@modusensus/dsh-mneme 0.7.31 → 0.8.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 +65 -27
- package/lib/api.js +139 -6
- package/lib/client.js +369 -32
- package/lib/commands.js +36 -5
- package/lib/config.js +101 -14
- package/lib/dream/decisions.js +147 -14
- package/lib/dream/sleep.js +84 -34
- package/lib/dream.js +250 -60
- package/lib/embedding.js +22 -2
- package/lib/index.js +68 -37
- package/lib/inject.js +54 -13
- package/lib/lang.js +168 -0
- package/lib/local-embedder.js +23 -9
- package/lib/mirror.js +17 -14
- package/lib/reranker.js +23 -8
- package/lib/runtime/adopt.js +176 -0
- package/lib/runtime/closure.js +172 -0
- package/lib/runtime/download.js +247 -0
- package/lib/runtime/layout.js +235 -0
- package/lib/runtime/loader.js +249 -0
- package/lib/runtime/provision.js +237 -0
- package/lib/runtime/tarball.js +130 -0
- package/lib/runtime/verify.js +191 -0
- package/lib/scope.js +83 -0
- package/lib/service.js +374 -55
- package/lib/settings.js +43 -2
- package/lib/store.js +126 -13
- package/lib/summarize.js +108 -35
- package/lib/tools.js +205 -12
- package/package.json +7 -2
- package/runtime-manifest.json +596 -0
- package/scripts/build-runtime-manifest.mjs +217 -0
- package/scripts/mneme-runtime.mjs +277 -0
- package/src/api.js +139 -6
- package/src/commands.js +36 -5
- package/src/config.js +101 -14
- package/src/dream/decisions.js +147 -14
- package/src/dream/sleep.js +84 -34
- package/src/dream.js +250 -60
- package/src/embedding.js +22 -2
- package/src/index.js +68 -37
- package/src/inject.js +54 -13
- package/src/lang.js +168 -0
- package/src/local-embedder.js +23 -9
- package/src/mirror.js +17 -14
- package/src/reranker.js +23 -8
- package/src/runtime/adopt.js +176 -0
- package/src/runtime/closure.js +172 -0
- package/src/runtime/download.js +247 -0
- package/src/runtime/layout.js +235 -0
- package/src/runtime/loader.js +249 -0
- package/src/runtime/provision.js +237 -0
- package/src/runtime/tarball.js +130 -0
- package/src/runtime/verify.js +191 -0
- package/src/scope.js +83 -0
- package/src/service.js +374 -55
- package/src/settings.js +43 -2
- package/src/store.js +126 -13
- package/src/summarize.js +108 -35
- package/src/tools.js +205 -12
- package/test/api.test.js +175 -9
- package/test/client.test.js +152 -10
- package/test/commands.test.js +40 -3
- package/test/config.test.js +17 -1
- package/test/dream-candidate-hybrid.test.js +281 -0
- package/test/dream.test.js +172 -0
- package/test/embedding-ready.test.js +196 -0
- package/test/helpers/runtime-source.js +60 -0
- package/test/helpers/tar-builder.js +80 -0
- package/test/inject.test.js +130 -1
- package/test/lang.test.js +87 -0
- package/test/quality-filter.test.js +68 -0
- package/test/reasoning-effort.test.js +106 -15
- package/test/reindex-backfill.test.js +62 -0
- package/test/runtime-adopt.test.js +206 -0
- package/test/runtime-cli.test.js +89 -0
- package/test/runtime-closure.test.js +193 -0
- package/test/runtime-download.test.js +302 -0
- package/test/runtime-layout.test.js +163 -0
- package/test/runtime-loader.test.js +237 -0
- package/test/runtime-manifest.test.js +158 -0
- package/test/runtime-provision.test.js +101 -0
- package/test/runtime-tarball.test.js +82 -0
- package/test/runtime-verify.test.js +214 -0
- package/test/scope-retrieval.test.js +197 -0
- package/test/scope-storage.test.js +247 -0
- package/test/scope-strict.test.js +165 -0
- package/test/service.test.js +76 -0
- package/test/sleep-action-set.test.js +422 -0
- package/test/store.test.js +14 -0
- package/test/summarize.test.js +224 -0
- package/test/tools.test.js +30 -5
- package/test/webServer-optional.test.js +34 -1
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import test from "node:test";
|
|
2
|
+
import assert from "node:assert/strict";
|
|
3
|
+
import { mkdirSync, mkdtempSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
import { DEFAULT_PROBE_TEXTS, defaultEngine, verifyFunctional, verifyPayload } from "../src/runtime/verify.js";
|
|
7
|
+
import { TRANSFORMERS_ENTRY } from "../src/runtime/layout.js";
|
|
8
|
+
import { pathToFileURL } from "node:url";
|
|
9
|
+
|
|
10
|
+
// 验证三件套(issue #131 / PR-A)。重点不是「能跑通」,而是「坏的那几种能被抓住」:
|
|
11
|
+
// 结构对但原生二进制与本机不匹配、返回非归一化向量、向量退化、加载直接抛——
|
|
12
|
+
// 这些都必须变成一条可读的失败结论,而不是让调用方拿到一个假的 ok。
|
|
13
|
+
|
|
14
|
+
/** 造一个结构上合法的 payload(只有形状,没有真东西)。 */
|
|
15
|
+
function makePayload({ platform = "win32", arch = "x64", withEntry = true } = {}) {
|
|
16
|
+
const dir = mkdtempSync(join(tmpdir(), "mneme-verify-"));
|
|
17
|
+
const write = (rel, body) => {
|
|
18
|
+
const full = join(dir, rel);
|
|
19
|
+
mkdirSync(join(full, ".."), { recursive: true });
|
|
20
|
+
writeFileSync(full, body);
|
|
21
|
+
};
|
|
22
|
+
for (const name of ["@huggingface/transformers", "onnxruntime-node", "sharp"]) {
|
|
23
|
+
write(join("node_modules", name, "package.json"), JSON.stringify({ name, version: name === "@huggingface/transformers" ? "4.2.0" : "1.0.0" }));
|
|
24
|
+
}
|
|
25
|
+
if (withEntry) write(TRANSFORMERS_ENTRY, "export const x = 1;\n");
|
|
26
|
+
mkdirSync(join(dir, "node_modules", "onnxruntime-node", "bin", "napi-v6", platform, arch), { recursive: true });
|
|
27
|
+
return dir;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** 归一化的假向量:`rows` 行,每行 dim 维,方向由 seed 决定。 */
|
|
31
|
+
function fakeRows(rows, dim, seed = 0) {
|
|
32
|
+
return Array.from({ length: rows }, (_, r) => {
|
|
33
|
+
const v = Array.from({ length: dim }, (_, i) => Math.sin((i + 1) * (r + 1 + seed)));
|
|
34
|
+
const length = Math.hypot(...v);
|
|
35
|
+
return v.map((x) => x / length);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** 注入一个「什么都能返回」的 engine。 */
|
|
40
|
+
function engineReturning(value) {
|
|
41
|
+
return async () => async () => value;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
test("功能验证:正常的向量通过,并报出维度与耗时", async () => {
|
|
45
|
+
const result = await verifyFunctional("/whatever", { engine: engineReturning(fakeRows(2, 512)) });
|
|
46
|
+
assert.equal(result.ok, true, result.reason);
|
|
47
|
+
assert.equal(result.dim, 512);
|
|
48
|
+
assert.equal(result.rows, 2);
|
|
49
|
+
assert.ok(result.elapsedMs >= 0);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test("功能验证:行数不符要报出来(而不是只取第一行当作通过)", async () => {
|
|
53
|
+
const result = await verifyFunctional("/whatever", { engine: engineReturning(fakeRows(1, 512)) });
|
|
54
|
+
assert.equal(result.ok, false);
|
|
55
|
+
assert.match(result.reason, /返回行数不符/);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
test("功能验证:非归一化向量要报出来(说明 normalize 没生效)", async () => {
|
|
59
|
+
const rows = fakeRows(2, 8).map((row) => row.map((x) => x * 3));
|
|
60
|
+
const result = await verifyFunctional("/whatever", { engine: engineReturning(rows) });
|
|
61
|
+
assert.equal(result.ok, false);
|
|
62
|
+
assert.match(result.reason, /不是 L2 归一化/);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
test("功能验证:向量退化成同一方向要报出来", async () => {
|
|
66
|
+
const one = fakeRows(1, 16)[0];
|
|
67
|
+
const result = await verifyFunctional("/whatever", { engine: engineReturning([one, one]) });
|
|
68
|
+
assert.equal(result.ok, false);
|
|
69
|
+
assert.match(result.reason, /嵌入退化/);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
test("功能验证:加载失败与推理失败分别给出不同措辞", async () => {
|
|
73
|
+
const loadFail = await verifyFunctional("/whatever", {
|
|
74
|
+
engine: async () => {
|
|
75
|
+
throw new Error("Cannot find package 'onnxruntime-node'");
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
assert.equal(loadFail.ok, false);
|
|
79
|
+
assert.match(loadFail.reason, /加载运行时失败/);
|
|
80
|
+
assert.match(loadFail.reason, /onnxruntime-node/);
|
|
81
|
+
|
|
82
|
+
const embedFail = await verifyFunctional("/whatever", {
|
|
83
|
+
engine: async () => async () => {
|
|
84
|
+
throw new Error("boom");
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
assert.equal(embedFail.ok, false);
|
|
88
|
+
assert.match(embedFail.reason, /推理失败/);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
test("功能验证:返回空向量要报出来,而不是当成 dim=0 通过", async () => {
|
|
92
|
+
const result = await verifyFunctional("/whatever", { engine: engineReturning([[], []]) });
|
|
93
|
+
assert.equal(result.ok, false);
|
|
94
|
+
assert.match(result.reason, /空向量/);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
test("三件套:结构不过就不再做功能验证(省掉一次无谓的加载)", async () => {
|
|
98
|
+
const dir = makePayload({ withEntry: false });
|
|
99
|
+
let engineCalled = false;
|
|
100
|
+
const result = await verifyPayload(dir, {
|
|
101
|
+
platform: "win32",
|
|
102
|
+
arch: "x64",
|
|
103
|
+
engine: async () => {
|
|
104
|
+
engineCalled = true;
|
|
105
|
+
return async () => fakeRows(2, 8);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
assert.equal(result.ok, false);
|
|
109
|
+
assert.equal(result.functional.ok, false);
|
|
110
|
+
assert.match(result.functional.reason, /跳过功能验证/);
|
|
111
|
+
assert.equal(engineCalled, false);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
test("三件套:结构 + 功能都过、完整性缺失时如实标 unverified 且不判定失败", async () => {
|
|
115
|
+
const dir = makePayload();
|
|
116
|
+
const result = await verifyPayload(dir, {
|
|
117
|
+
platform: "win32",
|
|
118
|
+
arch: "x64",
|
|
119
|
+
engine: engineReturning(fakeRows(2, 8))
|
|
120
|
+
});
|
|
121
|
+
assert.equal(result.ok, true);
|
|
122
|
+
assert.equal(result.integrity.status, "unverified");
|
|
123
|
+
assert.equal(result.integrity.ok, true);
|
|
124
|
+
assert.equal(result.version, "4.2.0");
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
test("三件套:--strict 场景下哈希不匹配即整体不通过", async () => {
|
|
128
|
+
const dir = makePayload();
|
|
129
|
+
const matched = await verifyPayload(dir, {
|
|
130
|
+
platform: "win32",
|
|
131
|
+
arch: "x64",
|
|
132
|
+
engine: engineReturning(fakeRows(2, 8)),
|
|
133
|
+
integrity: { status: "sha512-matched", detail: "tarball 比对通过" }
|
|
134
|
+
});
|
|
135
|
+
assert.equal(matched.ok, true);
|
|
136
|
+
assert.equal(matched.integrity.status, "sha512-matched");
|
|
137
|
+
|
|
138
|
+
const mismatch = await verifyPayload(dir, {
|
|
139
|
+
platform: "win32",
|
|
140
|
+
arch: "x64",
|
|
141
|
+
engine: engineReturning(fakeRows(2, 8)),
|
|
142
|
+
integrity: { status: "sha512-mismatch", detail: "与钉死的哈希不一致" }
|
|
143
|
+
});
|
|
144
|
+
assert.equal(mismatch.ok, false);
|
|
145
|
+
assert.equal(mismatch.structural.ok, true, "结构仍然是对的,失败来自完整性");
|
|
146
|
+
assert.equal(mismatch.functional.ok, true);
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
test("假通过防线 ①:行不是数组时返回失败,而不是抛异常", async () => {
|
|
150
|
+
// 契约是「任何失败都返回结果对象,不抛」;非数组行会让 .length/.some 直接抛。
|
|
151
|
+
const dir = makePayload();
|
|
152
|
+
const result = await verifyPayload(dir, {
|
|
153
|
+
platform: "win32",
|
|
154
|
+
arch: "x64",
|
|
155
|
+
engine: engineReturning([null, null])
|
|
156
|
+
});
|
|
157
|
+
assert.equal(result.ok, false);
|
|
158
|
+
assert.match(result.functional.reason, /不是数组/);
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
test("假通过防线 ②:非有限数值必须判失败(NaN 的比较恒为 false,会静默通过)", async () => {
|
|
162
|
+
const dir = makePayload();
|
|
163
|
+
for (const bad of [[NaN, 0], [Infinity, 0], ["0.5", "0.5"]]) {
|
|
164
|
+
const result = await verifyPayload(dir, {
|
|
165
|
+
platform: "win32",
|
|
166
|
+
arch: "x64",
|
|
167
|
+
engine: engineReturning([bad, [0, 0]])
|
|
168
|
+
});
|
|
169
|
+
assert.equal(result.ok, false, `含 ${JSON.stringify(bad)} 的向量不该被判通过`);
|
|
170
|
+
assert.match(result.functional.reason, /非有限数值/);
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
test("默认 engine 是导出的函数,且探针文本固定(改它等于改验收标准)", () => {
|
|
175
|
+
assert.equal(typeof defaultEngine, "function");
|
|
176
|
+
assert.deepEqual(DEFAULT_PROBE_TEXTS, ["猫咪喜欢晒太阳", "the quick brown fox"]);
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
// ── defaultEngine:注入假 transformers 模块,钉住「真 import + 行切分」的契约 ──
|
|
180
|
+
|
|
181
|
+
/** 造一个假 transformers 入口:export env + pipeline,把收到的参数记到 globalThis。 */
|
|
182
|
+
function fakeEntry(dims) {
|
|
183
|
+
const dir = mkdtempSync(join(tmpdir(), "mneme-engine-"));
|
|
184
|
+
const entry = join(dir, "entry.mjs");
|
|
185
|
+
writeFileSync(entry, `
|
|
186
|
+
export const env = {};
|
|
187
|
+
export async function pipeline(kind, model, opts) {
|
|
188
|
+
globalThis.__engineSeen = { kind, model, opts, cacheDir: env.cacheDir, remote: env.allowRemoteModels };
|
|
189
|
+
const d = ${JSON.stringify(dims)};
|
|
190
|
+
const data = Float32Array.from({ length: d[0] * d[1] }, (_, i) => i + 1);
|
|
191
|
+
return async () => ({ dims: d, data });
|
|
192
|
+
}
|
|
193
|
+
`);
|
|
194
|
+
return pathToFileURL(entry).href;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
test("defaultEngine: 假 transformers 入口可驱动嵌入,并按输出维度做行切分", async () => {
|
|
198
|
+
const entry = fakeEntry([2, 4]);
|
|
199
|
+
const embed = await defaultEngine(entry, { cacheDir: "/tmp/mneme-cache" });
|
|
200
|
+
const rows = await embed(["猫咪", "fox"]);
|
|
201
|
+
assert.equal(rows.length, 2);
|
|
202
|
+
assert.deepEqual(rows[0], [1, 2, 3, 4]);
|
|
203
|
+
assert.deepEqual(rows[1], [5, 6, 7, 8]);
|
|
204
|
+
// 缓存目录与离线开关必须落到 env:验证过程绝不能偷偷下载模型。
|
|
205
|
+
assert.equal(globalThis.__engineSeen.cacheDir, "/tmp/mneme-cache");
|
|
206
|
+
assert.equal(globalThis.__engineSeen.remote, false);
|
|
207
|
+
assert.equal(globalThis.__engineSeen.kind, "feature-extraction");
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
test("defaultEngine: 输出宽度为 0 时明确抛错(防止调用方死循环)", async () => {
|
|
211
|
+
const entry = fakeEntry([2, 0]);
|
|
212
|
+
const embed = await defaultEngine(entry, {});
|
|
213
|
+
await assert.rejects(() => embed(["x"]), /维度不可用/);
|
|
214
|
+
});
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import test from "node:test";
|
|
2
|
+
import assert from "node:assert/strict";
|
|
3
|
+
import { createStore } from "../src/store.js";
|
|
4
|
+
import { createService } from "../src/service.js";
|
|
5
|
+
import { createTools } from "../src/tools.js";
|
|
6
|
+
|
|
7
|
+
// v0.8.0 A2(issue #17):检索加权 + occurred_at 时间过滤。
|
|
8
|
+
// 当前 scope 加成、他 scope 降权但保留可见;occurred 窗在 store.list/count 与
|
|
9
|
+
// 搜索融合池两处同口径(COALESCE 回退 created_at)。
|
|
10
|
+
|
|
11
|
+
test("store.list/count filter by occurred_at with created_at fallback", () => {
|
|
12
|
+
const store = createStore(":memory:");
|
|
13
|
+
store.save({ type: "project", title: "aug", content: "x", occurred_at: "2026-08-15T00:00:00Z" });
|
|
14
|
+
store.save({ type: "project", title: "sep", content: "x", occurred_at: "2026-09-01T00:00:00Z" });
|
|
15
|
+
// 未标注 occurred_at → 回退 created_at(今天,2026-09-13)参与比较。
|
|
16
|
+
store.save({ type: "project", title: "legacy", content: "x" });
|
|
17
|
+
|
|
18
|
+
const aug = store.list({ occurredFrom: "2026-08-01", occurredTo: "2026-08-31" });
|
|
19
|
+
assert.deepEqual(aug.map((m) => m.title), ["aug"]);
|
|
20
|
+
assert.equal(store.count("project", { occurredFrom: "2026-08-01", occurredTo: "2026-08-31" }), 1);
|
|
21
|
+
|
|
22
|
+
// 回退方向:窗口从「今天」起(日期从刚写入行的 created_at 推导,不依赖
|
|
23
|
+
// 测试机时钟/时区),未标注行靠 created_at 落入;sep 的 occurred 是月初,
|
|
24
|
+
// 在窗口外。
|
|
25
|
+
const legacyRow = store.list({}).find((m) => m.title === "legacy");
|
|
26
|
+
const today = legacyRow.created_at.slice(0, 10);
|
|
27
|
+
const sinceToday = store.list({ occurredFrom: today }).map((m) => m.title);
|
|
28
|
+
assert.deepEqual(sinceToday, ["legacy"]);
|
|
29
|
+
|
|
30
|
+
// 非法边界值被忽略(不进 WHERE),三行都在。
|
|
31
|
+
assert.equal(store.list({ occurredFrom: "garbage", occurredTo: 42 }).length, 3);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test("service.list/count pass the occurred window through", () => {
|
|
35
|
+
const store = createStore(":memory:");
|
|
36
|
+
const service = createService({ store, mirror: null, config: {} });
|
|
37
|
+
store.save({ type: "decision", title: "old", content: "x", occurred_at: "2026-01-10T00:00:00Z" });
|
|
38
|
+
store.save({ type: "decision", title: "new", content: "x", occurred_at: "2026-06-10T00:00:00Z" });
|
|
39
|
+
const rows = service.list({ occurredFrom: "2026-06-01" });
|
|
40
|
+
assert.deepEqual(rows.map((m) => m.title), ["new"]);
|
|
41
|
+
assert.equal(service.count("decision", { occurredFrom: "2026-06-01" }), 1);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test("searchMemories applies the occurred window to the fused pool", async () => {
|
|
45
|
+
const store = createStore(":memory:");
|
|
46
|
+
const service = createService({ store, mirror: null, config: {} });
|
|
47
|
+
store.save({ type: "project", title: "needle aug", content: "hit", occurred_at: "2026-08-15T00:00:00Z" });
|
|
48
|
+
store.save({ type: "project", title: "needle legacy", content: "hit" });
|
|
49
|
+
|
|
50
|
+
const all = await service.searchMemories("needle", { mode: "keyword" });
|
|
51
|
+
assert.equal(all.length, 2);
|
|
52
|
+
|
|
53
|
+
const windowed = await service.searchMemories("needle", {
|
|
54
|
+
mode: "keyword",
|
|
55
|
+
occurredFrom: "2026-08-01",
|
|
56
|
+
occurredTo: "2026-08-31"
|
|
57
|
+
});
|
|
58
|
+
assert.deepEqual(windowed.map((m) => m.title), ["needle aug"]);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test("searchMemories scope weighting: current scope boosted, foreign demoted but visible", async () => {
|
|
62
|
+
const store = createStore(":memory:");
|
|
63
|
+
const service = createService({ store, mirror: null, config: { scopeEnabled: true } });
|
|
64
|
+
// 打分构造(scoreKeyword:标题命中 1 × 0.8,正文命中 0.6 × 0.8):
|
|
65
|
+
// 无加权时 alpha (0.8) 排在 beta (0.48) 前。
|
|
66
|
+
store.save({ type: "project", title: "alpha needle", content: "x", agent_scope: "coder" });
|
|
67
|
+
store.save({ type: "project", title: "beta", content: "needle", agent_scope: "novelist" });
|
|
68
|
+
|
|
69
|
+
// 当前会话是 novelist:beta 命中 ×1.25=0.6,alpha 他 scope ×0.5=0.4 → 翻转,
|
|
70
|
+
// 但 alpha 仍可见(降权不是过滤)。
|
|
71
|
+
const weighted = await service.searchMemories("needle", {
|
|
72
|
+
mode: "keyword",
|
|
73
|
+
scope: { agent_scope: "novelist", workspace_scope: null }
|
|
74
|
+
});
|
|
75
|
+
assert.deepEqual(weighted.map((m) => m.title), ["beta", "alpha needle"]);
|
|
76
|
+
|
|
77
|
+
// 无 scope 传参 → 不动分,保持基线排序。
|
|
78
|
+
const neutral = await service.searchMemories("needle", { mode: "keyword" });
|
|
79
|
+
assert.deepEqual(neutral.map((m) => m.title), ["alpha needle", "beta"]);
|
|
80
|
+
|
|
81
|
+
// scope 全 NULL(解析不出)→ 同样不动分。
|
|
82
|
+
const nullScope = await service.searchMemories("needle", {
|
|
83
|
+
mode: "keyword",
|
|
84
|
+
scope: { agent_scope: null, workspace_scope: null }
|
|
85
|
+
});
|
|
86
|
+
assert.deepEqual(nullScope.map((m) => m.title), ["alpha needle", "beta"]);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
test("searchMemories weighting is off entirely when the flag is off", async () => {
|
|
90
|
+
const store = createStore(":memory:");
|
|
91
|
+
const service = createService({ store, mirror: null, config: {} });
|
|
92
|
+
store.save({ type: "project", title: "alpha needle", content: "x", agent_scope: "coder" });
|
|
93
|
+
store.save({ type: "project", title: "beta", content: "needle", agent_scope: "novelist" });
|
|
94
|
+
const rows = await service.searchMemories("needle", {
|
|
95
|
+
mode: "keyword",
|
|
96
|
+
scope: { agent_scope: "novelist", workspace_scope: null }
|
|
97
|
+
});
|
|
98
|
+
assert.deepEqual(rows.map((m) => m.title), ["alpha needle", "beta"]);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
test("unscoped rows rank with matched rows under weighting (never suppressed)", async () => {
|
|
102
|
+
const store = createStore(":memory:");
|
|
103
|
+
const service = createService({ store, mirror: null, config: { scopeEnabled: true } });
|
|
104
|
+
store.save({ type: "project", title: "global needle", content: "x" });
|
|
105
|
+
store.save({ type: "project", title: "foreign", content: "needle", agent_scope: "someone-else" });
|
|
106
|
+
const rows = await service.searchMemories("needle", {
|
|
107
|
+
mode: "keyword",
|
|
108
|
+
scope: { agent_scope: "me", workspace_scope: null }
|
|
109
|
+
});
|
|
110
|
+
// 未标注行与命中行同列吃 BOOST(×1.25),foreign 行 ×0.5——不被任何会话压掉。
|
|
111
|
+
assert.deepEqual(rows.map((m) => m.title), ["global needle", "foreign"]);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
function setupTools(config) {
|
|
115
|
+
const store = createStore(":memory:");
|
|
116
|
+
const service = createService({ store, mirror: null, config });
|
|
117
|
+
const registered = [];
|
|
118
|
+
createTools(
|
|
119
|
+
{ tools: { register(def) { registered.push(def); return () => {}; } } },
|
|
120
|
+
service,
|
|
121
|
+
config
|
|
122
|
+
);
|
|
123
|
+
const pick = (name) => registered.find((def) => def.name === name);
|
|
124
|
+
return { store, service, pick };
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
async function runHandler(def, args, exec) {
|
|
128
|
+
const handler = def.execute.bind(def);
|
|
129
|
+
return handler(args, exec);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
test("toApiList surfaces scope annotation and occurred_at", () => {
|
|
133
|
+
const store = createStore(":memory:");
|
|
134
|
+
const service = createService({ store, mirror: null, config: {} });
|
|
135
|
+
store.save({
|
|
136
|
+
type: "pitfall",
|
|
137
|
+
title: "stamped",
|
|
138
|
+
content: "x",
|
|
139
|
+
agent_scope: "coder",
|
|
140
|
+
workspace_scope: "D:\\proj",
|
|
141
|
+
sensitivity: "personal",
|
|
142
|
+
occurred_at: "2026-09-12T08:00:00Z"
|
|
143
|
+
});
|
|
144
|
+
const [row] = service.toApiList([store.getById(
|
|
145
|
+
service.list({}).find((m) => m.title === "stamped").id
|
|
146
|
+
)]);
|
|
147
|
+
assert.equal(row.agent_scope, "coder");
|
|
148
|
+
assert.equal(row.workspace_scope, "D:\\proj");
|
|
149
|
+
assert.equal(row.sensitivity, "personal");
|
|
150
|
+
assert.equal(row.occurred_at, "2026-09-12T08:00:00.000Z");
|
|
151
|
+
// 未标注行四字段为 undefined(JSON 序列化时省略)。
|
|
152
|
+
store.save({ type: "pitfall", title: "plain", content: "x" });
|
|
153
|
+
const [plain] = service.toApiList([service.list({}).find((m) => m.title === "plain")]);
|
|
154
|
+
assert.equal(plain.agent_scope, undefined);
|
|
155
|
+
assert.equal(plain.occurred_at, undefined);
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
test("memory_search passes the session scope and occurred window through", async () => {
|
|
159
|
+
const { store, pick } = setupTools({ scopeEnabled: true });
|
|
160
|
+
store.save({ type: "project", title: "alpha needle", content: "x", agent_scope: "coder" });
|
|
161
|
+
store.save({
|
|
162
|
+
type: "project", title: "beta", content: "needle", agent_scope: "novelist",
|
|
163
|
+
occurred_at: "2026-08-15T00:00:00Z"
|
|
164
|
+
});
|
|
165
|
+
const search = pick("memory_search");
|
|
166
|
+
const exec = { agent: { session: { id: "s1", header: { agentPreset: "novelist", cwd: "D:\\p" } } } };
|
|
167
|
+
const args = { query: "needle", occurred_from: "2026-08-01", occurred_to: "2026-08-31" };
|
|
168
|
+
const out = await runHandler(search, args, exec);
|
|
169
|
+
// 窗口内只剩 beta;其 agent_scope 命中当前会话(novelist),标注随行透出。
|
|
170
|
+
assert.equal(out.items.length, 1);
|
|
171
|
+
assert.equal(out.items[0].title, "beta");
|
|
172
|
+
assert.equal(out.items[0].agent_scope, "novelist");
|
|
173
|
+
assert.equal(out.items[0].occurred_at, "2026-08-15T00:00:00.000Z");
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
test("memory_list filters by the occurred window and keeps total consistent", async () => {
|
|
177
|
+
const { store, pick } = setupTools({});
|
|
178
|
+
store.save({ type: "decision", title: "old", content: "x", occurred_at: "2026-01-10T00:00:00Z" });
|
|
179
|
+
store.save({ type: "decision", title: "new", content: "x", occurred_at: "2026-06-10T00:00:00Z" });
|
|
180
|
+
const list = pick("memory_list");
|
|
181
|
+
const args = { type: "decision", occurred_from: "2026-06-01" };
|
|
182
|
+
const out = await runHandler(list, args, undefined);
|
|
183
|
+
assert.deepEqual(out.items.map((m) => m.title), ["new"]);
|
|
184
|
+
assert.equal(out.total, 1);
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
test("memory_get returns scope annotation and occurred_at", async () => {
|
|
188
|
+
const { store, pick } = setupTools({});
|
|
189
|
+
const saved = store.save({
|
|
190
|
+
type: "pitfall", title: "t", content: "c",
|
|
191
|
+
agent_scope: "coder", occurred_at: "2026-09-12T08:00:00Z"
|
|
192
|
+
});
|
|
193
|
+
const get = pick("memory_get");
|
|
194
|
+
const out = await runHandler(get, { id: saved.id }, undefined);
|
|
195
|
+
assert.equal(out.memory.agent_scope, "coder");
|
|
196
|
+
assert.equal(out.memory.occurred_at, "2026-09-12T08:00:00.000Z");
|
|
197
|
+
});
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import test from "node:test";
|
|
2
|
+
import assert from "node:assert/strict";
|
|
3
|
+
import { createStore } from "../src/store.js";
|
|
4
|
+
import { createService } from "../src/service.js";
|
|
5
|
+
import { createTools } from "../src/tools.js";
|
|
6
|
+
import { createScopeResolver } from "../src/scope.js";
|
|
7
|
+
|
|
8
|
+
// v0.8.0 A1(issue #17):scope 隔离存储层。
|
|
9
|
+
// 四列可空(agent_scope/workspace_scope/sensitivity/occurred_at)、迁移纯增量
|
|
10
|
+
// 不带 DEFAULT;写入标注走 scopeEnabled 门控;去重键扩展 (type, title, scope…)。
|
|
11
|
+
|
|
12
|
+
test("migration adds four nullable scope columns without defaults", () => {
|
|
13
|
+
const store = createStore(":memory:");
|
|
14
|
+
const cols = store.db.prepare("PRAGMA table_info(memories)").all();
|
|
15
|
+
for (const name of ["agent_scope", "workspace_scope", "sensitivity", "occurred_at"]) {
|
|
16
|
+
const col = cols.find((c) => c.name === name);
|
|
17
|
+
assert.ok(col, `column ${name} should exist`);
|
|
18
|
+
assert.equal(col.notnull, 0, `${name} must be nullable`);
|
|
19
|
+
assert.equal(col.dflt_value, null, `${name} must not carry a DEFAULT (存量零重写)`);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test("rows written without scope fields read back unscoped (legacy semantics)", () => {
|
|
24
|
+
const store = createStore(":memory:");
|
|
25
|
+
const row = store.save({ type: "project", title: "legacy shape", content: "body" });
|
|
26
|
+
assert.equal(row.agent_scope, undefined);
|
|
27
|
+
assert.equal(row.workspace_scope, undefined);
|
|
28
|
+
assert.equal(row.sensitivity, undefined);
|
|
29
|
+
assert.equal(row.occurred_at, undefined);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test("store.save persists and normalizes scope fields; dirty input lands as NULL", () => {
|
|
33
|
+
const store = createStore(":memory:");
|
|
34
|
+
const kept = store.save({
|
|
35
|
+
type: "project",
|
|
36
|
+
title: "scoped",
|
|
37
|
+
content: "c",
|
|
38
|
+
agent_scope: " coder-agent ",
|
|
39
|
+
workspace_scope: "D:\\proj",
|
|
40
|
+
sensitivity: "personal",
|
|
41
|
+
occurred_at: "2026-09-13T10:00:00+08:00"
|
|
42
|
+
});
|
|
43
|
+
assert.equal(kept.agent_scope, "coder-agent");
|
|
44
|
+
assert.equal(kept.workspace_scope, "D:\\proj");
|
|
45
|
+
assert.equal(kept.sensitivity, "personal");
|
|
46
|
+
// 时区归一:A2 的时间过滤按 ISO 字典序直接比较。
|
|
47
|
+
assert.equal(kept.occurred_at, "2026-09-13T02:00:00.000Z");
|
|
48
|
+
|
|
49
|
+
const dirty = store.save({
|
|
50
|
+
type: "project",
|
|
51
|
+
title: "dirty",
|
|
52
|
+
content: "c",
|
|
53
|
+
agent_scope: " ",
|
|
54
|
+
workspace_scope: 42,
|
|
55
|
+
sensitivity: "",
|
|
56
|
+
occurred_at: "not-a-date"
|
|
57
|
+
});
|
|
58
|
+
assert.equal(dirty.agent_scope, undefined);
|
|
59
|
+
assert.equal(dirty.workspace_scope, undefined);
|
|
60
|
+
assert.equal(dirty.sensitivity, undefined);
|
|
61
|
+
assert.equal(dirty.occurred_at, undefined);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test("store.update keeps scope columns untouched (write-time annotation is immutable)", () => {
|
|
65
|
+
const store = createStore(":memory:");
|
|
66
|
+
const saved = store.save({ type: "decision", title: "t", content: "old", agent_scope: "a1", workspace_scope: "w1" });
|
|
67
|
+
store.update(saved.id, { content: "new", importance: 4 });
|
|
68
|
+
const row = store.getById(saved.id);
|
|
69
|
+
assert.equal(row.content, "new");
|
|
70
|
+
assert.equal(row.agent_scope, "a1");
|
|
71
|
+
assert.equal(row.workspace_scope, "w1");
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
test("scopeEnabled=false keeps legacy dedupe: cross-scope same-title still merges", () => {
|
|
75
|
+
const store = createStore(":memory:");
|
|
76
|
+
const service = createService({ store, mirror: null, config: {} });
|
|
77
|
+
store.save({ type: "project", title: "T", content: "scoped body", agent_scope: "agentA" });
|
|
78
|
+
const { action } = service.saveWithDedupe({ type: "project", title: "T", content: "new body" });
|
|
79
|
+
assert.equal(action, "merged");
|
|
80
|
+
assert.equal(store.count("project"), 1);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
test("scopeEnabled=true: dedupe key extends with agent_scope/workspace_scope/sensitivity", () => {
|
|
84
|
+
const store = createStore(":memory:");
|
|
85
|
+
const service = createService({ store, mirror: null, config: { scopeEnabled: true } });
|
|
86
|
+
const save = (fields) => service.saveWithDedupe({ type: "project", title: "T", content: "body", ...fields });
|
|
87
|
+
|
|
88
|
+
assert.equal(save({ agent_scope: "agentA" }).action, "created");
|
|
89
|
+
// 同标题、不同 agent_scope → 独立行,绝不互相合并。
|
|
90
|
+
assert.equal(save({ agent_scope: "agentB" }).action, "created");
|
|
91
|
+
// 不同 workspace_scope → 独立行。
|
|
92
|
+
assert.equal(save({ agent_scope: "agentA", workspace_scope: "D:\\proj-a" }).action, "created");
|
|
93
|
+
// 不同 sensitivity → 独立行。
|
|
94
|
+
assert.equal(save({ agent_scope: "agentA", sensitivity: "personal" }).action, "created");
|
|
95
|
+
// 三元组全同 → 合并。
|
|
96
|
+
assert.equal(save({ agent_scope: "agentA" }).action, "merged");
|
|
97
|
+
assert.equal(store.count("project"), 4);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
test("scopeEnabled=true: unscoped writes match legacy NULL rows but not stamped ones", () => {
|
|
101
|
+
const store = createStore(":memory:");
|
|
102
|
+
const service = createService({ store, mirror: null, config: { scopeEnabled: true } });
|
|
103
|
+
// 存量形状(NULL scope)。
|
|
104
|
+
store.save({ type: "preference", title: "P", content: "legacy" });
|
|
105
|
+
// 未标注新写入与存量 NULL 行互相匹配。
|
|
106
|
+
assert.equal(service.saveWithDedupe({ type: "preference", title: "P", content: "x" }).action, "merged");
|
|
107
|
+
// 已标注行与 NULL 行不匹配 → 独立新行。
|
|
108
|
+
assert.equal(service.saveWithDedupe({ type: "preference", title: "P", content: "x", agent_scope: "agentA" }).action, "created");
|
|
109
|
+
assert.equal(store.count("preference"), 2);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
test("scopeEnabled=true: _mergeInto across scopes is rejected and falls back to a fresh row", () => {
|
|
113
|
+
const store = createStore(":memory:");
|
|
114
|
+
const service = createService({ store, mirror: null, config: { scopeEnabled: true } });
|
|
115
|
+
const scoped = store.save({ type: "project", title: "S", content: "scoped", agent_scope: "agentA" });
|
|
116
|
+
const cross = service.saveWithDedupe({
|
|
117
|
+
type: "project", title: "S", content: "summary text", _mergeInto: scoped.id
|
|
118
|
+
});
|
|
119
|
+
assert.equal(cross.action, "created", "cross-scope semantic merge must not leak into the scoped row");
|
|
120
|
+
const same = service.saveWithDedupe({
|
|
121
|
+
type: "project", title: "S2", content: "more text", agent_scope: "agentA", _mergeInto: scoped.id
|
|
122
|
+
});
|
|
123
|
+
assert.equal(same.action, "merged", "same-scope explicit target still merges");
|
|
124
|
+
assert.equal(same.memory.id, scoped.id);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
function setupTools(config) {
|
|
128
|
+
const store = createStore(":memory:");
|
|
129
|
+
const service = createService({ store, mirror: null, config });
|
|
130
|
+
const registered = [];
|
|
131
|
+
createTools(
|
|
132
|
+
{ tools: { register(def) { registered.push(def); return () => {}; } } },
|
|
133
|
+
service,
|
|
134
|
+
config
|
|
135
|
+
);
|
|
136
|
+
const memorySave = registered.find((def) => def.name === "memory_save");
|
|
137
|
+
assert.ok(memorySave, "memory_save registered");
|
|
138
|
+
return { store, memorySave };
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
async function runMemorySave(memorySave, args, exec) {
|
|
142
|
+
const handler = memorySave.execute.bind(memorySave);
|
|
143
|
+
return handler(args, exec);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
test("memory_save stamps resolved scope onto the row when the flag is on", async () => {
|
|
147
|
+
const { store, memorySave } = setupTools({ scopeEnabled: true });
|
|
148
|
+
const exec = { agent: { session: { id: "s1", header: { agentPreset: "coder", cwd: "D:\\proj" } } } };
|
|
149
|
+
const args = { type: "pitfall", title: "T", content: "c", sensitivity: "personal", occurred_at: "2026-09-12T00:00:00Z" };
|
|
150
|
+
const out = await runMemorySave(memorySave, args, exec);
|
|
151
|
+
const row = store.getById(out.id);
|
|
152
|
+
assert.equal(row.agent_scope, "coder");
|
|
153
|
+
assert.equal(row.workspace_scope, "D:\\proj");
|
|
154
|
+
assert.equal(row.sensitivity, "personal");
|
|
155
|
+
assert.equal(row.occurred_at, "2026-09-12T00:00:00.000Z");
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
test("memory_save without exec context writes unscoped rows (flag on, nothing resolvable)", async () => {
|
|
159
|
+
const { store, memorySave } = setupTools({ scopeEnabled: true });
|
|
160
|
+
const out = await runMemorySave(memorySave, { type: "pitfall", title: "T", content: "c" }, undefined);
|
|
161
|
+
const row = store.getById(out.id);
|
|
162
|
+
assert.equal(row.agent_scope, undefined);
|
|
163
|
+
assert.equal(row.workspace_scope, undefined);
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
test("memory_save with the flag off writes rows without any scope annotation", async () => {
|
|
167
|
+
const { store, memorySave } = setupTools({});
|
|
168
|
+
const exec = { agent: { session: { id: "s1", header: { agentPreset: "coder", cwd: "D:\\proj" } } } };
|
|
169
|
+
const out = await runMemorySave(memorySave, { type: "pitfall", title: "T", content: "c" }, exec);
|
|
170
|
+
const row = store.getById(out.id);
|
|
171
|
+
assert.equal(row.agent_scope, undefined);
|
|
172
|
+
assert.equal(row.workspace_scope, undefined);
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
test("createScopeResolver returns null when scopeEnabled is off", () => {
|
|
176
|
+
const resolve = createScopeResolver({ ctx: {}, config: {} });
|
|
177
|
+
assert.equal(resolve({ agent: { session: { id: "s1" } } }), null);
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
test("resolver stamps agentPreset and header cwd; registry hit wins over header cwd", () => {
|
|
181
|
+
const resolve = createScopeResolver({
|
|
182
|
+
config: { scopeEnabled: true },
|
|
183
|
+
ctx: { workspaceRegistry: { list: () => [{ path: "C:\\canon", sessionIds: ["s1"] }] } }
|
|
184
|
+
});
|
|
185
|
+
const exec = { agent: { session: { id: "s1", header: { agentPreset: "coder", cwd: "D:\\raw" } } } };
|
|
186
|
+
assert.deepEqual(resolve(exec), { agent_scope: "coder", workspace_scope: "C:\\canon" });
|
|
187
|
+
|
|
188
|
+
const resolveNoHit = createScopeResolver({
|
|
189
|
+
config: { scopeEnabled: true },
|
|
190
|
+
ctx: { workspaceRegistry: { list: () => [{ path: "C:\\canon", sessionIds: ["other"] }] } }
|
|
191
|
+
});
|
|
192
|
+
assert.deepEqual(resolveNoHit(exec), { agent_scope: "coder", workspace_scope: "D:\\raw" });
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
test("resolver falls back to the static .header property on old hosts", () => {
|
|
196
|
+
const resolve = createScopeResolver({ config: { scopeEnabled: true }, ctx: {} });
|
|
197
|
+
const exec = { agent: { session: { id: "s1", header: { agentPreset: "novelist" } } } };
|
|
198
|
+
assert.deepEqual(resolve(exec), { agent_scope: "novelist", workspace_scope: null });
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
test("session.header wins over requestHeader() (EpochHeader must not shadow the durable header)", () => {
|
|
202
|
+
const resolve = createScopeResolver({ config: { scopeEnabled: true }, ctx: {} });
|
|
203
|
+
// 本地 web 复验(2026-09-13)实测踩中的形状:requestHeader() 返回请求级
|
|
204
|
+
// EpochHeader(模型路由头,无 agentPreset/cwd),曾在首个请求后遮蔽
|
|
205
|
+
// session.header,导致标注全空。
|
|
206
|
+
const exec = {
|
|
207
|
+
agent: {
|
|
208
|
+
session: {
|
|
209
|
+
id: "s1",
|
|
210
|
+
header: { agentPreset: "coder", cwd: "D:\\proj" },
|
|
211
|
+
requestHeader: () => ({ config: { provider: "deepseek-official", model: "deepseek-v4-flash" } })
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
assert.deepEqual(resolve(exec), { agent_scope: "coder", workspace_scope: "D:\\proj" });
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
test("hosts without .header fall back to requestHeader().config shape", () => {
|
|
219
|
+
const resolve = createScopeResolver({ config: { scopeEnabled: true }, ctx: {} });
|
|
220
|
+
const exec = {
|
|
221
|
+
agent: {
|
|
222
|
+
session: {
|
|
223
|
+
id: "s2",
|
|
224
|
+
requestHeader: () => ({ config: { agentPreset: "legacy", cwd: "E:\\old" } })
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
assert.deepEqual(resolve(exec), { agent_scope: "legacy", workspace_scope: "E:\\old" });
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
test("resolver never throws: registry explosion degrades to header cwd and warns once", () => {
|
|
232
|
+
const warnings = [];
|
|
233
|
+
const resolve = createScopeResolver({
|
|
234
|
+
config: { scopeEnabled: true },
|
|
235
|
+
ctx: { workspaceRegistry: { list: () => { throw new Error("boom"); } } },
|
|
236
|
+
logger: { warn: (m) => warnings.push(String(m)) }
|
|
237
|
+
});
|
|
238
|
+
const exec = { agent: { session: { id: "s1", header: { agentPreset: "coder", cwd: "D:\\raw" } } } };
|
|
239
|
+
assert.deepEqual(resolve(exec), { agent_scope: "coder", workspace_scope: "D:\\raw" });
|
|
240
|
+
assert.equal(warnings.length, 1, "warn exactly once, never block the write path");
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
test("resolver without a session or header lands all-NULL", () => {
|
|
244
|
+
const resolve = createScopeResolver({ config: { scopeEnabled: true }, ctx: {} });
|
|
245
|
+
assert.deepEqual(resolve(undefined), { agent_scope: null, workspace_scope: null });
|
|
246
|
+
assert.deepEqual(resolve({ agent: { session: { id: "s2" } } }), { agent_scope: null, workspace_scope: null });
|
|
247
|
+
});
|