literally-aeo 0.4.1 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -0
- package/dist/cli.mjs +1505 -549
- package/dist/lib/agents/copy-validation.js +3 -1
- package/dist/lib/agents/methodology.js +3 -3
- package/dist/lib/agents/verifier.js +2 -2
- package/dist/lib/bundle/contracts.js +1 -1
- package/dist/lib/bundle/export.js +13 -13
- package/dist/lib/bundle/journal.js +2 -2
- package/dist/lib/bundle/project-journal.js +5 -5
- package/dist/lib/bundle/project.js +11 -11
- package/dist/lib/bundle/read.js +14 -14
- package/dist/lib/bundle/recorder.js +3 -3
- package/dist/lib/bundle/redact.js +2 -2
- package/dist/lib/bundle/trace-coverage.js +2 -2
- package/dist/lib/bundle/verify-integrity.js +4 -4
- package/dist/lib/bundle/verify-measurement.js +2 -2
- package/dist/lib/bundle/verify-report.js +3 -3
- package/dist/lib/bundle/verify.js +8 -8
- package/dist/lib/checks/run-checks.js +4 -4
- package/dist/lib/chunks/{chunk-4KF5EVLI.js → chunk-2ANSPIUT.js} +2 -2
- package/dist/lib/chunks/{chunk-G22MXBBM.js → chunk-54GMIPWV.js} +1 -1
- package/dist/lib/chunks/{chunk-PI7PZKHP.js → chunk-65OIYOUH.js} +2 -2
- package/dist/lib/chunks/{chunk-2XMVEGQG.js → chunk-6MGXILUJ.js} +1 -1
- package/dist/lib/chunks/chunk-6OURIXQZ.js +472 -0
- package/dist/lib/chunks/{chunk-OBSW2WKF.js → chunk-746643QV.js} +1 -1
- package/dist/lib/chunks/{chunk-7DR2X7SF.js → chunk-74K4E3ZS.js} +1 -1
- package/dist/lib/chunks/{chunk-JVIOWZPG.js → chunk-7HCVSLVG.js} +1 -1
- package/dist/lib/chunks/{chunk-XX2TK6FI.js → chunk-7K2XT3WI.js} +5 -5
- package/dist/lib/chunks/{chunk-ABS5TK73.js → chunk-7K6CXSTL.js} +3 -1
- package/dist/lib/chunks/{chunk-CBOETT4C.js → chunk-7L4Y6N3V.js} +1 -1
- package/dist/lib/chunks/{chunk-FDCM7554.js → chunk-7QWT7LFM.js} +2 -2
- package/dist/lib/chunks/{chunk-4UN3YD5Z.js → chunk-7SA2CRSS.js} +1 -1
- package/dist/lib/chunks/{chunk-P7LGJGDL.js → chunk-ARKZ5PJN.js} +1 -1
- package/dist/lib/chunks/{chunk-4WPG2O2S.js → chunk-B6XGNJUU.js} +1 -1
- package/dist/lib/chunks/{chunk-5OL67GMN.js → chunk-BNX7S4GK.js} +4 -4
- package/dist/lib/chunks/chunk-BWBPEXEU.js +83 -0
- package/dist/lib/chunks/{chunk-U53GT2R7.js → chunk-BZAPAGXM.js} +1 -1
- package/dist/lib/chunks/{chunk-BNPWAQQG.js → chunk-C2Q7YE7Y.js} +6 -6
- package/dist/lib/chunks/{chunk-LYOCWN3R.js → chunk-D2LJMNH3.js} +2 -2
- package/dist/lib/chunks/{chunk-32HYNVPR.js → chunk-EVEJ3MFU.js} +3 -3
- package/dist/lib/chunks/{chunk-DGOFCRZM.js → chunk-GC7DISQO.js} +1 -1
- package/dist/lib/chunks/{chunk-BTRBLG6S.js → chunk-I6PQUKKF.js} +1 -1
- package/dist/lib/chunks/{chunk-6FGVCN4H.js → chunk-J5RYDPGP.js} +1 -1
- package/dist/lib/chunks/{chunk-JIUBLXR7.js → chunk-JHUI2K5X.js} +3 -3
- package/dist/lib/chunks/chunk-JQFLWUCA.js +123 -0
- package/dist/lib/chunks/{chunk-4RB3AOPT.js → chunk-JREYIUNG.js} +5 -5
- package/dist/lib/chunks/{chunk-42QARLUQ.js → chunk-JXQOWHWB.js} +3 -3
- package/dist/lib/chunks/{chunk-66BTHIL3.js → chunk-KFJ5O5CL.js} +2 -2
- package/dist/lib/chunks/{chunk-6P7EZJI7.js → chunk-KSJ3NZIJ.js} +4 -2
- package/dist/lib/chunks/{chunk-3RGUIUKU.js → chunk-L5HFTFFG.js} +2 -2
- package/dist/lib/chunks/{chunk-WBSJVDS2.js → chunk-LJD37WAV.js} +2 -2
- package/dist/lib/chunks/{chunk-QT5GTQGD.js → chunk-MKA2EP7M.js} +1 -1
- package/dist/lib/chunks/{chunk-CZMQ2DVJ.js → chunk-MMJ5UR2E.js} +1 -1
- package/dist/lib/chunks/{chunk-BWUOUP4J.js → chunk-MQFFMD4Q.js} +1 -1
- package/dist/lib/chunks/{chunk-7D7EOET3.js → chunk-NM2LUMQT.js} +4 -4
- package/dist/lib/chunks/{chunk-IJQEQL5Q.js → chunk-P5VVHTZU.js} +1 -1
- package/dist/lib/chunks/{chunk-OJQ66533.js → chunk-PFG3ESJE.js} +9 -9
- package/dist/lib/chunks/{chunk-WSATQQJI.js → chunk-Q7CWM6LZ.js} +6 -6
- package/dist/lib/chunks/{chunk-F6CC4WLO.js → chunk-R4HYBSQB.js} +1 -1
- package/dist/lib/chunks/{chunk-FWH3LYHG.js → chunk-R5NLULQW.js} +1 -1
- package/dist/lib/chunks/{chunk-WUDXMAJS.js → chunk-RM7U5M5L.js} +1 -1
- package/dist/lib/chunks/{chunk-3G6COT6E.js → chunk-RQ6GUJI5.js} +1 -1
- package/dist/lib/chunks/{chunk-TNTTIT2R.js → chunk-RUSMX6JH.js} +16 -7
- package/dist/lib/chunks/{chunk-G4GAGKSG.js → chunk-UNNRLD2U.js} +4 -4
- package/dist/lib/chunks/chunk-VFN2J4Z3.js +626 -0
- package/dist/lib/chunks/{chunk-BLDOQAEW.js → chunk-VPJN2GNC.js} +1 -1
- package/dist/lib/chunks/{chunk-3GDCPD5P.js → chunk-XSOTCSD3.js} +3 -3
- package/dist/lib/chunks/{chunk-WHW3NOG5.js → chunk-YX4EH6FR.js} +1 -1
- package/dist/lib/chunks/{chunk-TXGVQ6CN.js → chunk-ZC4MKS3J.js} +12 -12
- package/dist/lib/chunks/{chunk-VXO5RAR4.js → chunk-ZM4RHMBI.js} +1 -1
- package/dist/lib/cli/bundle-commands.js +60 -35
- package/dist/lib/cli/guide-command.js +1 -1
- package/dist/lib/cli/run-commands.js +40 -40
- package/dist/lib/cli/status-command.js +21 -21
- package/dist/lib/codex-workflow/aggregate.js +2 -2
- package/dist/lib/codex-workflow/author.js +5 -5
- package/dist/lib/codex-workflow/capture.js +5 -5
- package/dist/lib/codex-workflow/copy-editor.js +5 -5
- package/dist/lib/codex-workflow/copy.js +4 -4
- package/dist/lib/codex-workflow/finish.js +5 -5
- package/dist/lib/codex-workflow/loop.js +15 -15
- package/dist/lib/codex-workflow/run-source.js +5 -5
- package/dist/lib/codex-workflow/stage.js +6 -6
- package/dist/lib/engine/audit-file.js +3 -3
- package/dist/lib/engine/author.js +12 -12
- package/dist/lib/engine/cost-estimate.js +3 -3
- package/dist/lib/engine/local-run.js +20 -20
- package/dist/lib/engine/preflight.js +3 -3
- package/dist/lib/engine/rejudge.js +27 -27
- package/dist/lib/engine/resources.js +1 -1
- package/dist/lib/engine/run-bindings.js +3 -3
- package/dist/lib/engine/run-method.js +3 -3
- package/dist/lib/engine/run-models.js +4 -4
- package/dist/lib/engine/run-status.js +21 -21
- package/dist/lib/engine/templates.js +4 -4
- package/dist/lib/grounding/grounding-runtime.js +5 -5
- package/dist/lib/grounding/recorded-tools.js +4 -4
- package/dist/lib/pipeline.js +4 -4
- package/dist/lib/probes/bindings.js +2 -2
- package/dist/lib/probes/charged-trace.js +3 -3
- package/dist/lib/probes/probes.js +3 -3
- package/dist/lib/stores/files.js +3 -3
- package/dist/lib/stores/memory.js +2 -2
- package/dist/lib/stores/publication.js +2 -2
- package/dist/lib/viewer/alternatives.js +8 -0
- package/dist/lib/viewer/cited-domains.js +8 -0
- package/dist/lib/viewer/page.js +3 -1
- package/dist/lib/viewer/presentation.js +41 -0
- package/dist/lib/viewer/server.js +15 -10
- package/dist/types/agents/copy-validation.d.ts +2 -1
- package/dist/types/bundle/contracts.d.ts +1 -1
- package/dist/types/engine/resources.d.ts +2 -0
- package/dist/types/viewer/alternatives.d.ts +16 -0
- package/dist/types/viewer/cited-domains.d.ts +22 -0
- package/dist/types/viewer/page.d.ts +9 -2
- package/dist/types/viewer/presentation.d.ts +112 -0
- package/dist/types/viewer/server.d.ts +7 -3
- package/package.json +2 -1
- package/resources/fonts/Mulish-OFL.txt +93 -0
- package/resources/fonts/Mulish-VariableFont_wght.ttf +0 -0
- package/resources/fonts/SourceCodePro-OFL.txt +93 -0
- package/resources/fonts/SourceCodePro-VariableFont_wght.ttf +0 -0
- package/src/agents/copy-validation.ts +8 -2
- package/src/bundle/contracts.ts +1 -1
- package/src/cli/bundle-commands.ts +21 -0
- package/src/engine/resources.ts +9 -5
- package/src/report/core/rate-interval.ts +1 -2
- package/src/viewer/alternatives.ts +202 -0
- package/src/viewer/cited-domains.ts +127 -0
- package/src/viewer/page.ts +549 -236
- package/src/viewer/presentation.ts +759 -0
- package/src/viewer/server.ts +25 -4
- package/dist/lib/chunks/chunk-3TF4JGQA.js +0 -323
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
import {
|
|
2
|
+
rankAlternatives
|
|
3
|
+
} from "./chunk-JQFLWUCA.js";
|
|
4
|
+
import {
|
|
5
|
+
groupCitedDomains
|
|
6
|
+
} from "./chunk-BWBPEXEU.js";
|
|
7
|
+
import {
|
|
8
|
+
capturedRecordsSchema
|
|
9
|
+
} from "./chunk-M3WZCV65.js";
|
|
10
|
+
import {
|
|
11
|
+
bundlePaths
|
|
12
|
+
} from "./chunk-6MGXILUJ.js";
|
|
13
|
+
import {
|
|
14
|
+
parseBundleJson
|
|
15
|
+
} from "./chunk-E6NQQU6V.js";
|
|
16
|
+
import {
|
|
17
|
+
intervalPercents
|
|
18
|
+
} from "./chunk-FXR6P7HY.js";
|
|
19
|
+
import {
|
|
20
|
+
aeoPerceptionSchema,
|
|
21
|
+
aeoSnapshotSchema,
|
|
22
|
+
aeoSourceMixSchema,
|
|
23
|
+
brandSchema,
|
|
24
|
+
sourceCategories
|
|
25
|
+
} from "./chunk-N5IAPSLM.js";
|
|
26
|
+
import {
|
|
27
|
+
isAgentSurface,
|
|
28
|
+
surfaceFamilyOf,
|
|
29
|
+
surfaceLabels
|
|
30
|
+
} from "./chunk-LTPLZSXI.js";
|
|
31
|
+
import {
|
|
32
|
+
aeoFinalCopyDraftSchema
|
|
33
|
+
} from "./chunk-2MGARWKY.js";
|
|
34
|
+
import {
|
|
35
|
+
formatReportDate,
|
|
36
|
+
reportSectionTitle
|
|
37
|
+
} from "./chunk-H56DDRKE.js";
|
|
38
|
+
|
|
39
|
+
// src/viewer/presentation.ts
|
|
40
|
+
import { z } from "zod";
|
|
41
|
+
var viewedSnapshotSchema = z.object({
|
|
42
|
+
brand: brandSchema.optional(),
|
|
43
|
+
sections: aeoSnapshotSchema.shape.sections,
|
|
44
|
+
sourceMix: aeoSourceMixSchema.optional(),
|
|
45
|
+
perception: aeoPerceptionSchema.optional(),
|
|
46
|
+
meta: aeoSnapshotSchema.shape.meta.pick({
|
|
47
|
+
generatedAt: true,
|
|
48
|
+
promptCount: true,
|
|
49
|
+
probeCount: true,
|
|
50
|
+
partialFailures: true,
|
|
51
|
+
surfaceLabels: true,
|
|
52
|
+
methodology: true,
|
|
53
|
+
reusedProbes: true
|
|
54
|
+
}).partial({ promptCount: true, probeCount: true, partialFailures: true })
|
|
55
|
+
});
|
|
56
|
+
var configBrandSchema = z.object({
|
|
57
|
+
brand: z.object({ name: z.string().min(1), domain: z.string().min(1) })
|
|
58
|
+
});
|
|
59
|
+
var presentReport = (files) => {
|
|
60
|
+
const snapshotFile = files.get(bundlePaths.snapshot);
|
|
61
|
+
if (snapshotFile === void 0) {
|
|
62
|
+
return { outcome: "missing" };
|
|
63
|
+
}
|
|
64
|
+
const snapshot = parseDocument(snapshotFile, viewedSnapshotSchema);
|
|
65
|
+
if (snapshot === void 0) {
|
|
66
|
+
return {
|
|
67
|
+
outcome: "unreadable",
|
|
68
|
+
reason: `${bundlePaths.snapshot} does not match the report contract of this release.`
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
const brand = snapshot.brand ?? parseDocument(files.get(bundlePaths.config), configBrandSchema)?.brand;
|
|
72
|
+
if (brand === void 0) {
|
|
73
|
+
return {
|
|
74
|
+
outcome: "unreadable",
|
|
75
|
+
reason: `Neither ${bundlePaths.snapshot} nor ${bundlePaths.config} names the audited brand.`
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
const copy = parseDocument(
|
|
79
|
+
files.get(bundlePaths.copy),
|
|
80
|
+
aeoFinalCopyDraftSchema
|
|
81
|
+
);
|
|
82
|
+
const captured = parseDocument(
|
|
83
|
+
files.get(bundlePaths.captures),
|
|
84
|
+
capturedRecordsSchema
|
|
85
|
+
);
|
|
86
|
+
const answers = new Map(
|
|
87
|
+
(captured ?? []).map((record) => [answerKey(record), record.probe.text])
|
|
88
|
+
);
|
|
89
|
+
const { meta } = snapshot;
|
|
90
|
+
const measuredOn = measurementPeriod(meta);
|
|
91
|
+
const labelOf = surfaceLabelFor(meta.surfaceLabels ?? {});
|
|
92
|
+
const visibilities = snapshot.sections.map((s) => s.visibility);
|
|
93
|
+
const surfaces = [...new Set(visibilities.flatMap((v) => v.surfaces))];
|
|
94
|
+
const promptCount = meta.promptCount ?? visibilities.reduce((sum, v) => sum + v.prompts.length, 0);
|
|
95
|
+
const probeCount = meta.probeCount ?? visibilities.reduce((sum, v) => sum + v.matrix.length, 0);
|
|
96
|
+
const presentation = {
|
|
97
|
+
outcome: "shown",
|
|
98
|
+
brand: { name: brand.name, domain: brand.domain },
|
|
99
|
+
hero: {
|
|
100
|
+
title: copy?.hero.title.text ?? `How AI engines see ${brand.name}`,
|
|
101
|
+
subtitle: copy?.hero.subtitle.text ?? defaultSubtitle(brand.name, surfaces, labelOf),
|
|
102
|
+
measuredOn,
|
|
103
|
+
probeCount,
|
|
104
|
+
facts: [
|
|
105
|
+
`${promptCount} buyer-style prompts`,
|
|
106
|
+
`${surfaces.length} AI surfaces${surfaces.some(isAgentSurface) ? ", coding agents included" : ""}`,
|
|
107
|
+
// Only when the bundle holds them: a redaction can withhold them all.
|
|
108
|
+
...answers.size > 0 ? ["Raw answers preserved and inspectable"] : []
|
|
109
|
+
]
|
|
110
|
+
},
|
|
111
|
+
...copy?.intro[0] !== void 0 && {
|
|
112
|
+
intro: {
|
|
113
|
+
heading: `How AI engines see ${brand.name}`,
|
|
114
|
+
lead: copy.intro[0].text
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
sections: snapshot.sections.map(
|
|
118
|
+
(section) => presentSection(section, {
|
|
119
|
+
brand,
|
|
120
|
+
sourceMix: snapshot.sourceMix?.sections.find(
|
|
121
|
+
(s) => s.key === section.key
|
|
122
|
+
),
|
|
123
|
+
perception: snapshot.perception?.sections.find(
|
|
124
|
+
(s) => s.key === section.key
|
|
125
|
+
),
|
|
126
|
+
labelOf,
|
|
127
|
+
answers
|
|
128
|
+
})
|
|
129
|
+
),
|
|
130
|
+
footer: {
|
|
131
|
+
baseline: `Measured ${measuredOn}: ${promptCount} prompts, ${probeCount} captured answers across ${listOf(surfaces.map(labelOf))}.`,
|
|
132
|
+
methodology: meta.methodology ?? [],
|
|
133
|
+
notes: [
|
|
134
|
+
...reusedNote(meta.reusedProbes),
|
|
135
|
+
...unanalyzedNote(meta.partialFailures ?? [])
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
return presentation;
|
|
140
|
+
};
|
|
141
|
+
var presentSection = ({ key, visibility }, { brand, sourceMix, perception, labelOf, answers }) => {
|
|
142
|
+
const alternatives = rankAlternatives(visibility.matrix, brand);
|
|
143
|
+
const assistantSurfaces = visibility.surfaces.filter(
|
|
144
|
+
(s) => !isAgentSurface(s)
|
|
145
|
+
);
|
|
146
|
+
const agentSurfaces = visibility.surfaces.filter(isAgentSurface);
|
|
147
|
+
const runViewOf = (row, index) => {
|
|
148
|
+
const answer = row.runIndex === void 0 ? void 0 : answers.get(
|
|
149
|
+
answerKey({
|
|
150
|
+
sectionKey: key,
|
|
151
|
+
promptText: visibility.prompts[row.promptIdx]?.text ?? "",
|
|
152
|
+
surface: row.surface,
|
|
153
|
+
runIndex: row.runIndex
|
|
154
|
+
})
|
|
155
|
+
);
|
|
156
|
+
return presentRun(row, {
|
|
157
|
+
runNumber: row.runIndex ?? index + 1,
|
|
158
|
+
label: labelOf(row.surface),
|
|
159
|
+
answer
|
|
160
|
+
});
|
|
161
|
+
};
|
|
162
|
+
const section = {
|
|
163
|
+
key,
|
|
164
|
+
title: reportSectionTitle(key.replace(/_/g, " ")),
|
|
165
|
+
scorecards: presentScorecards(visibility, alternatives[0], labelOf),
|
|
166
|
+
surfaceRates: visibility.surfaces.flatMap((surface) => {
|
|
167
|
+
const rates = visibility.summary.byModel[surface];
|
|
168
|
+
const name = labelOf(surface);
|
|
169
|
+
return rates?.shareOfVoiceEvidence === void 0 ? [] : [
|
|
170
|
+
{
|
|
171
|
+
surface: name,
|
|
172
|
+
shareOfVoice: rateOf(
|
|
173
|
+
rates.shareOfVoice,
|
|
174
|
+
rates.shareOfVoiceEvidence,
|
|
175
|
+
{ subject: `${name} share of voice`, counted: "Mentioned" }
|
|
176
|
+
),
|
|
177
|
+
citationRate: rateOf(
|
|
178
|
+
rates.citationRate,
|
|
179
|
+
rates.citationRateEvidence,
|
|
180
|
+
{ subject: `${name} citation rate`, counted: "Cited" }
|
|
181
|
+
)
|
|
182
|
+
}
|
|
183
|
+
];
|
|
184
|
+
}),
|
|
185
|
+
matrix: {
|
|
186
|
+
assistantSurfaces: assistantSurfaces.map(labelOf),
|
|
187
|
+
agentSurfaces: agentSurfaces.map(labelOf),
|
|
188
|
+
rows: visibility.prompts.map((prompt, promptIdx) => ({
|
|
189
|
+
prompt: prompt.text,
|
|
190
|
+
category: prompt.category.replace(/_/g, " "),
|
|
191
|
+
cells: [...assistantSurfaces, ...agentSurfaces].map(
|
|
192
|
+
(surface) => presentCell(
|
|
193
|
+
visibility.matrix.filter(
|
|
194
|
+
(row) => row.promptIdx === promptIdx && row.surface === surface
|
|
195
|
+
).map(runViewOf)
|
|
196
|
+
)
|
|
197
|
+
)
|
|
198
|
+
}))
|
|
199
|
+
},
|
|
200
|
+
alternatives: alternatives.slice(0, 10).map((alternative) => {
|
|
201
|
+
const share = alternative.mentioning / alternative.captured;
|
|
202
|
+
return { ...alternative, share, percent: percentOf(share) };
|
|
203
|
+
}),
|
|
204
|
+
citedDomains: groupCitedDomains(visibility, brand.domain).map((domain) => ({
|
|
205
|
+
...domain,
|
|
206
|
+
urls: domain.urls.map((url) => ({
|
|
207
|
+
...url,
|
|
208
|
+
surfaces: url.surfaces.map(labelOf)
|
|
209
|
+
}))
|
|
210
|
+
})),
|
|
211
|
+
...sourceMix !== void 0 && {
|
|
212
|
+
sourceMix: {
|
|
213
|
+
rows: sourceMix.perSurface.filter(
|
|
214
|
+
({ counts }) => sourceCategories.some((category) => counts[category] > 0)
|
|
215
|
+
).map(({ surface, counts }) => ({
|
|
216
|
+
surface: labelOf(surface),
|
|
217
|
+
counts
|
|
218
|
+
})),
|
|
219
|
+
total: sourceMix.total
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
...perception !== void 0 && {
|
|
223
|
+
perception: {
|
|
224
|
+
...perception.sentiment,
|
|
225
|
+
phrases: groupPhrases(perception.narratives, labelOf)
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
return section;
|
|
230
|
+
};
|
|
231
|
+
var presentScorecards = (visibility, topAlternative, labelOf) => {
|
|
232
|
+
const { summary } = visibility;
|
|
233
|
+
const namesOf = (family) => listOf(
|
|
234
|
+
visibility.surfaces.filter((s) => surfaceFamilyOf(s) === family).map(labelOf)
|
|
235
|
+
);
|
|
236
|
+
const familyCard = (family, scope, rates) => {
|
|
237
|
+
if (rates.shareOfVoice === null || rates.shareOfVoice === void 0) {
|
|
238
|
+
return [];
|
|
239
|
+
}
|
|
240
|
+
const headline = rateOf(rates.shareOfVoice, rates.shareOfVoiceEvidence, {
|
|
241
|
+
subject: `share of voice across ${scope}`,
|
|
242
|
+
counted: "Mentioned"
|
|
243
|
+
});
|
|
244
|
+
const detail = rateOf(rates.citationRate ?? 0, rates.citationRateEvidence, {
|
|
245
|
+
subject: `citation rate across ${scope}`,
|
|
246
|
+
counted: "Cited"
|
|
247
|
+
});
|
|
248
|
+
const card = {
|
|
249
|
+
headline: headline.percent,
|
|
250
|
+
...headline.interval !== void 0 && {
|
|
251
|
+
headlineInterval: headline.interval
|
|
252
|
+
},
|
|
253
|
+
label: `Share of voice \u2014 ${scope}`,
|
|
254
|
+
detail: `${detail.percent} citation rate across ${namesOf(family)}`,
|
|
255
|
+
...detail.interval !== void 0 && { detailInterval: detail.interval }
|
|
256
|
+
};
|
|
257
|
+
return [card];
|
|
258
|
+
};
|
|
259
|
+
const cellMentions = /* @__PURE__ */ new Map();
|
|
260
|
+
for (const row of visibility.matrix) {
|
|
261
|
+
const cell = `${row.promptIdx}:${row.surface}`;
|
|
262
|
+
cellMentions.set(
|
|
263
|
+
cell,
|
|
264
|
+
(cellMentions.get(cell) ?? false) || row.prospectMentioned
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
const absentCells = [...cellMentions.values()].filter(
|
|
268
|
+
(mentioned) => !mentioned
|
|
269
|
+
).length;
|
|
270
|
+
const scorecards = [
|
|
271
|
+
...familyCard("chat", "AI assistants", {
|
|
272
|
+
shareOfVoice: summary.prospectShareOfVoice,
|
|
273
|
+
citationRate: summary.prospectCitationRate,
|
|
274
|
+
shareOfVoiceEvidence: summary.prospectShareOfVoiceEvidence,
|
|
275
|
+
citationRateEvidence: summary.prospectCitationRateEvidence
|
|
276
|
+
}),
|
|
277
|
+
...familyCard("consumer", "consumer apps", {
|
|
278
|
+
shareOfVoice: summary.consumerShareOfVoice,
|
|
279
|
+
citationRate: summary.consumerCitationRate,
|
|
280
|
+
shareOfVoiceEvidence: summary.consumerShareOfVoiceEvidence,
|
|
281
|
+
citationRateEvidence: summary.consumerCitationRateEvidence
|
|
282
|
+
}),
|
|
283
|
+
...familyCard("agents", "coding agents", {
|
|
284
|
+
shareOfVoice: summary.agentShareOfVoice,
|
|
285
|
+
citationRate: summary.agentCitationRate,
|
|
286
|
+
shareOfVoiceEvidence: summary.agentShareOfVoiceEvidence,
|
|
287
|
+
citationRateEvidence: summary.agentCitationRateEvidence
|
|
288
|
+
}),
|
|
289
|
+
...topAlternative === void 0 ? [] : [
|
|
290
|
+
{
|
|
291
|
+
headline: percentOf(
|
|
292
|
+
topAlternative.mentioning / topAlternative.captured
|
|
293
|
+
),
|
|
294
|
+
label: `${topAlternative.name} share of voice`,
|
|
295
|
+
detail: `Named most often: ${topAlternative.mentioning} of ${topAlternative.captured} captured answers`
|
|
296
|
+
}
|
|
297
|
+
],
|
|
298
|
+
{
|
|
299
|
+
headline: `${absentCells}/${cellMentions.size}`,
|
|
300
|
+
label: "Cells with zero mentions",
|
|
301
|
+
detail: "Prompts and surfaces where the brand was absent"
|
|
302
|
+
}
|
|
303
|
+
];
|
|
304
|
+
return scorecards;
|
|
305
|
+
};
|
|
306
|
+
var presentRun = (row, {
|
|
307
|
+
runNumber,
|
|
308
|
+
label,
|
|
309
|
+
answer
|
|
310
|
+
}) => {
|
|
311
|
+
const mentionedBrands = [
|
|
312
|
+
...new Set(
|
|
313
|
+
(row.mentionedBrands ?? []).map((brand) => brand.domain ?? brand.name)
|
|
314
|
+
)
|
|
315
|
+
];
|
|
316
|
+
const run = {
|
|
317
|
+
runNumber,
|
|
318
|
+
surface: label,
|
|
319
|
+
...row.agentCliVersion !== void 0 && {
|
|
320
|
+
cliVersion: row.agentCliVersion
|
|
321
|
+
},
|
|
322
|
+
status: statusOf(row),
|
|
323
|
+
...row.usedWebSearch !== void 0 && {
|
|
324
|
+
retrieval: retrievalOf(row.usedWebSearch)
|
|
325
|
+
},
|
|
326
|
+
...row.contextSnippet !== null && { snippet: row.contextSnippet },
|
|
327
|
+
...answer !== void 0 && { answer },
|
|
328
|
+
mentionedBrands,
|
|
329
|
+
citedUrls: row.citedUrls ?? []
|
|
330
|
+
};
|
|
331
|
+
return run;
|
|
332
|
+
};
|
|
333
|
+
var retrievalOf = (usedWebSearch) => {
|
|
334
|
+
if (usedWebSearch === null) {
|
|
335
|
+
return "unknown";
|
|
336
|
+
}
|
|
337
|
+
return usedWebSearch ? "searched" : "memory";
|
|
338
|
+
};
|
|
339
|
+
var statusOf = (row) => {
|
|
340
|
+
if (row.noOverview) {
|
|
341
|
+
return "no_overview";
|
|
342
|
+
}
|
|
343
|
+
if (!row.prospectMentioned) {
|
|
344
|
+
return "absent";
|
|
345
|
+
}
|
|
346
|
+
return row.prospectPosition === "primary" ? "primary" : "mentioned";
|
|
347
|
+
};
|
|
348
|
+
var presentCell = (runs) => {
|
|
349
|
+
const mentioned = runs.filter(
|
|
350
|
+
(run) => run.status === "primary" || run.status === "mentioned"
|
|
351
|
+
).length;
|
|
352
|
+
if (runs.length === 0) {
|
|
353
|
+
return { status: "no_data", mentioned, runs };
|
|
354
|
+
}
|
|
355
|
+
if (mentioned === 0) {
|
|
356
|
+
return { status: "absent", mentioned, runs };
|
|
357
|
+
}
|
|
358
|
+
const status = runs.some((run) => run.status === "primary") ? "primary" : "mentioned";
|
|
359
|
+
return { status, mentioned, runs };
|
|
360
|
+
};
|
|
361
|
+
var rateOf = (rate, evidence, {
|
|
362
|
+
subject,
|
|
363
|
+
counted
|
|
364
|
+
}) => {
|
|
365
|
+
const percent = percentOf(rate);
|
|
366
|
+
if (evidence === void 0 || evidence.low > evidence.high) {
|
|
367
|
+
return { percent };
|
|
368
|
+
}
|
|
369
|
+
const { low, high } = intervalPercents(evidence);
|
|
370
|
+
const text = `approx. 95% interval ${low}\u2013${high}%`;
|
|
371
|
+
const view = {
|
|
372
|
+
percent,
|
|
373
|
+
interval: {
|
|
374
|
+
text,
|
|
375
|
+
label: `${text} for ${subject}`,
|
|
376
|
+
counts: `${counted} in ${evidence.count} of ${evidence.planned} planned answers; ${evidence.captured} captured`
|
|
377
|
+
}
|
|
378
|
+
};
|
|
379
|
+
return view;
|
|
380
|
+
};
|
|
381
|
+
var groupPhrases = (narratives, labelOf) => {
|
|
382
|
+
const byPhrase = /* @__PURE__ */ new Map();
|
|
383
|
+
for (const narrative of narratives) {
|
|
384
|
+
const text = narrative.phrase.trim();
|
|
385
|
+
const key = text.toLowerCase();
|
|
386
|
+
if (key === "") {
|
|
387
|
+
continue;
|
|
388
|
+
}
|
|
389
|
+
const entry = byPhrase.get(key) ?? { text, count: 0, surfaces: [] };
|
|
390
|
+
const surface = labelOf(narrative.surface);
|
|
391
|
+
entry.count += 1;
|
|
392
|
+
if (!entry.surfaces.includes(surface)) {
|
|
393
|
+
entry.surfaces.push(surface);
|
|
394
|
+
}
|
|
395
|
+
byPhrase.set(key, entry);
|
|
396
|
+
}
|
|
397
|
+
const phrases = [...byPhrase.values()].sort((a, b) => b.count - a.count).slice(0, 20);
|
|
398
|
+
return phrases;
|
|
399
|
+
};
|
|
400
|
+
var surfaceLabelFor = (runLabels) => (surface) => {
|
|
401
|
+
return runLabels[surface] ?? surfaceLabels[surface]?.replace(/ \(API\)$/, "") ?? surface;
|
|
402
|
+
};
|
|
403
|
+
var defaultSubtitle = (brandName, surfaces, labelOf) => {
|
|
404
|
+
const assistants = surfaces.filter((s) => !isAgentSurface(s)).map(labelOf);
|
|
405
|
+
const agents = surfaces.filter(isAgentSurface).map(labelOf);
|
|
406
|
+
const asked = assistants.length > 0 ? `How often ${listOf(assistants)} mention and cite ${brandName}.` : `How often AI answers mention and cite ${brandName}.`;
|
|
407
|
+
const subtitle = agents.length > 0 ? `${asked} Plus ${agents.length === 1 ? "one coding agent" : `${agents.length} coding agents`}: ${listOf(agents)}.` : asked;
|
|
408
|
+
return subtitle;
|
|
409
|
+
};
|
|
410
|
+
var measurementPeriod = ({
|
|
411
|
+
generatedAt,
|
|
412
|
+
reusedProbes
|
|
413
|
+
}) => {
|
|
414
|
+
const generated = formatReportDate(generatedAt);
|
|
415
|
+
if (reusedProbes === void 0) {
|
|
416
|
+
return generated;
|
|
417
|
+
}
|
|
418
|
+
return reusedProbes.oldestCapturedAt === null ? `by ${generated}` : `${formatReportDate(reusedProbes.oldestCapturedAt)} to ${generated}`;
|
|
419
|
+
};
|
|
420
|
+
var reusedNote = (reusedProbes) => {
|
|
421
|
+
if (reusedProbes === void 0) {
|
|
422
|
+
return [];
|
|
423
|
+
}
|
|
424
|
+
const { count } = reusedProbes;
|
|
425
|
+
return [
|
|
426
|
+
`${count} answer${count === 1 ? " was" : "s were"} reused from an earlier capture, not asked again by this run.`
|
|
427
|
+
];
|
|
428
|
+
};
|
|
429
|
+
var unanalyzedNote = (partialFailures) => {
|
|
430
|
+
const count = partialFailures.filter(
|
|
431
|
+
(f) => f.step.startsWith("analysis:search:")
|
|
432
|
+
).length;
|
|
433
|
+
if (count === 0) {
|
|
434
|
+
return [];
|
|
435
|
+
}
|
|
436
|
+
return [
|
|
437
|
+
`${count} prompt${count === 1 ? "" : "s"} could not be analyzed in this run and show${count === 1 ? "s" : ""} as no data.`
|
|
438
|
+
];
|
|
439
|
+
};
|
|
440
|
+
var answerKey = ({
|
|
441
|
+
sectionKey,
|
|
442
|
+
promptText,
|
|
443
|
+
surface,
|
|
444
|
+
runIndex
|
|
445
|
+
}) => {
|
|
446
|
+
return JSON.stringify([sectionKey, promptText, surface, runIndex]);
|
|
447
|
+
};
|
|
448
|
+
var percentOf = (share) => {
|
|
449
|
+
return `${(share * 100).toFixed(0)}%`;
|
|
450
|
+
};
|
|
451
|
+
var listOf = (names) => {
|
|
452
|
+
const unique = [...new Set(names)];
|
|
453
|
+
if (unique.length <= 1) {
|
|
454
|
+
return unique[0] ?? "the measured surfaces";
|
|
455
|
+
}
|
|
456
|
+
return `${unique.slice(0, -1).join(", ")} and ${unique.at(-1) ?? ""}`;
|
|
457
|
+
};
|
|
458
|
+
var parseDocument = (file, schema) => {
|
|
459
|
+
if (file === void 0) {
|
|
460
|
+
return void 0;
|
|
461
|
+
}
|
|
462
|
+
try {
|
|
463
|
+
const parsed = schema.safeParse(parseBundleJson(file.toString("utf8")));
|
|
464
|
+
return parsed.success ? parsed.data : void 0;
|
|
465
|
+
} catch {
|
|
466
|
+
return void 0;
|
|
467
|
+
}
|
|
468
|
+
};
|
|
469
|
+
|
|
470
|
+
export {
|
|
471
|
+
presentReport
|
|
472
|
+
};
|
|
@@ -2,19 +2,19 @@ import {
|
|
|
2
2
|
checkIntegrity,
|
|
3
3
|
checkTraceChain,
|
|
4
4
|
checkTraceCoverage
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-EVEJ3MFU.js";
|
|
6
6
|
import {
|
|
7
7
|
checkJudgments,
|
|
8
8
|
checkPlan
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-RQ6GUJI5.js";
|
|
10
10
|
import {
|
|
11
11
|
checkCopy,
|
|
12
12
|
checkGrounding,
|
|
13
13
|
checkMetrics
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-KFJ5O5CL.js";
|
|
15
15
|
import {
|
|
16
16
|
capturedAnswerOf
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-7L4Y6N3V.js";
|
|
18
18
|
import {
|
|
19
19
|
CheckOutcome,
|
|
20
20
|
checkFrom,
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
predecessorPrefix,
|
|
30
30
|
readableBundleSchemaVersions,
|
|
31
31
|
traceSchemaVersion
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-6MGXILUJ.js";
|
|
33
33
|
import {
|
|
34
34
|
parseBundleJson
|
|
35
35
|
} from "./chunk-E6NQQU6V.js";
|
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
|
|
45
45
|
// src/agents/copy-validation.ts
|
|
46
46
|
import { createHash } from "node:crypto";
|
|
47
|
-
var copyCheckerVersion =
|
|
47
|
+
var copyCheckerVersion = 8;
|
|
48
48
|
var premiseVerifierPromptVersion = 4;
|
|
49
49
|
var narrativeContextFactIds = [
|
|
50
50
|
"scope:report",
|
|
@@ -715,6 +715,7 @@ var assertCopyValidation = (args) => {
|
|
|
715
715
|
4: 2,
|
|
716
716
|
5: 3,
|
|
717
717
|
6: 3,
|
|
718
|
+
7: 3,
|
|
718
719
|
[copyCheckerVersion]: premiseVerifierPromptVersion
|
|
719
720
|
};
|
|
720
721
|
const verifierPromptVersion = receipt ? verifierPromptVersions[receipt.checkerVersion] : void 0;
|
|
@@ -747,5 +748,6 @@ export {
|
|
|
747
748
|
copyReceiptDigest,
|
|
748
749
|
copyFactsUnchanged,
|
|
749
750
|
validateHumanCopy,
|
|
751
|
+
isStoredProvenance,
|
|
750
752
|
assertCopyValidation
|
|
751
753
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
readFinalizedRevisions
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-C2Q7YE7Y.js";
|
|
4
4
|
import {
|
|
5
5
|
BundleRefusedError,
|
|
6
6
|
archiveLimits,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from "./chunk-2QLAFBCG.js";
|
|
15
15
|
import {
|
|
16
16
|
bundlePaths
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-6MGXILUJ.js";
|
|
18
18
|
|
|
19
19
|
// src/bundle/read.ts
|
|
20
20
|
import { lstat, readdir, readFile } from "node:fs/promises";
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
localRunDigests,
|
|
3
3
|
runDirectoryState
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ZC4MKS3J.js";
|
|
5
5
|
import {
|
|
6
6
|
localReportKey
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-54GMIPWV.js";
|
|
8
8
|
import {
|
|
9
9
|
finalizeRevision,
|
|
10
10
|
revisionsDir
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-C2Q7YE7Y.js";
|
|
12
12
|
import {
|
|
13
13
|
carryFrozenBindings
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-MMJ5UR2E.js";
|
|
15
15
|
import {
|
|
16
16
|
bankDir
|
|
17
17
|
} from "./chunk-N4PQ6RPQ.js";
|