@remnic/core 10.0.170 → 10.0.171

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.
Files changed (41) hide show
  1. package/dist/access-admin-ops-surface.js +1 -1
  2. package/dist/access-cli.js +1 -1
  3. package/dist/access-extraction-force-flush-preempt.js +1 -1
  4. package/dist/access-extraction-force-flush.js +1 -1
  5. package/dist/access-http-briefing.js +1 -1
  6. package/dist/access-http-query.js +1 -1
  7. package/dist/access-http.js +1 -1
  8. package/dist/access-identity-continuity-surface.js +1 -1
  9. package/dist/access-lcm-surface.js +1 -1
  10. package/dist/access-mcp.js +1 -1
  11. package/dist/access-observe-write-surface.js +1 -1
  12. package/dist/access-operations-batch.js +1 -1
  13. package/dist/access-operations.js +1 -1
  14. package/dist/access-recall-concurrency.js +1 -1
  15. package/dist/access-recall-response.js +1 -1
  16. package/dist/access-recall-surface.js +1 -1
  17. package/dist/access-service.js +1 -1
  18. package/dist/chat/chat-engine.d.ts +5 -3
  19. package/dist/chat/chat-engine.d.ts.map +1 -1
  20. package/dist/chat/chat-executor.d.ts +3 -4
  21. package/dist/chat/chat-executor.d.ts.map +1 -1
  22. package/dist/{chunk-QMFHKWHN.js → chunk-SLWD7TB6.js} +2 -2
  23. package/dist/{chunk-5YIOUS5T.js → chunk-T2KCROPA.js} +28 -19
  24. package/dist/chunk-T2KCROPA.js.map +1 -0
  25. package/dist/cli.js +1 -1
  26. package/dist/correction/correction-access-wiring.d.ts +4 -1
  27. package/dist/correction/correction-access-wiring.d.ts.map +1 -1
  28. package/dist/explicit-capture.js +1 -1
  29. package/dist/index.js +1 -1
  30. package/dist/orchestration/backlog-scheduler.js +2 -2
  31. package/dist/orchestration/buffer-drain-runner.js +2 -2
  32. package/dist/orchestrator.js +1 -1
  33. package/dist/recall-navigation.js +1 -1
  34. package/package.json +2 -2
  35. package/src/chat/chat-engine.ts +5 -3
  36. package/src/chat/chat-executor.test.ts +150 -0
  37. package/src/chat/chat-executor.ts +31 -20
  38. package/src/chat/chat-factory.ts +1 -1
  39. package/src/correction/correction-access-wiring.ts +4 -1
  40. package/dist/chunk-5YIOUS5T.js.map +0 -1
  41. /package/dist/{chunk-QMFHKWHN.js.map → chunk-SLWD7TB6.js.map} +0 -0
package/dist/cli.js CHANGED
@@ -91,7 +91,7 @@ import {
91
91
  runWorkProductStatusCliCommand,
92
92
  runWorkProjectCliCommand,
93
93
  runWorkTaskCliCommand
94
- } from "./chunk-5YIOUS5T.js";
94
+ } from "./chunk-T2KCROPA.js";
95
95
  import "./chunk-RK7SE3BL.js";
96
96
  import "./chunk-GOZXQNIM.js";
97
97
  import "./chunk-PQM3B54K.js";
@@ -119,7 +119,10 @@ declare function isEligibleCorrectionCandidate(m: MemoryFile): boolean;
119
119
  * can never drift out of sync (review thread: correction-gate-config-mismatch):
120
120
  * - nested: `config.correction.enabled`
121
121
  * - flat: the `correctionEnabled` legacy key (ratchet-safe shape)
122
- * Nested wins when present; both default to `true` (plan is read-only, safe on).
122
+ * Nested wins when present; both default to `true`. Default-on predates the
123
+ * chat wiring: the executor's plan/apply tools are mutation-capable but sit
124
+ * behind the engine's interactive preview-confirm protocol, so enabled-by-
125
+ * default is intended for human-attended surfaces.
123
126
  */
124
127
  export declare function isCorrectionFeatureEnabled(config: PluginConfig): boolean;
