@tangle-network/agent-eval 0.120.0 → 0.120.2

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 (171) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/package.json +1 -1
  3. package/dist/analyst/index.d.ts +0 -3111
  4. package/dist/analyst/index.js +0 -403
  5. package/dist/analyst/index.js.map +0 -1
  6. package/dist/authenticity/index.d.ts +0 -161
  7. package/dist/authenticity/index.js +0 -215
  8. package/dist/authenticity/index.js.map +0 -1
  9. package/dist/belief-state/index.d.ts +0 -1301
  10. package/dist/belief-state/index.js +0 -2152
  11. package/dist/belief-state/index.js.map +0 -1
  12. package/dist/benchmarks/index.d.ts +0 -974
  13. package/dist/benchmarks/index.js +0 -60
  14. package/dist/benchmarks/index.js.map +0 -1
  15. package/dist/builder-eval/index.d.ts +0 -695
  16. package/dist/builder-eval/index.js +0 -366
  17. package/dist/builder-eval/index.js.map +0 -1
  18. package/dist/campaign/index.d.ts +0 -7454
  19. package/dist/campaign/index.js +0 -272
  20. package/dist/campaign/index.js.map +0 -1
  21. package/dist/chunk-32BZXMSO.js +0 -3878
  22. package/dist/chunk-32BZXMSO.js.map +0 -1
  23. package/dist/chunk-3A246TSA.js +0 -998
  24. package/dist/chunk-3A246TSA.js.map +0 -1
  25. package/dist/chunk-3RF76KTD.js +0 -84
  26. package/dist/chunk-3RF76KTD.js.map +0 -1
  27. package/dist/chunk-3YYRZDON.js +0 -45
  28. package/dist/chunk-3YYRZDON.js.map +0 -1
  29. package/dist/chunk-4I2E3LLO.js +0 -1030
  30. package/dist/chunk-4I2E3LLO.js.map +0 -1
  31. package/dist/chunk-ARU2PZFM.js +0 -312
  32. package/dist/chunk-ARU2PZFM.js.map +0 -1
  33. package/dist/chunk-BOD4O7OF.js +0 -40
  34. package/dist/chunk-BOD4O7OF.js.map +0 -1
  35. package/dist/chunk-DPZAEKA6.js +0 -880
  36. package/dist/chunk-DPZAEKA6.js.map +0 -1
  37. package/dist/chunk-DTJ6QUQB.js +0 -131
  38. package/dist/chunk-DTJ6QUQB.js.map +0 -1
  39. package/dist/chunk-GGE4NNQT.js +0 -65
  40. package/dist/chunk-GGE4NNQT.js.map +0 -1
  41. package/dist/chunk-H5UD2323.js +0 -286
  42. package/dist/chunk-H5UD2323.js.map +0 -1
  43. package/dist/chunk-HHWE3POT.js +0 -94
  44. package/dist/chunk-HHWE3POT.js.map +0 -1
  45. package/dist/chunk-HKUCJ437.js +0 -787
  46. package/dist/chunk-HKUCJ437.js.map +0 -1
  47. package/dist/chunk-JHCHEVET.js +0 -274
  48. package/dist/chunk-JHCHEVET.js.map +0 -1
  49. package/dist/chunk-JHOJHHU7.js +0 -867
  50. package/dist/chunk-JHOJHHU7.js.map +0 -1
  51. package/dist/chunk-JM2SKQMS.js +0 -750
  52. package/dist/chunk-JM2SKQMS.js.map +0 -1
  53. package/dist/chunk-JN2FCO5W.js +0 -7958
  54. package/dist/chunk-JN2FCO5W.js.map +0 -1
  55. package/dist/chunk-K4DBDHLK.js +0 -158
  56. package/dist/chunk-K4DBDHLK.js.map +0 -1
  57. package/dist/chunk-K6N6XJJX.js +0 -306
  58. package/dist/chunk-K6N6XJJX.js.map +0 -1
  59. package/dist/chunk-MA6HLL3S.js +0 -65
  60. package/dist/chunk-MA6HLL3S.js.map +0 -1
  61. package/dist/chunk-MAZ26DC7.js +0 -99
  62. package/dist/chunk-MAZ26DC7.js.map +0 -1
  63. package/dist/chunk-MOXWMGPC.js +0 -577
  64. package/dist/chunk-MOXWMGPC.js.map +0 -1
  65. package/dist/chunk-NJC7U437.js +0 -626
  66. package/dist/chunk-NJC7U437.js.map +0 -1
  67. package/dist/chunk-NPCTHQIO.js +0 -91
  68. package/dist/chunk-NPCTHQIO.js.map +0 -1
  69. package/dist/chunk-ONWEPEDO.js +0 -57
  70. package/dist/chunk-ONWEPEDO.js.map +0 -1
  71. package/dist/chunk-OYZAPX5G.js +0 -1526
  72. package/dist/chunk-OYZAPX5G.js.map +0 -1
  73. package/dist/chunk-PC4UYEBM.js +0 -166
  74. package/dist/chunk-PC4UYEBM.js.map +0 -1
  75. package/dist/chunk-PICTDURQ.js +0 -766
  76. package/dist/chunk-PICTDURQ.js.map +0 -1
  77. package/dist/chunk-PJQFMIOX.js +0 -1182
  78. package/dist/chunk-PJQFMIOX.js.map +0 -1
  79. package/dist/chunk-PXD6ZFNY.js +0 -1107
  80. package/dist/chunk-PXD6ZFNY.js.map +0 -1
  81. package/dist/chunk-PXE2VKMX.js +0 -140
  82. package/dist/chunk-PXE2VKMX.js.map +0 -1
  83. package/dist/chunk-PZ5AY32C.js +0 -10
  84. package/dist/chunk-PZ5AY32C.js.map +0 -1
  85. package/dist/chunk-QBRSJK47.js +0 -622
  86. package/dist/chunk-QBRSJK47.js.map +0 -1
  87. package/dist/chunk-QWMPPZ3X.js +0 -550
  88. package/dist/chunk-QWMPPZ3X.js.map +0 -1
  89. package/dist/chunk-S3UZOQ5Y.js +0 -328
  90. package/dist/chunk-S3UZOQ5Y.js.map +0 -1
  91. package/dist/chunk-S5TT5R3L.js +0 -2668
  92. package/dist/chunk-S5TT5R3L.js.map +0 -1
  93. package/dist/chunk-T4SQEITX.js +0 -95
  94. package/dist/chunk-T4SQEITX.js.map +0 -1
  95. package/dist/chunk-TT4KNT67.js +0 -124
  96. package/dist/chunk-TT4KNT67.js.map +0 -1
  97. package/dist/chunk-U5CHZ5M3.js +0 -357
  98. package/dist/chunk-U5CHZ5M3.js.map +0 -1
  99. package/dist/chunk-ULOKLHIQ.js +0 -1937
  100. package/dist/chunk-ULOKLHIQ.js.map +0 -1
  101. package/dist/chunk-VI2UW6B6.js +0 -162
  102. package/dist/chunk-VI2UW6B6.js.map +0 -1
  103. package/dist/chunk-VQMK5FMP.js +0 -247
  104. package/dist/chunk-VQMK5FMP.js.map +0 -1
  105. package/dist/chunk-VSMTAMNK.js +0 -53
  106. package/dist/chunk-VSMTAMNK.js.map +0 -1
  107. package/dist/chunk-VZSRQ272.js +0 -149
  108. package/dist/chunk-VZSRQ272.js.map +0 -1
  109. package/dist/chunk-WW2A73HW.js +0 -159
  110. package/dist/chunk-WW2A73HW.js.map +0 -1
  111. package/dist/chunk-X4UCIOTZ.js +0 -136
  112. package/dist/chunk-X4UCIOTZ.js.map +0 -1
  113. package/dist/chunk-XDIRG3TO.js +0 -1266
  114. package/dist/chunk-XDIRG3TO.js.map +0 -1
  115. package/dist/chunk-XJYR7XFV.js +0 -317
  116. package/dist/chunk-XJYR7XFV.js.map +0 -1
  117. package/dist/chunk-ZET2UAYW.js +0 -89
  118. package/dist/chunk-ZET2UAYW.js.map +0 -1
  119. package/dist/chunk-ZZUXHH3R.js +0 -99
  120. package/dist/chunk-ZZUXHH3R.js.map +0 -1
  121. package/dist/cli.d.ts +0 -1
  122. package/dist/cli.js +0 -112
  123. package/dist/cli.js.map +0 -1
  124. package/dist/contract/index.d.ts +0 -4969
  125. package/dist/contract/index.js +0 -1653
  126. package/dist/contract/index.js.map +0 -1
  127. package/dist/control.d.ts +0 -1013
  128. package/dist/control.js +0 -34
  129. package/dist/control.js.map +0 -1
  130. package/dist/fuzz.d.ts +0 -759
  131. package/dist/fuzz.js +0 -714
  132. package/dist/fuzz.js.map +0 -1
  133. package/dist/hosted/index.d.ts +0 -730
  134. package/dist/hosted/index.js +0 -14
  135. package/dist/hosted/index.js.map +0 -1
  136. package/dist/index.d.ts +0 -16780
  137. package/dist/index.js +0 -12168
  138. package/dist/index.js.map +0 -1
  139. package/dist/matrix/index.d.ts +0 -155
  140. package/dist/matrix/index.js +0 -8
  141. package/dist/matrix/index.js.map +0 -1
  142. package/dist/meta-eval/index.d.ts +0 -1030
  143. package/dist/meta-eval/index.js +0 -417
  144. package/dist/meta-eval/index.js.map +0 -1
  145. package/dist/multishot/index.d.ts +0 -579
  146. package/dist/multishot/index.js +0 -589
  147. package/dist/multishot/index.js.map +0 -1
  148. package/dist/openapi.json +0 -992
  149. package/dist/pipelines/index.d.ts +0 -567
  150. package/dist/pipelines/index.js +0 -515
  151. package/dist/pipelines/index.js.map +0 -1
  152. package/dist/reporting.d.ts +0 -1277
  153. package/dist/reporting.js +0 -48
  154. package/dist/reporting.js.map +0 -1
  155. package/dist/rl.d.ts +0 -4092
  156. package/dist/rl.js +0 -1724
  157. package/dist/rl.js.map +0 -1
  158. package/dist/run-campaign-HNFPJET4.js +0 -14
  159. package/dist/run-campaign-HNFPJET4.js.map +0 -1
  160. package/dist/storyboard/index.d.ts +0 -279
  161. package/dist/storyboard/index.js +0 -767
  162. package/dist/storyboard/index.js.map +0 -1
  163. package/dist/trace-attributes.d.ts +0 -52
  164. package/dist/trace-attributes.js +0 -62
  165. package/dist/trace-attributes.js.map +0 -1
  166. package/dist/traces.d.ts +0 -2343
  167. package/dist/traces.js +0 -249
  168. package/dist/traces.js.map +0 -1
  169. package/dist/wire/index.d.ts +0 -1252
  170. package/dist/wire/index.js +0 -81
  171. package/dist/wire/index.js.map +0 -1
