@modusensus/dsh-mneme 0.8.7 → 0.8.9

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.
@@ -0,0 +1,194 @@
1
+ import test from "node:test";
2
+ import assert from "node:assert/strict";
3
+ import { createDreamScheduler } from "../src/dream.js";
4
+ import { createStore } from "../src/store.js";
5
+ import { createService } from "../src/service.js";
6
+
7
+ // Issue #239(第 4 项,错峰队列)镜像到巩固:dreamPeakHours / dreamPeakMaxDeferMinutes。
8
+ //
9
+ // 这些用例锁的是「排程语义」,不是实现细节——它们防的回归是:
10
+ // ① 错峰闸门被写反/失效 → 高峰期又开始做梦(省钱能力静默消失);
11
+ // ② 顺延路径把 skip 做成静默 → 用户看到「不再巩固了」却查不出原因;
12
+ // ③ 顺延没有上限 → 长高峰(如全天)把巩固永久饿死;
13
+ // ④ 非法时段串被当成「全天高峰」→ 一个笔误把功能整个停掉;
14
+ // ⑤ dispose 漏清顺延定时器 → 进程关掉后仍触发一次巩固。
15
+ //
16
+ // 时钟与定时器全部注入(同 src/dream/sleep.js 的房型):排程不绑死真实时钟,
17
+ // 「高峰顺延 → 非高峰补跑」才能被确定性覆盖,也不会在 CI 上留下真实等待。
18
+ function dreamSetup() {
19
+ const store = createStore(":memory:");
20
+ const service = createService({ store, mirror: null, config: {} });
21
+ return { store, service };
22
+ }
23
+
24
+ /** 本地墙钟时间:用本地时区构造,getHours() 在 ubuntu/windows CI 上都等于入参。 */
25
+ function at(hour, minute = 0) {
26
+ return new Date(2026, 5, 15, hour, minute, 0, 0).getTime();
27
+ }
28
+
29
+ function fakeClock(startMs) {
30
+ let nowMs = startMs;
31
+ const timers = [];
32
+ let seq = 1;
33
+ return {
34
+ now: () => nowMs,
35
+ setNow: (v) => { nowMs = v; },
36
+ timers,
37
+ setTimeoutFn: (fn, delay) => { const t = { id: seq++, at: nowMs + delay, fn }; timers.push(t); return t.id; },
38
+ clearTimeoutFn: (id) => { const i = timers.findIndex((t) => t.id === id); if (i >= 0) timers.splice(i, 1); }
39
+ };
40
+ }
41
+
42
+ /** 造出「超过阈值」的写入量(thresholdCount=2)。 */
43
+ function fill(service, n = 2) {
44
+ for (let i = 0; i < n; i++) service.saveWithDedupe({ type: "project", title: `m${i}`, content: "x".repeat(50) });
45
+ }
46
+
47
+ test("dreamPeakHours: 命中高峰不调模型,登记 skip 审计并顺延", () => {
48
+ const { store, service } = dreamSetup();
49
+ const clock = fakeClock(at(10, 0)); // 本地 10:00,落在 09:00-18:00 内
50
+ let runs = 0;
51
+ const audits = [];
52
+ const dream = createDreamScheduler({
53
+ onRun: async () => { runs++; return { ok: true }; },
54
+ thresholdCount: 2, thresholdChars: 5000, delayMs: 0,
55
+ peakHours: "09:00-18:00",
56
+ peakMaxDeferMinutes: 0, // 不设上限:顺延应落在真正的高峰结束时刻
57
+ now: clock.now, setTimeoutFn: clock.setTimeoutFn, clearTimeoutFn: clock.clearTimeoutFn,
58
+ auditPeakSkip: (info) => audits.push(info)
59
+ });
60
+ fill(service);
61
+ assert.equal(dream.maybeSchedule(service), false, "高峰内不排「马上跑」");
62
+ assert.equal(runs, 0, "高峰内绝不调 LLM");
63
+ assert.equal(audits.length, 1, "skip 必须留痕,否则「为什么不再巩固」不可观测");
64
+ assert.equal(audits[0].count, 2, "审计带上窗口里积了多少(阈值继续累积,不是丢弃)");
65
+ assert.equal(clock.timers.length, 1, "挂了一个顺延定时器");
66
+ assert.equal(clock.timers[0].at, at(18, 0), "顺延到最近的高峰结束时刻");
67
+ store.close();
68
+ });
69
+
70
+ test("dreamPeakHours: 顺延到点后补跑(非高峰真的会跑)", async () => {
71
+ const { store, service } = dreamSetup();
72
+ const clock = fakeClock(at(10, 0));
73
+ let runs = 0;
74
+ const dream = createDreamScheduler({
75
+ onRun: async () => { runs++; return { ok: true }; },
76
+ thresholdCount: 2, thresholdChars: 5000, delayMs: 0,
77
+ peakHours: "09:00-18:00",
78
+ now: clock.now, setTimeoutFn: clock.setTimeoutFn, clearTimeoutFn: clock.clearTimeoutFn,
79
+ auditPeakSkip: () => {}
80
+ });
81
+ fill(service);
82
+ dream.maybeSchedule(service);
83
+ const deferred = clock.timers[0];
84
+ clock.setNow(deferred.at); // 走到 18:00
85
+ await deferred.fn();
86
+ assert.equal(runs, 1, "出高峰后补跑一次");
87
+ store.close();
88
+ });
89
+
90
+ test("dreamPeakHours: 重复触发不叠加顺延定时器", () => {
91
+ const { store, service } = dreamSetup();
92
+ const clock = fakeClock(at(10, 0));
93
+ let audits = 0;
94
+ const dream = createDreamScheduler({
95
+ onRun: async () => ({ ok: true }),
96
+ thresholdCount: 2, thresholdChars: 5000, delayMs: 0,
97
+ peakHours: "09:00-18:00",
98
+ now: clock.now, setTimeoutFn: clock.setTimeoutFn, clearTimeoutFn: clock.clearTimeoutFn,
99
+ auditPeakSkip: () => { audits++; }
100
+ });
101
+ fill(service);
102
+ dream.maybeSchedule(service);
103
+ dream.maybeSchedule(service); // 顺延期间又来一次写入触发
104
+ assert.equal(clock.timers.length, 1, "同一时刻只有一个顺延定时器");
105
+ assert.equal(audits, 1, "不重复刷审计行");
106
+ store.close();
107
+ });
108
+
109
+ test("dreamPeakMaxDeferMinutes: 上限截断后到点照跑,长高峰不饿死巩固", async () => {
110
+ const { store, service } = dreamSetup();
111
+ const clock = fakeClock(at(10, 0));
112
+ let runs = 0;
113
+ const dream = createDreamScheduler({
114
+ onRun: async () => { runs++; return { ok: true }; },
115
+ thresholdCount: 2, thresholdChars: 5000, delayMs: 0,
116
+ peakHours: "00:00-23:59", // 全天高峰:不设上限就会顺延到 23:59
117
+ peakMaxDeferMinutes: 120,
118
+ now: clock.now, setTimeoutFn: clock.setTimeoutFn, clearTimeoutFn: clock.clearTimeoutFn,
119
+ auditPeakSkip: () => {}
120
+ });
121
+ fill(service);
122
+ dream.maybeSchedule(service);
123
+ const t = clock.timers[0];
124
+ assert.equal(t.at, at(12, 0), "被上限截断到 120 分钟后(而不是等到 23:59)");
125
+ clock.setNow(t.at);
126
+ await t.fn();
127
+ assert.equal(runs, 1, "截断放行:仍在高峰也照跑,避免无限顺延");
128
+ store.close();
129
+ });
130
+
131
+ test("dreamPeakHours: 非法时段串按「未配置」处理(宁可不省,也不能误停)", async () => {
132
+ const { store, service } = dreamSetup();
133
+ const clock = fakeClock(at(10, 0));
134
+ let runs = 0;
135
+ let audits = 0;
136
+ const dream = createDreamScheduler({
137
+ onRun: async () => { runs++; return { ok: true }; },
138
+ thresholdCount: 2, thresholdChars: 5000, delayMs: 0,
139
+ peakHours: "10:00-99:00", // 非法:解析失败必须回落成「关闭」
140
+ now: clock.now, setTimeoutFn: clock.setTimeoutFn, clearTimeoutFn: clock.clearTimeoutFn,
141
+ auditPeakSkip: () => { audits++; }
142
+ });
143
+ fill(service);
144
+ assert.equal(dream.maybeSchedule(service), true, "非法串 = 未配置 → 走原有触发路径");
145
+ assert.equal(audits, 0, "不写 skip 审计");
146
+ const t = clock.timers[0];
147
+ clock.setNow(t.at);
148
+ await t.fn();
149
+ assert.equal(runs, 1, "巩固照常进行");
150
+ store.close();
151
+ });
152
+
153
+ test("dreamPeakHours: 非高峰时段不受影响(行为与现状一致)", async () => {
154
+ const { store, service } = dreamSetup();
155
+ const clock = fakeClock(at(20, 0)); // 本地 20:00,在 09:00-18:00 之外
156
+ let runs = 0;
157
+ const dream = createDreamScheduler({
158
+ onRun: async () => { runs++; return { ok: true }; },
159
+ thresholdCount: 2, thresholdChars: 5000, delayMs: 5,
160
+ peakHours: "09:00-18:00",
161
+ now: clock.now, setTimeoutFn: clock.setTimeoutFn, clearTimeoutFn: clock.clearTimeoutFn,
162
+ auditPeakSkip: () => { throw new Error("非高峰不该写 skip 审计"); }
163
+ });
164
+ fill(service);
165
+ assert.equal(dream.maybeSchedule(service), true, "非高峰照常排程");
166
+ const t = clock.timers[0];
167
+ assert.equal(t.at, at(20, 0) + 5, "走的是 delayMs 的「马上跑」路径,不是顺延路径");
168
+ clock.setNow(t.at);
169
+ await t.fn();
170
+ assert.equal(runs, 1);
171
+ store.close();
172
+ });
173
+
174
+ test("dreamPeakHours: dispose 清掉顺延定时器,进程关闭后不再触发巩固", async () => {
175
+ const { store, service } = dreamSetup();
176
+ const clock = fakeClock(at(10, 0));
177
+ let runs = 0;
178
+ const dream = createDreamScheduler({
179
+ onRun: async () => { runs++; return { ok: true }; },
180
+ thresholdCount: 2, thresholdChars: 5000, delayMs: 0,
181
+ peakHours: "09:00-18:00",
182
+ now: clock.now, setTimeoutFn: clock.setTimeoutFn, clearTimeoutFn: clock.clearTimeoutFn,
183
+ auditPeakSkip: () => {}
184
+ });
185
+ fill(service);
186
+ dream.maybeSchedule(service);
187
+ const t = clock.timers[0];
188
+ await dream.dispose();
189
+ assert.equal(clock.timers.length, 0, "顺延定时器已清");
190
+ clock.setNow(t.at);
191
+ await t.fn(); // 模拟「定时器已经进了事件队列,清不掉」的那一帧
192
+ assert.equal(runs, 0, "disposed 守卫拦住补跑");
193
+ store.close();
194
+ });
@@ -1,5 +1,8 @@
1
1
  import test from "node:test";
