omp-fabric 1.23.0 → 1.24.1

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 (100) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/capture/wrapper.d.ts.map +1 -1
  3. package/dist/chunks/{chunk-52JBWP2C.js → chunk-3LMPHRDQ.js} +2 -2
  4. package/dist/chunks/{chunk-R4EFMCIY.js → chunk-4XJHCLTX.js} +2 -2
  5. package/dist/chunks/{chunk-P4GPBAQS.js → chunk-66PGUYJJ.js} +3 -3
  6. package/dist/chunks/{chunk-MQSRZC2O.js → chunk-AEZ7VF5S.js} +2 -2
  7. package/dist/chunks/{chunk-SDZXNTBF.js → chunk-B7HOWHPZ.js} +2 -2
  8. package/dist/chunks/{chunk-DTG3DYVC.js → chunk-BQLRDSNL.js} +3 -3
  9. package/dist/chunks/{chunk-RA2IB2QT.js → chunk-DRIWQ6PD.js} +5 -5
  10. package/dist/chunks/chunk-G5FBLYOY.js +895 -0
  11. package/dist/chunks/chunk-G5FBLYOY.js.map +7 -0
  12. package/dist/chunks/{chunk-BPMSLBX4.js → chunk-GE53G4VR.js} +2 -2
  13. package/dist/chunks/{chunk-LNP6JVCZ.js → chunk-ICADZLLJ.js} +5 -4
  14. package/dist/chunks/chunk-ICADZLLJ.js.map +7 -0
  15. package/dist/chunks/{chunk-3GMSYFLT.js → chunk-IE5HUDWQ.js} +3 -3
  16. package/dist/chunks/{chunk-YBNCEX5E.js → chunk-JXNXHUIJ.js} +2 -2
  17. package/dist/chunks/{chunk-E4HNDTLM.js → chunk-MZUWSNZX.js} +2 -69
  18. package/dist/chunks/{chunk-E4HNDTLM.js.map → chunk-MZUWSNZX.js.map} +3 -3
  19. package/dist/chunks/chunk-NIWOSO22.js +74 -0
  20. package/dist/chunks/chunk-NIWOSO22.js.map +7 -0
  21. package/dist/chunks/{chunk-ZFMSJLQE.js → chunk-OHPTGVDK.js} +7 -2
  22. package/dist/chunks/chunk-OHPTGVDK.js.map +7 -0
  23. package/dist/chunks/{chunk-GUJNTA7Z.js → chunk-ON7LE7QA.js} +8 -3
  24. package/dist/chunks/chunk-ON7LE7QA.js.map +7 -0
  25. package/dist/chunks/{chunk-ZQ72MAHY.js → chunk-QP3SVWUV.js} +7 -4
  26. package/dist/chunks/chunk-QP3SVWUV.js.map +7 -0
  27. package/dist/chunks/chunk-QW5LEEFV.js +130 -0
  28. package/dist/chunks/chunk-QW5LEEFV.js.map +7 -0
  29. package/dist/chunks/{chunk-4J65SMNI.js → chunk-SWHJQ6XH.js} +173 -71
  30. package/dist/chunks/chunk-SWHJQ6XH.js.map +7 -0
  31. package/dist/compaction/hook.d.ts +1 -0
  32. package/dist/compaction/hook.d.ts.map +1 -1
  33. package/dist/compaction/hook.js +6 -5
  34. package/dist/compaction/lcm-addresses.d.ts.map +1 -1
  35. package/dist/compaction/lcm-maintenance.d.ts +4 -0
  36. package/dist/compaction/lcm-maintenance.d.ts.map +1 -1
  37. package/dist/compaction/lcm-model.d.ts +1 -0
  38. package/dist/compaction/lcm-model.d.ts.map +1 -1
  39. package/dist/compaction/lcm-recovery.d.ts +7 -0
  40. package/dist/compaction/lcm-recovery.d.ts.map +1 -0
  41. package/dist/compaction/lcm-runtime.d.ts +8 -3
  42. package/dist/compaction/lcm-runtime.d.ts.map +1 -1
  43. package/dist/compaction/lcm-runtime.js +272 -670
  44. package/dist/compaction/lcm-runtime.js.map +4 -4
  45. package/dist/config.d.ts +1 -0
  46. package/dist/config.d.ts.map +1 -1
  47. package/dist/core/action-registry.js +3 -3
  48. package/dist/core/omp-tools.d.ts +3 -0
  49. package/dist/core/omp-tools.d.ts.map +1 -1
  50. package/dist/core/system-guidance.d.ts.map +1 -1
  51. package/dist/entropy/index.js +6 -6
  52. package/dist/fabric-exec-tool.d.ts.map +1 -1
  53. package/dist/fabric-runtime-state.js +17 -16
  54. package/dist/fabric-runtime-state.js.map +1 -1
  55. package/dist/index.d.ts.map +1 -1
  56. package/dist/index.js +40 -19
  57. package/dist/index.js.map +3 -3
  58. package/dist/memory/discovery.js +5 -5
  59. package/dist/memory/lcm-adapter.d.ts +7 -2
  60. package/dist/memory/lcm-adapter.d.ts.map +1 -1
  61. package/dist/memory/normalize.js +4 -4
  62. package/dist/memory/search.js +5 -5
  63. package/dist/providers/memory-provider.d.ts +2 -1
  64. package/dist/providers/memory-provider.d.ts.map +1 -1
  65. package/dist/providers/memory-provider.js +8 -8
  66. package/dist/residency/host.js +12 -11
  67. package/dist/residency/omp-entry.js +12 -11
  68. package/dist/residency/omp-entry.js.map +1 -1
  69. package/dist/runtime/core-override-guest-types.js +1 -1
  70. package/dist/runtime/node-process-runtime.js +1 -1
  71. package/dist/storage/lcm-identity.d.ts +4 -0
  72. package/dist/storage/lcm-identity.d.ts.map +1 -1
  73. package/dist/storage/lcm-ledger.d.ts +11 -2
  74. package/dist/storage/lcm-ledger.d.ts.map +1 -1
  75. package/dist/storage/lcm-migration.d.ts.map +1 -1
  76. package/dist/ui/settings.d.ts.map +1 -1
  77. package/dist/ui/settings.js +26 -2
  78. package/dist/ui/settings.js.map +2 -2
  79. package/docs/compaction.md +18 -4
  80. package/docs/configuration.md +1 -1
  81. package/package.json +1 -1
  82. package/dist/chunks/chunk-4J65SMNI.js.map +0 -7
  83. package/dist/chunks/chunk-GUJNTA7Z.js.map +0 -7
  84. package/dist/chunks/chunk-LNP6JVCZ.js.map +0 -7
  85. package/dist/chunks/chunk-NX2G7BRO.js +0 -87
  86. package/dist/chunks/chunk-NX2G7BRO.js.map +0 -7
  87. package/dist/chunks/chunk-WCV26AOT.js +0 -183
  88. package/dist/chunks/chunk-WCV26AOT.js.map +0 -7
  89. package/dist/chunks/chunk-ZFMSJLQE.js.map +0 -7
  90. package/dist/chunks/chunk-ZQ72MAHY.js.map +0 -7
  91. /package/dist/chunks/{chunk-52JBWP2C.js.map → chunk-3LMPHRDQ.js.map} +0 -0
  92. /package/dist/chunks/{chunk-R4EFMCIY.js.map → chunk-4XJHCLTX.js.map} +0 -0
  93. /package/dist/chunks/{chunk-P4GPBAQS.js.map → chunk-66PGUYJJ.js.map} +0 -0
  94. /package/dist/chunks/{chunk-MQSRZC2O.js.map → chunk-AEZ7VF5S.js.map} +0 -0
  95. /package/dist/chunks/{chunk-SDZXNTBF.js.map → chunk-B7HOWHPZ.js.map} +0 -0
  96. /package/dist/chunks/{chunk-DTG3DYVC.js.map → chunk-BQLRDSNL.js.map} +0 -0
  97. /package/dist/chunks/{chunk-RA2IB2QT.js.map → chunk-DRIWQ6PD.js.map} +0 -0
  98. /package/dist/chunks/{chunk-BPMSLBX4.js.map → chunk-GE53G4VR.js.map} +0 -0
  99. /package/dist/chunks/{chunk-3GMSYFLT.js.map → chunk-IE5HUDWQ.js.map} +0 -0
  100. /package/dist/chunks/{chunk-YBNCEX5E.js.map → chunk-JXNXHUIJ.js.map} +0 -0
@@ -1,7 +1,5 @@
1
1
  import {
2
- MAX_SUMMARY_BYTES,
3
2
  canonicalizeText,
4
- clipUtf8,
5
3
  utf8Bytes
6
4
  } from "./chunk-3XPR2AZL.js";
7
5
 
@@ -393,77 +391,12 @@ var decodeCompactionInstructions = (source) => {
393
391
  };
394
392
  };
395
393
 
