omp-fabric 1.20.0 → 1.21.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.
Files changed (41) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +6 -2
  3. package/dist/agents/manager.d.ts +4 -0
  4. package/dist/agents/manager.d.ts.map +1 -1
  5. package/dist/chunks/{chunk-PUGB6NGD.js → chunk-3JYNYBJG.js} +3 -3
  6. package/dist/chunks/{chunk-5FYSQRJ4.js → chunk-GUJNTA7Z.js} +22 -3
  7. package/dist/chunks/chunk-GUJNTA7Z.js.map +7 -0
  8. package/dist/chunks/{chunk-NP5U3BJZ.js → chunk-KIIJH5CX.js} +166 -17
  9. package/dist/chunks/chunk-KIIJH5CX.js.map +7 -0
  10. package/dist/config.d.ts +12 -0
  11. package/dist/config.d.ts.map +1 -1
  12. package/dist/execution-service.d.ts +2 -0
  13. package/dist/execution-service.d.ts.map +1 -1
  14. package/dist/fabric-runtime-state.d.ts +3 -0
  15. package/dist/fabric-runtime-state.d.ts.map +1 -1
  16. package/dist/fabric-runtime-state.js +390 -9
  17. package/dist/fabric-runtime-state.js.map +4 -4
  18. package/dist/fabric-state.d.ts +1 -0
  19. package/dist/fabric-state.d.ts.map +1 -1
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +172 -17
  22. package/dist/index.js.map +4 -4
  23. package/dist/judgment/gates/delegation.d.ts +31 -0
  24. package/dist/judgment/gates/delegation.d.ts.map +1 -0
  25. package/dist/judgment/gates/skills.d.ts +20 -0
  26. package/dist/judgment/gates/skills.d.ts.map +1 -0
  27. package/dist/judgment/gates/tool-exec.d.ts +31 -0
  28. package/dist/judgment/gates/tool-exec.d.ts.map +1 -0
  29. package/dist/judgment/gates/tool-output.d.ts +40 -0
  30. package/dist/judgment/gates/tool-output.d.ts.map +1 -0
  31. package/dist/residency/host.js +3 -3
  32. package/dist/residency/omp-entry.js +3 -3
  33. package/dist/ui/settings.d.ts.map +1 -1
  34. package/dist/ui/settings.js +37 -3
  35. package/dist/ui/settings.js.map +2 -2
  36. package/docs/configuration.md +4 -0
  37. package/docs/judgment.md +34 -0
  38. package/package.json +2 -1
  39. package/dist/chunks/chunk-5FYSQRJ4.js.map +0 -7
  40. package/dist/chunks/chunk-NP5U3BJZ.js.map +0 -7
  41. /package/dist/chunks/{chunk-PUGB6NGD.js.map → chunk-3JYNYBJG.js.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.21.0
4
+
5
+ ### Added
6
+
7
+ - Four judgment gates read the lane from inside Fabric, and every one ships off. `judgment.gates.toolExec` judges a tool call before it runs, `judgment.gates.toolOutput` judges fetched text before it reaches the model, `judgment.gates.delegation` judges the shape of a delegated run, and `judgment.gates.skills` names at most one skill for the turn. They ship off so their effects stay separable: turn on two at once and a behaviour change has two suspects. Every gate fails open, so a refusal from the lane leaves the code on the path it would have taken with no judgment at all, and with a gate off its call site costs two boolean reads and builds nothing.
8
+ - The tool-call gate asks whether running a call destroys state that cannot be recovered, and how far the worst plausible outcome reaches, over the prepared arguments the call will actually run with. A destructive or far-reaching verdict escalates to the `execute` class; `network` is reserved for a reach whose mass sits on shared systems, so an operator guarding outbound traffic is not prompted about a local delete. It escalates through the approval path that already exists by raising the call's risk class, so the operator sees the prompt they already know, carrying the reason. Fabric ships every approval class on `allow`, so on a stock configuration the gate forms a verdict and has nothing to escalate to; it starts having an effect once an approval class moves off `allow`.
9
+ - The tool-output gate screens text fetched from outside the session before it reaches the model. The scope is exact: `mcp.<server>.<tool>` other than its `$` control actions, a captured `extensions.web_search`, and a `read` whose path is an `http`, `https`, `issue`, `pr` or `mcp` URL. Every other call, including all seven core tools on a local path, is returned untouched with no lane contact. A hit returns a flagged envelope carrying `judgmentScreened: true`, the notice, the two probabilities and the redacted result, so a program branches on a field instead of parsing prose, and a miss returns the original value by identity. Redaction replaces prose, never a handle, and it decides on the value rather than on the field name: a fetched document controls its own keys, so exempting `data` or `uri` by name would let an injection choose the field it hides in. A string is prose when fewer than a third of its words are longer than any word in prose, which covers a base64 blob, a cursor, a uuid and a URL whether or not they are line-wrapped. Values that are not plain objects or arrays pass through by reference, so a Buffer stays a Buffer and a Date stays a Date. The notice appears once on the envelope, which is what keeps a result of ten thousand screened leaves from growing by megabytes. A large page travels as a deterministic head-and-tail sample, because an injected payload is commonly appended at the end; on a 197,604-character page the state measures 32,905 bytes against the 65,536-byte ceiling.
10
+ - The delegation gate picks the agent kind and the reasoning effort for a spawn, but only where the caller left the field unset, and only above a confidence floor, so a near-tie leaves the configured default in place. It offers only kinds whose own tool mapper and model normalizer accept this request, and it declines to reroute a run whose model the caller pinned, which keeps the gate from ever being the reason a run fails. The effort comes from the level the judge put the most mass on, never from rounding a probability-weighted index, so a distribution split between the extremes cannot configure a midpoint neither side endorsed.
11
+ - The skill gate ranks the roster in one request and reads the three best candidates properly in a second, putting one line on the message channel rather than the system prompt, so provider prefix caches stay warm. Measured on this machine's roster of 765 skills over a 14-case fixture, it names the labelled skill in 6 of 9 cases, suggests nothing on all 5 turns that needed nothing including two written to sound procedural with no skill behind them, and adds 1.1 seconds at the median and 1.9 at the worst. `bun run benchmark:skill-router` runs that measurement against any fixture. It runs the cases one at a time, because an earlier concurrent version reported queue time as per-turn latency and published a figure three times too high, and it excludes any case the backend failed to answer, because the gate fails open and a dead backend would otherwise read as a perfect false-suggestion score. It measures the ranker, not the agent, since only an end-to-end run shows whether the model then loads what was named.
12
+ - TypeSafe rejects a Choice carrying more than 255 options, which a 765-skill roster crosses on the first attempt. The ranker shards the roster into questions of at most 254 options and merges the winners before the second pass. Nothing in the tree documents that cap; the harness found it as an HTTP 400 on every request, with the gate failing open and suggesting nothing, which is how a design constraint should surface.
13
+
3
14
  ## 1.20.0
4
15
 
5
16
  ### Added
package/README.md CHANGED
@@ -34,6 +34,7 @@ Fabric gives OMP one programmable tool called `fabric_exec`, which composes core
34
34
  | 🧰 | **Capability routing** | Call OMP core tools, MCP servers, captured extension tools, or Fabric providers through one runtime. |
35
35
  | 🧑‍🤝‍🧑 | **Agent runtime** | One-shot workers, durable resident agents, persistent event-driven actors, councils, and bounded recursive queries. |
36
36
  | 🕸️ | **Workflows + mesh** | Phased progress plus durable topics, shared tasks, and compare-and-swap state. |
37
+ | ⚖️ | **Typed judgment** | Calibrated choice, bool, and score answers about one state, batched into one backend request, with four optional gates that read them. |
37
38
  | 🛡️ | **Guardrails** | Approvals, isolation, timeouts, concurrency, recursion depth, and shared cost budgets. |
38
39
  | 🎛️ | **Native TUI** | Live activity, an interactive dashboard, and settings without leaving OMP. |
39
40
 
@@ -160,7 +161,7 @@ The command bills your provider and stops at `OMP_FABRIC_BENCH_MAX_USD`. Without
160
161
 
161
162
  - [Configuration](docs/configuration.md): `fabric.json`, code modes, tool capture, approvals, and budgets.
162
163
  - [Code map](docs/codemap.md): the native symbol index, token-budgeted disclosure, and git co-change ranking.
163
- - [Judgment](docs/judgment.md): calibrated choice, bool, and score answers over one state, batched into a single backend request.
164
+ - [Judgment](docs/judgment.md): calibrated choice, bool, and score answers over one state, batched into a single backend request, and the four gates that read them.
164
165
  - [Memory & recall](docs/memory-recall.md): compact ranked hits, uniform follow calls, lossless expansion, and guest-local `memory.walk` computation.
165
166
  - [Interface & commands](docs/interface.md): dashboard, settings, keybindings, slash commands, and headless runs.
166
167
  - [Agents, actors & mesh](docs/agents.md): model handoff, `/fabric prewalk`, runners, transports, actors, councils, recursive queries, and durable coordination.
@@ -188,8 +189,11 @@ The test suite covers:
188
189
  - provider dispatch, registered-tool execution, QuickJS isolation, and OMP built-in calls
189
190
  - agent fixtures for Claude and Veda
190
191
  - workflows, durable mesh state, actor mailboxes, subscriptions, and actor restoration
192
+ - the judgment lane, its provider, the guest surface, and the four gates
191
193
 
192
- Claude and Veda fixtures use local test processes with zero billable requests.
194
+ Claude and Veda fixtures use local test processes with zero billable requests. The judgment tests use scripted judges and spend nothing either.
195
+
196
+ `bun run benchmark:skill-router` measures the skill gate against a fixture of labelled turns. It needs `TYPESAFE_API_KEY` and makes real requests, so it is not part of `bun test`.
193
197
 
194
198
  ## Acknowledgments
195
199
 
@@ -1,6 +1,8 @@
1
1
  import { type FabricAgentRunner, type FabricAgentConfig, type FabricRetentionConfig } from "../config.js";
2
2
  import { type ClaudeModelInfo } from "./claude-cli.js";
3
3
  import type { FabricSteeringMode, FabricAgentLog, AgentHandleInfo, AgentRunRecord, AgentRunRequest, AgentRunResult, AgentSteerResult } from "./types.js";
4
+ import type { FabricJudgmentLane } from "../judgment/lane.js";
5
+ import type { FabricJudgmentGatesConfig } from "../config.js";
4
6
  import { type FabricLifecyclePublishRequest } from "../lifecycle/types.js";
5
7
  export declare const effectiveAgentTimeoutMs: (configuredTimeoutMs: number, requestedTimeoutMs?: number) => number;
6
8
  interface AgentParticipantGuidanceRequest {
@@ -35,6 +37,8 @@ export declare class AgentManager {
35
37
  onLifecycle?: (event: FabricLifecyclePublishRequest) => void;
36
38
  prepareOmpModel?: (model: string | undefined) => Promise<string | void>;
37
39
  resolveParticipantGuidance?: AgentParticipantGuidanceResolver;
40
+ judgment?: FabricJudgmentLane;
41
+ judgmentGates?: () => FabricJudgmentGatesConfig;
38
42
  });
39
43
  subscribeUi(listener: () => void): () => void;
40
44
  resolveCwd(requestedCwd?: string): string;
@@ -1 +1 @@
1
- {"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/agents/manager.ts"],"names":[],"mappings":"AAMA,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EAEtB,KAAK,qBAAqB,EAC3B,MAAM,cAAc,CAAC;AACtB,OAAO,EAIL,KAAK,eAAe,EACrB,MAAM,iBAAiB,CAAC;AAgBzB,OAAO,KAAK,EAEV,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,cAAc,EACd,eAAe,EACf,cAAc,EAEd,gBAAgB,EAIjB,MAAM,YAAY,CAAC;AAqBpB,OAAO,EAGL,KAAK,6BAA6B,EACnC,MAAM,u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AO,CAAC,EAAE,EAAE,MAAM,EAAE,YAAY,UAAQ,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAa9E,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,GAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,cAAc;IAkBnF,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,gBAAgB;IAKpE,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,gBAAgB;IAgBvE,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,GAAG,gBAAgB;IAIvE,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,GAAG,gBAAgB;IAUvE,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,gBAAgB;IA4BtD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAinB7B"}
@@ -10,11 +10,11 @@ import {
10
10
  lifecycleSourceIdentity,
11
11
  loadModelUsage,
12
12
  useBudgetLedger
13
- } from "./chunk-NP5U3BJZ.js";
13
+ } from "./chunk-KIIJH5CX.js";
14
14
  import {
15
15
  normalizeModelAliases,
16
16
  resolveAvailableOmpModel
17
- } from "./chunk-5FYSQRJ4.js";
17
+ } from "./chunk-GUJNTA7Z.js";
18
18
  import {
19
19
  parseFabricOwnedModelGuidance,
20
20
  resolveFabricModelGuidance
@@ -685,4 +685,4 @@ if (isMain) {
685
685
  export {
686
686
  runResidentHostFromConfigPath
687
687
  };
688
- //# sourceMappingURL=chunk-PUGB6NGD.js.map
688
+ //# sourceMappingURL=chunk-3JYNYBJG.js.map
@@ -750,7 +750,13 @@ var DEFAULT_FABRIC_CONFIG = {
750
750
  timeoutMs: 8e3,
751
751
  maxConcurrent: 8,
752
752
  maxQuestionsPerRequest: 32,
753
- maxStateBytes: 64 * 1024
753
+ maxStateBytes: 64 * 1024,
754
+ gates: {
755
+ toolExec: false,
756
+ toolOutput: false,
757
+ delegation: false,
758
+ skills: false
759
+ }
754
760
  },
755
761
  codePreview: defaultCodePreviewSettings()
756
762
  };
@@ -834,6 +840,7 @@ var normalizeFabricConfig = (input) => {
834
840
  const schemaMode = schemaModeValue(schema.mode, DEFAULT_FABRIC_CONFIG.schema.mode);
835
841
  const speculation = objectValue(input.speculation);
836
842
  const judgment = objectValue(input.judgment);
843
+ const judgmentGates = objectValue(judgment.gates);
837
844
  const configuredExecutorRuntime = executorRuntimeValue(
838
845
  executor.runtime,
839
846
  DEFAULT_FABRIC_CONFIG.executor.runtime
@@ -1467,7 +1474,19 @@ var normalizeFabricConfig = (input) => {
1467
1474
  DEFAULT_FABRIC_CONFIG.judgment.maxStateBytes,
1468
1475
  1024,
1469
1476
  512 * 1024
1470
- )
1477
+ ),
1478
+ gates: {
1479
+ toolExec: booleanValue(judgmentGates.toolExec, DEFAULT_FABRIC_CONFIG.judgment.gates.toolExec),
1480
+ toolOutput: booleanValue(
1481
+ judgmentGates.toolOutput,
1482
+ DEFAULT_FABRIC_CONFIG.judgment.gates.toolOutput
1483
+ ),
1484
+ delegation: booleanValue(
1485
+ judgmentGates.delegation,
1486
+ DEFAULT_FABRIC_CONFIG.judgment.gates.delegation
1487
+ ),
1488
+ skills: booleanValue(judgmentGates.skills, DEFAULT_FABRIC_CONFIG.judgment.gates.skills)
1489
+ }
1471
1490
  },
1472
1491
  codePreview: normalizeCodePreviewSettings(input.codePreview)
1473
1492
  };
