dsh-plugin-soulbridge 0.0.108 → 0.0.110

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 (2) hide show
  1. package/index.js +16 -6
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -37,6 +37,8 @@ import {
37
37
  readVerification,
38
38
  escapeAttr,
39
39
  escapeBlockText,
40
+ INFERRED_MARKER,
41
+ SOURCE_NOTES,
40
42
  } from 'soulbridge';
41
43
 
42
44
  export const name = 'dsh-plugin-soulbridge';
@@ -502,7 +504,7 @@ export function buildFactHooks(text, options = {}) {
502
504
  const when = fact.atText ?? (fact.at ? new Date(fact.at).toISOString().slice(0, 10) : '');
503
505
  // ADR 0035: a fact from my side of the exchange is inferred. Two characters plus one
504
506
  // explanation below the block, because a per-line sentence would double the text.
505
- const marker = fact.source === 'inferred' ? '我: ' : '';
507
+ const marker = fact.source === 'inferred' ? INFERRED_MARKER : '';
506
508
  if (marker) sawInferred = true;
507
509
  lines.push(`- ${marker}[${fact.id}] ${escapeBlockText(fact.statement)}${when ? `(${escapeBlockText(when)})` : ''}`);
508
510
  used.push(fact.id);
@@ -515,11 +517,7 @@ export function buildFactHooks(text, options = {}) {
515
517
  log(`prestep: hooks failed: ${error instanceof Error ? error.message : String(error)}`);
516
518
  }
517
519
  if (parts.length === 0) return '';
518
- if (sawInferred) {
519
- parts.push(
520
- '<source-notes>以「我:」开头的是我上一轮说的话,未经用户确认;没标的都是用户说的。</source-notes>',
521
- );
522
- }
520
+ if (sawInferred) parts.push(SOURCE_NOTES);
523
521
  return { text: parts.join('\n\n'), used };
524
522
  }
525
523
 
@@ -886,6 +884,18 @@ export function createPreStepHandler(deps) {
886
884
  } catch (error) {
887
885
  log(`threads close failed: ${error instanceof Error ? error.message : String(error)}`);
888
886
  }
887
+
888
+ // Housekeeping once per turn: an open question nobody answered in two weeks stopped
889
+ // being a question worth asking. No model call, one UPDATE.
890
+ try {
891
+ const swept = ensureSoul().sweep(Date.now(), { gapMaxAgeDays: 14 });
892
+ if (swept.gapsClosed > 0) {
893
+ log(`gaps closed: ${swept.gapsClosed} (expired)`);
894
+ trace({ event: 'gaps-expired', closed: swept.gapsClosed });
895
+ }
896
+ } catch (error) {
897
+ log(`gap sweep failed: ${error instanceof Error ? error.message : String(error)}`);
898
+ }
889
899
  const messages = Array.isArray(payload?.messages) ? payload.messages : [];
890
900
  const text = textOf(messages[messages.length - 1]?.content);
891
901
  if (text.length === 0) return decision;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-soulbridge",
3
- "version": "0.0.108",
3
+ "version": "0.0.110",
4
4
  "description": "Inject soulbridge context into DSH sessions and feed user turns back as observations.",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -42,6 +42,6 @@
42
42
  "setup": "node scripts/install-hooks.mjs"
43
43
  },
44
44
  "dependencies": {
45
- "soulbridge": ">=0.0.100 <0.1.0"
45
+ "soulbridge": ">=0.0.107 <0.1.0"
46
46
  }
47
47
  }