@miller-tech/uap 1.136.1 → 1.137.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/benchmarks/paired/report.d.ts +13 -0
  3. package/dist/benchmarks/paired/report.d.ts.map +1 -1
  4. package/dist/benchmarks/paired/report.js +29 -3
  5. package/dist/benchmarks/paired/report.js.map +1 -1
  6. package/dist/benchmarks/paired/types.d.ts +59 -0
  7. package/dist/benchmarks/paired/types.d.ts.map +1 -1
  8. package/dist/benchmarks/paired/types.js +60 -0
  9. package/dist/benchmarks/paired/types.js.map +1 -1
  10. package/dist/bin/cli.js +30 -0
  11. package/dist/bin/cli.js.map +1 -1
  12. package/dist/cli/deliver.d.ts.map +1 -1
  13. package/dist/cli/deliver.js +111 -7
  14. package/dist/cli/deliver.js.map +1 -1
  15. package/dist/cli/react.d.ts.map +1 -1
  16. package/dist/cli/react.js +18 -0
  17. package/dist/cli/react.js.map +1 -1
  18. package/dist/cli/self-tuning.d.ts +33 -0
  19. package/dist/cli/self-tuning.d.ts.map +1 -0
  20. package/dist/cli/self-tuning.js +139 -0
  21. package/dist/cli/self-tuning.js.map +1 -0
  22. package/dist/cli/tune-adapter.d.ts +8 -0
  23. package/dist/cli/tune-adapter.d.ts.map +1 -0
  24. package/dist/cli/tune-adapter.js +26 -0
  25. package/dist/cli/tune-adapter.js.map +1 -0
  26. package/dist/config/settings-registry.d.ts.map +1 -1
  27. package/dist/config/settings-registry.js +10 -0
  28. package/dist/config/settings-registry.js.map +1 -1
  29. package/dist/coordination/adaptation-signal.d.ts +19 -0
  30. package/dist/coordination/adaptation-signal.d.ts.map +1 -0
  31. package/dist/coordination/adaptation-signal.js +36 -0
  32. package/dist/coordination/adaptation-signal.js.map +1 -0
  33. package/dist/delivery/agentic-executor.d.ts +16 -1
  34. package/dist/delivery/agentic-executor.d.ts.map +1 -1
  35. package/dist/delivery/agentic-executor.js +45 -4
  36. package/dist/delivery/agentic-executor.js.map +1 -1
  37. package/dist/delivery/decompose.d.ts +27 -0
  38. package/dist/delivery/decompose.d.ts.map +1 -1
  39. package/dist/delivery/decompose.js +31 -1
  40. package/dist/delivery/decompose.js.map +1 -1
  41. package/dist/delivery/repair-escalation.d.ts +49 -0
  42. package/dist/delivery/repair-escalation.d.ts.map +1 -0
  43. package/dist/delivery/repair-escalation.js +83 -0
  44. package/dist/delivery/repair-escalation.js.map +1 -0
  45. package/dist/delivery/verifier-ladder.d.ts +47 -0
  46. package/dist/delivery/verifier-ladder.d.ts.map +1 -1
  47. package/dist/delivery/verifier-ladder.js +87 -1
  48. package/dist/delivery/verifier-ladder.js.map +1 -1
  49. package/dist/self-harness/mods.d.ts +20 -1
  50. package/dist/self-harness/mods.d.ts.map +1 -1
  51. package/dist/self-harness/mods.js +41 -0
  52. package/dist/self-harness/mods.js.map +1 -1
  53. package/dist/self-harness/orchestrator.js +4 -0
  54. package/dist/self-harness/orchestrator.js.map +1 -1
  55. package/dist/self-harness/transfer.d.ts.map +1 -1
  56. package/dist/self-harness/transfer.js +2 -0
  57. package/dist/self-harness/transfer.js.map +1 -1
  58. package/dist/self-tuning/flag-writer.d.ts +48 -0
  59. package/dist/self-tuning/flag-writer.d.ts.map +1 -0
  60. package/dist/self-tuning/flag-writer.js +102 -0
  61. package/dist/self-tuning/flag-writer.js.map +1 -0
  62. package/dist/self-tuning/flags.d.ts +88 -0
  63. package/dist/self-tuning/flags.d.ts.map +1 -0
  64. package/dist/self-tuning/flags.js +189 -0
  65. package/dist/self-tuning/flags.js.map +1 -0
  66. package/dist/self-tuning/index.d.ts +25 -0
  67. package/dist/self-tuning/index.d.ts.map +1 -0
  68. package/dist/self-tuning/index.js +25 -0
  69. package/dist/self-tuning/index.js.map +1 -0
  70. package/dist/self-tuning/judge.d.ts +66 -0
  71. package/dist/self-tuning/judge.d.ts.map +1 -0
  72. package/dist/self-tuning/judge.js +145 -0
  73. package/dist/self-tuning/judge.js.map +1 -0
  74. package/dist/self-tuning/llm-tuner.d.ts +83 -0
  75. package/dist/self-tuning/llm-tuner.d.ts.map +1 -0
  76. package/dist/self-tuning/llm-tuner.js +191 -0
  77. package/dist/self-tuning/llm-tuner.js.map +1 -0
  78. package/dist/self-tuning/orchestrator.d.ts +90 -0
  79. package/dist/self-tuning/orchestrator.d.ts.map +1 -0
  80. package/dist/self-tuning/orchestrator.js +126 -0
  81. package/dist/self-tuning/orchestrator.js.map +1 -0
  82. package/dist/self-tuning/paired-validator.d.ts +50 -0
  83. package/dist/self-tuning/paired-validator.d.ts.map +1 -0
  84. package/dist/self-tuning/paired-validator.js +78 -0
  85. package/dist/self-tuning/paired-validator.js.map +1 -0
  86. package/dist/self-tuning/profiles/index.d.ts +11 -0
  87. package/dist/self-tuning/profiles/index.d.ts.map +1 -0
  88. package/dist/self-tuning/profiles/index.js +15 -0
  89. package/dist/self-tuning/profiles/index.js.map +1 -0
  90. package/dist/self-tuning/profiles/opus48.d.ts +11 -0
  91. package/dist/self-tuning/profiles/opus48.d.ts.map +1 -0
  92. package/dist/self-tuning/profiles/opus48.js +27 -0
  93. package/dist/self-tuning/profiles/opus48.js.map +1 -0
  94. package/dist/self-tuning/profiles/qwen36.d.ts +11 -0
  95. package/dist/self-tuning/profiles/qwen36.d.ts.map +1 -0
  96. package/dist/self-tuning/profiles/qwen36.js +33 -0
  97. package/dist/self-tuning/profiles/qwen36.js.map +1 -0
  98. package/dist/self-tuning/quality-scorer.d.ts +90 -0
  99. package/dist/self-tuning/quality-scorer.d.ts.map +1 -0
  100. package/dist/self-tuning/quality-scorer.js +180 -0
  101. package/dist/self-tuning/quality-scorer.js.map +1 -0
  102. package/dist/self-tuning/realtime-adaptor.d.ts +78 -0
  103. package/dist/self-tuning/realtime-adaptor.d.ts.map +1 -0
  104. package/dist/self-tuning/realtime-adaptor.js +127 -0
  105. package/dist/self-tuning/realtime-adaptor.js.map +1 -0
  106. package/dist/self-tuning/run.d.ts +61 -0
  107. package/dist/self-tuning/run.d.ts.map +1 -0
  108. package/dist/self-tuning/run.js +122 -0
  109. package/dist/self-tuning/run.js.map +1 -0
  110. package/dist/self-tuning/search-reducer.d.ts +76 -0
  111. package/dist/self-tuning/search-reducer.d.ts.map +1 -0
  112. package/dist/self-tuning/search-reducer.js +349 -0
  113. package/dist/self-tuning/search-reducer.js.map +1 -0
  114. package/dist/self-tuning/tuning-profile.d.ts +72 -0
  115. package/dist/self-tuning/tuning-profile.d.ts.map +1 -0
  116. package/dist/self-tuning/tuning-profile.js +134 -0
  117. package/dist/self-tuning/tuning-profile.js.map +1 -0
  118. package/dist/telemetry/session-telemetry.d.ts +25 -0
  119. package/dist/telemetry/session-telemetry.d.ts.map +1 -1
  120. package/dist/telemetry/session-telemetry.js +32 -0
  121. package/dist/telemetry/session-telemetry.js.map +1 -1
  122. package/dist/types/config.d.ts +13 -0
  123. package/dist/types/config.d.ts.map +1 -1
  124. package/dist/types/config.js +3 -0
  125. package/dist/types/config.js.map +1 -1
  126. package/docs/design/LLM_SELF_TUNING_ANALYSIS.md +617 -0
  127. package/docs/guides/SELF_TUNING.md +137 -0
  128. package/package.json +1 -1
  129. package/src/policies/enforcers/__pycache__/_common.cpython-312.pyc +0 -0
  130. package/tools/agents/scripts/__pycache__/toolcall_path_normalizer.cpython-312.pyc +0 -0
  131. package/tools/agents/scripts/anthropic_proxy.py +355 -29
  132. package/tools/agents/scripts/confidence_escalation.py +60 -4
  133. package/tools/agents/tests/test_confidence_escalation.py +77 -0