396
- // src/compaction/render.ts
397
- var SECTION_ORDER = [
398
- { key: "goal", header: "[Session Goal]", maxBytes: 4096 },
399
- { key: "files", header: "[Files And Changes]", maxBytes: 4608 },
400
- { key: "activity", header: "[Fabric Activity]", maxBytes: 2048 },
401
- { key: "outstanding", header: "[Outstanding Context]", maxBytes: 4608 },
402
- { key: "earlierTurns", header: "[Earlier Turns]", maxBytes: 3072 },
403
- { key: "status", header: "[Current Status]", maxBytes: 2048 }
404
- ];
405
- var REQUEST_MAX_BYTES = 3072;
406
- var TRANSCRIPT_MAX_BYTES = 5120;
407
- var FOOTER_MAX_BYTES = 1536;
408
- var MAX_INPUT_LINES_PER_SECTION = 128;
409
- var MAX_RENDERED_LINE_BYTES = 1024;
410
- var LCM_RECOVERY_POINTER = "For exact pre-summary history, use memory.recall on this range, then memory.expand by stable entry or operation address.";
411
- var POINTER_LINE = LCM_RECOVERY_POINTER;
412
- var sampledLines = (lines, keep) => {
413
- if (lines.length <= keep) return [...lines];
414
- const earliest = Math.ceil(keep / 2);
415
- const latest = Math.floor(keep / 2);
416
- return [
417
- ...lines.slice(0, earliest),
418
- `\u2026 omitted ${lines.length - keep} rendered lines`,
419
- ...lines.slice(lines.length - latest)
420
- ];
421
- };
422
- var boundedBlock = (header, sourceLines, maxBytes) => {
423
- const clipped = sourceLines.map((line) => clipUtf8(line, MAX_RENDERED_LINE_BYTES));
424
- const capped = sampledLines(clipped, Math.min(clipped.length, MAX_INPUT_LINES_PER_SECTION));
425
- for (let keep = capped.length; keep >= 0; keep--) {
426
- const lines = sampledLines(capped, keep);
427
- const block = [header, ...lines].join("\n");
428
- if (utf8Bytes(block) <= maxBytes) return block;
429
- }
430
- return clipUtf8(header, maxBytes);
431
- };
432
- var renderSummary = (sections, options) => {
433
- const blocks = [];
434
- for (const { key, header, maxBytes } of SECTION_ORDER) {
435
- const lines = sections[key];
436
- if (lines.length === 0) continue;
437
- blocks.push(boundedBlock(header, lines, maxBytes));
438
- if (key === "goal" && options.requestLines && options.requestLines.length > 0) {
439
- blocks.push(boundedBlock("[Compaction Request]", options.requestLines, REQUEST_MAX_BYTES));
440
- }
441
- }
442
- if (sections.goal.length === 0 && options.requestLines && options.requestLines.length > 0) {
443
- blocks.unshift(boundedBlock("[Compaction Request]", options.requestLines, REQUEST_MAX_BYTES));
444
- }
445
- if (sections.transcript.length > 0) {
446
- blocks.push(boundedBlock("---", sections.transcript, TRANSCRIPT_MAX_BYTES));
447
- }
448
- const timestamp = options.lastTimestamp || "(unknown time)";
449
- const range = options.firstEntryId || options.lastEntryId ? `${options.firstEntryId || "(start)"} \u2192 ${options.lastEntryId || "(end)"}` : "(no entries)";
450
- const footer = options.summaryKind === "branch" ? `[branch summarized ${timestamp}; structural source entries ${range}]` : `[compacted ${timestamp}; cumulative source entries ${range}]`;
451
- blocks.push(boundedBlock("---", [footer, POINTER_LINE], FOOTER_MAX_BYTES));
452
- const summary = `${blocks.join("\n\n")}
453
- `;
454
- if (utf8Bytes(summary) <= MAX_SUMMARY_BYTES) return summary;
455
- return `${clipUtf8(summary, MAX_SUMMARY_BYTES - 1, "")}
456
- `;
457
- };
458
-
459
394
  export {
460
395
  MAX_COMPACTION_INSTRUCTIONS_CHARS,
461
396
  MAX_PRESERVE_ITEMS,
462
397
  MAX_PRESERVE_ITEM_CHARS,
463
398
  compactionRequestBoundsError,
464
399
  encodeCompactionRequest,
465
- decodeCompactionInstructions,
466
- LCM_RECOVERY_POINTER,
467
- renderSummary
400
+ decodeCompactionInstructions
468
401
  };
