stratagate-dsh 0.2.91 → 0.2.93
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/CHANGELOG.md +14 -0
- package/README.md +67 -199
- package/README.zh-CN.md +68 -209
- package/dist/client.js +3 -3
- package/dist/plugin.js +79 -43
- package/dist/plugin.js.map +1 -1
- package/docs/ARCHITECTURE.md +32 -0
- package/docs/DSH.md +7 -3
- package/docs/DSH.zh-CN.md +7 -3
- package/docs/EVALUATION.md +10 -0
- package/docs/EXTERNAL_MEMORY_IMPORT.zh-CN.md +45 -0
- package/package.json +28 -25
package/dist/plugin.js
CHANGED
|
@@ -1864,6 +1864,8 @@ function normalizeSnapshot(value) {
|
|
|
1864
1864
|
}
|
|
1865
1865
|
const sourceBlockMap = new Map(snapshot.blocks.map((block) => [block.id, block]));
|
|
1866
1866
|
for (const event of [...snapshot.events, ...snapshot.agentEvents]) {
|
|
1867
|
+
delete event.narrative;
|
|
1868
|
+
delete event.confidence;
|
|
1867
1869
|
event.temporal = { ...event.temporal, eventType: normalizeStandardEventType(event.temporal.eventType) };
|
|
1868
1870
|
if (event.formedTurn === void 0) {
|
|
1869
1871
|
const sourceBlock = event.sourceBlockId !== void 0 ? sourceBlockMap.get(event.sourceBlockId) : void 0;
|
|
@@ -2408,7 +2410,6 @@ function mapEventRows(rows, sourcesByEvent, table) {
|
|
|
2408
2410
|
id: row.id,
|
|
2409
2411
|
title: row.title,
|
|
2410
2412
|
summary: row.summary,
|
|
2411
|
-
narrative: row.narrative,
|
|
2412
2413
|
tags: parseJson(row.tags_json, `${table}.tags_json`),
|
|
2413
2414
|
quotes: parseJson(row.quotes_json, `${table}.quotes_json`),
|
|
2414
2415
|
sourceMessageIds: sourcesByEvent.get(row.id) ?? [],
|
|
@@ -2420,7 +2421,6 @@ function mapEventRows(rows, sourcesByEvent, table) {
|
|
|
2420
2421
|
})(),
|
|
2421
2422
|
scope: row.scope,
|
|
2422
2423
|
criticality: row.criticality,
|
|
2423
|
-
confidence: row.confidence,
|
|
2424
2424
|
status: row.status,
|
|
2425
2425
|
supersededBy: row.superseded_by,
|
|
2426
2426
|
weight: {
|
|
@@ -3043,7 +3043,7 @@ var SqliteStorage = class {
|
|
|
3043
3043
|
eventPosition,
|
|
3044
3044
|
event.title,
|
|
3045
3045
|
event.summary,
|
|
3046
|
-
event.
|
|
3046
|
+
event.summary,
|
|
3047
3047
|
JSON.stringify(event.tags),
|
|
3048
3048
|
JSON.stringify(event.quotes),
|
|
3049
3049
|
event.sourceBlockId,
|
|
@@ -3051,7 +3051,7 @@ var SqliteStorage = class {
|
|
|
3051
3051
|
JSON.stringify(event.temporal),
|
|
3052
3052
|
event.scope,
|
|
3053
3053
|
event.criticality,
|
|
3054
|
-
|
|
3054
|
+
1,
|
|
3055
3055
|
event.status,
|
|
3056
3056
|
event.supersededBy,
|
|
3057
3057
|
event.weight.mentionCount,
|
|
@@ -3087,7 +3087,7 @@ var SqliteStorage = class {
|
|
|
3087
3087
|
eventPosition,
|
|
3088
3088
|
event.title,
|
|
3089
3089
|
event.summary,
|
|
3090
|
-
event.
|
|
3090
|
+
event.summary,
|
|
3091
3091
|
JSON.stringify(event.tags),
|
|
3092
3092
|
JSON.stringify(event.quotes),
|
|
3093
3093
|
event.sourceBlockId ?? null,
|
|
@@ -3095,7 +3095,7 @@ var SqliteStorage = class {
|
|
|
3095
3095
|
JSON.stringify(event.temporal),
|
|
3096
3096
|
event.scope,
|
|
3097
3097
|
event.criticality,
|
|
3098
|
-
|
|
3098
|
+
1,
|
|
3099
3099
|
event.status,
|
|
3100
3100
|
event.supersededBy,
|
|
3101
3101
|
event.weight.mentionCount,
|
|
@@ -3685,6 +3685,19 @@ function agentEventCandidate(content, category, now, threadId) {
|
|
|
3685
3685
|
};
|
|
3686
3686
|
}
|
|
3687
3687
|
var DERIVATION_BACKOFF_MS = 1e3;
|
|
3688
|
+
function restrictExtractionRelations(temporal, allowedIds) {
|
|
3689
|
+
const result = { ...temporal };
|
|
3690
|
+
if (typeof result.sameEventId !== "string" || !allowedIds.has(result.sameEventId)) {
|
|
3691
|
+
delete result.sameEventId;
|
|
3692
|
+
}
|
|
3693
|
+
for (const field of ["beforeEventIds", "afterEventIds", "supersedesEventIds", "conflictsWithEventIds", "relatedEventIds"]) {
|
|
3694
|
+
const values = temporal[field];
|
|
3695
|
+
const ids = Array.isArray(values) ? [...new Set(values.filter((id) => typeof id === "string" && allowedIds.has(id)))] : [];
|
|
3696
|
+
if (ids.length > 0) result[field] = ids;
|
|
3697
|
+
else delete result[field];
|
|
3698
|
+
}
|
|
3699
|
+
return result;
|
|
3700
|
+
}
|
|
3688
3701
|
var StrataGate = class _StrataGate {
|
|
3689
3702
|
blockTurnSizeValue;
|
|
3690
3703
|
blockDecayLambdaValue;
|
|
@@ -4636,7 +4649,6 @@ var StrataGate = class _StrataGate {
|
|
|
4636
4649
|
[event.summary, 3],
|
|
4637
4650
|
[event.tags.join(" "), 2],
|
|
4638
4651
|
[event.quotes.join(" "), 2],
|
|
4639
|
-
[event.narrative, 1],
|
|
4640
4652
|
[(event.temporal.participants ?? []).join(" "), 5],
|
|
4641
4653
|
[event.temporal.eventType ?? "", 5],
|
|
4642
4654
|
[event.temporal.originalText ?? "", 4],
|
|
@@ -5383,7 +5395,6 @@ var StrataGate = class _StrataGate {
|
|
|
5383
5395
|
formedTurn: parts.formedTurn,
|
|
5384
5396
|
title: input.title.trim(),
|
|
5385
5397
|
summary: input.summary.trim(),
|
|
5386
|
-
narrative: input.narrative?.trim() || input.summary.trim(),
|
|
5387
5398
|
tags: [...new Set(input.tags ?? [])].slice(0, 12),
|
|
5388
5399
|
quotes: [...new Set(input.quotes ?? [])].slice(0, 12),
|
|
5389
5400
|
sourceMessageIds: parts.sourceMessageIds,
|
|
@@ -5394,7 +5405,6 @@ var StrataGate = class _StrataGate {
|
|
|
5394
5405
|
},
|
|
5395
5406
|
scope: input.scope ?? "user",
|
|
5396
5407
|
criticality: parts.criticality,
|
|
5397
|
-
confidence: Math.max(0, Math.min(1, input.confidence ?? 1)),
|
|
5398
5408
|
status: "active",
|
|
5399
5409
|
supersededBy: null,
|
|
5400
5410
|
weight: {
|
|
@@ -5905,6 +5915,7 @@ var StrataGate = class _StrataGate {
|
|
|
5905
5915
|
});
|
|
5906
5916
|
});
|
|
5907
5917
|
let result;
|
|
5918
|
+
let allowedTimelineEventIds = /* @__PURE__ */ new Set();
|
|
5908
5919
|
try {
|
|
5909
5920
|
const query = [target.l0Title, target.l1Summary, ...target.l2Keypoints ?? []].filter(Boolean).join(" ");
|
|
5910
5921
|
const relevant = query ? (await this.searchEvents(query, { limit: 8, trackRetrieval: false })).map(({ event }) => event) : [];
|
|
@@ -5914,11 +5925,12 @@ var StrataGate = class _StrataGate {
|
|
|
5914
5925
|
for (const event of recent) {
|
|
5915
5926
|
if (!timelineEvents.has(event.id)) timelineEvents.set(event.id, event);
|
|
5916
5927
|
}
|
|
5928
|
+
allowedTimelineEventIds = new Set(timelineEvents.keys());
|
|
5917
5929
|
result = await this.extractor({
|
|
5918
5930
|
previous: threadBlocks.slice(0, targetIndex).reverse().find((block) => block.l2Keypoints !== void 0) ?? null,
|
|
5919
5931
|
target,
|
|
5920
5932
|
next,
|
|
5921
|
-
timeline: [...timelineEvents.values()].map((event) => ({ id: event.id, title: event.title, temporal: event.temporal }))
|
|
5933
|
+
timeline: [...timelineEvents.values()].map((event) => ({ id: event.id, title: event.title, temporal: structuredClone(event.temporal) }))
|
|
5922
5934
|
});
|
|
5923
5935
|
} catch (error) {
|
|
5924
5936
|
await this.commitMutation(() => {
|
|
@@ -5950,7 +5962,15 @@ var StrataGate = class _StrataGate {
|
|
|
5950
5962
|
throw new Error(reason);
|
|
5951
5963
|
}
|
|
5952
5964
|
return this.commitMutation(() => {
|
|
5953
|
-
const
|
|
5965
|
+
const allowedIds = new Set([...allowedTimelineEventIds].filter((id) => {
|
|
5966
|
+
const event = this.findEvent(id);
|
|
5967
|
+
return event?.status === "active" || event?.status === "superseded";
|
|
5968
|
+
}));
|
|
5969
|
+
const extracted = result.shouldExtract ? result.events.map((event) => this.addEventInMemory({
|
|
5970
|
+
...event,
|
|
5971
|
+
sourceBlockId: target.id,
|
|
5972
|
+
...event.temporal ? { temporal: restrictExtractionRelations(event.temporal, allowedIds) } : {}
|
|
5973
|
+
})) : [];
|
|
5954
5974
|
if (extracted.length > 0) {
|
|
5955
5975
|
const ids = extracted.map(({ id }) => id);
|
|
5956
5976
|
this.queueElementProjection(ids);
|
|
@@ -6181,7 +6201,7 @@ var StrataGate = class _StrataGate {
|
|
|
6181
6201
|
import { readFileSync } from "node:fs";
|
|
6182
6202
|
import { createRequire } from "node:module";
|
|
6183
6203
|
var nodeRequire = createRequire(import.meta.url);
|
|
6184
|
-
var
|
|
6204
|
+
var CORE_RUNTIME_PACKAGES = [
|
|
6185
6205
|
"@deepseek-ai/cordis",
|
|
6186
6206
|
"@deepseek-ai/dsh-agent-default-model",
|
|
6187
6207
|
"@deepseek-ai/dsh-client-ui-conversation",
|
|
@@ -6193,6 +6213,12 @@ var RUNTIME_PACKAGES = [
|
|
|
6193
6213
|
"@deepseek-ai/dsh-tools",
|
|
6194
6214
|
"@deepseek-ai/schemastery"
|
|
6195
6215
|
];
|
|
6216
|
+
var SESSION_FORMAT_PACKAGES = [
|
|
6217
|
+
"@deepseek-ai/dsh-session-format",
|
|
6218
|
+
"@deepseek-ai/dsh-session-format-catalog",
|
|
6219
|
+
"@deepseek-ai/dsh-session-format-v0-to-v1"
|
|
6220
|
+
];
|
|
6221
|
+
var RUNTIME_PACKAGES = [...CORE_RUNTIME_PACKAGES, ...SESSION_FORMAT_PACKAGES];
|
|
6196
6222
|
var SUPPORTED_RUNTIME_FAMILIES = [
|
|
6197
6223
|
{
|
|
6198
6224
|
cli: "0.1.2-rc.1",
|
|
@@ -6271,8 +6297,15 @@ var SUPPORTED_RUNTIME_FAMILIES = [
|
|
|
6271
6297
|
}
|
|
6272
6298
|
];
|
|
6273
6299
|
var STRATAGATE_MESSAGE_SOURCE_KIND = "plugin:stratagate-memory";
|
|
6300
|
+
function isDsh020Version(version) {
|
|
6301
|
+
const match = /^0\.2\.0(?:-([0-9A-Za-z.-]+))?(?:\+([0-9A-Za-z.-]+))?$/.exec(version);
|
|
6302
|
+
if (!match) return false;
|
|
6303
|
+
const prerelease = match[1]?.split(".") ?? [];
|
|
6304
|
+
const build = match[2]?.split(".") ?? [];
|
|
6305
|
+
return [...prerelease, ...build].every((part) => part.length > 0) && prerelease.every((part) => !/^\d+$/.test(part) || part === "0" || !part.startsWith("0"));
|
|
6306
|
+
}
|
|
6274
6307
|
function buildDshMessageSource(version, form) {
|
|
6275
|
-
const source = /^0\.1\.7(?:-|$)/.test(version) ? { kind: STRATAGATE_MESSAGE_SOURCE_KIND } : { kind: "plugin", plugin: "stratagate-memory" };
|
|
6308
|
+
const source = /^0\.1\.7(?:-|$)/.test(version) || isDsh020Version(version) ? { kind: STRATAGATE_MESSAGE_SOURCE_KIND } : { kind: "plugin", plugin: "stratagate-memory" };
|
|
6276
6309
|
return form ? { ...source, form } : source;
|
|
6277
6310
|
}
|
|
6278
6311
|
function installedVersion(packageName) {
|
|
@@ -6303,16 +6336,17 @@ function isCompatiblePatch(version, major, minor, minimumPatch) {
|
|
|
6303
6336
|
return !!match && Number(match[1]) === major && Number(match[2]) === minor && Number(match[3]) >= minimumPatch;
|
|
6304
6337
|
}
|
|
6305
6338
|
function classifyDshRuntime(packageVersions) {
|
|
6306
|
-
const family = SUPPORTED_RUNTIME_FAMILIES.find(({ versions }) =>
|
|
6339
|
+
const family = SUPPORTED_RUNTIME_FAMILIES.find(({ versions }) => CORE_RUNTIME_PACKAGES.every((name2) => packageVersions[name2] === versions[name2]));
|
|
6307
6340
|
if (family) return { cliVersion: family.cli, packageVersions };
|
|
6308
6341
|
const dshVersion = packageVersions["@deepseek-ai/dsh-session"];
|
|
6309
|
-
const sameDshFamily =
|
|
6310
|
-
|
|
6342
|
+
const sameDshFamily = CORE_RUNTIME_PACKAGES.filter((name2) => name2.startsWith("@deepseek-ai/dsh-")).every((name2) => packageVersions[name2] === dshVersion);
|
|
6343
|
+
const sameSessionFormatFamily = !isDsh020Version(dshVersion) || SESSION_FORMAT_PACKAGES.every((name2) => packageVersions[name2] === dshVersion);
|
|
6344
|
+
if ((/^0\.1\.7-rc\.[1-9]\d*$/.test(dshVersion) || dshVersion === "0.1.7" || isDsh020Version(dshVersion)) && sameDshFamily && sameSessionFormatFamily && isCompatiblePatch(packageVersions["@deepseek-ai/cordis"], 4, 0, 4) && isCompatiblePatch(packageVersions["@deepseek-ai/schemastery"], 3, 18, 4)) {
|
|
6311
6345
|
return { cliVersion: dshVersion, packageVersions };
|
|
6312
6346
|
}
|
|
6313
6347
|
const found = RUNTIME_PACKAGES.map((name2) => `${name2}@${packageVersions[name2]}`).join(", ");
|
|
6314
6348
|
throw new Error(
|
|
6315
|
-
`StrataGate cannot start because this DSH profile resolves an unsupported or mixed core runtime. Resolved: ${found}. Supported hosts are @deepseek-ai/dsh@0.1.2-rc.1 (internal DSH packages 0.1.2-rc.1) and @deepseek-ai/dsh@0.1.5-rc.1 (its real dependency tree uses internal DSH packages 0.1.5-rc.2), and @deepseek-ai/dsh@0.1.6-alpha.1 (internal DSH packages 0.1.6-alpha.1), and the coherent DSH 0.1.7 family from rc.1 through the 0.1.7 release (Cordis 4.0.x from 4.0.4, Schemastery 3.18.x from 3.18.4). Reinstall or update stratagate-dsh through \`dsh plugin --profile <name> add <package>\` so the host supplies its peers.`
|
|
6349
|
+
`StrataGate cannot start because this DSH profile resolves an unsupported or mixed core runtime. Resolved: ${found}. Supported hosts are @deepseek-ai/dsh@0.1.2-rc.1 (internal DSH packages 0.1.2-rc.1) and @deepseek-ai/dsh@0.1.5-rc.1 (its real dependency tree uses internal DSH packages 0.1.5-rc.2), and @deepseek-ai/dsh@0.1.6-alpha.1 (internal DSH packages 0.1.6-alpha.1), and the coherent DSH 0.1.7 family from rc.1 through the 0.1.7 release, and the complete DSH 0.2.0 family (all alpha, beta, rc, and stable versions; >=0.2.0-0 <0.2.1-0) (Cordis 4.0.x from 4.0.4, Schemastery 3.18.x from 3.18.4). Reinstall or update stratagate-dsh through \`dsh plugin --profile <name> add <package>\` so the host supplies its peers.`
|
|
6316
6350
|
);
|
|
6317
6351
|
}
|
|
6318
6352
|
function assertCompatibleDshRuntime() {
|
|
@@ -6526,22 +6560,20 @@ var EVENT_ITEM = {
|
|
|
6526
6560
|
type: "object",
|
|
6527
6561
|
additionalProperties: false,
|
|
6528
6562
|
properties: {
|
|
6529
|
-
title: { type: "string", required: true },
|
|
6530
|
-
summary: { type: "string", required: true },
|
|
6531
|
-
|
|
6532
|
-
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
criticality: { type: "string", enum: ["routine", "preference", "identity", "safety"] },
|
|
6538
|
-
confidence: { type: "number" }
|
|
6563
|
+
title: { type: "string", description: "A short, specific, retrieval-friendly title stating the canonical subject and the single main event or state change. Prefer explicit names, versions, tools, projects, or decisions supported by the source. Avoid pronouns, vague wording, unsupported synonyms, and keyword stuffing.", required: true },
|
|
6564
|
+
summary: { type: "string", description: "A concise, self-contained statement of one event: identify the concrete subject, what happened or became true, and the important result or current status. Preserve exact names and distinctive source-supported terms useful for retrieval. Do not add unstated causes, conclusions, certainty, or relationships.", required: true },
|
|
6565
|
+
tags: { ...STRING_ARRAY, description: "A small set of distinctive retrieval labels that add useful search entry points not already obvious from the event type or participants. Use only source-supported canonical names, projects, tools, versions, technologies, concepts, aliases, or abbreviations. Avoid generic, speculative, weakly related, or redundant tags." },
|
|
6566
|
+
quotes: { ...STRING_ARRAY, description: "A few short verbatim excerpts that directly support the extracted event and whose exact wording has lasting evidential or retrieval value. Copy exactly from the source messages. Do not quote unrelated context, paraphrase, or select wording that changes the original meaning." },
|
|
6567
|
+
sourceMessageIds: { ...STRING_ARRAY, description: "The smallest set of exact message IDs from the target Block that directly supports every material claim in this event. Do not include merely related messages, and do not cite messages that support only background context.", required: true },
|
|
6568
|
+
temporal: { ...OPEN_OBJECT, description: "Structured temporal and event metadata, including when the event happened or was mentioned, its event type, participants, precision, and basis. Preserve uncertainty and do not invent missing times, participants, chronology, or relationships." },
|
|
6569
|
+
scope: { type: "string", enum: ["user", "project", "session"], description: "The memory scope of the event: user for durable user-level facts or preferences, project for project-specific facts and decisions, and session only for temporary context that should not generalize beyond the current session." },
|
|
6570
|
+
criticality: { type: "string", enum: ["routine", "preference", "identity", "safety"], description: "The event's persistence class: routine for ordinary facts and outcomes, preference for durable user preferences, identity for stable identity-related facts, and safety only for safety-critical information. Do not inflate criticality merely because an event seems important." }
|
|
6539
6571
|
}
|
|
6540
6572
|
};
|
|
6541
6573
|
var EXTRACTOR_PARAMETERS = {
|
|
6542
|
-
shouldExtract: { type: "boolean", required: true },
|
|
6543
|
-
reason: { type: "string", required: true },
|
|
6544
|
-
events: { type: "array", items: EVENT_ITEM, required: true }
|
|
6574
|
+
shouldExtract: { type: "boolean", description: "The Event Extractor's final judgment: true only when at least one durable Event is directly supported by target.messages. False when none qualifies, even if the Summarizer pre-screen was true; then return an empty events array.", required: true },
|
|
6575
|
+
reason: { type: "string", description: "Briefly explain the final decision to extract or not extract; do not use this field as Event content.", required: true },
|
|
6576
|
+
events: { type: "array", items: EVENT_ITEM, description: "Zero or more atomic, self-contained Event cards directly supported by target.messages. Separate independently changing, conflicting, or retrievable facts.", required: true }
|
|
6545
6577
|
};
|
|
6546
6578
|
var VALUE = {
|
|
6547
6579
|
oneOf: [
|
|
@@ -6656,7 +6688,7 @@ var STRUCTURED_TOOLS = {
|
|
|
6656
6688
|
},
|
|
6657
6689
|
extractor: {
|
|
6658
6690
|
name: "stratagate_extract_event_cards",
|
|
6659
|
-
description: "Submit
|
|
6691
|
+
description: "Submit the Event Extractor's final decision and zero or more atomic, self-contained, source-grounded long-term Event cards. Extract only from target.messages; return shouldExtract=false and events=[] when no durable target-supported Event qualifies.",
|
|
6660
6692
|
parameters: EXTRACTOR_PARAMETERS
|
|
6661
6693
|
},
|
|
6662
6694
|
projector: {
|
|
@@ -6706,7 +6738,6 @@ function compactGraphProjectionContext(context) {
|
|
|
6706
6738
|
id: event.id,
|
|
6707
6739
|
title: event.title,
|
|
6708
6740
|
summary: event.summary,
|
|
6709
|
-
narrative: event.narrative,
|
|
6710
6741
|
tags: event.tags,
|
|
6711
6742
|
quotes: event.quotes,
|
|
6712
6743
|
temporal: event.temporal,
|
|
@@ -6810,7 +6841,15 @@ var DshModelBridge = class {
|
|
|
6810
6841
|
const validMessageIds = new Set(context.target.l5Raw.map((message) => message.id));
|
|
6811
6842
|
const raw = object(await this.callStructured(
|
|
6812
6843
|
"extractor",
|
|
6813
|
-
`
|
|
6844
|
+
`You are the StrataGate Event Extractor. Make the final extraction decision independently of the Summarizer's high-recall pre-screen. Extract durable, evidence-backed events from target.messages, then call ${STRUCTURED_TOOLS.extractor.name} exactly once. If none qualifies, set shouldExtract=false and events=[]; give a brief reason, not an Event body.
|
|
6845
|
+
|
|
6846
|
+
Each Event is one atomic fact, decision, plan, outcome, or state change that can independently be retrieved, updated, superseded, or contradicted. If two facts can change or conflict separately, create separate Events; never combine them merely to reduce the Event count. Make title and summary self-contained: name the concrete subject rather than using it, this project, that tool, this issue, or the previous one. The title names the subject and one main change; the summary states the complete supported fact and current status; tags add distinct source-supported search entry points not already covered by title, summary, participants, or eventType. Keep real canonical names, aliases, abbreviations, versions, tools, technologies, projects, and distinctive concepts useful for later retrieval. Never invent keywords, unsupported synonyms, aliases, causes, relationships, or certainty, and never stuff keywords.
|
|
6847
|
+
|
|
6848
|
+
Preserve source certainty and attribution: distinguish a user statement or decision, an assistant proposal or hypothesis, a tool-observed result, a plan, a completed result, and an unresolved possibility. Do not turn a suggestion into a decision, a hypothesis into a cause, or a plan into a completed outcome. Every material claim, quotation, time, status, and relationship must match source evidence.
|
|
6849
|
+
|
|
6850
|
+
target.messages is a provenance-preserving derivation view of the target Block: message ids and conversational text are retained, while tool code and oversized tool payloads may be marked compacted. Use only retained tool names, evidence summaries, and excerpts; do not invent omitted details. Only target.messages may supply new facts, exact quotes, and sourceMessageIds. neighbors.previous and neighbors.next are context-only L2 summaries; timeline only helps identify historical relationships. Neither neighbors nor timeline nor an assistant recap of older memory can create a new Event. Require new human input or a new observable task/tool outcome from target.messages. Every sourceMessageIds entry must exactly match allowedSourceMessageIds and directly support the Event.
|
|
6851
|
+
|
|
6852
|
+
Use project scope for repository decisions, user scope for stable preferences/identity, and session scope for temporary task state. temporal.eventType must use exactly one stable value: decision, release, task_completed, plan, change, cancellation, incident, meeting, collaboration, migration, or other. temporal.participants contains canonical entity names. Use ISO-8601 timestamps with the explicit +08:00 offset in temporal fields. Keep happened time separate from mentionedAt; when happened time is unknown omit it and set precision/basis to unknown. Do not return the result as text.`,
|
|
6814
6853
|
extractorPayload(context)
|
|
6815
6854
|
));
|
|
6816
6855
|
const events = (Array.isArray(raw.events) ? raw.events : []).map((candidate) => {
|
|
@@ -6818,25 +6857,24 @@ var DshModelBridge = class {
|
|
|
6818
6857
|
const sourceMessageIds = strings2(item.sourceMessageIds).filter((id) => validMessageIds.has(id));
|
|
6819
6858
|
const scope = SCOPES.has(item.scope) ? item.scope : "project";
|
|
6820
6859
|
const criticality = CRITICALITIES.has(item.criticality) ? item.criticality : "routine";
|
|
6821
|
-
if (!text2(item.title) || !text2(item.summary) || sourceMessageIds.length === 0) return null;
|
|
6860
|
+
if (!text2(item.title) || !text2(item.summary) || sourceMessageIds.length === 0 || sourceMessageIds.length !== strings2(item.sourceMessageIds).length) return null;
|
|
6822
6861
|
return {
|
|
6823
6862
|
title: text2(item.title).slice(0, 200),
|
|
6824
6863
|
summary: text2(item.summary).slice(0, 1e3),
|
|
6825
|
-
narrative: text2(item.narrative),
|
|
6826
6864
|
tags: strings2(item.tags).slice(0, 16),
|
|
6827
6865
|
quotes: strings2(item.quotes).slice(0, 12),
|
|
6828
6866
|
sourceMessageIds,
|
|
6829
6867
|
sourceBlockId: context.target.id,
|
|
6830
6868
|
temporal: object(item.temporal),
|
|
6831
6869
|
scope,
|
|
6832
|
-
criticality
|
|
6833
|
-
confidence: typeof item.confidence === "number" ? item.confidence : 0.8
|
|
6870
|
+
criticality
|
|
6834
6871
|
};
|
|
6835
6872
|
}).filter((event) => event !== null);
|
|
6873
|
+
const shouldExtract = raw.shouldExtract === true && events.length > 0;
|
|
6836
6874
|
return {
|
|
6837
|
-
shouldExtract
|
|
6838
|
-
reason: text2(raw.reason
|
|
6839
|
-
events
|
|
6875
|
+
shouldExtract,
|
|
6876
|
+
reason: text2(raw.reason) || (shouldExtract ? "Durable evidence extracted." : "No durable evidence."),
|
|
6877
|
+
events: shouldExtract ? events : []
|
|
6840
6878
|
};
|
|
6841
6879
|
};
|
|
6842
6880
|
projector = async (context) => {
|
|
@@ -9848,7 +9886,7 @@ function registerMemoryTools(ctx, runtime) {
|
|
|
9848
9886
|
}));
|
|
9849
9887
|
ctx.tools.register(defineTool({
|
|
9850
9888
|
name: "memory_search_events",
|
|
9851
|
-
description: "This tool is provided by the StrataGate plugin. Search durable StrataGate event memories. Returns a compact batch of event cards (id, title, summary, time, and evidence refs); call memory_expand_event for
|
|
9889
|
+
description: "This tool is provided by the StrataGate plugin. Search durable StrataGate event memories. Returns a compact batch of event cards (id, title, summary, time, and evidence refs); call memory_expand_event for the full summary, quotes, and source messages. rankScore is BM25/RRF ordering only, never confidence or factual accuracy. Pass batchId to memory_assess before relying on evidence.",
|
|
9852
9890
|
parameters: {
|
|
9853
9891
|
query: { type: "string", required: true, description: "What historical decision, event, preference, or outcome to find." },
|
|
9854
9892
|
limit: { type: "integer", description: "Maximum results, 1-20." },
|
|
@@ -10363,14 +10401,12 @@ function eventSummary(event, snapshot) {
|
|
|
10363
10401
|
formedTurn: event.formedTurn,
|
|
10364
10402
|
title: event.title,
|
|
10365
10403
|
summary: event.summary,
|
|
10366
|
-
narrative: event.narrative,
|
|
10367
10404
|
tags: event.tags,
|
|
10368
10405
|
sourceBlockId: event.sourceBlockId,
|
|
10369
10406
|
sourceMessageIds: event.sourceMessageIds,
|
|
10370
10407
|
temporal: event.temporal,
|
|
10371
10408
|
scope: event.scope,
|
|
10372
10409
|
criticality: event.criticality,
|
|
10373
|
-
confidence: event.confidence,
|
|
10374
10410
|
status: event.status,
|
|
10375
10411
|
supersededBy: event.supersededBy,
|
|
10376
10412
|
weight: event.weight,
|