soulbridge 0.0.105 → 0.0.106
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.
|
@@ -20,3 +20,17 @@ export declare const CONCLUSION_TYPE = "\u7ED3\u8BBA";
|
|
|
20
20
|
* readers; retyping it in a second filter is how a layer silently drops out.
|
|
21
21
|
*/
|
|
22
22
|
export declare const ANCHOR_TYPES: readonly string[];
|
|
23
|
+
/**
|
|
24
|
+
* How a fact that came from my own reply is marked in injection (ADR 0035).
|
|
25
|
+
*
|
|
26
|
+
* Two renderers write fact lines — the core's `<memories>` block and the plugin's `<about>`
|
|
27
|
+
* block — and both must use the same marker, or the same fact reads differently depending on
|
|
28
|
+
* which path surfaced it. Declared here, imported by both.
|
|
29
|
+
*/
|
|
30
|
+
export declare const INFERRED_MARKER = "\u6211: ";
|
|
31
|
+
/**
|
|
32
|
+
* One explanation per block, not one per line.
|
|
33
|
+
*
|
|
34
|
+
* 341 of 646 facts are inferred, so a sentence on every line would double the injection.
|
|
35
|
+
*/
|
|
36
|
+
export declare const SOURCE_NOTES = "<source-notes>\u4EE5\u300C\u6211:\u300D\u5F00\u5934\u7684\u662F\u6211\u4E0A\u4E00\u8F6E\u8BF4\u7684\u8BDD\uFF0C\u672A\u7ECF\u7528\u6237\u786E\u8BA4\uFF1B\u6CA1\u6807\u7684\u90FD\u662F\u7528\u6237\u8BF4\u7684\u3002</source-notes>";
|
|
@@ -19,3 +19,17 @@ export const CONCLUSION_TYPE = '结论';
|
|
|
19
19
|
* readers; retyping it in a second filter is how a layer silently drops out.
|
|
20
20
|
*/
|
|
21
21
|
export const ANCHOR_TYPES = ['结论', '教训', '原则', '性格'];
|
|
22
|
+
/**
|
|
23
|
+
* How a fact that came from my own reply is marked in injection (ADR 0035).
|
|
24
|
+
*
|
|
25
|
+
* Two renderers write fact lines — the core's `<memories>` block and the plugin's `<about>`
|
|
26
|
+
* block — and both must use the same marker, or the same fact reads differently depending on
|
|
27
|
+
* which path surfaced it. Declared here, imported by both.
|
|
28
|
+
*/
|
|
29
|
+
export const INFERRED_MARKER = '我: ';
|
|
30
|
+
/**
|
|
31
|
+
* One explanation per block, not one per line.
|
|
32
|
+
*
|
|
33
|
+
* 341 of 646 facts are inferred, so a sentence on every line would double the injection.
|
|
34
|
+
*/
|
|
35
|
+
export const SOURCE_NOTES = '<source-notes>以「我:」开头的是我上一轮说的话,未经用户确认;没标的都是用户说的。</source-notes>';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FACT_STATUS } from './config/status.js';
|
|
2
|
-
import { ANCHOR_TYPES } from './config/labels.js';
|
|
2
|
+
import { ANCHOR_TYPES, INFERRED_MARKER, SOURCE_NOTES } from './config/labels.js';
|
|
3
3
|
import { isActive, roleOf } from './roles.js';
|
|
4
4
|
import { escapeAttr, escapeBlockText } from './inject-text.js';
|
|
5
5
|
import { selectDirectives } from './affect/directives.js';
|
|
@@ -109,7 +109,7 @@ export function buildContext(store, request, now = Date.now()) {
|
|
|
109
109
|
}
|
|
110
110
|
// Escaping can lengthen a line (one `<` is four characters), so cost is charged
|
|
111
111
|
// on the escaped text — the budget has to measure what actually gets injected.
|
|
112
|
-
const marker = anchor.inferred ?
|
|
112
|
+
const marker = anchor.inferred ? INFERRED_MARKER : '';
|
|
113
113
|
const line = `- ${marker}[${escapeBlockText(anchor.label)}] ${escapeBlockText(anchor.text)}`;
|
|
114
114
|
if (anchor.inferred)
|
|
115
115
|
sawInferred = true;
|
|
@@ -124,9 +124,8 @@ export function buildContext(store, request, now = Date.now()) {
|
|
|
124
124
|
}
|
|
125
125
|
if (request.includeAnchors !== false && lines.length > 0)
|
|
126
126
|
sections.push(`<memories>\n${lines.join('\n')}\n</memories>`);
|
|
127
|
-
if (sawInferred)
|
|
128
|
-
sections.push(
|
|
129
|
-
}
|
|
127
|
+
if (sawInferred)
|
|
128
|
+
sections.push(SOURCE_NOTES);
|
|
130
129
|
const text = sections.join('\n\n');
|
|
131
130
|
if (request.track !== false && used.length > 0)
|
|
132
131
|
store.touch(used, now);
|
|
@@ -8,6 +8,7 @@ export * from './types.ts';
|
|
|
8
8
|
export type { SoulStore } from './store.ts';
|
|
9
9
|
export { openSqlite, SCHEMA_VERSION, AFFECT_RETENTION_MS, DbNewerThanBinaryError } from './sqlite.ts';
|
|
10
10
|
export { buildContext, styleDirectives, DEFAULT_MAX_CHARS, AFFECT_BUDGET, AFFECT_WINDOW_MS, } from './context.ts';
|
|
11
|
+
export { INFERRED_MARKER, SOURCE_NOTES } from './config/labels.ts';
|
|
11
12
|
export { reflect, ruleExtract, nextEmotion, isCorrection, correctionRule, detectCorrection, isQuestion, } from './reflect.ts';
|
|
12
13
|
export type { CorrectionLayer, CorrectionSignal, CorrectionVerdict } from './reflect.ts';
|
|
13
14
|
export { rank, scoreMemory, tokenize, relevance, bm25, buildCorpusStats } from './scoring.ts';
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
export * from './types.js';
|
|
8
8
|
export { openSqlite, SCHEMA_VERSION, AFFECT_RETENTION_MS, DbNewerThanBinaryError } from './sqlite.js';
|
|
9
9
|
export { buildContext, styleDirectives, DEFAULT_MAX_CHARS, AFFECT_BUDGET, AFFECT_WINDOW_MS, } from './context.js';
|
|
10
|
+
export { INFERRED_MARKER, SOURCE_NOTES } from './config/labels.js';
|
|
10
11
|
export { reflect, ruleExtract, nextEmotion, isCorrection, correctionRule, detectCorrection, isQuestion, } from './reflect.js';
|
|
11
12
|
export { rank, scoreMemory, tokenize, relevance, bm25, buildCorpusStats } from './scoring.js';
|
|
12
13
|
export { parseThreadLine } from './extract.js';
|