@@ -0,0 +1,48 @@
1
+ /**
2
+ * LLM Self-Tuning — the Flag Writer (P1): atomic, validated, rollback-safe
3
+ * application of a tuning proposal to the real UAP configuration.
4
+ *
5
+ * A tuning step applies a `FlagChange[]` across three destinations:
6
+ * - `.uap.json` — json-kind settings (recipes.*, memory.*, delivery.*, …)
7
+ * - `.uap/proxy.env` — proxyEnv-kind settings (PROXY_* the proxy loads at start)
8
+ * - a `shellEnv` map — shell-kind runtime toggles the orchestrator injects into
9
+ * the benchmark child process (no file the proxy sources)
10
+ *
11
+ * It reuses the registry's `applySetting` so every write goes through the SAME
12
+ * bounds/enum validation as `uap config set` — an out-of-range value can never
13
+ * corrupt `.uap.json` and trigger the strict-parse config wipe. Before touching
14
+ * anything it snapshots the raw bytes of both files, so `rollback()` restores
15
+ * the exact prior state (including "file did not exist") after a rejected trial.
16
+ */
17
+ import { FlagChange, FlagConfig } from './flags.js';
18
+ export interface ApplyFlagsResult {
19
+ /** Changes that were validated and persisted (or staged into shellEnv). */
20
+ applied: FlagChange[];
21
+ /** Changes that could not be applied, with the reason. */
22
+ skipped: {
23
+ change: FlagChange;
24
+ reason: string;
25
+ }[];
26
+ /**
27
+ * Env vars for shell-kind flags. These are NOT persisted to a file (nothing
28
+ * sources them); the orchestrator injects them into the benchmark child env.
29
+ */
30
+ shellEnv: Record<string, string>;
31
+ /** Restore `.uap.json` + `.uap/proxy.env` to their exact pre-apply bytes. */
32
+ rollback(): void;
33
+ }
34
+ export interface ApplyFlagsOptions {
35
+ /** Validate + compute effects without writing anything (rollback is a no-op). */
36
+ dryRun?: boolean;
37
+ }
38
+ /**
39
+ * Apply a set of flag changes. json/proxyEnv writes go through `applySetting`
40
+ * (validated); shell flags are collected for the child env. Every change is
41
+ * value-coerced to its flag domain first, so a proposal that overshoots a range
42
+ * is clamped rather than rejected. Returns a `rollback()` that undoes all file
43
+ * writes atomically.
44
+ */
45
+ export declare function applyFlagChanges(cwd: string, changes: FlagChange[], opts?: ApplyFlagsOptions): ApplyFlagsResult;
46
+ /** Apply an entire FlagConfig (every flag → its value). Returns the same handle. */
47
+ export declare function applyFlagConfig(cwd: string, config: FlagConfig, opts?: ApplyFlagsOptions): ApplyFlagsResult;
48
+ //# sourceMappingURL=flag-writer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flag-writer.d.ts","sourceRoot":"","sources":["../../src/self-tuning/flag-writer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAOH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAmD,MAAM,YAAY,CAAC;AA6BrG,MAAM,WAAW,gBAAgB;IAC/B,2EAA2E;IAC3E,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,0DAA0D;IAC1D,OAAO,EAAE;QAAE,MAAM,EAAE,UAAU,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAClD;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,6EAA6E;IAC7E,QAAQ,IAAI,IAAI,CAAC;CAClB;AAED,MAAM,WAAW,iBAAiB;IAChC,iFAAiF;IACjF,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,UAAU,EAAE,EACrB,IAAI,GAAE,iBAAsB,GAC3B,gBAAgB,CAmDlB;AAED,oFAAoF;AACpF,wBAAgB,eAAe,CAC7B,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,UAAU,EAClB,IAAI,GAAE,iBAAsB,GAC3B,gBAAgB,CAElB"}
@@ -0,0 +1,102 @@
1
+ /**
2
+ * LLM Self-Tuning — the Flag Writer (P1): atomic, validated, rollback-safe
3
+ * application of a tuning proposal to the real UAP configuration.
4
+ *
5
+ * A tuning step applies a `FlagChange[]` across three destinations:
6
+ * - `.uap.json` — json-kind settings (recipes.*, memory.*, delivery.*, …)
7
+ * - `.uap/proxy.env` — proxyEnv-kind settings (PROXY_* the proxy loads at start)
8
+ * - a `shellEnv` map — shell-kind runtime toggles the orchestrator injects into
9
+ * the benchmark child process (no file the proxy sources)
10
+ *
11
+ * It reuses the registry's `applySetting` so every write goes through the SAME
12
+ * bounds/enum validation as `uap config set` — an out-of-range value can never
13
+ * corrupt `.uap.json` and trigger the strict-parse config wipe. Before touching
14
+ * anything it snapshots the raw bytes of both files, so `rollback()` restores
15
+ * the exact prior state (including "file did not exist") after a rejected trial.
16
+ */
17
+ import { existsSync, readFileSync, writeFileSync, rmSync, mkdirSync } from 'fs';
18
+ import { dirname, join } from 'path';
19
+ import { findUapConfigPath } from '../utils/config-loader.js';
20
+ import { applySetting } from '../cli/config-command.js';
21
+ import { getSetting } from '../config/settings-registry.js';
22
+ import { coerceToDomain, configToChanges, getTunableFlag } from './flags.js';
23
+ /** Resolve the two files a flag write can touch, given a cwd. */
24
+ function targetPaths(cwd) {
25
+ const uapJson = findUapConfigPath(cwd) ?? join(cwd, '.uap.json');
26
+ const root = dirname(uapJson);
27
+ return { uapJson, proxyEnv: join(root, '.uap', 'proxy.env') };
28
+ }
29
+ function snapshot(path) {
30
+ const existed = existsSync(path);
31
+ return { path, existed, content: existed ? readFileSync(path, 'utf-8') : null };
32
+ }
33
+ function restore(snap) {
34
+ if (snap.existed && snap.content != null) {
35
+ mkdirSync(dirname(snap.path), { recursive: true });
36
+ writeFileSync(snap.path, snap.content, 'utf-8');
37
+ }
38
+ else if (!snap.existed && existsSync(snap.path)) {
39
+ rmSync(snap.path, { force: true });
40
+ }
41
+ }
42
+ /**
43
+ * Apply a set of flag changes. json/proxyEnv writes go through `applySetting`
44
+ * (validated); shell flags are collected for the child env. Every change is
45
+ * value-coerced to its flag domain first, so a proposal that overshoots a range
46
+ * is clamped rather than rejected. Returns a `rollback()` that undoes all file
47
+ * writes atomically.
48
+ */
49
+ export function applyFlagChanges(cwd, changes, opts = {}) {
50
+ const { uapJson, proxyEnv } = targetPaths(cwd);
51
+ const snaps = [snapshot(uapJson), snapshot(proxyEnv)];
52
+ const applied = [];
53
+ const skipped = [];
54
+ const shellEnv = {};
55
+ for (const change of changes) {
56
+ const flag = getTunableFlag(change.key);
57
+ const setting = getSetting(change.key);
58
+ if (!flag || !setting) {
59
+ skipped.push({ change, reason: `not a tunable/registry flag: ${change.key}` });
60
+ continue;
61
+ }
62
+ const coerced = coerceToDomain(change.key, change.to);
63
+ if (coerced === null) {
64
+ skipped.push({ change, reason: `value out of domain: ${String(change.to)}` });
65
+ continue;
66
+ }
67
+ const rawValue = String(coerced);
68
+ // Shell-kind flags never persist to a file — stage them for the child env.
69
+ if (setting.kind === 'env' && setting.target === 'shell') {
70
+ shellEnv[setting.key] = rawValue;
71
+ applied.push({ ...change, to: coerced });
72
+ continue;
73
+ }
74
+ if (opts.dryRun) {
75
+ applied.push({ ...change, to: coerced });
76
+ continue;
77
+ }
78
+ const res = applySetting(cwd, setting, rawValue);
79
+ if (res.ok) {
80
+ applied.push({ ...change, to: coerced });
81
+ }
82
+ else {
83
+ skipped.push({ change, reason: res.message });
84
+ }
85
+ }
86
+ return {
87
+ applied,
88
+ skipped,
89
+ shellEnv,
90
+ rollback() {
91
+ if (opts.dryRun)
92
+ return;
93
+ for (const s of snaps)
94
+ restore(s);
95
+ },
96
+ };
97
+ }
98
+ /** Apply an entire FlagConfig (every flag → its value). Returns the same handle. */
99
+ export function applyFlagConfig(cwd, config, opts = {}) {
100
+ return applyFlagChanges(cwd, configToChanges(config), opts);
101
+ }
102
+ //# sourceMappingURL=flag-writer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flag-writer.js","sourceRoot":"","sources":["../../src/self-tuning/flag-writer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAChF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAA0B,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAErG,iEAAiE;AACjE,SAAS,WAAW,CAAC,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AC,IAAI,CAAC,EAAE,GAAG,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;YACzC,SAAS;QACX,CAAC;QAED,MAAM,GAAG,GAAG,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;QACjD,IAAI,GAAG,CAAC,EAAE,EAAE,CAAC;YACX,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;QAC3C,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IAED,OAAO;QACL,OAAO;QACP,OAAO;QACP,QAAQ;QACR,QAAQ;YACN,IAAI,IAAI,CAAC,MAAM;gBAAE,OAAO;YACxB,KAAK,MAAM,CAAC,IAAI,KAAK;gBAAE,OAAO,CAAC,CAAC,CAAC,CAAC;QACpC,CAAC;KACF,CAAC;AACJ,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,eAAe,CAC7B,GAAW,EACX,MAAkB,EAClB,OAA0B,EAAE;IAE5B,OAAO,gBAAgB,CAAC,GAAG,EAAE,eAAe,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC;AAC9D,CAAC"}
@@ -0,0 +1,88 @@
1
+ /**
2
+ * LLM Self-Tuning — the tunable-flag domain model (P1).
3
+ *
4
+ * This is the SEARCH SPACE. It selects the subset of the UAP settings registry
5
+ * that is safe + impactful to tune toward quality, and enriches each flag with
6
+ * what the optimizer needs: a search domain (bool / enum values / numeric range)
7
+ * and a DEPENDENCY (a flag only "matters" when its parent is in a given state,
8
+ * e.g. `recipes.fusionN` only when `recipes.recipe='fusion'`). The dependency
9
+ * map is the design's §11 flag-dependency graph, and it is what lets the
10
+ * Bayesian optimizer and the LLM tuner prune the 3^42 blow-up to a tractable
11
+ * space (design §3.3.3).
12
+ *
13
+ * Flag values are drawn straight from `settings-registry.ts` where it declares
14
+ * them (type, enumValues, min/max) so the catalog can never drift from the
15
+ * canonical settings; search bounds absent from the registry (e.g. a good range
16
+ * for `memory.shortTerm.maxEntries`) are supplied here.
17
+ */
18
+ import { SettingCategoryId } from '../config/settings-registry.js';
19
+ export type FlagValue = string | number | boolean;
20
+ /** A flat tuning configuration: settings-registry key → value. */
21
+ export type FlagConfig = Record<string, FlagValue>;
22
+ /** A change to one flag (the atom the LLM tuner and flag-writer operate on). */
23
+ export interface FlagChange {
24
+ /** settings-registry key, e.g. `recipes.confidenceThreshold` or `PROXY_LOOP_BREAKER`. */
25
+ key: string;
26
+ from: FlagValue | null;
27
+ to: FlagValue;
28
+ category: SettingCategoryId;
29
+ }
30
+ export type FlagDomain = {
31
+ kind: 'bool';
32
+ } | {
33
+ kind: 'enum';
34
+ values: readonly string[];
35
+ } | {
36
+ kind: 'number';
37
+ min: number;
38
+ max: number;
39
+ int: boolean;
40
+ step: number;
41
+ };
42
+ /** A dependency: this flag only affects behavior when `key` holds one of `values`. */
43
+ export interface FlagDependency {
44
+ key: string;
45
+ values: readonly FlagValue[];
46
+ }
47
+ export interface TunableFlag {
48
+ key: string;
49
+ category: SettingCategoryId;
50
+ domain: FlagDomain;
51
+ /** Default value when unset in a config. */
52
+ default: FlagValue;
53
+ /** All dependencies must be satisfied for this flag to be "active". */
54
+ dependsOn: FlagDependency[];
55
+ }
56
+ /** The resolved tunable-flag catalog. */
57
+ export declare const TUNABLE_FLAGS: readonly TunableFlag[];
58
+ export declare function getTunableFlag(key: string): TunableFlag | undefined;
59
+ /** The all-defaults configuration over every tunable flag. */
60
+ export declare function defaultFlagConfig(): FlagConfig;
61
+ /** Resolve a flag's effective value in a config (its value, or its default). */
62
+ export declare function flagValue(cfg: FlagConfig, key: string): FlagValue | undefined;
63
+ /**
64
+ * Is `flag` ACTIVE in `cfg` — i.e. do all its dependencies hold, TRANSITIVELY?
65
+ * A flag is inactive if any dependency value is unsatisfied OR the dependency
66
+ * flag is itself inactive (e.g. `recipes.fusionN` needs `recipes.recipe` to be
67
+ * `fusion`/`auto` AND `recipes.recipe` needs `recipes.enabled`). An inactive
68
+ * flag's value is irrelevant, so the optimizer never spends search on it and the
69
+ * tuner never proposes changing it. The dependency graph is acyclic.
70
+ */
71
+ export declare function isFlagActive(flag: TunableFlag, cfg: FlagConfig): boolean;
72
+ /** The keys of every flag active in `cfg`. */
73
+ export declare function activeFlags(cfg: FlagConfig): string[];
74
+ /** Human-readable `key = value` lines for the flags active in `cfg`. */
75
+ export declare function describeActiveFlagsList(cfg: FlagConfig): string[];
76
+ /**
77
+ * Coerce/clamp a value into a flag's domain. Numbers are clamped + optionally
78
+ * snapped to int; enums fall back to the default on an unknown value; bools are
79
+ * truth-tested. Returns null when `key` is not a tunable flag.
80
+ */
81
+ export declare function coerceToDomain(key: string, value: FlagValue): FlagValue | null;
82
+ /** Diff two configs into the minimal FlagChange[] (only keys that differ). */
83
+ export declare function diffConfigs(from: FlagConfig, to: FlagConfig): FlagChange[];
84
+ /** Every flag of a config expressed as a FlagChange (from unknown), for a full apply. */
85
+ export declare function configToChanges(cfg: FlagConfig): FlagChange[];
86
+ /** Apply FlagChange[] onto a config, returning a new config (coerced to domain). */
87
+ export declare function applyChanges(cfg: FlagConfig, changes: FlagChange[]): FlagConfig;
88
+ //# sourceMappingURL=flags.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flags.d.ts","sourceRoot":"","sources":["../../src/self-tuning/flags.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAc,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAE/E,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAElD,kEAAkE;AAClE,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAEnD,gFAAgF;AAChF,MAAM,WAAW,UAAU;IAC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AQxE;AAED,8CAA8C;AAC9C,wBAAgB,WAAW,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM,EAAE,CAErD;AAED,wEAAwE;AACxE,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM,EAAE,CAIjE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,SAAS,GAAG,IAAI,CAkB9E;AAED,8EAA8E;AAC9E,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,UAAU,GAAG,UAAU,EAAE,CAU1E;AAED,yFAAyF;AACzF,wBAAgB,eAAe,CAAC,GAAG,EAAE,UAAU,GAAG,UAAU,EAAE,CAO7D;AAED,oFAAoF;AACpF,wBAAgB,YAAY,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,UAAU,CAO/E"}
@@ -0,0 +1,189 @@
1
+ /**
2
+ * LLM Self-Tuning — the tunable-flag domain model (P1).
3
+ *
4
+ * This is the SEARCH SPACE. It selects the subset of the UAP settings registry
5
+ * that is safe + impactful to tune toward quality, and enriches each flag with
6
+ * what the optimizer needs: a search domain (bool / enum values / numeric range)
7
+ * and a DEPENDENCY (a flag only "matters" when its parent is in a given state,
8
+ * e.g. `recipes.fusionN` only when `recipes.recipe='fusion'`). The dependency
9
+ * map is the design's §11 flag-dependency graph, and it is what lets the
10
+ * Bayesian optimizer and the LLM tuner prune the 3^42 blow-up to a tractable
11
+ * space (design §3.3.3).
12
+ *
13
+ * Flag values are drawn straight from `settings-registry.ts` where it declares
14
+ * them (type, enumValues, min/max) so the catalog can never drift from the
15
+ * canonical settings; search bounds absent from the registry (e.g. a good range
16
+ * for `memory.shortTerm.maxEntries`) are supplied here.
17
+ */
18
+ import { getSetting } from '../config/settings-registry.js';
19
+ const CATALOG = [
20
+ // ── Recipes / escalation ──────────────────────────────────────────────────
21
+ { key: 'recipes.enabled' },
22
+ { key: 'recipes.recipe', dependsOn: [{ key: 'recipes.enabled', values: [true] }] },
23
+ {
24
+ key: 'recipes.confidenceThreshold',
25
+ search: { min: 0.3, max: 0.8, step: 0.05 },
26
+ dependsOn: [{ key: 'recipes.recipe', values: ['confidence', 'auto'] }],
27
+ },
28
+ {
29
+ key: 'recipes.fusionN',
30
+ dependsOn: [{ key: 'recipes.recipe', values: ['fusion', 'auto'] }],
31
+ },
32
+ { key: 'recipes.allowSelfJudge', dependsOn: [{ key: 'recipes.enabled', values: [true] }] },
33
+ // ── Hands-free ────────────────────────────────────────────────────────────
34
+ { key: 'handsfree.enabled' },
35
+ { key: 'handsfree.intensity', dependsOn: [{ key: 'handsfree.enabled', values: [true] }] },
36
+ {
37
+ key: 'UAP_HANDSFREE_STAGNATION_LIMIT',
38
+ search: { min: 3, max: 12, int: true, step: 1 },
39
+ dependsOn: [{ key: 'handsfree.enabled', values: [true] }],
40
+ defaultOverride: 8,
41
+ },
42
+ // ── Concurrency ───────────────────────────────────────────────────────────
43
+ { key: 'modelConcurrency.slots', search: { min: 1, max: 8, int: true, step: 1 }, defaultOverride: 4 },
44
+ { key: 'modelConcurrency.adaptive' },
45
+ // ── Memory ────────────────────────────────────────────────────────────────
46
+ { key: 'memory.shortTerm.maxEntries', search: { min: 20, max: 120, int: true, step: 10 }, defaultOverride: 50 },
47
+ { key: 'memory.patternRag.enabled' },
48
+ // ── Verification / delivery ───────────────────────────────────────────────
49
+ { key: 'delivery.runtimeVerify' },
50
+ // ── Proxy guardrails (hot-reloadable-ish; applied via proxy.env) ──────────
51
+ { key: 'PROXY_RECON_CONVERGENCE_THRESHOLD', search: { min: 20, max: 120, int: true, step: 10 }, defaultOverride: 40 },
52
+ { key: 'PROXY_LOOP_BREAKER' },
53
+ { key: 'PROXY_STUCK_BREAK' },
54
+ ];
55
+ function domainFor(spec) {
56
+ const s = getSetting(spec.key);
57
+ if (!s) {
58
+ throw new Error(`self-tuning flags: '${spec.key}' is not in the settings registry`);
59
+ }
60
+ const category = s.category;
61
+ if (s.type === 'boolean') {
62
+ return { domain: { kind: 'bool' }, category, def: spec.defaultOverride ?? (s.default ?? false) };
63
+ }
64
+ if (s.type === 'enum') {
65
+ const values = s.enumValues ?? [];
66
+ return {
67
+ domain: { kind: 'enum', values },
68
+ category,
69
+ def: spec.defaultOverride ?? s.default ?? values[0],
70
+ };
71
+ }
72
+ // number
73
+ const min = spec.search?.min ?? s.min ?? 0;
74
+ const max = spec.search?.max ?? s.max ?? Math.max(1, (Number(s.default) || 1) * 4);
75
+ const int = spec.search?.int ?? s.int ?? false;
76
+ const step = spec.search?.step ?? (int ? 1 : (max - min) / 10);
77
+ const def = spec.defaultOverride ?? (typeof s.default === 'number' ? s.default : (min + max) / 2);
78
+ return { domain: { kind: 'number', min, max, int, step }, category, def };
79
+ }
80
+ /** The resolved tunable-flag catalog. */
81
+ export const TUNABLE_FLAGS = CATALOG.map((spec) => {
82
+ const { domain, category, def } = domainFor(spec);
83
+ return { key: spec.key, category, domain, default: def, dependsOn: spec.dependsOn ?? [] };
84
+ });
85
+ const FLAG_BY_KEY = new Map(TUNABLE_FLAGS.map((f) => [f.key, f]));
86
+ export function getTunableFlag(key) {
87
+ return FLAG_BY_KEY.get(key);
88
+ }
89
+ /** The all-defaults configuration over every tunable flag. */
90
+ export function defaultFlagConfig() {
91
+ const cfg = {};
92
+ for (const f of TUNABLE_FLAGS)
93
+ cfg[f.key] = f.default;
94
+ return cfg;
95
+ }
96
+ /** Resolve a flag's effective value in a config (its value, or its default). */
97
+ export function flagValue(cfg, key) {
98
+ if (key in cfg)
99
+ return cfg[key];
100
+ return FLAG_BY_KEY.get(key)?.default;
101
+ }
102
+ /**
103
+ * Is `flag` ACTIVE in `cfg` — i.e. do all its dependencies hold, TRANSITIVELY?
104
+ * A flag is inactive if any dependency value is unsatisfied OR the dependency
105
+ * flag is itself inactive (e.g. `recipes.fusionN` needs `recipes.recipe` to be
106
+ * `fusion`/`auto` AND `recipes.recipe` needs `recipes.enabled`). An inactive
107
+ * flag's value is irrelevant, so the optimizer never spends search on it and the
108
+ * tuner never proposes changing it. The dependency graph is acyclic.
109
+ */
110
+ export function isFlagActive(flag, cfg) {
111
+ for (const dep of flag.dependsOn) {
112
+ const v = flagValue(cfg, dep.key);
113
+ if (v === undefined || !dep.values.includes(v))
114
+ return false;
115
+ const depFlag = FLAG_BY_KEY.get(dep.key);
116
+ if (depFlag && !isFlagActive(depFlag, cfg))
117
+ return false; // transitive gate
118
+ }
119
+ return true;
120
+ }
121
+ /** The keys of every flag active in `cfg`. */
122
+ export function activeFlags(cfg) {
123
+ return TUNABLE_FLAGS.filter((f) => isFlagActive(f, cfg)).map((f) => f.key);
124
+ }
125
+ /** Human-readable `key = value` lines for the flags active in `cfg`. */
126
+ export function describeActiveFlagsList(cfg) {
127
+ return TUNABLE_FLAGS.filter((f) => isFlagActive(f, cfg)).map((f) => `${f.key} = ${JSON.stringify(flagValue(cfg, f.key))}`);
128
+ }
129
+ /**
130
+ * Coerce/clamp a value into a flag's domain. Numbers are clamped + optionally
131
+ * snapped to int; enums fall back to the default on an unknown value; bools are
132
+ * truth-tested. Returns null when `key` is not a tunable flag.
133
+ */
134
+ export function coerceToDomain(key, value) {
135
+ const flag = FLAG_BY_KEY.get(key);
136
+ if (!flag)
137
+ return null;
138
+ const d = flag.domain;
139
+ if (d.kind === 'bool') {
140
+ if (typeof value === 'boolean')
141
+ return value;
142
+ const s = String(value).toLowerCase();
143
+ return s === 'true' || s === '1' || s === 'yes' || s === 'on';
144
+ }
145
+ if (d.kind === 'enum') {
146
+ return d.values.includes(String(value)) ? String(value) : flag.default;
147
+ }
148
+ // number
149
+ let n = Number(value);
150
+ if (!Number.isFinite(n))
151
+ n = Number(flag.default);
152
+ n = Math.max(d.min, Math.min(d.max, n));
153
+ if (d.int)
154
+ n = Math.round(n);
155
+ return n;
156
+ }
157
+ /** Diff two configs into the minimal FlagChange[] (only keys that differ). */
158
+ export function diffConfigs(from, to) {
159
+ const changes = [];
160
+ for (const flag of TUNABLE_FLAGS) {
161
+ const a = flagValue(from, flag.key);
162
+ const b = flagValue(to, flag.key);
163
+ if (b !== undefined && a !== b) {
164
+ changes.push({ key: flag.key, from: a ?? null, to: b, category: flag.category });
165
+ }
166
+ }
167
+ return changes;
168
+ }
169
+ /** Every flag of a config expressed as a FlagChange (from unknown), for a full apply. */
170
+ export function configToChanges(cfg) {
171
+ const changes = [];
172
+ for (const flag of TUNABLE_FLAGS) {
173
+ const v = flagValue(cfg, flag.key);
174
+ if (v !== undefined)
175
+ changes.push({ key: flag.key, from: null, to: v, category: flag.category });
176
+ }
177
+ return changes;
178
+ }
179
+ /** Apply FlagChange[] onto a config, returning a new config (coerced to domain). */
180
+ export function applyChanges(cfg, changes) {
181
+ const next = { ...cfg };
182
+ for (const c of changes) {
183
+ const coerced = coerceToDomain(c.key, c.to);
184
+ if (coerced !== null)
185
+ next[c.key] = coerced;
186
+ }
187
+ return next;
188
+ }
189
+ //# sourceMappingURL=flags.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flags.js","sourceRoot":"","sources":["../../src/self-tuning/flags.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,UAAU,EAAqB,MAAM,gCAAgC,CAAC;AAoD/E,MAAM,OAAO,GAAkB;IAC7B,6EAA6E;IAC7E,EAAE,GAAG,EAAE,iBAAiB,EAAE;IAC1B,EAAE,GAAG,EAAE,gBAAgB,EAAE,SAAS,EAAE,CAAC,EAAE,GAAG,EAAE,iBAAiB,EAAE,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;IAClF;QACE,GAAG,EAAE,6BAA6B;QAClC,MAAM,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE;QAC1C,SAAS,EAAE,CAAC,EAAE,GAAG,EAAE,gBAAgB,EAAE,MAAM,EAAE,CAAC,YAAY,EAA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AAO,CAAC;AACjB,CAAC;AAED,yFAAyF;AACzF,MAAM,UAAU,eAAe,CAAC,GAAe;IAC7C,MAAM,OAAO,GAAiB,EAAE,CAAC;IACjC,KAAK,MAAM,IAAI,IAAI,aAAa,EAAE,CAAC;QACjC,MAAM,CAAC,GAAG,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;QACnC,IAAI,CAAC,KAAK,SAAS;YAAE,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IACnG,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,YAAY,CAAC,GAAe,EAAE,OAAqB;IACjE,MAAM,IAAI,GAAG,EAAE,GAAG,GAAG,EAAE,CAAC;IACxB,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,MAAM,OAAO,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QAC5C,IAAI,OAAO,KAAK,IAAI;YAAE,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC;IAC9C,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * LLM Self-Tuning — raising a small model (qwen3.6) toward Opus 4.8 by tuning
3
+ * UAP's own flag surface with a closed, benchmark-validated loop.
4
+ *
5
+ * Pipeline (see docs/design/LLM_SELF_TUNING_ANALYSIS.md):
6
+ * P0 quality-scorer — a multi-dimensional quality signal beyond pass/fail
7
+ * P1 llm-tuner — LLM-guided flag proposals over the search space
8
+ * search-reducer — a real Gaussian-process Bayesian optimizer + pruning
9
+ * flag-writer — atomic, validated, rollback-safe config writes
10
+ * tuning-profile — model-specific best-config storage
11
+ * P2 orchestrator/run— the propose → apply → validate → decide → learn loop
12
+ * P4 realtime-adaptor— per-session flag adaptation over the live signal channel
13
+ */
14
+ export * from './judge.js';
15
+ export * from './quality-scorer.js';
16
+ export * from './flags.js';
17
+ export * from './flag-writer.js';
18
+ export * from './tuning-profile.js';
19
+ export * from './search-reducer.js';
20
+ export * from './llm-tuner.js';
21
+ export * from './orchestrator.js';
22
+ export * from './paired-validator.js';
23
+ export * from './run.js';
24
+ export * from './realtime-adaptor.js';
25
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/self-tuning/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,UAAU,CAAC;AACzB,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * LLM Self-Tuning — raising a small model (qwen3.6) toward Opus 4.8 by tuning
3
+ * UAP's own flag surface with a closed, benchmark-validated loop.
4
+ *
5
+ * Pipeline (see docs/design/LLM_SELF_TUNING_ANALYSIS.md):
6
+ * P0 quality-scorer — a multi-dimensional quality signal beyond pass/fail
7
+ * P1 llm-tuner — LLM-guided flag proposals over the search space
8
+ * search-reducer — a real Gaussian-process Bayesian optimizer + pruning
9
+ * flag-writer — atomic, validated, rollback-safe config writes
10
+ * tuning-profile — model-specific best-config storage
11
+ * P2 orchestrator/run— the propose → apply → validate → decide → learn loop
12
+ * P4 realtime-adaptor— per-session flag adaptation over the live signal channel
13
+ */
14
+ export * from './judge.js';
15
+ export * from './quality-scorer.js';
16
+ export * from './flags.js';
17
+ export * from './flag-writer.js';
18
+ export * from './tuning-profile.js';
19
+ export * from './search-reducer.js';
20
+ export * from './llm-tuner.js';
21
+ export * from './orchestrator.js';
22
+ export * from './paired-validator.js';
23
+ export * from './run.js';
24
+ export * from './realtime-adaptor.js';
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/self-tuning/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,UAAU,CAAC;AACzB,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * LLM Self-Tuning — the shared judge/tuner LLM client seam.
3
+ *
4
+ * Both the Quality Scorer (P0) and the LLM Tuner (P1) need to make a REAL call
5
+ * to a stronger "judge" model given a prompt and get text back. This module is
6
+ * the single, injectable seam for that:
7
+ *
8
+ * - `JudgeClient` is a tiny interface (id + complete) so every consumer is
9
+ * testable with a deterministic stub and never hard-wires the network.
10
+ * - `resolveJudgeClient` builds a production client over `OpenAICompatClient`
11
+ * + `ModelPresets`, resolving the judge model from an explicit id, the
12
+ * `recipes.judge.model` config field, or an Opus fallback — the same
13
+ * construction the `uap verify` acceptance judge uses (src/cli/verify.ts).
14
+ * - `parseJsonLenient` recovers a JSON object from a completion even when the
15
+ * model wraps it in prose / ``` fences (the local-model reality), while the
16
+ * `x-uap-json-response` grammar keeps the happy path deterministic.
17
+ *
18
+ * The recipe/confidence-escalation engine that consumes `recipes.judge.model`
19
+ * at serving time lives in the Python proxy; this is the TypeScript-side judge
20
+ * call the offline tuning loop uses. See docs/design/LLM_SELF_TUNING_ANALYSIS.md.
21
+ */
22
+ import type { ModelConfig } from '../models/types.js';
23
+ /** A minimal prompt→text completion seam for the judge/tuner model. */
24
+ export interface JudgeClient {
25
+ /** Human-readable id (model id) for logs and provenance. */
26
+ readonly id: string;
27
+ /** Complete a prompt and return the raw text. `json` requests grammar-constrained JSON. */
28
+ complete(prompt: string, opts?: {
29
+ json?: boolean;
30
+ temperature?: number;
31
+ maxTokens?: number;
32
+ }): Promise<string>;
33
+ }
34
+ export interface ResolveJudgeOptions {
35
+ /** Explicit judge model: a `ModelPresets` key, a preset `apiModel`, or a bare model id. */
36
+ judgeModel?: string;
37
+ /** Endpoint override (e.g. a cloud gateway). Defaults to the client's default. */
38
+ endpoint?: string;
39
+ /** Read `recipes.judge.model` from `.uap.json` in this cwd when `judgeModel` is unset. */
40
+ cwd?: string;
41
+ /** Fallback preset id when nothing resolves. Default 'opus-4.8'. */
42
+ fallbackPreset?: string;
43
+ /** When true, do NOT fall back to a default preset — return null if unresolved. */
44
+ requireExplicit?: boolean;
45
+ }
46
+ /**
47
+ * Resolve a judge model id into a concrete `ModelConfig`. Order of preference:
48
+ * 1. an exact `ModelPresets` key,
49
+ * 2. a preset whose `apiModel` equals the id (accepts wire ids like `claude-opus-4-8`),
50
+ * 3. a synthesized Anthropic-style config using the id verbatim as the apiModel.
51
+ */
52
+ export declare function resolveJudgeModelConfig(id: string, presets: Record<string, ModelConfig>): ModelConfig;
53
+ /**
54
+ * Build a production `JudgeClient`, or null when no judge model can be resolved
55
+ * and `requireExplicit`/no-fallback is in effect. Lazily imports the model layer
56
+ * so callers that never score/tune don't pay for it.
57
+ */
58
+ export declare function resolveJudgeClient(opts?: ResolveJudgeOptions): Promise<JudgeClient | null>;
59
+ /**
60
+ * Extract the first well-formed JSON object/array from a model completion.
61
+ * Tolerates ``` fences, a `<think>` preamble, and leading/trailing prose — the
62
+ * failure modes a local model produces even under the JSON grammar. Returns the
63
+ * parsed value, or null if no balanced JSON literal is found.
64
+ */
65
+ export declare function parseJsonLenient<T = unknown>(text: string): T | null;
66
+ //# sourceMappingURL=judge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"judge.d.ts","sourceRoot":"","sources":["../../src/self-tuning/judge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGtD,uEAAuE;AACvE,MAAM,WAAW,WAAW;IAC1B,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,2FAA2F;IAC3F,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,OAAO,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAChH;AAED,MAAM,WAAW,mBAAmB;IAClC,2FAA2F;IAC3F,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kFAAkF;IAClF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0FAA0F;IAC1F,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,oEAAoE;IACpE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mFAAmF;IACnF,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GACnC,WAAW,CAeb;AAED;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,GAAE,mBAAwB,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CA6BpG;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,CAyCpE"}