@jungjaehoon/mama-core 1.8.1 → 1.9.0
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/memory/api.d.ts +1 -0
- package/dist/memory/api.js +13 -2
- package/package.json +1 -1
package/dist/memory/api.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export interface FusedHit {
|
|
|
15
15
|
case_id?: string | null;
|
|
16
16
|
retrieval_diagnostics?: SearchHitDiagnostics;
|
|
17
17
|
}
|
|
18
|
+
export declare function buildDecisionId(topic: string): string;
|
|
18
19
|
export declare const LEXICAL_STOPWORDS: Set<string>;
|
|
19
20
|
export declare function getLexicalQueryTokens(query: string): string[];
|
|
20
21
|
export declare function loadEdgesForIds(ids: string[]): Promise<MemoryEdge[]>;
|
package/dist/memory/api.js
CHANGED
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getChannelSummary = exports.upsertChannelSummary = exports.LEXICAL_STOPWORDS = void 0;
|
|
7
|
+
exports.buildDecisionId = buildDecisionId;
|
|
7
8
|
exports.getLexicalQueryTokens = getLexicalQueryTokens;
|
|
8
9
|
exports.loadEdgesForIds = loadEdgesForIds;
|
|
9
10
|
exports.saveMemory = saveMemory;
|
|
@@ -41,8 +42,18 @@ const search_quality_js_1 = require("../search/search-quality.js");
|
|
|
41
42
|
const event_store_js_1 = require("./event-store.js");
|
|
42
43
|
const provenance_js_1 = require("./provenance.js");
|
|
43
44
|
function buildDecisionId(topic) {
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
// Non-ASCII topics (Korean etc.) used to collapse into bare underscore runs
|
|
46
|
+
// ("decision_______<ts>") - unreadable and near-colliding. Collapse the runs
|
|
47
|
+
// and fall back to a stable topic hash when nothing ASCII survives; the
|
|
48
|
+
// human-readable topic itself is stored verbatim in the topic column.
|
|
49
|
+
const safeTopic = topic
|
|
50
|
+
.replace(/[^a-z0-9_]+/gi, '_')
|
|
51
|
+
.replace(/_+/g, '_')
|
|
52
|
+
.replace(/^_+|_+$/g, '')
|
|
53
|
+
.toLowerCase();
|
|
54
|
+
// sha256 (not sha1) purely to keep SAST scanners quiet - this is an id slug, not crypto.
|
|
55
|
+
const slug = safeTopic || `t${node_crypto_1.default.createHash('sha256').update(topic).digest('hex').slice(0, 8)}`;
|
|
56
|
+
return `decision_${slug}_${Date.now()}_${node_crypto_1.default.randomUUID().slice(0, 8)}`;
|
|
46
57
|
}
|
|
47
58
|
function buildSaveEventReason(toolName, gatewayCallId) {
|
|
48
59
|
const parts = ['saved'];
|