469
- //# sourceMappingURL=chunk-E4HNDTLM.js.map
402
+ //# sourceMappingURL=chunk-MZUWSNZX.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/compaction/instructions.ts", "../../src/compaction/render.ts"],
4
- "sourcesContent": ["import { canonicalizeText, utf8Bytes } from \"./bounds.js\";\n\nexport const FABRIC_COMPACTION_REQUEST_PREFIX = \"__omp_fabric_compact_request_v1__:\";\nexport const MAX_COMPACTION_INSTRUCTIONS_CHARS = 8 * 1024;\nconst MAX_COMPACTION_INSTRUCTIONS_BYTES = 8 * 1024;\nexport const MAX_PRESERVE_ITEMS = 16;\nexport const MAX_PRESERVE_ITEM_CHARS = 2 * 1024;\nconst MAX_PRESERVE_ITEM_BYTES = 2 * 1024;\nexport const MAX_TYPED_COMPACTION_SOURCE_BYTES = 16 * 1024;\n\nexport interface TypedCompactionRequest {\n version: 1;\n instructions?: string;\n preserve?: string[];\n}\n\nexport interface CompactionInstructionPolicy {\n mode: \"none\" | \"plain\" | \"typed-v1\";\n canonicalized: boolean;\n sourceBytes: number;\n truncated: boolean;\n preserveCount: number;\n omittedPreserveCount: number;\n}\n\ntype CompactionInstructionErrorCode =\n | \"encoded-source-too-large\"\n | \"malformed-json\"\n | \"duplicate-field\"\n | \"invalid-unicode\"\n | \"structure-too-complex\"\n | \"invalid-object\"\n | \"unknown-field\"\n | \"unsupported-version\"\n | \"invalid-type\"\n | \"instructions-too-large\"\n | \"preserve-too-many\"\n | \"preserve-item-too-large\";\n\nexport interface CompactionInstructionDecodeError {\n code: CompactionInstructionErrorCode;\n message: string;\n sourceBytes: number;\n}\n\nexport type DecodedCompactionInstructions =\n | {\n ok: true;\n requestLines: string[];\n policy: CompactionInstructionPolicy;\n }\n | {\n ok: false;\n requestLines: [];\n error: CompactionInstructionDecodeError;\n };\n\nconst rejection = (\n code: CompactionInstructionErrorCode,\n message: string,\n sourceBytes: number,\n): DecodedCompactionInstructions => ({\n ok: false,\n requestLines: [],\n error: { code, message, sourceBytes },\n});\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n value !== null && typeof value === \"object\" && !Array.isArray(value);\n\nconst hasPairedSurrogates = (value: string): boolean => {\n for (let index = 0; index < value.length; index++) {\n const unit = value.charCodeAt(index);\n if (unit >= 0xd800 && unit <= 0xdbff) {\n const next = value.charCodeAt(index + 1);\n if (!(next >= 0xdc00 && next <= 0xdfff)) return false;\n index += 1;\n } else if (unit >= 0xdc00 && unit <= 0xdfff) {\n return false;\n }\n }\n return true;\n};\n\nexport const compactionRequestBoundsError = (\n request: Omit<TypedCompactionRequest, \"version\">,\n): Omit<CompactionInstructionDecodeError, \"sourceBytes\"> | undefined => {\n if (request.instructions !== undefined) {\n if (!hasPairedSurrogates(request.instructions)) {\n return {\n code: \"invalid-unicode\",\n message: \"typed compaction instructions contain an unpaired UTF-16 surrogate\",\n };\n }\n if (request.instructions.length > MAX_COMPACTION_INSTRUCTIONS_CHARS\n || utf8Bytes(request.instructions) > MAX_COMPACTION_INSTRUCTIONS_BYTES) {\n return {\n code: \"instructions-too-large\",\n message: `typed compaction instructions exceed ${MAX_COMPACTION_INSTRUCTIONS_CHARS} characters or ${MAX_COMPACTION_INSTRUCTIONS_BYTES} UTF-8 bytes`,\n };\n }\n }\n if (request.preserve !== undefined) {\n if (request.preserve.length > MAX_PRESERVE_ITEMS) {\n return {\n code: \"preserve-too-many\",\n message: `typed compaction preserve exceeds ${MAX_PRESERVE_ITEMS} items`,\n };\n }\n for (const item of request.preserve) {\n if (!hasPairedSurrogates(item)) {\n return {\n code: \"invalid-unicode\",\n message: \"typed compaction preserve item contains an unpaired UTF-16 surrogate\",\n };\n }\n if (item.length > MAX_PRESERVE_ITEM_CHARS || utf8Bytes(item) > MAX_PRESERVE_ITEM_BYTES) {\n return {\n code: \"preserve-item-too-large\",\n message: `typed compaction preserve item exceeds ${MAX_PRESERVE_ITEM_CHARS} characters or ${MAX_PRESERVE_ITEM_BYTES} UTF-8 bytes`,\n };\n }\n }\n }\n return undefined;\n};\n\nexport const encodeCompactionRequest = (request: Omit<TypedCompactionRequest, \"version\">): string => {\n const boundsError = compactionRequestBoundsError(request);\n if (boundsError) throw new Error(boundsError.message);\n const payload: TypedCompactionRequest = {\n version: 1,\n ...(request.instructions !== undefined ? { instructions: request.instructions } : {}),\n ...(request.preserve !== undefined ? { preserve: request.preserve } : {}),\n };\n const encoded = `${FABRIC_COMPACTION_REQUEST_PREFIX}${JSON.stringify(payload)}`;\n if (utf8Bytes(encoded) > MAX_TYPED_COMPACTION_SOURCE_BYTES) {\n throw new Error(`typed compaction request exceeds ${MAX_TYPED_COMPACTION_SOURCE_BYTES} encoded UTF-8 bytes`);\n }\n return encoded;\n};\n\nconst plainInstructions = (source: string): DecodedCompactionInstructions => {\n const canonical = canonicalizeText(source);\n return {\n ok: true,\n requestLines: canonical.text ? [canonical.text] : [],\n policy: {\n mode: \"plain\",\n canonicalized: canonical.text !== source,\n sourceBytes: canonical.sourceBytes,\n truncated: canonical.truncated,\n preserveCount: 0,\n omittedPreserveCount: 0,\n },\n };\n};\n\nclass StrictJsonError extends Error {\n constructor(\n readonly code: \"malformed-json\" | \"duplicate-field\" | \"invalid-unicode\" | \"structure-too-complex\",\n message: string,\n ) {\n super(message);\n }\n}\n\nconst MAX_TYPED_JSON_DEPTH = 32;\nconst MAX_TYPED_JSON_NODES = 4096;\n\nclass StrictJsonParser {\n private index = 0;\n private nodes = 0;\n\n constructor(private readonly source: string) {}\n\n parse(): unknown {\n this.skipWhitespace();\n const value = this.parseValue(0);\n this.skipWhitespace();\n if (this.index !== this.source.length) this.malformed();\n return value;\n }\n\n private parseValue(depth: number): unknown {\n if (depth > MAX_TYPED_JSON_DEPTH) {\n throw new StrictJsonError(\"structure-too-complex\", \"typed compaction JSON exceeds the structural depth limit\");\n }\n this.nodes += 1;\n if (this.nodes > MAX_TYPED_JSON_NODES) {\n throw new StrictJsonError(\"structure-too-complex\", \"typed compaction JSON exceeds the structural node limit\");\n }\n const character = this.source[this.index];\n if (character === \"{\") return this.parseObject(depth + 1);\n if (character === \"[\") return this.parseArray(depth + 1);\n if (character === \"\\\"\") return this.parseString();\n if (character === \"t\") return this.parseLiteral(\"true\", true);\n if (character === \"f\") return this.parseLiteral(\"false\", false);\n if (character === \"n\") return this.parseLiteral(\"null\", null);\n if (character === \"-\" || (character !== undefined && character >= \"0\" && character <= \"9\")) {\n return this.parseNumber();\n }\n return this.malformed();\n }\n\n private parseObject(depth: number): Record<string, unknown> {\n this.index += 1;\n this.skipWhitespace();\n const output = Object.create(null) as Record<string, unknown>;\n const keys = new Set<string>();\n if (this.source[this.index] === \"}\") {\n this.index += 1;\n return output;\n }\n while (this.index < this.source.length) {\n if (this.source[this.index] !== \"\\\"\") this.malformed();\n const key = this.parseString();\n if (keys.has(key)) {\n throw new StrictJsonError(\"duplicate-field\", `typed compaction request contains duplicate field ${JSON.stringify(key)}`);\n }\n keys.add(key);\n this.skipWhitespace();\n if (this.source[this.index] !== \":\") this.malformed();\n this.index += 1;\n this.skipWhitespace();\n output[key] = this.parseValue(depth);\n this.skipWhitespace();\n const delimiter = this.source[this.index];\n if (delimiter === \"}\") {\n this.index += 1;\n return output;\n }\n if (delimiter !== \",\") this.malformed();\n this.index += 1;\n this.skipWhitespace();\n }\n return this.malformed();\n }\n\n private parseArray(depth: number): unknown[] {\n this.index += 1;\n this.skipWhitespace();\n const output: unknown[] = [];\n if (this.source[this.index] === \"]\") {\n this.index += 1;\n return output;\n }\n while (this.index < this.source.length) {\n output.push(this.parseValue(depth));\n this.skipWhitespace();\n const delimiter = this.source[this.index];\n if (delimiter === \"]\") {\n this.index += 1;\n return output;\n }\n if (delimiter !== \",\") this.malformed();\n this.index += 1;\n this.skipWhitespace();\n }\n return this.malformed();\n }\n\n private parseString(): string {\n this.index += 1;\n let output = \"\";\n while (this.index < this.source.length) {\n const unit = this.source.charCodeAt(this.index);\n if (unit === 0x22) {\n this.index += 1;\n if (!hasPairedSurrogates(output)) {\n throw new StrictJsonError(\"invalid-unicode\", \"typed compaction JSON string contains an unpaired UTF-16 surrogate\");\n }\n return output;\n }\n if (unit <= 0x1f) this.malformed();\n if (unit !== 0x5c) {\n output += this.source[this.index]!;\n this.index += 1;\n continue;\n }\n this.index += 1;\n const escape = this.source[this.index];\n this.index += 1;\n if (escape === \"\\\"\" || escape === \"\\\\\" || escape === \"/\") output += escape;\n else if (escape === \"b\") output += \"\\b\";\n else if (escape === \"f\") output += \"\\f\";\n else if (escape === \"n\") output += \"\\n\";\n else if (escape === \"r\") output += \"\\r\";\n else if (escape === \"t\") output += \"\\t\";\n else if (escape === \"u\") {\n let value = 0;\n for (let offset = 0; offset < 4; offset++) {\n const digit = this.hexValue(this.source.charCodeAt(this.index + offset));\n if (digit < 0) this.malformed();\n value = value * 16 + digit;\n }\n this.index += 4;\n output += String.fromCharCode(value);\n } else {\n this.malformed();\n }\n }\n return this.malformed();\n }\n\n private parseNumber(): number {\n const start = this.index;\n if (this.source[this.index] === \"-\") this.index += 1;\n if (this.source[this.index] === \"0\") {\n this.index += 1;\n if (this.isDigit(this.source.charCodeAt(this.index))) this.malformed();\n } else {\n if (!this.isDigitOneToNine(this.source.charCodeAt(this.index))) this.malformed();\n while (this.isDigit(this.source.charCodeAt(this.index))) this.index += 1;\n }\n if (this.source[this.index] === \".\") {\n this.index += 1;\n if (!this.isDigit(this.source.charCodeAt(this.index))) this.malformed();\n while (this.isDigit(this.source.charCodeAt(this.index))) this.index += 1;\n }\n const exponent = this.source[this.index];\n if (exponent === \"e\" || exponent === \"E\") {\n this.index += 1;\n const sign = this.source[this.index];\n if (sign === \"+\" || sign === \"-\") this.index += 1;\n if (!this.isDigit(this.source.charCodeAt(this.index))) this.malformed();\n while (this.isDigit(this.source.charCodeAt(this.index))) this.index += 1;\n }\n const value = Number(this.source.slice(start, this.index));\n if (!Number.isFinite(value)) this.malformed();\n return value;\n }\n\n private parseLiteral<T>(literal: string, value: T): T {\n if (!this.source.startsWith(literal, this.index)) this.malformed();\n this.index += literal.length;\n return value;\n }\n\n private skipWhitespace(): void {\n while (this.index < this.source.length) {\n const unit = this.source.charCodeAt(this.index);\n if (unit !== 0x20 && unit !== 0x09 && unit !== 0x0a && unit !== 0x0d) return;\n this.index += 1;\n }\n }\n\n private hexValue(unit: number): number {\n if (unit >= 0x30 && unit <= 0x39) return unit - 0x30;\n if (unit >= 0x41 && unit <= 0x46) return unit - 0x41 + 10;\n if (unit >= 0x61 && unit <= 0x66) return unit - 0x61 + 10;\n return -1;\n }\n\n private isDigit(unit: number): boolean {\n return unit >= 0x30 && unit <= 0x39;\n }\n\n private isDigitOneToNine(unit: number): boolean {\n return unit >= 0x31 && unit <= 0x39;\n }\n\n private malformed(): never {\n throw new StrictJsonError(\"malformed-json\", \"typed compaction request contains malformed JSON\");\n }\n}\n\nexport const decodeCompactionInstructions = (\n source: string | undefined,\n): DecodedCompactionInstructions => {\n if (source === undefined || source === \"\") {\n return {\n ok: true,\n requestLines: [],\n policy: {\n mode: \"none\",\n canonicalized: false,\n sourceBytes: 0,\n truncated: false,\n preserveCount: 0,\n omittedPreserveCount: 0,\n },\n };\n }\n if (!source.startsWith(FABRIC_COMPACTION_REQUEST_PREFIX)) return plainInstructions(source);\n\n const encodedSourceBytes = utf8Bytes(source);\n if (encodedSourceBytes > MAX_TYPED_COMPACTION_SOURCE_BYTES) {\n return rejection(\n \"encoded-source-too-large\",\n `typed compaction request exceeds ${MAX_TYPED_COMPACTION_SOURCE_BYTES} encoded UTF-8 bytes`,\n encodedSourceBytes,\n );\n }\n\n let parsed: unknown;\n try {\n parsed = new StrictJsonParser(source.slice(FABRIC_COMPACTION_REQUEST_PREFIX.length)).parse();\n } catch (error) {\n if (error instanceof StrictJsonError) {\n return rejection(error.code, error.message, encodedSourceBytes);\n }\n return rejection(\"malformed-json\", \"typed compaction request contains malformed JSON\", encodedSourceBytes);\n }\n if (!isRecord(parsed)) {\n return rejection(\"invalid-object\", \"typed compaction request must be a JSON object\", encodedSourceBytes);\n }\n\n const keys = Object.keys(parsed);\n const unknownField = keys.find((key) => key !== \"version\" && key !== \"instructions\" && key !== \"preserve\");\n if (unknownField !== undefined) {\n return rejection(\"unknown-field\", `typed compaction request contains unknown field ${JSON.stringify(unknownField)}`, encodedSourceBytes);\n }\n if (parsed.version !== 1) {\n return rejection(\"unsupported-version\", \"typed compaction request version must be 1\", encodedSourceBytes);\n }\n if (parsed.instructions !== undefined && typeof parsed.instructions !== \"string\") {\n return rejection(\"invalid-type\", \"typed compaction request instructions must be a string\", encodedSourceBytes);\n }\n if (parsed.preserve !== undefined && !Array.isArray(parsed.preserve)) {\n return rejection(\"invalid-type\", \"typed compaction request preserve must be an array\", encodedSourceBytes);\n }\n\n const preserve = parsed.preserve as unknown[] | undefined;\n if (preserve !== undefined && preserve.length > MAX_PRESERVE_ITEMS) {\n return rejection(\n \"preserve-too-many\",\n `typed compaction preserve exceeds ${MAX_PRESERVE_ITEMS} items`,\n encodedSourceBytes,\n );\n }\n if (preserve !== undefined && !preserve.every((item) => typeof item === \"string\")) {\n return rejection(\"invalid-type\", \"typed compaction preserve items must be strings\", encodedSourceBytes);\n }\n\n const request: Omit<TypedCompactionRequest, \"version\"> = {\n ...(parsed.instructions !== undefined ? { instructions: parsed.instructions } : {}),\n ...(preserve !== undefined ? { preserve: preserve as string[] } : {}),\n };\n const boundsError = compactionRequestBoundsError(request);\n if (boundsError) return rejection(boundsError.code, boundsError.message, encodedSourceBytes);\n\n const requestLines: string[] = [];\n let valueSourceBytes = 0;\n let truncated = false;\n let canonicalized = false;\n if (request.instructions !== undefined) {\n const instructions = canonicalizeText(request.instructions, MAX_COMPACTION_INSTRUCTIONS_BYTES);\n valueSourceBytes += instructions.sourceBytes;\n truncated ||= instructions.truncated;\n canonicalized ||= instructions.text !== request.instructions;\n if (instructions.text) requestLines.push(instructions.text);\n }\n\n for (let index = 0; index < (request.preserve?.length ?? 0); index++) {\n const sourceItem = request.preserve![index]!;\n const item = canonicalizeText(sourceItem, MAX_PRESERVE_ITEM_BYTES);\n valueSourceBytes += item.sourceBytes;\n truncated ||= item.truncated;\n canonicalized ||= item.text !== sourceItem;\n if (item.text) requestLines.push(`- ${item.text} [preserve:${index}]`);\n }\n\n return {\n ok: true,\n requestLines,\n policy: {\n mode: \"typed-v1\",\n canonicalized,\n sourceBytes: valueSourceBytes,\n truncated,\n preserveCount: request.preserve?.length ?? 0,\n omittedPreserveCount: 0,\n },\n };\n};\n", "import { clipUtf8, MAX_SUMMARY_BYTES, utf8Bytes } from \"./bounds.js\";\nimport type { Sections } from \"./projections.js\";\n\nconst SECTION_ORDER: { key: keyof Sections; header: string; maxBytes: number }[] = [\n { key: \"goal\", header: \"[Session Goal]\", maxBytes: 4096 },\n { key: \"files\", header: \"[Files And Changes]\", maxBytes: 4608 },\n { key: \"activity\", header: \"[Fabric Activity]\", maxBytes: 2048 },\n { key: \"outstanding\", header: \"[Outstanding Context]\", maxBytes: 4608 },\n { key: \"earlierTurns\", header: \"[Earlier Turns]\", maxBytes: 3072 },\n { key: \"status\", header: \"[Current Status]\", maxBytes: 2048 },\n];\n\nconst REQUEST_MAX_BYTES = 3072;\nconst TRANSCRIPT_MAX_BYTES = 5120;\nconst FOOTER_MAX_BYTES = 1536;\nconst MAX_INPUT_LINES_PER_SECTION = 128;\nconst MAX_RENDERED_LINE_BYTES = 1024;\n\nexport interface RenderOptions {\n firstEntryId: string;\n lastEntryId: string;\n lastTimestamp: string;\n requestLines?: string[];\n summaryKind?: \"compaction\" | \"branch\";\n}\n\nexport const LCM_RECOVERY_POINTER =\n \"For exact pre-summary history, use memory.recall on this range, then memory.expand by stable entry or operation address.\";\nconst POINTER_LINE = LCM_RECOVERY_POINTER;\n\nconst sampledLines = (lines: readonly string[], keep: number): string[] => {\n if (lines.length <= keep) return [...lines];\n const earliest = Math.ceil(keep / 2);\n const latest = Math.floor(keep / 2);\n return [\n ...lines.slice(0, earliest),\n `\u2026 omitted ${lines.length - keep} rendered lines`,\n ...lines.slice(lines.length - latest),\n ];\n};\n\nconst boundedBlock = (header: string, sourceLines: readonly string[], maxBytes: number): string => {\n const clipped = sourceLines.map((line) => clipUtf8(line, MAX_RENDERED_LINE_BYTES));\n const capped = sampledLines(clipped, Math.min(clipped.length, MAX_INPUT_LINES_PER_SECTION));\n for (let keep = capped.length; keep >= 0; keep--) {\n const lines = sampledLines(capped, keep);\n const block = [header, ...lines].join(\"\\n\");\n if (utf8Bytes(block) <= maxBytes) return block;\n }\n return clipUtf8(header, maxBytes);\n};\n\nexport const renderSummary = (sections: Sections, options: RenderOptions): string => {\n const blocks: string[] = [];\n for (const { key, header, maxBytes } of SECTION_ORDER) {\n const lines = sections[key];\n if (lines.length === 0) continue;\n blocks.push(boundedBlock(header, lines, maxBytes));\n if (key === \"goal\" && options.requestLines && options.requestLines.length > 0) {\n blocks.push(boundedBlock(\"[Compaction Request]\", options.requestLines, REQUEST_MAX_BYTES));\n }\n }\n if (sections.goal.length === 0 && options.requestLines && options.requestLines.length > 0) {\n blocks.unshift(boundedBlock(\"[Compaction Request]\", options.requestLines, REQUEST_MAX_BYTES));\n }\n\n if (sections.transcript.length > 0) {\n blocks.push(boundedBlock(\"---\", sections.transcript, TRANSCRIPT_MAX_BYTES));\n }\n\n const timestamp = options.lastTimestamp || \"(unknown time)\";\n const range = options.firstEntryId || options.lastEntryId\n ? `${options.firstEntryId || \"(start)\"} \u2192 ${options.lastEntryId || \"(end)\"}`\n : \"(no entries)\";\n const footer = options.summaryKind === \"branch\"\n ? `[branch summarized ${timestamp}; structural source entries ${range}]`\n : `[compacted ${timestamp}; cumulative source entries ${range}]`;\n blocks.push(boundedBlock(\"---\", [footer, POINTER_LINE], FOOTER_MAX_BYTES));\n\n const summary = `${blocks.join(\"\\n\\n\")}\\n`;\n if (utf8Bytes(summary) <= MAX_SUMMARY_BYTES) return summary;\n return `${clipUtf8(summary, MAX_SUMMARY_BYTES - 1, \"\")}\\n`;\n};\n"],
5
- "mappings": ";;;;;;;;AAEO,IAAM,mCAAmC;AACzC,IAAM,oCAAoC,IAAI;AACrD,IAAM,oCAAoC,IAAI;AACvC,IAAM,qBAAqB;AAC3B,IAAM,0BAA0B,IAAI;AAC3C,IAAM,0BAA0B,IAAI;AAC7B,IAAM,oCAAoC,KAAK;AAiDtD,IAAM,YAAY,CAChB,MACA,SACA,iBACmC;AAAA,EACnC,IAAI;AAAA,EACJ,cAAc,CAAC;AAAA,EACf,OAAO,EAAE,MAAM,SAAS,YAAY;AACtC;AAEA,IAAM,WAAW,CAAC,UAChB,UAAU,QAAQ,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK;AAErE,IAAM,sBAAsB,CAAC,UAA2B;AACtD,WAAS,QAAQ,GAAG,QAAQ,MAAM,QAAQ,SAAS;AACjD,UAAM,OAAO,MAAM,WAAW,KAAK;AACnC,QAAI,QAAQ,SAAU,QAAQ,OAAQ;AACpC,YAAM,OAAO,MAAM,WAAW,QAAQ,CAAC;AACvC,UAAI,EAAE,QAAQ,SAAU,QAAQ,OAAS,QAAO;AAChD,eAAS;AAAA,IACX,WAAW,QAAQ,SAAU,QAAQ,OAAQ;AAC3C,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAEO,IAAM,+BAA+B,CAC1C,YACsE;AACtE,MAAI,QAAQ,iBAAiB,QAA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C;AAAA;AACtC,MAAI,UAAU,OAAO,KAAK,kBAAmB,QAAO;AACpD,SAAO,GAAG,SAAS,SAAS,oBAAoB,GAAG,EAAE,CAAC;AAAA;AACxD;",
3
+ "sources": ["../../src/compaction/instructions.ts"],
4
+ "sourcesContent": ["import { canonicalizeText, utf8Bytes } from \"./bounds.js\";\n\nexport const FABRIC_COMPACTION_REQUEST_PREFIX = \"__omp_fabric_compact_request_v1__:\";\nexport const MAX_COMPACTION_INSTRUCTIONS_CHARS = 8 * 1024;\nconst MAX_COMPACTION_INSTRUCTIONS_BYTES = 8 * 1024;\nexport const MAX_PRESERVE_ITEMS = 16;\nexport const MAX_PRESERVE_ITEM_CHARS = 2 * 1024;\nconst MAX_PRESERVE_ITEM_BYTES = 2 * 1024;\nexport const MAX_TYPED_COMPACTION_SOURCE_BYTES = 16 * 1024;\n\nexport interface TypedCompactionRequest {\n version: 1;\n instructions?: string;\n preserve?: string[];\n}\n\nexport interface CompactionInstructionPolicy {\n mode: \"none\" | \"plain\" | \"typed-v1\";\n canonicalized: boolean;\n sourceBytes: number;\n truncated: boolean;\n preserveCount: number;\n omittedPreserveCount: number;\n}\n\ntype CompactionInstructionErrorCode =\n | \"encoded-source-too-large\"\n | \"malformed-json\"\n | \"duplicate-field\"\n | \"invalid-unicode\"\n | \"structure-too-complex\"\n | \"invalid-object\"\n | \"unknown-field\"\n | \"unsupported-version\"\n | \"invalid-type\"\n | \"instructions-too-large\"\n | \"preserve-too-many\"\n | \"preserve-item-too-large\";\n\nexport interface CompactionInstructionDecodeError {\n code: CompactionInstructionErrorCode;\n message: string;\n sourceBytes: number;\n}\n\nexport type DecodedCompactionInstructions =\n | {\n ok: true;\n requestLines: string[];\n policy: CompactionInstructionPolicy;\n }\n | {\n ok: false;\n requestLines: [];\n error: CompactionInstructionDecodeError;\n };\n\nconst rejection = (\n code: CompactionInstructionErrorCode,\n message: string,\n sourceBytes: number,\n): DecodedCompactionInstructions => ({\n ok: false,\n requestLines: [],\n error: { code, message, sourceBytes },\n});\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n value !== null && typeof value === \"object\" && !Array.isArray(value);\n\nconst hasPairedSurrogates = (value: string): boolean => {\n for (let index = 0; index < value.length; index++) {\n const unit = value.charCodeAt(index);\n if (unit >= 0xd800 && unit <= 0xdbff) {\n const next = value.charCodeAt(index + 1);\n if (!(next >= 0xdc00 && next <= 0xdfff)) return false;\n index += 1;\n } else if (unit >= 0xdc00 && unit <= 0xdfff) {\n return false;\n }\n }\n return true;\n};\n\nexport const compactionRequestBoundsError = (\n request: Omit<TypedCompactionRequest, \"version\">,\n): Omit<CompactionInstructionDecodeError, \"sourceBytes\"> | undefined => {\n if (request.instructions !== undefined) {\n if (!hasPairedSurrogates(request.instructions)) {\n return {\n code: \"invalid-unicode\",\n message: \"typed compaction instructions contain an unpaired UTF-16 surrogate\",\n };\n }\n if (request.instructions.length > MAX_COMPACTION_INSTRUCTIONS_CHARS\n || utf8Bytes(request.instructions) > MAX_COMPACTION_INSTRUCTIONS_BYTES) {\n return {\n code: \"instructions-too-large\",\n message: `typed compaction instructions exceed ${MAX_COMPACTION_INSTRUCTIONS_CHARS} characters or ${MAX_COMPACTION_INSTRUCTIONS_BYTES} UTF-8 bytes`,\n };\n }\n }\n if (request.preserve !== undefined) {\n if (request.preserve.length > MAX_PRESERVE_ITEMS) {\n return {\n code: \"preserve-too-many\",\n message: `typed compaction preserve exceeds ${MAX_PRESERVE_ITEMS} items`,\n };\n }\n for (const item of request.preserve) {\n if (!hasPairedSurrogates(item)) {\n return {\n code: \"invalid-unicode\",\n message: \"typed compaction preserve item contains an unpaired UTF-16 surrogate\",\n };\n }\n if (item.length > MAX_PRESERVE_ITEM_CHARS || utf8Bytes(item) > MAX_PRESERVE_ITEM_BYTES) {\n return {\n code: \"preserve-item-too-large\",\n message: `typed compaction preserve item exceeds ${MAX_PRESERVE_ITEM_CHARS} characters or ${MAX_PRESERVE_ITEM_BYTES} UTF-8 bytes`,\n };\n }\n }\n }\n return undefined;\n};\n\nexport const encodeCompactionRequest = (request: Omit<TypedCompactionRequest, \"version\">): string => {\n const boundsError = compactionRequestBoundsError(request);\n if (boundsError) throw new Error(boundsError.message);\n const payload: TypedCompactionRequest = {\n version: 1,\n ...(request.instructions !== undefined ? { instructions: request.instructions } : {}),\n ...(request.preserve !== undefined ? { preserve: request.preserve } : {}),\n };\n const encoded = `${FABRIC_COMPACTION_REQUEST_PREFIX}${JSON.stringify(payload)}`;\n if (utf8Bytes(encoded) > MAX_TYPED_COMPACTION_SOURCE_BYTES) {\n throw new Error(`typed compaction request exceeds ${MAX_TYPED_COMPACTION_SOURCE_BYTES} encoded UTF-8 bytes`);\n }\n return encoded;\n};\n\nconst plainInstructions = (source: string): DecodedCompactionInstructions => {\n const canonical = canonicalizeText(source);\n return {\n ok: true,\n requestLines: canonical.text ? [canonical.text] : [],\n policy: {\n mode: \"plain\",\n canonicalized: canonical.text !== source,\n sourceBytes: canonical.sourceBytes,\n truncated: canonical.truncated,\n preserveCount: 0,\n omittedPreserveCount: 0,\n },\n };\n};\n\nclass StrictJsonError extends Error {\n constructor(\n readonly code: \"malformed-json\" | \"duplicate-field\" | \"invalid-unicode\" | \"structure-too-complex\",\n message: string,\n ) {\n super(message);\n }\n}\n\nconst MAX_TYPED_JSON_DEPTH = 32;\nconst MAX_TYPED_JSON_NODES = 4096;\n\nclass StrictJsonParser {\n private index = 0;\n private nodes = 0;\n\n constructor(private readonly source: string) {}\n\n parse(): unknown {\n this.skipWhitespace();\n const value = this.parseValue(0);\n this.skipWhitespace();\n if (this.index !== this.source.length) this.malformed();\n return value;\n }\n\n private parseValue(depth: number): unknown {\n if (depth > MAX_TYPED_JSON_DEPTH) {\n throw new StrictJsonError(\"structure-too-complex\", \"typed compaction JSON exceeds the structural depth limit\");\n }\n this.nodes += 1;\n if (this.nodes > MAX_TYPED_JSON_NODES) {\n throw new StrictJsonError(\"structure-too-complex\", \"typed compaction JSON exceeds the structural node limit\");\n }\n const character = this.source[this.index];\n if (character === \"{\") return this.parseObject(depth + 1);\n if (character === \"[\") return this.parseArray(depth + 1);\n if (character === \"\\\"\") return this.parseString();\n if (character === \"t\") return this.parseLiteral(\"true\", true);\n if (character === \"f\") return this.parseLiteral(\"false\", false);\n if (character === \"n\") return this.parseLiteral(\"null\", null);\n if (character === \"-\" || (character !== undefined && character >= \"0\" && character <= \"9\")) {\n return this.parseNumber();\n }\n return this.malformed();\n }\n\n private parseObject(depth: number): Record<string, unknown> {\n this.index += 1;\n this.skipWhitespace();\n const output = Object.create(null) as Record<string, unknown>;\n const keys = new Set<string>();\n if (this.source[this.index] === \"}\") {\n this.index += 1;\n return output;\n }\n while (this.index < this.source.length) {\n if (this.source[this.index] !== \"\\\"\") this.malformed();\n const key = this.parseString();\n if (keys.has(key)) {\n throw new StrictJsonError(\"duplicate-field\", `typed compaction request contains duplicate field ${JSON.stringify(key)}`);\n }\n keys.add(key);\n this.skipWhitespace();\n if (this.source[this.index] !== \":\") this.malformed();\n this.index += 1;\n this.skipWhitespace();\n output[key] = this.parseValue(depth);\n this.skipWhitespace();\n const delimiter = this.source[this.index];\n if (delimiter === \"}\") {\n this.index += 1;\n return output;\n }\n if (delimiter !== \",\") this.malformed();\n this.index += 1;\n this.skipWhitespace();\n }\n return this.malformed();\n }\n\n private parseArray(depth: number): unknown[] {\n this.index += 1;\n this.skipWhitespace();\n const output: unknown[] = [];\n if (this.source[this.index] === \"]\") {\n this.index += 1;\n return output;\n }\n while (this.index < this.source.length) {\n output.push(this.parseValue(depth));\n this.skipWhitespace();\n const delimiter = this.source[this.index];\n if (delimiter === \"]\") {\n this.index += 1;\n return output;\n }\n if (delimiter !== \",\") this.malformed();\n this.index += 1;\n this.skipWhitespace();\n }\n return this.malformed();\n }\n\n private parseString(): string {\n this.index += 1;\n let output = \"\";\n while (this.index < this.source.length) {\n const unit = this.source.charCodeAt(this.index);\n if (unit === 0x22) {\n this.index += 1;\n if (!hasPairedSurrogates(output)) {\n throw new StrictJsonError(\"invalid-unicode\", \"typed compaction JSON string contains an unpaired UTF-16 surrogate\");\n }\n return output;\n }\n if (unit <= 0x1f) this.malformed();\n if (unit !== 0x5c) {\n output += this.source[this.index]!;\n this.index += 1;\n continue;\n }\n this.index += 1;\n const escape = this.source[this.index];\n this.index += 1;\n if (escape === \"\\\"\" || escape === \"\\\\\" || escape === \"/\") output += escape;\n else if (escape === \"b\") output += \"\\b\";\n else if (escape === \"f\") output += \"\\f\";\n else if (escape === \"n\") output += \"\\n\";\n else if (escape === \"r\") output += \"\\r\";\n else if (escape === \"t\") output += \"\\t\";\n else if (escape === \"u\") {\n let value = 0;\n for (let offset = 0; offset < 4; offset++) {\n const digit = this.hexValue(this.source.charCodeAt(this.index + offset));\n if (digit < 0) this.malformed();\n value = value * 16 + digit;\n }\n this.index += 4;\n output += String.fromCharCode(value);\n } else {\n this.malformed();\n }\n }\n return this.malformed();\n }\n\n private parseNumber(): number {\n const start = this.index;\n if (this.source[this.index] === \"-\") this.index += 1;\n if (this.source[this.index] === \"0\") {\n this.index += 1;\n if (this.isDigit(this.source.charCodeAt(this.index))) this.malformed();\n } else {\n if (!this.isDigitOneToNine(this.source.charCodeAt(this.index))) this.malformed();\n while (this.isDigit(this.source.charCodeAt(this.index))) this.index += 1;\n }\n if (this.source[this.index] === \".\") {\n this.index += 1;\n if (!this.isDigit(this.source.charCodeAt(this.index))) this.malformed();\n while (this.isDigit(this.source.charCodeAt(this.index))) this.index += 1;\n }\n const exponent = this.source[this.index];\n if (exponent === \"e\" || exponent === \"E\") {\n this.index += 1;\n const sign = this.source[this.index];\n if (sign === \"+\" || sign === \"-\") this.index += 1;\n if (!this.isDigit(this.source.charCodeAt(this.index))) this.malformed();\n while (this.isDigit(this.source.charCodeAt(this.index))) this.index += 1;\n }\n const value = Number(this.source.slice(start, this.index));\n if (!Number.isFinite(value)) this.malformed();\n return value;\n }\n\n private parseLiteral<T>(literal: string, value: T): T {\n if (!this.source.startsWith(literal, this.index)) this.malformed();\n this.index += literal.length;\n return value;\n }\n\n private skipWhitespace(): void {\n while (this.index < this.source.length) {\n const unit = this.source.charCodeAt(this.index);\n if (unit !== 0x20 && unit !== 0x09 && unit !== 0x0a && unit !== 0x0d) return;\n this.index += 1;\n }\n }\n\n private hexValue(unit: number): number {\n if (unit >= 0x30 && unit <= 0x39) return unit - 0x30;\n if (unit >= 0x41 && unit <= 0x46) return unit - 0x41 + 10;\n if (unit >= 0x61 && unit <= 0x66) return unit - 0x61 + 10;\n return -1;\n }\n\n private isDigit(unit: number): boolean {\n return unit >= 0x30 && unit <= 0x39;\n }\n\n private isDigitOneToNine(unit: number): boolean {\n return unit >= 0x31 && unit <= 0x39;\n }\n\n private malformed(): never {\n throw new StrictJsonError(\"malformed-json\", \"typed compaction request contains malformed JSON\");\n }\n}\n\nexport const decodeCompactionInstructions = (\n source: string | undefined,\n): DecodedCompactionInstructions => {\n if (source === undefined || source === \"\") {\n return {\n ok: true,\n requestLines: [],\n policy: {\n mode: \"none\",\n canonicalized: false,\n sourceBytes: 0,\n truncated: false,\n preserveCount: 0,\n omittedPreserveCount: 0,\n },\n };\n }\n if (!source.startsWith(FABRIC_COMPACTION_REQUEST_PREFIX)) return plainInstructions(source);\n\n const encodedSourceBytes = utf8Bytes(source);\n if (encodedSourceBytes > MAX_TYPED_COMPACTION_SOURCE_BYTES) {\n return rejection(\n \"encoded-source-too-large\",\n `typed compaction request exceeds ${MAX_TYPED_COMPACTION_SOURCE_BYTES} encoded UTF-8 bytes`,\n encodedSourceBytes,\n );\n }\n\n let parsed: unknown;\n try {\n parsed = new StrictJsonParser(source.slice(FABRIC_COMPACTION_REQUEST_PREFIX.length)).parse();\n } catch (error) {\n if (error instanceof StrictJsonError) {\n return rejection(error.code, error.message, encodedSourceBytes);\n }\n return rejection(\"malformed-json\", \"typed compaction request contains malformed JSON\", encodedSourceBytes);\n }\n if (!isRecord(parsed)) {\n return rejection(\"invalid-object\", \"typed compaction request must be a JSON object\", encodedSourceBytes);\n }\n\n const keys = Object.keys(parsed);\n const unknownField = keys.find((key) => key !== \"version\" && key !== \"instructions\" && key !== \"preserve\");\n if (unknownField !== undefined) {\n return rejection(\"unknown-field\", `typed compaction request contains unknown field ${JSON.stringify(unknownField)}`, encodedSourceBytes);\n }\n if (parsed.version !== 1) {\n return rejection(\"unsupported-version\", \"typed compaction request version must be 1\", encodedSourceBytes);\n }\n if (parsed.instructions !== undefined && typeof parsed.instructions !== \"string\") {\n return rejection(\"invalid-type\", \"typed compaction request instructions must be a string\", encodedSourceBytes);\n }\n if (parsed.preserve !== undefined && !Array.isArray(parsed.preserve)) {\n return rejection(\"invalid-type\", \"typed compaction request preserve must be an array\", encodedSourceBytes);\n }\n\n const preserve = parsed.preserve as unknown[] | undefined;\n if (preserve !== undefined && preserve.length > MAX_PRESERVE_ITEMS) {\n return rejection(\n \"preserve-too-many\",\n `typed compaction preserve exceeds ${MAX_PRESERVE_ITEMS} items`,\n encodedSourceBytes,\n );\n }\n if (preserve !== undefined && !preserve.every((item) => typeof item === \"string\")) {\n return rejection(\"invalid-type\", \"typed compaction preserve items must be strings\", encodedSourceBytes);\n }\n\n const request: Omit<TypedCompactionRequest, \"version\"> = {\n ...(parsed.instructions !== undefined ? { instructions: parsed.instructions } : {}),\n ...(preserve !== undefined ? { preserve: preserve as string[] } : {}),\n };\n const boundsError = compactionRequestBoundsError(request);\n if (boundsError) return rejection(boundsError.code, boundsError.message, encodedSourceBytes);\n\n const requestLines: string[] = [];\n let valueSourceBytes = 0;\n let truncated = false;\n let canonicalized = false;\n if (request.instructions !== undefined) {\n const instructions = canonicalizeText(request.instructions, MAX_COMPACTION_INSTRUCTIONS_BYTES);\n valueSourceBytes += instructions.sourceBytes;\n truncated ||= instructions.truncated;\n canonicalized ||= instructions.text !== request.instructions;\n if (instructions.text) requestLines.push(instructions.text);\n }\n\n for (let index = 0; index < (request.preserve?.length ?? 0); index++) {\n const sourceItem = request.preserve![index]!;\n const item = canonicalizeText(sourceItem, MAX_PRESERVE_ITEM_BYTES);\n valueSourceBytes += item.sourceBytes;\n truncated ||= item.truncated;\n canonicalized ||= item.text !== sourceItem;\n if (item.text) requestLines.push(`- ${item.text} [preserve:${index}]`);\n }\n\n return {\n ok: true,\n requestLines,\n policy: {\n mode: \"typed-v1\",\n canonicalized,\n sourceBytes: valueSourceBytes,\n truncated,\n preserveCount: request.preserve?.length ?? 0,\n omittedPreserveCount: 0,\n },\n };\n};\n"],
5
+ "mappings": ";;;;;;AAEO,IAAM,mCAAmC;AACzC,IAAM,oCAAoC,IAAI;AACrD,IAAM,oCAAoC,IAAI;AACvC,IAAM,qBAAqB;AAC3B,IAAM,0BAA0B,IAAI;AAC3C,IAAM,0BAA0B,IAAI;AAC7B,IAAM,oCAAoC,KAAK;AAiDtD,IAAM,YAAY,CAChB,MACA,SACA,iBACmC;AAAA,EACnC,IAAI;AAAA,EACJ,cAAc,CAAC;AAAA,EACf,OAAO,EAAE,MAAM,SAAS,YAAY;AACtC;AAEA,IAAM,WAAW,CAAC,UAChB,UAAU,QAAQ,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK;AAErE,IAAM,sBAAsB,CAAC,UAA2B;AACtD,WAAS,QAAQ,GAAG,QAAQ,MAAM,QAAQ,SAAS;AACjD,UAAM,OAAO,MAAM,WAAW,KAAK;AACnC,QAAI,QAAQ,SAAU,QAAQ,OAAQ;AACpC,YAAM,OAAO,MAAM,WAAW,QAAQ,CAAC;AACvC,UAAI,EAAE,QAAQ,SAAU,QAAQ,OAAS,QAAO;AAChD,eAAS;AAAA,IACX,WAAW,QAAQ,SAAU,QAAQ,OAAQ;AAC3C,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAEO,IAAM,+BAA+B,CAC1C,YACsE;AACtE,MAAI,QAAQ,iBAAiB,QAAW;AACtC,QAAI,CAAC,oBAAoB,QAAQ,YAAY,GAAG;AAC9C,aAAO;AAAA,QACL,MAAM;AAAA,QACN,SAAS;AAAA,MACX;AAAA,IACF;AACA,QAAI,QAA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3C,sBAAsB;AAAA,IACxB;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,74 @@
1
+ import {
2
+ MAX_SUMMARY_BYTES,
3
+ clipUtf8,
4
+ utf8Bytes
5
+ } from "./chunk-3XPR2AZL.js";
6
+
7
+ // src/compaction/render.ts
8
+ var SECTION_ORDER = [
9
+ { key: "goal", header: "[Session Goal]", maxBytes: 4096 },
10
+ { key: "files", header: "[Files And Changes]", maxBytes: 4608 },
11
+ { key: "activity", header: "[Fabric Activity]", maxBytes: 2048 },
12
+ { key: "outstanding", header: "[Outstanding Context]", maxBytes: 4608 },
13
+ { key: "earlierTurns", header: "[Earlier Turns]", maxBytes: 3072 },
14
+ { key: "status", header: "[Current Status]", maxBytes: 2048 }
15
+ ];
16
+ var REQUEST_MAX_BYTES = 3072;
17
+ var TRANSCRIPT_MAX_BYTES = 5120;
18
+ var FOOTER_MAX_BYTES = 1536;
19
+ var MAX_INPUT_LINES_PER_SECTION = 128;
20
+ var MAX_RENDERED_LINE_BYTES = 1024;
21
+ var LCM_RECOVERY_POINTER = "For exact pre-summary history, use memory.recall on this range, then memory.expand by stable entry or operation address.";
22
+ var POINTER_LINE = LCM_RECOVERY_POINTER;
23
+ var sampledLines = (lines, keep) => {
24
+ if (lines.length <= keep) return [...lines];
25
+ const earliest = Math.ceil(keep / 2);
26
+ const latest = Math.floor(keep / 2);
27
+ return [
28
+ ...lines.slice(0, earliest),
29
+ `\u2026 omitted ${lines.length - keep} rendered lines`,
30
+ ...lines.slice(lines.length - latest)
31
+ ];
32
+ };
33
+ var boundedBlock = (header, sourceLines, maxBytes) => {
34
+ const clipped = sourceLines.map((line) => clipUtf8(line, MAX_RENDERED_LINE_BYTES));
35
+ const capped = sampledLines(clipped, Math.min(clipped.length, MAX_INPUT_LINES_PER_SECTION));
36
+ for (let keep = capped.length; keep >= 0; keep--) {
37
+ const lines = sampledLines(capped, keep);
38
+ const block = [header, ...lines].join("\n");
39
+ if (utf8Bytes(block) <= maxBytes) return block;
40
+ }
41
+ return clipUtf8(header, maxBytes);
42
+ };
43
+ var renderSummary = (sections, options) => {
44
+ const blocks = [];
45
+ for (const { key, header, maxBytes } of SECTION_ORDER) {
46
+ const lines = sections[key];
47
+ if (lines.length === 0) continue;
48
+ blocks.push(boundedBlock(header, lines, maxBytes));
49
+ if (key === "goal" && options.requestLines && options.requestLines.length > 0) {
50
+ blocks.push(boundedBlock("[Compaction Request]", options.requestLines, REQUEST_MAX_BYTES));
51
+ }
52
+ }
53
+ if (sections.goal.length === 0 && options.requestLines && options.requestLines.length > 0) {
54
+ blocks.unshift(boundedBlock("[Compaction Request]", options.requestLines, REQUEST_MAX_BYTES));
55
+ }
56
+ if (sections.transcript.length > 0) {
57
+ blocks.push(boundedBlock("---", sections.transcript, TRANSCRIPT_MAX_BYTES));
58
+ }
59
+ const timestamp = options.lastTimestamp || "(unknown time)";
60
+ const range = options.firstEntryId || options.lastEntryId ? `${options.firstEntryId || "(start)"} \u2192 ${options.lastEntryId || "(end)"}` : "(no entries)";
61
+ const footer = options.summaryKind === "branch" ? `[branch summarized ${timestamp}; structural source entries ${range}]` : `[compacted ${timestamp}; cumulative source entries ${range}]`;
62
+ blocks.push(boundedBlock("---", [footer, POINTER_LINE], FOOTER_MAX_BYTES));
63
+ const summary = `${blocks.join("\n\n")}
64
+ `;
65
+ if (utf8Bytes(summary) <= MAX_SUMMARY_BYTES) return summary;
66
+ return `${clipUtf8(summary, MAX_SUMMARY_BYTES - 1, "")}
67
+ `;
68
+ };
69
+
70
+ export {
71
+ LCM_RECOVERY_POINTER,
72
+ renderSummary
73
+ };
74
+ //# sourceMappingURL=chunk-NIWOSO22.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/compaction/render.ts"],
4
+ "sourcesContent": ["import { clipUtf8, MAX_SUMMARY_BYTES, utf8Bytes } from \"./bounds.js\";\nimport type { Sections } from \"./projections.js\";\n\nconst SECTION_ORDER: { key: keyof Sections; header: string; maxBytes: number }[] = [\n { key: \"goal\", header: \"[Session Goal]\", maxBytes: 4096 },\n { key: \"files\", header: \"[Files And Changes]\", maxBytes: 4608 },\n { key: \"activity\", header: \"[Fabric Activity]\", maxBytes: 2048 },\n { key: \"outstanding\", header: \"[Outstanding Context]\", maxBytes: 4608 },\n { key: \"earlierTurns\", header: \"[Earlier Turns]\", maxBytes: 3072 },\n { key: \"status\", header: \"[Current Status]\", maxBytes: 2048 },\n];\n\nconst REQUEST_MAX_BYTES = 3072;\nconst TRANSCRIPT_MAX_BYTES = 5120;\nconst FOOTER_MAX_BYTES = 1536;\nconst MAX_INPUT_LINES_PER_SECTION = 128;\nconst MAX_RENDERED_LINE_BYTES = 1024;\n\nexport interface RenderOptions {\n firstEntryId: string;\n lastEntryId: string;\n lastTimestamp: string;\n requestLines?: string[];\n summaryKind?: \"compaction\" | \"branch\";\n}\n\nexport const LCM_RECOVERY_POINTER =\n \"For exact pre-summary history, use memory.recall on this range, then memory.expand by stable entry or operation address.\";\nconst POINTER_LINE = LCM_RECOVERY_POINTER;\n\nconst sampledLines = (lines: readonly string[], keep: number): string[] => {\n if (lines.length <= keep) return [...lines];\n const earliest = Math.ceil(keep / 2);\n const latest = Math.floor(keep / 2);\n return [\n ...lines.slice(0, earliest),\n `\u2026 omitted ${lines.length - keep} rendered lines`,\n ...lines.slice(lines.length - latest),\n ];\n};\n\nconst boundedBlock = (header: string, sourceLines: readonly string[], maxBytes: number): string => {\n const clipped = sourceLines.map((line) => clipUtf8(line, MAX_RENDERED_LINE_BYTES));\n const capped = sampledLines(clipped, Math.min(clipped.length, MAX_INPUT_LINES_PER_SECTION));\n for (let keep = capped.length; keep >= 0; keep--) {\n const lines = sampledLines(capped, keep);\n const block = [header, ...lines].join(\"\\n\");\n if (utf8Bytes(block) <= maxBytes) return block;\n }\n return clipUtf8(header, maxBytes);\n};\n\nexport const renderSummary = (sections: Sections, options: RenderOptions): string => {\n const blocks: string[] = [];\n for (const { key, header, maxBytes } of SECTION_ORDER) {\n const lines = sections[key];\n if (lines.length === 0) continue;\n blocks.push(boundedBlock(header, lines, maxBytes));\n if (key === \"goal\" && options.requestLines && options.requestLines.length > 0) {\n blocks.push(boundedBlock(\"[Compaction Request]\", options.requestLines, REQUEST_MAX_BYTES));\n }\n }\n if (sections.goal.length === 0 && options.requestLines && options.requestLines.length > 0) {\n blocks.unshift(boundedBlock(\"[Compaction Request]\", options.requestLines, REQUEST_MAX_BYTES));\n }\n\n if (sections.transcript.length > 0) {\n blocks.push(boundedBlock(\"---\", sections.transcript, TRANSCRIPT_MAX_BYTES));\n }\n\n const timestamp = options.lastTimestamp || \"(unknown time)\";\n const range = options.firstEntryId || options.lastEntryId\n ? `${options.firstEntryId || \"(start)\"} \u2192 ${options.lastEntryId || \"(end)\"}`\n : \"(no entries)\";\n const footer = options.summaryKind === \"branch\"\n ? `[branch summarized ${timestamp}; structural source entries ${range}]`\n : `[compacted ${timestamp}; cumulative source entries ${range}]`;\n blocks.push(boundedBlock(\"---\", [footer, POINTER_LINE], FOOTER_MAX_BYTES));\n\n const summary = `${blocks.join(\"\\n\\n\")}\\n`;\n if (utf8Bytes(summary) <= MAX_SUMMARY_BYTES) return summary;\n return `${clipUtf8(summary, MAX_SUMMARY_BYTES - 1, \"\")}\\n`;\n};\n"],
5
+ "mappings": ";;;;;;;AAGA,IAAM,gBAA6E;AAAA,EACjF,EAAE,KAAK,QAAQ,QAAQ,kBAAkB,UAAU,KAAK;AAAA,EACxD,EAAE,KAAK,SAAS,QAAQ,uBAAuB,UAAU,KAAK;AAAA,EAC9D,EAAE,KAAK,YAAY,QAAQ,qBAAqB,UAAU,KAAK;AAAA,EAC/D,EAAE,KAAK,eAAe,QAAQ,yBAAyB,UAAU,KAAK;AAAA,EACtE,EAAE,KAAK,gBAAgB,QAAQ,mBAAmB,UAAU,KAAK;AAAA,EACjE,EAAE,KAAK,UAAU,QAAQ,oBAAoB,UAAU,KAAK;AAC9D;AAEA,IAAM,oBAAoB;AAC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AiB,CAAC;AAAA,IAC3F;AAAA,EACF;AACA,MAAI,SAAS,KAAK,WAAW,KAAK,QAAQ,gBAAgB,QAAQ,aAAa,SAAS,GAAG;AACzF,WAAO,QAAQ,aAAa,wBAAwB,QAAQ,cAAc,iBAAiB,CAAC;AAAA,EAC9F;AAEA,MAAI,SAAS,WAAW,SAAS,GAAG;AAClC,WAAO,KAAK,aAAa,OAAO,SAAS,YAAY,oBAAoB,CAAC;AAAA,EAC5E;AAEA,QAAM,YAAY,QAAQ,iBAAiB;AAC3C,QAAM,QAAQ,QAAQ,gBAAgB,QAAQ,cAC1C,GAAG,QAAQ,gBAAgB,SAAS,WAAM,QAAQ,eAAe,OAAO,KACxE;AACJ,QAAM,SAAS,QAAQ,gBAAgB,WACnC,sBAAsB,SAAS,+BAA+B,KAAK,MACnE,cAAc,SAAS,+BAA+B,KAAK;AAC/D,SAAO,KAAK,aAAa,OAAO,CAAC,QAAQ,YAAY,GAAG,gBAAgB,CAAC;AAEzE,QAAM,UAAU,GAAG,OAAO,KAAK,MAAM,CAAC;AAAA;AACtC,MAAI,UAAU,OAAO,KAAK,kBAAmB,QAAO;AACpD,SAAO,GAAG,SAAS,SAAS,oBAAoB,GAAG,EAAE,CAAC;AAAA;AACxD;",
6
+ "names": []
7
+ }
@@ -11,7 +11,10 @@ var OMP_CORE_TOOL_NAMES = [
11
11
  var isOmpShellToolName = (name) => name === "bash";
12
12
  var isOmpShellRef = (ref) => ref === "omp.bash";
13
13
  var OMP_CORE_TOOL_NAME_SET = new Set(OMP_CORE_TOOL_NAMES);
14
- var ompCoreToolDenied = (name, hostActiveTools) => Boolean(hostActiveTools?.size) && !hostActiveTools.has(name);
14
+ var HOST_TOOL_FOR_CORE = /* @__PURE__ */ new Map([["find", "glob"]]);
15
+ var hostToolForCore = (name) => HOST_TOOL_FOR_CORE.get(name) ?? name;
16
+ var FABRIC_OWNED_HOST_TOOLS = new Set(OMP_CORE_TOOL_NAMES.map(hostToolForCore));
17
+ var ompCoreToolDenied = (name, hostActiveTools) => Boolean(hostActiveTools?.size) && !hostActiveTools.has(OMP_CORE_TOOL_NAME_SET.has(name) ? hostToolForCore(name) : name);
15
18
  var deniedOmpCoreTools = (hostActiveTools) => OMP_CORE_TOOL_NAMES.filter((name) => ompCoreToolDenied(name, hostActiveTools));
16
19
 
17
20
  export {
@@ -19,7 +22,9 @@ export {
19
22
  isOmpShellToolName,
20
23
  isOmpShellRef,
21
24
  OMP_CORE_TOOL_NAME_SET,
25
+ hostToolForCore,
26
+ FABRIC_OWNED_HOST_TOOLS,
22
27
  ompCoreToolDenied,
23
28
  deniedOmpCoreTools
24
29
  };
25
- //# sourceMappingURL=chunk-ZFMSJLQE.js.map
30
+ //# sourceMappingURL=chunk-OHPTGVDK.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/core/omp-tools.ts"],
4
+ "sourcesContent": ["export const OMP_CORE_TOOL_NAMES = [\n \"read\",\n \"bash\",\n \"edit\",\n \"write\",\n \"grep\",\n \"find\",\n \"ls\",\n] as const;\n\nexport type OmpCoreToolName = (typeof OMP_CORE_TOOL_NAMES)[number];\n\nconst OMP_SHELL_TOOL_NAMES = [\"bash\"] as const;\nexport type OmpShellToolName = (typeof OMP_SHELL_TOOL_NAMES)[number];\n\nexport const isOmpShellToolName = (name: string): name is OmpShellToolName => name === \"bash\";\n\nexport const isOmpShellRef = (ref: string): boolean => ref === \"omp.bash\";\n\nexport const OMP_CORE_TOOL_NAME_SET: ReadonlySet<string> = new Set(OMP_CORE_TOOL_NAMES);\n\n/** The host tool a core tool replaces, when the two carry different names. `omp.find` runs the host's glob search; the host's own `find` is a semantic search fabric does not serve. */\nconst HOST_TOOL_FOR_CORE: ReadonlyMap<OmpCoreToolName, string> = new Map([[\"find\", \"glob\"]]);\n\nexport const hostToolForCore = (name: OmpCoreToolName): string => HOST_TOOL_FOR_CORE.get(name) ?? name;\n\n/** The host tools fabric replaces, and so the ones it owns while full code mode is on. */\nexport const FABRIC_OWNED_HOST_TOOLS: ReadonlySet<string> = new Set(OMP_CORE_TOOL_NAMES.map(hostToolForCore));\n\n/** An empty host selection reads as unknown, so it denies nothing. */\nexport const ompCoreToolDenied = (\n name: string,\n hostActiveTools: ReadonlySet<string> | undefined,\n): boolean => Boolean(hostActiveTools?.size)\n && !hostActiveTools!.has(OMP_CORE_TOOL_NAME_SET.has(name) ? hostToolForCore(name as OmpCoreToolName) : name);\n\nexport const deniedOmpCoreTools = (\n hostActiveTools: ReadonlySet<string> | undefined,\n): readonly OmpCoreToolName[] =>\n OMP_CORE_TOOL_NAMES.filter((name) => ompCoreToolDenied(name, hostActiveTools));\n"],
5
+ "mappings": ";AAAO,IAAM,sBAAsB;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAOO,IAAM,qBAAqB,CAAC,SAA2C,SAAS;AAEhF,IAAM,gBAAgB,CAAC,QAAyB,QAAQ;AAExD,IAAM,yBAA8C,IAAI,IAAI,mBAAmB;AAGtF,IAAM,qBAA2D,oBAAI,IAAI,CAAC,CAAC,QAAQ,MAAM,CAAC,CAAC;AAEpF,IAAM,kBAAkB,CAAC,SAAkC,mBAAmB,IAAI,IAAI,KAAK;AAG3F,IAAM,0BAA+C,IAAI,IAAI,oBAAoB,IAAI,eAAe,CAAC;AAGrG,IAAM,oBAAoB,CAC/B,MACA,oBACY,QAAQ,iBAAiB,IAAI,KACtC,CAAC,gBAAiB,IAAI,uBAAuB,IAAI,IAAI,IAAI,gBAAgB,IAAuB,IAAI,IAAI;AAEtG,IAAM,qBAAqB,CAChC,oBAEA,oBAAoB,OAAO,CAAC,SAAS,kBAAkB,MAAM,eAAe,CAAC;",
6
+ "names": []
7
+ }
@@ -5,12 +5,15 @@ import {
5
5
  normalizeCodePreviewSettings,
6
6
  truncateMiddle
7
7
  } from "./chunk-SKYNDRW5.js";
8
+ import {
9
+ MAX_LEAF_ENTRIES
10
+ } from "./chunk-G5FBLYOY.js";
8
11
  import {
9
12
  renameAtomic
10
13
  } from "./chunk-KAD7UWT2.js";
11
14
  import {
12
15
  OMP_CORE_TOOL_NAME_SET
13
- } from "./chunk-ZFMSJLQE.js";
16
+ } from "./chunk-OHPTGVDK.js";
14
17
 
