wiki-graph 0.7.1 → 0.8.0
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/dist/cli.js +665 -630
- package/dist/cli.js.map +1 -1
- package/dist/data/help/commands/library-predicate.jinja +13 -0
- package/dist/data/help/commands/library.jinja +2 -0
- package/dist/gc-worker.js +102 -85
- package/dist/gc-worker.js.map +1 -1
- package/dist/index.cjs +523 -171
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +438 -82
- package/dist/index.js.map +1 -1
- package/dist/queue-worker.js +657 -622
- package/dist/queue-worker.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -559,6 +559,29 @@ var init_version = __esm({
|
|
|
559
559
|
}
|
|
560
560
|
});
|
|
561
561
|
|
|
562
|
+
// src/support/archive-target.ts
|
|
563
|
+
function parseCLIArchiveTarget(locator) {
|
|
564
|
+
if (locator.startsWith("wikg://lib/")) {
|
|
565
|
+
return { kind: "library", uri: locator };
|
|
566
|
+
}
|
|
567
|
+
if (!locator.includes("://")) {
|
|
568
|
+
return { kind: "standalone", path: locator };
|
|
569
|
+
}
|
|
570
|
+
const parsed = (0, import_wiki_graph_sdk4.parseLocatedWikiGraphUri)(locator);
|
|
571
|
+
return {
|
|
572
|
+
kind: "standalone",
|
|
573
|
+
path: parsed.archivePath ?? locator,
|
|
574
|
+
...parsed.objectUri === void 0 ? {} : { objectUri: parsed.objectUri }
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
var import_wiki_graph_sdk4;
|
|
578
|
+
var init_archive_target = __esm({
|
|
579
|
+
"src/support/archive-target.ts"() {
|
|
580
|
+
"use strict";
|
|
581
|
+
import_wiki_graph_sdk4 = require("wiki-graph-sdk");
|
|
582
|
+
}
|
|
583
|
+
});
|
|
584
|
+
|
|
562
585
|
// src/support/index.ts
|
|
563
586
|
var init_support = __esm({
|
|
564
587
|
"src/support/index.ts"() {
|
|
@@ -572,6 +595,7 @@ var init_support = __esm({
|
|
|
572
595
|
init_uri();
|
|
573
596
|
init_version();
|
|
574
597
|
init_command();
|
|
598
|
+
init_archive_target();
|
|
575
599
|
}
|
|
576
600
|
});
|
|
577
601
|
|
|
@@ -587,20 +611,20 @@ var init_local_config = __esm({
|
|
|
587
611
|
// src/runtime/config.ts
|
|
588
612
|
async function loadCLIConfig(options) {
|
|
589
613
|
try {
|
|
590
|
-
return await (0,
|
|
614
|
+
return await (0, import_wiki_graph_sdk15.loadWikiGraphRuntimeConfig)(options);
|
|
591
615
|
} catch (error) {
|
|
592
616
|
throw withConfigHelp(error);
|
|
593
617
|
}
|
|
594
618
|
}
|
|
595
619
|
function resolveWikispineConfig(value, envPolicy = getCLIEnvPolicy()) {
|
|
596
620
|
try {
|
|
597
|
-
return (0,
|
|
621
|
+
return (0, import_wiki_graph_sdk15.resolveWikispineConfig)(value, envPolicy);
|
|
598
622
|
} catch (error) {
|
|
599
623
|
throw withConfigHelp(error);
|
|
600
624
|
}
|
|
601
625
|
}
|
|
602
626
|
function resolveHostedProviderEndpoint(scope, envPolicy = getCLIEnvPolicy()) {
|
|
603
|
-
return (0,
|
|
627
|
+
return (0, import_wiki_graph_sdk15.resolveHostedProviderEndpoint)(scope, envPolicy);
|
|
604
628
|
}
|
|
605
629
|
function withConfigHelp(error) {
|
|
606
630
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -608,11 +632,11 @@ function withConfigHelp(error) {
|
|
|
608
632
|
cause: error
|
|
609
633
|
});
|
|
610
634
|
}
|
|
611
|
-
var
|
|
635
|
+
var import_wiki_graph_sdk15;
|
|
612
636
|
var init_config = __esm({
|
|
613
637
|
"src/runtime/config.ts"() {
|
|
614
638
|
"use strict";
|
|
615
|
-
|
|
639
|
+
import_wiki_graph_sdk15 = require("wiki-graph-sdk");
|
|
616
640
|
init_support();
|
|
617
641
|
init_context();
|
|
618
642
|
}
|
|
@@ -621,7 +645,7 @@ var init_config = __esm({
|
|
|
621
645
|
// src/runtime/llm.ts
|
|
622
646
|
function buildLLMOptions(config) {
|
|
623
647
|
try {
|
|
624
|
-
return (0,
|
|
648
|
+
return (0, import_wiki_graph_sdk16.buildWikiGraphLLMOptions)(config);
|
|
625
649
|
} catch (error) {
|
|
626
650
|
const message = error instanceof Error ? error.message : String(error);
|
|
627
651
|
throw new Error(withHelpRoute(message, CLI_HELP_ROUTES.config), {
|
|
@@ -629,11 +653,11 @@ function buildLLMOptions(config) {
|
|
|
629
653
|
});
|
|
630
654
|
}
|
|
631
655
|
}
|
|
632
|
-
var
|
|
656
|
+
var import_wiki_graph_sdk16;
|
|
633
657
|
var init_llm = __esm({
|
|
634
658
|
"src/runtime/llm.ts"() {
|
|
635
659
|
"use strict";
|
|
636
|
-
|
|
660
|
+
import_wiki_graph_sdk16 = require("wiki-graph-sdk");
|
|
637
661
|
init_support();
|
|
638
662
|
}
|
|
639
663
|
});
|
|
@@ -1024,7 +1048,7 @@ var init_progress_output = __esm({
|
|
|
1024
1048
|
// src/runtime/stage.ts
|
|
1025
1049
|
async function loadRequiredStageConfig(options) {
|
|
1026
1050
|
try {
|
|
1027
|
-
return await (0,
|
|
1051
|
+
return await (0, import_wiki_graph_sdk18.loadRequiredStageConfig)(options);
|
|
1028
1052
|
} catch (error) {
|
|
1029
1053
|
const message = error instanceof Error ? error.message : String(error);
|
|
1030
1054
|
throw new Error(withHelpRoute(message, CLI_HELP_ROUTES.config), {
|
|
@@ -1032,12 +1056,12 @@ async function loadRequiredStageConfig(options) {
|
|
|
1032
1056
|
});
|
|
1033
1057
|
}
|
|
1034
1058
|
}
|
|
1035
|
-
var
|
|
1059
|
+
var import_wiki_graph_sdk17, import_wiki_graph_sdk18;
|
|
1036
1060
|
var init_stage = __esm({
|
|
1037
1061
|
"src/runtime/stage.ts"() {
|
|
1038
1062
|
"use strict";
|
|
1039
|
-
import_wiki_graph_sdk16 = require("wiki-graph-sdk");
|
|
1040
1063
|
import_wiki_graph_sdk17 = require("wiki-graph-sdk");
|
|
1064
|
+
import_wiki_graph_sdk18 = require("wiki-graph-sdk");
|
|
1041
1065
|
init_support();
|
|
1042
1066
|
}
|
|
1043
1067
|
});
|
|
@@ -1054,18 +1078,18 @@ var init_wikispine = __esm({
|
|
|
1054
1078
|
// src/runtime/index.ts
|
|
1055
1079
|
var runtime_exports = {};
|
|
1056
1080
|
__export(runtime_exports, {
|
|
1057
|
-
DEFAULT_EXTRACTION_PROMPT: () =>
|
|
1058
|
-
DEFAULT_KNOWLEDGE_GRAPH_RECALL_PROMPT: () =>
|
|
1081
|
+
DEFAULT_EXTRACTION_PROMPT: () => import_wiki_graph_sdk17.DEFAULT_EXTRACTION_PROMPT,
|
|
1082
|
+
DEFAULT_KNOWLEDGE_GRAPH_RECALL_PROMPT: () => import_wiki_graph_sdk17.DEFAULT_KNOWLEDGE_GRAPH_RECALL_PROMPT,
|
|
1059
1083
|
ProgressOutputWriter: () => ProgressOutputWriter,
|
|
1060
1084
|
buildLLMOptions: () => buildLLMOptions,
|
|
1061
1085
|
createCLIProgressRenderer: () => createCLIProgressRenderer,
|
|
1062
|
-
createStageLLM: () =>
|
|
1086
|
+
createStageLLM: () => import_wiki_graph_sdk17.createStageLLM,
|
|
1063
1087
|
formatStatusText: () => formatStatusText,
|
|
1064
1088
|
loadCLIConfig: () => loadCLIConfig,
|
|
1065
1089
|
loadRequiredStageConfig: () => loadRequiredStageConfig,
|
|
1066
|
-
resolveExtractionPrompt: () =>
|
|
1090
|
+
resolveExtractionPrompt: () => import_wiki_graph_sdk17.resolveExtractionPrompt,
|
|
1067
1091
|
resolveHostedProviderEndpoint: () => resolveHostedProviderEndpoint,
|
|
1068
|
-
resolveKnowledgeGraphRecallPrompt: () =>
|
|
1092
|
+
resolveKnowledgeGraphRecallPrompt: () => import_wiki_graph_sdk17.resolveKnowledgeGraphRecallPrompt,
|
|
1069
1093
|
resolveWikispineConfig: () => resolveWikispineConfig,
|
|
1070
1094
|
toCLIGenerationPerformanceHints: () => toCLIGenerationPerformanceHints
|
|
1071
1095
|
});
|
|
@@ -1284,7 +1308,7 @@ async function createArchive(args) {
|
|
|
1284
1308
|
args.json === true ? formatCLIJSON({ uri: result.locatedUri }) : "<archive>\n"
|
|
1285
1309
|
);
|
|
1286
1310
|
} catch (error) {
|
|
1287
|
-
if (!(error instanceof
|
|
1311
|
+
if (!(error instanceof import_wiki_graph_sdk19.WikiGraphArchiveExistsError)) throw error;
|
|
1288
1312
|
throw new Error(formatArchiveAlreadyExistsMessage(error.path), {
|
|
1289
1313
|
cause: error
|
|
1290
1314
|
});
|
|
@@ -1299,11 +1323,11 @@ function formatArchiveAlreadyExistsMessage(archivePath) {
|
|
|
1299
1323
|
`Use \`${formatCliCommand([uri, "inspect"])}\` to view it, or rerun with \`--replace\` to overwrite it.`
|
|
1300
1324
|
].join("\n");
|
|
1301
1325
|
}
|
|
1302
|
-
var
|
|
1326
|
+
var import_wiki_graph_sdk19;
|
|
1303
1327
|
var init_create = __esm({
|
|
1304
1328
|
"src/commands/archive-command/create.ts"() {
|
|
1305
1329
|
"use strict";
|
|
1306
|
-
|
|
1330
|
+
import_wiki_graph_sdk19 = require("wiki-graph-sdk");
|
|
1307
1331
|
init_context();
|
|
1308
1332
|
init_runtime();
|
|
1309
1333
|
init_support();
|
|
@@ -1312,16 +1336,306 @@ var init_create = __esm({
|
|
|
1312
1336
|
|
|
1313
1337
|
// src/commands/archive-command/inspect.ts
|
|
1314
1338
|
async function writeArchiveInspectReport(args) {
|
|
1315
|
-
const archive = await getWikiGraphSDK().archives.open(
|
|
1339
|
+
const archive = await getWikiGraphSDK().archives.open(
|
|
1340
|
+
parseCLIArchiveTarget(args.archivePath)
|
|
1341
|
+
);
|
|
1316
1342
|
const report = toCLIInspectReport(
|
|
1317
|
-
await
|
|
1318
|
-
|
|
1319
|
-
|
|
1343
|
+
await createInspectReport(
|
|
1344
|
+
await archive.inspect({
|
|
1345
|
+
...args.chapterId === void 0 ? {} : { chapterId: args.chapterId }
|
|
1346
|
+
})
|
|
1347
|
+
)
|
|
1320
1348
|
);
|
|
1321
1349
|
await writeTextToStdout(
|
|
1322
1350
|
args.json === true ? formatCLIJSON(report) : formatArchiveInspectText(report)
|
|
1323
1351
|
);
|
|
1324
1352
|
}
|
|
1353
|
+
async function createInspectReport(inspection) {
|
|
1354
|
+
const config = await (0, import_wiki_graph_sdk20.loadWikiGraphRuntimeConfig)();
|
|
1355
|
+
const chapters = inspection.chapters;
|
|
1356
|
+
const contentChapters = chapters.filter(
|
|
1357
|
+
({ chapter }) => chapter.stage !== "planned"
|
|
1358
|
+
);
|
|
1359
|
+
const readingGraphCovered = contentChapters.filter(
|
|
1360
|
+
({ capabilities }) => capabilities.readingGraph.completed
|
|
1361
|
+
);
|
|
1362
|
+
const knowledgeGraphCovered = contentChapters.filter(
|
|
1363
|
+
({ capabilities }) => capabilities.knowledgeGraph.completed
|
|
1364
|
+
);
|
|
1365
|
+
const summaryCovered = contentChapters.filter(
|
|
1366
|
+
({ capabilities }) => capabilities.readingSummary.completed
|
|
1367
|
+
);
|
|
1368
|
+
const ftsArtifactCovered = contentChapters.filter(
|
|
1369
|
+
({ indexes }) => indexes.fts.current
|
|
1370
|
+
);
|
|
1371
|
+
const sourceEmbeddingArtifactCovered = contentChapters.filter(
|
|
1372
|
+
({ indexes }) => indexes.sourceEmbedding.current
|
|
1373
|
+
);
|
|
1374
|
+
const summaryEmbeddingArtifactCovered = contentChapters.filter(
|
|
1375
|
+
({ indexes }) => indexes.summaryEmbedding.current
|
|
1376
|
+
);
|
|
1377
|
+
const queryBlockedChapters = contentChapters.filter(
|
|
1378
|
+
(chapter) => !ftsArtifactCovered.includes(chapter) && !sourceEmbeddingArtifactCovered.includes(chapter)
|
|
1379
|
+
);
|
|
1380
|
+
const queryReady = queryBlockedChapters.length === 0;
|
|
1381
|
+
const concurrent = {
|
|
1382
|
+
job: config.concurrent?.job ?? import_wiki_graph_sdk20.DEFAULT_GENERATION_JOB_CONCURRENCY,
|
|
1383
|
+
request: config.concurrent?.request ?? import_wiki_graph_sdk20.DEFAULT_GENERATION_REQUEST_CONCURRENCY
|
|
1384
|
+
};
|
|
1385
|
+
const improvements = createInspectImprovements({
|
|
1386
|
+
concurrent,
|
|
1387
|
+
contentChapters,
|
|
1388
|
+
indexCacheCurrent: inspection.localIndexCache.current,
|
|
1389
|
+
knowledgeGraphCovered,
|
|
1390
|
+
planningModel: (0, import_wiki_graph_sdk20.formatGenerationPlanningModel)(config.llm),
|
|
1391
|
+
queryBlockedChapters,
|
|
1392
|
+
readingGraphCovered,
|
|
1393
|
+
summaryCovered
|
|
1394
|
+
});
|
|
1395
|
+
const performanceHints = (0, import_wiki_graph_sdk20.createGenerationPerformanceHints)({
|
|
1396
|
+
chapters: Math.max(
|
|
1397
|
+
0,
|
|
1398
|
+
...improvements.map((improvement) => improvement.missingChapters ?? 0)
|
|
1399
|
+
),
|
|
1400
|
+
concurrent,
|
|
1401
|
+
hasJobWork: improvements.some(
|
|
1402
|
+
(improvement) => improvement.planning !== void 0
|
|
1403
|
+
),
|
|
1404
|
+
hasRequestWork: improvements.some(
|
|
1405
|
+
(improvement) => improvement.planning !== void 0
|
|
1406
|
+
)
|
|
1407
|
+
});
|
|
1408
|
+
const sourceWords = sumWords(contentChapters);
|
|
1409
|
+
const indexCacheCurrent = inspection.localIndexCache.current;
|
|
1410
|
+
return {
|
|
1411
|
+
archiveUri: inspection.archiveUri,
|
|
1412
|
+
content: {
|
|
1413
|
+
chapters: {
|
|
1414
|
+
content: contentChapters.length,
|
|
1415
|
+
planned: chapters.length - contentChapters.length,
|
|
1416
|
+
total: chapters.length
|
|
1417
|
+
},
|
|
1418
|
+
sourceWords,
|
|
1419
|
+
summaryWords: chapters.reduce(
|
|
1420
|
+
(total, chapter) => total + chapter.summaryWords,
|
|
1421
|
+
0
|
|
1422
|
+
)
|
|
1423
|
+
},
|
|
1424
|
+
coverage: {
|
|
1425
|
+
ftsIndexArtifact: createInspectCoverage(
|
|
1426
|
+
ftsArtifactCovered,
|
|
1427
|
+
contentChapters
|
|
1428
|
+
),
|
|
1429
|
+
knowledgeGraph: createInspectCoverage(
|
|
1430
|
+
knowledgeGraphCovered,
|
|
1431
|
+
contentChapters
|
|
1432
|
+
),
|
|
1433
|
+
readingGraph: createInspectCoverage(readingGraphCovered, contentChapters),
|
|
1434
|
+
sourceEmbeddingIndexArtifact: createInspectCoverage(
|
|
1435
|
+
sourceEmbeddingArtifactCovered,
|
|
1436
|
+
contentChapters
|
|
1437
|
+
),
|
|
1438
|
+
summary: createInspectCoverage(summaryCovered, contentChapters),
|
|
1439
|
+
summaryEmbeddingIndexArtifact: createInspectCoverage(
|
|
1440
|
+
summaryEmbeddingArtifactCovered,
|
|
1441
|
+
contentChapters
|
|
1442
|
+
)
|
|
1443
|
+
},
|
|
1444
|
+
improvements,
|
|
1445
|
+
localIndexCache: {
|
|
1446
|
+
current: indexCacheCurrent,
|
|
1447
|
+
...!queryReady ? {
|
|
1448
|
+
blockedBy: "missing-search-artifacts",
|
|
1449
|
+
impact: "The cache cannot be built until every content chapter has a current FTS or source embedding artifact."
|
|
1450
|
+
} : indexCacheCurrent ? {} : {
|
|
1451
|
+
impact: "The next archive query may need to sync index cache first.",
|
|
1452
|
+
resource: "local CPU/disk time only; no provider calls."
|
|
1453
|
+
},
|
|
1454
|
+
status: !queryReady ? "blocked" : indexCacheCurrent ? "current" : "missing-or-outdated",
|
|
1455
|
+
syncAvailable: queryReady && !indexCacheCurrent
|
|
1456
|
+
},
|
|
1457
|
+
performanceHints,
|
|
1458
|
+
query: { ready: queryReady },
|
|
1459
|
+
retrievalGuidance: formatRetrievalGuidance({
|
|
1460
|
+
contentChapters,
|
|
1461
|
+
indexCacheCurrent,
|
|
1462
|
+
knowledgeGraphCovered,
|
|
1463
|
+
queryReady,
|
|
1464
|
+
readingGraphCovered,
|
|
1465
|
+
sourceWords
|
|
1466
|
+
}),
|
|
1467
|
+
scope: inspection.scope,
|
|
1468
|
+
searchArtifacts: {
|
|
1469
|
+
blockedChapters: queryBlockedChapters.map(
|
|
1470
|
+
(item) => createInspectChapterReference(inspection.archiveUri, item)
|
|
1471
|
+
),
|
|
1472
|
+
...!queryReady ? { resource: "local CPU/disk time only; no provider calls." } : {},
|
|
1473
|
+
ready: queryReady,
|
|
1474
|
+
status: queryReady ? "ready" : "incomplete"
|
|
1475
|
+
},
|
|
1476
|
+
summaryCoverageNote: "Summary coverage means a current summary artifact exists for the chapter; it does not guarantee that every source topic is represented in the summary text.",
|
|
1477
|
+
uri: inspection.uri
|
|
1478
|
+
};
|
|
1479
|
+
}
|
|
1480
|
+
function createInspectChapterReference(archiveUri, inspection) {
|
|
1481
|
+
return {
|
|
1482
|
+
chapterId: inspection.chapter.chapterId,
|
|
1483
|
+
locatedUri: `${archiveUri.replace(/\/+$/u, "")}/${inspection.chapter.uri.replace(/^wikg:\/\//u, "")}`,
|
|
1484
|
+
title: inspection.chapter.title,
|
|
1485
|
+
uri: inspection.chapter.uri
|
|
1486
|
+
};
|
|
1487
|
+
}
|
|
1488
|
+
function createInspectCoverage(covered, total) {
|
|
1489
|
+
const coveredWords = sumWords(covered);
|
|
1490
|
+
const totalWords = sumWords(total);
|
|
1491
|
+
return {
|
|
1492
|
+
coveredChapters: covered.length,
|
|
1493
|
+
coveredWords,
|
|
1494
|
+
percent: formatPercent(coveredWords, totalWords),
|
|
1495
|
+
totalChapters: total.length,
|
|
1496
|
+
totalWords
|
|
1497
|
+
};
|
|
1498
|
+
}
|
|
1499
|
+
function createInspectImprovements(input) {
|
|
1500
|
+
if (input.contentChapters.length === 0) {
|
|
1501
|
+
return [
|
|
1502
|
+
{
|
|
1503
|
+
kind: "add-source",
|
|
1504
|
+
recommendation: "No source content is available yet; add or import source text before graph or summary generation.",
|
|
1505
|
+
title: "Add source content"
|
|
1506
|
+
}
|
|
1507
|
+
];
|
|
1508
|
+
}
|
|
1509
|
+
const improvements = [];
|
|
1510
|
+
if (input.queryBlockedChapters.length > 0) {
|
|
1511
|
+
improvements.push({
|
|
1512
|
+
kind: "build",
|
|
1513
|
+
missingChapters: input.queryBlockedChapters.length,
|
|
1514
|
+
missingWords: sumWords(input.queryBlockedChapters),
|
|
1515
|
+
recommendation: "Build local FTS artifacts to make this scope queryable. This does not call a provider.",
|
|
1516
|
+
task: "index-fts",
|
|
1517
|
+
title: "Enable query with local FTS"
|
|
1518
|
+
});
|
|
1519
|
+
} else if (!input.indexCacheCurrent) {
|
|
1520
|
+
improvements.push({
|
|
1521
|
+
kind: "sync-index",
|
|
1522
|
+
recommendation: "Sync the index cache from chapter index artifacts so query starts without a lazy cache rebuild.",
|
|
1523
|
+
title: "Sync index cache"
|
|
1524
|
+
});
|
|
1525
|
+
}
|
|
1526
|
+
improvements.push(
|
|
1527
|
+
...createGraphImprovement({
|
|
1528
|
+
concurrent: input.concurrent,
|
|
1529
|
+
covered: input.readingGraphCovered,
|
|
1530
|
+
planningModel: input.planningModel,
|
|
1531
|
+
task: "reading-graph",
|
|
1532
|
+
title: "Complete Reading Graph coverage",
|
|
1533
|
+
total: input.contentChapters
|
|
1534
|
+
}),
|
|
1535
|
+
...createGraphImprovement({
|
|
1536
|
+
concurrent: input.concurrent,
|
|
1537
|
+
covered: input.knowledgeGraphCovered,
|
|
1538
|
+
planningModel: input.planningModel,
|
|
1539
|
+
task: "knowledge-graph",
|
|
1540
|
+
title: "Complete Knowledge Graph coverage",
|
|
1541
|
+
total: input.contentChapters
|
|
1542
|
+
}),
|
|
1543
|
+
...createGraphImprovement({
|
|
1544
|
+
concurrent: input.concurrent,
|
|
1545
|
+
covered: input.summaryCovered,
|
|
1546
|
+
planningModel: input.planningModel,
|
|
1547
|
+
task: "reading-summary",
|
|
1548
|
+
title: "Complete Summary coverage",
|
|
1549
|
+
total: input.contentChapters
|
|
1550
|
+
})
|
|
1551
|
+
);
|
|
1552
|
+
return improvements;
|
|
1553
|
+
}
|
|
1554
|
+
function createGraphImprovement(input) {
|
|
1555
|
+
const coveredIds = new Set(
|
|
1556
|
+
input.covered.map(({ chapter }) => chapter.chapterId)
|
|
1557
|
+
);
|
|
1558
|
+
const missing = input.total.filter(
|
|
1559
|
+
({ chapter }) => !coveredIds.has(chapter.chapterId)
|
|
1560
|
+
);
|
|
1561
|
+
if (missing.length === 0) return [];
|
|
1562
|
+
const missingWords = sumWords(missing);
|
|
1563
|
+
return [
|
|
1564
|
+
{
|
|
1565
|
+
kind: "build",
|
|
1566
|
+
missingChapters: missing.length,
|
|
1567
|
+
missingWords,
|
|
1568
|
+
planning: (0, import_wiki_graph_sdk20.planGenerationTask)(
|
|
1569
|
+
input.task,
|
|
1570
|
+
missingWords,
|
|
1571
|
+
missing.length,
|
|
1572
|
+
input.concurrent,
|
|
1573
|
+
input.planningModel
|
|
1574
|
+
),
|
|
1575
|
+
recommendation: formatImprovementRecommendation(
|
|
1576
|
+
input.covered,
|
|
1577
|
+
input.total,
|
|
1578
|
+
missingWords
|
|
1579
|
+
),
|
|
1580
|
+
task: input.task,
|
|
1581
|
+
title: input.title
|
|
1582
|
+
}
|
|
1583
|
+
];
|
|
1584
|
+
}
|
|
1585
|
+
function formatImprovementRecommendation(covered, total, missingWords) {
|
|
1586
|
+
const totalWords = sumWords(total);
|
|
1587
|
+
const coveredWords = sumWords(covered);
|
|
1588
|
+
if (totalWords === 0) return "No source content is available.";
|
|
1589
|
+
if (total.length === 1 || coveredWords / totalWords >= 0.9 || missingWords <= 1e3) {
|
|
1590
|
+
return "Queue the full scope to finish the remaining gap.";
|
|
1591
|
+
}
|
|
1592
|
+
return "Queue selected chapters first if only part of the scope matters.";
|
|
1593
|
+
}
|
|
1594
|
+
function formatRetrievalGuidance(input) {
|
|
1595
|
+
if (input.sourceWords === 0 || input.contentChapters.length === 0) {
|
|
1596
|
+
return [
|
|
1597
|
+
"Source content: empty.",
|
|
1598
|
+
"Add source text before using query coverage or graph-based retrieval."
|
|
1599
|
+
];
|
|
1600
|
+
}
|
|
1601
|
+
return [
|
|
1602
|
+
input.queryReady ? `Query: available; local index cache is ${input.indexCacheCurrent ? "current" : "missing or outdated and can be synced from artifacts"}.` : "Query: unavailable until every content chapter has a current FTS or source embedding artifact.",
|
|
1603
|
+
formatObjectSearchGuidance(
|
|
1604
|
+
"Reading Graph object retrieval",
|
|
1605
|
+
input.readingGraphCovered,
|
|
1606
|
+
input.contentChapters
|
|
1607
|
+
),
|
|
1608
|
+
formatObjectSearchGuidance(
|
|
1609
|
+
"Entity/triple retrieval",
|
|
1610
|
+
input.knowledgeGraphCovered,
|
|
1611
|
+
input.contentChapters
|
|
1612
|
+
)
|
|
1613
|
+
];
|
|
1614
|
+
}
|
|
1615
|
+
function formatObjectSearchGuidance(label, covered, total) {
|
|
1616
|
+
const coveredWords = sumWords(covered);
|
|
1617
|
+
const totalWords = sumWords(total);
|
|
1618
|
+
const ratio = totalWords === 0 ? 0 : coveredWords / totalWords;
|
|
1619
|
+
const coverage = formatPercent(coveredWords, totalWords);
|
|
1620
|
+
if (ratio >= 1) {
|
|
1621
|
+
return `${label}: covers all source content; it can represent the full scope for object retrieval.`;
|
|
1622
|
+
}
|
|
1623
|
+
if (ratio >= 0.9) {
|
|
1624
|
+
return `${label}: covers ${coverage}; use it as the main path, but source --query is needed for uncovered content.`;
|
|
1625
|
+
}
|
|
1626
|
+
if (ratio >= 0.5) {
|
|
1627
|
+
return `${label}: covers ${coverage}; use it as leads, not as a full-scope substitute for source --query.`;
|
|
1628
|
+
}
|
|
1629
|
+
return `${label}: covers ${coverage}; build missing graph coverage before relying on object retrieval.`;
|
|
1630
|
+
}
|
|
1631
|
+
function sumWords(chapters) {
|
|
1632
|
+
return chapters.reduce((total, { chapter }) => total + chapter.words, 0);
|
|
1633
|
+
}
|
|
1634
|
+
function formatPercent(numerator, denominator) {
|
|
1635
|
+
if (denominator === 0) return "n/a";
|
|
1636
|
+
const percent = numerator / denominator * 100;
|
|
1637
|
+
return `${Number.isInteger(percent) ? percent.toFixed(0) : percent.toFixed(1)}%`;
|
|
1638
|
+
}
|
|
1325
1639
|
function toCLIInspectReport(report) {
|
|
1326
1640
|
const { archiveUri, summaryCoverageNote, ...base } = report;
|
|
1327
1641
|
return {
|
|
@@ -1477,12 +1791,15 @@ function formatInspectPerformanceHints(hints) {
|
|
|
1477
1791
|
])
|
|
1478
1792
|
];
|
|
1479
1793
|
}
|
|
1794
|
+
var import_wiki_graph_sdk20;
|
|
1480
1795
|
var init_inspect = __esm({
|
|
1481
1796
|
"src/commands/archive-command/inspect.ts"() {
|
|
1482
1797
|
"use strict";
|
|
1798
|
+
import_wiki_graph_sdk20 = require("wiki-graph-sdk");
|
|
1483
1799
|
init_runtime();
|
|
1484
1800
|
init_context();
|
|
1485
1801
|
init_support();
|
|
1802
|
+
init_archive_target();
|
|
1486
1803
|
}
|
|
1487
1804
|
});
|
|
1488
1805
|
|
|
@@ -1568,11 +1885,11 @@ function formatEvidencePreviewContinuation(evidence, hiddenEvidenceCount) {
|
|
|
1568
1885
|
}
|
|
1569
1886
|
return hiddenEvidenceCount > 0 ? ["", `${hiddenEvidenceCount} evidence more...`] : [];
|
|
1570
1887
|
}
|
|
1571
|
-
var
|
|
1888
|
+
var import_wiki_graph_sdk21;
|
|
1572
1889
|
var init_evidence = __esm({
|
|
1573
1890
|
"src/commands/archive-output/text/evidence.ts"() {
|
|
1574
1891
|
"use strict";
|
|
1575
|
-
|
|
1892
|
+
import_wiki_graph_sdk21 = require("wiki-graph-sdk");
|
|
1576
1893
|
init_command();
|
|
1577
1894
|
init_lines();
|
|
1578
1895
|
init_source();
|
|
@@ -3021,27 +3338,15 @@ var init_types2 = __esm({
|
|
|
3021
3338
|
});
|
|
3022
3339
|
|
|
3023
3340
|
// src/commands/archive-command/run/uri.ts
|
|
3024
|
-
|
|
3025
|
-
return await (0, import_wiki_graph_sdk20.resolveWikiGraphArchiveLocation)(uriOrPath);
|
|
3026
|
-
}
|
|
3027
|
-
async function resolveArchiveCommandRuntimeArguments(args) {
|
|
3341
|
+
function resolveArchiveCommandRuntimeArguments(args) {
|
|
3028
3342
|
if (args.action === "create" || args.action === "export") {
|
|
3029
|
-
|
|
3030
|
-
return { ...args, archivePath: location2.archivePath };
|
|
3031
|
-
}
|
|
3032
|
-
if (args.action === "inspect" || args.action === "next") return args;
|
|
3033
|
-
if (!args.archivePath.startsWith("wikg://lib/")) {
|
|
3034
|
-
return args;
|
|
3343
|
+
return { ...args, archivePath: getArchivePath(args.archivePath) };
|
|
3035
3344
|
}
|
|
3036
|
-
|
|
3037
|
-
return {
|
|
3038
|
-
...args,
|
|
3039
|
-
archivePath: location.locatedUri,
|
|
3040
|
-
...args.objectId === args.archivePath ? { objectId: location.locatedUri } : {}
|
|
3041
|
-
};
|
|
3345
|
+
return args;
|
|
3042
3346
|
}
|
|
3043
3347
|
function getArchivePath(uri) {
|
|
3044
|
-
if (
|
|
3348
|
+
if (!uri.includes("://")) return uri;
|
|
3349
|
+
if ((0, import_wiki_graph_sdk22.parseWikiGraphLibraryUri)(uri)?.kind === "scope") {
|
|
3045
3350
|
return uri;
|
|
3046
3351
|
}
|
|
3047
3352
|
const archivePath = parseLocatedWikiGraphUri(uri).archivePath;
|
|
@@ -3051,14 +3356,14 @@ function getArchivePath(uri) {
|
|
|
3051
3356
|
return archivePath;
|
|
3052
3357
|
}
|
|
3053
3358
|
function getArchiveIndexScope(uri) {
|
|
3054
|
-
if ((0,
|
|
3359
|
+
if ((0, import_wiki_graph_sdk22.parseWikiGraphLibraryUri)(uri)?.kind === "scope") {
|
|
3055
3360
|
return { kind: "library-index", libraryId: -1 };
|
|
3056
3361
|
}
|
|
3057
3362
|
const archivePath = getArchivePath(uri);
|
|
3058
3363
|
return { archiveKey: archivePath, archivePath, kind: "archive-index" };
|
|
3059
3364
|
}
|
|
3060
3365
|
function getObjectUri(uri) {
|
|
3061
|
-
const libraryTarget = (0,
|
|
3366
|
+
const libraryTarget = (0, import_wiki_graph_sdk22.parseWikiGraphLibraryUri)(uri);
|
|
3062
3367
|
if (libraryTarget?.kind === "scope" && libraryTarget.objectUri !== void 0) {
|
|
3063
3368
|
return libraryTarget.objectUri;
|
|
3064
3369
|
}
|
|
@@ -3072,11 +3377,11 @@ function parseChapterScope(uri) {
|
|
|
3072
3377
|
const match = /^wikg:\/\/chapter\/([1-9][0-9]*)(?:\/|$)/u.exec(uri);
|
|
3073
3378
|
return match?.[1] === void 0 ? void 0 : Number(match[1]);
|
|
3074
3379
|
}
|
|
3075
|
-
var
|
|
3380
|
+
var import_wiki_graph_sdk22;
|
|
3076
3381
|
var init_uri3 = __esm({
|
|
3077
3382
|
"src/commands/archive-command/run/uri.ts"() {
|
|
3078
3383
|
"use strict";
|
|
3079
|
-
|
|
3384
|
+
import_wiki_graph_sdk22 = require("wiki-graph-sdk");
|
|
3080
3385
|
init_support();
|
|
3081
3386
|
}
|
|
3082
3387
|
});
|
|
@@ -3192,7 +3497,7 @@ function createScopeOptions(args) {
|
|
|
3192
3497
|
if (args.chapters !== void 0) {
|
|
3193
3498
|
return { chapters: args.chapters };
|
|
3194
3499
|
}
|
|
3195
|
-
const objectUri = (0,
|
|
3500
|
+
const objectUri = (0, import_wiki_graph_sdk23.parseLocatedWikiGraphUri)(args.archivePath).objectUri;
|
|
3196
3501
|
if (objectUri === void 0) {
|
|
3197
3502
|
return {};
|
|
3198
3503
|
}
|
|
@@ -3235,11 +3540,11 @@ function toArchiveCollectionType(kind) {
|
|
|
3235
3540
|
return "triple";
|
|
3236
3541
|
}
|
|
3237
3542
|
}
|
|
3238
|
-
var
|
|
3543
|
+
var import_wiki_graph_sdk23;
|
|
3239
3544
|
var init_options = __esm({
|
|
3240
3545
|
"src/commands/archive-command/run/options.ts"() {
|
|
3241
3546
|
"use strict";
|
|
3242
|
-
|
|
3547
|
+
import_wiki_graph_sdk23 = require("wiki-graph-sdk");
|
|
3243
3548
|
init_types2();
|
|
3244
3549
|
init_uri3();
|
|
3245
3550
|
}
|
|
@@ -3249,7 +3554,7 @@ var init_options = __esm({
|
|
|
3249
3554
|
async function runNextArchivePage(args) {
|
|
3250
3555
|
const cursorId = args.cursor ?? args.archivePath;
|
|
3251
3556
|
const page = await getWikiGraphSDK().continuations.next({
|
|
3252
|
-
...args.cursor === void 0 ? {} : { archive: args.archivePath },
|
|
3557
|
+
...args.cursor === void 0 ? {} : { archive: parseCLIArchiveTarget(args.archivePath) },
|
|
3253
3558
|
cursor: cursorId,
|
|
3254
3559
|
...args.format === void 0 ? {} : { format: args.format },
|
|
3255
3560
|
...args.limit === void 0 ? {} : { limit: args.limit }
|
|
@@ -3319,6 +3624,7 @@ function createCursorOutputContext(cursor, format, limit) {
|
|
|
3319
3624
|
var init_next = __esm({
|
|
3320
3625
|
"src/commands/archive-command/run/next.ts"() {
|
|
3321
3626
|
"use strict";
|
|
3627
|
+
init_archive_target();
|
|
3322
3628
|
init_context();
|
|
3323
3629
|
init_archive_output();
|
|
3324
3630
|
init_options();
|
|
@@ -3330,17 +3636,17 @@ async function writeArchiveRoot(args) {
|
|
|
3330
3636
|
const archivePath = getArchivePath(args.objectId);
|
|
3331
3637
|
if (args.format === "json") {
|
|
3332
3638
|
await writeTextToStdout(
|
|
3333
|
-
formatCLIJSON({ uri: (0,
|
|
3639
|
+
formatCLIJSON({ uri: (0, import_wiki_graph_sdk24.formatLocatedWikiGraphUri)(archivePath) })
|
|
3334
3640
|
);
|
|
3335
3641
|
return;
|
|
3336
3642
|
}
|
|
3337
3643
|
await writeTextToStdout("<archive>\n");
|
|
3338
3644
|
}
|
|
3339
|
-
var
|
|
3645
|
+
var import_wiki_graph_sdk24;
|
|
3340
3646
|
var init_root = __esm({
|
|
3341
3647
|
"src/commands/archive-command/run/root.ts"() {
|
|
3342
3648
|
"use strict";
|
|
3343
|
-
|
|
3649
|
+
import_wiki_graph_sdk24 = require("wiki-graph-sdk");
|
|
3344
3650
|
init_support();
|
|
3345
3651
|
init_uri3();
|
|
3346
3652
|
}
|
|
@@ -3364,12 +3670,12 @@ __export(archive_command_exports, {
|
|
|
3364
3670
|
runArchiveCommand: () => runArchiveCommand
|
|
3365
3671
|
});
|
|
3366
3672
|
async function runArchiveCommand(args) {
|
|
3367
|
-
const libraryTarget = (0,
|
|
3673
|
+
const libraryTarget = (0, import_wiki_graph_sdk25.parseWikiGraphLibraryUri)(args.archivePath);
|
|
3368
3674
|
if (libraryTarget?.kind === "scope" && libraryTarget.objectUri !== "wikg://index" && (libraryTarget.objectUri !== void 0 || args.action === "related" || args.action === "evidence" || args.action === "pack" || args.action === "search" || args.action === "list")) {
|
|
3369
3675
|
await runLibraryIndexArchiveCommand(args, libraryTarget);
|
|
3370
3676
|
return;
|
|
3371
3677
|
}
|
|
3372
|
-
args =
|
|
3678
|
+
args = resolveArchiveCommandRuntimeArguments(args);
|
|
3373
3679
|
switch (args.action) {
|
|
3374
3680
|
case "create":
|
|
3375
3681
|
await createArchive(args);
|
|
@@ -3414,7 +3720,9 @@ async function runArchiveCommand(args) {
|
|
|
3414
3720
|
return;
|
|
3415
3721
|
case "pack":
|
|
3416
3722
|
await writePack(
|
|
3417
|
-
await (await getWikiGraphSDK().archives.open(
|
|
3723
|
+
await (await getWikiGraphSDK().archives.open(
|
|
3724
|
+
parseCLIArchiveTarget(args.archivePath)
|
|
3725
|
+
)).pack(getObjectUri(args.objectId), args.budget ?? 5e3),
|
|
3418
3726
|
createArchiveOutputContext(args),
|
|
3419
3727
|
args.format ?? "text"
|
|
3420
3728
|
);
|
|
@@ -3422,9 +3730,11 @@ async function runArchiveCommand(args) {
|
|
|
3422
3730
|
}
|
|
3423
3731
|
}
|
|
3424
3732
|
async function runArchiveList(args) {
|
|
3425
|
-
const archive = await getWikiGraphSDK().archives.open(
|
|
3733
|
+
const archive = await getWikiGraphSDK().archives.open(
|
|
3734
|
+
parseCLIArchiveTarget(args.archivePath)
|
|
3735
|
+
);
|
|
3426
3736
|
const objectUri = getObjectUri(args.archivePath);
|
|
3427
|
-
if ((0,
|
|
3737
|
+
if ((0, import_wiki_graph_sdk25.isSourceLocatorScopeUri)(objectUri)) {
|
|
3428
3738
|
const context2 = createArchiveOutputContext(args, {
|
|
3429
3739
|
continuationKind: "source-locators",
|
|
3430
3740
|
targetUri: objectUri
|
|
@@ -3491,7 +3801,9 @@ async function runArchiveList(args) {
|
|
|
3491
3801
|
);
|
|
3492
3802
|
}
|
|
3493
3803
|
async function runArchiveSearch(args) {
|
|
3494
|
-
const archive = await getWikiGraphSDK().archives.open(
|
|
3804
|
+
const archive = await getWikiGraphSDK().archives.open(
|
|
3805
|
+
parseCLIArchiveTarget(args.archivePath)
|
|
3806
|
+
);
|
|
3495
3807
|
const scope = await archive.resolveScope({
|
|
3496
3808
|
...args.depth === void 0 ? {} : { depth: args.depth }
|
|
3497
3809
|
});
|
|
@@ -3525,7 +3837,9 @@ async function runArchiveGet(args) {
|
|
|
3525
3837
|
const objectUri = getObjectUri(args.objectId);
|
|
3526
3838
|
const evidenceLimit = getSingleObjectEvidenceLimit(args, objectUri);
|
|
3527
3839
|
const context = evidenceLimit === void 0 ? createArchiveOutputContext(args) : createArchiveOutputContext({ ...args, evidenceLimit });
|
|
3528
|
-
const archive = await getWikiGraphSDK().archives.open(
|
|
3840
|
+
const archive = await getWikiGraphSDK().archives.open(
|
|
3841
|
+
parseCLIArchiveTarget(args.archivePath)
|
|
3842
|
+
);
|
|
3529
3843
|
await writePage(
|
|
3530
3844
|
await archive.page(objectUri, {
|
|
3531
3845
|
...args.backlinks === void 0 ? {} : { backlinks: args.backlinks },
|
|
@@ -3539,7 +3853,9 @@ async function runArchiveGet(args) {
|
|
|
3539
3853
|
}
|
|
3540
3854
|
async function runArchiveRelated(args) {
|
|
3541
3855
|
const objectUri = getObjectUri(args.objectId);
|
|
3542
|
-
const archive = await getWikiGraphSDK().archives.open(
|
|
3856
|
+
const archive = await getWikiGraphSDK().archives.open(
|
|
3857
|
+
parseCLIArchiveTarget(args.archivePath)
|
|
3858
|
+
);
|
|
3543
3859
|
const scope = await archive.resolveScope();
|
|
3544
3860
|
const context = createArchiveOutputContext(
|
|
3545
3861
|
scope === void 0 ? args : { ...args, chapters: scope.chapterIds },
|
|
@@ -3571,7 +3887,9 @@ async function runArchiveRelated(args) {
|
|
|
3571
3887
|
}
|
|
3572
3888
|
async function runArchiveEvidence(args) {
|
|
3573
3889
|
const objectUri = getObjectUri(args.objectId);
|
|
3574
|
-
const archive = await getWikiGraphSDK().archives.open(
|
|
3890
|
+
const archive = await getWikiGraphSDK().archives.open(
|
|
3891
|
+
parseCLIArchiveTarget(args.archivePath)
|
|
3892
|
+
);
|
|
3575
3893
|
const scope = await archive.resolveScope();
|
|
3576
3894
|
const context = createArchiveOutputContext(
|
|
3577
3895
|
scope === void 0 ? args : { ...args, chapters: scope.chapterIds },
|
|
@@ -3630,7 +3948,7 @@ function isArchiveQueryNotReadyError(error) {
|
|
|
3630
3948
|
async function runLibraryIndexArchiveCommand(args, target) {
|
|
3631
3949
|
const libraries = getWikiGraphSDK().libraries;
|
|
3632
3950
|
const library = await libraries.get(
|
|
3633
|
-
(0,
|
|
3951
|
+
(0, import_wiki_graph_sdk25.formatWikiGraphLibraryUri)(target.publicId)
|
|
3634
3952
|
);
|
|
3635
3953
|
const isLibraryRootCollection = target.objectUri === void 0 && args.objectId === void 0;
|
|
3636
3954
|
const objectUri = isLibraryRootCollection ? void 0 : getObjectUri(args.objectId ?? args.archivePath);
|
|
@@ -3887,11 +4205,11 @@ function requireLibraryObjectUri(action, objectUri) {
|
|
|
3887
4205
|
}
|
|
3888
4206
|
return objectUri;
|
|
3889
4207
|
}
|
|
3890
|
-
var
|
|
4208
|
+
var import_wiki_graph_sdk25;
|
|
3891
4209
|
var init_archive_command = __esm({
|
|
3892
4210
|
"src/commands/archive-command/index.ts"() {
|
|
3893
4211
|
"use strict";
|
|
3894
|
-
|
|
4212
|
+
import_wiki_graph_sdk25 = require("wiki-graph-sdk");
|
|
3895
4213
|
init_context();
|
|
3896
4214
|
init_support();
|
|
3897
4215
|
init_convert();
|
|
@@ -3899,6 +4217,7 @@ var init_archive_command = __esm({
|
|
|
3899
4217
|
init_inspect();
|
|
3900
4218
|
init_archive_output();
|
|
3901
4219
|
init_run();
|
|
4220
|
+
init_archive_target();
|
|
3902
4221
|
}
|
|
3903
4222
|
});
|
|
3904
4223
|
|
|
@@ -4225,15 +4544,6 @@ var init_estimate = __esm({
|
|
|
4225
4544
|
}
|
|
4226
4545
|
});
|
|
4227
4546
|
|
|
4228
|
-
// src/runtime/node-platform.ts
|
|
4229
|
-
var node_platform_exports = {};
|
|
4230
|
-
var init_node_platform = __esm({
|
|
4231
|
-
"src/runtime/node-platform.ts"() {
|
|
4232
|
-
"use strict";
|
|
4233
|
-
__reExport(node_platform_exports, require("wiki-graph-sdk/node-platform"));
|
|
4234
|
-
}
|
|
4235
|
-
});
|
|
4236
|
-
|
|
4237
4547
|
// src/commands/queue/output.ts
|
|
4238
4548
|
async function writeJobList(jobs, options) {
|
|
4239
4549
|
const chapters = await resolveJobChapters(jobs);
|
|
@@ -4467,7 +4777,7 @@ function createJobChapterReference(job, chapter) {
|
|
|
4467
4777
|
}
|
|
4468
4778
|
function createJobChapterReferenceFromPath(archivePath, chapter) {
|
|
4469
4779
|
return {
|
|
4470
|
-
locatedUri: (0,
|
|
4780
|
+
locatedUri: (0, import_wiki_graph_sdk26.formatLocatedChapterUri)(archivePath, chapter.path),
|
|
4471
4781
|
title: chapter.title,
|
|
4472
4782
|
uri: chapter.uri
|
|
4473
4783
|
};
|
|
@@ -4480,26 +4790,23 @@ async function resolveJobChapter(job) {
|
|
|
4480
4790
|
}
|
|
4481
4791
|
function getJobResourcePath(job, resourceKey, legacyKey) {
|
|
4482
4792
|
const record = job;
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
const managedPath = getManagedJobResourcePath(resource);
|
|
4486
|
-
if (managedPath !== void 0) return managedPath;
|
|
4487
|
-
return (0, node_platform_exports.getNodeResourcePath)(resource);
|
|
4793
|
+
if (resourceKey === "archive") {
|
|
4794
|
+
return job.archive.kind === "library" ? job.archive.uri : job.archive.path;
|
|
4488
4795
|
}
|
|
4489
4796
|
const legacyPath = record[legacyKey];
|
|
4490
|
-
if (typeof legacyPath === "string")
|
|
4797
|
+
if (typeof legacyPath === "string") {
|
|
4798
|
+
return resolveManagedJobResourcePath(legacyPath) ?? legacyPath;
|
|
4799
|
+
}
|
|
4491
4800
|
return void 0;
|
|
4492
4801
|
}
|
|
4493
|
-
function
|
|
4494
|
-
if (
|
|
4495
|
-
|
|
4496
|
-
}
|
|
4497
|
-
const relativePath = resource.identity.slice("managed:library:".length);
|
|
4802
|
+
function resolveManagedJobResourcePath(identity) {
|
|
4803
|
+
if (!identity.startsWith("managed:library:")) return void 0;
|
|
4804
|
+
const relativePath = identity.slice("managed:library:".length);
|
|
4498
4805
|
const segments = relativePath.split("/");
|
|
4499
4806
|
if (relativePath === "" || segments.some(
|
|
4500
4807
|
(segment) => segment === "" || segment === "." || segment === ".." || segment.includes("\\")
|
|
4501
4808
|
)) {
|
|
4502
|
-
throw new TypeError(`Invalid managed job resource: ${
|
|
4809
|
+
throw new TypeError(`Invalid managed job resource: ${identity}`);
|
|
4503
4810
|
}
|
|
4504
4811
|
const environmentHome = getCLIEnvValue("HOME")?.trim();
|
|
4505
4812
|
const stateDirectory = getCLIStateDir() ?? (0, import_path7.join)(
|
|
@@ -4513,14 +4820,13 @@ function requireJobResourcePath(job, resourceKey, legacyKey) {
|
|
|
4513
4820
|
if (path !== void 0) return path;
|
|
4514
4821
|
throw new TypeError(`Build job is missing ${resourceKey}`);
|
|
4515
4822
|
}
|
|
4516
|
-
var
|
|
4823
|
+
var import_wiki_graph_sdk26, import_os3, import_path7;
|
|
4517
4824
|
var init_output = __esm({
|
|
4518
4825
|
"src/commands/queue/output.ts"() {
|
|
4519
4826
|
"use strict";
|
|
4520
|
-
|
|
4827
|
+
import_wiki_graph_sdk26 = require("wiki-graph-sdk");
|
|
4521
4828
|
init_support();
|
|
4522
4829
|
init_estimate();
|
|
4523
|
-
init_node_platform();
|
|
4524
4830
|
init_context();
|
|
4525
4831
|
import_os3 = require("os");
|
|
4526
4832
|
import_path7 = require("path");
|
|
@@ -4553,6 +4859,7 @@ var init_add = __esm({
|
|
|
4553
4859
|
init_internal_child();
|
|
4554
4860
|
init_estimate();
|
|
4555
4861
|
init_output();
|
|
4862
|
+
init_archive_target();
|
|
4556
4863
|
}
|
|
4557
4864
|
});
|
|
4558
4865
|
|
|
@@ -4563,7 +4870,7 @@ __export(chapter_exports, {
|
|
|
4563
4870
|
});
|
|
4564
4871
|
async function runArchiveChapterCommand(args) {
|
|
4565
4872
|
const sdk = getWikiGraphSDK();
|
|
4566
|
-
const archive = await sdk.archives.open(args.path);
|
|
4873
|
+
const archive = await sdk.archives.open(parseCLIArchiveTarget(args.path));
|
|
4567
4874
|
switch (args.action) {
|
|
4568
4875
|
case "add": {
|
|
4569
4876
|
const details = await archive.addChapter({
|
|
@@ -4593,7 +4900,7 @@ async function runArchiveChapterCommand(args) {
|
|
|
4593
4900
|
requireChapterPath2(args.chapterPath)
|
|
4594
4901
|
);
|
|
4595
4902
|
const job = await sdk.jobs.create({
|
|
4596
|
-
archive: archive.
|
|
4903
|
+
archive: archive.target,
|
|
4597
4904
|
chapterId: chapter.chapterId,
|
|
4598
4905
|
target: requireIndexArtifactTarget(args.indexArtifactTarget)
|
|
4599
4906
|
});
|
|
@@ -4653,7 +4960,7 @@ async function runArchiveChapterCommand(args) {
|
|
|
4653
4960
|
return;
|
|
4654
4961
|
case "set-source": {
|
|
4655
4962
|
const sourceText = await readRequiredSourceText(args);
|
|
4656
|
-
const parsed = args.inputFormat === "jsonl" ? (0,
|
|
4963
|
+
const parsed = args.inputFormat === "jsonl" ? (0, import_wiki_graph_sdk27.parseSourceTextJsonl)(sourceText) : void 0;
|
|
4657
4964
|
await writeChapterDetails(
|
|
4658
4965
|
await archive.setChapterSource(
|
|
4659
4966
|
requireChapterPath2(args.chapterPath),
|
|
@@ -4686,7 +4993,7 @@ async function runArchiveChapterCommand(args) {
|
|
|
4686
4993
|
if (args.treeAction === "apply") {
|
|
4687
4994
|
await writeChapterTreeApplyResult(
|
|
4688
4995
|
await archive.applyChapterTree(
|
|
4689
|
-
(0,
|
|
4996
|
+
(0, import_wiki_graph_sdk27.parseChapterTreeInput)(JSON.parse(await readContentText(args))),
|
|
4690
4997
|
{ dryRun: args.dryRun ?? false }
|
|
4691
4998
|
),
|
|
4692
4999
|
args.dryRun ?? false
|
|
@@ -4812,10 +5119,10 @@ function formatChapterCommandUri(archiveLocator, chapterPath) {
|
|
|
4812
5119
|
if (archiveLocator.startsWith("wikg://")) {
|
|
4813
5120
|
const parsed = parseLocatedWikiGraphUri(archiveLocator);
|
|
4814
5121
|
if (parsed.archivePath !== void 0) {
|
|
4815
|
-
return (0,
|
|
5122
|
+
return (0, import_wiki_graph_sdk27.formatLocatedChapterUri)(parsed.archivePath, chapterPath);
|
|
4816
5123
|
}
|
|
4817
5124
|
}
|
|
4818
|
-
return (0,
|
|
5125
|
+
return (0, import_wiki_graph_sdk27.formatLocatedChapterUri)(archiveLocator, chapterPath);
|
|
4819
5126
|
}
|
|
4820
5127
|
async function writeChapterList(entries, json) {
|
|
4821
5128
|
if (json) {
|
|
@@ -4902,14 +5209,15 @@ function formatStage(stage) {
|
|
|
4902
5209
|
return "reading-summary";
|
|
4903
5210
|
}
|
|
4904
5211
|
}
|
|
4905
|
-
var import_promises2,
|
|
5212
|
+
var import_promises2, import_wiki_graph_sdk27;
|
|
4906
5213
|
var init_chapter = __esm({
|
|
4907
5214
|
"src/commands/archive-command/chapter.ts"() {
|
|
4908
5215
|
"use strict";
|
|
4909
5216
|
import_promises2 = require("fs/promises");
|
|
4910
|
-
|
|
5217
|
+
import_wiki_graph_sdk27 = require("wiki-graph-sdk");
|
|
4911
5218
|
init_context();
|
|
4912
5219
|
init_support();
|
|
5220
|
+
init_archive_target();
|
|
4913
5221
|
init_support();
|
|
4914
5222
|
init_add();
|
|
4915
5223
|
init_output();
|
|
@@ -4935,11 +5243,15 @@ async function runArchiveIndexCommand(args) {
|
|
|
4935
5243
|
}
|
|
4936
5244
|
}
|
|
4937
5245
|
async function readIndexCache(args) {
|
|
4938
|
-
const archive = await getWikiGraphSDK().archives.open(
|
|
5246
|
+
const archive = await getWikiGraphSDK().archives.open(
|
|
5247
|
+
parseCLIArchiveTarget(args.archivePath)
|
|
5248
|
+
);
|
|
4939
5249
|
await writeIndexOutput(args, await archive.getSearchIndexStatus());
|
|
4940
5250
|
}
|
|
4941
5251
|
async function syncIndexCache(args) {
|
|
4942
|
-
const archive = await getWikiGraphSDK().archives.open(
|
|
5252
|
+
const archive = await getWikiGraphSDK().archives.open(
|
|
5253
|
+
parseCLIArchiveTarget(args.archivePath)
|
|
5254
|
+
);
|
|
4943
5255
|
const writer = new ProgressOutputWriter({
|
|
4944
5256
|
jsonl: args.jsonl ?? false,
|
|
4945
5257
|
throttleMs: INDEX_PROGRESS_OUTPUT_INTERVAL_MS
|
|
@@ -4988,7 +5300,9 @@ async function syncIndexCache(args) {
|
|
|
4988
5300
|
});
|
|
4989
5301
|
}
|
|
4990
5302
|
async function cleanIndexCache(args) {
|
|
4991
|
-
const archive = await getWikiGraphSDK().archives.open(
|
|
5303
|
+
const archive = await getWikiGraphSDK().archives.open(
|
|
5304
|
+
parseCLIArchiveTarget(args.archivePath)
|
|
5305
|
+
);
|
|
4992
5306
|
await writeIndexOutput(args, await archive.cleanSearchIndex());
|
|
4993
5307
|
}
|
|
4994
5308
|
function formatIndexCounter(input) {
|
|
@@ -5057,6 +5371,7 @@ var init_search_index = __esm({
|
|
|
5057
5371
|
"src/commands/archive-command/search-index.ts"() {
|
|
5058
5372
|
"use strict";
|
|
5059
5373
|
init_support();
|
|
5374
|
+
init_archive_target();
|
|
5060
5375
|
init_support();
|
|
5061
5376
|
init_runtime();
|
|
5062
5377
|
init_context();
|
|
@@ -5075,13 +5390,17 @@ async function runArchiveMetaCommand(args) {
|
|
|
5075
5390
|
await updateArchiveMeta(args.inputPath, args.metaPatch);
|
|
5076
5391
|
return;
|
|
5077
5392
|
}
|
|
5078
|
-
const archive = await getWikiGraphSDK().archives.open(
|
|
5393
|
+
const archive = await getWikiGraphSDK().archives.open(
|
|
5394
|
+
parseCLIArchiveTarget(args.inputPath)
|
|
5395
|
+
);
|
|
5079
5396
|
await writeArchiveMeta(await archive.readBookMeta(), {
|
|
5080
5397
|
json: args.json ?? false
|
|
5081
5398
|
});
|
|
5082
5399
|
}
|
|
5083
5400
|
async function runArchiveCoverCommand(args) {
|
|
5084
|
-
const archive = await getWikiGraphSDK().archives.open(
|
|
5401
|
+
const archive = await getWikiGraphSDK().archives.open(
|
|
5402
|
+
parseCLIArchiveTarget(args.inputPath)
|
|
5403
|
+
);
|
|
5085
5404
|
if (process.stdout.isTTY === true) {
|
|
5086
5405
|
throw new Error(
|
|
5087
5406
|
"Refusing to write binary cover data to an interactive terminal. Redirect stdout or pipe it."
|
|
@@ -5094,7 +5413,9 @@ async function runArchiveCoverCommand(args) {
|
|
|
5094
5413
|
await writeBinaryToStdout(cover.data);
|
|
5095
5414
|
}
|
|
5096
5415
|
async function updateArchiveMeta(path, patch) {
|
|
5097
|
-
const archive = await getWikiGraphSDK().archives.open(
|
|
5416
|
+
const archive = await getWikiGraphSDK().archives.open(
|
|
5417
|
+
parseCLIArchiveTarget(path)
|
|
5418
|
+
);
|
|
5098
5419
|
const meta = await archive.readBookMeta();
|
|
5099
5420
|
if (meta === void 0) {
|
|
5100
5421
|
throw new Error("Archive metadata is missing.");
|
|
@@ -5157,6 +5478,7 @@ var init_maintenance = __esm({
|
|
|
5157
5478
|
"src/commands/archive-command/maintenance.ts"() {
|
|
5158
5479
|
"use strict";
|
|
5159
5480
|
init_support();
|
|
5481
|
+
init_archive_target();
|
|
5160
5482
|
init_support();
|
|
5161
5483
|
init_context();
|
|
5162
5484
|
}
|
|
@@ -5687,7 +6009,7 @@ async function runLibraryCommand(args) {
|
|
|
5687
6009
|
}
|
|
5688
6010
|
if (args.target.kind === "archive-collection") {
|
|
5689
6011
|
await writeLibraryArchives(
|
|
5690
|
-
await (await libraries.get((0,
|
|
6012
|
+
await (await libraries.get((0, import_wiki_graph_sdk28.formatWikiGraphLibraryUri)(args.target.publicId))).archives(),
|
|
5691
6013
|
args.json ?? false
|
|
5692
6014
|
);
|
|
5693
6015
|
return;
|
|
@@ -5719,7 +6041,7 @@ async function runLibraryCommand(args) {
|
|
|
5719
6041
|
}
|
|
5720
6042
|
case "archive-tree": {
|
|
5721
6043
|
await writeLibraryArchiveTree(
|
|
5722
|
-
await (await libraries.get((0,
|
|
6044
|
+
await (await libraries.get((0, import_wiki_graph_sdk28.formatWikiGraphLibraryUri)(args.target.publicId))).archives(),
|
|
5723
6045
|
{
|
|
5724
6046
|
...args.depth === void 0 ? {} : { depth: args.depth },
|
|
5725
6047
|
json: args.json ?? false,
|
|
@@ -5793,10 +6115,24 @@ async function runLibraryCommand(args) {
|
|
|
5793
6115
|
);
|
|
5794
6116
|
return;
|
|
5795
6117
|
}
|
|
6118
|
+
case "replace": {
|
|
6119
|
+
if (args.inputPath === void 0) {
|
|
6120
|
+
throw new Error("Missing --input <path> for library archive replace.");
|
|
6121
|
+
}
|
|
6122
|
+
await writeLibraryArchive(
|
|
6123
|
+
await libraries.replaceArchive({
|
|
6124
|
+
inputPath: args.inputPath,
|
|
6125
|
+
target: args.target
|
|
6126
|
+
}),
|
|
6127
|
+
args.json ?? false,
|
|
6128
|
+
"Replaced library archive"
|
|
6129
|
+
);
|
|
6130
|
+
return;
|
|
6131
|
+
}
|
|
5796
6132
|
case "get": {
|
|
5797
6133
|
if (args.target.kind === "path") {
|
|
5798
6134
|
await writeLibraryPath(
|
|
5799
|
-
(await libraries.get((0,
|
|
6135
|
+
(await libraries.get((0, import_wiki_graph_sdk28.formatWikiGraphLibraryUri)(args.target.publicId))).snapshot,
|
|
5800
6136
|
args.json ?? false
|
|
5801
6137
|
);
|
|
5802
6138
|
return;
|
|
@@ -5824,7 +6160,7 @@ async function runLibraryCommand(args) {
|
|
|
5824
6160
|
}
|
|
5825
6161
|
if (args.target.kind === "archive-collection") {
|
|
5826
6162
|
await writeLibraryArchives(
|
|
5827
|
-
await (await libraries.get((0,
|
|
6163
|
+
await (await libraries.get((0, import_wiki_graph_sdk28.formatWikiGraphLibraryUri)(args.target.publicId))).archives(),
|
|
5828
6164
|
args.json ?? false
|
|
5829
6165
|
);
|
|
5830
6166
|
return;
|
|
@@ -5890,9 +6226,8 @@ async function writeLibrary(library, json) {
|
|
|
5890
6226
|
formatCLIJSON({
|
|
5891
6227
|
uri: library.uri,
|
|
5892
6228
|
id: library.publicId,
|
|
5893
|
-
folderPath:
|
|
6229
|
+
folderPath: library.folderPath,
|
|
5894
6230
|
isDefault: library.isDefault,
|
|
5895
|
-
stagingPath: (0, node_platform_exports.getNodeResourcePath)(library.staging),
|
|
5896
6231
|
createdAt: library.createdAt,
|
|
5897
6232
|
updatedAt: library.updatedAt
|
|
5898
6233
|
})
|
|
@@ -5909,7 +6244,7 @@ async function writeLibraries(libraries, json) {
|
|
|
5909
6244
|
items: libraries.map((library) => ({
|
|
5910
6245
|
uri: library.uri,
|
|
5911
6246
|
id: library.publicId,
|
|
5912
|
-
path:
|
|
6247
|
+
path: library.folderPath,
|
|
5913
6248
|
isDefault: library.isDefault
|
|
5914
6249
|
}))
|
|
5915
6250
|
})
|
|
@@ -5921,7 +6256,7 @@ async function writeLibraries(libraries, json) {
|
|
|
5921
6256
|
(library) => [
|
|
5922
6257
|
library.uri,
|
|
5923
6258
|
library.publicId,
|
|
5924
|
-
|
|
6259
|
+
library.folderPath,
|
|
5925
6260
|
library.isDefault ? "default" : ""
|
|
5926
6261
|
].join(" ")
|
|
5927
6262
|
).join("\n") + (libraries.length === 0 ? "" : "\n")
|
|
@@ -5932,12 +6267,12 @@ async function writeLibraryPath(library, json) {
|
|
|
5932
6267
|
await writeTextToStdout(
|
|
5933
6268
|
formatCLIJSON({
|
|
5934
6269
|
uri: `${library.uri}/path`,
|
|
5935
|
-
path:
|
|
6270
|
+
path: library.folderPath
|
|
5936
6271
|
})
|
|
5937
6272
|
);
|
|
5938
6273
|
return;
|
|
5939
6274
|
}
|
|
5940
|
-
await writeTextToStdout(`${
|
|
6275
|
+
await writeTextToStdout(`${library.folderPath}
|
|
5941
6276
|
`);
|
|
5942
6277
|
}
|
|
5943
6278
|
async function writeLibraryArchivePath(archive, json) {
|
|
@@ -6004,8 +6339,8 @@ async function writeLibraryArchives(archives, json) {
|
|
|
6004
6339
|
}
|
|
6005
6340
|
async function writeLibraryScopeCollection(target, json) {
|
|
6006
6341
|
const manager = getWikiGraphSDK().libraries;
|
|
6007
|
-
const library = await manager.get((0,
|
|
6008
|
-
const baseUri = (0,
|
|
6342
|
+
const library = await manager.get((0, import_wiki_graph_sdk28.formatWikiGraphLibraryUri)(target.publicId));
|
|
6343
|
+
const baseUri = (0, import_wiki_graph_sdk28.formatWikiGraphLibraryUri)(target.publicId);
|
|
6009
6344
|
const context = {
|
|
6010
6345
|
archiveKey: baseUri,
|
|
6011
6346
|
archivePath: baseUri,
|
|
@@ -6276,18 +6611,17 @@ function formatMetadataTextValue(value) {
|
|
|
6276
6611
|
return String(value);
|
|
6277
6612
|
}
|
|
6278
6613
|
function formatArchiveHostPath(archive) {
|
|
6279
|
-
return archive.
|
|
6614
|
+
return archive.relativePath;
|
|
6280
6615
|
}
|
|
6281
|
-
var import_promises4,
|
|
6616
|
+
var import_promises4, import_wiki_graph_sdk28, INDEX_PROGRESS_OUTPUT_INTERVAL_MS2;
|
|
6282
6617
|
var init_library = __esm({
|
|
6283
6618
|
"src/commands/library.ts"() {
|
|
6284
6619
|
"use strict";
|
|
6285
6620
|
import_promises4 = require("fs/promises");
|
|
6286
|
-
|
|
6621
|
+
import_wiki_graph_sdk28 = require("wiki-graph-sdk");
|
|
6287
6622
|
init_context();
|
|
6288
6623
|
init_support();
|
|
6289
6624
|
init_run();
|
|
6290
|
-
init_node_platform();
|
|
6291
6625
|
init_archive_output();
|
|
6292
6626
|
init_runtime();
|
|
6293
6627
|
INDEX_PROGRESS_OUTPUT_INTERVAL_MS2 = 6e3;
|
|
@@ -6300,7 +6634,9 @@ __export(object_metadata_exports, {
|
|
|
6300
6634
|
runObjectMetadataCommand: () => runObjectMetadataCommand
|
|
6301
6635
|
});
|
|
6302
6636
|
async function runObjectMetadataCommand(args) {
|
|
6303
|
-
const archive = await getWikiGraphSDK().archives.open(
|
|
6637
|
+
const archive = await getWikiGraphSDK().archives.open(
|
|
6638
|
+
parseCLIArchiveTarget(args.archivePath)
|
|
6639
|
+
);
|
|
6304
6640
|
switch (args.action) {
|
|
6305
6641
|
case "get": {
|
|
6306
6642
|
await writeMetadataMap2(
|
|
@@ -6431,6 +6767,7 @@ var init_object_metadata = __esm({
|
|
|
6431
6767
|
import_promises5 = require("fs/promises");
|
|
6432
6768
|
init_context();
|
|
6433
6769
|
init_support();
|
|
6770
|
+
init_archive_target();
|
|
6434
6771
|
init_support();
|
|
6435
6772
|
}
|
|
6436
6773
|
});
|
|
@@ -6564,11 +6901,11 @@ function formatProgressTokenMetrics(tokens) {
|
|
|
6564
6901
|
];
|
|
6565
6902
|
return metrics.length === 0 ? void 0 : { metrics, name: "tokens" };
|
|
6566
6903
|
}
|
|
6567
|
-
var
|
|
6904
|
+
var import_wiki_graph_sdk29, PROGRESS_OUTPUT_INTERVAL_MS;
|
|
6568
6905
|
var init_watch = __esm({
|
|
6569
6906
|
"src/commands/queue/watch.ts"() {
|
|
6570
6907
|
"use strict";
|
|
6571
|
-
|
|
6908
|
+
import_wiki_graph_sdk29 = require("wiki-graph-sdk");
|
|
6572
6909
|
init_runtime();
|
|
6573
6910
|
init_context();
|
|
6574
6911
|
PROGRESS_OUTPUT_INTERVAL_MS = 6e3;
|
|
@@ -6582,7 +6919,7 @@ async function runQueueWorker() {
|
|
|
6582
6919
|
process.once("SIGINT", stop);
|
|
6583
6920
|
process.once("SIGTERM", stop);
|
|
6584
6921
|
try {
|
|
6585
|
-
await (0,
|
|
6922
|
+
await (0, import_wiki_graph_sdk30.runWikiGraphQueueWorker)({ signal: controller.signal });
|
|
6586
6923
|
} catch (error) {
|
|
6587
6924
|
const message = error instanceof Error ? error.message : String(error);
|
|
6588
6925
|
throw new Error(withHelpRoute(message, CLI_HELP_ROUTES.config), {
|
|
@@ -6593,11 +6930,11 @@ async function runQueueWorker() {
|
|
|
6593
6930
|
process.removeListener("SIGTERM", stop);
|
|
6594
6931
|
}
|
|
6595
6932
|
}
|
|
6596
|
-
var
|
|
6933
|
+
var import_wiki_graph_sdk30;
|
|
6597
6934
|
var init_worker = __esm({
|
|
6598
6935
|
"src/commands/queue/worker.ts"() {
|
|
6599
6936
|
"use strict";
|
|
6600
|
-
|
|
6937
|
+
import_wiki_graph_sdk30 = require("wiki-graph-sdk");
|
|
6601
6938
|
init_support();
|
|
6602
6939
|
}
|
|
6603
6940
|
});
|
|
@@ -6661,7 +6998,7 @@ async function runQueueCommand(args) {
|
|
|
6661
6998
|
(await getWikiGraphSDK().jobs.list({
|
|
6662
6999
|
...args.activeOnly === void 0 ? {} : { activeOnly: args.activeOnly },
|
|
6663
7000
|
...args.all === void 0 ? {} : { all: args.all },
|
|
6664
|
-
...args.archivePath === void 0 ? {} : { archive:
|
|
7001
|
+
...args.archivePath === void 0 ? {} : { archive: parseCLIArchiveTarget(args.archivePath) }
|
|
6665
7002
|
})).map((job) => job.snapshot),
|
|
6666
7003
|
{ json: args.json ?? false }
|
|
6667
7004
|
);
|
|
@@ -6713,7 +7050,7 @@ async function getQueueJob(args) {
|
|
|
6713
7050
|
}
|
|
6714
7051
|
function createEnqueueOptions(args) {
|
|
6715
7052
|
return {
|
|
6716
|
-
archive: args.archivePath,
|
|
7053
|
+
archive: parseCLIArchiveTarget(args.archivePath),
|
|
6717
7054
|
...args.boost === void 0 ? {} : { boost: args.boost },
|
|
6718
7055
|
...args.chapterId === void 0 ? {} : { chapterId: args.chapterId },
|
|
6719
7056
|
...args.chapterIds === void 0 ? {} : { chapterIds: args.chapterIds },
|
|
@@ -6730,11 +7067,11 @@ var init_queue = __esm({
|
|
|
6730
7067
|
init_config();
|
|
6731
7068
|
init_context();
|
|
6732
7069
|
init_support();
|
|
7070
|
+
init_archive_target();
|
|
6733
7071
|
init_add();
|
|
6734
7072
|
init_estimate();
|
|
6735
7073
|
init_output();
|
|
6736
7074
|
init_watch();
|
|
6737
|
-
init_node_platform();
|
|
6738
7075
|
init_worker();
|
|
6739
7076
|
}
|
|
6740
7077
|
});
|
|
@@ -6750,10 +7087,10 @@ module.exports = __toCommonJS(src_exports);
|
|
|
6750
7087
|
|
|
6751
7088
|
// src/app/runner.ts
|
|
6752
7089
|
var import_stream2 = require("stream");
|
|
6753
|
-
var
|
|
7090
|
+
var import_wiki_graph_sdk32 = require("wiki-graph-sdk");
|
|
6754
7091
|
|
|
6755
7092
|
// src/args/help.ts
|
|
6756
|
-
var
|
|
7093
|
+
var import_wiki_graph_sdk6 = require("wiki-graph-sdk");
|
|
6757
7094
|
var import_fs3 = require("fs");
|
|
6758
7095
|
var import_path5 = require("path");
|
|
6759
7096
|
init_command();
|
|
@@ -6763,7 +7100,7 @@ init_support();
|
|
|
6763
7100
|
init_support();
|
|
6764
7101
|
|
|
6765
7102
|
// src/args/uri/chapter/target.ts
|
|
6766
|
-
var
|
|
7103
|
+
var import_wiki_graph_sdk5 = require("wiki-graph-sdk");
|
|
6767
7104
|
|
|
6768
7105
|
// src/args/uri/triple-pattern.ts
|
|
6769
7106
|
function parseTriplePatternObjectUri(objectUri) {
|
|
@@ -6910,7 +7247,7 @@ function parseChapterPathAndSuffix(value) {
|
|
|
6910
7247
|
);
|
|
6911
7248
|
const pathParts = suffixStart === -1 ? parts : parts.slice(0, suffixStart);
|
|
6912
7249
|
const suffixParts = suffixStart === -1 ? [] : parts.slice(suffixStart);
|
|
6913
|
-
const chapterPath = (0,
|
|
7250
|
+
const chapterPath = (0, import_wiki_graph_sdk5.parseChapterPath)(pathParts.join("/"), "chapter URI");
|
|
6914
7251
|
return {
|
|
6915
7252
|
chapterPath,
|
|
6916
7253
|
...suffixParts.length === 0 ? {} : { suffix: suffixParts.join("/") }
|
|
@@ -7176,7 +7513,7 @@ function formatHelpCommandUri(uri) {
|
|
|
7176
7513
|
return formatShellArgument(uri);
|
|
7177
7514
|
}
|
|
7178
7515
|
function formatLibraryHelpUri(fallbackUri, target) {
|
|
7179
|
-
const scopeUri = (0,
|
|
7516
|
+
const scopeUri = (0, import_wiki_graph_sdk6.formatWikiGraphLibraryUri)(target.publicId);
|
|
7180
7517
|
switch (target.kind) {
|
|
7181
7518
|
case "archive":
|
|
7182
7519
|
if (target.archivePublicId === void 0) {
|
|
@@ -7249,7 +7586,7 @@ function requireUriHelpTarget(name) {
|
|
|
7249
7586
|
function getLibraryHelpContext(uri) {
|
|
7250
7587
|
const target = (() => {
|
|
7251
7588
|
try {
|
|
7252
|
-
return (0,
|
|
7589
|
+
return (0, import_wiki_graph_sdk6.parseWikiGraphLibraryUri)(uri);
|
|
7253
7590
|
} catch {
|
|
7254
7591
|
return void 0;
|
|
7255
7592
|
}
|
|
@@ -7276,7 +7613,7 @@ function getUriHelpContext(uri) {
|
|
|
7276
7613
|
}
|
|
7277
7614
|
function getHelpObjectUri(uri) {
|
|
7278
7615
|
try {
|
|
7279
|
-
const libraryTarget = (0,
|
|
7616
|
+
const libraryTarget = (0, import_wiki_graph_sdk6.parseWikiGraphLibraryUri)(uri);
|
|
7280
7617
|
if (libraryTarget?.objectUri !== void 0) {
|
|
7281
7618
|
return libraryTarget.objectUri;
|
|
7282
7619
|
}
|
|
@@ -7300,7 +7637,7 @@ function renderHelpTemplate(templateName, extraContext = {}) {
|
|
|
7300
7637
|
});
|
|
7301
7638
|
}
|
|
7302
7639
|
function getHelpTemplateEnvironment() {
|
|
7303
|
-
helpTemplateEnvironment ??= (0,
|
|
7640
|
+
helpTemplateEnvironment ??= (0, import_wiki_graph_sdk6.createNodeTemplateEnvironment)(
|
|
7304
7641
|
resolveCLIDataDirectory(),
|
|
7305
7642
|
{
|
|
7306
7643
|
autoescape: false
|
|
@@ -7333,7 +7670,7 @@ function resolveCLIDataDirectory() {
|
|
|
7333
7670
|
|
|
7334
7671
|
// src/args/archive.ts
|
|
7335
7672
|
init_support();
|
|
7336
|
-
var
|
|
7673
|
+
var import_wiki_graph_sdk10 = require("wiki-graph-sdk");
|
|
7337
7674
|
|
|
7338
7675
|
// src/args/helper/actions.ts
|
|
7339
7676
|
init_support();
|
|
@@ -7347,13 +7684,13 @@ function isArchiveMaintenanceCommand(value) {
|
|
|
7347
7684
|
}
|
|
7348
7685
|
|
|
7349
7686
|
// src/args/helper/chapter/ids.ts
|
|
7350
|
-
var
|
|
7687
|
+
var import_wiki_graph_sdk8 = require("wiki-graph-sdk");
|
|
7351
7688
|
init_support();
|
|
7352
7689
|
|
|
7353
7690
|
// src/args/helper/uri.ts
|
|
7354
7691
|
init_support();
|
|
7355
7692
|
init_local_config();
|
|
7356
|
-
var
|
|
7693
|
+
var import_wiki_graph_sdk7 = require("wiki-graph-sdk");
|
|
7357
7694
|
function validateArchiveCommandUriInput(action, value) {
|
|
7358
7695
|
if (action === "create" || action === "export" || action === "inspect" || action === "next") {
|
|
7359
7696
|
return;
|
|
@@ -7523,7 +7860,7 @@ function formatMissingArchiveInputMessage(action) {
|
|
|
7523
7860
|
}
|
|
7524
7861
|
}
|
|
7525
7862
|
function isWikiGraphUri(value) {
|
|
7526
|
-
return value?.startsWith(
|
|
7863
|
+
return value?.startsWith(import_wiki_graph_sdk7.WIKI_GRAPH_URI_PREFIX) === true;
|
|
7527
7864
|
}
|
|
7528
7865
|
function stripObjectUriPrefix(objectUri) {
|
|
7529
7866
|
const prefix = getWikiGraphUriPrefix(objectUri);
|
|
@@ -7586,8 +7923,8 @@ function parseWikiGraphJobTargetUri(uri) {
|
|
|
7586
7923
|
return jobId;
|
|
7587
7924
|
}
|
|
7588
7925
|
function getWikiGraphUriPrefix(uri) {
|
|
7589
|
-
if (uri.startsWith(
|
|
7590
|
-
return
|
|
7926
|
+
if (uri.startsWith(import_wiki_graph_sdk7.WIKI_GRAPH_URI_PREFIX)) {
|
|
7927
|
+
return import_wiki_graph_sdk7.WIKI_GRAPH_URI_PREFIX;
|
|
7591
7928
|
}
|
|
7592
7929
|
return void 0;
|
|
7593
7930
|
}
|
|
@@ -7613,7 +7950,7 @@ function parseWikiGraphPath(value) {
|
|
|
7613
7950
|
return void 0;
|
|
7614
7951
|
}
|
|
7615
7952
|
try {
|
|
7616
|
-
const parsed = (0,
|
|
7953
|
+
const parsed = (0, import_wiki_graph_sdk7.parseWikiGraphUriSyntax)(value);
|
|
7617
7954
|
return parsed.protocol === "wikg" ? parsed.path : void 0;
|
|
7618
7955
|
} catch {
|
|
7619
7956
|
return void 0;
|
|
@@ -7634,7 +7971,7 @@ function parseChapterPathRef(value, flag, archivePath, helpRoute) {
|
|
|
7634
7971
|
const normalized = value.trim();
|
|
7635
7972
|
try {
|
|
7636
7973
|
if (!isWikiGraphUri(normalized)) {
|
|
7637
|
-
return (0,
|
|
7974
|
+
return (0, import_wiki_graph_sdk8.parseChapterPath)(normalized, flag);
|
|
7638
7975
|
}
|
|
7639
7976
|
const parsed = parseLocatedWikiGraphUri(normalized);
|
|
7640
7977
|
if (parsed.archivePath !== void 0 && parsed.archivePath !== archivePath) {
|
|
@@ -7642,7 +7979,7 @@ function parseChapterPathRef(value, flag, archivePath, helpRoute) {
|
|
|
7642
7979
|
`Invalid ${flag}: ${value}. Chapter URI belongs to a different archive.`
|
|
7643
7980
|
);
|
|
7644
7981
|
}
|
|
7645
|
-
const path = (0,
|
|
7982
|
+
const path = (0, import_wiki_graph_sdk8.parseChapterUriPath)(parsed.objectUri ?? normalized);
|
|
7646
7983
|
if (path === void 0) {
|
|
7647
7984
|
throw new Error(
|
|
7648
7985
|
`Invalid ${flag}: ${value}. Expected a chapter path or URI.`
|
|
@@ -8272,7 +8609,7 @@ function parseBuildJobTarget(value) {
|
|
|
8272
8609
|
|
|
8273
8610
|
// src/args/helper/flags.ts
|
|
8274
8611
|
init_support();
|
|
8275
|
-
var
|
|
8612
|
+
var import_wiki_graph_sdk9 = require("wiki-graph-sdk");
|
|
8276
8613
|
function rejectArchiveChapterFlag(name, value, helpRoute) {
|
|
8277
8614
|
if (value !== void 0) {
|
|
8278
8615
|
throw new Error(
|
|
@@ -8312,7 +8649,7 @@ function rejectNonCreateReplaceFlag(positionals, values) {
|
|
|
8312
8649
|
return;
|
|
8313
8650
|
}
|
|
8314
8651
|
const [command, action] = positionals;
|
|
8315
|
-
if (command?.startsWith(
|
|
8652
|
+
if (command?.startsWith(import_wiki_graph_sdk9.WIKI_GRAPH_URI_PREFIX) === true && action === "create") {
|
|
8316
8653
|
return;
|
|
8317
8654
|
}
|
|
8318
8655
|
throw new Error(
|
|
@@ -9215,14 +9552,14 @@ function rejectNonQuerySkipUnindexedFlag(action, values, helpRoute) {
|
|
|
9215
9552
|
|
|
9216
9553
|
// src/args/parse.ts
|
|
9217
9554
|
var import_util = require("util");
|
|
9218
|
-
var
|
|
9555
|
+
var import_wiki_graph_sdk14 = require("wiki-graph-sdk");
|
|
9219
9556
|
init_support();
|
|
9220
9557
|
|
|
9221
9558
|
// src/args/queue.ts
|
|
9222
9559
|
init_support();
|
|
9223
9560
|
|
|
9224
9561
|
// src/args/uri/chapter/routing.ts
|
|
9225
|
-
var
|
|
9562
|
+
var import_wiki_graph_sdk11 = require("wiki-graph-sdk");
|
|
9226
9563
|
init_support();
|
|
9227
9564
|
function parseArchiveChapterUriArguments(uri, archivePath, target, action, tail, values) {
|
|
9228
9565
|
const helpRoute = formatWikiGraphHelpCommand(uri, action);
|
|
@@ -9502,7 +9839,7 @@ function parseSingleChapterUriArguments(archivePath, chapterPath, action, tail,
|
|
|
9502
9839
|
case "list":
|
|
9503
9840
|
return parseArchiveArguments(
|
|
9504
9841
|
action,
|
|
9505
|
-
[(0,
|
|
9842
|
+
[(0, import_wiki_graph_sdk11.formatLocatedChapterUri)(archivePath, chapterPath), ...tail],
|
|
9506
9843
|
values,
|
|
9507
9844
|
helpRoute
|
|
9508
9845
|
);
|
|
@@ -9598,7 +9935,7 @@ function parseChapterResourceUriArguments(uri, archivePath, chapterPath, resourc
|
|
|
9598
9935
|
return parseArchiveArguments(
|
|
9599
9936
|
action,
|
|
9600
9937
|
[
|
|
9601
|
-
resource === "source" || resource === "summary" ? formatChapterScopedArchiveUri(archivePath, chapterPath) : (0,
|
|
9938
|
+
resource === "source" || resource === "summary" ? formatChapterScopedArchiveUri(archivePath, chapterPath) : (0, import_wiki_graph_sdk11.formatLocatedChapterUri)(archivePath, chapterPath),
|
|
9602
9939
|
...tail
|
|
9603
9940
|
],
|
|
9604
9941
|
values,
|
|
@@ -9631,7 +9968,7 @@ function parseChapterResourceUriArguments(uri, archivePath, chapterPath, resourc
|
|
|
9631
9968
|
);
|
|
9632
9969
|
}
|
|
9633
9970
|
if (action === "get") {
|
|
9634
|
-
const objectUri = uri.includes("#") && (resource === "source" || resource === "summary") ? uri : isLibraryArchiveLocator(archivePath) ? uri : resource === "source" ? (0,
|
|
9971
|
+
const objectUri = uri.includes("#") && (resource === "source" || resource === "summary") ? uri : isLibraryArchiveLocator(archivePath) ? uri : resource === "source" ? (0, import_wiki_graph_sdk11.formatLocatedChapterSourceCollectionUri)(archivePath, chapterPath) : (0, import_wiki_graph_sdk11.formatLocatedChapterResourceUri)(
|
|
9635
9972
|
archivePath,
|
|
9636
9973
|
chapterPath,
|
|
9637
9974
|
resource
|
|
@@ -9657,7 +9994,7 @@ function parseChapterResourceUriArguments(uri, archivePath, chapterPath, resourc
|
|
|
9657
9994
|
);
|
|
9658
9995
|
}
|
|
9659
9996
|
function formatChapterScopedArchiveUri(archivePath, chapterPath) {
|
|
9660
|
-
return isLibraryArchiveLocator(archivePath) ? `${archivePath}/chapter/${chapterPath}` : (0,
|
|
9997
|
+
return isLibraryArchiveLocator(archivePath) ? `${archivePath}/chapter/${chapterPath}` : (0, import_wiki_graph_sdk11.formatLocatedChapterUri)(archivePath, chapterPath);
|
|
9661
9998
|
}
|
|
9662
9999
|
function isLibraryArchiveLocator(archivePath) {
|
|
9663
10000
|
return archivePath.startsWith("wikg://lib/arc/") || /^wikg:\/\/lib\/[^/]+\/arc\//u.test(archivePath);
|
|
@@ -9709,7 +10046,7 @@ function parseArchiveChapterLikeArguments(action, archivePath, tail, values, hel
|
|
|
9709
10046
|
}
|
|
9710
10047
|
|
|
9711
10048
|
// src/args/uri/entry.ts
|
|
9712
|
-
var
|
|
10049
|
+
var import_wiki_graph_sdk12 = require("wiki-graph-sdk");
|
|
9713
10050
|
init_support();
|
|
9714
10051
|
|
|
9715
10052
|
// src/args/uri/archive-objects.ts
|
|
@@ -10305,7 +10642,7 @@ function parseArchiveUriTargetArguments(uri, action, tail, values) {
|
|
|
10305
10642
|
return parseArchiveArguments(action, [uri, ...tail], values, helpRoute);
|
|
10306
10643
|
}
|
|
10307
10644
|
function parseLibraryArchiveObjectTarget(uri) {
|
|
10308
|
-
const target = (0,
|
|
10645
|
+
const target = (0, import_wiki_graph_sdk12.parseWikiGraphLibraryUri)(uri);
|
|
10309
10646
|
if (target?.kind === "archive" && target.objectUri !== void 0) {
|
|
10310
10647
|
return target;
|
|
10311
10648
|
}
|
|
@@ -11158,9 +11495,9 @@ function parseTransformArguments(positionals, values) {
|
|
|
11158
11495
|
}
|
|
11159
11496
|
|
|
11160
11497
|
// src/args/uri/library.ts
|
|
11161
|
-
var
|
|
11498
|
+
var import_wiki_graph_sdk13 = require("wiki-graph-sdk");
|
|
11162
11499
|
init_support();
|
|
11163
|
-
var LIBRARY_ARCHIVE_ACTIONS = /* @__PURE__ */ new Set(["get", "remove"]);
|
|
11500
|
+
var LIBRARY_ARCHIVE_ACTIONS = /* @__PURE__ */ new Set(["get", "remove", "replace"]);
|
|
11164
11501
|
var LIBRARY_ARCHIVE_COLLECTION_ACTIONS = /* @__PURE__ */ new Set(["add", "get", "scan"]);
|
|
11165
11502
|
var LIBRARY_ARCHIVE_PATH_ACTIONS = /* @__PURE__ */ new Set(["get", "set"]);
|
|
11166
11503
|
var LIBRARY_ARCHIVE_TREE_ACTIONS = /* @__PURE__ */ new Set(["archive-tree"]);
|
|
@@ -11189,7 +11526,7 @@ function parseLibraryUriFirstArguments(positionals, values) {
|
|
|
11189
11526
|
if (uri === void 0) {
|
|
11190
11527
|
throw new Error("Internal error: missing library URI.");
|
|
11191
11528
|
}
|
|
11192
|
-
const target = (0,
|
|
11529
|
+
const target = (0, import_wiki_graph_sdk13.parseWikiGraphLibraryUri)(uri);
|
|
11193
11530
|
if (target === void 0) {
|
|
11194
11531
|
throw new Error(`Expected a Wiki Graph library URI: ${uri}`);
|
|
11195
11532
|
}
|
|
@@ -11867,10 +12204,22 @@ function parseLibraryArchiveArguments(uri, target, action, tail, values) {
|
|
|
11867
12204
|
allowConfirm: action === "remove"
|
|
11868
12205
|
});
|
|
11869
12206
|
rejectArchiveFlag(action, "--path", values.path, helpRoute);
|
|
11870
|
-
rejectArchiveFlag(action, "--input", values.input, helpRoute);
|
|
11871
12207
|
rejectArchiveFlag(action, "--json-input", values["json-input"], helpRoute);
|
|
11872
12208
|
rejectArchiveBooleanFlag(action, "--jsonl", values.jsonl, helpRoute);
|
|
11873
12209
|
rejectExtraPositionals(action, tail, 0, helpRoute);
|
|
12210
|
+
if (action === "replace") {
|
|
12211
|
+
if (values.input === void 0) {
|
|
12212
|
+
throw new Error(withHelpRoute("Missing --input <path>.", helpRoute));
|
|
12213
|
+
}
|
|
12214
|
+
rejectArchiveFlag(action, "--to", values.to, helpRoute);
|
|
12215
|
+
rejectArchiveBooleanFlag(action, "--confirm", values.confirm, helpRoute);
|
|
12216
|
+
return {
|
|
12217
|
+
args: { action, inputPath: values.input, json: values.json, target },
|
|
12218
|
+
help: false,
|
|
12219
|
+
kind: "library"
|
|
12220
|
+
};
|
|
12221
|
+
}
|
|
12222
|
+
rejectArchiveFlag(action, "--input", values.input, helpRoute);
|
|
11874
12223
|
if (action === "get") {
|
|
11875
12224
|
rejectArchiveFlag(action, "--to", values.to, helpRoute);
|
|
11876
12225
|
rejectArchiveBooleanFlag(action, "--confirm", values.confirm, helpRoute);
|
|
@@ -11967,6 +12316,7 @@ function parseLibraryScopeArguments(uri, target, action, tail, values) {
|
|
|
11967
12316
|
case "add":
|
|
11968
12317
|
case "create":
|
|
11969
12318
|
case "rebind":
|
|
12319
|
+
case "replace":
|
|
11970
12320
|
case "scan":
|
|
11971
12321
|
throw new Error(
|
|
11972
12322
|
"Internal error: unsupported action routed to library scope."
|
|
@@ -12034,6 +12384,7 @@ function parseLibraryMetadataArguments(uri, target, action, tail, values) {
|
|
|
12034
12384
|
case "create":
|
|
12035
12385
|
case "list":
|
|
12036
12386
|
case "remove":
|
|
12387
|
+
case "replace":
|
|
12037
12388
|
case "add":
|
|
12038
12389
|
case "rebind":
|
|
12039
12390
|
case "clean-index":
|
|
@@ -12078,7 +12429,7 @@ function rejectExtraPositionals(action, positionals, expected, helpRoute) {
|
|
|
12078
12429
|
}
|
|
12079
12430
|
}
|
|
12080
12431
|
function isLibraryAction(action) {
|
|
12081
|
-
return action === "add" || action === "archive-tree" || action === "clear" || action === "clean-index" || action === "create" || action === "delete" || action === "get" || action === "get-index" || action === "list" || action === "put" || action === "rebind" || action === "remove" || action === "scan" || action === "set" || action === "sync-index";
|
|
12432
|
+
return action === "add" || action === "archive-tree" || action === "clear" || action === "clean-index" || action === "create" || action === "delete" || action === "get" || action === "get-index" || action === "list" || action === "put" || action === "rebind" || action === "replace" || action === "remove" || action === "scan" || action === "set" || action === "sync-index";
|
|
12082
12433
|
}
|
|
12083
12434
|
function validateTargetAction(uri, label, actions, action) {
|
|
12084
12435
|
if (!actions.has(action)) {
|
|
@@ -12454,7 +12805,7 @@ function parseCLIArguments(argv = process.argv.slice(2)) {
|
|
|
12454
12805
|
);
|
|
12455
12806
|
return parseLocalConfigUriFirstArguments(positionals, values);
|
|
12456
12807
|
}
|
|
12457
|
-
if ((0,
|
|
12808
|
+
if ((0, import_wiki_graph_sdk14.isWikiGraphLibraryUri)(positionals[0])) {
|
|
12458
12809
|
return parseLibraryUriFirstArguments(positionals, values);
|
|
12459
12810
|
}
|
|
12460
12811
|
if (isWikiGraphUri(positionals[0])) {
|
|
@@ -12484,7 +12835,7 @@ function rejectNonWikiGraphSkipUnindexedFlag(positionals, values) {
|
|
|
12484
12835
|
return;
|
|
12485
12836
|
}
|
|
12486
12837
|
const command = positionals[0];
|
|
12487
|
-
if (command !== void 0 && (isWikiGraphUri(command) || (0,
|
|
12838
|
+
if (command !== void 0 && (isWikiGraphUri(command) || (0, import_wiki_graph_sdk14.isWikiGraphLibraryUri)(command))) {
|
|
12488
12839
|
return;
|
|
12489
12840
|
}
|
|
12490
12841
|
throw new Error(
|
|
@@ -12553,7 +12904,7 @@ async function runQueueCommand2(args) {
|
|
|
12553
12904
|
init_support();
|
|
12554
12905
|
init_support();
|
|
12555
12906
|
init_home_target();
|
|
12556
|
-
var
|
|
12907
|
+
var import_wiki_graph_sdk31 = require("wiki-graph-sdk");
|
|
12557
12908
|
init_context();
|
|
12558
12909
|
async function dispatchWikiGraphCLI(input) {
|
|
12559
12910
|
try {
|
|
@@ -12640,10 +12991,10 @@ function shouldPrintDefaultHelp(argv, stdinIsTTY) {
|
|
|
12640
12991
|
return argv.length === 0 && stdinIsTTY === true;
|
|
12641
12992
|
}
|
|
12642
12993
|
function formatCLIError(error, argv) {
|
|
12643
|
-
if (error instanceof
|
|
12994
|
+
if (error instanceof import_wiki_graph_sdk31.LLMPaymentRequiredError) {
|
|
12644
12995
|
return "LLM payment required. Check your provider billing status or account balance.";
|
|
12645
12996
|
}
|
|
12646
|
-
const message = formatTerminalRemediation(error, (0,
|
|
12997
|
+
const message = formatTerminalRemediation(error, (0, import_wiki_graph_sdk31.formatError)(error));
|
|
12647
12998
|
const relativeResolution = hasErrorCode(error, "ENOENT") ? getRelativeArchiveUriResolution(argv[0] ?? "") : void 0;
|
|
12648
12999
|
if (relativeResolution === void 0) {
|
|
12649
13000
|
return message;
|
|
@@ -12656,7 +13007,7 @@ Resolved archive path:
|
|
|
12656
13007
|
See: wg help uri`;
|
|
12657
13008
|
}
|
|
12658
13009
|
function formatTerminalRemediation(error, message) {
|
|
12659
|
-
if (error instanceof
|
|
13010
|
+
if (error instanceof import_wiki_graph_sdk31.WikiGraphError) {
|
|
12660
13011
|
const chapterId = error.details.chapterId;
|
|
12661
13012
|
switch (error.code) {
|
|
12662
13013
|
case "chapter_has_children":
|
|
@@ -12700,7 +13051,7 @@ function createCLIErrorObject(error, argv) {
|
|
|
12700
13051
|
return {
|
|
12701
13052
|
error: {
|
|
12702
13053
|
message: formatCLIError(error, argv),
|
|
12703
|
-
type: error instanceof
|
|
13054
|
+
type: error instanceof import_wiki_graph_sdk31.LLMPaymentRequiredError ? "llm_payment_required" : "error"
|
|
12704
13055
|
}
|
|
12705
13056
|
};
|
|
12706
13057
|
}
|
|
@@ -12758,7 +13109,7 @@ async function runWikiGraphCLIWithEntryPolicy(input = {}, envPolicy) {
|
|
|
12758
13109
|
envPolicy: entryContext.envPolicy,
|
|
12759
13110
|
exitCode: 0,
|
|
12760
13111
|
queueAutostart: true,
|
|
12761
|
-
sdk: (0,
|
|
13112
|
+
sdk: (0, import_wiki_graph_sdk32.createWikiGraphSDK)({
|
|
12762
13113
|
cwd: input.cwd ?? process.cwd(),
|
|
12763
13114
|
env: entryContext.env,
|
|
12764
13115
|
envPolicy: entryContext.envPolicy,
|
|
@@ -12869,8 +13220,9 @@ var CaptureWritable = class extends import_stream2.Writable {
|
|
|
12869
13220
|
}
|
|
12870
13221
|
};
|
|
12871
13222
|
|
|
12872
|
-
// src/
|
|
12873
|
-
|
|
13223
|
+
// src/runtime/node-platform.ts
|
|
13224
|
+
var node_platform_exports = {};
|
|
13225
|
+
__reExport(node_platform_exports, require("wiki-graph-sdk/node-platform"));
|
|
12874
13226
|
// Annotate the CommonJS export names for ESM import in node:
|
|
12875
13227
|
0 && (module.exports = {
|
|
12876
13228
|
createWikiGraphCLI,
|