@lmzhen/dsh-evolution-review 0.3.57 → 0.3.59

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 CHANGED
@@ -38,6 +38,6 @@ Independent of request-prefix construction. This package does not alter the asse
38
38
  ### Review delivery contract (0.3.38-0.3.42)
39
39
 
40
40
  - **Both channels execute at conversation end only** (a `turn/end` with `reason.kind === 'completed'`): a cadence threshold fire mid-task merely latches the kind — no subagent spawn, no inject. The flush runs BEFORE the latch block (the completing turn may itself be a threshold-firing turn). `reviewMode` (`'subagent'` default / `'inject'`) selects how the flush delivers; the explicit `'inject'` mode's historical "immediate on threshold" contract was superseded in 0.3.39 — both modes are end-of-conversation.
41
- - **`skillReviewTrigger`** (default `'cadence'`): `'cadence'` runs one end-of-conversation review from the cadence latch; `'completion'` uses the separate long-session completion gate (session-cumulative tool-call threshold); `'both'` enables both (note: with the deferred cadence execution the `'both'` combination would inject a second task-complete prompt at the same boundary — prefer `'cadence'`).
41
+ - **`skillReviewTrigger`** (default `'cadence'`): the cadence channel is **always on** (one end-of-conversation review from the cadence latch per task segment); the flag gates **only the completion channel** — `'cadence'` disables it, `'completion'` enables it (cadence still fires), `'both'` enables it on top of the always-on cadence. At one boundary a turn is served by exactly one review: the cadence flush runs first and returns, so `'both'` never double-sends a second task-complete prompt at the same boundary (V10-13).
42
42
  - **`reviewWakeInject`** (default `true`): deliveries use `agent.followup` (next-turn + wake — the model starts processing immediately) instead of the non-waking `agent.inject` (which waits for the next driver wake). The host falls back to `inject` when it has no followup or the option is `false`. The woken turn's own cadence fire is suppressed once (an injected review prompt alone must not re-trigger a review under `interval=1`); a restart clears the queue, so the loop cannot survive it.
43
43
  - **Counting window = injection-to-injection**: the `turnsSinceMemory`/`turnsSinceSkill` counters are monotonic across threshold fires (`resetOnFire: false`) and are zeroed at the flush delivery — a continued conversation starts a fresh segment from the injection. A threshold fire on the completing turn is caught by the flush (`pendingKind = latch ?? kind`). All deliveries (review prompt AND result notices) share the same waking channel; a failed counter-reset persist warns once per session (a stateful reload may re-deliver).
package/lib/index.js CHANGED
@@ -50,17 +50,6 @@ const REVIEW_OUTPUT_SCHEMA = {
50
50
  }
51
51
  };
52
52
  let statelessReviewStateWarned = false;