2
2
  import assert from "node:assert/strict";
3
+ import { readdirSync, readFileSync } from "node:fs";
4
+ import { fileURLToPath } from "node:url";
5
+ import path from "node:path";
3
6
  import { createStore } from "../src/store.js";
4
7
  import { createService } from "../src/service.js";
5
8
  import { createDreamScheduler } from "../src/dream.js";
@@ -14,12 +17,15 @@ import { createVectorIndex } from "../src/vector-index.js";
14
17
  // 阶段就抛 "Cannot read properties of undefined (reading 'kind')",四条 LLM 管线
15
18
  // (dream / sleep / summarize / entity extraction)全军覆没、耗时 0ms。
16
19
  // 这里用同等严格的桩驱动真实管线,任何新加的消息漏了 source 都会失败。
20
+ // issue #326:kind 值必须是生产者自有 kind "plugin:dsh-mneme"——DSH 0.1.7 起的
21
+ // V4 写入准入把裸 "plugin"(含缺失/空串)一并拒绝,注入/蒸馏会整条报
22
+ // "format v4 message requires a producer-owned source kind"。
17
23
  function assertMessageSources(options) {
18
24
  for (const message of options.messages ?? []) {
19
25
  assert.equal(
20
26
  message.source?.kind,
21
- "plugin",
22
- `LLM 消息缺 source(provider 会抛 TypeError): ${message.role} / ${String(message.content?.[0]?.text ?? "").slice(0, 40)}`
27
+ "plugin:dsh-mneme",
28
+ `LLM 消息缺 source 或 kind 不是生产者自有值(V4 会拒收): ${message.role} / ${String(message.content?.[0]?.text ?? "").slice(0, 40)}`
23
29
  );
24
30
  }
25
31
  }
