stratagate-dsh 0.2.79 → 0.2.81

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/dist/plugin.js CHANGED
@@ -5093,11 +5093,19 @@ var StrataGate = class _StrataGate {
5093
5093
  });
5094
5094
  let result;
5095
5095
  try {
5096
+ const query = [target.l0Title, target.l1Summary, ...target.l2Keypoints ?? []].filter(Boolean).join(" ");
5097
+ const relevant = query ? (await this.searchEvents(query, { limit: 8, trackRetrieval: false })).map(({ event }) => event) : [];
5098
+ const sourceSequence = new Map(this.blocks.map((block) => [block.id, block.sequence]));
5099
+ const recent = this.events.filter((event) => event.status === "active" || event.status === "superseded").sort((left, right) => (sourceSequence.get(right.sourceBlockId) ?? -1) - (sourceSequence.get(left.sourceBlockId) ?? -1) || (right.formedTurn ?? -1) - (left.formedTurn ?? -1) || right.createdAt.localeCompare(left.createdAt) || right.id.localeCompare(left.id)).slice(0, 4);
5100
+ const timelineEvents = new Map(relevant.map((event) => [event.id, event]));
5101
+ for (const event of recent) {
5102
+ if (!timelineEvents.has(event.id)) timelineEvents.set(event.id, event);
5103
+ }
5096
5104
  result = await this.extractor({
5097
5105
  previous: threadBlocks.slice(0, targetIndex).reverse().find((block) => block.l2Keypoints !== void 0) ?? null,
5098
5106
  target,
5099
5107
  next,
5100
- timeline: this.events.map((event) => ({ id: event.id, title: event.title, temporal: event.temporal }))
5108
+ timeline: [...timelineEvents.values()].map((event) => ({ id: event.id, title: event.title, temporal: event.temporal }))
5101
5109
  });
5102
5110
  } catch (error) {
5103
5111
  await this.commitMutation(() => {
@@ -8541,7 +8549,7 @@ function sessionOf(exec) {
8541
8549
  function registerMemoryTools(ctx, runtime) {
8542
8550
  ctx.tools.register(defineTool({
8543
8551
  name: "feedback_prepare",
8544
- description: 'Create or revise a local StrataGate feedback draft when the user directly requests it, or after a proactive suggestion permitted by the StrataGate feedback policy and the user explicitly agrees. A direct user request is already authorization. Use only facts known from the current conversation; leave unknown fields empty and never invent versions, logs, Block counts, or diagnostics. Never submit anything to GitHub. After success, briefly say the draft is local and not submitted, then render feedbackUrl as a Markdown link labeled "\u6253\u5F00\u53CD\u9988\u8349\u7A3F". Do not print draft fields or an Issue-content table, and do not direct the user through Settings manually.',
8552
+ description: 'This tool is provided by the StrataGate plugin. Create or revise a local StrataGate feedback draft when the user directly requests it, or after a proactive suggestion permitted by the StrataGate feedback policy and the user explicitly agrees. A direct user request is already authorization. Use only facts known from the current conversation; leave unknown fields empty and never invent versions, logs, Block counts, or diagnostics. Never submit anything to GitHub. After success, briefly say the draft is local and not submitted, then render feedbackUrl as a Markdown link labeled "\u6253\u5F00\u53CD\u9988\u8349\u7A3F". Then ask exactly once: "\u8981\u4E0D\u8981\u987A\u4FBF\u8BA9\u6211\u5C1D\u8BD5\u4FEE\u590D\u8FD9\u4E2A\u95EE\u9898\uFF0C\u5E76\u63D0\u4EA4\u4E00\u4E2A PR\uFF1F" If the user does not respond or declines, do not ask again. Do not use a popup or other additional UI. Do not print draft fields or an Issue-content table, and do not direct the user through Settings manually.',
8545
8553
  parameters: {
8546
8554
  title: { type: "string" },
8547
8555
  description: { type: "string" },
@@ -8562,7 +8570,7 @@ function registerMemoryTools(ctx, runtime) {
8562
8570
  }));
8563
8571
  ctx.tools.register(defineTool({
8564
8572
  name: "memory_search_events",
8565
- description: "Search durable StrataGate event memories. Returns a compact batch of event cards (id, title, summary, time, and evidence refs); call memory_expand_event for narrative/quotes/source messages. rankScore is BM25/RRF ordering only, never confidence or factual accuracy. Pass batchId to memory_assess before relying on evidence.",
8573
+ 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 narrative/quotes/source messages. rankScore is BM25/RRF ordering only, never confidence or factual accuracy. Pass batchId to memory_assess before relying on evidence.",
8566
8574
  parameters: {
8567
8575
  query: { type: "string", required: true, description: "What historical decision, event, preference, or outcome to find." },
8568
8576
  limit: { type: "integer", description: "Maximum results, 1-20." },
@@ -8580,7 +8588,7 @@ function registerMemoryTools(ctx, runtime) {
8580
8588
  }));
8581
8589
  ctx.tools.register(defineTool({
8582
8590
  name: "memory_search_graph",
8583
- description: "Search the Event-backed Knowledge Graph for current state and query-relevant history. Results explicitly label current, historical, or both; historical matches never imply current truth, disputed records remain marked, and Event evidence is bounded to the match. Endpoint names and aliases can match relations, while relation text alone is ranking context. rankScore is ranking-only, never confidence or factual accuracy.",
8591
+ description: "This tool is provided by the StrataGate plugin. Search the Event-backed Knowledge Graph for current state and query-relevant history. Results explicitly label current, historical, or both; historical matches never imply current truth, disputed records remain marked, and Event evidence is bounded to the match. Endpoint names and aliases can match relations, while relation text alone is ranking context. rankScore is ranking-only, never confidence or factual accuracy.",
8584
8592
  parameters: {
8585
8593
  query: { type: "string", required: true },
8586
8594
  limit: { type: "integer", description: "Maximum results, 1-20." }
@@ -8590,14 +8598,14 @@ function registerMemoryTools(ctx, runtime) {
8590
8598
  }));
8591
8599
  ctx.tools.register(defineTool({
8592
8600
  name: "memory_expand_graph_node",
8593
- description: "Expand one Knowledge Graph node through the same Event-authoritative view as search: dynamic current state, marked disputed records, retrievable history, and bounded supporting Event evidence. Forgotten or archived Event provenance is never exposed.",
8601
+ description: "This tool is provided by the StrataGate plugin. Expand one Knowledge Graph node through the same Event-authoritative view as search: dynamic current state, marked disputed records, retrievable history, and bounded supporting Event evidence. Forgotten or archived Event provenance is never exposed.",
8594
8602
  parameters: { id: { type: "string", required: true } },
8595
8603
  output: jsonOutput,
8596
8604
  execute: async (args, exec) => runtime.expandGraphNode(sessionOf(exec), args.id)
8597
8605
  }));
8598
8606
  ctx.tools.register(defineTool({
8599
8607
  name: "memory_search_elements",
8600
- description: "Deprecated compatibility search for legacy Element-card data. Returns compact fact hits; rankScore is BM25/RRF ordering only, never confidence or factual accuracy. Prefer memory_search_graph.",
8608
+ description: "This tool is provided by the StrataGate plugin. Deprecated compatibility search for legacy Element-card data. Returns compact fact hits; rankScore is BM25/RRF ordering only, never confidence or factual accuracy. Prefer memory_search_graph.",
8601
8609
  parameters: {
8602
8610
  query: { type: "string", required: true },
8603
8611
  limit: { type: "integer" },
@@ -8613,7 +8621,7 @@ function registerMemoryTools(ctx, runtime) {
8613
8621
  }));
8614
8622
  ctx.tools.register(defineTool({
8615
8623
  name: "memory_search_raw",
8616
- description: "Search archived messages when summarized memories are insufficient. Returns compact raw hits (message id, blockId, excerpt, role, and time); use memory_expand_block with blockId for complete source details. By default searches the whole current namespace; use scope=session for the active thread. Returns evidence refs and batchId for assessment.",
8624
+ description: "This tool is provided by the StrataGate plugin. Search archived messages when summarized memories are insufficient. Returns compact raw hits (message id, blockId, excerpt, role, and time); use memory_expand_block with blockId for complete source details. By default searches the whole current namespace; use scope=session for the active thread. Returns evidence refs and batchId for assessment.",
8617
8625
  parameters: {
8618
8626
  query: { type: "string", required: true },
8619
8627
  limit: { type: "integer" },
@@ -8624,7 +8632,7 @@ function registerMemoryTools(ctx, runtime) {
8624
8632
  }));
8625
8633
  ctx.tools.register(defineTool({
8626
8634
  name: "memory_get_blocks",
8627
- description: "List decayed conversation-block summaries and their current detail levels. Defaults to the active session only; use scope=namespace to inspect every thread in the current namespace. The response always reports scope, namespace, threadId, counts, and a machine-readable emptyReason when no blocks match.",
8635
+ description: "This tool is provided by the StrataGate plugin. List decayed conversation-block summaries and their current detail levels. Defaults to the active session only; use scope=namespace to inspect every thread in the current namespace. The response always reports scope, namespace, threadId, counts, and a machine-readable emptyReason when no blocks match.",
8628
8636
  parameters: {
8629
8637
  scope: { type: "string", enum: ["session", "namespace"], description: "Query range. Defaults to session to preserve existing isolation behavior." }
8630
8638
  },
@@ -8633,7 +8641,7 @@ function registerMemoryTools(ctx, runtime) {
8633
8641
  }));
8634
8642
  ctx.tools.register(defineTool({
8635
8643
  name: "memory_expand_block",
8636
- description: "Expand one memory block to a more detailed layer. The result is a new evidence batch and must be assessed.",
8644
+ description: "This tool is provided by the StrataGate plugin. Expand one memory block to a more detailed layer. The result is a new evidence batch and must be assessed.",
8637
8645
  parameters: {
8638
8646
  id: { type: "string", required: true },
8639
8647
  target: { oneOf: [{ type: "string" }, { type: "integer" }] }
@@ -8643,7 +8651,7 @@ function registerMemoryTools(ctx, runtime) {
8643
8651
  }));
8644
8652
  ctx.tools.register(defineTool({
8645
8653
  name: "memory_expand_event",
8646
- description: "Retrieve one complete Event card by id. The result is a new evidence batch and must be assessed.",
8654
+ description: "This tool is provided by the StrataGate plugin. Retrieve one complete Event card by id. The result is a new evidence batch and must be assessed.",
8647
8655
  parameters: {
8648
8656
  id: { type: "string", required: true }
8649
8657
  },
@@ -8652,7 +8660,7 @@ function registerMemoryTools(ctx, runtime) {
8652
8660
  }));
8653
8661
  ctx.tools.register(defineTool({
8654
8662
  name: "memory_expand_element",
8655
- description: "Expand an Element card, optionally as it was at an ISO date. The result is a new evidence batch and must be assessed.",
8663
+ description: "This tool is provided by the StrataGate plugin. Expand an Element card, optionally as it was at an ISO date. The result is a new evidence batch and must be assessed.",
8656
8664
  parameters: {
8657
8665
  id: { type: "string", required: true },
8658
8666
  at: { type: "string" }
@@ -8662,7 +8670,7 @@ function registerMemoryTools(ctx, runtime) {
8662
8670
  }));
8663
8671
  ctx.tools.register(defineTool({
8664
8672
  name: "memory_assess",
8665
- description: "Apply StrataGate Evidence Gate to a retrieval batch. Pass batch_id from the retrieval result; omitting it remains compatible with sequential flows and selects the latest batch. The response reports every input ref that was not adopted and why.",
8673
+ description: "This tool is provided by the StrataGate plugin. Apply StrataGate Evidence Gate to a retrieval batch. Pass batch_id from the retrieval result; omitting it remains compatible with sequential flows and selects the latest batch. The response reports every input ref that was not adopted and why.",
8666
8674
  parameters: {
8667
8675
  batch_id: { type: "string", description: "The batchId returned by the retrieval to assess. Omit only in a strictly sequential flow." },
8668
8676
  verdict: { type: "string", enum: ["sufficient", "partial", "wrong"], required: true },
@@ -8680,7 +8688,7 @@ function registerMemoryTools(ctx, runtime) {
8680
8688
  }));
8681
8689
  ctx.tools.register(defineTool({
8682
8690
  name: "memory_record_use",
8683
- description: "Close one StrataGate retrieval batch. Pass its batch_id and exactly the evidenceRefs from that batch actually used in the answer, or [] when none were used. Non-empty refs require that batch's sufficient assessment. The host renders successful selections as answer-tail citations, so do not write a manual citation list. Omitting batch_id selects the latest batch for sequential compatibility.",
8691
+ description: "This tool is provided by the StrataGate plugin. Close one StrataGate retrieval batch. Pass its batch_id and exactly the evidenceRefs from that batch actually used in the answer, or [] when none were used. Non-empty refs require that batch's sufficient assessment. The host renders successful selections as answer-tail citations, so do not write a manual citation list. Omitting batch_id selects the latest batch for sequential compatibility.",
8684
8692
  parameters: {
8685
8693
  batch_id: { type: "string", description: "The batchId to close. Omit only in a strictly sequential flow." },
8686
8694
  evidence_refs: { type: "array", items: { type: "string" }, required: true }