@@ -1645,4 +1664,4 @@ export {
1645
1664
  saveFabricConfig,
1646
1665
  resolveAgentDir
1647
1666
  };
1648
- //# sourceMappingURL=chunk-5FYSQRJ4.js.map
1667
+ //# sourceMappingURL=chunk-GUJNTA7Z.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/core/model-resolution.ts", "../../src/config.ts", "../../src/config-migrations.ts", "../../src/output-budget.ts", "../../src/core/agent-dir.ts"],
4
+ "sourcesContent": ["const PROVIDER_MODEL_RE = /^[^\\s/]+\\/[^\\s/]+$/;\n\n/** Minimal model view needed for resolution; satisfied by OMP Model entries. */\nexport interface FabricModelCandidate {\n provider: string;\n id: string;\n name?: string;\n}\n\nexport type FabricModelResolution =\n | { kind: \"resolved\"; model: FabricModelCandidate; via?: string }\n | { kind: \"already-active\"; model: FabricModelCandidate }\n | { kind: \"ambiguous\"; query: string; candidates: FabricModelCandidate[] }\n | { kind: \"not-found\"; query: string; tried?: string[] };\n\n/** Markers reported in `via` when an inexact selector is fuzzy-resolved. */\nexport const FUZZY_RESOLUTION_MARKERS = [\"closest\", \"recent\", \"latest\"] as const;\n\nconst modelKey = (model: FabricModelCandidate): string => `${model.provider}/${model.id}`;\n\nconst sameModel = (\n left: FabricModelCandidate,\n right: FabricModelCandidate | undefined,\n): boolean =>\n right !== undefined &&\n left.provider.toLowerCase() === right.provider.toLowerCase() &&\n left.id.toLowerCase() === right.id.toLowerCase();\n\n/**\n * Normalize raw `models.aliases` config into alias name \u2192 ordered targets.\n * String targets degrade to one-element fallback chains. Entries whose name,\n * target list, or any `provider/model` target string is malformed are\n * dropped entirely, matching the lenient fallback style of the other config\n * normalizers (no partial alias survives with a silently missing target).\n */\nexport const normalizeModelAliases = (input: unknown): Record<string, string[]> => {\n if (typeof input !== \"object\" || input === null || Array.isArray(input)) return {};\n const aliases: Record<string, string[]> = {};\n for (const [rawName, rawValue] of Object.entries(input as Record<string, unknown>)) {\n const name = rawName.trim();\n if (!name) continue;\n const values = typeof rawValue === \"string\" ? [rawValue] : rawValue;\n if (!Array.isArray(values) || values.length === 0) continue;\n const targets: string[] = [];\n let valid = true;\n for (const candidate of values) {\n if (typeof candidate !== \"string\") {\n valid = false;\n break;\n }\n const target = candidate.trim();\n if (!PROVIDER_MODEL_RE.test(target)) {\n valid = false;\n break;\n }\n if (!targets.includes(target)) targets.push(target);\n }\n if (valid && targets.length > 0) aliases[name] = targets;\n }\n return aliases;\n};\n\nconst FUZZY_MIN_QUERY_LENGTH = 4;\nconst FUZZY_LEVENSHTEIN_MIN_RATIO = 0.55;\n\n/**\n * Span covered when every character of `needle` appears in `haystack` in\n * order (first to last matched index), or Infinity when it does not. A tight\n * span keeps abbreviated selectors honest: \"gmni\" spans 6 chars in\n * \"gemini-2.5-pro\" but 10 in \"gpt-5-mini\", so only the former reads as the\n * same token with letters dropped.\n */\nconst subsequenceSpan = (needle: string, haystack: string): number => {\n let index = 0;\n let first = -1;\n let last = -1;\n for (let i = 0; i < haystack.length && index < needle.length; i += 1) {\n if (haystack[i] === needle[index]) {\n if (first === -1) first = i;\n last = i;\n index += 1;\n }\n }\n return index === needle.length ? last - first + 1 : Number.POSITIVE_INFINITY;\n};\n\n/** Normalized Levenshtein similarity in [0, 1]; 1 means identical. */\nconst levenshteinRatio = (left: string, right: string): number => {\n if (left === right) return 1;\n if (left.length === 0 || right.length === 0) return 0;\n let previous = Array.from({ length: right.length + 1 }, (_, column) => column);\n for (let i = 0; i < left.length; i += 1) {\n const current: number[] = [i + 1];\n for (let j = 0; j < right.length; j += 1) {\n current.push(Math.min(\n previous[j]! + 1,\n current[j]! + 1,\n previous[j]! + (left[i] === right[j] ? 0 : 1),\n ));\n }\n previous = current;\n }\n return 1 - previous[right.length]! / Math.max(left.length, right.length);\n};\n\n/**\n * Closeness score for an inexact selector against one candidate. Tiered so a\n * substring hit always outranks a subsequence hit, which always outranks a\n * typo-level Levenshtein resemblance; coverage bonuses reward selectors that\n * span most of the target id name. Zero means no resemblance at all.\n */\nconst closenessScore = (query: string, model: FabricModelCandidate): number => {\n const id = model.id.toLowerCase();\n const name = model.name?.toLowerCase();\n if (id.startsWith(query)) return 60 + (query.length / id.length) * 20;\n if (id.includes(query)) return 50 + (query.length / id.length) * 15;\n if (name?.startsWith(query) === true) return 45 + (query.length / name.length) * 15;\n if (name?.includes(query) === true) return 40 + (query.length / name.length) * 10;\n if (model.provider.toLowerCase().includes(query)) return 25;\n if (\n query.length >= 3 &&\n query[0] === id[0] &&\n subsequenceSpan(query, id) <= query.length + 2\n ) {\n return 18 + (query.length / id.length) * 6;\n }\n if (query.length >= FUZZY_MIN_QUERY_LENGTH) {\n const idRatio = levenshteinRatio(query, id);\n if (idRatio >= FUZZY_LEVENSHTEIN_MIN_RATIO) return 8 + idRatio * 10;\n if (name !== undefined) {\n const nameRatio = levenshteinRatio(query, name);\n if (nameRatio >= FUZZY_LEVENSHTEIN_MIN_RATIO) return 6 + nameRatio * 8;\n }\n }\n return 0;\n};\n\nexport type FabricModelUsage = Record<string, number>;\n\n/**\n * Pick the closest candidate for an inexact selector. Ranking is closeness\n * first; equal-closeness ties fall to the most recently used model (recency\n * timestamps such as pi-model-sort's extensions/pi-model-sort.json under the\n * agent dir, keyed by provider/id), then to the highest-sorting key, mirroring\n * OMP's convention that the newest alias/versioned id sorts last.\n */\nconst pickClosestCandidate = (\n query: string,\n pool: readonly FabricModelCandidate[],\n lastUsed: FabricModelUsage | undefined,\n): { model: FabricModelCandidate; via: \"closest\" | \"recent\" | \"latest\" } | undefined => {\n const usage: FabricModelUsage = {};\n for (const [key, value] of Object.entries(lastUsed ?? {})) {\n usage[key.toLowerCase()] = value;\n }\n const recency = (model: FabricModelCandidate): number =>\n usage[`${model.provider}/${model.id}`.toLowerCase()] ?? 0;\n let best: FabricModelCandidate | undefined;\n let bestScore = 0;\n let tied = false;\n for (const model of pool) {\n const score = closenessScore(query, model);\n if (score <= 0) continue;\n if (best === undefined || score > bestScore) {\n best = model;\n bestScore = score;\n tied = false;\n continue;\n }\n if (score === bestScore) {\n tied = true;\n const bestRecent = recency(best);\n const nextRecent = recency(model);\n if (nextRecent > bestRecent || (nextRecent === bestRecent && modelKey(model) > modelKey(best))) {\n best = model;\n }\n }\n }\n if (best === undefined) return undefined;\n const runnersUp = pool.filter(\n (model) => model !== best && closenessScore(query, model) === bestScore,\n );\n const wonOnRecency = tied\n && runnersUp.some((model) => recency(model) !== recency(best));\n return {\n model: best,\n via: !tied ? \"closest\" : wonOnRecency ? \"recent\" : \"latest\",\n };\n};\n\n/**\n * Resolve a model selector against aliases and the available (authenticated)\n * registry. Order: alias lookup first so a configured name always wins, then\n * exact provider/id, exact id, then fuzzy selection. A lone partial match is\n * returned directly; broader candidate pools are ranked by closeness, with\n * equal-closeness ties falling to the most recently used model (when usage\n * timestamps are supplied, e.g. from pi-model-sort) and then to the\n * highest-sorting key, mirroring OMP's newest-alias convention. Only a pool\n * with no resemblance at all stays not-found; `ambiguous` is retained for\n * defensive completeness but the ranker always produces a deterministic pick.\n */\nexport const resolveFabricModel = (\n query: string,\n options: {\n aliases: Record<string, string[]>;\n available: readonly FabricModelCandidate[];\n current?: FabricModelCandidate;\n provider?: string;\n lastUsed?: FabricModelUsage;\n },\n): FabricModelResolution => {\n const normalized = query.trim().toLowerCase();\n if (!normalized) return { kind: \"not-found\", query };\n const providerFilter = options.provider?.trim().toLowerCase();\n const available = providerFilter\n ? options.available.filter((model) => model.provider.toLowerCase() === providerFilter)\n : [...options.available];\n if (available.length === 0) return { kind: \"not-found\", query };\n\n const aliasKey = Object.keys(options.aliases).find(\n (key) => key.toLowerCase() === normalized,\n );\n const tried: string[] = [];\n if (aliasKey !== undefined) {\n const chain = options.aliases[aliasKey] ?? [];\n for (const target of chain) {\n tried.push(target);\n const separator = target.indexOf(\"/\");\n const provider = target.slice(0, separator);\n const id = target.slice(separator + 1);\n const match = available.find(\n (model) =>\n model.provider.toLowerCase() === provider.toLowerCase() &&\n model.id.toLowerCase() === id.toLowerCase(),\n );\n if (match) {\n return sameModel(match, options.current)\n ? { kind: \"already-active\", model: match }\n : { kind: \"resolved\", model: match, via: aliasKey };\n }\n }\n return { kind: \"not-found\", query, tried };\n }\n\n const exact = available.find((model) => modelKey(model).toLowerCase() === normalized)\n ?? available.find((model) => model.id.toLowerCase() === normalized);\n if (exact) {\n return sameModel(exact, options.current)\n ? { kind: \"already-active\", model: exact }\n : { kind: \"resolved\", model: exact };\n }\n\n const candidates = available.filter(\n (model) =>\n model.id.toLowerCase().includes(normalized) ||\n (model.name !== undefined && model.name.toLowerCase().includes(normalized)) ||\n model.provider.toLowerCase().includes(normalized),\n );\n if (candidates.length === 1) {\n const match = candidates[0];\n if (match === undefined) return { kind: \"not-found\", query };\n return sameModel(match, options.current)\n ? { kind: \"already-active\", model: match }\n : { kind: \"resolved\", model: match };\n }\n const pool = candidates.length > 1 ? candidates : available;\n const picked = pickClosestCandidate(normalized, pool, options.lastUsed);\n if (picked) {\n return sameModel(picked.model, options.current)\n ? { kind: \"already-active\", model: picked.model }\n : { kind: \"resolved\", model: picked.model, via: picked.via };\n }\n if (candidates.length > 1) return { kind: \"ambiguous\", query, candidates };\n return { kind: \"not-found\", query };\n};\n\nconst unavailableOmpModelError = (\n query: string,\n resolution?: Extract<FabricModelResolution, { kind: \"ambiguous\" | \"not-found\" }>,\n): Error => {\n const detail = resolution?.kind === \"not-found\" && resolution.tried !== undefined\n ? ` Alias targets tried: ${resolution.tried.join(\", \")}.`\n : resolution?.kind === \"ambiguous\"\n ? ` Visible matches: ${resolution.candidates.map(modelKey).join(\", \")}.`\n : \"\";\n return new Error(\n `Model ${JSON.stringify(query)} is not available to this OMP session.${detail} ` +\n 'Use agents.models({ runner: \"omp\" }) to list the models visible to this session.',\n );\n};\n\n/**\n * Resolve an OMP participant selector strictly within the execution owner's\n * visible registry. Exact provider/id keys never fall back to fuzzy matching;\n * aliases and inexact selectors retain the normal Fabric resolution policy.\n */\nexport const resolveAvailableOmpModel = (\n selector: string,\n options: {\n aliases: Record<string, string[]>;\n available: readonly FabricModelCandidate[];\n lastUsed?: FabricModelUsage;\n },\n): FabricModelCandidate => {\n const query = selector.trim();\n const alias = Object.keys(options.aliases).some(\n (name) => name.toLowerCase() === query.toLowerCase(),\n );\n if (PROVIDER_MODEL_RE.test(query) && !alias) {\n const exact = options.available.find(\n (model) => modelKey(model).toLowerCase() === query.toLowerCase(),\n );\n if (exact) return exact;\n throw unavailableOmpModelError(query);\n }\n\n const resolution = resolveFabricModel(query, options);\n if (resolution.kind === \"resolved\" || resolution.kind === \"already-active\") {\n return resolution.model;\n }\n throw unavailableOmpModelError(query, resolution);\n};\n", "import fs from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\nimport { renameAtomic } from \"./core/atomic-write.js\";\nimport { normalizeModelAliases } from \"./core/model-resolution.js\";\nimport { OMP_CORE_TOOL_NAME_SET } from \"./core/omp-tools.js\";\nimport {\n CURRENT_FABRIC_CONFIG_VERSION,\n migrateFabricConfigDocument,\n} from \"./config-migrations.js\";\nimport type { FabricComponentEntry } from \"./components/types.js\";\nimport {\n configureOutputArtifactRetention,\n DEFAULT_OUTPUT_ARTIFACT_RETENTION,\n} from \"./output-budget.js\";\nimport type { FabricRisk } from \"./protocol.js\";\nimport { DEFAULT_FABRIC_THINKING, isFabricThinking, type FabricThinking } from \"./thinking.js\";\nimport {\n defaultCodePreviewSettings,\n normalizeCodePreviewSettings,\n type CodePreviewSettings,\n} from \"./ui/code-preview.js\";\n\ntype FabricApprovalMode = \"allow\" | \"ask\" | \"auto\" | \"deny\";\nexport type FabricAgentTransport =\n | \"auto\"\n | \"process\"\n | \"tmux\"\n | \"screen\"\n | \"localterm\"\n | \"herdr\";\nexport type FabricAgentRunner = \"omp\" | \"claude\" | \"veda\";\nexport type FabricUiWidgetMode = \"auto\" | \"always\" | \"hidden\";\ntype FabricToolDisplayMode = \"full\" | \"compact\";\nexport type FabricResultFormat = \"auto\" | \"yaml\" | \"json\" | \"text\";\nexport type FabricPrewalkMode = \"in-place\" | \"trajectory\";\nexport type FabricExecutorRuntime = \"quickjs\" | \"node-process\" | \"bun-process\";\nexport type FabricConfigScope = \"global\" | \"project\";\ntype FabricCompactionEngine = \"lcm\" | \"omp\";\ntype FabricActorScope = \"project\" | \"session\";\n\ninterface FabricExecutorConfig {\n runtime: FabricExecutorRuntime;\n timeoutMs: number;\n /** Policy maximum for any executor deadline, including per-invocation\n * requests and per-ref floors. Values above this are visibly normalized. */\n maxTimeoutMs: number;\n /** Exact-ref deadline floors (ms) for known long-running host calls, e.g.\n * \"extensions.subagent\". Keys are exact refs; no wildcard matching. */\n hostCallTimeouts: Record<string, number>;\n memoryLimitBytes: number;\n maxOutputChars: number;\n maxNestedResultChars: number;\n resultFormat: FabricResultFormat;\n}\n\nexport interface FabricApprovalConfig {\n read: FabricApprovalMode;\n write: FabricApprovalMode;\n execute: FabricApprovalMode;\n network: FabricApprovalMode;\n agent: FabricApprovalMode;\n model?: string;\n}\n\n/** Session-start background revalidation scope for the MCP descriptor cache:\n * \"changed\" lists only added/reconfigured servers, \"all\" re-lists every known\n * server, \"off\" never spawns servers in the background. */\ntype FabricMcpRevalidatePolicy = \"changed\" | \"all\" | \"off\";\n\ninterface FabricMcpCacheConfig {\n /** Serve MCP tool metadata from the on-disk descriptor cache instead of\n * connecting to every configured server on first discovery each session. */\n enabled: boolean;\n revalidate: FabricMcpRevalidatePolicy;\n /** Wall-clock budget for one session-start background revalidation pass. */\n revalidateBudgetMs: number;\n}\n\nexport interface FabricMcpConfig {\n enabled: boolean;\n configPath?: string;\n disableOAuth: boolean;\n allowDynamicServers: boolean;\n callTimeoutMs: number;\n cache: FabricMcpCacheConfig;\n}\n\ninterface FabricClaudeRunnerConfig {\n binary: string;\n model?: string;\n}\n\n/** Veda CLI options for the `veda` agent runner. The Veda CLI wraps external\n * backends (agy, codex, claude-code, droid, pi, and any backend registered by\n * the installed Veda build); the backend is selected here and the persona\n * controls read-only vs write-capable behavior. */\ninterface FabricVedaRunnerConfig {\n binary: string;\n /** Veda backend to drive. Defaults to the Antigravity CLI (agy). */\n backend: string;\n /** Optional backend-specific model or Veda model alias. */\n model?: string;\n /** Veda persona: navigator-plan, navigator-chat, reviewer, or worker. */\n persona: string;\n}\n\ninterface FabricPrewalkConfig {\n // Master switch, persisted by /fabric prewalk --disable|--enable or the\n // settings UI (absent means enabled). Manual arming, session auto-arm, and\n // boundary claims all gate on it.\n enabled?: boolean;\n mode: FabricPrewalkMode;\n model?: string;\n alwaysRearm: boolean;\n // Compact with the configured engine just before restoring Main's boundary\n // model after an in-place continuation settles.\n compactOnReturn: boolean;\n // Filesystem fallback trigger: when an armed boundary ran a successful\n // omp.bash without an audited mutation, claim on stat-manifest drift so\n // shell heredocs / sed -i / formatter writes also hand off.\n detectShellWrites: boolean;\n // Reasoning effort for the trajectory executor; unset inherits agents.thinking.\n thinking?: FabricThinking;\n handoffRetirement: boolean;\n handoffRetirementKeep: number;\n}\n\nexport interface FabricCodemapConfig {\n enabled: boolean;\n maxFiles: number;\n maxSymbols: number;\n maxMs: number;\n defaultMaxTokens: number;\n cascadeCommits: number;\n cascadeLimit: number;\n}\n\nexport interface FabricAgentConfig {\n enabled: boolean;\n runner: FabricAgentRunner;\n transport: FabricAgentTransport;\n model?: string;\n claude: FabricClaudeRunnerConfig;\n veda: FabricVedaRunnerConfig;\n thinking: FabricThinking;\n maxConcurrent: number;\n maxPerExecution: number;\n maxDepth: number;\n timeoutMs: number;\n extensions: boolean;\n defaultTools: string[];\n retainRuns: boolean;\n notifyOnComplete: boolean;\n budgetUsd: number;\n maxTokensPerChild: number;\n /** Write usage-only OMP-format session files per agent run for external trackers. */\n sessionExport: boolean;\n /** Export store root override; OMP_FABRIC_AGENT_DIR wins over the active agent directory's fabric store. */\n sessionExportDir: string;\n}\n\nexport interface FabricToolCaptureConfig {\n enabled: boolean;\n hideFromModel: boolean;\n keepVisible: string[];\n includeTools: string[];\n excludeTools: string[];\n defaultRisk: FabricRisk;\n risks: Record<string, FabricRisk>;\n}\n\nexport type FabricSchemaMode = \"off\" | \"audit\" | \"enforce\";\n\nexport interface FabricSchemaTrustedCommand {\n command: string;\n args: string[];\n shell: boolean;\n timeoutMs: number;\n}\n\nexport interface FabricSchemaConfig {\n mode: FabricSchemaMode;\n certificateTtlMs: number;\n maxFiles: number;\n maxBytes: number;\n trustedCommands: Record<string, FabricSchemaTrustedCommand>;\n}\n\ninterface FabricUiConfig {\n enabled: boolean;\n widget: FabricUiWidgetMode;\n maxRows: number;\n refreshMs: number;\n eventHistory: number;\n haltOnEscape: boolean;\n showAgentToolPreview: boolean;\n toolDisplay: FabricToolDisplayMode;\n updateDebounceMs: number;\n}\n\ninterface FabricCompactionConfig {\n engine: FabricCompactionEngine;\n summaryModel?: string;\n targetContextRatio: number;\n softThresholdRatio: number;\n hardThresholdRatio: number;\n thresholds: Record<string, number>;\n tokenThresholds: Record<string, number>;\n lcmMaxInputChars: number;\n lcmMaxOutputTokens: number;\n lcmMaxOutputChars: number;\n lcmMaxLeafEntries: number;\n lcmMaxCondenseChildren: number;\n lcmMaintenancePasses: number;\n lcmMaintenanceConcurrency: number;\n lcmModelSummaries: boolean;\n lcmModelTimeoutSeconds: number;\n lcmMaxDailyModelCalls: number;\n lcmMaxSessionModelCalls: number;\n lcmMaxDailyModelSeconds: number;\n}\n\nexport const MIN_COMPACTION_TOKEN_THRESHOLD = 1_000;\nexport const MAX_COMPACTION_TOKEN_THRESHOLD = 100_000_000;\nexport const MIN_COMPACTION_RATIO_THRESHOLD = 0.25;\nexport const MAX_COMPACTION_RATIO_THRESHOLD = 0.95;\n\nexport const clampCompactionTokenThreshold = (value: number): number =>\n Math.min(\n MAX_COMPACTION_TOKEN_THRESHOLD,\n Math.max(MIN_COMPACTION_TOKEN_THRESHOLD, Math.round(value)),\n );\n\nexport const clampCompactionRatioThreshold = (value: number): number =>\n Math.min(\n MAX_COMPACTION_RATIO_THRESHOLD,\n Math.max(MIN_COMPACTION_RATIO_THRESHOLD, value),\n );\n\nconst MIN_SOFT_THRESHOLD_RATIO = 0.1;\nconst MAX_SOFT_THRESHOLD_RATIO = 0.95;\nconst MIN_HARD_THRESHOLD_RATIO = 0.2;\nconst MAX_HARD_THRESHOLD_RATIO = 0.98;\nconst SOFT_BELOW_HARD_MARGIN = 0.05;\n\nconst clampSoftThresholdRatio = (value: number): number =>\n value <= 0\n ? 0\n : Math.min(MAX_SOFT_THRESHOLD_RATIO, Math.max(MIN_SOFT_THRESHOLD_RATIO, value));\n\nconst THRESHOLD_RATIO_STEPS_PER_UNIT = 20;\n\nconst roundThresholdRatio = (value: number): number =>\n Math.round(value * THRESHOLD_RATIO_STEPS_PER_UNIT) / THRESHOLD_RATIO_STEPS_PER_UNIT;\n\nconst clampHardThresholdRatio = (value: number): number =>\n value <= 0\n ? 0\n : Math.min(MAX_HARD_THRESHOLD_RATIO, Math.max(MIN_HARD_THRESHOLD_RATIO, value));\n\nconst reconcileThresholdRatios = (\n soft: number,\n hard: number,\n): { soft: number; hard: number } => {\n const clampedHard = clampHardThresholdRatio(hard);\n const clampedSoft = clampSoftThresholdRatio(soft);\n if (clampedHard > 0 && clampedSoft > 0 && clampedSoft >= clampedHard) {\n return {\n soft: clampSoftThresholdRatio(\n roundThresholdRatio(clampedHard - SOFT_BELOW_HARD_MARGIN),\n ),\n hard: clampedHard,\n };\n }\n return { soft: clampedSoft, hard: clampedHard };\n};\n\nexport interface FabricRetentionConfig {\n orphanedTempRunMs: number;\n oneShotRunMs: number;\n actorRunArchiveMs: number;\n outputArtifactMs: number;\n outputArtifactMaxBytes: number;\n}\n\nexport interface FabricMeshConfig {\n enabled: boolean;\n root?: string;\n actorScope: FabricActorScope;\n maxEventBytes: number;\n maxReadEvents: number;\n actorPollMs: number;\n actorQueueLimit: number;\n eventContextChars: number;\n actorContextEntries: number;\n}\n\ninterface FabricRepairsConfig {\n enabled: boolean;\n}\n\ninterface FabricEntropyConfig {\n compile: boolean;\n}\n\ninterface FabricUpdateConfig {\n check: boolean;\n}\n\nexport interface FabricMemoryConfig {\n enabled: boolean;\n indexDir?: string;\n maxSessions: number;\n maxEntryChars: number;\n indexThinking: boolean;\n indexToolOutput: boolean;\n hotSessions?: number;\n digestTerms?: number;\n maxColdVocabularyBytes?: number;\n maxColdCacheBytes?: number;\n maxSyncSessions?: number;\n maxSyncSourceBytes?: number;\n maxCacheCleanupFiles?: number;\n regexMaxPatternBytes?: number;\n regexMaxHaystackTerms?: number;\n regexMaxHaystackBytes?: number;\n regexTimeoutMs?: number;\n}\n\nexport interface FabricSpeculationConfig {\n /** Master switch for speculative programmatic tool calling during streaming. */\n enabled: boolean;\n /** Maximum simultaneously in-flight speculative calls; excess candidates are dropped. */\n maxConcurrent: number;\n /** Maximum retained unserved speculation entries per turn. */\n maxEntries: number;\n /** Per-stream cap on buffered partial tool-call arguments while extracting the `code` field. */\n maxBufferBytes: number;\n /** Unserved speculation entries older than this are aborted and discarded. */\n entryTtlMs: number;\n /**\n * Tier B: MCP tools that may be speculated despite risk \"network\". Entries\n * are `server.tool` or `server.*` and match the ref after the `mcp.` prefix.\n * Only enable for tools the operator knows are read-only; cached MCP\n * annotations with destructiveHint=true always refuse.\n */\n mcpAllowlist: string[];\n}\n\n\nexport interface FabricJudgmentGatesConfig {\n /** Judge a core or captured tool call before it runs. */\n toolExec: boolean;\n /** Judge fetched tool output before it enters the model's context. */\n toolOutput: boolean;\n /** Judge which agent kind and effort a delegated run should take. */\n delegation: boolean;\n /** Rank the skill roster for the turn before the model reads it. */\n skills: boolean;\n}\n\nexport interface FabricJudgmentConfig {\n /** Master switch for typed judgments; off leaves every `judgment.*` call unanswered. */\n enabled: boolean;\n /** Window in which judgments over the same state merge into one backend request. */\n coalesceMs: number;\n /** Deadline for one backend request; a slower answer is discarded. */\n timeoutMs: number;\n /** Backend requests allowed in flight at once; a further batch waits for a slot. */\n maxConcurrent: number;\n /** Questions one request may carry; a larger ask is refused rather than split blindly. */\n maxQuestionsPerRequest: number;\n /** Byte ceiling on the judged state; a larger state is refused rather than truncated. */\n maxStateBytes: number;\n /** Per-gate switches; every gate ships off and is turned on one at a time. */\n gates: FabricJudgmentGatesConfig;\n}\n\nexport interface FabricModelsConfig {\n /** Alias name \u2192 ordered provider/model fallback chain, first available wins. */\n aliases: Record<string, string[]>;\n}\n\nexport interface FabricConfig {\n fullCodeMode: boolean;\n executor: FabricExecutorConfig;\n approvals: FabricApprovalConfig;\n mcp: FabricMcpConfig;\n prewalk: FabricPrewalkConfig;\n codemap: FabricCodemapConfig;\n agents: FabricAgentConfig;\n models: FabricModelsConfig;\n components: FabricComponentEntry[];\n capture: FabricToolCaptureConfig;\n ui: FabricUiConfig;\n compaction: FabricCompactionConfig;\n retention: FabricRetentionConfig;\n mesh: FabricMeshConfig;\n memory: FabricMemoryConfig;\n entropy: FabricEntropyConfig;\n repairs: FabricRepairsConfig;\n update: FabricUpdateConfig;\n schema: FabricSchemaConfig;\n speculation: FabricSpeculationConfig;\n judgment: FabricJudgmentConfig;\n codePreview: CodePreviewSettings;\n}\n\n/** Hard implementation maximum for any executor deadline. Policy ceilings\n * (executor.maxTimeoutMs) may be raised up to this value by administrators. */\nexport const MAX_EXECUTOR_TIMEOUT_MS = 24 * 3_600_000;\n\nexport const MIN_AGENT_TIMEOUT_MS = 1_000;\nconst DEFAULT_AGENT_TIMEOUT_MS = 3_600_000;\nexport const MAX_AGENT_TIMEOUT_MS = 24 * 3_600_000;\nexport const QUICKJS_MAX_MEMORY_LIMIT_BYTES = 0xffff_ffff;\nexport const MAX_EXECUTOR_MEMORY_LIMIT_BYTES = Math.max(\n 8 * 1024 * 1024,\n Math.min(Number.MAX_SAFE_INTEGER, Math.floor(os.totalmem())),\n);\n\nexport const maxExecutorMemoryLimitBytes = (runtime: FabricExecutorRuntime): number =>\n runtime === \"quickjs\"\n ? Math.min(QUICKJS_MAX_MEMORY_LIMIT_BYTES, MAX_EXECUTOR_MEMORY_LIMIT_BYTES)\n : MAX_EXECUTOR_MEMORY_LIMIT_BYTES;\n\nexport const DEFAULT_FABRIC_CONFIG: FabricConfig = {\n fullCodeMode: true,\n executor: {\n runtime: \"quickjs\",\n timeoutMs: 120_000,\n maxTimeoutMs: 900_000,\n hostCallTimeouts: {},\n memoryLimitBytes: 256 * 1024 * 1024,\n maxOutputChars: 50_000,\n maxNestedResultChars: 2_000_000,\n resultFormat: \"auto\",\n },\n approvals: {\n read: \"allow\",\n write: \"allow\",\n execute: \"allow\",\n network: \"allow\",\n agent: \"allow\",\n },\n mcp: {\n enabled: true,\n disableOAuth: true,\n allowDynamicServers: true,\n callTimeoutMs: 90_000,\n cache: {\n enabled: true,\n revalidate: \"changed\",\n revalidateBudgetMs: 60_000,\n },\n },\n prewalk: {\n mode: \"in-place\",\n alwaysRearm: false,\n compactOnReturn: true,\n detectShellWrites: true,\n handoffRetirement: true,\n handoffRetirementKeep: 3,\n },\n codemap: {\n enabled: true,\n maxFiles: 4_000,\n maxSymbols: 40_000,\n maxMs: 30_000,\n defaultMaxTokens: 8_000,\n cascadeCommits: 600,\n cascadeLimit: 24,\n },\n agents: {\n enabled: true,\n runner: \"omp\",\n transport: \"process\",\n claude: { binary: \"claude\" },\n veda: { binary: \"veda\", backend: \"agy\", persona: \"navigator-chat\" },\n thinking: DEFAULT_FABRIC_THINKING,\n maxConcurrent: 8,\n maxPerExecution: 100,\n maxDepth: 3,\n timeoutMs: DEFAULT_AGENT_TIMEOUT_MS,\n extensions: true,\n defaultTools: [\"read\", \"bash\", \"edit\", \"write\", \"grep\", \"find\"],\n retainRuns: false,\n notifyOnComplete: true,\n budgetUsd: 0,\n maxTokensPerChild: 0,\n sessionExport: true,\n sessionExportDir: \"\",\n },\n components: [],\n capture: {\n enabled: true,\n hideFromModel: true,\n keepVisible: [\"fabric_exec\"],\n includeTools: [],\n excludeTools: [],\n defaultRisk: \"execute\",\n risks: {\n read: \"read\",\n grep: \"read\",\n find: \"read\",\n ls: \"read\",\n edit: \"write\",\n write: \"write\",\n bash: \"execute\",\n fovea_sketch: \"read\",\n fovea_focus: \"read\",\n fovea_dwell: \"read\",\n fovea_impact: \"read\",\n },\n },\n ui: {\n enabled: true,\n widget: \"auto\",\n maxRows: 10,\n refreshMs: 500,\n eventHistory: 80,\n haltOnEscape: true,\n showAgentToolPreview: true,\n toolDisplay: \"compact\",\n updateDebounceMs: 100,\n },\n compaction: {\n engine: \"lcm\",\n targetContextRatio: 0.75,\n softThresholdRatio: 0.55,\n hardThresholdRatio: 0,\n thresholds: {},\n tokenThresholds: {},\n lcmMaxInputChars: 200_000,\n lcmMaxOutputTokens: 4_096,\n lcmMaxOutputChars: 16_384,\n lcmMaxLeafEntries: 32,\n lcmMaxCondenseChildren: 4,\n lcmMaintenancePasses: 8,\n lcmMaintenanceConcurrency: 3,\n lcmModelSummaries: true,\n lcmModelTimeoutSeconds: 120,\n lcmMaxDailyModelCalls: 0,\n lcmMaxSessionModelCalls: 0,\n lcmMaxDailyModelSeconds: 0,\n },\n retention: {\n orphanedTempRunMs: 6 * 60 * 60 * 1_000,\n oneShotRunMs: 24 * 60 * 60 * 1_000,\n actorRunArchiveMs: 7 * 24 * 60 * 60 * 1_000,\n outputArtifactMs: DEFAULT_OUTPUT_ARTIFACT_RETENTION.maxAgeMs,\n outputArtifactMaxBytes: DEFAULT_OUTPUT_ARTIFACT_RETENTION.maxBytes,\n },\n mesh: {\n enabled: true,\n actorScope: \"project\",\n maxEventBytes: 256 * 1024,\n maxReadEvents: 500,\n actorPollMs: 250,\n actorQueueLimit: 32,\n eventContextChars: 40_000,\n actorContextEntries: 14,\n },\n models: {\n aliases: {},\n },\n memory: {\n enabled: true,\n maxSessions: 500,\n maxEntryChars: 2_000,\n indexThinking: true,\n indexToolOutput: true,\n hotSessions: 100,\n digestTerms: 200,\n maxColdVocabularyBytes: 512 * 1024,\n maxColdCacheBytes: 1024 * 1024,\n maxSyncSessions: 10_000,\n maxSyncSourceBytes: 512 * 1024 * 1024,\n maxCacheCleanupFiles: 100_000,\n regexMaxPatternBytes: 1_024,\n regexMaxHaystackTerms: 20_000,\n regexMaxHaystackBytes: 2 * 1024 * 1024,\n regexTimeoutMs: 250,\n },\n entropy: {\n compile: true,\n },\n repairs: {\n enabled: true,\n },\n update: {\n check: true,\n },\n schema: {\n mode: \"off\",\n certificateTtlMs: 30_000,\n maxFiles: 100,\n maxBytes: 10 * 1024 * 1024,\n trustedCommands: {},\n },\n speculation: {\n enabled: true,\n maxConcurrent: 10,\n maxEntries: 64,\n maxBufferBytes: 2 * 1024 * 1024,\n entryTtlMs: 180_000,\n mcpAllowlist: [],\n },\n judgment: {\n enabled: true,\n coalesceMs: 8,\n timeoutMs: 8_000,\n maxConcurrent: 8,\n maxQuestionsPerRequest: 32,\n maxStateBytes: 64 * 1024,\n gates: {\n toolExec: false,\n toolOutput: false,\n delegation: false,\n skills: false,\n },\n },\n codePreview: defaultCodePreviewSettings(),\n};\n\ninterface JsonObjectFile {\n document: Record<string, unknown>;\n source: string;\n}\n\nconst readJsonObjectFile = (filePath: string): JsonObjectFile | undefined => {\n try {\n const source = fs.readFileSync(filePath, \"utf8\");\n const parsed: unknown = JSON.parse(source);\n if (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) {\n throw new Error(\"configuration root must be an object\");\n }\n return { document: parsed as Record<string, unknown>, source };\n } catch (error) {\n if (error instanceof Error && \"code\" in error && error.code === \"ENOENT\") return undefined;\n const message = error instanceof Error ? error.message : String(error);\n throw new Error(`Failed to read ${filePath}: ${message}`);\n }\n};\n\nconst readJsonObject = (filePath: string): Record<string, unknown> | undefined =>\n readJsonObjectFile(filePath)?.document;\n\nconst mergeObjects = (\n base: Record<string, unknown>,\n override: Record<string, unknown>,\n): Record<string, unknown> => {\n const merged = { ...base };\n for (const [key, value] of Object.entries(override)) {\n const baseValue = merged[key];\n if (\n typeof baseValue === \"object\" &&\n baseValue !== null &&\n !Array.isArray(baseValue) &&\n typeof value === \"object\" &&\n value !== null &&\n !Array.isArray(value)\n ) {\n merged[key] = mergeObjects(\n baseValue as Record<string, unknown>,\n value as Record<string, unknown>,\n );\n } else {\n merged[key] = value;\n }\n }\n return merged;\n};\n\nconst approvalMode = (value: unknown, fallback: FabricApprovalMode): FabricApprovalMode =>\n value === \"allow\" || value === \"ask\" || value === \"auto\" || value === \"deny\"\n ? value\n : fallback;\n\nconst booleanValue = (value: unknown, fallback: boolean): boolean =>\n typeof value === \"boolean\" ? value : fallback;\n\nconst boundedInteger = (value: unknown, fallback: number, min: number, max: number): number =>\n typeof value === \"number\" && Number.isInteger(value)\n ? Math.max(min, Math.min(max, value))\n : fallback;\n\nconst boundedFloat = (value: unknown, fallback: number, min: number, max: number): number =>\n typeof value === \"number\" && Number.isFinite(value)\n ? Math.max(min, Math.min(max, value))\n : fallback;\n\nconst stringValue = (value: unknown): string | undefined =>\n typeof value === \"string\" && value.trim() ? value : undefined;\n\nconst runnerValue = (value: unknown, fallback: FabricAgentRunner): FabricAgentRunner =>\n value === \"omp\" || value === \"claude\" || value === \"veda\" ? value : fallback;\n\nconst prewalkModeValue = (\n value: unknown,\n fallback: FabricPrewalkMode,\n): FabricPrewalkMode =>\n value === \"in-place\" || value === \"trajectory\" ? value : fallback;\n\nconst transportValue = (\n value: unknown,\n fallback: FabricAgentTransport,\n): FabricAgentTransport =>\n value === \"auto\" ||\n value === \"process\" ||\n value === \"tmux\" ||\n value === \"screen\" ||\n value === \"localterm\" ||\n value === \"herdr\"\n ? value\n : fallback;\n\nconst thinkingValue = (value: unknown, fallback: FabricThinking): FabricThinking =>\n isFabricThinking(value) ? value : fallback;\n\nconst objectValue = (value: unknown): Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : {};\n\nconst widgetModeValue = (value: unknown, fallback: FabricUiWidgetMode): FabricUiWidgetMode =>\n value === \"auto\" || value === \"always\" || value === \"hidden\" ? value : fallback;\n\nconst toolDisplayModeValue = (\n value: unknown,\n fallback: FabricToolDisplayMode,\n): FabricToolDisplayMode => value === \"full\" || value === \"compact\" ? value : fallback;\n\nconst executorRuntimeValue = (\n value: unknown,\n fallback: FabricExecutorRuntime,\n): FabricExecutorRuntime =>\n value === \"quickjs\" || value === \"node-process\" || value === \"bun-process\" ? value : fallback;\n\nconst resultFormatValue = (\n value: unknown,\n fallback: FabricResultFormat,\n): FabricResultFormat =>\n value === \"auto\" || value === \"yaml\" || value === \"json\" || value === \"text\"\n ? value\n : fallback;\n\nconst compactionEngineValue = (\n value: unknown,\n fallback: FabricCompactionEngine,\n): FabricCompactionEngine =>\n value === \"omp\" || value === \"lcm\" ? value : fallback;\n\nconst actorScopeValue = (value: unknown, fallback: FabricActorScope): FabricActorScope =>\n value === \"project\" || value === \"session\" ? value : fallback;\n\nconst schemaModeValue = (value: unknown, fallback: FabricSchemaMode): FabricSchemaMode =>\n value === \"off\" || value === \"audit\" || value === \"enforce\" ? value : fallback;\n\nconst mcpRevalidatePolicyValue = (\n value: unknown,\n fallback: FabricMcpRevalidatePolicy,\n): FabricMcpRevalidatePolicy =>\n value === \"changed\" || value === \"all\" || value === \"off\" ? value : fallback;\n\nconst riskValue = (value: unknown, fallback: FabricRisk): FabricRisk =>\n value === \"read\" ||\n value === \"write\" ||\n value === \"execute\" ||\n value === \"network\" ||\n value === \"agent\"\n ? value\n : fallback;\n\nexport const normalizeFabricConfig = (input: Record<string, unknown>): FabricConfig => {\n const executor = objectValue(input.executor);\n const executorMaxTimeoutMs = boundedInteger(\n executor.maxTimeoutMs,\n DEFAULT_FABRIC_CONFIG.executor.maxTimeoutMs,\n 1_000,\n MAX_EXECUTOR_TIMEOUT_MS,\n );\n const approvals = objectValue(input.approvals);\n const mcp = objectValue(input.mcp);\n const mcpCache = objectValue(mcp.cache);\n const prewalk = objectValue(input.prewalk);\n const codemap = objectValue(input.codemap);\n const agents = objectValue(input.agents);\n const claude = objectValue(agents.claude);\n const veda = objectValue(agents.veda);\n const capture = objectValue(input.capture);\n const toolPolicy = objectValue(input.toolPolicy);\n const ui = objectValue(input.ui);\n const compaction = objectValue(input.compaction);\n const summaryModel = stringValue(compaction.summaryModel);\n const retention = objectValue(input.retention);\n const mesh = objectValue(input.mesh);\n const memory = objectValue(input.memory);\n const entropy = objectValue(input.entropy);\n const repairs = objectValue(input.repairs);\n const update = objectValue(input.update);\n const modelsSection = objectValue(input.models);\n const schema = objectValue(input.schema);\n const schemaMode = schemaModeValue(schema.mode, DEFAULT_FABRIC_CONFIG.schema.mode);\n const speculation = objectValue(input.speculation);\n const judgment = objectValue(input.judgment);\n const judgmentGates = objectValue(judgment.gates);\n const configuredExecutorRuntime = executorRuntimeValue(\n executor.runtime,\n DEFAULT_FABRIC_CONFIG.executor.runtime,\n );\n const executorRuntime = schemaMode === \"enforce\" ? \"quickjs\" : configuredExecutorRuntime;\n const configuredTools = Array.isArray(agents.defaultTools)\n ? agents.defaultTools.filter(\n (tool): tool is string => typeof tool === \"string\" && Boolean(tool),\n )\n : DEFAULT_FABRIC_CONFIG.agents.defaultTools;\n const approvalModel = stringValue(approvals.model);\n const configPath = stringValue(mcp.configPath);\n const meshRoot = stringValue(mesh.root);\n const memoryIndexDir = stringValue(memory.indexDir);\n const compactionThresholds = Object.fromEntries(\n Object.entries(objectValue(compaction.thresholds))\n .filter(([model, threshold]) =>\n model.includes(\"/\")\n && typeof threshold === \"number\"\n && Number.isFinite(threshold),\n )\n .map(([model, threshold]) => [\n model,\n clampCompactionRatioThreshold(threshold as number),\n ]),\n );\n const compactionTokenThresholds = Object.fromEntries(\n Object.entries(objectValue(compaction.tokenThresholds))\n .filter(([model, tokens]) =>\n model.includes(\"/\")\n && typeof tokens === \"number\"\n && Number.isFinite(tokens),\n )\n .map(([model, tokens]) => [\n model,\n clampCompactionTokenThreshold(tokens as number),\n ]),\n );\n const thresholdRatios = reconcileThresholdRatios(\n typeof compaction.softThresholdRatio === \"number\" && Number.isFinite(compaction.softThresholdRatio)\n ? compaction.softThresholdRatio\n : DEFAULT_FABRIC_CONFIG.compaction.softThresholdRatio,\n typeof compaction.hardThresholdRatio === \"number\" && Number.isFinite(compaction.hardThresholdRatio)\n ? compaction.hardThresholdRatio\n : DEFAULT_FABRIC_CONFIG.compaction.hardThresholdRatio,\n );\n const prewalkModel = stringValue(prewalk.model);\n const prewalkThinking = isFabricThinking(prewalk.thinking) ? prewalk.thinking : undefined;\n const agentModel = stringValue(agents.model);\n const claudeBinary = stringValue(claude.binary);\n const claudeModel = stringValue(claude.model);\n const vedaBinary = stringValue(veda.binary);\n const vedaBackend = stringValue(veda.backend);\n const vedaModel = stringValue(veda.model);\n const vedaPersona = stringValue(veda.persona);\n const agentThinking = thinkingValue(agents.thinking, DEFAULT_FABRIC_CONFIG.agents.thinking);\n const configuredComponents: FabricComponentEntry[] = Array.isArray(input.components)\n ? input.components.flatMap((raw) => {\n const componentEntry = objectValue(raw);\n const id = stringValue(componentEntry.id);\n const component = stringValue(componentEntry.component);\n if (!id || !component) return [];\n return [{\n id,\n component,\n ...(Object.prototype.hasOwnProperty.call(componentEntry, \"config\")\n ? { config: componentEntry.config }\n : {}),\n ...(typeof componentEntry.disabled === \"boolean\"\n ? { disabled: componentEntry.disabled }\n : {}),\n }];\n }).slice(0, 256)\n : DEFAULT_FABRIC_CONFIG.components;\n const configuredVisible = Array.isArray(capture.keepVisible)\n ? capture.keepVisible.filter(\n (name): name is string => typeof name === \"string\" && Boolean(name.trim()),\n )\n : DEFAULT_FABRIC_CONFIG.capture.keepVisible;\n const configuredIncluded = Array.isArray(capture.includeTools)\n ? capture.includeTools.filter(\n (name): name is string => typeof name === \"string\" && Boolean(name.trim()),\n )\n : DEFAULT_FABRIC_CONFIG.capture.includeTools;\n const configuredExcluded = Array.isArray(capture.excludeTools)\n ? capture.excludeTools.filter(\n (name): name is string => typeof name === \"string\" && Boolean(name.trim()),\n )\n : DEFAULT_FABRIC_CONFIG.capture.excludeTools;\n const configuredRisks = {\n ...DEFAULT_FABRIC_CONFIG.capture.risks,\n ...objectValue(capture.risks),\n };\n const trustedCommands = Object.fromEntries(\n Object.entries(objectValue(schema.trustedCommands)).flatMap(([name, raw]) => {\n if (!/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,63}$/.test(name)) return [];\n const command = objectValue(raw);\n const executable = stringValue(command.command);\n if (!executable) return [];\n const shell = booleanValue(command.shell, false);\n const args = !shell && Array.isArray(command.args)\n ? command.args.filter((arg): arg is string => typeof arg === \"string\").slice(0, 64)\n : [];\n return [[name, {\n command: executable,\n args,\n shell,\n timeoutMs: boundedInteger(command.timeoutMs, 30_000, 1, 300_000),\n } satisfies FabricSchemaTrustedCommand]];\n }),\n );\n const risks = Object.fromEntries(\n Object.entries(configuredRisks)\n .filter(([name]) => Boolean(name.trim()))\n .map(([name, risk]) => [name, riskValue(risk, DEFAULT_FABRIC_CONFIG.capture.defaultRisk)]),\n );\n\n return {\n fullCodeMode: booleanValue(input.fullCodeMode, DEFAULT_FABRIC_CONFIG.fullCodeMode),\n executor: {\n runtime: executorRuntime,\n maxTimeoutMs: boundedInteger(\n executor.maxTimeoutMs,\n DEFAULT_FABRIC_CONFIG.executor.maxTimeoutMs,\n 1_000,\n MAX_EXECUTOR_TIMEOUT_MS,\n ),\n hostCallTimeouts: Object.fromEntries(\n Object.entries(objectValue(executor.hostCallTimeouts))\n .filter(([ref, value]) =>\n typeof ref === \"string\" &&\n Boolean(ref.trim()) &&\n typeof value === \"number\" &&\n Number.isFinite(value) &&\n value >= 1,\n )\n .map(([ref, value]) => [ref, boundedInteger(value, 1_000, 1_000, executorMaxTimeoutMs)]),\n ),\n timeoutMs: boundedInteger(\n executor.timeoutMs,\n DEFAULT_FABRIC_CONFIG.executor.timeoutMs,\n 1_000,\n executorMaxTimeoutMs,\n ),\n memoryLimitBytes: boundedInteger(\n executor.memoryLimitBytes,\n DEFAULT_FABRIC_CONFIG.executor.memoryLimitBytes,\n 8 * 1024 * 1024,\n maxExecutorMemoryLimitBytes(executorRuntime),\n ),\n maxOutputChars: boundedInteger(\n executor.maxOutputChars,\n DEFAULT_FABRIC_CONFIG.executor.maxOutputChars,\n 1_000,\n 1_000_000,\n ),\n maxNestedResultChars: boundedInteger(\n executor.maxNestedResultChars,\n DEFAULT_FABRIC_CONFIG.executor.maxNestedResultChars,\n 10_000,\n 20_000_000,\n ),\n resultFormat: resultFormatValue(\n executor.resultFormat,\n DEFAULT_FABRIC_CONFIG.executor.resultFormat,\n ),\n },\n approvals: {\n read: approvalMode(approvals.read, DEFAULT_FABRIC_CONFIG.approvals.read),\n write: approvalMode(approvals.write, DEFAULT_FABRIC_CONFIG.approvals.write),\n execute: approvalMode(approvals.execute, DEFAULT_FABRIC_CONFIG.approvals.execute),\n network: approvalMode(approvals.network, DEFAULT_FABRIC_CONFIG.approvals.network),\n agent: approvalMode(approvals.agent, DEFAULT_FABRIC_CONFIG.approvals.agent),\n ...(approvalModel ? { model: approvalModel } : {}),\n },\n mcp: {\n enabled: booleanValue(mcp.enabled, DEFAULT_FABRIC_CONFIG.mcp.enabled),\n ...(configPath ? { configPath } : {}),\n disableOAuth: booleanValue(mcp.disableOAuth, DEFAULT_FABRIC_CONFIG.mcp.disableOAuth),\n allowDynamicServers: booleanValue(\n mcp.allowDynamicServers,\n DEFAULT_FABRIC_CONFIG.mcp.allowDynamicServers,\n ),\n callTimeoutMs: boundedInteger(\n mcp.callTimeoutMs,\n DEFAULT_FABRIC_CONFIG.mcp.callTimeoutMs,\n 1_000,\n 900_000,\n ),\n cache: {\n enabled: booleanValue(mcpCache.enabled, DEFAULT_FABRIC_CONFIG.mcp.cache.enabled),\n revalidate: mcpRevalidatePolicyValue(\n mcpCache.revalidate,\n DEFAULT_FABRIC_CONFIG.mcp.cache.revalidate,\n ),\n revalidateBudgetMs: boundedInteger(\n mcpCache.revalidateBudgetMs,\n DEFAULT_FABRIC_CONFIG.mcp.cache.revalidateBudgetMs,\n 1_000,\n 600_000,\n ),\n },\n },\n prewalk: {\n ...(prewalk.enabled === false ? { enabled: false } : {}),\n mode: prewalkModeValue(prewalk.mode, DEFAULT_FABRIC_CONFIG.prewalk.mode),\n ...(prewalkModel ? { model: prewalkModel } : {}),\n ...(prewalkThinking ? { thinking: prewalkThinking } : {}),\n alwaysRearm: booleanValue(\n prewalk.alwaysRearm,\n DEFAULT_FABRIC_CONFIG.prewalk.alwaysRearm,\n ),\n compactOnReturn: booleanValue(\n prewalk.compactOnReturn,\n DEFAULT_FABRIC_CONFIG.prewalk.compactOnReturn,\n ),\n handoffRetirement: booleanValue(\n prewalk.handoffRetirement,\n DEFAULT_FABRIC_CONFIG.prewalk.handoffRetirement,\n ),\n handoffRetirementKeep: boundedInteger(\n prewalk.handoffRetirementKeep,\n DEFAULT_FABRIC_CONFIG.prewalk.handoffRetirementKeep,\n 0,\n 64,\n ),\n detectShellWrites: booleanValue(\n prewalk.detectShellWrites,\n DEFAULT_FABRIC_CONFIG.prewalk.detectShellWrites,\n ),\n },\n codemap: {\n enabled: booleanValue(codemap.enabled, DEFAULT_FABRIC_CONFIG.codemap.enabled),\n maxFiles: boundedInteger(\n codemap.maxFiles,\n DEFAULT_FABRIC_CONFIG.codemap.maxFiles,\n 1,\n 1_000_000,\n ),\n maxSymbols: boundedInteger(\n codemap.maxSymbols,\n DEFAULT_FABRIC_CONFIG.codemap.maxSymbols,\n 1,\n 5_000_000,\n ),\n maxMs: boundedInteger(\n codemap.maxMs,\n DEFAULT_FABRIC_CONFIG.codemap.maxMs,\n 1_000,\n 600_000,\n ),\n defaultMaxTokens: boundedInteger(\n codemap.defaultMaxTokens,\n DEFAULT_FABRIC_CONFIG.codemap.defaultMaxTokens,\n 200,\n 200_000,\n ),\n cascadeCommits: boundedInteger(\n codemap.cascadeCommits,\n DEFAULT_FABRIC_CONFIG.codemap.cascadeCommits,\n 10,\n 20_000,\n ),\n cascadeLimit: boundedInteger(\n codemap.cascadeLimit,\n DEFAULT_FABRIC_CONFIG.codemap.cascadeLimit,\n 1,\n 200,\n ),\n },\n agents: {\n enabled: booleanValue(agents.enabled, DEFAULT_FABRIC_CONFIG.agents.enabled),\n runner: runnerValue(agents.runner, DEFAULT_FABRIC_CONFIG.agents.runner),\n transport: transportValue(agents.transport, DEFAULT_FABRIC_CONFIG.agents.transport),\n ...(agentModel ? { model: agentModel } : {}),\n claude: {\n binary: claudeBinary ?? DEFAULT_FABRIC_CONFIG.agents.claude.binary,\n ...(claudeModel ? { model: claudeModel } : {}),\n },\n veda: {\n binary: vedaBinary ?? DEFAULT_FABRIC_CONFIG.agents.veda.binary,\n backend: vedaBackend ?? DEFAULT_FABRIC_CONFIG.agents.veda.backend,\n ...(vedaModel ? { model: vedaModel } : {}),\n persona: vedaPersona ?? DEFAULT_FABRIC_CONFIG.agents.veda.persona,\n },\n thinking: agentThinking,\n maxConcurrent: boundedInteger(\n agents.maxConcurrent,\n DEFAULT_FABRIC_CONFIG.agents.maxConcurrent,\n 1,\n 32,\n ),\n maxPerExecution: boundedInteger(\n agents.maxPerExecution,\n DEFAULT_FABRIC_CONFIG.agents.maxPerExecution,\n 1,\n 1_000,\n ),\n maxDepth: boundedInteger(\n agents.maxDepth,\n DEFAULT_FABRIC_CONFIG.agents.maxDepth,\n 0,\n Number.MAX_SAFE_INTEGER,\n ),\n timeoutMs: boundedInteger(\n agents.timeoutMs,\n DEFAULT_FABRIC_CONFIG.agents.timeoutMs,\n MIN_AGENT_TIMEOUT_MS,\n MAX_AGENT_TIMEOUT_MS,\n ),\n extensions: booleanValue(agents.extensions, DEFAULT_FABRIC_CONFIG.agents.extensions),\n defaultTools: configuredTools,\n retainRuns: booleanValue(agents.retainRuns, DEFAULT_FABRIC_CONFIG.agents.retainRuns),\n notifyOnComplete: booleanValue(\n agents.notifyOnComplete,\n DEFAULT_FABRIC_CONFIG.agents.notifyOnComplete,\n ),\n budgetUsd: boundedFloat(\n agents.budgetUsd,\n DEFAULT_FABRIC_CONFIG.agents.budgetUsd,\n 0,\n 1_000_000,\n ),\n maxTokensPerChild: boundedInteger(\n agents.maxTokensPerChild,\n DEFAULT_FABRIC_CONFIG.agents.maxTokensPerChild,\n 0,\n 100_000_000,\n ),\n sessionExport: booleanValue(\n agents.sessionExport,\n DEFAULT_FABRIC_CONFIG.agents.sessionExport,\n ),\n sessionExportDir:\n typeof agents.sessionExportDir === \"string\"\n ? agents.sessionExportDir\n : DEFAULT_FABRIC_CONFIG.agents.sessionExportDir,\n },\n components: configuredComponents.map((entry) => structuredClone(entry)),\n capture: {\n enabled: booleanValue(capture.enabled, DEFAULT_FABRIC_CONFIG.capture.enabled),\n hideFromModel: booleanValue(\n capture.hideFromModel,\n DEFAULT_FABRIC_CONFIG.capture.hideFromModel,\n ),\n keepVisible: [...new Set(configuredVisible)],\n includeTools: [...new Set(configuredIncluded)],\n excludeTools: [...new Set(configuredExcluded)],\n defaultRisk: riskValue(capture.defaultRisk, DEFAULT_FABRIC_CONFIG.capture.defaultRisk),\n risks,\n },\n ui: {\n enabled: booleanValue(ui.enabled, DEFAULT_FABRIC_CONFIG.ui.enabled),\n widget: widgetModeValue(ui.widget, DEFAULT_FABRIC_CONFIG.ui.widget),\n maxRows: boundedInteger(ui.maxRows, DEFAULT_FABRIC_CONFIG.ui.maxRows, 1, 20),\n refreshMs: boundedInteger(ui.refreshMs, DEFAULT_FABRIC_CONFIG.ui.refreshMs, 100, 10_000),\n eventHistory: boundedInteger(\n ui.eventHistory,\n DEFAULT_FABRIC_CONFIG.ui.eventHistory,\n 1,\n 500,\n ),\n haltOnEscape: booleanValue(ui.haltOnEscape, DEFAULT_FABRIC_CONFIG.ui.haltOnEscape),\n // Renamed from ui.showNestedToolCalls; the v2 migration rewrites persisted\n // files, and this fallback covers configs normalized without migration.\n showAgentToolPreview: booleanValue(\n ui.showAgentToolPreview ?? ui.showNestedToolCalls,\n DEFAULT_FABRIC_CONFIG.ui.showAgentToolPreview,\n ),\n toolDisplay: toolDisplayModeValue(\n ui.toolDisplay,\n DEFAULT_FABRIC_CONFIG.ui.toolDisplay,\n ),\n // Renamed from ui.nestedToolDebounceMs (v3): the window coalesces every\n // live fabric_exec card update \u2014 nested calls, progress, agent previews.\n updateDebounceMs: boundedInteger(\n ui.updateDebounceMs ?? ui.nestedToolDebounceMs,\n DEFAULT_FABRIC_CONFIG.ui.updateDebounceMs,\n 0,\n 2_000,\n ),\n },\n compaction: {\n engine: compactionEngineValue(compaction.engine, DEFAULT_FABRIC_CONFIG.compaction.engine),\n ...(summaryModel !== undefined ? { summaryModel } : {}),\n targetContextRatio: boundedFloat(\n compaction.targetContextRatio,\n DEFAULT_FABRIC_CONFIG.compaction.targetContextRatio,\n 0.25,\n 0.85,\n ),\n softThresholdRatio: thresholdRatios.soft,\n hardThresholdRatio: thresholdRatios.hard,\n thresholds: compactionThresholds,\n tokenThresholds: compactionTokenThresholds,\n lcmMaxInputChars: boundedInteger(compaction.lcmMaxInputChars, DEFAULT_FABRIC_CONFIG.compaction.lcmMaxInputChars, 1_024, 1_000_000),\n lcmMaxOutputTokens: boundedInteger(compaction.lcmMaxOutputTokens, DEFAULT_FABRIC_CONFIG.compaction.lcmMaxOutputTokens, 128, 32_768),\n lcmMaxOutputChars: boundedInteger(compaction.lcmMaxOutputChars, DEFAULT_FABRIC_CONFIG.compaction.lcmMaxOutputChars, 1_024, 131_072),\n lcmMaxLeafEntries: boundedInteger(compaction.lcmMaxLeafEntries, DEFAULT_FABRIC_CONFIG.compaction.lcmMaxLeafEntries, 1, 128),\n lcmMaxCondenseChildren: boundedInteger(compaction.lcmMaxCondenseChildren, DEFAULT_FABRIC_CONFIG.compaction.lcmMaxCondenseChildren, 2, 32),\n lcmMaintenancePasses: boundedInteger(compaction.lcmMaintenancePasses, DEFAULT_FABRIC_CONFIG.compaction.lcmMaintenancePasses, 1, 64),\n lcmMaintenanceConcurrency: boundedInteger(compaction.lcmMaintenanceConcurrency, DEFAULT_FABRIC_CONFIG.compaction.lcmMaintenanceConcurrency, 1, 8),\n lcmModelSummaries: booleanValue(compaction.lcmModelSummaries, DEFAULT_FABRIC_CONFIG.compaction.lcmModelSummaries),\n lcmModelTimeoutSeconds: boundedInteger(compaction.lcmModelTimeoutSeconds, DEFAULT_FABRIC_CONFIG.compaction.lcmModelTimeoutSeconds, 10, 900),\n lcmMaxDailyModelCalls: boundedInteger(compaction.lcmMaxDailyModelCalls, DEFAULT_FABRIC_CONFIG.compaction.lcmMaxDailyModelCalls, 0, 100_000),\n lcmMaxSessionModelCalls: boundedInteger(compaction.lcmMaxSessionModelCalls, DEFAULT_FABRIC_CONFIG.compaction.lcmMaxSessionModelCalls, 0, 100_000),\n lcmMaxDailyModelSeconds: boundedInteger(compaction.lcmMaxDailyModelSeconds, DEFAULT_FABRIC_CONFIG.compaction.lcmMaxDailyModelSeconds, 0, 604_800),\n },\n retention: {\n orphanedTempRunMs: boundedInteger(\n retention.orphanedTempRunMs,\n DEFAULT_FABRIC_CONFIG.retention.orphanedTempRunMs,\n 60 * 60 * 1_000,\n 365 * 24 * 60 * 60 * 1_000,\n ),\n oneShotRunMs: boundedInteger(\n retention.oneShotRunMs,\n DEFAULT_FABRIC_CONFIG.retention.oneShotRunMs,\n 60 * 60 * 1_000,\n 365 * 24 * 60 * 60 * 1_000,\n ),\n actorRunArchiveMs: boundedInteger(\n retention.actorRunArchiveMs,\n DEFAULT_FABRIC_CONFIG.retention.actorRunArchiveMs,\n 60 * 60 * 1_000,\n 365 * 24 * 60 * 60 * 1_000,\n ),\n outputArtifactMs: boundedInteger(\n retention.outputArtifactMs,\n DEFAULT_FABRIC_CONFIG.retention.outputArtifactMs,\n 60 * 60 * 1_000,\n 365 * 24 * 60 * 60 * 1_000,\n ),\n outputArtifactMaxBytes: boundedInteger(\n retention.outputArtifactMaxBytes,\n DEFAULT_FABRIC_CONFIG.retention.outputArtifactMaxBytes,\n 1024 * 1024,\n 64 * 1024 * 1024 * 1024,\n ),\n },\n mesh: {\n enabled: booleanValue(mesh.enabled, DEFAULT_FABRIC_CONFIG.mesh.enabled),\n ...(meshRoot ? { root: meshRoot } : {}),\n actorScope: actorScopeValue(mesh.actorScope, DEFAULT_FABRIC_CONFIG.mesh.actorScope),\n maxEventBytes: boundedInteger(\n mesh.maxEventBytes,\n DEFAULT_FABRIC_CONFIG.mesh.maxEventBytes,\n 1_024,\n 4 * 1024 * 1024,\n ),\n maxReadEvents: boundedInteger(\n mesh.maxReadEvents,\n DEFAULT_FABRIC_CONFIG.mesh.maxReadEvents,\n 1,\n 10_000,\n ),\n actorPollMs: boundedInteger(\n mesh.actorPollMs,\n DEFAULT_FABRIC_CONFIG.mesh.actorPollMs,\n 50,\n 10_000,\n ),\n actorQueueLimit: boundedInteger(\n mesh.actorQueueLimit,\n DEFAULT_FABRIC_CONFIG.mesh.actorQueueLimit,\n 1,\n 1_000,\n ),\n eventContextChars: boundedInteger(\n mesh.eventContextChars,\n DEFAULT_FABRIC_CONFIG.mesh.eventContextChars,\n 1_000,\n 1_000_000,\n ),\n actorContextEntries: boundedInteger(\n mesh.actorContextEntries,\n DEFAULT_FABRIC_CONFIG.mesh.actorContextEntries,\n 1,\n 100,\n ),\n },\n models: {\n aliases: normalizeModelAliases(modelsSection.aliases),\n },\n memory: {\n enabled: booleanValue(memory.enabled, DEFAULT_FABRIC_CONFIG.memory.enabled),\n ...(memoryIndexDir ? { indexDir: memoryIndexDir } : {}),\n maxSessions: boundedInteger(\n memory.maxSessions,\n DEFAULT_FABRIC_CONFIG.memory.maxSessions,\n 1,\n 100_000,\n ),\n maxEntryChars: boundedInteger(\n memory.maxEntryChars,\n DEFAULT_FABRIC_CONFIG.memory.maxEntryChars,\n 100,\n 1_000_000,\n ),\n indexThinking: booleanValue(\n memory.indexThinking,\n DEFAULT_FABRIC_CONFIG.memory.indexThinking ?? false,\n ),\n indexToolOutput: booleanValue(\n memory.indexToolOutput,\n DEFAULT_FABRIC_CONFIG.memory.indexToolOutput ?? true,\n ),\n hotSessions: boundedInteger(\n memory.hotSessions,\n DEFAULT_FABRIC_CONFIG.memory.hotSessions ?? 50,\n 0,\n 100_000,\n ),\n digestTerms: boundedInteger(\n memory.digestTerms,\n DEFAULT_FABRIC_CONFIG.memory.digestTerms ?? 200,\n 1,\n 10_000,\n ),\n maxColdVocabularyBytes: boundedInteger(\n memory.maxColdVocabularyBytes,\n DEFAULT_FABRIC_CONFIG.memory.maxColdVocabularyBytes ?? 512 * 1024,\n 2,\n 64 * 1024 * 1024,\n ),\n maxColdCacheBytes: boundedInteger(\n memory.maxColdCacheBytes,\n DEFAULT_FABRIC_CONFIG.memory.maxColdCacheBytes ?? 1024 * 1024,\n 512,\n 128 * 1024 * 1024,\n ),\n maxSyncSessions: boundedInteger(\n memory.maxSyncSessions,\n DEFAULT_FABRIC_CONFIG.memory.maxSyncSessions ?? 10_000,\n 1,\n 1_000_000,\n ),\n maxSyncSourceBytes: boundedInteger(\n memory.maxSyncSourceBytes,\n DEFAULT_FABRIC_CONFIG.memory.maxSyncSourceBytes ?? 512 * 1024 * 1024,\n 1_024,\n 8 * 1024 * 1024 * 1024,\n ),\n maxCacheCleanupFiles: boundedInteger(\n memory.maxCacheCleanupFiles,\n DEFAULT_FABRIC_CONFIG.memory.maxCacheCleanupFiles ?? 100_000,\n 1,\n 1_000_000,\n ),\n regexMaxPatternBytes: boundedInteger(\n memory.regexMaxPatternBytes,\n DEFAULT_FABRIC_CONFIG.memory.regexMaxPatternBytes ?? 1_024,\n 1,\n 64 * 1024,\n ),\n regexMaxHaystackTerms: boundedInteger(\n memory.regexMaxHaystackTerms,\n DEFAULT_FABRIC_CONFIG.memory.regexMaxHaystackTerms ?? 20_000,\n 1,\n 1_000_000,\n ),\n regexMaxHaystackBytes: boundedInteger(\n memory.regexMaxHaystackBytes,\n DEFAULT_FABRIC_CONFIG.memory.regexMaxHaystackBytes ?? 2 * 1024 * 1024,\n 1_024,\n 128 * 1024 * 1024,\n ),\n regexTimeoutMs: boundedInteger(\n memory.regexTimeoutMs,\n DEFAULT_FABRIC_CONFIG.memory.regexTimeoutMs ?? 250,\n 10,\n 10_000,\n ),\n },\n entropy: {\n compile: booleanValue(entropy.compile, DEFAULT_FABRIC_CONFIG.entropy.compile),\n },\n repairs: {\n enabled: booleanValue(repairs.enabled, DEFAULT_FABRIC_CONFIG.repairs.enabled),\n },\n update: {\n check: booleanValue(update.check, DEFAULT_FABRIC_CONFIG.update.check),\n },\n schema: {\n mode: schemaMode,\n certificateTtlMs: boundedInteger(\n schema.certificateTtlMs,\n DEFAULT_FABRIC_CONFIG.schema.certificateTtlMs,\n 1_000,\n 10 * 60_000,\n ),\n maxFiles: boundedInteger(\n schema.maxFiles,\n DEFAULT_FABRIC_CONFIG.schema.maxFiles,\n 1,\n 1_000,\n ),\n maxBytes: boundedInteger(\n schema.maxBytes,\n DEFAULT_FABRIC_CONFIG.schema.maxBytes,\n 1_024,\n 100 * 1024 * 1024,\n ),\n trustedCommands,\n },\n speculation: {\n enabled: booleanValue(\n speculation.enabled,\n DEFAULT_FABRIC_CONFIG.speculation.enabled,\n ),\n maxConcurrent: boundedInteger(\n speculation.maxConcurrent,\n DEFAULT_FABRIC_CONFIG.speculation.maxConcurrent,\n 1,\n 32,\n ),\n maxEntries: boundedInteger(\n speculation.maxEntries,\n DEFAULT_FABRIC_CONFIG.speculation.maxEntries,\n 1,\n 1_024,\n ),\n maxBufferBytes: boundedInteger(\n speculation.maxBufferBytes,\n DEFAULT_FABRIC_CONFIG.speculation.maxBufferBytes,\n 64 * 1024,\n 64 * 1024 * 1024,\n ),\n entryTtlMs: boundedInteger(\n speculation.entryTtlMs,\n DEFAULT_FABRIC_CONFIG.speculation.entryTtlMs,\n 5_000,\n 30 * 60_000,\n ),\n mcpAllowlist: [\n ...new Set(\n (Array.isArray(speculation.mcpAllowlist) ? speculation.mcpAllowlist : [])\n .filter(\n (entry): entry is string =>\n typeof entry === \"string\" && entry.trim().length > 0,\n )\n .map((entry) => entry.trim().slice(0, 256)),\n ),\n ].slice(0, 256),\n },\n judgment: {\n enabled: booleanValue(judgment.enabled, DEFAULT_FABRIC_CONFIG.judgment.enabled),\n coalesceMs: boundedInteger(\n judgment.coalesceMs,\n DEFAULT_FABRIC_CONFIG.judgment.coalesceMs,\n 0,\n 1_000,\n ),\n timeoutMs: boundedInteger(\n judgment.timeoutMs,\n DEFAULT_FABRIC_CONFIG.judgment.timeoutMs,\n 250,\n 120_000,\n ),\n maxConcurrent: boundedInteger(\n judgment.maxConcurrent,\n DEFAULT_FABRIC_CONFIG.judgment.maxConcurrent,\n 1,\n 64,\n ),\n maxQuestionsPerRequest: boundedInteger(\n judgment.maxQuestionsPerRequest,\n DEFAULT_FABRIC_CONFIG.judgment.maxQuestionsPerRequest,\n 1,\n 256,\n ),\n maxStateBytes: boundedInteger(\n judgment.maxStateBytes,\n DEFAULT_FABRIC_CONFIG.judgment.maxStateBytes,\n 1_024,\n 512 * 1024,\n ),\n gates: {\n toolExec: booleanValue(judgmentGates.toolExec, DEFAULT_FABRIC_CONFIG.judgment.gates.toolExec),\n toolOutput: booleanValue(\n judgmentGates.toolOutput,\n DEFAULT_FABRIC_CONFIG.judgment.gates.toolOutput,\n ),\n delegation: booleanValue(\n judgmentGates.delegation,\n DEFAULT_FABRIC_CONFIG.judgment.gates.delegation,\n ),\n skills: booleanValue(judgmentGates.skills, DEFAULT_FABRIC_CONFIG.judgment.gates.skills),\n },\n },\n codePreview: normalizeCodePreviewSettings(input.codePreview),\n };\n};\n\nexport const effectiveToolCaptureConfig = (\n config: Pick<FabricConfig, \"fullCodeMode\" | \"capture\"> & Partial<Pick<FabricConfig, \"schema\">>,\n): FabricToolCaptureConfig =>\n config.schema?.mode === \"enforce\"\n ? {\n ...config.capture,\n enabled: true,\n hideFromModel: true,\n keepVisible: [\"fabric_exec\"],\n risks: { ...config.capture.risks },\n }\n : config.fullCodeMode\n ? {\n ...config.capture,\n keepVisible: config.capture.keepVisible.filter(\n (name) => !OMP_CORE_TOOL_NAME_SET.has(name) || name === \"fabric_exec\",\n ),\n risks: { ...config.capture.risks },\n }\n : {\n ...config.capture,\n enabled: false,\n hideFromModel: false,\n keepVisible: [...config.capture.keepVisible],\n risks: { ...config.capture.risks },\n };\n\ninterface FabricConfigFilePlan {\n path: string;\n document: Record<string, unknown>;\n source: string;\n changed: boolean;\n}\n\nconst planConfigFile = (filePath: string): FabricConfigFilePlan | undefined => {\n const input = readJsonObjectFile(filePath);\n if (!input) return undefined;\n const migration = migrateFabricConfigDocument(input.document);\n return {\n path: filePath,\n document: migration.document,\n source: input.source,\n changed: migration.changed,\n };\n};\n\nconst writeJsonAtomic = (\n filePath: string,\n document: Record<string, unknown>,\n expectedSource: string | null,\n): void => {\n const resolvedPath = fs.existsSync(filePath) ? fs.realpathSync(filePath) : filePath;\n const directory = path.dirname(resolvedPath);\n if (!fs.existsSync(directory)) fs.mkdirSync(directory, { recursive: true });\n const mode = fs.existsSync(resolvedPath) ? fs.statSync(resolvedPath).mode & 0o777 : 0o600;\n const temporaryPath = path.join(\n directory,\n `.${path.basename(resolvedPath)}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2)}.tmp`,\n );\n let descriptor: number | undefined;\n try {\n descriptor = fs.openSync(temporaryPath, \"wx\", mode);\n fs.writeFileSync(descriptor, `${JSON.stringify(document, null, 2)}\\n`, \"utf8\");\n fs.fsyncSync(descriptor);\n fs.closeSync(descriptor);\n descriptor = undefined;\n if (expectedSource === null) {\n if (fs.existsSync(resolvedPath)) {\n throw new Error(`Fabric configuration changed while updating ${filePath}`);\n }\n } else {\n let currentSource: string;\n try {\n currentSource = fs.readFileSync(resolvedPath, \"utf8\");\n } catch (error) {\n throw new Error(`Fabric configuration changed while updating ${filePath}`, { cause: error });\n }\n if (currentSource !== expectedSource) {\n throw new Error(`Fabric configuration changed while updating ${filePath}`);\n }\n }\n renameAtomic(temporaryPath, resolvedPath);\n try {\n const directoryDescriptor = fs.openSync(directory, \"r\");\n try {\n fs.fsyncSync(directoryDescriptor);\n } finally {\n fs.closeSync(directoryDescriptor);\n }\n } catch (error) {\n const code = error instanceof Error && \"code\" in error ? error.code : undefined;\n if (code !== \"EINVAL\" && code !== \"ENOTSUP\" && code !== \"EISDIR\" && code !== \"EPERM\") throw error;\n }\n } catch (error) {\n if (descriptor !== undefined) fs.closeSync(descriptor);\n fs.rmSync(temporaryPath, { force: true });\n throw error;\n }\n};\n\nconst resolveFabricConfig = (\n options: {\n cwd: string;\n agentDir: string;\n },\n includeProject: boolean,\n applyEnvironmentOverrides: boolean,\n): FabricConfig => {\n let merged = structuredClone(DEFAULT_FABRIC_CONFIG) as unknown as Record<string, unknown>;\n const plans = [\n planConfigFile(path.join(options.agentDir, \"fabric.json\")),\n ...(includeProject\n ? [planConfigFile(path.join(options.cwd, \".omp\", \"fabric.json\"))]\n : []),\n ].filter((plan): plan is FabricConfigFilePlan => plan !== undefined);\n for (const plan of plans) {\n if (plan.changed) writeJsonAtomic(plan.path, plan.document, plan.source);\n merged = mergeObjects(merged, plan.document);\n }\n const inheritedFullCodeMode = process.env.OMP_FABRIC_FULL_CODE_MODE;\n if (\n applyEnvironmentOverrides &&\n (inheritedFullCodeMode === \"true\" || inheritedFullCodeMode === \"false\")\n ) {\n merged.fullCodeMode = inheritedFullCodeMode === \"true\";\n }\n return normalizeFabricConfig(merged);\n};\n\nexport const loadFabricConfigForScope = (\n options: {\n cwd: string;\n agentDir: string;\n projectTrusted: boolean;\n },\n scope: FabricConfigScope,\n): FabricConfig => {\n if (scope === \"project\" && !options.projectTrusted) {\n throw new Error(\"Cannot load project Fabric configuration for an untrusted project\");\n }\n return resolveFabricConfig(options, scope === \"project\", false);\n};\n\nexport const loadFabricConfig = (options: {\n cwd: string;\n agentDir: string;\n projectTrusted: boolean;\n}): FabricConfig => {\n const config = resolveFabricConfig(options, options.projectTrusted, true);\n configureOutputArtifactRetention({\n maxAgeMs: config.retention.outputArtifactMs,\n maxBytes: config.retention.outputArtifactMaxBytes,\n });\n return config;\n};\n\nexport const saveFabricConfig = (\n options: {\n cwd: string;\n agentDir: string;\n projectTrusted: boolean;\n scope?: FabricConfigScope;\n },\n partial: Record<string, unknown>,\n): { scope: FabricConfigScope; path: string } => {\n const scope = options.scope ?? \"global\";\n if (scope === \"project\" && !options.projectTrusted) {\n throw new Error(\"Cannot save project Fabric configuration for an untrusted project\");\n }\n const targetPath = scope === \"project\"\n ? path.join(options.cwd, \".omp\", \"fabric.json\")\n : path.join(options.agentDir, \"fabric.json\");\n if (Object.hasOwn(partial, \"configVersion\") || Object.hasOwn(partial, \"subagents\")) {\n throw new Error(\"Fabric configuration updates must use the current schema\");\n }\n const input = readJsonObjectFile(targetPath);\n const existing = migrateFabricConfigDocument(input?.document ?? {}).document;\n const merged = mergeObjects(existing, partial) as Record<string, unknown>;\n // Never stamp down: preserve version markers written by newer builds.\n merged.configVersion = Math.max(\n typeof merged.configVersion === \"number\" ? merged.configVersion : 0,\n CURRENT_FABRIC_CONFIG_VERSION,\n );\n writeJsonAtomic(targetPath, merged, input?.source ?? null);\n return { scope, path: targetPath };\n};\n", "export const CURRENT_FABRIC_CONFIG_VERSION = 5;\n\nexport interface FabricConfigMigrationResult {\n document: Record<string, unknown>;\n fromVersion: number;\n toVersion: number;\n appliedVersions: number[];\n changed: boolean;\n // True when the document was written by a newer omp-fabric build. The document\n // is accepted as-is (newer builds only add semantics older builds can safely\n // ignore) and is never rewritten or version-stamped down.\n forwardCompatible: boolean;\n}\n\ninterface FabricConfigMigration {\n from: number;\n to: number;\n migrate(document: Readonly<Record<string, unknown>>): Record<string, unknown>;\n}\n\nconst isObject = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst mergeObjects = (\n base: Record<string, unknown>,\n override: Record<string, unknown>,\n): Record<string, unknown> => {\n const merged = { ...base };\n for (const [key, value] of Object.entries(override)) {\n const current = merged[key];\n merged[key] = isObject(current) && isObject(value) ? mergeObjects(current, value) : value;\n }\n return merged;\n};\n\nconst migrations: readonly FabricConfigMigration[] = [\n {\n from: 0,\n to: 1,\n migrate(document) {\n const migrated = { ...document };\n const legacy = migrated.subagents;\n const canonical = migrated.agents;\n if (legacy !== undefined) {\n if (canonical !== undefined && isObject(legacy) !== isObject(canonical)) {\n throw new Error(\n \"Fabric configuration cannot merge legacy subagents with a malformed agents section\",\n );\n }\n migrated.agents = isObject(legacy) && isObject(canonical)\n ? mergeObjects(legacy, canonical)\n : canonical ?? legacy;\n }\n delete migrated.subagents;\n return migrated;\n },\n },\n {\n from: 1,\n to: 2,\n migrate(document) {\n const migrated = { ...document };\n const ui = migrated.ui;\n if (isObject(ui) && Object.hasOwn(ui, \"showNestedToolCalls\")) {\n const renamed = { ...ui };\n if (!Object.hasOwn(renamed, \"showAgentToolPreview\")) {\n renamed.showAgentToolPreview = renamed.showNestedToolCalls;\n }\n delete renamed.showNestedToolCalls;\n migrated.ui = renamed;\n }\n return migrated;\n },\n },\n {\n from: 2,\n to: 3,\n migrate(document) {\n const migrated = { ...document };\n const ui = migrated.ui;\n if (isObject(ui) && Object.hasOwn(ui, \"nestedToolDebounceMs\")) {\n const renamed = { ...ui };\n if (!Object.hasOwn(renamed, \"updateDebounceMs\")) {\n renamed.updateDebounceMs = renamed.nestedToolDebounceMs;\n }\n delete renamed.nestedToolDebounceMs;\n migrated.ui = renamed;\n }\n return migrated;\n },\n },\n {\n from: 3,\n to: 4,\n migrate(document) {\n const migrated = { ...document };\n const prewalk = migrated.prewalk;\n if (\n isObject(prewalk) &&\n (prewalk.enabled === \"true\" || prewalk.enabled === \"false\")\n ) {\n migrated.prewalk = {\n ...prewalk,\n enabled: prewalk.enabled === \"true\",\n };\n }\n return migrated;\n },\n },\n {\n from: 4,\n to: 5,\n migrate(document) {\n const migrated = { ...document };\n const compaction = migrated.compaction;\n if (isObject(compaction) && compaction.engine === \"fabric\") {\n migrated.compaction = { ...compaction, engine: \"lcm\" };\n }\n return migrated;\n },\n },\n];\n\nconst configVersion = (document: Readonly<Record<string, unknown>>): number => {\n const value = document.configVersion;\n if (value === undefined) return 0;\n if (typeof value !== \"number\" || !Number.isInteger(value) || value < 0) {\n throw new Error(\"Fabric configuration configVersion must be a non-negative integer\");\n }\n return value;\n};\n\nexport const migrateFabricConfigDocument = (\n input: Readonly<Record<string, unknown>>,\n): FabricConfigMigrationResult => {\n const fromVersion = configVersion(input);\n if (fromVersion > CURRENT_FABRIC_CONFIG_VERSION) {\n // Written by a newer build: accept as-is instead of bricking the\n // extension. Legacy-shape checks (e.g. the removed subagents key) apply to\n // supported versions only \u2014 newer semantics are unknown here.\n return {\n document: structuredClone(input) as Record<string, unknown>,\n fromVersion,\n toVersion: fromVersion,\n appliedVersions: [],\n changed: false,\n forwardCompatible: true,\n };\n }\n let version = fromVersion;\n let document = structuredClone(input) as Record<string, unknown>;\n const appliedVersions: number[] = [];\n\n while (version < CURRENT_FABRIC_CONFIG_VERSION) {\n const migration = migrations.find((candidate) => candidate.from === version);\n if (!migration || migration.to !== version + 1) {\n throw new Error(`No Fabric configuration migration exists for version ${version}`);\n }\n document = migration.migrate(document);\n version = migration.to;\n document.configVersion = version;\n appliedVersions.push(version);\n }\n\n if (Object.hasOwn(document, \"subagents\")) {\n throw new Error(\"Current Fabric configuration contains removed key subagents\");\n }\n\n return {\n document,\n fromVersion,\n toVersion: version,\n appliedVersions,\n changed: appliedVersions.length > 0,\n forwardCompatible: false,\n };\n};\n", "import { mkdir, readdir, rm, stat, writeFile } from \"node:fs/promises\";\nimport { randomBytes } from \"node:crypto\";\nimport path from \"node:path\";\nimport { truncateMiddle } from \"./util.js\";\n\nexport const MAX_FAILURE_MODEL_OUTPUT_CHARS = 20_000;\n\nexport const modelOutputBudget = (\n configuredMaxChars: number,\n success: boolean,\n): number => success\n ? configuredMaxChars\n : Math.min(configuredMaxChars, MAX_FAILURE_MODEL_OUTPUT_CHARS);\n\nexport interface BoundedModelOutput {\n text: string;\n artifactPath?: string;\n originalChars: number;\n omittedChars: number;\n}\n\nexport const fabricStateDir = (env: NodeJS.ProcessEnv = process.env): string =>\n path.join(\n env.XDG_STATE_HOME || path.join(env.HOME || \".\", \".local\", \"state\"),\n \"omp-fabric\",\n );\n\nexport const outputArtifactDir = (env: NodeJS.ProcessEnv = process.env): string =>\n path.join(fabricStateDir(env), \"output\");\n\nexport interface OutputArtifactRetention {\n maxAgeMs: number;\n maxBytes: number;\n}\n\nexport const DEFAULT_OUTPUT_ARTIFACT_RETENTION: OutputArtifactRetention = {\n maxAgeMs: 7 * 24 * 60 * 60 * 1_000,\n maxBytes: 256 * 1024 * 1024,\n};\n\nexport const OUTPUT_ARTIFACT_SWEEP_INTERVAL_MS = 5 * 60 * 1_000;\n\nlet sweptAt: number | undefined;\nlet lastSweep: OutputArtifactSweepRecord | undefined;\n\nexport const resetOutputArtifactSweepSchedule = (): void => {\n sweptAt = undefined;\n lastSweep = undefined;\n};\n\nexport const lastOutputArtifactSweep = (): OutputArtifactSweepRecord | undefined => lastSweep;\n\nlet activeRetention: OutputArtifactRetention = DEFAULT_OUTPUT_ARTIFACT_RETENTION;\n\nexport const configureOutputArtifactRetention = (\n retention: OutputArtifactRetention,\n): void => {\n const changed = retention.maxAgeMs !== activeRetention.maxAgeMs\n || retention.maxBytes !== activeRetention.maxBytes;\n activeRetention = { maxAgeMs: retention.maxAgeMs, maxBytes: retention.maxBytes };\n if (changed) resetOutputArtifactSweepSchedule();\n};\n\nexport const outputArtifactRetention = (): OutputArtifactRetention => activeRetention;\n\nconst ARTIFACT_FILE = /^output-[0-9a-z]+-(?:p([0-9a-z]+)-)?[0-9a-f]+\\.txt$/;\n\nconst ownerAlive = (pid: number): boolean => {\n try {\n process.kill(pid, 0);\n return true;\n } catch (error) {\n return !(error instanceof Error && \"code\" in error && error.code === \"ESRCH\");\n }\n};\n\ninterface ArtifactCandidate {\n path: string;\n bytes: number;\n mtimeMs: number;\n held: boolean;\n}\n\nexport interface OutputArtifactSweep {\n removed: string[];\n keptBytes: number;\n heldBytes: number;\n overBudgetBytes: number;\n}\n\nexport interface OutputArtifactSweepRecord extends OutputArtifactSweep {\n at: number;\n}\n\nexport const sweepOutputArtifacts = async (options: {\n directory?: string;\n retention?: OutputArtifactRetention;\n now?: number;\n isOwnerAlive?: (pid: number) => boolean;\n} = {}): Promise<OutputArtifactSweep> => {\n const directory = options.directory ?? outputArtifactDir();\n const retention = options.retention ?? activeRetention;\n const now = options.now ?? Date.now();\n const alive = options.isOwnerAlive ?? ownerAlive;\n\n let names: string[];\n try {\n names = await readdir(directory);\n } catch {\n return { removed: [], keptBytes: 0, heldBytes: 0, overBudgetBytes: 0 };\n }\n\n const candidates: ArtifactCandidate[] = [];\n for (const name of names) {\n const match = ARTIFACT_FILE.exec(name);\n if (!match) continue;\n const artifactPath = path.join(directory, name);\n let info;\n try {\n info = await stat(artifactPath);\n } catch {\n continue;\n }\n if (!info.isFile()) continue;\n const pid = match[1] === undefined ? Number.NaN : Number.parseInt(match[1], 36);\n candidates.push({\n path: artifactPath,\n bytes: info.size,\n mtimeMs: info.mtimeMs,\n held: Number.isInteger(pid) && pid > 0 && alive(pid),\n });\n }\n candidates.sort((left, right) =>\n left.mtimeMs - right.mtimeMs || left.path.localeCompare(right.path));\n\n const removed: string[] = [];\n const survivors: ArtifactCandidate[] = [];\n let keptBytes = 0;\n for (const candidate of candidates) {\n if (!candidate.held && now - candidate.mtimeMs >= retention.maxAgeMs) {\n try {\n await rm(candidate.path, { force: true });\n removed.push(candidate.path);\n continue;\n } catch {}\n }\n survivors.push(candidate);\n keptBytes += candidate.bytes;\n }\n for (const candidate of survivors) {\n if (keptBytes <= retention.maxBytes) break;\n if (candidate.held) continue;\n try {\n await rm(candidate.path, { force: true });\n } catch {\n continue;\n }\n removed.push(candidate.path);\n keptBytes -= candidate.bytes;\n }\n let heldBytes = 0;\n for (const candidate of survivors) {\n if (candidate.held) heldBytes += candidate.bytes;\n }\n return {\n removed,\n keptBytes,\n heldBytes,\n overBudgetBytes: Math.max(0, keptBytes - retention.maxBytes),\n };\n};\n\nexport const sweepOutputArtifactsIfDue = async (options: {\n directory?: string;\n retention?: OutputArtifactRetention;\n now?: number;\n isOwnerAlive?: (pid: number) => boolean;\n intervalMs?: number;\n} = {}): Promise<OutputArtifactSweep | undefined> => {\n const now = options.now ?? Date.now();\n const interval = options.intervalMs ?? OUTPUT_ARTIFACT_SWEEP_INTERVAL_MS;\n if (sweptAt !== undefined && now - sweptAt < interval) return undefined;\n sweptAt = now;\n const sweep = await sweepOutputArtifacts(options);\n lastSweep = { ...sweep, at: now };\n if (sweep.overBudgetBytes > 0) {\n const cap = (options.retention ?? activeRetention).maxBytes;\n console.warn(\n `[omp-fabric] output artifacts keep ${sweep.keptBytes} bytes against a ${cap} byte cap; ` +\n `${sweep.overBudgetBytes} bytes stay because ${sweep.heldBytes} bytes belong to running sessions`,\n );\n }\n return sweep;\n};\n\ntype ArtifactWriter = (content: string) => Promise<string>;\n\nconst writeOutputArtifact: ArtifactWriter = async (content) => {\n const directory = outputArtifactDir();\n await mkdir(directory, { recursive: true, mode: 0o700 });\n const artifactPath = path.join(\n directory,\n `output-${Date.now().toString(36)}-p${process.pid.toString(36)}-${randomBytes(6).toString(\"hex\")}.txt`,\n );\n await writeFile(artifactPath, content, { encoding: \"utf8\", mode: 0o600 });\n try {\n await sweepOutputArtifactsIfDue({ directory });\n } catch {}\n return artifactPath;\n};\n\nconst MAX_ARTIFACT_FAILURE_REASON_CHARS = 160;\n\nconst artifactFailureReason = (error: unknown): string => {\n const raw = error instanceof Error ? error.message : String(error);\n const flattened = raw.replace(/\\s+/g, \" \").trim();\n if (!flattened) return \"unknown error\";\n return flattened.length <= MAX_ARTIFACT_FAILURE_REASON_CHARS\n ? flattened\n : `${flattened.slice(0, MAX_ARTIFACT_FAILURE_REASON_CHARS - 1)}\u2026`;\n};\n\nexport const boundModelOutput = async (\n visible: string,\n maxChars: number,\n fullOutput = visible,\n writeArtifact: ArtifactWriter = writeOutputArtifact,\n): Promise<BoundedModelOutput> => {\n if (visible.length <= maxChars && fullOutput.length <= maxChars) {\n return { text: visible, originalChars: fullOutput.length, omittedChars: 0 };\n }\n\n let artifactPath: string | undefined;\n let failureReason: string | undefined;\n try {\n artifactPath = await writeArtifact(fullOutput);\n } catch (error) {\n failureReason = artifactFailureReason(error);\n }\n const suffix = artifactPath\n ? `\\n\\n[Full output (${fullOutput.length} chars) saved to: ${artifactPath}]`\n : `\\n\\n[full output ${fullOutput.length} chars; overflow could not be saved: ${failureReason}]`;\n const bodyBudget = Math.max(1, maxChars - suffix.length);\n const body = truncateMiddle(visible, bodyBudget);\n const combined = `${body}${suffix}`;\n return {\n text: combined.length <= maxChars ? combined : truncateMiddle(combined, maxChars),\n ...(artifactPath ? { artifactPath } : {}),\n originalChars: fullOutput.length,\n omittedChars: Math.max(0, fullOutput.length - Math.min(fullOutput.length, body.length)),\n };\n};\n", "import path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { homedir } from \"node:os\";\nimport { getAgentDir } from \"@oh-my-pi/pi-utils\";\n\nconst expandEnvDir = (envDir: string): string => {\n if (/^file:\\/\\//.test(envDir)) return fileURLToPath(envDir);\n if (envDir === \"~\") return homedir();\n if (envDir.startsWith(\"~/\") || (process.platform === \"win32\" && envDir.startsWith(\"~\\\\\"))) {\n return path.join(homedir(), envDir.slice(2));\n }\n return envDir;\n};\n\nexport const resolveAgentDir = (): string => {\n const envDir = process.env.OMP_FABRIC_AGENT_DIR;\n if (envDir) return expandEnvDir(envDir);\n return getAgentDir();\n};"],
5
+ "mappings": ";;;;;;;;;;;;;;;AAAA,IAAM,oBAAoB;AAgBnB,IAAM,2BAA2B,CAAC,WAAW,UAAU,QAAQ;AAEtE,IAAM,WAAW,CAAC,UAAwC,GAAG,MAAM,QAAQ,IAAI,MAAM,EAAE;AAEvF,IAAM,YAAY,CAChB,MACA,UAEA,UAAU,UACV,KAAK,SAAS,YAAY,MAAM,MAAM,SAAS,YAAY,KAC3D,KAAK,GAAG,YAAY,MAAM,MAAM,GAAG,YAAY;AAS1C,IAAM,wBAAwB,CAAC,UAA6C;AACjF,MAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,MAAM,QAAQ,KAAK,EAAG,QAAO,CAAC;AACjF,QAAM,UAAoC,CAAC;AAC3C,aAAW,CAAC,SAAS,QAAQ,KAAK,OAAO,QAAQ,KAAgC,GAAG;AAClF,UAAM,OAAO,QAAQ,KAAK;AAC1B,QAAI,CAAC,KAAM;AACX,UAAM,SAAS,OAAO,aAAa,WAAW,CAAC,QAAQ,IAAI;AAC3D,QAAI,CAAC,MAAM,QAAQ,MAAM,KAAK,OAAO,WAAW,EAAG;AACnD,U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