@@ -175,3 +181,27 @@ test("entity extraction: messages handed to the llm adapter carry source", async
175
181
  assert.equal(calls.length, 1, "extraction called the LLM adapter");
176
182
  store.close();
177
183
  });
184
+
185
+ // ---------------------------------------------------------------- shape lock
186
+
187
+ // issue #326 形状锁:任何新增的会话写入点再用裸 kind: "plugin"(V4 写入准入从
188
+ // DSH 0.1.7 起会整条拒绝)都直接红灯。静态 grep 锁而非运行时枚举,是因为写入点
189
+ // 散在 6 个文件 16 处,运行时桩只覆盖 LLM 管线、盖不住 api.js 的连通性探针。
190
+ test("no writer emits the rejected bare kind: \"plugin\" (issue #326)", () => {
191
+ const srcDir = path.join(path.dirname(fileURLToPath(import.meta.url)), "..", "src");
192
+ const offenders = [];
193
+ const walk = (dir) => {
194
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
195
+ const full = path.join(dir, entry.name);
196
+ if (entry.isDirectory()) walk(full);
197
+ else if (entry.name.endsWith(".js")) offenders.push(...scanSource(readFileSync(full, "utf8"), full));
198
+ }
199
+ };
200
+ const scanSource = (text, file) =>
201
+ text.split("\n").reduce(
202
+ (acc, line, i) => (/kind:\s*["'`]plugin["'`]/.test(line) ? [...acc, `${file}:${i + 1}`] : acc),
203
+ []
204
+ );
205
+ walk(srcDir);
206
+ assert.deepEqual(offenders, [], `裸 kind: "plugin" 会被 V4 写入准入拒绝,改用生产者自有 kind(如 "plugin:dsh-mneme"): ${offenders.join(", ")}`);
207
+ });
@@ -48,11 +48,17 @@ test("issue#135: reasoningEffort unset = undefined (auto-lowest at resolve time)
48
48
  const cfg = Config({});
49
49
  assert.equal(cfg.dreamReasoningEffort, undefined, "unset must be distinguishable from explicit 'none'");
50
50
  assert.equal(cfg.sleepReasoningEffort, undefined);
51
+ // issue #315: the distill knob defaults to 'none' (entity-extraction shape,
52
+ // no auto-lowest resolution — distill keeps its current behavior until the
53
+ // user opts in).
54
+ assert.equal(cfg.summarizeReasoningEffort, "none", "distill effort defaults to 'none'");
55
+ assert.equal(Config({ summarizeReasoningEffort: "off" }).summarizeReasoningEffort, "off");
51
56
  assert.equal(Config({ dreamReasoningEffort: "none" }).dreamReasoningEffort, "none", "explicit 'none' kept");
52
57
  assert.equal(Config({ dreamReasoningEffort: "off" }).dreamReasoningEffort, "off", "'off' now a valid explicit choice");
53
58
  assert.equal(Config({ sleepReasoningEffort: "medium" }).sleepReasoningEffort, "medium");
54
59
  assert.throws(() => Config({ dreamReasoningEffort: "bogus" }), "invalid effort rejected");
55
60
  assert.throws(() => Config({ sleepReasoningEffort: "ultra" }), "invalid effort rejected");
61
+ assert.throws(() => Config({ summarizeReasoningEffort: "max" }), "invalid distill effort rejected");
56
62
  });