125
128
  declare const CLASSIFY_SYSTEM_PROMPT = "You classify memory corrections and draft per-memory actions.\n\nGiven a correction statement and candidate memories, respond with a JSON object:\n{\n \"classification\": \"wrong\" | \"outdated\" | \"incomplete\" | \"wrong_scope\" | \"never_store\",\n \"confidence\": <number 0..1>,\n \"actions\": [<one or more correction actions>],\n \"relevance\": [{\"memoryId\": \"<id>\", \"why\": \"<one short sentence>\"}]\n}\n\nAction shapes:\n- {\"kind\":\"supersede\",\"loserId\":\"<id>\",\"replacement\":{\"content\":\"<new fact>\"}}\n- {\"kind\":\"supersede\",\"loserId\":\"<id>\",\"winnerId\":\"<existing id>\"}\n- {\"kind\":\"edit\",\"memoryId\":\"<id>\",\"patch\":\"<new full content>\"}\n- {\"kind\":\"retract\",\"memoryId\":\"<id>\"}\n- {\"kind\":\"rescope\",\"memoryId\":\"<id>\",\"toNamespace\":\"<ns>\"}\n- {\"kind\":\"redaction_rule\",\"pattern\":\"<bounded literal or regex>\"}\n\nOnly emit actions you are confident in. If uncertain, return confidence < 0.5 and few actions.";
@@ -1 +1 @@
1
- {"version":3,"file":"correction-access-wiring.d.ts","sourceRoot":"","sources":["../../src/correction/correction-access-wiring.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AASH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAgB,YAAY,EAAE,MAAM,aAAa,CAAC;AAM1E,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EAEtB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,iBAAiB,EAA8B,MAAM,yBAAyB,CAAC;AASxF;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,YAAY,CAAC;IAC3B,6EAA6E;IAC7E,0BAA0B,CAAC,OAAO,EAAE;QAClC,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACpB,8EAA8E;IAC9E,yBAAyB,CAAC,OAAO,EAAE;QACjC,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GAAG,SAAS,MAAM,EAAE,CAAC;IACtB,kFAAkF;IAClF,iBAAiB,CAAC,OAAO,EAAE;QACzB,SAAS,EAAE,M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ACjD,OAAO,EAAE,iBAAiB,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;CACrB,EACD,WAAW,CAAC,EAAE,WAAW,GACxB,OAAO,CAAC,MAAM,CAAC,CAuBjB;AAED,iBAAS,cAAc,CAAC,MAAM,EAAE;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,cAAc,CAAC,gBAAgB,CAAC,CAAC;IACjD,OAAO,EAAE,iBAAiB,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;CACrB,GAAG,MAAM,CA4BT;AAkDD;;;;;;;;;GASG;AACH,iBAAS,6BAA6B,CAAC,CAAC,EAAE,UAAU,GAAG,OAAO,CAK7D;AAkCD;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAYxE;AAqDD,QAAA,MAAM,sBAAsB,69BAkBmE,CAAC;AAEhG,iBAAS,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,gBAAgB,EAAE,GAAG,MAAM,CAWjF;AAED,iBAAS,qBAAqB,CAC5B,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,gBAAgB,EAAE,GAC7B,uBAAuB,CAmEzB;AA6BD,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EAErB,6BAA6B,EAC7B,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,uBAAuB,EACvB,cAAc,EACd,eAAe,EACf,sBAAsB,GACvB,CAAC"}
1
+ {"version":3,"file":"correction-access-wiring.d.ts","sourceRoot":"","sources":["../../src/correction/correction-access-wiring.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AASH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAgB,YAAY,EAAE,MAAM,aAAa,CAAC;AAM1E,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK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M,sBAAsB,69BAkBmE,CAAC;AAEhG,iBAAS,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,gBAAgB,EAAE,GAAG,MAAM,CAWjF;AAED,iBAAS,qBAAqB,CAC5B,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,gBAAgB,EAAE,GAC7B,uBAAuB,CAmEzB;AA6BD,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EAErB,6BAA6B,EAC7B,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,uBAAuB,EACvB,cAAc,EACd,eAAe,EACf,sBAAsB,GACvB,CAAC"}
@@ -8,7 +8,7 @@ import {
8
8
  shouldSkipImplicitExtraction,
9
9
  stripInlineExplicitCaptureNotes,
10
10
  validateExplicitCaptureInput
11
- } from "./chunk-5YIOUS5T.js";
11
+ } from "./chunk-T2KCROPA.js";
12
12
  import "./chunk-RK7SE3BL.js";
13
13
  import "./chunk-GOZXQNIM.js";
14
14
  import "./chunk-PQM3B54K.js";
package/dist/index.js CHANGED
@@ -259,7 +259,7 @@ import {
259
259
  writeManifest,
260
260
  writeMeetingEpisodeMemory,
261
261
  writeTimelineState
262
- } from "./chunk-5YIOUS5T.js";
262
+ } from "./chunk-T2KCROPA.js";
263
263
  import {
264
264
  WEARABLE_SOURCE_PREFIX,
265
265
  WearablesInputError,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  BufferDrainRunner
3
- } from "../chunk-QMFHKWHN.js";
4
- import "../chunk-5YIOUS5T.js";
3
+ } from "../chunk-SLWD7TB6.js";
4
+ import "../chunk-T2KCROPA.js";
5
5
  import "../chunk-RK7SE3BL.js";