@@ -1,215 +0,0 @@
1
- import "../chunk-PZ5AY32C.js";
2
-
3
- // src/authenticity/index.ts
4
- var DEFAULT_MOCK = /\bmock|\bfake|\bdummy|\bstub\b|simulat|hardcoded|placeholder|TODO|not\s+implemented|FIXME/i;
5
- function basename(p) {
6
- return p.split("/").pop() ?? p;
7
- }
8
- function escapeRe(s) {
9
- return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
10
- }
11
- function declaredNames(content) {
12
- const names = /* @__PURE__ */ new Set();
13
- const re = /\b(?:contract|library|interface|abstract\s+contract|class|enum|struct|module|package)\s+([A-Za-z_]\w*)/g;
14
- let m;
15
- while (m = re.exec(content)) {
16
- const name = m[1];
17
- if (name && name.length >= 4) names.add(name);
18
- }
19
- return [...names];
20
- }
21
- function isArtifactReferenced(required, others) {
22
- if (!required.length || !others.length) return false;
23
- return required.some((rf) => {
24
- const stem = rf.path.replace(/\.[^.]+$/, "");
25
- const base = basename(rf.path);
26
- const names = declaredNames(rf.content ?? "");
27
- return others.some((o) => {
28
- const c = o.content ?? "";
29
- if (!c) return false;
30
- if (c.includes(base) || c.includes(stem)) return true;
31
- return names.some((n) => new RegExp(`\\b${escapeRe(n)}\\b`).test(c));
32
- });
33
- });
34
- }
35
- function scoreAuthenticity(files, signals) {
36
- const w = {
37
- artifact: signals.weights?.artifact ?? 40,
38
- impl: signals.weights?.impl ?? 25,
39
- infra: signals.weights?.infra ?? 20,
40
- wiring: signals.weights?.wiring ?? 15
41
- };
42
- const mockRe = signals.mock ?? DEFAULT_MOCK;
43
- const required = signals.requiredArtifact ? files.filter(
44
- (f) => signals.requiredArtifact.test(f.path) && !(signals.vendored?.test(f.path) ?? false)
45
- ) : [];
46
- const others = signals.requiredArtifact ? files.filter((f) => !required.includes(f)) : files;
47
- const requiredText = required.map((f) => f.content ?? "").join("\n");
48
- const otherText = others.map((f) => f.content ?? "").join("\n");
49
- const allText = files.map((f) => f.content ?? "").join("\n");
50
- const requiredArtifactPresent = signals.requiredArtifact ? required.length > 0 : true;
51
- const usesRealImpl = signals.realImpl.test(signals.requiredArtifact ? requiredText : allText);
52
- const realInfra = signals.realInfra.test(allText);
53
- const wired = signals.wiring ? signals.wiring.test(otherText || allText) : false;
54
- const artifactReferenced = isArtifactReferenced(required, others);
55
- const artifactWired = wired || artifactReferenced;
56
- const fakeShim = files.some(
57
- (f) => signals.fakeShim.test(basename(f.path)) || signals.fakeShim.test(f.content ?? "")
58
- );
59
- const mockHits = (allText.match(
60
- new RegExp(mockRe.source, mockRe.flags.includes("g") ? mockRe.flags : `${mockRe.flags}g`)
61
- ) ?? []).length;
62
- const loc = Math.max(1, allText.split("\n").length);
63
- const mockDensity = Math.min(100, Math.round(mockHits / loc * 1e3));
64
- const decorativeArtifact = requiredArtifactPresent && usesRealImpl && !artifactWired;
65
- let realness = 0;
66
- if (requiredArtifactPresent) realness += w.artifact;
67
- if (usesRealImpl) realness += w.impl;
68
- if (realInfra) realness += w.infra;
69
- if (wired) realness += w.wiring;
70
- if (fakeShim) realness -= 25;
71
- realness -= Math.min(20, mockDensity);
72
- realness = Math.max(0, Math.min(100, realness));
73
- const flags = [];
74
- if (signals.requiredArtifact && !requiredArtifactPresent) {
75
- flags.push(
76
- `NO_REQUIRED_ARTIFACT: task needs ${signals.label} artifact (${signals.requiredArtifact}); none produced`
77
- );
78
- }
79
- if (requiredArtifactPresent && signals.requiredArtifact && !usesRealImpl) {
80
- flags.push("ARTIFACT_NO_REAL_IMPL: required artifact exists but lacks the real implementation");
81
- }
82
- if (fakeShim) flags.push("FAKE_SHIM: ships a client-side stand-in simulating the real infra");
83
- if (!realInfra && !requiredArtifactPresent)
84
- flags.push("NO_REAL_INFRA: no real infra calls \u2014 cosmetic at best");
85
- if (mockDensity >= 8)
86
- flags.push(`HIGH_MOCK_DENSITY: ${mockDensity} mock/stub markers per 1000 LOC`);
87
- if (signals.wiring && requiredArtifactPresent && !wired)
88
- flags.push("NOT_WIRED: artifact exists but is never used by the client");
89
- if (decorativeArtifact)
90
- flags.push(
91
- "DEAD_ARTIFACT: required artifact is not referenced/imported anywhere \u2014 decorative or dead code"
92
- );
93
- return {
94
- realness,
95
- requiredArtifactPresent,
96
- requiredArtifactCount: required.length,
97
- usesRealImpl,
98
- realInfra,
99
- wired,
100
- artifactReferenced,
101
- artifactWired,
102
- fakeShim,
103
- mockDensity,
104
- flags
105
- };
106
- }
107
- function gateRealness(r, opts = {}) {
108
- const floor = opts.floor ?? 30;
109
- if ((opts.requireArtifact ?? true) && !r.requiredArtifactPresent) {
110
- return { gated: true, reason: "required artifact missing" };
111
- }
112
- if (r.fakeShim && !r.usesRealImpl) {
113
- return { gated: true, reason: "fake shim with no real implementation" };
114
- }
115
- if (opts.requireArtifactWired && r.requiredArtifactPresent && r.usesRealImpl && !r.artifactWired) {
116
- return { gated: true, reason: "required artifact present but never wired into the system" };
117
- }
118
- if (r.realness < floor)
119
- return { gated: true, reason: `realness ${r.realness} below floor ${floor}` };
120
- return { gated: false };
121
- }
122
- function fileDigest(files, opts = {}) {
123
- const maxFiles = opts.maxFiles ?? 14;
124
- const perFile = opts.perFile ?? 1200;
125
- const ordered = opts.prioritize ? [...files].sort(
126
- (a, b) => Number(opts.prioritize.test(b.path)) - Number(opts.prioritize.test(a.path))
127
- ) : files;
128
- return ordered.slice(0, maxFiles).map((f) => `// ${f.path}
129
- ${(f.content ?? "").slice(0, perFile)}`).join("\n\n");
130
- }
131
- function clampPct(v) {
132
- const n = typeof v === "number" ? v : Number(v);
133
- return Number.isFinite(n) ? Math.max(0, Math.min(100, Math.round(n))) : 0;
134
- }
135
- async function scoreAuthenticityNuance(files, complete, opts = {}) {
136
- const system = 'You audit whether an agent BUILT THE REAL THING or faked it. Be skeptical: a pretty UI, cosmetic labels, simulated/in-memory stand-ins for real infra, and cargo-culted imports do NOT count as real. Respond with ONLY JSON: {"mockedPct":0-100,"fakePct":0-100,"uniquePct":0-100,"verdict":"one sentence"}. mockedPct = how much is mocked/stubbed; fakePct = how hollow/facade it is; uniquePct = how distinctive vs boilerplate.';
137
- const user = (opts.intent ? `Intended deliverable: ${opts.intent}
138
-
139
- ` : "") + `Produced files:
140
- ${fileDigest(files, { prioritize: opts.prioritize })}`;
141
- try {
142
- const raw = await complete(system, user);
143
- const m = raw.match(/\{[\s\S]*\}/);
144
- if (!m)
145
- return { mockedPct: 100, fakePct: 100, uniquePct: 0, verdict: "unparseable judge response" };
146
- const j = JSON.parse(m[0]);
147
- return {
148
- mockedPct: clampPct(j.mockedPct),
149
- fakePct: clampPct(j.fakePct),
150
- uniquePct: clampPct(j.uniquePct),
151
- verdict: typeof j.verdict === "string" ? j.verdict : ""
152
- };
153
- } catch (err) {
154
- return {
155
- mockedPct: 100,
156
- fakePct: 100,
157
- uniquePct: 0,
158
- verdict: `judge error: ${err instanceof Error ? err.message : String(err)}`
159
- };
160
- }
161
- }
162
- async function judgeRealnessLlm(files, complete, opts = {}) {
163
- const system = "You are a skeptical auditor. Rate how REAL an agent's build is vs the intended deliverable, 0-100. A genuine implementation of the HARD part on the intended infrastructure is SUBSTANTIALLY REAL (>=50) even if peripheral layers are stubbed; a pure simulator / facade / branded-type stand-in / no-op-stubbed dependency with no real implementation is FAKE (<=25). Judge the core on its merits and note the runtime. " + (opts.rubric ? `Domain rubric: ${opts.rubric} ` : "") + 'Respond with ONLY JSON: {"isReal":0-100,"why":"one sentence"}.';
164
- const user = (opts.intent ? `Intended deliverable: ${opts.intent}
165
-
166
- ` : "") + `Produced files:
167
- ${fileDigest(files, { prioritize: opts.prioritize })}`;
168
- try {
169
- const raw = await complete(system, user);
170
- const m = raw.match(/\{[\s\S]*\}/);
171
- if (!m) return { isReal: 0, rationale: "unparseable judge response" };
172
- const j = JSON.parse(m[0]);
173
- return {
174
- isReal: clampPct(j.isReal),
175
- rationale: typeof j.why === "string" ? j.why : ""
176
- };
177
- } catch (err) {
178
- return {
179
- isReal: 0,
180
- rationale: `judge error: ${err instanceof Error ? err.message : String(err)}`
181
- };
182
- }
183
- }
184
- async function scoreRealnessBlended(files, signals, complete, opts = {}) {
185
- const det = scoreAuthenticity(files, signals);
186
- const [lo, hi] = opts.grayBand ?? [30, 70];
187
- const mockGray = opts.mockGrayThreshold ?? 8;
188
- const conflict = det.requiredArtifactPresent && det.usesRealImpl && (det.fakeShim || !det.wired || det.mockDensity >= mockGray);
189
- const midRange = det.realness >= lo && det.realness <= hi;
190
- let band;
191
- if (conflict || midRange) band = "gray";
192
- else if (det.realness < lo) band = "clean-fake";
193
- else band = "clean-real";
194
- if (band !== "gray") {
195
- return { ...det, blendedRealness: det.realness, band, consultedLlm: false };
196
- }
197
- const judgment = await judgeRealnessLlm(files, complete, {
198
- intent: opts.intent,
199
- rubric: opts.rubric,
200
- prioritize: signals.requiredArtifact
201
- });
202
- const blendedRealness = Math.max(
203
- 0,
204
- Math.min(100, Math.round(0.25 * det.realness + 0.75 * judgment.isReal))
205
- );
206
- return { ...det, blendedRealness, band, consultedLlm: true, judgment };
207
- }
208
- export {
209
- gateRealness,
210
- judgeRealnessLlm,
211
- scoreAuthenticity,
212
- scoreAuthenticityNuance,
213
- scoreRealnessBlended
214
- };
215
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/authenticity/index.ts"],"sourcesContent":["/**\n * Authenticity — \"is this real, or convincing BS?\"\n *\n * Pass/build-style scoring rewards anything that compiles and renders, so an\n * agent can ship a polished frontend with a FAKE in-browser engine and zero of\n * the required on-chain/contract work, and outscore a half-finished real\n * implementation. This module scores what buildability does not: did the agent\n * actually build the intended thing on the intended infra, or fake it.\n *\n * Two layers:\n * - DETERMINISTIC `scoreAuthenticity` — calibrated by construction (no LLM,\n * trustworthy today). Structural signals over the produced files, driven by\n * a domain `AuthenticitySignals` config: required artifact present, real\n * implementation of the hard part, real infra calls, wiring, fake-shim\n * detection, mock/stub density.\n * - LLM NUANCE `scoreAuthenticityNuance` — mocked% / fake% / unique% for the\n * \"looks real but is hollow\" cases structure can't see.\n *\n * `gateRealness` is the anti-Goodhart gate: a submission missing the required\n * artifact (or faking it) is capped and cannot rank high regardless of how\n * buildable it is. Domain-agnostic; ships a Solidity/Fhenix preset.\n *\n * Input is the produced-state currency: `{ path, content }[]` — exactly what\n * `extractProducedState(...).artifacts` yields, so any consumer can feed a run's\n * produced state straight in.\n */\n\nexport interface ProducedFile {\n path: string\n content?: string\n}\n\nexport interface AuthenticitySignals {\n /** Human label for the domain (e.g. 'fhenix-fhe'). */\n label: string\n /** A file the task REQUIRES (e.g. /\\.sol$/ for an on-chain task). */\n requiredArtifact?: RegExp\n /** Vendored/3rd-party paths to exclude from required-artifact detection. */\n vendored?: RegExp\n /** Real implementation of the hard part, inside the required artifact\n * (e.g. Fhenix encrypted types + FHE.* ops). Matched against content, so it\n * fails on comments/strings only if the regex is written tightly. */\n realImpl: RegExp\n /** Real use of the intended client infra (e.g. cofhejs.encrypt() calls). */\n realInfra: RegExp\n /** Evidence the artifact is actually wired/used (e.g. contract writes). */\n wiring?: RegExp\n /** A fake shim standing in for the real thing — matched on file path AND body. */\n fakeShim: RegExp\n /** Mock/stub/TODO markers. Defaults to a generic set. */\n mock?: RegExp\n /** Score weights (default 40/25/20/15). */\n weights?: { artifact?: number; impl?: number; infra?: number; wiring?: number }\n}\n\nexport interface AuthenticityResult {\n /** Deterministic realness, 0 (BS) … 100 (real on real infra). */\n realness: number\n requiredArtifactPresent: boolean\n requiredArtifactCount: number\n usesRealImpl: boolean\n realInfra: boolean\n wired: boolean\n /** The required artifact is actually referenced/imported by other (non-artifact)\n * files — i.e. wired into the rest of the system, not dead code. Domain-agnostic:\n * a deliverable nothing else uses is suspect in any vertical. */\n artifactReferenced: boolean\n /** Convenience: the artifact is connected to the running system, via either the\n * domain wiring signal OR a structural reference. */\n artifactWired: boolean\n fakeShim: boolean\n /** mock/stub markers per 1000 LOC, capped at 100. */\n mockDensity: number\n /** Human-readable BS flags — what's missing or faked. */\n flags: string[]\n}\n\nconst DEFAULT_MOCK =\n /\\bmock|\\bfake|\\bdummy|\\bstub\\b|simulat|hardcoded|placeholder|TODO|not\\s+implemented|FIXME/i\n\nfunction basename(p: string): string {\n return p.split('/').pop() ?? p\n}\n\nfunction escapeRe(s: string): string {\n return s.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n}\n\n/** Top-level symbols a source file declares (contract/library/class/etc.), used to\n * test whether other files reference the artifact. Language-agnostic keyword set. */\nfunction declaredNames(content: string): string[] {\n const names = new Set<string>()\n const re =\n /\\b(?:contract|library|interface|abstract\\s+contract|class|enum|struct|module|package)\\s+([A-Za-z_]\\w*)/g\n let m: RegExpExecArray | null\n while ((m = re.exec(content))) {\n const name = m[1]\n if (name && name.length >= 4) names.add(name)\n }\n return [...names]\n}\n\n/** Is a required artifact referenced/imported by any non-artifact file? Catches the\n * \"decorative / dead-code artifact\" facade (a real-looking deliverable nothing in\n * the running system imports, deploys, or calls). Purely structural — no domain. */\nfunction isArtifactReferenced(\n required: readonly ProducedFile[],\n others: readonly ProducedFile[],\n): boolean {\n if (!required.length || !others.length) return false\n return required.some((rf) => {\n const stem = rf.path.replace(/\\.[^.]+$/, '') // import-path stem (no ext)\n const base = basename(rf.path) // filename incl. ext\n const names = declaredNames(rf.content ?? '')\n return others.some((o) => {\n const c = o.content ?? ''\n if (!c) return false\n if (c.includes(base) || c.includes(stem)) return true // import of the path\n return names.some((n) => new RegExp(`\\\\b${escapeRe(n)}\\\\b`).test(c)) // symbol reference\n })\n })\n}\n\n/** Deterministic authenticity scan of produced files. Pure — same files in,\n * same score out. No LLM, no IO. */\nexport function scoreAuthenticity(\n files: readonly ProducedFile[],\n signals: AuthenticitySignals,\n): AuthenticityResult {\n const w = {\n artifact: signals.weights?.artifact ?? 40,\n impl: signals.weights?.impl ?? 25,\n infra: signals.weights?.infra ?? 20,\n wiring: signals.weights?.wiring ?? 15,\n }\n const mockRe = signals.mock ?? DEFAULT_MOCK\n\n const required = signals.requiredArtifact\n ? files.filter(\n (f) => signals.requiredArtifact!.test(f.path) && !(signals.vendored?.test(f.path) ?? false),\n )\n : []\n const others = signals.requiredArtifact ? files.filter((f) => !required.includes(f)) : files\n\n const requiredText = required.map((f) => f.content ?? '').join('\\n')\n const otherText = others.map((f) => f.content ?? '').join('\\n')\n const allText = files.map((f) => f.content ?? '').join('\\n')\n\n const requiredArtifactPresent = signals.requiredArtifact ? required.length > 0 : true\n // Real impl looked for in the required artifact when there is one, else anywhere.\n const usesRealImpl = signals.realImpl.test(signals.requiredArtifact ? requiredText : allText)\n const realInfra = signals.realInfra.test(allText)\n const wired = signals.wiring ? signals.wiring.test(otherText || allText) : false\n // Structural: is the required artifact actually used by the rest of the system?\n const artifactReferenced = isArtifactReferenced(required, others)\n const artifactWired = wired || artifactReferenced\n const fakeShim = files.some(\n (f) => signals.fakeShim.test(basename(f.path)) || signals.fakeShim.test(f.content ?? ''),\n )\n\n const mockHits = (\n allText.match(\n new RegExp(mockRe.source, mockRe.flags.includes('g') ? mockRe.flags : `${mockRe.flags}g`),\n ) ?? []\n ).length\n const loc = Math.max(1, allText.split('\\n').length)\n const mockDensity = Math.min(100, Math.round((mockHits / loc) * 1000))\n\n // A real-looking artifact that nothing in the system imports/deploys/calls is\n // decorative (dead code) — a common facade. We REPORT this (flag + signal) but do\n // NOT auto-penalize the score: structural reference detection is noisy (an ABI or\n // placeholder-address file makes a dead contract look \"referenced\", while a strong\n // contract-only submission looks \"dead\"), so a score penalty manufactures false\n // negatives on legitimately-partial work. Gate on it only via opts.requireArtifactWired,\n // and let the LLM-nuance layer resolve the ambiguous middle band.\n const decorativeArtifact = requiredArtifactPresent && usesRealImpl && !artifactWired\n\n let realness = 0\n if (requiredArtifactPresent) realness += w.artifact\n if (usesRealImpl) realness += w.impl\n if (realInfra) realness += w.infra\n if (wired) realness += w.wiring\n if (fakeShim) realness -= 25\n realness -= Math.min(20, mockDensity)\n realness = Math.max(0, Math.min(100, realness))\n\n const flags: string[] = []\n if (signals.requiredArtifact && !requiredArtifactPresent) {\n flags.push(\n `NO_REQUIRED_ARTIFACT: task needs ${signals.label} artifact (${signals.requiredArtifact}); none produced`,\n )\n }\n if (requiredArtifactPresent && signals.requiredArtifact && !usesRealImpl) {\n flags.push('ARTIFACT_NO_REAL_IMPL: required artifact exists but lacks the real implementation')\n }\n if (fakeShim) flags.push('FAKE_SHIM: ships a client-side stand-in simulating the real infra')\n if (!realInfra && !requiredArtifactPresent)\n flags.push('NO_REAL_INFRA: no real infra calls — cosmetic at best')\n if (mockDensity >= 8)\n flags.push(`HIGH_MOCK_DENSITY: ${mockDensity} mock/stub markers per 1000 LOC`)\n if (signals.wiring && requiredArtifactPresent && !wired)\n flags.push('NOT_WIRED: artifact exists but is never used by the client')\n if (decorativeArtifact)\n flags.push(\n 'DEAD_ARTIFACT: required artifact is not referenced/imported anywhere — decorative or dead code',\n )\n\n return {\n realness,\n requiredArtifactPresent,\n requiredArtifactCount: required.length,\n usesRealImpl,\n realInfra,\n wired,\n artifactReferenced,\n artifactWired,\n fakeShim,\n mockDensity,\n flags,\n }\n}\n\nexport interface RealnessGate {\n gated: boolean\n reason?: string\n}\n\n/** Anti-Goodhart gate: a required-artifact-missing or faked submission is\n * capped and cannot rank high regardless of buildability. */\nexport function gateRealness(\n r: AuthenticityResult,\n opts: { floor?: number; requireArtifact?: boolean; requireArtifactWired?: boolean } = {},\n): RealnessGate {\n const floor = opts.floor ?? 30\n if ((opts.requireArtifact ?? true) && !r.requiredArtifactPresent) {\n return { gated: true, reason: 'required artifact missing' }\n }\n if (r.fakeShim && !r.usesRealImpl) {\n return { gated: true, reason: 'fake shim with no real implementation' }\n }\n // Opt-in (default off): a vertical where the deliverable MUST be wired into the\n // running system can reject a decorative/dead artifact. Off by default because a\n // contract-only (incomplete-but-real) submission is legitimately partial, not fake.\n if (\n opts.requireArtifactWired &&\n r.requiredArtifactPresent &&\n r.usesRealImpl &&\n !r.artifactWired\n ) {\n return { gated: true, reason: 'required artifact present but never wired into the system' }\n }\n if (r.realness < floor)\n return { gated: true, reason: `realness ${r.realness} below floor ${floor}` }\n return { gated: false }\n}\n\n// ── LLM nuance layer ─────────────────────────────────────────────────────────\n\nexport interface AuthenticityNuance {\n /** 0 (nothing mocked) … 100 (entirely mocked). */\n mockedPct: number\n /** 0 (genuine) … 100 (a hollow facade / cargo-culted). */\n fakePct: number\n /** 0 (boilerplate/template clone) … 100 (distinctive real work). */\n uniquePct: number\n verdict: string\n}\n\n/** A minimal completion fn — inject your model caller (router/tcloud). Keeps\n * this module free of any specific LLM client. */\nexport type CompleteFn = (system: string, user: string) => Promise<string>\n\nfunction fileDigest(\n files: readonly ProducedFile[],\n opts: { maxFiles?: number; perFile?: number; prioritize?: RegExp } = {},\n): string {\n const maxFiles = opts.maxFiles ?? 14\n const perFile = opts.perFile ?? 1200\n // Lead with the required-artifact files (e.g. .sol) so a truncated digest\n // never hides the very thing the judge must assess.\n const ordered = opts.prioritize\n ? [...files].sort(\n (a, b) => Number(opts.prioritize!.test(b.path)) - Number(opts.prioritize!.test(a.path)),\n )\n : files\n return ordered\n .slice(0, maxFiles)\n .map((f) => `// ${f.path}\\n${(f.content ?? '').slice(0, perFile)}`)\n .join('\\n\\n')\n}\n\nfunction clampPct(v: unknown): number {\n const n = typeof v === 'number' ? v : Number(v)\n return Number.isFinite(n) ? Math.max(0, Math.min(100, Math.round(n))) : 0\n}\n\n/**\n * LLM nuance scoring — judges the \"looks real but is hollow\" axis structure\n * misses. Inject a `complete` caller; returns mocked/fake/unique % + a verdict.\n * Fail-soft: a bad/unparseable response yields a worst-case (fully-fake) read,\n * never a false pass.\n */\nexport async function scoreAuthenticityNuance(\n files: readonly ProducedFile[],\n complete: CompleteFn,\n opts: { intent?: string; prioritize?: RegExp } = {},\n): Promise<AuthenticityNuance> {\n const system =\n 'You audit whether an agent BUILT THE REAL THING or faked it. Be skeptical: ' +\n 'a pretty UI, cosmetic labels, simulated/in-memory stand-ins for real infra, ' +\n 'and cargo-culted imports do NOT count as real. Respond with ONLY JSON: ' +\n '{\"mockedPct\":0-100,\"fakePct\":0-100,\"uniquePct\":0-100,\"verdict\":\"one sentence\"}. ' +\n 'mockedPct = how much is mocked/stubbed; fakePct = how hollow/facade it is; ' +\n 'uniquePct = how distinctive vs boilerplate.'\n const user =\n (opts.intent ? `Intended deliverable: ${opts.intent}\\n\\n` : '') +\n `Produced files:\\n${fileDigest(files, { prioritize: opts.prioritize })}`\n try {\n const raw = await complete(system, user)\n const m = raw.match(/\\{[\\s\\S]*\\}/)\n if (!m)\n return { mockedPct: 100, fakePct: 100, uniquePct: 0, verdict: 'unparseable judge response' }\n const j = JSON.parse(m[0]) as Record<string, unknown>\n return {\n mockedPct: clampPct(j.mockedPct),\n fakePct: clampPct(j.fakePct),\n uniquePct: clampPct(j.uniquePct),\n verdict: typeof j.verdict === 'string' ? j.verdict : '',\n }\n } catch (err) {\n return {\n mockedPct: 100,\n fakePct: 100,\n uniquePct: 0,\n verdict: `judge error: ${err instanceof Error ? err.message : String(err)}`,\n }\n }\n}\n\n// ── Realness-direct LLM judge ─────────────────────────────────────────────────\n\nexport interface RealnessJudgment {\n /** 0 (facade/simulator) … 100 (real implementation on the intended infra). */\n isReal: number\n rationale: string\n}\n\n/**\n * Ask an LLM to rate realness DIRECTLY on a 0-100 scale — the axis that matched\n * human blind-labels in validation (F1 0.80→0.88 on the gray band; a fakePct/\n * hollowness proxy over-penalized \"real core + stubbed periphery\" partials, and a\n * weak judge model over-flagged — use a strong one). Domain-agnostic skeleton; the\n * consumer supplies `intent` (what the deliverable should be) and `rubric` (domain\n * specifics of real-vs-fake). Fail-closed: a bad response reads as fully fake.\n */\nexport async function judgeRealnessLlm(\n files: readonly ProducedFile[],\n complete: CompleteFn,\n opts: { intent?: string; rubric?: string; prioritize?: RegExp } = {},\n): Promise<RealnessJudgment> {\n const system =\n \"You are a skeptical auditor. Rate how REAL an agent's build is vs the intended \" +\n 'deliverable, 0-100. A genuine implementation of the HARD part on the intended ' +\n 'infrastructure is SUBSTANTIALLY REAL (>=50) even if peripheral layers are stubbed; ' +\n 'a pure simulator / facade / branded-type stand-in / no-op-stubbed dependency with ' +\n 'no real implementation is FAKE (<=25). Judge the core on its merits and note the ' +\n 'runtime. ' +\n (opts.rubric ? `Domain rubric: ${opts.rubric} ` : '') +\n 'Respond with ONLY JSON: {\"isReal\":0-100,\"why\":\"one sentence\"}.'\n const user =\n (opts.intent ? `Intended deliverable: ${opts.intent}\\n\\n` : '') +\n `Produced files:\\n${fileDigest(files, { prioritize: opts.prioritize })}`\n try {\n const raw = await complete(system, user)\n const m = raw.match(/\\{[\\s\\S]*\\}/)\n if (!m) return { isReal: 0, rationale: 'unparseable judge response' }\n const j = JSON.parse(m[0]) as Record<string, unknown>\n return {\n isReal: clampPct(j.isReal),\n rationale: typeof j.why === 'string' ? j.why : '',\n }\n } catch (err) {\n return {\n isReal: 0,\n rationale: `judge error: ${err instanceof Error ? err.message : String(err)}`,\n }\n }\n}\n\n// ── Blended pipeline: deterministic for the clean extremes, LLM for the gray band ─\n\nexport type RealnessBand = 'clean-real' | 'clean-fake' | 'gray'\n\nexport interface BlendedRealness extends AuthenticityResult {\n /** Final realness after (only-when-needed) LLM adjudication, 0…100. */\n blendedRealness: number\n band: RealnessBand\n /** True iff the LLM judge was actually consulted (gray band only). */\n consultedLlm: boolean\n /** Present iff the LLM was consulted. */\n judgment?: RealnessJudgment\n}\n\n/**\n * Score realness using the cheapest sufficient signal: trust the deterministic\n * scorer on the CLEAN extremes (obvious fakes / obviously-real-and-wired), and only\n * spend an LLM call on the GRAY band — cells that look real structurally but carry\n * fakeness markers (a fake shim, an unwired/dead artifact, high mock density) or land\n * mid-range. This caps LLM cost at the fraction of cells static analysis can't\n * resolve, which matters at multi-vertical / multi-partner scale.\n *\n * Domain-agnostic: the gray-band TRIGGER is structural; the LLM judges via the\n * consumer-supplied `intent`. Fail-closed (a bad LLM response reads as fully fake).\n */\nexport async function scoreRealnessBlended(\n files: readonly ProducedFile[],\n signals: AuthenticitySignals,\n complete: CompleteFn,\n opts: {\n intent?: string\n rubric?: string\n grayBand?: [number, number]\n mockGrayThreshold?: number\n } = {},\n): Promise<BlendedRealness> {\n const det = scoreAuthenticity(files, signals)\n const [lo, hi] = opts.grayBand ?? [30, 70]\n const mockGray = opts.mockGrayThreshold ?? 8\n\n // Structural conflict: a real artifact whose RUNTIME authenticity static analysis\n // can't settle — a fake shim is present, or it isn't wired to a real client (could\n // be a decorative contract next to a simulator, OR an incomplete-but-real build),\n // or mock density is high. Empirically (21 labeled cells) this routes 100% of the\n // deterministic errors to the LLM while leaving an error-free clean band.\n const conflict =\n det.requiredArtifactPresent &&\n det.usesRealImpl &&\n (det.fakeShim || !det.wired || det.mockDensity >= mockGray)\n const midRange = det.realness >= lo && det.realness <= hi\n\n let band: RealnessBand\n if (conflict || midRange) band = 'gray'\n else if (det.realness < lo) band = 'clean-fake'\n else band = 'clean-real'\n\n if (band !== 'gray') {\n return { ...det, blendedRealness: det.realness, band, consultedLlm: false }\n }\n\n // In the gray band the LLM read dominates (that's why we paid for it), with the\n // deterministic score as a light anchor. Weights 0.25/0.75 validated against blind\n // human labels (F1 0.88 vs 0.80 deterministic-only).\n const judgment = await judgeRealnessLlm(files, complete, {\n intent: opts.intent,\n rubric: opts.rubric,\n prioritize: signals.requiredArtifact,\n })\n const blendedRealness = Math.max(\n 0,\n Math.min(100, Math.round(0.25 * det.realness + 0.75 * judgment.isReal)),\n )\n return { ...det, blendedRealness, band, consultedLlm: true, judgment }\n}\n\n// Domain `AuthenticitySignals` (e.g. a Solidity/Fhenix preset) live in the\n// CONSUMER, not the substrate — this module stays domain-agnostic.\n"],"mappings":";;;AA6EA,IAAM,eACJ;AAEF,SAAS,SAAS,GAAmB;AACnC,SAAO,EAAE,MAAM,GAAG,EAAE,IAAI,KAAK;AAC/B;AAEA,SAAS,SAAS,GAAmB;AACnC,SAAO,EAAE,QAAQ,uBAAuB,MAAM;AAChD;AAIA,SAAS,cAAc,SAA2B;AAChD,QAAM,QAAQ,oBAAI,IAAY;AAC9B,QAAM,KACJ;AACF,MAAI;AACJ,SAAQ,IAAI,GAAG,KAAK,OAAO,GAAI;AAC7B,UAAM,OAAO,EAAE,CAAC;AAChB,QAAI,QAAQ,KAAK,UAAU,EAAG,OAAM,IAAI,IAAI;AAAA,EAC9C;AACA,SAAO,CAAC,GAAG,KAAK;AAClB;AAKA,SAAS,qBACP,UACA,QACS;AACT,MAAI,CAAC,SAAS,UAAU,CAAC,OAAO,OAAQ,QAAO;AAC/C,SAAO,SAAS,KAAK,CAAC,OAAO;AAC3B,UAAM,OAAO,GAAG,KAAK,QAAQ,YAAY,EAAE;AAC3C,UAAM,OAAO,SAAS,GAAG,IAAI;AAC7B,UAAM,QAAQ,cAAc,GAAG,WAAW,EAAE;AAC5C,WAAO,OAAO,KAAK,CAAC,MAAM;AACxB,YAAM,IAAI,EAAE,WAAW;AACvB,UAAI,CAAC,EAAG,QAAO;AACf,UAAI,EAAE,SAAS,IAAI,KAAK,EAAE,SAAS,IAAI,EAAG,QAAO;AACjD,aAAO,MAAM,KAAK,CAAC,MAAM,IAAI,OAAO,MAA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