stratagate-dsh 0.2.95 → 0.2.96
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 +6 -0
- package/dist/client.js +1 -1
- package/dist/plugin.js +45 -7
- package/dist/plugin.js.map +1 -1
- package/package.json +1 -1
package/dist/plugin.js
CHANGED
|
@@ -834,6 +834,41 @@ function applyGraphProjection(options) {
|
|
|
834
834
|
}
|
|
835
835
|
|
|
836
836
|
// packages/core/src/events.ts
|
|
837
|
+
function normalizeEventTemporal(value) {
|
|
838
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return {};
|
|
839
|
+
const temporal = { ...value };
|
|
840
|
+
for (const field of [
|
|
841
|
+
"mentionedAt",
|
|
842
|
+
"happenedStart",
|
|
843
|
+
"happenedEnd",
|
|
844
|
+
"originalText",
|
|
845
|
+
"precision",
|
|
846
|
+
"basis",
|
|
847
|
+
"status",
|
|
848
|
+
"eventType",
|
|
849
|
+
"threadId",
|
|
850
|
+
"sameEventId"
|
|
851
|
+
]) {
|
|
852
|
+
if (typeof temporal[field] !== "string") delete temporal[field];
|
|
853
|
+
}
|
|
854
|
+
for (const field of [
|
|
855
|
+
"participants",
|
|
856
|
+
"participantNodeIds",
|
|
857
|
+
"beforeEventIds",
|
|
858
|
+
"afterEventIds",
|
|
859
|
+
"supersedesEventIds",
|
|
860
|
+
"conflictsWithEventIds",
|
|
861
|
+
"relatedEventIds"
|
|
862
|
+
]) {
|
|
863
|
+
const values = temporal[field];
|
|
864
|
+
if (Array.isArray(values) && [...values].every((item) => typeof item === "string")) {
|
|
865
|
+
temporal[field] = [...values];
|
|
866
|
+
} else {
|
|
867
|
+
delete temporal[field];
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
return temporal;
|
|
871
|
+
}
|
|
837
872
|
function normalizeStandardEventType(value) {
|
|
838
873
|
const normalized = normalizeSearchText(value ?? "").replace(/[\s_-]+/g, "");
|
|
839
874
|
const aliases = {
|
|
@@ -1866,7 +1901,8 @@ function normalizeSnapshot(value) {
|
|
|
1866
1901
|
for (const event of [...snapshot.events, ...snapshot.agentEvents]) {
|
|
1867
1902
|
delete event.narrative;
|
|
1868
1903
|
delete event.confidence;
|
|
1869
|
-
|
|
1904
|
+
const temporal = normalizeEventTemporal(event.temporal);
|
|
1905
|
+
event.temporal = { ...temporal, eventType: normalizeStandardEventType(temporal.eventType) };
|
|
1870
1906
|
if (event.formedTurn === void 0) {
|
|
1871
1907
|
const sourceBlock = event.sourceBlockId !== void 0 ? sourceBlockMap.get(event.sourceBlockId) : void 0;
|
|
1872
1908
|
const reliableSource = sourceBlock && !isSyntheticSourceThreadId(sourceBlock.threadId) && Number.isSafeInteger(sourceBlock.endTurn) && sourceBlock.endTurn >= 0;
|
|
@@ -2416,7 +2452,7 @@ function mapEventRows(rows, sourcesByEvent, table) {
|
|
|
2416
2452
|
...row.source_block_id === null ? {} : { sourceBlockId: row.source_block_id },
|
|
2417
2453
|
...row.formed_turn === null ? {} : { formedTurn: row.formed_turn },
|
|
2418
2454
|
temporal: (() => {
|
|
2419
|
-
const temporal = parseJson(row.temporal_json, `${table}.temporal_json`);
|
|
2455
|
+
const temporal = normalizeEventTemporal(parseJson(row.temporal_json, `${table}.temporal_json`));
|
|
2420
2456
|
return { ...temporal, eventType: normalizeStandardEventType(temporal.eventType) };
|
|
2421
2457
|
})(),
|
|
2422
2458
|
scope: row.scope,
|
|
@@ -4632,6 +4668,7 @@ var StrataGate = class _StrataGate {
|
|
|
4632
4668
|
}
|
|
4633
4669
|
/** Rank one event pool (BM25 + structured filters fused by RRF), sliced to `limit`. */
|
|
4634
4670
|
rankEventPool(candidates, query, options, limit) {
|
|
4671
|
+
for (const event of candidates) event.temporal = normalizeEventTemporal(event.temporal);
|
|
4635
4672
|
const participants = (options.participants ?? []).map(normalizeSearchText).filter(Boolean);
|
|
4636
4673
|
const eventType = normalizeSearchText(options.eventType ?? "");
|
|
4637
4674
|
const from = options.happenedFrom ? Date.parse(options.happenedFrom) : Number.NEGATIVE_INFINITY;
|
|
@@ -4757,7 +4794,7 @@ var StrataGate = class _StrataGate {
|
|
|
4757
4794
|
event.title,
|
|
4758
4795
|
event.summary,
|
|
4759
4796
|
event.tags.join(" "),
|
|
4760
|
-
(event.temporal.participants ?? []).join(" ")
|
|
4797
|
+
(normalizeEventTemporal(event.temporal).participants ?? []).join(" ")
|
|
4761
4798
|
].join(" ")).join(" "));
|
|
4762
4799
|
const effectiveViews = this.graphNodes.flatMap((node) => effectiveGraphNodeView(node, this.graphEdges, this.listAllEvents()) ?? []);
|
|
4763
4800
|
const effectiveNodes = effectiveViews.map(({ node }) => node);
|
|
@@ -5390,6 +5427,7 @@ var StrataGate = class _StrataGate {
|
|
|
5390
5427
|
});
|
|
5391
5428
|
}
|
|
5392
5429
|
storeEventCard(input, pool, parts) {
|
|
5430
|
+
const temporal = normalizeEventTemporal(input.temporal);
|
|
5393
5431
|
const event = {
|
|
5394
5432
|
id: input.id ?? this.idFactory("evt"),
|
|
5395
5433
|
formedTurn: parts.formedTurn,
|
|
@@ -5400,8 +5438,8 @@ var StrataGate = class _StrataGate {
|
|
|
5400
5438
|
sourceMessageIds: parts.sourceMessageIds,
|
|
5401
5439
|
...parts.sourceBlockId !== void 0 ? { sourceBlockId: parts.sourceBlockId } : {},
|
|
5402
5440
|
temporal: {
|
|
5403
|
-
...input.temporal ?
|
|
5404
|
-
eventType: normalizeStandardEventType(
|
|
5441
|
+
...input.temporal ? temporal : { mentionedAt: parts.now },
|
|
5442
|
+
eventType: normalizeStandardEventType(temporal.eventType)
|
|
5405
5443
|
},
|
|
5406
5444
|
scope: input.scope ?? "user",
|
|
5407
5445
|
criticality: parts.criticality,
|
|
@@ -5930,7 +5968,7 @@ var StrataGate = class _StrataGate {
|
|
|
5930
5968
|
previous: threadBlocks.slice(0, targetIndex).reverse().find((block) => block.l2Keypoints !== void 0) ?? null,
|
|
5931
5969
|
target,
|
|
5932
5970
|
next,
|
|
5933
|
-
timeline: [...timelineEvents.values()].map((event) => ({ id: event.id, title: event.title, temporal: structuredClone(event.temporal) }))
|
|
5971
|
+
timeline: [...timelineEvents.values()].map((event) => ({ id: event.id, title: event.title, temporal: normalizeEventTemporal(structuredClone(event.temporal)) }))
|
|
5934
5972
|
});
|
|
5935
5973
|
} catch (error) {
|
|
5936
5974
|
await this.commitMutation(() => {
|
|
@@ -6865,7 +6903,7 @@ Use project scope for repository decisions, user scope for stable preferences/id
|
|
|
6865
6903
|
quotes: strings2(item.quotes).slice(0, 12),
|
|
6866
6904
|
sourceMessageIds,
|
|
6867
6905
|
sourceBlockId: context.target.id,
|
|
6868
|
-
temporal:
|
|
6906
|
+
temporal: normalizeEventTemporal(item.temporal),
|
|
6869
6907
|
scope,
|
|
6870
6908
|
criticality
|
|
6871
6909
|
};
|