@aliyunrds/ctxdb 0.0.8-beta.5 → 0.0.9-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/dist/{chunk-WBFP2KGQ.js → chunk-PZJZ5O62.js} +1 -1
- package/dist/{chunk-6PIRPPWU.js → chunk-RHWGDY6S.js} +2 -2
- package/dist/{chunk-R6TLOWVZ.js → chunk-TOXXGL5L.js} +1 -0
- package/dist/cli/main.js +26 -10
- package/dist/hooks/pre-tool-use.js +3 -1
- package/dist/hooks/session-start.js +6 -4
- package/dist/hooks/stop.js +5 -3
- package/dist/hooks/user-prompt-submit.js +6 -4
- package/package.json +1 -1
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
isConnectionError,
|
|
7
7
|
resetCircuit,
|
|
8
8
|
tripCircuit
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-PZJZ5O62.js";
|
|
10
10
|
import {
|
|
11
11
|
CtxdbError
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-TOXXGL5L.js";
|
|
13
13
|
|
|
14
14
|
// src/lib/recall-orchestrator.ts
|
|
15
15
|
import {
|
package/dist/cli/main.js
CHANGED
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
removeAgent,
|
|
32
32
|
save,
|
|
33
33
|
writeInstalledPkgVersion
|
|
34
|
-
} from "../chunk-
|
|
34
|
+
} from "../chunk-TOXXGL5L.js";
|
|
35
35
|
|
|
36
36
|
// src/cli/util.ts
|
|
37
37
|
var BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
|
|
@@ -1489,22 +1489,29 @@ import { fileURLToPath as fileURLToPath2 } from "url";
|
|
|
1489
1489
|
import { dirname as dirname2 } from "path";
|
|
1490
1490
|
var PACKAGE_NAME = "@aliyunrds/ctxdb";
|
|
1491
1491
|
var NPM_VIEW_TIMEOUT_MS = 1e4;
|
|
1492
|
+
function npmCommand(platform = process.platform) {
|
|
1493
|
+
return platform === "win32" ? "npm.cmd" : "npm";
|
|
1494
|
+
}
|
|
1495
|
+
function ctxdbCommand(platform = process.platform) {
|
|
1496
|
+
return platform === "win32" ? "ctxdb.cmd" : "ctxdb";
|
|
1497
|
+
}
|
|
1492
1498
|
function detectInstallMethod() {
|
|
1493
1499
|
const dir = dirname2(fileURLToPath2(import.meta.url));
|
|
1494
1500
|
return dir.includes("/node_modules/") || dir.includes("\\node_modules\\") ? "npm" : "unknown";
|
|
1495
1501
|
}
|
|
1496
1502
|
function checkLatestVersion(currentVersion) {
|
|
1497
|
-
const result = spawnSync(
|
|
1503
|
+
const result = spawnSync(npmCommand(), ["view", PACKAGE_NAME, "version"], {
|
|
1498
1504
|
encoding: "utf-8",
|
|
1499
1505
|
timeout: NPM_VIEW_TIMEOUT_MS,
|
|
1500
|
-
stdio: ["ignore", "pipe", "pipe"]
|
|
1506
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
1507
|
+
shell: process.platform === "win32"
|
|
1501
1508
|
});
|
|
1502
1509
|
if (result.status !== 0 || !result.stdout?.trim()) {
|
|
1503
1510
|
return {
|
|
1504
1511
|
latest: null,
|
|
1505
1512
|
current: currentVersion,
|
|
1506
1513
|
isNewer: false,
|
|
1507
|
-
error: result
|
|
1514
|
+
error: spawnFailureMessage(result, "npm view")
|
|
1508
1515
|
};
|
|
1509
1516
|
}
|
|
1510
1517
|
const latest = result.stdout.trim();
|
|
@@ -1514,6 +1521,13 @@ function checkLatestVersion(currentVersion) {
|
|
|
1514
1521
|
isNewer: isNewerVersion(latest, currentVersion)
|
|
1515
1522
|
};
|
|
1516
1523
|
}
|
|
1524
|
+
function spawnFailureMessage(result, commandLabel) {
|
|
1525
|
+
const stderr = result.stderr?.toString().trim();
|
|
1526
|
+
if (stderr) return stderr;
|
|
1527
|
+
if (result.error) return `${commandLabel} failed: ${result.error.message}`;
|
|
1528
|
+
if (result.signal) return `${commandLabel} terminated by signal ${result.signal}`;
|
|
1529
|
+
return `${commandLabel} exited with code ${result.status}`;
|
|
1530
|
+
}
|
|
1517
1531
|
function isNewerVersion(candidate, current) {
|
|
1518
1532
|
const parse = (v) => v.replace(/^v/, "").split(".").map(Number);
|
|
1519
1533
|
const [cMaj = 0, cMin = 0, cPat = 0] = parse(candidate);
|
|
@@ -1545,31 +1559,33 @@ function runSelfUpdate(currentVersion, passthroughArgs = []) {
|
|
|
1545
1559
|
}
|
|
1546
1560
|
process.stderr.write(`ctxdb: updating ${PACKAGE_NAME} v${currentVersion} \u2192 v${check.latest}...
|
|
1547
1561
|
`);
|
|
1548
|
-
const install = spawnSync(
|
|
1562
|
+
const install = spawnSync(npmCommand(), ["install", "-g", `${PACKAGE_NAME}@${check.latest}`], {
|
|
1549
1563
|
stdio: "inherit",
|
|
1550
|
-
encoding: "utf-8"
|
|
1564
|
+
encoding: "utf-8",
|
|
1565
|
+
shell: process.platform === "win32"
|
|
1551
1566
|
});
|
|
1552
1567
|
if (install.status !== 0) {
|
|
1553
1568
|
return {
|
|
1554
1569
|
ok: false,
|
|
1555
1570
|
updated: false,
|
|
1556
1571
|
fromVersion: currentVersion,
|
|
1557
|
-
error:
|
|
1572
|
+
error: spawnFailureMessage(install, "npm install -g")
|
|
1558
1573
|
};
|
|
1559
1574
|
}
|
|
1560
1575
|
process.stderr.write(`ctxdb: package updated to v${check.latest}, refreshing skills/hooks...
|
|
1561
1576
|
`);
|
|
1562
1577
|
const upgradeArgs = ["upgrade", ...passthroughArgs];
|
|
1563
|
-
const refresh = spawnSync(
|
|
1578
|
+
const refresh = spawnSync(ctxdbCommand(), upgradeArgs, {
|
|
1564
1579
|
stdio: "inherit",
|
|
1565
|
-
encoding: "utf-8"
|
|
1580
|
+
encoding: "utf-8",
|
|
1581
|
+
shell: process.platform === "win32"
|
|
1566
1582
|
});
|
|
1567
1583
|
return {
|
|
1568
1584
|
ok: refresh.status === 0,
|
|
1569
1585
|
updated: true,
|
|
1570
1586
|
fromVersion: currentVersion,
|
|
1571
1587
|
toVersion: check.latest,
|
|
1572
|
-
error: refresh.status !== 0 ?
|
|
1588
|
+
error: refresh.status !== 0 ? spawnFailureMessage(refresh, "ctxdb upgrade") : void 0
|
|
1573
1589
|
};
|
|
1574
1590
|
}
|
|
1575
1591
|
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import {
|
|
3
3
|
fetchKbCatalogBlock,
|
|
4
4
|
recallTurn
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-RHWGDY6S.js";
|
|
6
6
|
import "../chunk-6S5RJYBC.js";
|
|
7
7
|
import {
|
|
8
8
|
isCircuitOpen
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-PZJZ5O62.js";
|
|
10
10
|
import {
|
|
11
11
|
HttpClient,
|
|
12
12
|
agentFromArgvWithFallback,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
isComplete,
|
|
15
15
|
load,
|
|
16
16
|
setDebug
|
|
17
|
-
} from "../chunk-
|
|
17
|
+
} from "../chunk-TOXXGL5L.js";
|
|
18
18
|
|
|
19
19
|
// src/hooks/session-start.ts
|
|
20
20
|
import { pathToFileURL } from "url";
|
|
@@ -170,7 +170,9 @@ async function main() {
|
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
if (import.meta.url === pathToFileURL(process.argv[1] ?? "").href) {
|
|
173
|
-
main().then((code) =>
|
|
173
|
+
main().then((code) => {
|
|
174
|
+
process.exitCode = code;
|
|
175
|
+
});
|
|
174
176
|
}
|
|
175
177
|
export {
|
|
176
178
|
HOOK_TIMEOUT_MS,
|
package/dist/hooks/stop.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
isConnectionError,
|
|
5
5
|
resetCircuit,
|
|
6
6
|
tripCircuit
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-PZJZ5O62.js";
|
|
8
8
|
import {
|
|
9
9
|
CtxdbError,
|
|
10
10
|
HttpClient,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
isDebug,
|
|
14
14
|
load,
|
|
15
15
|
setDebug
|
|
16
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-TOXXGL5L.js";
|
|
17
17
|
|
|
18
18
|
// src/lib/capture-orchestrator.ts
|
|
19
19
|
import {
|
|
@@ -543,4 +543,6 @@ async function main() {
|
|
|
543
543
|
return 0;
|
|
544
544
|
}
|
|
545
545
|
}
|
|
546
|
-
main().then((code) =>
|
|
546
|
+
main().then((code) => {
|
|
547
|
+
process.exitCode = code;
|
|
548
|
+
});
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import {
|
|
3
3
|
fetchKbCatalogBlock,
|
|
4
4
|
recallTurn
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-RHWGDY6S.js";
|
|
6
6
|
import "../chunk-6S5RJYBC.js";
|
|
7
7
|
import {
|
|
8
8
|
isCircuitOpen
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-PZJZ5O62.js";
|
|
10
10
|
import {
|
|
11
11
|
HttpClient,
|
|
12
12
|
agentFromArgvWithFallback,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
isComplete,
|
|
15
15
|
load,
|
|
16
16
|
setDebug
|
|
17
|
-
} from "../chunk-
|
|
17
|
+
} from "../chunk-TOXXGL5L.js";
|
|
18
18
|
|
|
19
19
|
// src/hooks/user-prompt-submit.ts
|
|
20
20
|
import { pathToFileURL } from "url";
|
|
@@ -97,7 +97,9 @@ async function main() {
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
if (import.meta.url === pathToFileURL(process.argv[1] ?? "").href) {
|
|
100
|
-
main().then((code) =>
|
|
100
|
+
main().then((code) => {
|
|
101
|
+
process.exitCode = code;
|
|
102
|
+
});
|
|
101
103
|
}
|
|
102
104
|
export {
|
|
103
105
|
composeUserPromptSubmit,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aliyunrds/ctxdb",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9-beta.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Unified access layer for RDS ContextDatabase: `ctxdb` CLI (memory + KB ops), one-shot `setup --agent <qoder|codex|claude>` installer, per-agent config, hooks, and SKILL.md.",
|
|
6
6
|
"license": "Apache-2.0",
|