literally-aeo 0.4.2 → 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 +1503 -548
- package/dist/lib/agents/methodology.js +3 -3
- package/dist/lib/bundle/contracts.js +1 -1
- package/dist/lib/bundle/export.js +12 -12
- package/dist/lib/bundle/journal.js +2 -2
- package/dist/lib/bundle/project-journal.js +5 -5
- package/dist/lib/bundle/project.js +10 -10
- package/dist/lib/bundle/read.js +13 -13
- 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-22SP35NA.js → chunk-2ANSPIUT.js} +1 -1
- package/dist/lib/chunks/{chunk-ITLJZUKL.js → chunk-54GMIPWV.js} +1 -1
- package/dist/lib/chunks/{chunk-QJX6YXXQ.js → chunk-65OIYOUH.js} +2 -2
- package/dist/lib/chunks/{chunk-ENPRRXH5.js → chunk-6MGXILUJ.js} +1 -1
- package/dist/lib/chunks/chunk-6OURIXQZ.js +472 -0
- package/dist/lib/chunks/{chunk-AMK6IHJD.js → chunk-746643QV.js} +1 -1
- package/dist/lib/chunks/{chunk-AMF3T5A3.js → chunk-74K4E3ZS.js} +1 -1
- package/dist/lib/chunks/{chunk-5EM6J7TG.js → chunk-7HCVSLVG.js} +1 -1
- package/dist/lib/chunks/{chunk-RWVXK7XE.js → chunk-7K2XT3WI.js} +5 -5
- package/dist/lib/chunks/{chunk-VOK4TUXV.js → chunk-7L4Y6N3V.js} +1 -1
- package/dist/lib/chunks/{chunk-TD47AB37.js → chunk-7QWT7LFM.js} +2 -2
- package/dist/lib/chunks/{chunk-ATKP5ZW6.js → chunk-7SA2CRSS.js} +1 -1
- package/dist/lib/chunks/{chunk-Q6TZB2OQ.js → chunk-ARKZ5PJN.js} +1 -1
- package/dist/lib/chunks/{chunk-FBMO6UV4.js → chunk-B6XGNJUU.js} +1 -1
- package/dist/lib/chunks/{chunk-RR63UE5H.js → chunk-BNX7S4GK.js} +4 -4
- package/dist/lib/chunks/chunk-BWBPEXEU.js +83 -0
- package/dist/lib/chunks/{chunk-DKR7LSP2.js → chunk-BZAPAGXM.js} +1 -1
- package/dist/lib/chunks/{chunk-FFDMGNRO.js → chunk-C2Q7YE7Y.js} +6 -6
- package/dist/lib/chunks/{chunk-NWABYXDQ.js → chunk-D2LJMNH3.js} +2 -2
- package/dist/lib/chunks/{chunk-XT5M3PPQ.js → chunk-EVEJ3MFU.js} +3 -3
- package/dist/lib/chunks/{chunk-U4AROC2Z.js → chunk-GC7DISQO.js} +1 -1
- package/dist/lib/chunks/{chunk-YRXYTCMY.js → chunk-JHUI2K5X.js} +1 -1
- package/dist/lib/chunks/chunk-JQFLWUCA.js +123 -0
- package/dist/lib/chunks/{chunk-HJEIEMPE.js → chunk-JREYIUNG.js} +4 -4
- package/dist/lib/chunks/{chunk-FXCUGNFL.js → chunk-JXQOWHWB.js} +1 -1
- package/dist/lib/chunks/{chunk-BKAERR7J.js → chunk-KFJ5O5CL.js} +2 -2
- package/dist/lib/chunks/{chunk-6P7EZJI7.js → chunk-KSJ3NZIJ.js} +4 -2
- package/dist/lib/chunks/{chunk-EZ23TKTX.js → chunk-L5HFTFFG.js} +2 -2
- package/dist/lib/chunks/{chunk-DI4LZR37.js → chunk-LJD37WAV.js} +2 -2
- package/dist/lib/chunks/{chunk-YPGJN232.js → chunk-MKA2EP7M.js} +1 -1
- package/dist/lib/chunks/{chunk-JN4332MJ.js → chunk-MMJ5UR2E.js} +1 -1
- package/dist/lib/chunks/{chunk-A2RW4ZMR.js → chunk-MQFFMD4Q.js} +1 -1
- package/dist/lib/chunks/{chunk-CRXJFOCK.js → chunk-NM2LUMQT.js} +4 -4
- package/dist/lib/chunks/{chunk-RYV25YGT.js → chunk-P5VVHTZU.js} +1 -1
- package/dist/lib/chunks/{chunk-JKBXKACC.js → chunk-PFG3ESJE.js} +7 -7
- package/dist/lib/chunks/{chunk-OF3WIGG7.js → chunk-Q7CWM6LZ.js} +6 -6
- package/dist/lib/chunks/{chunk-DU3MAXVC.js → chunk-R5NLULQW.js} +1 -1
- package/dist/lib/chunks/{chunk-T5Q5CBTA.js → chunk-RM7U5M5L.js} +1 -1
- package/dist/lib/chunks/{chunk-JGBJQ3TO.js → chunk-RQ6GUJI5.js} +1 -1
- package/dist/lib/chunks/{chunk-CMB2KSW2.js → chunk-RUSMX6JH.js} +16 -7
- package/dist/lib/chunks/{chunk-KFYTORIT.js → chunk-UNNRLD2U.js} +4 -4
- package/dist/lib/chunks/chunk-VFN2J4Z3.js +626 -0
- package/dist/lib/chunks/{chunk-3DVFQMJT.js → chunk-VPJN2GNC.js} +1 -1
- package/dist/lib/chunks/{chunk-NZOKSFIA.js → chunk-XSOTCSD3.js} +3 -3
- package/dist/lib/chunks/{chunk-M4XGUJMO.js → chunk-YX4EH6FR.js} +1 -1
- package/dist/lib/chunks/{chunk-WIRVKAYB.js → chunk-ZC4MKS3J.js} +11 -11
- package/dist/lib/chunks/{chunk-KC35BXW7.js → chunk-ZM4RHMBI.js} +1 -1
- package/dist/lib/cli/bundle-commands.js +57 -32
- package/dist/lib/cli/guide-command.js +1 -1
- package/dist/lib/cli/run-commands.js +36 -36
- package/dist/lib/cli/status-command.js +18 -18
- package/dist/lib/codex-workflow/aggregate.js +2 -2
- package/dist/lib/codex-workflow/author.js +3 -3
- package/dist/lib/codex-workflow/capture.js +5 -5
- package/dist/lib/codex-workflow/copy-editor.js +3 -3
- package/dist/lib/codex-workflow/copy.js +2 -2
- package/dist/lib/codex-workflow/finish.js +5 -5
- package/dist/lib/codex-workflow/loop.js +13 -13
- package/dist/lib/codex-workflow/run-source.js +5 -5
- package/dist/lib/codex-workflow/stage.js +4 -4
- package/dist/lib/engine/audit-file.js +3 -3
- package/dist/lib/engine/author.js +10 -10
- package/dist/lib/engine/cost-estimate.js +3 -3
- package/dist/lib/engine/local-run.js +17 -17
- package/dist/lib/engine/preflight.js +3 -3
- package/dist/lib/engine/rejudge.js +24 -24
- package/dist/lib/engine/resources.js +1 -1
- package/dist/lib/engine/run-bindings.js +3 -3
- package/dist/lib/engine/run-method.js +2 -2
- package/dist/lib/engine/run-models.js +4 -4
- package/dist/lib/engine/run-status.js +18 -18
- 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/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/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/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,93 @@
|
|
|
1
|
+
Copyright 2016 The Mulish Project Authors (https://github.com/googlefonts/mulish)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
Binary file
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries.
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
|
|
5
|
+
This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
Binary file
|
package/src/bundle/contracts.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { canonicalDigest } from './json';
|
|
|
13
13
|
export const toolId = 'literally-aeo';
|
|
14
14
|
// The package version, recorded in every journal and bundle; the build and
|
|
15
15
|
// version.spec.ts refuse a mismatch with package.json.
|
|
16
|
-
export const toolVersion = '0.4.
|
|
16
|
+
export const toolVersion = '0.4.3';
|
|
17
17
|
// Version 2: config.json may set chatProbes, and agentProbes.runsPerPrompt
|
|
18
18
|
// above 2. A verifier that reads only version 1 then refuses the bundle as
|
|
19
19
|
// unsupported instead of dropping its depth and failing it.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
1
2
|
import path from 'node:path';
|
|
2
3
|
import {
|
|
3
4
|
ExportBlockedError,
|
|
@@ -17,6 +18,8 @@ import { BundleRefusedError } from '../bundle/zip';
|
|
|
17
18
|
import { readSettings } from '../engine/env-file';
|
|
18
19
|
import { runDirectoryState } from '../engine/local-run';
|
|
19
20
|
import { credentialSettingNames } from '../engine/preflight';
|
|
21
|
+
import { engineResources } from '../engine/resources';
|
|
22
|
+
import { viewerFontFiles } from '../viewer/page';
|
|
20
23
|
import { startViewer } from '../viewer/server';
|
|
21
24
|
import { formatLine, writeErr, writeOut, type Flags } from './io';
|
|
22
25
|
|
|
@@ -204,6 +207,23 @@ export const runVerify = async (flags: Flags, usage: string) => {
|
|
|
204
207
|
return verification.exitCode;
|
|
205
208
|
};
|
|
206
209
|
|
|
210
|
+
/** The viewer's fonts, from the engine's own resources. */
|
|
211
|
+
const readViewerFonts = async (): Promise<Map<string, Buffer>> => {
|
|
212
|
+
const { fonts } = await engineResources();
|
|
213
|
+
const entries = await Promise.all(
|
|
214
|
+
Object.values(viewerFontFiles).map(
|
|
215
|
+
async (file) => [file, await readFile(path.join(fonts, file))] as const,
|
|
216
|
+
),
|
|
217
|
+
).catch((err: unknown) => {
|
|
218
|
+
throw new Error(
|
|
219
|
+
`The viewer's fonts are missing from ${fonts}. In a checkout, run pnpm build to refresh resources/; otherwise reinstall literally-aeo.`,
|
|
220
|
+
{ cause: err },
|
|
221
|
+
);
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
return new Map(entries);
|
|
225
|
+
};
|
|
226
|
+
|
|
207
227
|
/** view serves a bundle or a run directory on loopback until Ctrl-C. */
|
|
208
228
|
export const runView = async (flags: Flags, usage: string) => {
|
|
209
229
|
const target = flags.positional[0];
|
|
@@ -231,6 +251,7 @@ export const runView = async (flags: Flags, usage: string) => {
|
|
|
231
251
|
const portOption = flags.options.get('--port');
|
|
232
252
|
const viewer = await startViewer(bundle, {
|
|
233
253
|
port: portOption === undefined ? 0 : Number(portOption),
|
|
254
|
+
fonts: await readViewerFonts(),
|
|
234
255
|
});
|
|
235
256
|
|
|
236
257
|
writeOut(
|
package/src/engine/resources.ts
CHANGED
|
@@ -4,11 +4,11 @@ import { enginePackageRoot } from './package-root';
|
|
|
4
4
|
|
|
5
5
|
// ============================================================================
|
|
6
6
|
// The engine's own files (specs/aeo-open-source-cli-spec.md §4.1): the copy
|
|
7
|
-
// and author rules, the banlist, the neutral editorial context
|
|
8
|
-
//
|
|
9
|
-
// reads them in place under src/. Never the caller's
|
|
10
|
-
// never a publisher's private editorial files unless
|
|
11
|
-
// them.
|
|
7
|
+
// and author rules, the banlist, the neutral editorial context, the operator
|
|
8
|
+
// guide and the report viewer's fonts. A packed install carries them in
|
|
9
|
+
// resources/; a checkout reads them in place under src/. Never the caller's
|
|
10
|
+
// working directory, and never a publisher's private editorial files unless
|
|
11
|
+
// AEO_EDITORIAL_DIR names them.
|
|
12
12
|
// ============================================================================
|
|
13
13
|
|
|
14
14
|
export type EngineResources = {
|
|
@@ -18,6 +18,8 @@ export type EngineResources = {
|
|
|
18
18
|
editorial: string;
|
|
19
19
|
/** The operator guide `literally-aeo guide` prints. */
|
|
20
20
|
guide: string;
|
|
21
|
+
/** The report viewer's fonts, served on loopback beside the page. */
|
|
22
|
+
fonts: string;
|
|
21
23
|
};
|
|
22
24
|
|
|
23
25
|
const exists = async (file: string) => {
|
|
@@ -38,6 +40,7 @@ export const engineResources = async (): Promise<EngineResources> => {
|
|
|
38
40
|
author: path.join(packed, 'author'),
|
|
39
41
|
editorial: path.join(packed, 'editorial'),
|
|
40
42
|
guide: path.join(packed, 'guide', 'OPERATOR.md'),
|
|
43
|
+
fonts: path.join(packed, 'fonts'),
|
|
41
44
|
};
|
|
42
45
|
}
|
|
43
46
|
|
|
@@ -46,5 +49,6 @@ export const engineResources = async (): Promise<EngineResources> => {
|
|
|
46
49
|
author: path.join(root, 'src', 'author'),
|
|
47
50
|
editorial: path.join(root, 'src', 'engine', 'editorial'),
|
|
48
51
|
guide: path.join(root, 'src', 'engine', 'guide', 'OPERATOR.md'),
|
|
52
|
+
fonts: path.join(root, 'src', 'viewer', 'fonts'),
|
|
49
53
|
};
|
|
50
54
|
};
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
// percents, so the range a reader sees always contains the computed one.
|
|
4
4
|
// Zod-free: the report page's client island imports it, and the fact
|
|
5
5
|
// sentences use it, so every place that states an interval rounds it the
|
|
6
|
-
// same way
|
|
7
|
-
// its own copy of this rule (viewer/page.ts, `intervalText`).
|
|
6
|
+
// same way, the local viewer included (viewer/presentation.ts).
|
|
8
7
|
// ============================================================================
|
|
9
8
|
|
|
10
9
|
/** The whole-percent range that contains [low, high], two shares in 0..1.
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { normalizeDomain } from '../report/core/normalize-domain';
|
|
2
|
+
import { qualifiedCompetitorsForRow } from '../report/core/qualified-competitors';
|
|
3
|
+
import type { AeoMatrixRow } from '../report/core/schema';
|
|
4
|
+
|
|
5
|
+
// ============================================================================
|
|
6
|
+
// "Who buyers hear about instead": a section's qualified alternatives,
|
|
7
|
+
// grouped as the hosted report groups them (its `groupAlternatives`), so a
|
|
8
|
+
// business carries one name and one count on both pages. Entries on one
|
|
9
|
+
// domain are one alternative; a name given without a domain joins the one
|
|
10
|
+
// domain whose answers used that name.
|
|
11
|
+
// ============================================================================
|
|
12
|
+
|
|
13
|
+
export type RankedAlternative = {
|
|
14
|
+
name: string;
|
|
15
|
+
domain?: string;
|
|
16
|
+
/** Answers that name the alternative, each counted once. */
|
|
17
|
+
mentioning: number;
|
|
18
|
+
captured: number;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
type Sighting = {
|
|
22
|
+
key: string;
|
|
23
|
+
domain?: string;
|
|
24
|
+
// Every spelling the answers used, with the rows that used it.
|
|
25
|
+
names: Map<string, Set<number>>;
|
|
26
|
+
rowIndices: Set<number>;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
type Prospect = { name: string; domain: string };
|
|
30
|
+
|
|
31
|
+
/** rankAlternatives orders a section's alternatives by the answers that
|
|
32
|
+
* name them, most first. */
|
|
33
|
+
export const rankAlternatives = (
|
|
34
|
+
matrix: ReadonlyArray<
|
|
35
|
+
Pick<AeoMatrixRow, 'qualifiedCompetitors' | 'competitors'>
|
|
36
|
+
>,
|
|
37
|
+
prospect: Prospect,
|
|
38
|
+
): RankedAlternative[] => {
|
|
39
|
+
const isProspect = matchesProspect(prospect);
|
|
40
|
+
const ranked = [...foldNameOnlySightings(collectSightings(matrix)).values()]
|
|
41
|
+
.filter((sighting) => !isProspect(sighting))
|
|
42
|
+
.map((sighting) => ({
|
|
43
|
+
name: displayName(sighting),
|
|
44
|
+
...(sighting.domain !== undefined && { domain: sighting.domain }),
|
|
45
|
+
mentioning: sighting.rowIndices.size,
|
|
46
|
+
captured: matrix.length,
|
|
47
|
+
}))
|
|
48
|
+
.sort(
|
|
49
|
+
(a, b) => b.mentioning - a.mentioning || a.name.localeCompare(b.name),
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
return ranked;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const collectSightings = (
|
|
56
|
+
matrix: ReadonlyArray<
|
|
57
|
+
Pick<AeoMatrixRow, 'qualifiedCompetitors' | 'competitors'>
|
|
58
|
+
>,
|
|
59
|
+
): Map<string, Sighting> => {
|
|
60
|
+
const sightings = new Map<string, Sighting>();
|
|
61
|
+
|
|
62
|
+
matrix.forEach((row, rowIndex) => {
|
|
63
|
+
for (const brand of qualifiedCompetitorsForRow(row)) {
|
|
64
|
+
const name = brand.name.trim();
|
|
65
|
+
const domain = brand.domain ? normalizeDomain(brand.domain) : undefined;
|
|
66
|
+
const key = domain ?? name.toLowerCase();
|
|
67
|
+
const sighting = sightings.get(key) ?? {
|
|
68
|
+
key,
|
|
69
|
+
names: new Map<string, Set<number>>(),
|
|
70
|
+
rowIndices: new Set<number>(),
|
|
71
|
+
};
|
|
72
|
+
const nameRows = sighting.names.get(name) ?? new Set<number>();
|
|
73
|
+
|
|
74
|
+
// A name-only first sighting takes the domain a later entry supplies.
|
|
75
|
+
sighting.domain ??= domain;
|
|
76
|
+
nameRows.add(rowIndex);
|
|
77
|
+
sighting.names.set(name, nameRows);
|
|
78
|
+
sighting.rowIndices.add(rowIndex);
|
|
79
|
+
sightings.set(key, sighting);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
return sightings;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// The analyzer sometimes returns one brand with and without a domain, which
|
|
87
|
+
// lands under two keys.
|
|
88
|
+
const foldNameOnlySightings = (
|
|
89
|
+
sightings: ReadonlyMap<string, Sighting>,
|
|
90
|
+
): Map<string, Sighting> => {
|
|
91
|
+
const domainKeysByName = new Map<string, Set<string>>();
|
|
92
|
+
|
|
93
|
+
for (const sighting of sightings.values()) {
|
|
94
|
+
if (sighting.domain === undefined) {
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
for (const name of sighting.names.keys()) {
|
|
99
|
+
const lowered = name.toLowerCase();
|
|
100
|
+
const keys = domainKeysByName.get(lowered) ?? new Set<string>();
|
|
101
|
+
|
|
102
|
+
keys.add(sighting.key);
|
|
103
|
+
domainKeysByName.set(lowered, keys);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const folded = new Map(sightings);
|
|
108
|
+
|
|
109
|
+
for (const sighting of sightings.values()) {
|
|
110
|
+
if (sighting.domain !== undefined) {
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const [ownerKey, ...otherKeys] = [
|
|
115
|
+
...(domainKeysByName.get(sighting.key) ?? []),
|
|
116
|
+
];
|
|
117
|
+
const owner = ownerKey === undefined ? undefined : folded.get(ownerKey);
|
|
118
|
+
|
|
119
|
+
if (!owner || otherKeys.length > 0) {
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
folded.set(owner.key, mergeSightings(owner, sighting));
|
|
124
|
+
folded.delete(sighting.key);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return folded;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const mergeSightings = (owner: Sighting, nameOnly: Sighting): Sighting => {
|
|
131
|
+
const names = new Map(
|
|
132
|
+
[...owner.names].map(([name, rows]) => [name, new Set(rows)]),
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
for (const [name, rows] of nameOnly.names) {
|
|
136
|
+
names.set(name, new Set([...(names.get(name) ?? []), ...rows]));
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const merged = {
|
|
140
|
+
...owner,
|
|
141
|
+
names,
|
|
142
|
+
rowIndices: new Set([...owner.rowIndices, ...nameOnly.rowIndices]),
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
return merged;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* displayName labels an alternative by what all its mentions share. When
|
|
150
|
+
* every name the answers used starts with the shortest one ("Rivalstack",
|
|
151
|
+
* "Rivalstack Edge"), that name, in its most-used spelling. Otherwise the
|
|
152
|
+
* entries are different products of one vendor, and the domain names the
|
|
153
|
+
* alternative, so no product is credited with its siblings' mentions.
|
|
154
|
+
*/
|
|
155
|
+
const displayName = (sighting: Sighting): string => {
|
|
156
|
+
const spellings = [...sighting.names].map(([name, rows]) => ({
|
|
157
|
+
name,
|
|
158
|
+
words: name.toLowerCase().split(/\s+/),
|
|
159
|
+
answers: rows.size,
|
|
160
|
+
}));
|
|
161
|
+
const [base] = [...spellings].sort(
|
|
162
|
+
(a, b) =>
|
|
163
|
+
a.words.length - b.words.length ||
|
|
164
|
+
b.answers - a.answers ||
|
|
165
|
+
a.name.localeCompare(b.name),
|
|
166
|
+
);
|
|
167
|
+
|
|
168
|
+
if (!base) {
|
|
169
|
+
throw new Error(`Alternative has no recorded name: ${sighting.key}.`);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const isSharedBase = spellings.every((spelling) =>
|
|
173
|
+
base.words.every((word, index) => spelling.words[index] === word),
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
if (!isSharedBase && sighting.domain !== undefined) {
|
|
177
|
+
return sighting.domain;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// The base name's spellings ("RivalStack", "Rivalstack"): the one most answers used.
|
|
181
|
+
const [label] = spellings
|
|
182
|
+
.filter((spelling) => spelling.words.length === base.words.length)
|
|
183
|
+
.sort((a, b) => b.answers - a.answers || a.name.localeCompare(b.name));
|
|
184
|
+
|
|
185
|
+
return (label ?? base).name;
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
const matchesProspect = (prospect: Prospect) => {
|
|
189
|
+
const prospectName = prospect.name.trim().toLowerCase();
|
|
190
|
+
const prospectDomain = normalizeDomain(prospect.domain);
|
|
191
|
+
|
|
192
|
+
return (sighting: Sighting): boolean => {
|
|
193
|
+
const identity = sighting.domain ?? sighting.key;
|
|
194
|
+
const isProspectDomain =
|
|
195
|
+
identity === prospectDomain || identity.endsWith(`.${prospectDomain}`);
|
|
196
|
+
const isProspectName = [...sighting.names.keys()].some(
|
|
197
|
+
(name) => name.toLowerCase() === prospectName,
|
|
198
|
+
);
|
|
199
|
+
|
|
200
|
+
return isProspectDomain || isProspectName;
|
|
201
|
+
};
|
|
202
|
+
};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { isGroundingRedirectUrl } from '../report/core/grounding';
|
|
2
|
+
import { normalizeDomain } from '../report/core/normalize-domain';
|
|
3
|
+
import type { AeoVisibility } from '../report/core/schema';
|
|
4
|
+
|
|
5
|
+
// ============================================================================
|
|
6
|
+
// "What gets cited": every URL a section's answers cited, grouped by domain
|
|
7
|
+
// as the hosted report groups them. The brand's own domain leads, even at
|
|
8
|
+
// zero (an answer that never cites the brand is the finding), with its
|
|
9
|
+
// citations split by host (site, blog, docs); every other host groups under
|
|
10
|
+
// its last two labels.
|
|
11
|
+
// ============================================================================
|
|
12
|
+
|
|
13
|
+
export type CitedUrl = {
|
|
14
|
+
url: string;
|
|
15
|
+
count: number;
|
|
16
|
+
/** Distinct surfaces and question texts that cited the URL, first seen first. */
|
|
17
|
+
surfaces: string[];
|
|
18
|
+
prompts: string[];
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type CitedDomain = {
|
|
22
|
+
domain: string;
|
|
23
|
+
count: number;
|
|
24
|
+
isBrand: boolean;
|
|
25
|
+
/** The brand's citations by host; present on the brand's row only. */
|
|
26
|
+
hosts?: Array<{ label: string; count: number }>;
|
|
27
|
+
urls: CitedUrl[];
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/** groupCitedDomains lists the brand's row first, then every other domain
|
|
31
|
+
* by citations, most first. */
|
|
32
|
+
export const groupCitedDomains = (
|
|
33
|
+
visibility: Pick<AeoVisibility, 'matrix' | 'prompts'>,
|
|
34
|
+
brandDomain: string,
|
|
35
|
+
): CitedDomain[] => {
|
|
36
|
+
const brand = normalizeDomain(brandDomain);
|
|
37
|
+
const urlsByDomain = new Map<string, Map<string, CitedUrl>>();
|
|
38
|
+
const brandHostCounts = new Map<string, number>();
|
|
39
|
+
|
|
40
|
+
for (const row of visibility.matrix) {
|
|
41
|
+
for (const url of row.citedUrls ?? []) {
|
|
42
|
+
// An unresolved grounding redirect is an opaque wrapper, not a
|
|
43
|
+
// citation of Google.
|
|
44
|
+
const host = isGroundingRedirectUrl(url) ? undefined : hostOf(url);
|
|
45
|
+
|
|
46
|
+
if (host === undefined) {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const isBrandHost = host === brand || host.endsWith(`.${brand}`);
|
|
51
|
+
const domain = isBrandHost ? brand : apexOf(host);
|
|
52
|
+
const urls = urlsByDomain.get(domain) ?? new Map<string, CitedUrl>();
|
|
53
|
+
const cited = urls.get(url) ?? {
|
|
54
|
+
url,
|
|
55
|
+
count: 0,
|
|
56
|
+
surfaces: [],
|
|
57
|
+
prompts: [],
|
|
58
|
+
};
|
|
59
|
+
const promptText = visibility.prompts[row.promptIdx]?.text;
|
|
60
|
+
|
|
61
|
+
cited.count += 1;
|
|
62
|
+
if (!cited.surfaces.includes(row.surface)) {
|
|
63
|
+
cited.surfaces.push(row.surface);
|
|
64
|
+
}
|
|
65
|
+
if (promptText !== undefined && !cited.prompts.includes(promptText)) {
|
|
66
|
+
cited.prompts.push(promptText);
|
|
67
|
+
}
|
|
68
|
+
urls.set(url, cited);
|
|
69
|
+
urlsByDomain.set(domain, urls);
|
|
70
|
+
if (isBrandHost) {
|
|
71
|
+
const label = brandHostLabel(host, brand);
|
|
72
|
+
|
|
73
|
+
brandHostCounts.set(label, (brandHostCounts.get(label) ?? 0) + 1);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const domainOf = (domain: string): CitedDomain => {
|
|
79
|
+
const urls = [...(urlsByDomain.get(domain)?.values() ?? [])].sort(
|
|
80
|
+
(a, b) => b.count - a.count || a.url.localeCompare(b.url),
|
|
81
|
+
);
|
|
82
|
+
const cited = {
|
|
83
|
+
domain,
|
|
84
|
+
count: urls.reduce((sum, url) => sum + url.count, 0),
|
|
85
|
+
isBrand: domain === brand,
|
|
86
|
+
urls,
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
return cited;
|
|
90
|
+
};
|
|
91
|
+
const brandRow: CitedDomain = {
|
|
92
|
+
...domainOf(brand),
|
|
93
|
+
...(brandHostCounts.size > 0 && {
|
|
94
|
+
hosts: [...brandHostCounts]
|
|
95
|
+
.map(([label, count]) => ({ label, count }))
|
|
96
|
+
.sort((a, b) => b.count - a.count),
|
|
97
|
+
}),
|
|
98
|
+
};
|
|
99
|
+
const others = [...urlsByDomain.keys()]
|
|
100
|
+
.filter((domain) => domain !== brand)
|
|
101
|
+
.map(domainOf)
|
|
102
|
+
.sort((a, b) => b.count - a.count || a.domain.localeCompare(b.domain));
|
|
103
|
+
const domains = [brandRow, ...others];
|
|
104
|
+
|
|
105
|
+
return domains;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const hostOf = (url: string): string | undefined => {
|
|
109
|
+
try {
|
|
110
|
+
return normalizeDomain(new URL(url).hostname);
|
|
111
|
+
} catch {
|
|
112
|
+
return undefined;
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// The last two labels approximate the registrable domain (reddit.com). A
|
|
117
|
+
// multi-part public suffix (co.uk) collapses a level: the table is a
|
|
118
|
+
// grouping aid, not a registry.
|
|
119
|
+
const apexOf = (host: string): string => {
|
|
120
|
+
const labels = host.split('.');
|
|
121
|
+
|
|
122
|
+
return labels.length <= 2 ? host : labels.slice(-2).join('.');
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
const brandHostLabel = (host: string, brand: string): string => {
|
|
126
|
+
return host === brand ? 'site' : host.slice(0, -(brand.length + 1));
|
|
127
|
+
};
|