@hraness/wordcell 0.21.3 → 0.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +170 -64
- package/dist/authoring.js +5 -3
- package/dist/{authority-4sp9d552.js → authority-06eqhqam.js} +57 -12
- package/dist/benchmark.js +4 -4
- package/dist/capture.js +6 -5
- package/dist/cli.js +39 -33
- package/dist/clip/acquire.js +3 -2
- package/dist/clip/cli.js +6 -5
- package/dist/clip/doctor.js +4 -3
- package/dist/clip/jobs.js +3 -3
- package/dist/clip/refresh.js +1 -1
- package/dist/evaluation-builder.js +20 -19
- package/dist/evaluation-kb.js +16 -15
- package/dist/graph-authority.js +5 -5
- package/dist/graph-percolation.js +7 -7
- package/dist/graph.js +1 -1
- package/dist/{index-pbr6rv47.js → index-1k595z6v.js} +6 -6
- package/dist/{index-0k2x4nn9.js → index-233z9wmn.js} +17 -5
- package/dist/index-3agn8scn.js +306 -0
- package/dist/index-4knsp9qj.js +34 -0
- package/dist/index-66pshdtx.js +341 -0
- package/dist/{index-59ssmqqm.js → index-76dbn6pe.js} +1 -1
- package/dist/{index-0rfcqab6.js → index-810nfzdj.js} +617 -66
- package/dist/index-9rf81m0p.js +368 -0
- package/dist/{index-51bap0mq.js → index-bqtqeak3.js} +10 -10
- package/dist/{index-9zcpdbjg.js → index-de2w8crk.js} +13 -13
- package/dist/{index-bgfzwt4h.js → index-djrcc1yf.js} +6 -6
- package/dist/{index-6sw24nvv.js → index-ecqpgr5y.js} +53 -2
- package/dist/{index-van48n3g.js → index-fc4dr114.js} +4 -2
- package/dist/{index-jzcws0zn.js → index-g5vsqmdy.js} +27 -57
- package/dist/index-hmw17zaa.js +1985 -0
- package/dist/index-j70m75wd.js +217 -0
- package/dist/{index-nd6nynv2.js → index-jk1sgx36.js} +1 -1
- package/dist/{index-3ehtt59c.js → index-n386evxj.js} +1 -1
- package/dist/{index-vdw5yjfa.js → index-q7tbg07z.js} +110 -20
- package/dist/{index-ekpwvbra.js → index-qbssx940.js} +1 -2
- package/dist/{index-115b07ap.js → index-rr9kzq4n.js} +5 -5
- package/dist/{index-11621h23.js → index-tf4wzjew.js} +1 -1
- package/dist/{index-why54q5p.js → index-vnybgywh.js} +4 -4
- package/dist/{index-bcfn9xah.js → index-xv80vzfp.js} +7 -7
- package/dist/index.js +289 -95
- package/dist/percolate.js +2 -2
- package/dist/portfolio.js +16 -15
- package/dist/publish-model.js +36 -0
- package/dist/publish-reader/reader.css +1042 -0
- package/dist/publish-reader/reader.js +1534 -0
- package/dist/publish-reader/theme.js +92 -0
- package/dist/publish-search.js +52 -0
- package/dist/publish.js +36 -0
- package/dist/rerank-typesafe.js +13 -0
- package/dist/rerank.js +14 -0
- package/dist/sdk.js +16 -13
- package/dist/search.js +3 -3
- package/dist/semantic.js +5 -5
- package/dist/{support-vm4mkw0k.js → support-1rh2d7mt.js} +38 -32
- package/dist/workflows/decision-context.js +15 -14
- package/dist/workflows/index.js +15 -14
- package/package.json +65 -6
- package/skills/wordcell/AGENTS.md +1 -0
- package/skills/wordcell/SKILL.md +2 -1
- package/skills/wordcell/agents/openai.yaml +1 -1
- package/skills/wordcell/references/publish.md +127 -0
- package/skills/wordcell/references/query.md +22 -0
- package/skills/wordcell/references/refresh.md +14 -0
- package/src/authoring-model.ts +29 -0
- package/src/authoring-program.ts +38 -3
- package/src/authoring.ts +17 -3
- package/src/cli-program.ts +441 -12
- package/src/graph.ts +1 -1
- package/src/index.ts +4 -0
- package/src/oh/authority.ts +14 -5
- package/src/oh/canonical-rust.ts +127 -0
- package/src/oh/projection-rust.ts +63 -0
- package/src/oh-adoption.ts +7 -1
- package/src/publish-graph.ts +0 -0
- package/src/publish-index.ts +195 -0
- package/src/publish-markdown.ts +617 -0
- package/src/publish-model.ts +599 -0
- package/src/publish-nav.ts +204 -0
- package/src/publish-pages.ts +382 -0
- package/src/publish-reader/reader.css +1042 -0
- package/src/publish-reader/reader.ts +1017 -0
- package/src/publish-reader/theme.ts +97 -0
- package/src/publish-search.ts +418 -0
- package/src/publish-select.ts +419 -0
- package/src/publish-theme.ts +106 -0
- package/src/publish.ts +904 -0
- package/src/rerank-credentials.ts +56 -0
- package/src/rerank-typesafe.ts +472 -0
- package/src/rerank.ts +389 -0
- package/src/sdk.ts +157 -6
- package/src/serve.ts +180 -0
- package/src/vault.ts +23 -9
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
import {
|
|
3
3
|
classifyPlatformUrl
|
|
4
4
|
} from "./index-hgve9rh2.js";
|
|
5
|
+
import {
|
|
6
|
+
filterCookieProviderResult,
|
|
7
|
+
readCookieFile,
|
|
8
|
+
renderCookieHeader
|
|
9
|
+
} from "./index-2gv8y733.js";
|
|
5
10
|
import {
|
|
6
11
|
startNetworkProxy
|
|
7
12
|
} from "./index-w2zc0vwa.js";
|
|
@@ -20,63 +25,28 @@ import {
|
|
|
20
25
|
sanitizeArtifactUrl
|
|
21
26
|
} from "./index-mxxxytys.js";
|
|
22
27
|
import {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
} from "./index-2gv8y733.js";
|
|
28
|
+
findKbPackageRoot,
|
|
29
|
+
resolvePackageDirectory
|
|
30
|
+
} from "./index-4knsp9qj.js";
|
|
27
31
|
|
|
28
32
|
// src/clip/acquire.ts
|
|
29
33
|
import {
|
|
30
34
|
chmodSync,
|
|
31
|
-
existsSync
|
|
35
|
+
existsSync,
|
|
32
36
|
lstatSync,
|
|
33
37
|
mkdtempSync,
|
|
34
|
-
readFileSync
|
|
38
|
+
readFileSync,
|
|
35
39
|
realpathSync,
|
|
36
40
|
rmSync,
|
|
37
41
|
statSync,
|
|
38
42
|
writeFileSync
|
|
39
43
|
} from "fs";
|
|
40
44
|
import { homedir, tmpdir } from "os";
|
|
41
|
-
import { basename, dirname
|
|
45
|
+
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "path";
|
|
42
46
|
import { getCookies } from "@steipete/sweet-cookie";
|
|
43
|
-
|
|
44
|
-
// src/clip/package-root.ts
|
|
45
|
-
import { existsSync, readFileSync } from "fs";
|
|
46
|
-
import { createRequire } from "module";
|
|
47
|
-
import { dirname, join, resolve } from "path";
|
|
48
|
-
function isPackageManifest(value) {
|
|
49
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
50
|
-
}
|
|
51
|
-
function findKbPackageRoot(startDirectory = import.meta.dir, dependencies = {}) {
|
|
52
|
-
const exists = dependencies.exists ?? existsSync;
|
|
53
|
-
const readText = dependencies.readText ?? ((path) => readFileSync(path, "utf8"));
|
|
54
|
-
let directory = resolve(startDirectory);
|
|
55
|
-
for (let depth = 0;depth < 8; depth += 1) {
|
|
56
|
-
const manifestPath = join(directory, "package.json");
|
|
57
|
-
if (exists(manifestPath)) {
|
|
58
|
-
try {
|
|
59
|
-
const parsed = JSON.parse(readText(manifestPath));
|
|
60
|
-
if (isPackageManifest(parsed) && typeof parsed.name === "string" && parsed.name === "@hraness/wordcell" && typeof parsed.version === "string")
|
|
61
|
-
return directory;
|
|
62
|
-
} catch {}
|
|
63
|
-
}
|
|
64
|
-
const parent = dirname(directory);
|
|
65
|
-
if (parent === directory)
|
|
66
|
-
break;
|
|
67
|
-
directory = parent;
|
|
68
|
-
}
|
|
69
|
-
throw new Error("Could not locate the wordcell package root.");
|
|
70
|
-
}
|
|
71
|
-
function resolvePackageDirectory(packageName, parentUrl = import.meta.url) {
|
|
72
|
-
const manifest = createRequire(parentUrl).resolve(`${packageName}/package.json`);
|
|
73
|
-
return dirname(manifest);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// src/clip/acquire.ts
|
|
77
|
-
var agentBrowserBinDirectory = join2(resolvePackageDirectory("agent-browser"), "bin");
|
|
47
|
+
var agentBrowserBinDirectory = join(resolvePackageDirectory("agent-browser"), "bin");
|
|
78
48
|
function agentBrowserCommand() {
|
|
79
|
-
return [process.execPath,
|
|
49
|
+
return [process.execPath, join(agentBrowserBinDirectory, "agent-browser.js")];
|
|
80
50
|
}
|
|
81
51
|
var inheritedProxyKeys = new Set([
|
|
82
52
|
"ALL_PROXY",
|
|
@@ -99,9 +69,9 @@ function isolatedAgentBrowserEnvironment(source, socketDirectory) {
|
|
|
99
69
|
return environment;
|
|
100
70
|
}
|
|
101
71
|
function createAgentBrowserIsolation(directory) {
|
|
102
|
-
const configPath =
|
|
72
|
+
const configPath = join(directory, "agent-browser.config.json");
|
|
103
73
|
const socketRoot = process.platform === "win32" ? tmpdir() : "/tmp";
|
|
104
|
-
const socketDirectory = mkdtempSync(
|
|
74
|
+
const socketDirectory = mkdtempSync(join(socketRoot, "jc-ab-"));
|
|
105
75
|
try {
|
|
106
76
|
chmodSync(socketDirectory, 448);
|
|
107
77
|
writeFileSync(configPath, `{}
|
|
@@ -209,7 +179,7 @@ async function runAgentBrowserBatch(globalArgs, commands, options) {
|
|
|
209
179
|
throw new Error("agent-browser batch failed");
|
|
210
180
|
}
|
|
211
181
|
async function discoverChromeProfiles(timeoutMs = 15000) {
|
|
212
|
-
const directory = mkdtempSync(
|
|
182
|
+
const directory = mkdtempSync(join(tmpdir(), "hraness-wordcell-profiles-"));
|
|
213
183
|
chmodSync(directory, 448);
|
|
214
184
|
let socketDirectory = null;
|
|
215
185
|
try {
|
|
@@ -501,10 +471,10 @@ function browserNavigationReachedTarget(target, before, after, navigationCommand
|
|
|
501
471
|
return navigationCommandSucceeded && before !== null && navigationIdentity(before) !== afterIdentity;
|
|
502
472
|
}
|
|
503
473
|
async function terminateAgentBrowserSession(session, socketDirectory) {
|
|
504
|
-
const pidPath =
|
|
505
|
-
if (!
|
|
474
|
+
const pidPath = join(socketDirectory, `${session}.pid`);
|
|
475
|
+
if (!existsSync(pidPath))
|
|
506
476
|
return;
|
|
507
|
-
const rawPid =
|
|
477
|
+
const rawPid = readFileSync(pidPath, "utf8").trim();
|
|
508
478
|
if (!/^\d+$/.test(rawPid))
|
|
509
479
|
return;
|
|
510
480
|
const pid = Number(rawPid);
|
|
@@ -529,7 +499,7 @@ function pathInside(root, target) {
|
|
|
529
499
|
}
|
|
530
500
|
function canonicalPotentialPath(value, label) {
|
|
531
501
|
const suffix = [];
|
|
532
|
-
let ancestor =
|
|
502
|
+
let ancestor = resolve(value);
|
|
533
503
|
while (true) {
|
|
534
504
|
try {
|
|
535
505
|
lstatSync(ancestor);
|
|
@@ -539,12 +509,12 @@ function canonicalPotentialPath(value, label) {
|
|
|
539
509
|
} catch {
|
|
540
510
|
throw new Error(`${label} contains an unresolved symbolic link.`);
|
|
541
511
|
}
|
|
542
|
-
return
|
|
512
|
+
return resolve(canonicalAncestor, ...suffix);
|
|
543
513
|
} catch (error) {
|
|
544
514
|
if (error.code !== "ENOENT")
|
|
545
515
|
throw error;
|
|
546
516
|
}
|
|
547
|
-
const parent =
|
|
517
|
+
const parent = dirname(ancestor);
|
|
548
518
|
if (parent === ancestor)
|
|
549
519
|
throw new Error(`${label} has no resolvable filesystem ancestor.`);
|
|
550
520
|
suffix.unshift(basename(ancestor));
|
|
@@ -555,7 +525,7 @@ function profilePath(value) {
|
|
|
555
525
|
const pathLike = isAbsolute(value) || value.startsWith(`.${sep}`) || value.startsWith(`..${sep}`) || value.startsWith(`~${sep}`) || value.includes("/") || value.includes("\\");
|
|
556
526
|
if (!pathLike)
|
|
557
527
|
return null;
|
|
558
|
-
const expanded = value.startsWith(`~${sep}`) ?
|
|
528
|
+
const expanded = value.startsWith(`~${sep}`) ? join(homedir(), value.slice(2)) : resolve(value);
|
|
559
529
|
return canonicalPotentialPath(expanded, "Persistent browser profile");
|
|
560
530
|
}
|
|
561
531
|
function assertSafePersistentProfile(options) {
|
|
@@ -828,7 +798,7 @@ async function acquireBrowser(options, temporaryDirectory, useDiscoveredProfile
|
|
|
828
798
|
warnings.push("Rendered text was truncated at its configured output boundary.");
|
|
829
799
|
let screenshotPath;
|
|
830
800
|
if ((options.evidence === "screenshot" || options.evidence === "all") && browserPageProvenanceIntact) {
|
|
831
|
-
const requestedScreenshotPath =
|
|
801
|
+
const requestedScreenshotPath = join(temporaryDirectory, "page.png");
|
|
832
802
|
screenshotPath = requestedScreenshotPath;
|
|
833
803
|
try {
|
|
834
804
|
await runBrowser(globalArgs, ["screenshot", requestedScreenshotPath], {
|
|
@@ -841,7 +811,7 @@ async function acquireBrowser(options, temporaryDirectory, useDiscoveredProfile
|
|
|
841
811
|
rmSync(requestedScreenshotPath, { force: true });
|
|
842
812
|
warnings.push("Browser screenshot changed pages during capture and was discarded.");
|
|
843
813
|
screenshotPath = undefined;
|
|
844
|
-
} else if (!
|
|
814
|
+
} else if (!existsSync(requestedScreenshotPath)) {
|
|
845
815
|
warnings.push("Browser screenshot was requested but agent-browser did not create it.");
|
|
846
816
|
screenshotPath = undefined;
|
|
847
817
|
}
|
|
@@ -1028,7 +998,7 @@ async function acquireFile(options) {
|
|
|
1028
998
|
if (stats.size > options.maxHtmlBytes) {
|
|
1029
999
|
throw new Error(`HTML input is ${stats.size} bytes; limit is ${options.maxHtmlBytes}`);
|
|
1030
1000
|
}
|
|
1031
|
-
return
|
|
1001
|
+
return readFileSync(options.htmlFile, "utf8");
|
|
1032
1002
|
})();
|
|
1033
1003
|
return {
|
|
1034
1004
|
body,
|
|
@@ -1039,4 +1009,4 @@ async function acquireFile(options) {
|
|
|
1039
1009
|
};
|
|
1040
1010
|
}
|
|
1041
1011
|
|
|
1042
|
-
export {
|
|
1012
|
+
export { agentBrowserCommand, isolatedAgentBrowserEnvironment, discoverChromeProfiles, mergeRenderedTextSnapshots, browserExpansionLimits, browserExpansionScript, readBrowserExpansionTelemetry, browserExpansionWarnings, browserExpansionStayedOnPage, browserNavigationReachedTarget, assertSafePersistentProfile, browserCookieCommands, seedOwnedBrowserCookies, browserProxyArguments, acquireBrowser, acquireHttp, acquireCookieHttp, createCookieRecordReader, createCookieHeaderReader, acquireCookieRecords, acquireCookieHeader, acquireFile };
|