omp-fabric 1.4.5 → 1.6.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/CHANGELOG.md +26 -0
- package/dist/chunks/{chunk-TR3LQHO7.js → chunk-2ZEMWIHZ.js} +2 -2
- package/dist/chunks/chunk-3XPR2AZL.js +74 -0
- package/dist/chunks/chunk-3XPR2AZL.js.map +7 -0
- package/dist/chunks/{chunk-PQE42AW4.js → chunk-CQIFOUT5.js} +3 -3
- package/dist/chunks/{chunk-SG4GVSWX.js → chunk-EQSL47QL.js} +10 -66
- package/dist/chunks/chunk-EQSL47QL.js.map +7 -0
- package/dist/chunks/{chunk-LB2EC7FZ.js → chunk-JMYHQUJQ.js} +9 -105
- package/dist/chunks/chunk-JMYHQUJQ.js.map +7 -0
- package/dist/chunks/{chunk-6JPXLXDS.js → chunk-KHQJKGBC.js} +2 -2
- package/dist/chunks/{chunk-6JPXLXDS.js.map → chunk-KHQJKGBC.js.map} +1 -1
- package/dist/chunks/chunk-KTB4R3E3.js +51 -0
- package/dist/chunks/chunk-KTB4R3E3.js.map +7 -0
- package/dist/chunks/{chunk-VDLZAORG.js → chunk-SY56DK6U.js} +11 -5
- package/dist/chunks/chunk-SY56DK6U.js.map +7 -0
- package/dist/chunks/{chunk-J6DWC5CX.js → chunk-TGN42MRN.js} +3 -3
- package/dist/chunks/chunk-TQQPXV3I.js +58 -0
- package/dist/chunks/chunk-TQQPXV3I.js.map +7 -0
- package/dist/chunks/chunk-ZDWBTQB6.js +107 -0
- package/dist/chunks/chunk-ZDWBTQB6.js.map +7 -0
- package/dist/compaction/hook.js +2 -1
- package/dist/compaction/lcm-loader.d.ts +12 -0
- package/dist/compaction/lcm-loader.d.ts.map +1 -0
- package/dist/compaction/lcm-maintenance.d.ts +2 -1
- package/dist/compaction/lcm-maintenance.d.ts.map +1 -1
- package/dist/compaction/lcm-runtime.d.ts +4 -0
- package/dist/compaction/lcm-runtime.d.ts.map +1 -1
- package/dist/compaction/lcm-runtime.js +1185 -0
- package/dist/compaction/lcm-runtime.js.map +7 -0
- package/dist/config.d.ts +3 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/fabric-runtime-state.js +9 -7
- package/dist/fabric-runtime-state.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +137 -990
- package/dist/index.js.map +4 -4
- package/dist/memory/lcm-adapter.d.ts +1 -1
- package/dist/memory/lcm-adapter.d.ts.map +1 -1
- package/dist/providers/memory-provider.js +2 -2
- package/dist/residency/host.js +8 -6
- package/dist/residency/omp-entry.js +8 -6
- package/dist/residency/omp-entry.js.map +1 -1
- package/dist/storage/lcm-identity.d.ts +43 -0
- package/dist/storage/lcm-identity.d.ts.map +1 -0
- package/dist/storage/lcm-ledger.d.ts +7 -46
- package/dist/storage/lcm-ledger.d.ts.map +1 -1
- package/dist/storage/sqlite.d.ts +19 -0
- package/dist/storage/sqlite.d.ts.map +1 -0
- package/dist/ui/dashboard.js +3 -3
- package/dist/ui/settings.js +4 -4
- package/docs/compaction.md +6 -3
- package/package.json +1 -1
- package/dist/chunks/chunk-LB2EC7FZ.js.map +0 -7
- package/dist/chunks/chunk-MBOXJKF6.js +0 -311
- package/dist/chunks/chunk-MBOXJKF6.js.map +0 -7
- package/dist/chunks/chunk-SG4GVSWX.js.map +0 -7
- package/dist/chunks/chunk-VDLZAORG.js.map +0 -7
- /package/dist/chunks/{chunk-TR3LQHO7.js.map → chunk-2ZEMWIHZ.js.map} +0 -0
- /package/dist/chunks/{chunk-PQE42AW4.js.map → chunk-CQIFOUT5.js.map} +0 -0
- /package/dist/chunks/{chunk-J6DWC5CX.js.map → chunk-TGN42MRN.js.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.6.0
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- LCM compaction fell back to deterministic excerpts after about four model summaries per day. The maintenance budget spent a 60-second wall-time quota that is accounted per project per day, and each summary of a real session took roughly fourteen seconds, so the fifth call was refused and every later node was written by the emergency reducer. Observed on a live 2,368-entry session: four model-written leaves covering 32 sources, twelve deterministic nodes, and 55,110 ms of 60,000 ms spent. The daily quota is now 7,200 seconds, a separate 60-second guard bounds a single maintenance run so turns stay responsive, and the compaction that fires reads model summaries.
|
|
8
|
+
- Leaf selection clipped evidence. A leaf took a fixed count of entries with no regard for their size, and on the measured session the ninetieth-percentile leaf reached 62,040 characters against a 48,000-character prompt bound, so the tail was cut before the model saw it. Leaves are now packed up to the input budget and always carry at least one entry.
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- Compaction defaults target model summaries rather than fallbacks: leaves hold up to 32 entries (was 8) inside a 200,000-character prompt budget (was 48,000), a maintenance run makes up to 8 passes (was 4), and the model budget allows 512 daily and 256 per-session calls (was 32 and 16). On the measured session this covers the same 2,368 entries in roughly 43 calls rather than 296.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- `compaction.lcmMaxDailyModelCalls`, `compaction.lcmMaxSessionModelCalls`, and `compaction.lcmMaxDailyModelSeconds` expose the model budget that was previously a fixed constant.
|
|
17
|
+
|
|
18
|
+
## 1.5.0
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- LCM runs on Bun's own SQLite. `src/storage/sqlite.ts` resolves `node:sqlite` first and falls back to `bun:sqlite`, so a runtime that ships only Bun's driver keeps durable ledger compaction rather than losing it. The ledger, maintenance, backup, checkpoint, rollback, and restart paths are covered against the Bun driver directly.
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- Installing or loading the extension failed outright on runtimes without `node:sqlite` (`Failed to load extension: Could not resolve: "node:sqlite"`), which took down every Fabric feature rather than only LCM. The entry bundle pulled the ledger in statically through `src/index.ts`, `src/agents/handoff.ts`, and the memory provider. The sqlite-free identity and payload helpers now live in `src/storage/lcm-identity.ts`, the LCM runtime loads from the stable lazy entry `dist/compaction/lcm-runtime.js` only when compaction needs it, and a runtime that cannot resolve `node:sqlite` keeps the extension running with compaction delegated to OMP core plus one warning. `bun run build` now fails when anything in the startup static graph imports `node:sqlite`.
|
|
27
|
+
- Windows CI failed on unrelated files with 5 s test timeouts that passed on rerun, and the v1.4.6 release was correctly withheld by the new Windows gate because of it. The suite now scales its test and hook deadlines on Windows runners, where it executes roughly three times slower, and keeps the tight defaults elsewhere.
|
|
28
|
+
|
|
3
29
|
## 1.4.5
|
|
4
30
|
|
|
5
31
|
### Added
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
buildThinkingDigest,
|
|
13
13
|
snapshotHandoffSession,
|
|
14
14
|
thinkingTransferPolicy
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-JMYHQUJQ.js";
|
|
16
16
|
import {
|
|
17
17
|
isFabricThinking
|
|
18
18
|
} from "./chunk-JSBTB3P6.js";
|
|
@@ -2803,4 +2803,4 @@ export {
|
|
|
2803
2803
|
resolveFabricIdentity,
|
|
2804
2804
|
MainAgentController
|
|
2805
2805
|
};
|
|
2806
|
-
//# sourceMappingURL=chunk-
|
|
2806
|
+
//# sourceMappingURL=chunk-2ZEMWIHZ.js.map
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// src/compaction/bounds.ts
|
|
2
|
+
var MAX_SUMMARY_BYTES = 32 * 1024;
|
|
3
|
+
var MAX_REQUEST_SOURCE_BYTES = 8 * 1024;
|
|
4
|
+
var encoder = new TextEncoder();
|
|
5
|
+
var utf8Bytes = (text) => encoder.encode(text).byteLength;
|
|
6
|
+
var clipUtf8 = (text, maxBytes, suffix = "\u2026") => {
|
|
7
|
+
if (maxBytes <= 0) return "";
|
|
8
|
+
if (utf8Bytes(text) <= maxBytes) return text;
|
|
9
|
+
const suffixBytes = utf8Bytes(suffix);
|
|
10
|
+
if (suffixBytes >= maxBytes) return "";
|
|
11
|
+
let output = "";
|
|
12
|
+
let used = 0;
|
|
13
|
+
const available = maxBytes - suffixBytes;
|
|
14
|
+
for (const character of text) {
|
|
15
|
+
const bytes = utf8Bytes(character);
|
|
16
|
+
if (used + bytes > available) break;
|
|
17
|
+
output += character;
|
|
18
|
+
used += bytes;
|
|
19
|
+
}
|
|
20
|
+
return `${output}${suffix}`;
|
|
21
|
+
};
|
|
22
|
+
var canonicalizeText = (input, maxBytes = MAX_REQUEST_SOURCE_BYTES) => {
|
|
23
|
+
const canonical = input.trim().split(/\s+/u).filter(Boolean).join(" ");
|
|
24
|
+
const sourceBytes = utf8Bytes(canonical);
|
|
25
|
+
return {
|
|
26
|
+
text: clipUtf8(canonical, maxBytes),
|
|
27
|
+
truncated: sourceBytes > maxBytes,
|
|
28
|
+
sourceBytes
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
var sampleAddressedFrom = (source, maxValues) => {
|
|
32
|
+
const earliestLimit = Math.ceil(maxValues / 2);
|
|
33
|
+
const latestLimit = Math.floor(maxValues / 2);
|
|
34
|
+
const earliest = [];
|
|
35
|
+
const latest = [];
|
|
36
|
+
let omitted = 0;
|
|
37
|
+
let omittedFirstEntryId;
|
|
38
|
+
let omittedLastEntryId;
|
|
39
|
+
for (const value of source) {
|
|
40
|
+
if (earliest.length < earliestLimit) {
|
|
41
|
+
earliest.push(value);
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
latest.push(value);
|
|
45
|
+
if (latest.length <= latestLimit) continue;
|
|
46
|
+
const displaced = latest.shift();
|
|
47
|
+
omitted += 1;
|
|
48
|
+
omittedFirstEntryId ??= displaced.entryId;
|
|
49
|
+
omittedLastEntryId = displaced.entryId;
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
values: [...earliest, ...latest],
|
|
53
|
+
omitted,
|
|
54
|
+
...omittedFirstEntryId !== void 0 ? { omittedFirstEntryId } : {},
|
|
55
|
+
...omittedLastEntryId !== void 0 ? { omittedLastEntryId } : {},
|
|
56
|
+
splitIndex: earliest.length
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
var sampleAddressed = (values, maxValues) => sampleAddressedFrom(values, maxValues);
|
|
60
|
+
var omissionLine = (count, firstEntryId, lastEntryId, noun) => {
|
|
61
|
+
const range = firstEntryId || lastEntryId ? `${firstEntryId || "(start)"} \u2192 ${lastEntryId || "(end)"}` : "(unknown range)";
|
|
62
|
+
return `\u2026 omitted ${count} ${noun}; source entries ${range}`;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export {
|
|
66
|
+
MAX_SUMMARY_BYTES,
|
|
67
|
+
utf8Bytes,
|
|
68
|
+
clipUtf8,
|
|
69
|
+
canonicalizeText,
|
|
70
|
+
sampleAddressedFrom,
|
|
71
|
+
sampleAddressed,
|
|
72
|
+
omissionLine
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=chunk-3XPR2AZL.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/compaction/bounds.ts"],
|
|
4
|
+
"sourcesContent": ["export const MAX_SUMMARY_BYTES = 32 * 1024;\nconst MAX_REQUEST_SOURCE_BYTES = 8 * 1024;\n\nconst encoder = new TextEncoder();\n\nexport const utf8Bytes = (text: string): number => encoder.encode(text).byteLength;\n\nexport const clipUtf8 = (text: string, maxBytes: number, suffix = \"\u2026\"): string => {\n if (maxBytes <= 0) return \"\";\n if (utf8Bytes(text) <= maxBytes) return text;\n const suffixBytes = utf8Bytes(suffix);\n if (suffixBytes >= maxBytes) return \"\";\n let output = \"\";\n let used = 0;\n const available = maxBytes - suffixBytes;\n for (const character of text) {\n const bytes = utf8Bytes(character);\n if (used + bytes > available) break;\n output += character;\n used += bytes;\n }\n return `${output}${suffix}`;\n};\n\nexport interface CanonicalText {\n text: string;\n truncated: boolean;\n sourceBytes: number;\n}\n\nexport const canonicalizeText = (input: string, maxBytes = MAX_REQUEST_SOURCE_BYTES): CanonicalText => {\n const canonical = input.trim().split(/\\s+/u).filter(Boolean).join(\" \");\n const sourceBytes = utf8Bytes(canonical);\n return {\n text: clipUtf8(canonical, maxBytes),\n truncated: sourceBytes > maxBytes,\n sourceBytes,\n };\n};\n\nexport interface AddressedValue {\n entryId: string;\n}\n\nexport interface AddressedSample<T extends AddressedValue> {\n values: T[];\n omitted: number;\n omittedFirstEntryId?: string;\n omittedLastEntryId?: string;\n splitIndex: number;\n}\n\nexport const sampleAddressedFrom = <T extends AddressedValue>(\n source: Iterable<T>,\n maxValues: number,\n): AddressedSample<T> => {\n const earliestLimit = Math.ceil(maxValues / 2);\n const latestLimit = Math.floor(maxValues / 2);\n const earliest: T[] = [];\n const latest: T[] = [];\n let omitted = 0;\n let omittedFirstEntryId: string | undefined;\n let omittedLastEntryId: string | undefined;\n\n for (const value of source) {\n if (earliest.length < earliestLimit) {\n earliest.push(value);\n continue;\n }\n latest.push(value);\n if (latest.length <= latestLimit) continue;\n const displaced = latest.shift()!;\n omitted += 1;\n omittedFirstEntryId ??= displaced.entryId;\n omittedLastEntryId = displaced.entryId;\n }\n\n return {\n values: [...earliest, ...latest],\n omitted,\n ...(omittedFirstEntryId !== undefined ? { omittedFirstEntryId } : {}),\n ...(omittedLastEntryId !== undefined ? { omittedLastEntryId } : {}),\n splitIndex: earliest.length,\n };\n};\n\nexport const sampleAddressed = <T extends AddressedValue>(\n values: readonly T[],\n maxValues: number,\n): AddressedSample<T> => sampleAddressedFrom(values, maxValues);\n\nexport const omissionLine = (\n count: number,\n firstEntryId: string | undefined,\n lastEntryId: string | undefined,\n noun: string,\n): string => {\n const range = firstEntryId || lastEntryId\n ? `${firstEntryId || \"(start)\"} \u2192 ${lastEntryId || \"(end)\"}`\n : \"(unknown range)\";\n return `\u2026 omitted ${count} ${noun}; source entries ${range}`;\n};\n"],
|
|
5
|
+
"mappings": ";AAAO,IAAM,oBAAoB,KAAK;AACtC,IAAM,2BAA2B,IAAI;AAErC,IAAM,UAAU,IAAI,YAAY;AAEzB,IAAM,YAAY,CAAC,SAAyB,QAAQ,OAAO,IAAI,EAAE;AAEjE,IAAM,WAAW,CAAC,MAAc,UAAkB,SAAS,aAAgB;AAChF,MAAI,YAAY,EAAG,QAAO;AAC1B,MAAI,UAAU,IAAI,KAAK,SAAU,QAAO;AACxC,QAAM,cAAc,UAAU,MAAM;AACpC,MAAI,eAAe,SAAU,QAAO;AACpC,MAAI,SAAS;AACb,MAAI,OAAO;AACX,QAAM,YAAY,WAAW;AAC7B,aAAW,aAAa,MAAM;AAC5B,UAAM,QAAQ,UAAU,SAAS;AACjC,QAAI,OAAO,QAAQ,UAAW;AAC9B,cAAU;AACV,YAAQ;AAAA,EACV;AACA,SAAO,GAAG,MAAM,GAAG,MAAM;AAC3B;AAQO,IAAM,mBAAmB,CAAC,OAAe,WAAW,6BAA4C;AACrG,QAAM,YAAY,MAAM,KAAK,EAAE,MAAM,MAAM,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AACrE,QAAM,cAAc,UAAU,SAAS;AACvC,SAAO;AAAA,IACL,MAAM,SAAS,WAAW,QAAQ;AAAA,IAClC,WAAW,cAAc;AAAA,IACzB;AAAA,EACF;AACF;AAcO,IAAM,sBAAsB,CACjC,QACA,cACuB;AACvB,QAAM,gBAAgB,KAAK,KAAK,YAAY,CAAC;AAC7C,QAAM,cAAc,KAAK,MAAM,YAAY,CAAC;AAC5C,QAAM,WAAgB,CAAC;AACvB,QAAM,SAAc,CAAC;AACrB,MAAI,UAAU;AACd,MAAI;AACJ,MAAI;AAEJ,aAAW,SAAS,QAAQ;AAC1B,QAAI,SAAS,SAAS,eAAe;AACnC,eAAS,KAAK,KAAK;AACnB;AAAA,IACF;AACA,WAAO,KAAK,KAAK;AACjB,QAAI,OAAO,UAAU,YAAa;AAClC,UAAM,YAAY,OAAO,MAAM;AAC/B,eAAW;AACX,4BAAwB,UAAU;AAClC,yBAAqB,UAAU;AAAA,EACjC;AAEA,SAAO;AAAA,IACL,QAAQ,CAAC,GAAG,UAAU,GAAG,MAAM;AAAA,IAC/B;AAAA,IACA,GAAI,wBAAwB,SAAY,EAAE,oBAAoB,IAAI,CAAC;AAAA,IACnE,GAAI,uBAAuB,SAAY,EAAE,mBAAmB,IAAI,CAAC;AAAA,IACjE,YAAY,SAAS;AAAA,EACvB;AACF;AAEO,IAAM,kBAAkB,CAC7B,QACA,cACuB,oBAAoB,QAAQ,SAAS;AAEvD,IAAM,eAAe,CAC1B,OACA,cACA,aACA,SACW;AACX,QAAM,QAAQ,gBAAgB,cAC1B,GAAG,gBAAgB,SAAS,WAAM,eAAe,OAAO,KACxD;AACJ,SAAO,kBAAa,KAAK,IAAI,IAAI,oBAAoB,KAAK;AAC5D;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -21,13 +21,13 @@ import {
|
|
|
21
21
|
import {
|
|
22
22
|
peerLabelPrefix,
|
|
23
23
|
writeHandoffSession
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-JMYHQUJQ.js";
|
|
25
25
|
import {
|
|
26
26
|
DEFAULT_FABRIC_CONFIG,
|
|
27
27
|
MAX_AGENT_TIMEOUT_MS,
|
|
28
28
|
MIN_AGENT_TIMEOUT_MS,
|
|
29
29
|
resolveAgentDir
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-SY56DK6U.js";
|
|
31
31
|
import {
|
|
32
32
|
FABRIC_ACTOR_HOST_EVENTS,
|
|
33
33
|
readJsonlPage
|
|
@@ -6635,4 +6635,4 @@ export {
|
|
|
6635
6635
|
agentParticipantRecords,
|
|
6636
6636
|
actorParticipantRecord
|
|
6637
6637
|
};
|
|
6638
|
-
//# sourceMappingURL=chunk-
|
|
6638
|
+
//# sourceMappingURL=chunk-CQIFOUT5.js.map
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
fabricExecTitleHint
|
|
3
3
|
} from "./chunk-3J7BKUNG.js";
|
|
4
|
+
import {
|
|
5
|
+
MAX_SUMMARY_BYTES,
|
|
6
|
+
canonicalizeText,
|
|
7
|
+
clipUtf8,
|
|
8
|
+
omissionLine,
|
|
9
|
+
sampleAddressed,
|
|
10
|
+
sampleAddressedFrom,
|
|
11
|
+
utf8Bytes
|
|
12
|
+
} from "./chunk-3XPR2AZL.js";
|
|
4
13
|
import {
|
|
5
14
|
FABRIC_BRANCH_RUN_DESCRIPTION_MAX_BYTES,
|
|
6
15
|
FABRIC_BRANCH_RUN_NAME_MAX_BYTES,
|
|
@@ -82,70 +91,6 @@ var sessionEntryToContextMessages = (entry) => buildOmpSessionContext([entry], e
|
|
|
82
91
|
}).messages;
|
|
83
92
|
var buildSessionContext = (entries, leafId, byId) => buildOmpSessionContext([...entries], leafId, byId);
|
|
84
93
|
|
|
85
|
-
// src/compaction/bounds.ts
|
|
86
|
-
var MAX_SUMMARY_BYTES = 32 * 1024;
|
|
87
|
-
var MAX_REQUEST_SOURCE_BYTES = 8 * 1024;
|
|
88
|
-
var encoder = new TextEncoder();
|
|
89
|
-
var utf8Bytes = (text) => encoder.encode(text).byteLength;
|
|
90
|
-
var clipUtf8 = (text, maxBytes, suffix = "\u2026") => {
|
|
91
|
-
if (maxBytes <= 0) return "";
|
|
92
|
-
if (utf8Bytes(text) <= maxBytes) return text;
|
|
93
|
-
const suffixBytes = utf8Bytes(suffix);
|
|
94
|
-
if (suffixBytes >= maxBytes) return "";
|
|
95
|
-
let output = "";
|
|
96
|
-
let used = 0;
|
|
97
|
-
const available = maxBytes - suffixBytes;
|
|
98
|
-
for (const character of text) {
|
|
99
|
-
const bytes = utf8Bytes(character);
|
|
100
|
-
if (used + bytes > available) break;
|
|
101
|
-
output += character;
|
|
102
|
-
used += bytes;
|
|
103
|
-
}
|
|
104
|
-
return `${output}${suffix}`;
|
|
105
|
-
};
|
|
106
|
-
var canonicalizeText = (input, maxBytes = MAX_REQUEST_SOURCE_BYTES) => {
|
|
107
|
-
const canonical = input.trim().split(/\s+/u).filter(Boolean).join(" ");
|
|
108
|
-
const sourceBytes = utf8Bytes(canonical);
|
|
109
|
-
return {
|
|
110
|
-
text: clipUtf8(canonical, maxBytes),
|
|
111
|
-
truncated: sourceBytes > maxBytes,
|
|
112
|
-
sourceBytes
|
|
113
|
-
};
|
|
114
|
-
};
|
|
115
|
-
var sampleAddressedFrom = (source, maxValues) => {
|
|
116
|
-
const earliestLimit = Math.ceil(maxValues / 2);
|
|
117
|
-
const latestLimit = Math.floor(maxValues / 2);
|
|
118
|
-
const earliest = [];
|
|
119
|
-
const latest = [];
|
|
120
|
-
let omitted = 0;
|
|
121
|
-
let omittedFirstEntryId;
|
|
122
|
-
let omittedLastEntryId;
|
|
123
|
-
for (const value of source) {
|
|
124
|
-
if (earliest.length < earliestLimit) {
|
|
125
|
-
earliest.push(value);
|
|
126
|
-
continue;
|
|
127
|
-
}
|
|
128
|
-
latest.push(value);
|
|
129
|
-
if (latest.length <= latestLimit) continue;
|
|
130
|
-
const displaced = latest.shift();
|
|
131
|
-
omitted += 1;
|
|
132
|
-
omittedFirstEntryId ??= displaced.entryId;
|
|
133
|
-
omittedLastEntryId = displaced.entryId;
|
|
134
|
-
}
|
|
135
|
-
return {
|
|
136
|
-
values: [...earliest, ...latest],
|
|
137
|
-
omitted,
|
|
138
|
-
...omittedFirstEntryId !== void 0 ? { omittedFirstEntryId } : {},
|
|
139
|
-
...omittedLastEntryId !== void 0 ? { omittedLastEntryId } : {},
|
|
140
|
-
splitIndex: earliest.length
|
|
141
|
-
};
|
|
142
|
-
};
|
|
143
|
-
var sampleAddressed = (values, maxValues) => sampleAddressedFrom(values, maxValues);
|
|
144
|
-
var omissionLine = (count, firstEntryId, lastEntryId, noun) => {
|
|
145
|
-
const range = firstEntryId || lastEntryId ? `${firstEntryId || "(start)"} \u2192 ${lastEntryId || "(end)"}` : "(unknown range)";
|
|
146
|
-
return `\u2026 omitted ${count} ${noun}; source entries ${range}`;
|
|
147
|
-
};
|
|
148
|
-
|
|
149
94
|
// src/compaction/threshold.ts
|
|
150
95
|
var modelCompactionKey = (model) => model ? `${model.provider}/${model.id}` : void 0;
|
|
151
96
|
var configuredCompactionTokenThreshold = (config, modelKey) => modelKey === void 0 ? void 0 : config.compaction.tokenThresholds[modelKey];
|
|
@@ -2214,7 +2159,6 @@ var registerCompactionHook = (omp, options) => {
|
|
|
2214
2159
|
|
|
2215
2160
|
export {
|
|
2216
2161
|
estimateTokens,
|
|
2217
|
-
clipUtf8,
|
|
2218
2162
|
compactAtConfiguredThreshold,
|
|
2219
2163
|
MAX_COMPACTION_INSTRUCTIONS_CHARS,
|
|
2220
2164
|
MAX_PRESERVE_ITEMS,
|
|
@@ -2229,4 +2173,4 @@ export {
|
|
|
2229
2173
|
compileFabricSummary,
|
|
2230
2174
|
registerCompactionHook
|
|
2231
2175
|
};
|
|
2232
|
-
//# sourceMappingURL=chunk-
|
|
2176
|
+
//# sourceMappingURL=chunk-EQSL47QL.js.map
|