From abeefc63a4c590333fd59b6f9484f7abde4d46ad Mon Sep 17 00:00:00 2001 From: allthewayeast Date: Tue, 29 Sep 2026 07:00:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AF=BC=E8=87=B4V4=E4=BC=9A?= =?UTF-8?q?=E8=AF=9D=E9=94=99=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cordis.patch.yml | 5 ++++- dist/dsh.js | 10 ++++++---- dist/src/format/dsh-compaction.js | 2 +- dist/src/format/dsh-turn-projection.js | 2 +- dsh.ts | 10 ++++++---- src/format/dsh-compaction.ts | 2 +- src/format/dsh-turn-projection.ts | 2 +- 7 files changed, 20 insertions(+), 13 deletions(-) diff --git a/cordis.patch.yml b/cordis.patch.yml index 192c762..8f01324 100644 --- a/cordis.patch.yml +++ b/cordis.patch.yml @@ -17,7 +17,10 @@ # are set, this route takes precedence over the foreground Agent model. llmProvider: !!js process.env.GRAPH_MEMORY_LLM_PROVIDER llmModel: !!js process.env.GRAPH_MEMORY_LLM_MODEL - llmReasoningEffort: !!js process.env.GRAPH_MEMORY_LLM_REASONING_EFFORT + # Local patch: providers that cannot disable reasoning reject "off" + # (the plugin's built-in default), which quarantines every extraction. + # Fall back to the cheapest declared level unless the env var overrides it. + llmReasoningEffort: !!js "process.env.GRAPH_MEMORY_LLM_REASONING_EFFORT ? process.env.GRAPH_MEMORY_LLM_REASONING_EFFORT : 'low'" llmMaxTokens: !!js "process.env.GRAPH_MEMORY_LLM_MAX_TOKENS ? Number(process.env.GRAPH_MEMORY_LLM_MAX_TOKENS) : undefined" # Each committed DSH turn is one extraction job containing only the # original user question and the final visible assistant answer. diff --git a/dist/dsh.js b/dist/dsh.js index 9f9fceb..fc4371b 100644 --- a/dist/dsh.js +++ b/dist/dsh.js @@ -197,7 +197,7 @@ export function apply(ctx, input = {}) { id: randomUUID(), role: "user", content: [{ type: "text", text: user }], - source: { kind: "plugin", plugin: PLUGIN }, + source: { kind: `plugin:${PLUGIN}`, plugin: PLUGIN }, }], }); for await (const chunk of chunks) { @@ -531,9 +531,11 @@ export function apply(ctx, input = {}) { const visibleMessageIds = new Set(surfaceSeqs.map(seq => `${HOST}:${key}:${String(seq)}`)); const hasArchivedHistory = surfaceSeqs.some(seq => { const event = immutableEvents?.[seq]; + const source = event?.data?.source; + const ownedSource = source?.kind === `plugin:${PLUGIN}` + || source?.kind === "plugin" && source?.plugin === PLUGIN; return event?.type === "user/message" - && event?.data?.source?.kind === "plugin" - && event?.data?.source?.plugin === PLUGIN + && ownedSource && event?.surfaceOp?.op === "replace"; }); const recalledNodes = filterDshRecallNodes(recalled.nodes, getNodeSources(db, recalled.nodes.map(node => node.id)), currentSession, visibleMessageIds, hasArchivedHistory); @@ -562,7 +564,7 @@ export function apply(ctx, input = {}) { id: randomUUID(), role: "user", source: { - kind: "plugin", + kind: `plugin:${PLUGIN}`, plugin: PLUGIN, form: "snapshot", sections: [{ name: "graph-memory:recall", text }], diff --git a/dist/src/format/dsh-compaction.js b/dist/src/format/dsh-compaction.js index 9bee1fa..8828476 100644 --- a/dist/src/format/dsh-compaction.js +++ b/dist/src/format/dsh-compaction.js @@ -99,7 +99,7 @@ export function replaceDshArchivedPrefix(session, tokenMeter, range) { const replacement = session.append("user/message", { id: `graph-memory-archive:${String(session.id ?? "session")}:${range.start}-${range.end}`, role: "user", - source: { kind: "plugin", plugin: "graph-memory" }, + source: { kind: "plugin:graph-memory", plugin: "graph-memory" }, content: [{ type: "text", text: DSH_ARCHIVE_MARKER }], }, { // Match the current DSH Session surface-operation contract exactly. diff --git a/dist/src/format/dsh-turn-projection.js b/dist/src/format/dsh-turn-projection.js index 6e76d81..841e262 100644 --- a/dist/src/format/dsh-turn-projection.js +++ b/dist/src/format/dsh-turn-projection.js @@ -171,7 +171,7 @@ export function replaceDshCompletedTurnTrace(session, tokenMeter, range) { const replacement = session.append("user/message", { id: `graph-memory-turn-trace:${String(session.id ?? "session")}:${range.turn}`, role: "user", - source: { kind: "plugin", plugin: "graph-memory" }, + source: { kind: "plugin:graph-memory", plugin: "graph-memory" }, content: [{ type: "text", text: `Intermediate tool trace archived; the original question and final answer remain visible.`, diff --git a/dsh.ts b/dsh.ts index 3d9e96a..8b5a64b 100644 --- a/dsh.ts +++ b/dsh.ts @@ -321,7 +321,7 @@ export function apply(ctx: DshContext, input: Config = {}): void { id: randomUUID(), role: "user", content: [{ type: "text", text: user }], - source: { kind: "plugin", plugin: PLUGIN }, + source: { kind: `plugin:${PLUGIN}`, plugin: PLUGIN }, }], }); for await (const chunk of chunks) { @@ -680,9 +680,11 @@ export function apply(ctx: DshContext, input: Config = {}): void { const visibleMessageIds = new Set(surfaceSeqs.map(seq => `${HOST}:${key}:${String(seq)}`)); const hasArchivedHistory = surfaceSeqs.some(seq => { const event = immutableEvents?.[seq]; + const source = event?.data?.source; + const ownedSource = source?.kind === `plugin:${PLUGIN}` + || source?.kind === "plugin" && source?.plugin === PLUGIN; return event?.type === "user/message" - && event?.data?.source?.kind === "plugin" - && event?.data?.source?.plugin === PLUGIN + && ownedSource && event?.surfaceOp?.op === "replace"; }); const recalledNodes = filterDshRecallNodes( @@ -719,7 +721,7 @@ export function apply(ctx: DshContext, input: Config = {}): void { id: randomUUID(), role: "user", source: { - kind: "plugin", + kind: `plugin:${PLUGIN}`, plugin: PLUGIN, form: "snapshot", sections: [{ name: "graph-memory:recall", text }], diff --git a/src/format/dsh-compaction.ts b/src/format/dsh-compaction.ts index ab42cba..87cd33d 100644 --- a/src/format/dsh-compaction.ts +++ b/src/format/dsh-compaction.ts @@ -147,7 +147,7 @@ export function replaceDshArchivedPrefix( const replacement = session.append("user/message", { id: `graph-memory-archive:${String(session.id ?? "session")}:${range.start}-${range.end}`, role: "user", - source: { kind: "plugin", plugin: "graph-memory" }, + source: { kind: "plugin:graph-memory", plugin: "graph-memory" }, content: [{ type: "text", text: DSH_ARCHIVE_MARKER }], }, { // Match the current DSH Session surface-operation contract exactly. diff --git a/src/format/dsh-turn-projection.ts b/src/format/dsh-turn-projection.ts index c5c5161..d98c040 100644 --- a/src/format/dsh-turn-projection.ts +++ b/src/format/dsh-turn-projection.ts @@ -228,7 +228,7 @@ export function replaceDshCompletedTurnTrace( const replacement = session.append("user/message", { id: `graph-memory-turn-trace:${String(session.id ?? "session")}:${range.turn}`, role: "user", - source: { kind: "plugin", plugin: "graph-memory" }, + source: { kind: "plugin:graph-memory", plugin: "graph-memory" }, content: [{ type: "text", text: `Intermediate tool trace archived; the original question and final answer remain visible.`,