@remnic/core 9.3.687 → 9.3.689
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/access-boundary.js +8 -8
- package/dist/access-cli.js +16 -16
- package/dist/access-http.js +11 -11
- package/dist/access-mcp.js +10 -10
- package/dist/access-operations.js +9 -9
- package/dist/access-service.js +7 -7
- package/dist/active-recall.js +3 -3
- package/dist/{chunk-ZPTISBQU.js → chunk-2SNKUSQC.js} +4 -4
- package/dist/{chunk-MCQDSY4G.js → chunk-3K37VPM3.js} +2 -2
- package/dist/{chunk-6GJS4BFH.js → chunk-A7UZR6RA.js} +2 -2
- package/dist/{chunk-U7D7NP4J.js → chunk-ED35D32I.js} +2 -2
- package/dist/{chunk-2KAYTPPT.js → chunk-JPETDXED.js} +5 -5
- package/dist/{chunk-B43NZNMG.js → chunk-JZBFL7RI.js} +7 -7
- package/dist/chunk-K6MV3TRQ.js +56 -0
- package/dist/chunk-K6MV3TRQ.js.map +1 -0
- package/dist/{chunk-QO3AILZN.js → chunk-OO42R444.js} +2 -2
- package/dist/{chunk-NN7QYW5W.js → chunk-OWFY6NGQ.js} +2 -2
- package/dist/{chunk-S2OU5DZY.js → chunk-QSQW54U5.js} +4 -4
- package/dist/{chunk-QVMXQGT7.js → chunk-RHXFYIHA.js} +23 -23
- package/dist/{chunk-CTOQEZSN.js → chunk-SAEZIIID.js} +2 -2
- package/dist/{chunk-DCWIQFNA.js → chunk-T422SYM6.js} +5 -5
- package/dist/{chunk-FE6DQUNJ.js → chunk-UHUZXWDX.js} +3 -3
- package/dist/{chunk-473JIN2U.js → chunk-UXLZOVCN.js} +3 -3
- package/dist/{chunk-2SJCWLQD.js → chunk-W63OY3J7.js} +2 -2
- package/dist/{chunk-FUCUR2OZ.js → chunk-XU7363OX.js} +2 -2
- package/dist/{chunk-KFBOZYME.js → chunk-Z2M6YTAJ.js} +3 -3
- package/dist/cli.js +24 -24
- package/dist/config.js +3 -3
- package/dist/connectors/index.d.ts +10 -2
- package/dist/connectors/index.js +2 -2
- package/dist/conversation-index/backend.js +2 -2
- package/dist/emit-legacy-tools.js +2 -2
- package/dist/index.d.ts +11 -0
- package/dist/index.js +36 -33
- package/dist/index.js.map +1 -1
- package/dist/lcm/engine.js +2 -2
- package/dist/lcm/index.js +4 -4
- package/dist/namespaces/migrate.js +7 -7
- package/dist/namespaces/search.js +6 -6
- package/dist/operator-toolkit.js +11 -11
- package/dist/orchestrator.js +10 -10
- package/dist/recall-pipeline-stages.d.ts +167 -0
- package/dist/recall-pipeline-stages.js +61 -0
- package/dist/recall-pipeline-stages.js.map +1 -0
- package/dist/resume-bundles.js +4 -4
- package/dist/search/factory.js +5 -5
- package/dist/search/index.js +9 -9
- package/package.json +2 -2
- package/src/connectors/paths.test.ts +192 -0
- package/src/connectors/paths.ts +106 -20
- package/src/memory-extension/claude-code-publisher.ts +1 -0
- package/src/memory-extension/codex-publisher.ts +1 -0
- package/src/memory-extension/hermes-publisher.ts +1 -0
- package/src/memory-extension/types.ts +11 -0
- package/src/recall-pipeline-stages.test.ts +269 -0
- package/src/recall-pipeline-stages.ts +294 -0
- package/dist/chunk-3BQOQYRB.js +0 -33
- package/dist/chunk-3BQOQYRB.js.map +0 -1
- /package/dist/{chunk-ZPTISBQU.js.map → chunk-2SNKUSQC.js.map} +0 -0
- /package/dist/{chunk-MCQDSY4G.js.map → chunk-3K37VPM3.js.map} +0 -0
- /package/dist/{chunk-6GJS4BFH.js.map → chunk-A7UZR6RA.js.map} +0 -0
- /package/dist/{chunk-U7D7NP4J.js.map → chunk-ED35D32I.js.map} +0 -0
- /package/dist/{chunk-2KAYTPPT.js.map → chunk-JPETDXED.js.map} +0 -0
- /package/dist/{chunk-B43NZNMG.js.map → chunk-JZBFL7RI.js.map} +0 -0
- /package/dist/{chunk-QO3AILZN.js.map → chunk-OO42R444.js.map} +0 -0
- /package/dist/{chunk-NN7QYW5W.js.map → chunk-OWFY6NGQ.js.map} +0 -0
- /package/dist/{chunk-S2OU5DZY.js.map → chunk-QSQW54U5.js.map} +0 -0
- /package/dist/{chunk-QVMXQGT7.js.map → chunk-RHXFYIHA.js.map} +0 -0
- /package/dist/{chunk-CTOQEZSN.js.map → chunk-SAEZIIID.js.map} +0 -0
- /package/dist/{chunk-DCWIQFNA.js.map → chunk-T422SYM6.js.map} +0 -0
- /package/dist/{chunk-FE6DQUNJ.js.map → chunk-UHUZXWDX.js.map} +0 -0
- /package/dist/{chunk-473JIN2U.js.map → chunk-UXLZOVCN.js.map} +0 -0
- /package/dist/{chunk-2SJCWLQD.js.map → chunk-W63OY3J7.js.map} +0 -0
- /package/dist/{chunk-FUCUR2OZ.js.map → chunk-XU7363OX.js.map} +0 -0
- /package/dist/{chunk-KFBOZYME.js.map → chunk-Z2M6YTAJ.js.map} +0 -0
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Issue #1539 PR2 — the staged recall pipeline spine.
|
|
3
|
+
*
|
|
4
|
+
* The four recall pipelines (`targeted-fact-recall.ts`, `response-guidance-
|
|
5
|
+
* recall.ts`, `explicit-cue-recall.ts`, `event-order-recall.ts`) implement
|
|
6
|
+
* the same stage sequence — intent → candidate collection → dedup → rank →
|
|
7
|
+
* filter → slice → metadata insertion → token budgeting — with ~70%
|
|
8
|
+
* near-duplicate code. The most dangerous divergence is the sort
|
|
9
|
+
* comparator: guidance/targeted-fact sort `turnIndex` DESC (recency) while
|
|
10
|
+
* event-order sorts `turnIndex` ASC (chronological). The comparators are
|
|
11
|
+
* byte-identical except for this direction — copy-pasting into a new
|
|
12
|
+
* chronological pipeline silently inverts the ordering.
|
|
13
|
+
*
|
|
14
|
+
* This module centralizes the **dedup + score + threshold-filter + sort**
|
|
15
|
+
* stages behind one declared config object. Per-tier divergence (threshold
|
|
16
|
+
* value, sort direction, content transformation) becomes a declared config
|
|
17
|
+
* field instead of embedded code.
|
|
18
|
+
*
|
|
19
|
+
* **PR 2 scope:** extract the module with NO pipeline changes. PRs 3–6
|
|
20
|
+
* migrate each pipeline to call `unifiedDedupeAndRank` one at a time,
|
|
21
|
+
* re-running the characterization snapshots
|
|
22
|
+
* (`tests/recall-pipeline-unified.test.ts`) to verify byte-for-byte parity.
|
|
23
|
+
*
|
|
24
|
+
* Future PRs will add the remaining stages from the issue's Solution
|
|
25
|
+
* (`mergeAcrossLcmKeys`, `insertMetadata`) once the per-tier hooks are
|
|
26
|
+
* factored out of each pipeline.
|
|
27
|
+
*
|
|
28
|
+
* @see https://github.com/joshuaswarren/remnic/issues/1539
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
import type { EvidencePackItem } from "./evidence-pack.js";
|
|
32
|
+
|
|
33
|
+
/** A ranked evidence item: an `EvidencePackItem` with a computed `rank`. */
|
|
34
|
+
export interface RankedEvidenceItem extends EvidencePackItem {
|
|
35
|
+
rank: number;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Sort direction for the turn-index secondary key. This is the divergence
|
|
40
|
+
* issue #1539 identifies: relevance-ranked pipelines (targeted-fact,
|
|
41
|
+
* response-guidance) sort `turnIndex` DESC (recency — latest first); the
|
|
42
|
+
* chronological pipeline (event-order) sorts `turnIndex` ASC (earliest
|
|
43
|
+
* first). The rank primary key is ALWAYS DESC (higher rank first); only
|
|
44
|
+
* the `turnIndex` tiebreaker flips direction.
|
|
45
|
+
*/
|
|
46
|
+
export type TurnIndexSortDirection = "desc" | "asc";
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Configuration for the unified dedup + score + threshold-filter + sort
|
|
50
|
+
* pass. Each pipeline declares its divergences as fields here instead of
|
|
51
|
+
* embedding them in pipeline-specific code.
|
|
52
|
+
*
|
|
53
|
+
* The issue's Solution defines the intended full config object
|
|
54
|
+
* (`RecallPipelineConfig`); this interface is extracted incrementally:
|
|
55
|
+
* - PR 2 (this PR): dedup/score/threshold/sort only
|
|
56
|
+
* - PRs 3–6: migrate each pipeline to consume the spine
|
|
57
|
+
* - future: add `mergeAcrossLcmKeys`, `insertMetadata` once the per-tier
|
|
58
|
+
* hooks are factored out of each pipeline
|
|
59
|
+
*/
|
|
60
|
+
export interface UnifiedRankConfig<TIntent> {
|
|
61
|
+
/** The user query — passed to the scorer. */
|
|
62
|
+
query: string;
|
|
63
|
+
/**
|
|
64
|
+
* Per-tier intent classification result (already computed by the caller;
|
|
65
|
+
* intent classification stays per-tier because it is genuinely
|
|
66
|
+
* per-tier per issue #1539 Pitfall 1).
|
|
67
|
+
*/
|
|
68
|
+
intents: TIntent[];
|
|
69
|
+
/**
|
|
70
|
+
* Score an item using its ORIGINAL (pre-transform) content. Higher = more
|
|
71
|
+
* relevant. The return value becomes the item's `rank`. For pipelines
|
|
72
|
+
* that don't score (explicit-cue), pass a constant scorer — the config
|
|
73
|
+
* makes the no-scoring policy explicit.
|
|
74
|
+
*/
|
|
75
|
+
scoreEvidence: (
|
|
76
|
+
item: EvidencePackItem,
|
|
77
|
+
query: string,
|
|
78
|
+
intents: TIntent[],
|
|
79
|
+
) => number;
|
|
80
|
+
/**
|
|
81
|
+
* Optional content transformation applied to each surviving item's
|
|
82
|
+
* OUTPUT content (NOT to the content the scorer sees). Per-tier
|
|
83
|
+
* cue-appenders go here:
|
|
84
|
+
* - targeted-fact: `appendNormalizedNumericCues`
|
|
85
|
+
* - response-guidance: `appendGuidanceCues`
|
|
86
|
+
* - event-order: `appendChronologicalCues`
|
|
87
|
+
*
|
|
88
|
+
* The dedup key uses the TRANSFORMED content. This is equivalent to
|
|
89
|
+
* deduping on original content for all existing pipelines because every
|
|
90
|
+
* transform is a deterministic append (same original → same transformed →
|
|
91
|
+
* same key; different originals → different transformed → different key).
|
|
92
|
+
*/
|
|
93
|
+
transformContent?: (content: string, intents: TIntent[]) => string;
|
|
94
|
+
/**
|
|
95
|
+
* Whether to deduplicate by normalized (transformed) content in addition to
|
|
96
|
+
* id. Default `true` — matches targeted-fact, response-guidance, and
|
|
97
|
+
* explicit-cue, which all collapse later items sharing a normalized content
|
|
98
|
+
* key. Event-order sets this to `false`: its rank pass
|
|
99
|
+
* (`rankAndSelectEventOrderItems`) deduplicates by turn id only and keeps
|
|
100
|
+
* distinct turns even when two turns share the same cue-appended body
|
|
101
|
+
* (legitimate repeated turns in a chronological transcript). Making this a
|
|
102
|
+
* declared field prevents PR 6's migration from silently dropping valid
|
|
103
|
+
* turns (cursor bugbot a4299851).
|
|
104
|
+
*/
|
|
105
|
+
dedupByContent?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Items with `rank` below this threshold are dropped. `undefined` = no
|
|
108
|
+
* filter. Event-order declares `rankThreshold: 6` here instead of
|
|
109
|
+
* inlining an undocumented `.filter((item) => item.rank >= 6)` (the
|
|
110
|
+
* "hardcoded rank threshold that exists in no config and no other
|
|
111
|
+
* pipeline" from issue #1539's audit).
|
|
112
|
+
*/
|
|
113
|
+
rankThreshold?: number;
|
|
114
|
+
/**
|
|
115
|
+
* Sort direction for the `turnIndex` secondary key.
|
|
116
|
+
*
|
|
117
|
+
* - `"desc"` (default): relevance-ranked pipelines (targeted-fact,
|
|
118
|
+
* response-guidance) sort `turnIndex` DESC. Undefined `turnIndex`
|
|
119
|
+
* falls to `-1` (bottom of a DESC list). Tertiary tiebreaker:
|
|
120
|
+
* `score DESC`.
|
|
121
|
+
* - `"asc"`: the chronological pipeline (event-order) sorts `turnIndex`
|
|
122
|
+
* ASC. Undefined `turnIndex` falls to `Number.MAX_SAFE_INTEGER`
|
|
123
|
+
* (bottom of an ASC list). Tertiary tiebreaker: `content.localeCompare`.
|
|
124
|
+
*
|
|
125
|
+
* The rank primary key is ALWAYS DESC regardless of this setting.
|
|
126
|
+
*/
|
|
127
|
+
turnIndexSortDirection?: TurnIndexSortDirection;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Sentinel for undefined `turnIndex` when sorting DESC. `-1` sorts below
|
|
132
|
+
* every real turn index (which are `>= 0`), so missing `turn_index` always
|
|
133
|
+
* lands at the bottom of a DESC-ordered list — never wins ordering over a
|
|
134
|
+
* real turn.
|
|
135
|
+
*/
|
|
136
|
+
const UNDEFINED_TURN_INDEX_DESC_SENTINEL = -1;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Sentinel for undefined `turnIndex` when sorting ASC.
|
|
140
|
+
* `Number.MAX_SAFE_INTEGER` sorts above every real turn index, so missing
|
|
141
|
+
* `turn_index` always lands at the bottom of an ASC-ordered list.
|
|
142
|
+
*/
|
|
143
|
+
const UNDEFINED_TURN_INDEX_ASC_SENTINEL = Number.MAX_SAFE_INTEGER;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Deduplicate, score, threshold-filter, and sort evidence items under one
|
|
147
|
+
* unified policy.
|
|
148
|
+
*
|
|
149
|
+
* **Stage order** (matches every existing pipeline's rank/dedupe function):
|
|
150
|
+
* 1. **dedup** by `id` + normalized content (first-seen wins). The dedup
|
|
151
|
+
* key uses transformed content if `transformContent` is declared.
|
|
152
|
+
* 2. **score** each surviving item on its ORIGINAL content (the transform
|
|
153
|
+
* does not influence the score).
|
|
154
|
+
* 3. **threshold-filter**: drop items with `rank < rankThreshold` (if
|
|
155
|
+
* declared).
|
|
156
|
+
* 4. **sort**: `rank DESC` → `turnIndex` (direction-configurable) →
|
|
157
|
+
* tertiary tiebreaker (`score DESC` for relevance pipelines,
|
|
158
|
+
* `content.localeCompare` for chronological pipelines).
|
|
159
|
+
*
|
|
160
|
+
* This function does NOT slice (`maxResults`), budget, or format — those
|
|
161
|
+
* stages remain per-tier because they interact with per-tier metadata
|
|
162
|
+
* insertion. The issue's Solution describes a future `insertMetadata` hook
|
|
163
|
+
* that will make budget-adjustment uniform; that lands in the per-tier
|
|
164
|
+
* migration PRs.
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* // Relevance-ranked pipeline (targeted-fact shape):
|
|
168
|
+
* unifiedDedupeAndRank(items, {
|
|
169
|
+
* query,
|
|
170
|
+
* intents: [],
|
|
171
|
+
* scoreEvidence: (item, q) => scoreTargetedFact(item, q),
|
|
172
|
+
* transformContent: (content) => appendNormalizedNumericCues(content),
|
|
173
|
+
* // turnIndexSortDirection defaults to "desc"
|
|
174
|
+
* });
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* // Chronological pipeline (event-order shape):
|
|
178
|
+
* unifiedDedupeAndRank(items, {
|
|
179
|
+
* query,
|
|
180
|
+
* intents: [],
|
|
181
|
+
* scoreEvidence: (item, q) => scoreEventOrder(item, q),
|
|
182
|
+
* transformContent: (content) => appendChronologicalCues(content, query),
|
|
183
|
+
* rankThreshold: 6, // declared, not inlined
|
|
184
|
+
* turnIndexSortDirection: "asc",
|
|
185
|
+
* });
|
|
186
|
+
*/
|
|
187
|
+
export function unifiedDedupeAndRank<TIntent>(
|
|
188
|
+
items: readonly EvidencePackItem[],
|
|
189
|
+
config: UnifiedRankConfig<TIntent>,
|
|
190
|
+
): RankedEvidenceItem[] {
|
|
191
|
+
const transformContent = config.transformContent ?? ((content: string) => content);
|
|
192
|
+
const direction: TurnIndexSortDirection = config.turnIndexSortDirection ?? "desc";
|
|
193
|
+
const dedupByContent = config.dedupByContent !== false;
|
|
194
|
+
|
|
195
|
+
// Stage 1: dedup by id (+ normalized transformed content when enabled).
|
|
196
|
+
// First-seen wins, matching every existing pipeline. Event-order opts out
|
|
197
|
+
// of content dedup (dedupByContent: false) because it keeps distinct turns
|
|
198
|
+
// even when two turns share the same cue-appended body.
|
|
199
|
+
const seenIds = new Set<string>();
|
|
200
|
+
const seenContent = new Set<string>();
|
|
201
|
+
const survivors: Array<{ original: EvidencePackItem; transformedContent: string }> = [];
|
|
202
|
+
|
|
203
|
+
for (const item of items) {
|
|
204
|
+
const id = resolveItemId(item);
|
|
205
|
+
if (id && seenIds.has(id)) continue;
|
|
206
|
+
|
|
207
|
+
const transformedContent = transformContent(item.content, config.intents);
|
|
208
|
+
if (dedupByContent) {
|
|
209
|
+
const contentKey = transformedContent.toLowerCase().replace(/\s+/g, " ").trim();
|
|
210
|
+
if (seenContent.has(contentKey)) continue;
|
|
211
|
+
seenContent.add(contentKey);
|
|
212
|
+
}
|
|
213
|
+
if (id) seenIds.add(id);
|
|
214
|
+
survivors.push({ original: item, transformedContent });
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// Stage 2: score on ORIGINAL content (transforms don't influence the score).
|
|
218
|
+
const scored: RankedEvidenceItem[] = survivors.map(({ original, transformedContent }) => ({
|
|
219
|
+
...original,
|
|
220
|
+
content: transformedContent,
|
|
221
|
+
rank: config.scoreEvidence(original, config.query, config.intents),
|
|
222
|
+
}));
|
|
223
|
+
|
|
224
|
+
// Stage 3: threshold-filter (declared, not inlined).
|
|
225
|
+
const filtered =
|
|
226
|
+
typeof config.rankThreshold === "number"
|
|
227
|
+
? scored.filter((item) => item.rank >= (config.rankThreshold as number))
|
|
228
|
+
: scored;
|
|
229
|
+
|
|
230
|
+
// Stage 4: sort.
|
|
231
|
+
// rank is ALWAYS DESC (higher rank first).
|
|
232
|
+
// turnIndex direction is configurable: DESC (relevance) or ASC (chronology).
|
|
233
|
+
// The tertiary tiebreaker follows the direction:
|
|
234
|
+
// DESC → score DESC; ASC → content.localeCompare.
|
|
235
|
+
return filtered.sort(makeComparator(direction));
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Build the sort comparator for the configured direction. Extracted so the
|
|
240
|
+
* comparator's two shapes (DESC / ASC) can be tested independently and so
|
|
241
|
+
* the direction divergence is visible in ONE place.
|
|
242
|
+
*/
|
|
243
|
+
function makeComparator(
|
|
244
|
+
direction: TurnIndexSortDirection,
|
|
245
|
+
): (left: RankedEvidenceItem, right: RankedEvidenceItem) => number {
|
|
246
|
+
if (direction === "asc") {
|
|
247
|
+
// Chronological (event-order): rank DESC → turnIndex ASC → content localeCompare.
|
|
248
|
+
// Matches event-order-recall.ts:159-164 (rankedByScore sort) byte-for-byte.
|
|
249
|
+
return (left, right) => {
|
|
250
|
+
if (right.rank !== left.rank) return right.rank - left.rank;
|
|
251
|
+
const leftTurn =
|
|
252
|
+
typeof left.turnIndex === "number"
|
|
253
|
+
? left.turnIndex
|
|
254
|
+
: UNDEFINED_TURN_INDEX_ASC_SENTINEL;
|
|
255
|
+
const rightTurn =
|
|
256
|
+
typeof right.turnIndex === "number"
|
|
257
|
+
? right.turnIndex
|
|
258
|
+
: UNDEFINED_TURN_INDEX_ASC_SENTINEL;
|
|
259
|
+
if (leftTurn !== rightTurn) return leftTurn - rightTurn;
|
|
260
|
+
return left.content.localeCompare(right.content);
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
// Relevance-ranked (targeted-fact, response-guidance):
|
|
264
|
+
// rank DESC → turnIndex DESC → score DESC.
|
|
265
|
+
// Matches targeted-fact-recall.ts:239-245 and response-guidance-recall.ts:374-380
|
|
266
|
+
// byte-for-byte.
|
|
267
|
+
return (left, right) => {
|
|
268
|
+
if (right.rank !== left.rank) return right.rank - left.rank;
|
|
269
|
+
const leftTurn =
|
|
270
|
+
typeof left.turnIndex === "number"
|
|
271
|
+
? left.turnIndex
|
|
272
|
+
: UNDEFINED_TURN_INDEX_DESC_SENTINEL;
|
|
273
|
+
const rightTurn =
|
|
274
|
+
typeof right.turnIndex === "number"
|
|
275
|
+
? right.turnIndex
|
|
276
|
+
: UNDEFINED_TURN_INDEX_DESC_SENTINEL;
|
|
277
|
+
if (rightTurn !== leftTurn) return rightTurn - leftTurn;
|
|
278
|
+
return (right.score ?? 0) - (left.score ?? 0);
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Resolve an evidence item's id. Falls back to `sessionId:turnIndex` when
|
|
285
|
+
* `id` is absent — mirrors every existing pipeline's fallback and
|
|
286
|
+
* `evidence-pack.ts`'s `evidenceItemFallbackId`.
|
|
287
|
+
*/
|
|
288
|
+
function resolveItemId(item: EvidencePackItem): string | undefined {
|
|
289
|
+
if (item.id) return item.id;
|
|
290
|
+
if (item.sessionId && typeof item.turnIndex === "number") {
|
|
291
|
+
return `${item.sessionId}:${item.turnIndex}`;
|
|
292
|
+
}
|
|
293
|
+
return undefined;
|
|
294
|
+
}
|
package/dist/chunk-3BQOQYRB.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
readEnvVar,
|
|
3
|
-
resolveHomeDir
|
|
4
|
-
} from "./chunk-JUC24CTX.js";
|
|
5
|
-
|
|
6
|
-
// src/connectors/paths.ts
|
|
7
|
-
import fs from "fs";
|
|
8
|
-
import path from "path";
|
|
9
|
-
var REGISTRY_DIR_NAME = ".engram-connectors";
|
|
10
|
-
function getConnectorsConfigRoot() {
|
|
11
|
-
const xdgConfigHome = readEnvVar("XDG_CONFIG_HOME");
|
|
12
|
-
return xdgConfigHome ? path.join(xdgConfigHome, "engram") : path.join(resolveHomeDir(), ".config", "engram");
|
|
13
|
-
}
|
|
14
|
-
function getRegistryPath() {
|
|
15
|
-
return path.join(getConnectorsConfigRoot(), REGISTRY_DIR_NAME, "registry.json");
|
|
16
|
-
}
|
|
17
|
-
function getConnectorsDir() {
|
|
18
|
-
return path.join(getConnectorsConfigRoot(), REGISTRY_DIR_NAME, "connectors");
|
|
19
|
-
}
|
|
20
|
-
function hasLegacyConnectorEntries() {
|
|
21
|
-
try {
|
|
22
|
-
return fs.readdirSync(getConnectorsDir()).some((name) => name.endsWith(".json"));
|
|
23
|
-
} catch {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export {
|
|
29
|
-
getRegistryPath,
|
|
30
|
-
getConnectorsDir,
|
|
31
|
-
hasLegacyConnectorEntries
|
|
32
|
-
};
|
|
33
|
-
//# sourceMappingURL=chunk-3BQOQYRB.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/connectors/paths.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { readEnvVar, resolveHomeDir } from \"../runtime/env.js\";\n\n/**\n * Connector registry directory name. Kept under the legacy `engram` config\n * root for backward compatibility with existing installs; the rename to a\n * `remnic` path (with a legacy read-fallback) is tracked in #1518.\n */\nexport const REGISTRY_DIR_NAME = \".engram-connectors\";\n\n/**\n * Single source of truth for the connectors config root\n * (`$XDG_CONFIG_HOME/engram` or `~/.config/engram`). Issue #1527 flagged this\n * derivation as previously duplicated across call sites — add new callers\n * here, never re-derive the path inline.\n */\nexport function getConnectorsConfigRoot(): string {\n const xdgConfigHome = readEnvVar(\"XDG_CONFIG_HOME\");\n return xdgConfigHome\n ? path.join(xdgConfigHome, \"engram\")\n : path.join(resolveHomeDir(), \".config\", \"engram\");\n}\n\n/** Path of the connector registry manifest file. */\nexport function getRegistryPath(): string {\n return path.join(getConnectorsConfigRoot(), REGISTRY_DIR_NAME, \"registry.json\");\n}\n\n/** Directory holding one `<connector-id>.json` per installed connector. */\nexport function getConnectorsDir(): string {\n return path.join(getConnectorsConfigRoot(), REGISTRY_DIR_NAME, \"connectors\");\n}\n\n/**\n * Sticky-legacy evidence for `emitLegacyTools` (issue #1550): any persisted\n * connector entry under the legacy engram connectors dir means an existing\n * install whose clients may still address engram_* aliases. Missing or\n * unreadable dir means fresh install — no evidence, no aliases.\n */\nexport function hasLegacyConnectorEntries(): boolean {\n try {\n return fs\n .readdirSync(getConnectorsDir())\n .some((name) => name.endsWith(\".json\"));\n } catch {\n return false;\n }\n}\n"],"mappings":";;;;;;AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AASV,IAAM,oBAAoB;AAQ1B,SAAS,0BAAkC;AAChD,QAAM,gBAAgB,WAAW,iBAAiB;AAClD,SAAO,gBACH,KAAK,KAAK,eAAe,QAAQ,IACjC,KAAK,KAAK,eAAe,GAAG,WAAW,QAAQ;AACrD;AAGO,SAAS,kBAA0B;AACxC,SAAO,KAAK,KAAK,wBAAwB,GAAG,mBAAmB,eAAe;AAChF;AAGO,SAAS,mBAA2B;AACzC,SAAO,KAAK,KAAK,wBAAwB,GAAG,mBAAmB,YAAY;AAC7E;AAQO,SAAS,4BAAqC;AACnD,MAAI;AACF,WAAO,GACJ,YAAY,iBAAiB,CAAC,EAC9B,KAAK,CAAC,SAAS,KAAK,SAAS,OAAO,CAAC;AAAA,EAC1C,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|