6
6
  import "../chunk-GOZXQNIM.js";
7
7
  import "../chunk-PQM3B54K.js";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  BufferDrainRunner,
3
3
  ClaimBufferStorage
4
- } from "../chunk-QMFHKWHN.js";
5
- import "../chunk-5YIOUS5T.js";
4
+ } from "../chunk-SLWD7TB6.js";
5
+ import "../chunk-T2KCROPA.js";
6
6
  import "../chunk-RK7SE3BL.js";
7
7
  import "../chunk-GOZXQNIM.js";
8
8
  import "../chunk-PQM3B54K.js";
@@ -6,7 +6,7 @@ import {
6
6
  mergeGraphExpandedResults,
7
7
  qmdStartupCollectionChecksWithTimeout,
8
8
  resolveEffectiveIdentityInjectionMode
9
- } from "./chunk-5YIOUS5T.js";
9
+ } from "./chunk-T2KCROPA.js";
10
10
  import "./chunk-RK7SE3BL.js";
11
11
  import "./chunk-GOZXQNIM.js";
12
12
  import "./chunk-PQM3B54K.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runRecallNavigation
3
- } from "./chunk-5YIOUS5T.js";
3
+ } from "./chunk-T2KCROPA.js";
4
4
  import "./chunk-RK7SE3BL.js";
5
5
  import "./chunk-GOZXQNIM.js";
6
6
  import "./chunk-PQM3B54K.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remnic/core",
3
- "version": "10.0.170",
3
+ "version": "10.0.171",
4
4
  "description": "Framework-agnostic Remnic memory engine — orchestrator, storage, extraction, search, trust zones",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -3416,7 +3416,7 @@
3416
3416
  "core"
3417
3417
  ],
3418
3418
  "peerDependencies": {
3419
- "@remnic/coding-graph": "^10.0.170"
3419
+ "@remnic/coding-graph": "^10.0.171"
3420
3420
  },
