wiki-graph-sdk 0.7.0 → 0.7.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 +16 -0
- package/dist/archives.cjs +71 -7
- package/dist/archives.cjs.map +1 -1
- package/dist/archives.js +67 -3
- package/dist/archives.js.map +1 -1
- package/dist/conversions.cjs +65 -1
- package/dist/conversions.cjs.map +1 -1
- package/dist/conversions.d.ts +13 -3
- package/dist/conversions.js +65 -1
- package/dist/conversions.js.map +1 -1
- package/dist/default-worker.cjs +17 -16
- package/dist/default-worker.cjs.map +1 -1
- package/dist/default-worker.js +13 -11
- package/dist/default-worker.js.map +1 -1
- package/dist/index.cjs +173 -108
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +86 -20
- package/dist/index.js.map +1 -1
- package/dist/worker.cjs +37 -0
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.d.ts +17 -1
- package/dist/worker.js +39 -2
- package/dist/worker.js.map +1 -1
- package/package.json +2 -2
package/dist/default-worker.js
CHANGED
|
@@ -8,12 +8,12 @@ import {
|
|
|
8
8
|
getChapterDetails,
|
|
9
9
|
openWikimediaResolver,
|
|
10
10
|
recordBuildJobInputRevision,
|
|
11
|
-
WikiGraphArchiveFile,
|
|
11
|
+
WikiGraphArchiveFile as WikiGraphArchiveFile2,
|
|
12
12
|
WikiGraphScope,
|
|
13
13
|
withLoggingContext
|
|
14
14
|
} from "wiki-graph-core";
|
|
15
15
|
import {
|
|
16
|
-
applyChapterJobArtifactFile as
|
|
16
|
+
applyChapterJobArtifactFile as applyChapterJobArtifactFile3,
|
|
17
17
|
createLocalChapterJobFileExecutor as createLocalChapterJobFileExecutor2,
|
|
18
18
|
writeChapterJobInputFile as writeChapterJobInputFile2
|
|
19
19
|
} from "wiki-graph-core/worker";
|
|
@@ -1435,10 +1435,12 @@ function abortError(signal) {
|
|
|
1435
1435
|
|
|
1436
1436
|
// src/worker.ts
|
|
1437
1437
|
import {
|
|
1438
|
+
applyChapterJobArtifactFile,
|
|
1438
1439
|
runBuildJobWorker as runCoreBuildJobWorker
|
|
1439
1440
|
} from "wiki-graph-core/worker";
|
|
1441
|
+
import { WikiGraphArchiveFile } from "wiki-graph-core";
|
|
1440
1442
|
import {
|
|
1441
|
-
applyChapterJobArtifactFile,
|
|
1443
|
+
applyChapterJobArtifactFile as applyChapterJobArtifactFile2,
|
|
1442
1444
|
createLocalChapterJobFileExecutor,
|
|
1443
1445
|
writeChapterJobInputFile
|
|
1444
1446
|
} from "wiki-graph-core/worker";
|
|
@@ -1480,7 +1482,7 @@ async function executeBuildJob(job, reporter, context) {
|
|
|
1480
1482
|
let stage = await readChapterStage(job);
|
|
1481
1483
|
if (stage === "sourced") {
|
|
1482
1484
|
await executeStep(job, "reading-graph", execution, reporter, context, {
|
|
1483
|
-
...execution.extractionPrompt === void 0 ? {} : {
|
|
1485
|
+
...execution.extractionPrompt === void 0 ? {} : { prompt: execution.extractionPrompt }
|
|
1484
1486
|
});
|
|
1485
1487
|
stage = await readChapterStage(job);
|
|
1486
1488
|
}
|
|
@@ -1513,8 +1515,8 @@ async function executeBuildJob(job, reporter, context) {
|
|
|
1513
1515
|
}
|
|
1514
1516
|
}
|
|
1515
1517
|
await executeStep(job, job.target, execution, reporter, context, {
|
|
1516
|
-
...job.target === "reading-graph" ? {
|
|
1517
|
-
...job.target === "knowledge-graph" ? {
|
|
1518
|
+
...job.target === "reading-graph" ? { prompt: execution.extractionPrompt } : {},
|
|
1519
|
+
...job.target === "knowledge-graph" ? { prompt: execution.knowledgeGraphPrompt } : {}
|
|
1518
1520
|
});
|
|
1519
1521
|
} finally {
|
|
1520
1522
|
await execution.close();
|
|
@@ -1529,7 +1531,7 @@ async function executeStep(job, kind, execution, reporter, context, inputOptions
|
|
|
1529
1531
|
const stepWorkspace = await resetStepWorkspace(job.workspace, kind);
|
|
1530
1532
|
const inputFile = await stepWorkspace.createFile("input.jsonl");
|
|
1531
1533
|
const outputWorkspace = await stepWorkspace.createDirectory("output");
|
|
1532
|
-
const revision = await new
|
|
1534
|
+
const revision = await new WikiGraphArchiveFile2(job.archive).readDocument(
|
|
1533
1535
|
async (document) => {
|
|
1534
1536
|
await getChapterDetails(document, job.chapterId);
|
|
1535
1537
|
return await writeChapterJobInputFile2(
|
|
@@ -1571,9 +1573,9 @@ async function executeStep(job, kind, execution, reporter, context, inputOptions
|
|
|
1571
1573
|
total: 1,
|
|
1572
1574
|
unit: "item"
|
|
1573
1575
|
});
|
|
1574
|
-
await new
|
|
1576
|
+
await new WikiGraphArchiveFile2(job.archive).write(async (document) => {
|
|
1575
1577
|
assertJobStillRunning(await getBuildJob(job.jobId));
|
|
1576
|
-
await
|
|
1578
|
+
await applyChapterJobArtifactFile3(
|
|
1577
1579
|
document,
|
|
1578
1580
|
job.chapterId,
|
|
1579
1581
|
kind,
|
|
@@ -1656,12 +1658,12 @@ async function resetStepWorkspace(workspace, kind) {
|
|
|
1656
1658
|
return await workspace.createDirectory(name);
|
|
1657
1659
|
}
|
|
1658
1660
|
async function readChapterStage(job) {
|
|
1659
|
-
return await new
|
|
1661
|
+
return await new WikiGraphArchiveFile2(job.archive).readDocument(
|
|
1660
1662
|
async (document) => (await getChapterDetails(document, job.chapterId)).stage
|
|
1661
1663
|
);
|
|
1662
1664
|
}
|
|
1663
1665
|
async function assertCurrentFtsArtifact(job) {
|
|
1664
|
-
await new
|
|
1666
|
+
await new WikiGraphArchiveFile2(job.archive).readDocument(async (document) => {
|
|
1665
1667
|
const revision = await document.serials.getRevision(job.chapterId);
|
|
1666
1668
|
const artifact = await document.indexArtifacts.get(job.chapterId, "fts");
|
|
1667
1669
|
if (artifact?.sourceRevision !== revision) {
|