15
18
  // src/core/model-resolution.ts
16
19
  var PROVIDER_MODEL_RE = /^[^\s/]+\/[^\s/]+$/;
@@ -676,6 +679,7 @@ var DEFAULT_FABRIC_CONFIG = {
676
679
  lcmMaxCondenseChildren: 4,
677
680
  lcmMaintenancePasses: 8,
678
681
  lcmMaintenanceConcurrency: 3,
682
+ lcmMaintenanceRunSeconds: 60,
679
683
  lcmModelSummaries: true,
680
684
  lcmModelTimeoutSeconds: 120,
681
685
  lcmMaxDailyModelCalls: 0,
@@ -1199,10 +1203,11 @@ var normalizeFabricConfig = (input) => {
1199
1203
  lcmMaxInputChars: boundedInteger(compaction.lcmMaxInputChars, DEFAULT_FABRIC_CONFIG.compaction.lcmMaxInputChars, 1024, 1e6),
1200
1204
  lcmMaxOutputTokens: boundedInteger(compaction.lcmMaxOutputTokens, DEFAULT_FABRIC_CONFIG.compaction.lcmMaxOutputTokens, 128, 32768),
1201
1205
  lcmMaxOutputChars: boundedInteger(compaction.lcmMaxOutputChars, DEFAULT_FABRIC_CONFIG.compaction.lcmMaxOutputChars, 1024, 131072),
1202
- lcmMaxLeafEntries: boundedInteger(compaction.lcmMaxLeafEntries, DEFAULT_FABRIC_CONFIG.compaction.lcmMaxLeafEntries, 1, 128),
1206
+ lcmMaxLeafEntries: boundedInteger(compaction.lcmMaxLeafEntries, DEFAULT_FABRIC_CONFIG.compaction.lcmMaxLeafEntries, 1, MAX_LEAF_ENTRIES),
1203
1207
  lcmMaxCondenseChildren: boundedInteger(compaction.lcmMaxCondenseChildren, DEFAULT_FABRIC_CONFIG.compaction.lcmMaxCondenseChildren, 2, 32),
1204
1208
  lcmMaintenancePasses: boundedInteger(compaction.lcmMaintenancePasses, DEFAULT_FABRIC_CONFIG.compaction.lcmMaintenancePasses, 1, 64),
1205
1209
  lcmMaintenanceConcurrency: boundedInteger(compaction.lcmMaintenanceConcurrency, DEFAULT_FABRIC_CONFIG.compaction.lcmMaintenanceConcurrency, 1, 8),
1210
+ lcmMaintenanceRunSeconds: boundedInteger(compaction.lcmMaintenanceRunSeconds, DEFAULT_FABRIC_CONFIG.compaction.lcmMaintenanceRunSeconds, 10, 600),
1206
1211
  lcmModelSummaries: booleanValue(compaction.lcmModelSummaries, DEFAULT_FABRIC_CONFIG.compaction.lcmModelSummaries),
1207
1212
  lcmModelTimeoutSeconds: boundedInteger(compaction.lcmModelTimeoutSeconds, DEFAULT_FABRIC_CONFIG.compaction.lcmModelTimeoutSeconds, 10, 900),
1208
1213
  lcmMaxDailyModelCalls: boundedInteger(compaction.lcmMaxDailyModelCalls, DEFAULT_FABRIC_CONFIG.compaction.lcmMaxDailyModelCalls, 0, 1e5),
@@ -1664,4 +1669,4 @@ export {
1664
1669
  saveFabricConfig,
1665
1670
  resolveAgentDir
1666
1671
  };
1667
- //# sourceMappingURL=chunk-GUJNTA7Z.js.map
1672
+ //# sourceMappingURL=chunk-ON7LE7QA.js.map