3421
3421
  "peerDependenciesMeta": {
3422
3422
  "@remnic/coding-graph": {
@@ -52,12 +52,14 @@ export interface ChatToolExecutor {
52
52
  scopeInspect(): Promise<string>;
53
53
  /**
54
54
  * Generate a correction plan. Returns a JSON string with a planId and
55
- * a diff preview. When the Correction Contract (#1580) is not merged,
56
- * this is a stub that returns a not-available marker.
55
+ * a diff preview, backed by the Correction Contract (#1580) pipeline.
57
56
  */
58
57
  correctionPlan(request: string): Promise<{ planId: string; preview: string }>;
59
58
  /**
60
- * Apply a correction plan. Returns a JSON result string.
59
+ * Apply a correction plan. Returns a JSON result string. Implementations
60
+ * pass `confirm: true` to the service; the engine's preview-confirm
61
+ * protocol is the consent that satisfies the apply gate, so this method
62
+ * must stay reachable only through the engine's confirmation flow.
61
63
  */
62
64
  correctionApply(planId: string): Promise<string>;
63
65
  /**
@@ -0,0 +1,150 @@
1
+ import assert from "node:assert/strict";
2
+ import test from "node:test";
3
+ import { EngramAccessService } from "../access-service.js";
4
+ import type {
5
+ CorrectionOutcome,
6
+ CorrectionPlan,
7
+ CorrectionRequest,
8
+ } from "../correction/index.js";
9
+ import { createChatExecutor } from "./chat-executor.js";
10
+
11
+ interface ApplyOpts {
12
+ confirm?: boolean;
13
+ namespace?: string;
14
+ sessionKey?: string;
15
+ principal?: string;
16
+ abortSignal?: AbortSignal;
17
+ }
18
+
19
+ interface ListPendingOpts {
20
+ namespace?: string;
21
+ sessionKey?: string;
22
+ principal?: string;
23
+ }
24
+
25
+ interface CapturedCalls {
26
+ planRequests: CorrectionRequest[];
27
+ applyPlanIds: string[];
28
+ applyOpts: ApplyOpts[];
29
+ listOpts: ListPendingOpts[];
30
+ }
31
+
32
+ /** Minimal correction surface; captures the args the executor sends. */
33
+ function fakeCorrectionService(calls: CapturedCalls, pending: CorrectionPlan[]): EngramAccessService {
34
+ // SAFETY: the double implements only the three correction methods the
35
+ // executor calls; no other EngramAccessService member is reached here.
36
+ const service = Object.create(EngramAccessService.prototype) as EngramAccessService;
37
+ service.correctionPlan = async (request: CorrectionRequest): Promise<CorrectionPlan> => {
38
+ calls.planRequests.push(request);
39
+ return {
40
+ planId: "corr-real-1",
41
+ request,
42
+ namespace: "ns",
43
+ affected: [],
44
+ classification: "wrong",
45
+ actions: [],
46
+ diff: "DIFF: rewrite fact",
47
+ confidence: 0.9,
48
+ warnings: [],
49
+ createdAt: "t",
50
+ expiresAt: "t+1h",
51
+ };
52
+ };
53
+ service.correctionApply = async (planId: string, opts: ApplyOpts): Promise<CorrectionOutcome> => {
54
+ calls.applyPlanIds.push(planId);
55
+ calls.applyOpts.push(opts);
56
+ return {
57
+ planId,
58
+ status: "applied",
59
+ results: [],
60
+ auditMemoryId: "audit-1",
61
+ appliedAt: "t",
62
+ };
63
+ };
64
+ service.correctionListPending = async (opts: ListPendingOpts): Promise<CorrectionPlan[]> => {
65
+ calls.listOpts.push(opts);
66
+ return pending;
67
+ };
68
+ return service;
69
+ }
70
+
71
+ function emptyCalls(): CapturedCalls {
72
+ return { planRequests: [], applyPlanIds: [], applyOpts: [], listOpts: [] };
73
+ }
74
+
75
+ test("correctionPlan delegates to the access-service plan path", async () => {
76
+ const calls = emptyCalls();
77
+ const executor = createChatExecutor({
78
+ service: fakeCorrectionService(calls, []),
79
+ principal: "reader",
80
+ namespace: "team",
81
+ sessionKey: "sess-1",
82
+ });
83
+ const plan = await executor.correctionPlan("the deploy day is wrong");
84
+ assert.equal(plan.planId, "corr-real-1");
85
+ assert.equal(plan.preview, "DIFF: rewrite fact");
86
+ const request = calls.planRequests[0];
87
+ assert.equal(request?.text, "the deploy day is wrong");
88
+ assert.equal(request?.sessionKey, "sess-1");
89
+ assert.equal(request?.principal, "reader");
90
+ assert.equal(request?.namespace, "team");
91
+ // The stub marker must be gone.
92
+ assert.ok(!plan.planId.startsWith("stub-"));
93
+ assert.ok(!plan.preview.includes("not yet available"));
94
+ });
95
+
96
+ test("correctionPlan retrieves a pending plan preview for the engine sentinel", async () => {
97
+ const calls = emptyCalls();
98
+ const pending: CorrectionPlan[] = [
99
+ {
100
+ planId: "corr-9",
101
+ request: { text: "prior request" },
102
+ namespace: "ns",
103
+ affected: [],
104
+ classification: "outdated",
105
+ actions: [],
106
+ diff: "DIFF: pending preview",
107
+ confidence: 0.8,
108
+ warnings: [],
109
+ createdAt: "t",
110
+ expiresAt: "t+1h",
111
+ },
112
+ ];
113
+ const executor = createChatExecutor({
114
+ service: fakeCorrectionService(calls, pending),
115
+ sessionKey: "sess-1",
116
+ });
117
+ const plan = await executor.correctionPlan("retrieve plan corr-9");
118
+ assert.equal(plan.planId, "corr-9");
119
+ assert.equal(plan.preview, "DIFF: pending preview");
120
+ assert.equal(calls.planRequests.length, 0, "sentinel must not mint a new plan");
121
+ assert.equal(calls.listOpts.length, 1);
122
+ await assert.rejects(
123
+ () => executor.correctionPlan("retrieve plan corr-missing"),
124
+ /not found|expired/i,
125
+ );
126
+ });
127
+
128
+ test("correctionApply delegates with confirm and the bound identity", async () => {
129
+ const calls = emptyCalls();
130
+ const executor = createChatExecutor({
131
+ service: fakeCorrectionService(calls, []),
132
+ principal: "writer",
133
+ namespace: "team",
134
+ sessionKey: "sess-2",
135
+ });
136
+ // SAFETY: correctionApply JSON.stringify's the service outcome, so the
137
+ // parsed shape is the CorrectionOutcome the fake returned.
138
+ const out = JSON.parse(await executor.correctionApply("corr-real-1")) as {
139
+ status: string;
140
+ auditMemoryId: string;
141
+ };
142
+ assert.equal(out.status, "applied");
143
+ assert.equal(out.auditMemoryId, "audit-1");
144
+ assert.equal(calls.applyPlanIds[0], "corr-real-1");
145
+ const opts = calls.applyOpts[0];
146
+ assert.equal(opts?.confirm, true);
147
+ assert.equal(opts?.sessionKey, "sess-2");
148
+ assert.equal(opts?.principal, "writer");
149
+ assert.equal(opts?.namespace, "team");
150
+ });
@@ -6,10 +6,9 @@
6
6
  * session's principal/namespace/sessionKey so every tool call flows through
7
7
  * access-service with the caller's identity (rule 42).
8
8
  *
9
- * Correction tools (correction_plan / correction_apply / memory_promote) are
10
- * stubbed behind the same interface until the Correction Contract (#1580)
11
- * merges. The stub returns a clear not-available marker so the engine and
12
- * surfaces degrade gracefully.
9
+ * Correction tools (correction_plan / correction_apply / memory_promote)
10
+ * delegate to the Correction Contract (#1580) plan/apply pipeline through
11
+ * the access-service.
13
12
  */
14
13
 
15
14
  import type { EngramAccessService } from "../access-service.js";
@@ -27,6 +26,10 @@ export interface ChatExecutorBindings {
27
26
  */
28
27
  export function createChatExecutor(bindings: ChatExecutorBindings): ChatToolExecutor {
29
28
  const { service, principal, namespace, sessionKey } = bindings;
29
+ const correctionScope: Parameters<EngramAccessService["correctionListPending"]>[0] = {};
30
+ if (namespace) correctionScope.namespace = namespace;
31
+ if (sessionKey) correctionScope.sessionKey = sessionKey;
32
+ if (principal) correctionScope.principal = principal;
30
33
 
31
34
  return {
32
35
  async memorySearch(query: string, maxResults?: number): Promise<string> {
@@ -86,28 +89,36 @@ export function createChatExecutor(bindings: ChatExecutorBindings): ChatToolExec
86
89
  });
87
90
  },
88
91
 
89
- // ── Correction tools — stubbed until #1580 merges ──────────────────
90
- // When the Correction Contract lands, replace these stubs with calls to
91
- // the correction module's plan/apply interface. The engine, CLI, and
92
- // MCP tool all consume this interface, so the stub-to-real swap is a
93
- // single-file change here.
92
+ // ── Correction tools — Correction Contract (#1580) ─────────────────
93
+ // Thin adapters over the service's plan/apply pipeline. The engine's
94
+ // confirmation interception asks for a pending plan's preview via the
95
+ // "retrieve plan <id>" sentinel; that is a lookup, not a new plan.
94
96
 
95
97
  async correctionPlan(request: string): Promise<{ planId: string; preview: string }> {
96
- // Stub: the Correction Contract (#1580) is not yet merged.
97
- // Return a not-available marker that the engine surfaces gracefully.
98
- return {
99
- planId: `stub-${Date.now()}`,
100
- preview: `[Correction Contract (#1580) not yet available]\n\nRequested correction: "${request}"\n\nThe plan/apply pipeline is pending. Inspection tools are fully functional.`,
101
- };
98
+ const retrieve = /^retrieve plan (\S+)$/i.exec(request.trim());
99
+ if (retrieve) {
100
+ const pending = await service.correctionListPending(correctionScope);
101
+ const plan = pending.find((p) => p.planId === retrieve[1]);
102
+ if (!plan) {
103
+ throw new Error(`Correction plan ${retrieve[1]} not found or expired.`);
104
+ }
105
+ return { planId: plan.planId, preview: plan.diff };
106
+ }
107
+ const plan = await service.correctionPlan({
108
+ text: request,
109
+ ...correctionScope,
110
+ });
111
+ return { planId: plan.planId, preview: plan.diff };
102
112
  },
103
113
 
104
114
  async correctionApply(planId: string): Promise<string> {
105
- // Stub: no-op until #1580 merges.
106
- return JSON.stringify({
107
- applied: false,
108
- planId,
109
- reason: "Correction Contract (#1580) not yet available. No mutation was applied.",
115
+ // The engine's confirmation protocol is the explicit consent; pass it
116
+ // through as confirm so the apply gate sees a confirmed call.
117
+ const outcome = await service.correctionApply(planId, {
118
+ confirm: true,
119
+ ...correctionScope,
110
120
  });
121
+ return JSON.stringify(outcome);
111
122
  },
112
123
 
113
124
  async memoryPromote(memoryId: string): Promise<string> {
@@ -62,7 +62,7 @@ export function createChatEngine(opts: ChatEngineFactoryOptions): ChatEngine | n
62
62
  executor,
63
63
  maxToolCallsPerTurn: opts.config.maxToolCallsPerTurn,
64
64
  ...(opts.config.model ? { model: opts.config.model } : {}),
65
- correctionAvailable: false,
65
+ correctionAvailable: opts.service.correctionSurfaceVisible,
66
66
  scopeInspectAvailable: false,
67
67
  });
68
68
  }
@@ -947,7 +947,10 @@ function toExecutorMemory(m: MemoryFile): ExecutorMemory {
947
947
  * can never drift out of sync (review thread: correction-gate-config-mismatch):
948
948
  * - nested: `config.correction.enabled`
949
949
  * - flat: the `correctionEnabled` legacy key (ratchet-safe shape)
950
- * Nested wins when present; both default to `true` (plan is read-only, safe on).
950
+ * Nested wins when present; both default to `true`. Default-on predates the
951
+ * chat wiring: the executor's plan/apply tools are mutation-capable but sit
952
+ * behind the engine's interactive preview-confirm protocol, so enabled-by-
953
+ * default is intended for human-attended surfaces.
951
954
  */
952
955
  export function isCorrectionFeatureEnabled(config: PluginConfig): boolean {
953
956
  // parseConfig now resolves this into `resolveRecallAuxiliaryCapabilities(config).correction` (review