按 docs/feasibility.md §7.1 阶段 A 落地最小可验证切片,
刻意不引入 embedding、不碰 L1 淘汰。
落地内容
- lib/store.js BlockStore:node:sqlite 建 memory_blocks /
memory_block_edges / graph_centroid 三表 + FTS5 索引。
内容派生 id(blk_+sha256[:12],移植 distill.BlockID);
putBlock 走「空值不覆盖」,重复 commit 幂等。
- lib/recall.js FTS5 bm25 + 精确串布尔置顶(移植 SymbolScore/fusion.go:427)、
单字符不成符号(abstain.go:115)、前缀特异性 tie-break、
CJK 2..4 字滑窗兜底(移植 cjkWindows/fusion.go:240)。
- lib/index.js StableMem service + systemPrompt.context 常驻索引 +
agent/pre-step 按本轮输入召回注入 + stablemem_commit 工具。
- scripts/checkpoints.js V1–V5 + 两条变异,对真实 cordis 服务跑。
- test/ 26 个测试(store / recall / plugin wiring / real loader / isolate)。
- scripts/link-dsh.sh 把全局 dsh 包软链进 node_modules(插件本身零依赖)。
三个实测出来的 dsh 约束(都是先红了才发现的)
1. cordis service 不能用 JS #private 字段 —— ctx.<name> 是 proxy,
访问私有字段抛 "Cannot read private member"。状态必须放普通属性。
2. isolate() 不隔离 prompt context 名与工具名(只隔离 service 查找)——
所以工具名做成可配置,prompt context 名由 db 路径派生以保唯一。
3. systemPrompt.getContextOrder() 是分配器不是常量表,用命名槽位。
验证
- npm test → 26/26 通过
- npm run check → 8/8 checkpoint 通过
V1 sqlite/WAL/100 写回读;V2 能力分层(tier1 30/30、tier2 20/20,
tier3/4 作为已知缺口显式记录);V3 AssembleContext 仅 [agent];
V3b 注入落进批次且带 source.kind;V3b† 静默召回则判据红;
V4 工具 schema+render 端到端;V5 fiber dispose 释放句柄并可重开;
A5† 退化成包含匹配则区分度消失。
阶段 A exit criteria 全部满足(含 V3/V3b 分工结论写入 README)。
参考仓 /home/program/TrueAgent 未改动。
53 lines
1.5 KiB
Bash
Executable File
53 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Link the globally-installed dsh packages into node_modules.
|
|
#
|
|
# The plugin itself has zero runtime dependencies (it uses only `node:` built-ins),
|
|
# so nothing is installed from a registry. The dsh packages are *peers*: they must
|
|
# come from the running harness. During development they live in
|
|
# /usr/lib/node_modules/@deepseek-ai (a global install), so this script wires them
|
|
# up by symlink instead of vendoring a copy that could drift from the harness.
|
|
#
|
|
# Usage: ./scripts/link-dsh.sh [global-modules-root]
|
|
set -euo pipefail
|
|
|
|
GLOBAL_ROOT="${1:-/usr/lib/node_modules}"
|
|
PEERS=(
|
|
cordis
|
|
cosmokit
|
|
dsh-llm
|
|
dsh-session
|
|
dsh-scope
|
|
dsh-system-prompt
|
|
dsh-tools
|
|
dsh-util-values
|
|
cordis-plugin-loader
|
|
)
|
|
|
|
cd "$(dirname "$0")/.."
|
|
|
|
if [[ ! -d "$GLOBAL_ROOT/@deepseek-ai" ]]; then
|
|
echo "error: $GLOBAL_ROOT/@deepseek-ai not found — pass the root that holds the dsh install" >&2
|
|
exit 1
|
|
fi
|
|
|
|
mkdir -p node_modules/@deepseek-ai
|
|
for peer in "${PEERS[@]}"; do
|
|
src="$GLOBAL_ROOT/@deepseek-ai/$peer"
|
|
if [[ ! -d "$src" ]]; then
|
|
echo " skip $peer (not installed)"
|
|
continue
|
|
fi
|
|
ln -sfn "$src" "node_modules/@deepseek-ai/$peer"
|
|
echo " link $peer"
|
|
done
|
|
|
|
# js-yaml is a transitive dep of cordis-plugin-include; needed only by the
|
|
# loader integration test, and only when it is not resolvable already.
|
|
if [[ -d "$GLOBAL_ROOT/js-yaml" && ! -e node_modules/js-yaml ]]; then
|
|
ln -sfn "$GLOBAL_ROOT/js-yaml" node_modules/js-yaml
|
|
echo " link js-yaml"
|
|
fi
|
|
|
|
echo
|
|
echo "done. try: npm test && npm run check"
|