57
63
 
58
64
  // ---------------------------------------------------------------- dream passthrough
@@ -0,0 +1,189 @@
1
+ // Regression for issue #315: the distill (summarize) LLM call gets a reasoning
2
+ // effort knob, mirroring the entity-extraction shape (issue #109) and reusing
3
+ // the dream/sleep fallback machinery. Pins:
4
+ // - explicit effort is forwarded on the distill stream call;
5
+ // - default 'none' omits the field entirely (current behavior unchanged);
6
+ // - a stream-level effort rejection (error finish chunk, the rc.1 shape that
7
+ // never reaches catch) is retried once WITHOUT the field;
8
+ // - non-effort stream failures are NOT retried (no blind double calls) and
9
+ // the aborted window stays retryable (cursor not consumed);
10
+ // - 'off' works like any explicit effort (rejected → retried without it).
11
+ // Mock shapes (ctx.on subscription capture, {delta} text chunks, finish
12
+ // {reason:{kind,failure}}) follow the existing summarize.test.js conventions.
13
+ import test from "node:test";
14
+ import assert from "node:assert/strict";
15
+ import { createSummarizer } from "../src/summarize.js";
16
+ import { createStore } from "../src/store.js";
17
+ import { createService } from "../src/service.js";
18
+
19
+ const ENTRIES_JSON = JSON.stringify([
20
+ { type: "decision", title: "选型", content: "确定用 node:sqlite", importance: 4 }
21
+ ]);
22
+
23
+ function userMessage(text, seq) {
24
+ return {
25
+ seq,
26
+ type: "user/message",
27
+ data: { source: { kind: "user" }, content: [{ type: "text", text }] }
28
+ };
29
+ }
30
+
31
+ function setup(configOver = {}, stream) {
32
+ const store = createStore(":memory:");
33
+ const service = createService({ store, mirror: null, config: {} });
34
+ const calls = [];
35
+ const events = [];
36
+ const ctx = {
37
+ on(name, fn) {
38
+ events.push({ name, fn });
39
+ return () => {};
40
+ },
41
+ llm: {
42
+ stream(options) {
43
+ calls.push(options);
44
+ return stream(options);
45
+ }
46
+ }
47
+ };
48
+ const config = { autoSummarize: true, distillRateLimitIntervalMs: 0, ...configOver };
49
+ createSummarizer(ctx, service, config, {});
50
+ const handler = events.find((e) => e.name === "session/event").fn;
51
+ const session = {
52
+ id: "s315",
53
+ requestHeader: () => ({ config: { provider: "deepseek", model: "deepseek-chat" } }),
54
+ events: [userMessage("帮我选型", 1), { seq: 2, type: "turn/end" }]
55
+ };
56
+ return { store, service, calls, handler, session };
57
+ }
58
+
59
+ test("issue#315: explicit summarizeReasoningEffort is forwarded on the distill call", async () => {
60
+ const { store, calls, handler, session } = setup(
61
+ { summarizeReasoningEffort: "low" },
62
+ () => (async function* () {
63
+ yield { type: "text-delta", delta: ENTRIES_JSON };
64
+ yield { type: "finish", kind: "ok" };
65
+ })()
66
+ );
67
+ await handler(session, { seq: 2, type: "turn/end" });
68
+ assert.equal(calls.length, 1);
69
+ assert.equal(calls[0].reasoningEffort, "low", "the configured effort rides the distill call");
70
+ store.close();
71
+ });
72
+
73
+ test("issue#315: default 'none' omits the reasoningEffort field entirely", async () => {
74
+ const { store, calls, handler, session } = setup(
75
+ {},
76
+ () => (async function* () {
77
+ yield { type: "text-delta", delta: ENTRIES_JSON };
78
+ yield { type: "finish", kind: "ok" };
79
+ })()
80
+ );
81
+ await handler(session, { seq: 2, type: "turn/end" });
82
+ assert.equal(calls.length, 1);
83
+ assert.equal("reasoningEffort" in calls[0], false, "unset/'none' must not add the field");
84
+ assert.equal(store.count(), 1, "entries still stored as before");
85
+ store.close();
86
+ });
87
+
88
+ test("issue#315: stream-level effort rejection retries once without the field", async () => {
89
+ const { store, calls, handler, session } = setup(
90
+ { summarizeReasoningEffort: "low" },
91
+ (options) => (async function* () {
92
+ if (options.reasoningEffort) {
93
+ // rc.1 shape: the provider rejection arrives as a terminal error finish
94
+ // chunk (adapterStream never throws), so the retry must be triggered
95
+ // from the chunk path, not a catch block.
96
+ yield {
97
+ type: "finish",
98
+ reason: {
99
+ kind: "error",
100
+ failure: {
101
+ code: "UNSUPPORTED_REASONING_EFFORT",
102
+ message: 'provider "deepseek" model "deepseek-chat" does not support reasoning effort "low"'
103
+ }
104
+ }
105
+ };
106
+ return;
107
+ }
108
+ yield { type: "text-delta", delta: ENTRIES_JSON };
109
+ yield { type: "finish", kind: "ok" };
110
+ })()
111
+ );
112
+ await handler(session, { seq: 2, type: "turn/end" });
113
+ assert.equal(calls.length, 2, "exactly one no-effort retry");
114
+ assert.equal(calls[0].reasoningEffort, "low", "first attempt forwards the effort");
115
+ assert.equal("reasoningEffort" in calls[1], false, "retry omits the rejected effort field");
116
+ assert.equal(store.count(), 1, "the retried run still stores its entry");
117
+ store.close();
118
+ });
119
+
120
+ test("issue#315: non-effort stream failures are not retried and stay abortable", async () => {
121
+ const { store, calls, handler, session } = setup(
122
+ { summarizeReasoningEffort: "low" },
123
+ () => (async function* () {
124
+ yield { type: "finish", reason: { kind: "error", failure: { code: "PROVIDER_GONE", message: "provider deepseek is not registered" } } };
125
+ })()
126
+ );
127
+ await handler(session, { seq: 2, type: "turn/end" });
128
+ assert.equal(calls.length, 1, "no blind retry when the stream failure is not an effort rejection");
129
+ assert.equal(store.count(), 0, "failed window stores nothing");
130
+ store.close();
131
+ });
132
+
133
+ test("issue#315: off works like any explicit effort (rejected → retried without it)", async () => {
134
+ const { store, calls, handler, session } = setup(
135
+ { summarizeReasoningEffort: "off" },
136
+ (options) => (async function* () {
137
+ if (options.reasoningEffort) {
138
+ yield { type: "finish", reason: { kind: "error", failure: { code: "UNSUPPORTED_REASONING_EFFORT", message: 'reasoning effort "off" is not supported here' } } };
139
+ return;
140
+ }
141
+ yield { type: "text-delta", delta: ENTRIES_JSON };
142
+ yield { type: "finish", kind: "ok" };
143
+ })()
144
+ );
145
+ await handler(session, { seq: 2, type: "turn/end" });
146
+ assert.equal(calls.length, 2);
147
+ assert.equal(calls[0].reasoningEffort, "off");
148
+ assert.equal(store.count(), 1);
149
+ store.close();
150
+ });
151
+
152
+ test("issue#315: successful effort-fallback retry records audit as success, not the first failure", async () => {
153
+ const { store, service, calls, handler, session } = setup(
154
+ { summarizeReasoningEffort: "low" },
155
+ (options) => (async function* () {
156
+ if (options.reasoningEffort) {
157
+ // first attempt is rejected (effort unsupported)…
158
+ yield { type: "finish", reason: { kind: "error", failure: { code: "UNSUPPORTED_REASONING_EFFORT", message: 'reasoning effort "low" rejected' } } };
159
+ return;
160
+ }
161
+ // …but the no-effort retry succeeds.
162
+ yield { type: "text-delta", delta: ENTRIES_JSON };
163
+ yield { type: "finish", kind: "ok" };
164
+ })()
165
+ );
166
+ await handler(session, { seq: 2, type: "turn/end" });
167
+ assert.equal(calls.length, 2, "effort rejection + one retry");
168
+ const rows = service.listLlmAudits();
169
+ const summarize = rows.find((r) => r.operation_type === "summarize_compress");
170
+ assert.ok(summarize, "summarize audit row present");
171
+ assert.equal(summarize.status, "success",
172
+ "the retried run must record success, not the first attempt's error status");
173
+ store.close();
174
+ });
175
+
176
+ test("issue#315: abort is not misread as an effort rejection even when the message matches the pattern", async () => {
177
+ const { store, calls, handler, session } = setup(
178
+ { summarizeReasoningEffort: "low" },
179
+ () => (async function* () {
180
+ // The message matches EFFORT_REJECT_RE on purpose: without the AbortError
181
+ // guard in withEffortFallback this would be misread as an effort rejection
182
+ // and trigger a wasteful no-effort retry.
183
+ throw Object.assign(new Error("aborted by dispose: UNSUPPORTED_REASONING_EFFORT"), { name: "AbortError" });
184
+ })()
185
+ );
186
+ await handler(session, { seq: 2, type: "turn/end" });
187
+ assert.equal(calls.length, 1, "abort must not trigger a no-effort fallback retry");
188
+ store.close();
189
+ });