53
- /**
54
- * G3.1 (0.3.23): clamp the numeric review config at assembly so a 0/negative/
55
- * NaN/±Infinity value falls back to the package default instead of folding as a
56
- * "disabled" special value (a 0 interval would fire a review every turn; NaN
57
- * folds as NaN into the cadence/timeout). The schema `.min(1)` guards the
58
- * loader path; this clamp also covers NaN/±Infinity (which schemastery lets a
59
- * bare number schema through) and direct construction. `reviewMaxDepth` clamps
60
- * to at least 1 because 0 is the historical 0.3.1 maximum-depth defect (a 0
61
- * rejects the spawn outright). Warn once when a user-supplied value had to be
62
- * corrected.
63
- */
64
53
  function clampReviewConfig(rawConfig, ctx) {
65
54
  const clamped = [];
66
55
  const field = (name, value, fallback, min) => {
@@ -203,18 +192,7 @@ function apply(ctx, rawConfig) {
203
192
  if (!shouldCompletionReview(event.data.reason, cumulative, config.skillReviewCompletionMinToolCalls)) return;
204
193
  completionInjected.add(session.id);
205
194
  try {
206
- agent.inject(createUserMessage({
207
- content: [{
208
- type: "text",
209
- text: COMPLETION_SKILL_REVIEW_PROMPT
210
- }],
211
- source: {
212
- kind: "plugin",
213
- plugin: "dsh-evolution-review",
214
- form: "notice",
215
- summary: "completion review"
216
- }
217
- }));
195
+ deliverMessage(agent, COMPLETION_SKILL_REVIEW_PROMPT, "completion review");
218
196
  } catch (injectError) {
219
197
  completionInjected.delete(session.id);
220
198
  ctx.logger.warn(`dsh-evolution-review: completion review inject failed: ${injectError instanceof Error ? injectError.message : String(injectError)}`);
@@ -278,7 +256,7 @@ function apply(ctx, rawConfig) {
278
256
  maxDepth: config.reviewMaxDepth,
279
257
  agentOptions,
280
258
  persona: reviewPrompt(kind, "plan"),
281
- toolFilter: { allow: [...config.reviewToolAllow] },
259
+ toolFilter: { allow: [...config.reviewToolAllow ?? []] },
282
260
  outputSchema: REVIEW_OUTPUT_SCHEMA
283
261
  });
284
262
  try {
@@ -28,8 +28,12 @@ export interface Config {
28
28
  reviewMaxDepth?: number;
29
29
  /** LLM provider for review subagents. Omit to inherit the deployment default route. */
30
30
  reviewProvider?: string;
31
- /** Which channel runs the end-of-conversation summary: the cadence latch
32
- * ('cadence'), the long-session completion gate ('completion'), or both. */
31
+ /** E3/P1-8 (v11) TRUE semantics: this flag gates ONLY the completion
32
+ * channel. The cadence latch stays active regardless of the value (a
33
+ * completion-gated deployment still fires at the policy cadence), so
34
+ * 'completion' does NOT mean "cadence off", and 'both' is effectively
35
+ * "completion on top of the always-on cadence". The mutually-exclusive
36
+ * channel reading in earlier docs was wrong. */
33
37
  skillReviewTrigger?: 'cadence' | 'completion' | 'both';
34
38
  /** Cumulative session tool calls before a session counts as proven-long for the completion channel. */
35
39
  skillReviewCompletionMinToolCalls?: number;
@@ -81,7 +85,19 @@ export declare const REVIEW_OUTPUT_SCHEMA: {
81
85
  * rejects the spawn outright). Warn once when a user-supplied value had to be
82
86
  * corrected.
83
87
  */
84
- export declare function clampReviewConfig(rawConfig: Config, ctx: Context): Required<Config>;
88
+ /** F5 (P2-16, v11): the clamp sets exactly these seven numeric fields — the
89
+ * old `as Required<Config>` lied about `reviewToolAllow` etc. being populated
90
+ * (`[...undefined]` TypeErrors under a direct `apply(ctx, {})`). */
91
+ type ClampedReviewConfig = Config & {
92
+ memoryInterval: number;
93
+ skillInterval: number;
94
+ reviewTimeoutMs: number;
95
+ reviewContextMessages: number;
96
+ reviewMessageChars: number;
97
+ reviewMaxDepth: number;
98
+ skillReviewCompletionMinToolCalls: number;
99
+ };
100
+ export declare function clampReviewConfig(rawConfig: Config, ctx: Context): ClampedReviewConfig;
85
101
  export declare function apply(ctx: Context, rawConfig: Config): void;
86
102
  /** Completion-channel decision: task finished normally AND the session is proven long. */
87
103
  export declare function shouldCompletionReview(reason: {
@@ -121,4 +137,5 @@ export declare function filterUnreadSkillOps(ops: Array<{
121
137
  * buildReviewRequest and is unchanged).
122
138
  */
123
139
  export declare function renderToolResultLine(data: unknown): string;
140
+ export {};
124
141
  //# sourceMappingURL=index.d.ts.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lmzhen/dsh-evolution-review",
3
3
  "description": "Background review orchestration (community build)",
4
- "version": "0.3.57",
4
+ "version": "0.3.59",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -31,9 +31,9 @@
31
31
  "license": "MIT",
32
32
  "dependencies": {
33
33
  "@deepseek-ai/schemastery": "^3.18.1",
34
- "@lmzhen/dsh-evolution-approval": "^0.3.57",
35
- "@lmzhen/dsh-evolution-core": "^0.3.57",
36
- "@lmzhen/dsh-evolution-plan-validator": "^0.3.57"
34
+ "@lmzhen/dsh-evolution-approval": "^0.3.59",
35
+ "@lmzhen/dsh-evolution-core": "^0.3.59",
36
+ "@lmzhen/dsh-evolution-plan-validator": "^0.3.59"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "@deepseek-ai/cordis": "^4.0.1",
@@ -42,8 +42,8 @@
42
42
  "@deepseek-ai/dsh-llm": "^0.1.1-rc.2",
43
43
  "@deepseek-ai/dsh-session": "^0.1.1-rc.2",
44
44
  "@deepseek-ai/dsh-tools": "^0.1.1-rc.2",
45
- "@lmzhen/dsh-evolution-state": "^0.3.57",
46
- "@lmzhen/dsh-evolution-policy": "^0.3.57"
45
+ "@lmzhen/dsh-evolution-state": "^0.3.59",
46
+ "@lmzhen/dsh-evolution-policy": "^0.3.59"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@deepseek-ai/dsh-agent": "^0.1.1-rc.2",
@@ -54,9 +54,9 @@
54
54
  "@deepseek-ai/dsh-session-persistence": "^0.1.1-rc.2",
55
55
  "@deepseek-ai/dsh-session-persistence-jsonl": "^0.1.1-rc.2",
56
56
  "@deepseek-ai/dsh-tools": "^0.1.1-rc.2",
57
- "@lmzhen/dsh-evolution-approval": "^0.3.57",
58
- "@lmzhen/dsh-evolution-core": "^0.3.57",
59
- "@lmzhen/dsh-evolution-plan-validator": "^0.3.57",
60
- "@lmzhen/dsh-evolution-state": "^0.3.57"
57
+ "@lmzhen/dsh-evolution-approval": "^0.3.59",
58
+ "@lmzhen/dsh-evolution-core": "^0.3.59",
59
+ "@lmzhen/dsh-evolution-plan-validator": "^0.3.59",
60
+ "@lmzhen/dsh-evolution-state": "^0.3.59"
61
61
  }
62
62
  }