wiki-graph-sdk 0.8.1 → 0.8.2
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 +25 -0
- package/dist/archives.cjs +7 -0
- package/dist/archives.cjs.map +1 -1
- package/dist/archives.d.ts +2 -0
- package/dist/archives.js +8 -0
- package/dist/archives.js.map +1 -1
- package/dist/conversions.cjs.map +1 -1
- package/dist/conversions.js +1 -0
- package/dist/conversions.js.map +1 -1
- package/dist/default-worker.cjs +50 -10
- package/dist/default-worker.cjs.map +1 -1
- package/dist/default-worker.js +54 -10
- package/dist/default-worker.js.map +1 -1
- package/dist/embedding.cjs.map +1 -1
- package/dist/embedding.js +1 -0
- package/dist/embedding.js.map +1 -1
- package/dist/gc.cjs +52 -10
- package/dist/gc.cjs.map +1 -1
- package/dist/gc.d.ts +3 -0
- package/dist/gc.js +56 -10
- package/dist/gc.js.map +1 -1
- package/dist/host-pQiVAKEY.d.ts +10 -0
- package/dist/index.cjs +86 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +8 -4
- package/dist/index.js +90 -12
- package/dist/index.js.map +1 -1
- package/dist/local-config.cjs.map +1 -1
- package/dist/local-config.js +1 -0
- package/dist/local-config.js.map +1 -1
- package/dist/maintenance.cjs.map +1 -1
- package/dist/maintenance.js +1 -0
- package/dist/maintenance.js.map +1 -1
- package/dist/node-platform.cjs +18 -4
- package/dist/node-platform.cjs.map +1 -1
- package/dist/node-platform.d.ts +12 -3
- package/dist/node-platform.js +18 -4
- package/dist/node-platform.js.map +1 -1
- package/dist/runtime-config.cjs.map +1 -1
- package/dist/runtime-config.js +1 -0
- package/dist/runtime-config.js.map +1 -1
- package/dist/stage.cjs.map +1 -1
- package/dist/stage.js +1 -0
- package/dist/stage.js.map +1 -1
- package/dist/worker.cjs +81 -42
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.d.ts +7 -2
- package/dist/worker.js +85 -42
- package/dist/worker.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -7,25 +7,26 @@ export { LOCAL_CONFIG_SECTIONS, clearLocalConfigSection, deleteLocalConfigValue,
|
|
|
7
7
|
import { W as WikiGraphJobRuntime, a as WikiGraphJobManager } from './jobs-CRK-DZ40.js';
|
|
8
8
|
export { b as WikiGraphJob, c as WikiGraphJobBackend, d as WikiGraphJobChapterReference, e as WikiGraphJobCreateOptions, f as WikiGraphJobEnqueueOptions, g as WikiGraphJobEnqueuePlan, h as WikiGraphJobEnqueueResult, i as WikiGraphJobEventListener, j as WikiGraphJobEventsOptions, k as WikiGraphJobListOptions, l as WikiGraphJobSnapshot, m as WikiGraphJobSubscriptionOptions } from './jobs-CRK-DZ40.js';
|
|
9
9
|
import { ContinuationCursor, QueryIndexScope, SearchIndexQueryMode, ArchiveSourceLocatorResult, ArchiveCollectionResult, ArchiveFindResult, ArchiveEvidence, ArchiveRelatedResult, WikiGraphLibraryRecord, WikiGraphLibraryArchiveRecord, ParsedWikiGraphLibraryUri, listWikiGraphLibraryEvidence, WikiGraphLibraryIndexState, rebuildWikiGraphLibraryIndex, ArchiveFindOptions, ArchiveCollectionOptions, readWikiGraphLibraryPage, ArchivePage, listRelatedWikiGraphLibraryObjects, ArchivePack } from 'wiki-graph-core';
|
|
10
|
-
export { ArchiveBacklinkBucket, ArchiveBacklinks, ArchiveCollectionOptions, ArchiveCollectionResult, ArchiveEvidence, ArchiveEvidenceItem, ArchiveFindEvidencePreview, ArchiveFindHit, ArchiveFindOptions, ArchiveFindResult, ArchiveListItem, ArchivePack, ArchivePage, ArchiveRelatedResult, ArchiveSourceLocator, ArchiveSourceLocatorResult, ArchiveTriplePattern, BookMeta, BuildJobEvent, BuildJobProgressCounter, BuildJobTarget, ChapterDetails, ChapterEntry, ChapterStage, ChapterTree, ChapterTreeApplyResult, ContinuationCursor, DEFAULT_EXTRACTION_PROMPT, DEFAULT_KNOWLEDGE_GRAPH_RECALL_PROMPT, IndexArtifactKind, LLMPaymentRequiredError, LocatedWikiGraphUri, ParsedWikiGraphLibraryUri, QueryIndexScope, SearchIndexEmbeddingProvider, SourceArtifactInput, WIKI_GRAPH_URI_PREFIX, WikiGraphError, WikiGraphLLMOptions, WikiGraphLibraryIndexState, WikiGraphMaintenanceUpgradeResult, WikiGraphProgressCallback, WikiGraphProgressEvent, WikispineProvider, formatError, formatLocatedChapterResourceUri, formatLocatedChapterSourceCollectionUri, formatLocatedChapterUri, formatLocatedWikiGraphUri, formatWikiGraphCommandUri, formatWikiGraphLibraryUri, isSourceLocatorScopeUri, isWikiGraphLibraryUri, parseChapterPath, parseChapterTreeInput, parseChapterUriPath, parseLocatedWikiGraphUri, parseSourceTextJsonl, parseWikiGraphLibraryUri, parseWikiGraphUriSyntax, resolveExtractionPrompt, resolveKnowledgeGraphRecallPrompt } from 'wiki-graph-core';
|
|
10
|
+
export { ArchiveBacklinkBucket, ArchiveBacklinks, ArchiveCollectionOptions, ArchiveCollectionResult, ArchiveEvidence, ArchiveEvidenceItem, ArchiveFindEvidencePreview, ArchiveFindHit, ArchiveFindOptions, ArchiveFindResult, ArchiveListItem, ArchivePack, ArchivePage, ArchiveRelatedResult, ArchiveSourceLocator, ArchiveSourceLocatorResult, ArchiveTriplePattern, BookMeta, BuildJobEvent, BuildJobProgressCounter, BuildJobTarget, ChapterDetails, ChapterEntry, ChapterStage, ChapterTree, ChapterTreeApplyResult, ContinuationCursor, DEFAULT_EXTRACTION_PROMPT, DEFAULT_KNOWLEDGE_GRAPH_RECALL_PROMPT, Directory, File, FileReader, FileWriter, IndexArtifactKind, LLMPaymentRequiredError, LocatedWikiGraphUri, ParsedSourceLocatorFragment, ParsedWikiGraphLibraryUri, ParsedWikiGraphUri, QueryIndexScope, ReadonlyFile, SearchIndexEmbeddingProvider, SearchIndexQueryMode, SourceArtifactInput, WIKI_GRAPH_URI_PREFIX, WikiGraphError, WikiGraphLLMOptions, WikiGraphLibraryIndexState, WikiGraphMaintenanceUpgradeResult, WikiGraphPlatform, WikiGraphProgressCallback, WikiGraphProgressEvent, WikiGraphStorage, WikispineProvider, formatError, formatLocatedChapterResourceUri, formatLocatedChapterSourceCollectionUri, formatLocatedChapterUri, formatLocatedWikiGraphUri, formatSourceArtifactUri, formatSourceLocatorFragment, formatWikiGraphCommandUri, formatWikiGraphLibraryUri, isSourceLocatorScopeUri, isWikiGraphJobUri, isWikiGraphLibraryUri, isWikiGraphUri, parseChapterPath, parseChapterTreeInput, parseChapterUriPath, parseLocatedWikiGraphUri, parseSourceLocatorFragment, parseSourceTextJsonl, parseWikiGraphLibraryUri, parseWikiGraphUriSyntax, requireArchiveUri, requireLocatedObjectOrArchiveUri, requireLocatedObjectUri, resolveExtractionPrompt, resolveKnowledgeGraphRecallPrompt } from 'wiki-graph-core';
|
|
11
11
|
import { WikiGraphConversionManager } from './conversions.js';
|
|
12
12
|
export { WikiGraphConversionFormat, WikiGraphConversionInput, WikiGraphConversionOptions, WikiGraphConversionResult, WikiGraphSourceFormat } from './conversions.js';
|
|
13
13
|
export { WikiGraphQueueWorkerOptions, requireKnowledgeGraphWikispineConfig, runWikiGraphQueueWorker } from './default-worker.js';
|
|
14
14
|
export { DANGEROUS_RUNTIME_ENV_NAMES, WikiGraphEntryEnvPolicy, WikiGraphEntryRuntimeContext, WikiGraphEntryRuntimeOptions, createEntryRuntimeContext } from './entry-context.js';
|
|
15
15
|
export { QueryEmbeddingResult, WikiGraphEmbeddingConfig, WikiGraphEmbeddingProviderName, buildSearchIndexEmbeddingProvider, embedQueryText, embedQueryTextWithLocalConfig, readWikiGraphEmbeddingConfig } from './embedding.js';
|
|
16
|
+
import { W as WikiGraphSDKHost } from './host-pQiVAKEY.js';
|
|
16
17
|
export { buildWikiGraphLLMOptions } from './llm.js';
|
|
17
18
|
import { WikiGraphMaintenanceManager } from './maintenance.js';
|
|
18
19
|
export { WikiGraphLegacyMigrationResult, WikiGraphMaintenanceTarget } from './maintenance.js';
|
|
19
|
-
export { NodeDirectory, NodeFile, createNodeTemplateEnvironment, createNodeWikiGraphStorage, ensureNodeWikiGraphPlatform, getNodeResourcePath, installNodeWikiGraphPlatform, nodeWikiGraphPlatform, withNodeWikiGraphStorage, writeNodeFileHandle } from './node-platform.js';
|
|
20
|
+
export { NodeDirectory, NodeFile, NodeWikiGraphPlatformOptions, NodeWikiGraphStorageOptions, createNodeTemplateEnvironment, createNodeWikiGraphPlatform, createNodeWikiGraphStorage, ensureNodeWikiGraphPlatform, getNodeResourcePath, installNodeWikiGraphPlatform, nodeWikiGraphPlatform, withNodeWikiGraphStorage, writeNodeFileHandle } from './node-platform.js';
|
|
20
21
|
export { DEFAULT_GENERATION_JOB_CONCURRENCY, DEFAULT_GENERATION_REQUEST_CONCURRENCY, GenerationConcurrency, GenerationPerformanceHint, GenerationPlanningCost, createGenerationPerformanceHints, formatGenerationPlanningDuration, formatGenerationPlanningModel, planGenerationTask } from './planning.js';
|
|
21
22
|
import { W as WikiGraphSDKProviders } from './stage-BnWI3Rqt.js';
|
|
22
23
|
export { a as WikiGraphEmbeddingProvider, b as WikiGraphLLMMessage, c as WikiGraphLLMProvider, d as WikiGraphLLMProviderEvent, e as WikiGraphLLMProviderOptions, f as createStageLLM, l as loadRequiredStageConfig, r as resolveWikiGraphLLMJSON } from './stage-BnWI3Rqt.js';
|
|
23
24
|
export { HostedProviderScope, WikiGraphLLMConfig, WikiGraphProvider, WikiGraphRuntimeConfig, loadWikiGraphRuntimeConfig, resolveHostedProviderEndpoint, resolveWikispineConfig } from './runtime-config.js';
|
|
24
25
|
export { nodeWikispineCommandRunner } from './wikispine.js';
|
|
25
26
|
import 'zod';
|
|
27
|
+
import 'wiki-graph-core/platform';
|
|
26
28
|
import 'node:fs/promises';
|
|
27
29
|
import 'nunjucks';
|
|
28
|
-
import 'wiki-graph-core/platform';
|
|
29
30
|
|
|
30
31
|
interface WikiGraphProviderTestResult {
|
|
31
32
|
readonly durationMs: number;
|
|
@@ -75,6 +76,7 @@ interface WikiGraphContinuationContext {
|
|
|
75
76
|
readonly ids?: readonly string[];
|
|
76
77
|
readonly indexScope: QueryIndexScope;
|
|
77
78
|
readonly libraryQuery?: "archive-members" | "objects";
|
|
79
|
+
readonly match?: "all" | "any";
|
|
78
80
|
readonly order?: "doc-asc" | "doc-desc";
|
|
79
81
|
readonly query?: string;
|
|
80
82
|
readonly queryMode?: SearchIndexQueryMode;
|
|
@@ -212,6 +214,7 @@ interface WikiGraphSDKRuntimeContext {
|
|
|
212
214
|
readonly cwd: string;
|
|
213
215
|
readonly env: NodeJS.ProcessEnv;
|
|
214
216
|
readonly envPolicy: WikiGraphSDKEnvPolicy;
|
|
217
|
+
readonly host?: WikiGraphSDKHost;
|
|
215
218
|
readonly providers?: WikiGraphSDKProviders;
|
|
216
219
|
readonly stateDir?: string | undefined;
|
|
217
220
|
}
|
|
@@ -224,6 +227,7 @@ interface WikiGraphSDKOptions {
|
|
|
224
227
|
readonly cwd?: string;
|
|
225
228
|
readonly env?: NodeJS.ProcessEnv;
|
|
226
229
|
readonly envPolicy?: WikiGraphSDKEnvPolicy;
|
|
230
|
+
readonly host?: WikiGraphSDKHost;
|
|
227
231
|
readonly providers?: WikiGraphSDKProviders;
|
|
228
232
|
readonly stateDir?: string;
|
|
229
233
|
}
|
|
@@ -244,4 +248,4 @@ declare class WikiGraphSDK implements WikiGraphJobRuntime {
|
|
|
244
248
|
}
|
|
245
249
|
declare function createWikiGraphSDK(options?: WikiGraphSDKOptions): WikiGraphSDK;
|
|
246
250
|
|
|
247
|
-
export { LocalConfigObject, LocalConfigSection, WikiGraphArchiveManager, WikiGraphArchiveTarget, WikiGraphConfigManager, type WikiGraphContinuationContext, WikiGraphContinuationManager, type WikiGraphContinuationOptions, type WikiGraphContinuationPage, WikiGraphConversionManager, WikiGraphJobManager, WikiGraphJobRuntime, WikiGraphLibrary, type WikiGraphLibraryAddArchiveOptions, type WikiGraphLibraryArchiveContent, type WikiGraphLibraryArchiveReadOptions, type WikiGraphLibraryArchiveSnapshot, type WikiGraphLibraryEvidenceOptions, WikiGraphLibraryManager, type WikiGraphLibraryMoveArchiveOptions, type WikiGraphLibraryPageOptions, type WikiGraphLibraryRelatedOptions, type WikiGraphLibraryReplaceArchiveOptions, type WikiGraphLibraryScanSnapshot, type WikiGraphLibrarySearchOptions, type WikiGraphLibrarySnapshot, type WikiGraphLibraryTarget, WikiGraphMaintenanceManager, type WikiGraphProviderTestResult, WikiGraphSDK, type WikiGraphSDKEnvPolicy, type WikiGraphSDKOptions, WikiGraphSDKProviders, type WikiGraphSDKRuntimeContext, createWikiGraphSDK, getWikiGraphSDKProviders, getWikiGraphSDKRuntimeContext, getWikiGraphSDKStateDir, withWikiGraphSDKRuntimeContext };
|
|
251
|
+
export { LocalConfigObject, LocalConfigSection, WikiGraphArchiveManager, WikiGraphArchiveTarget, WikiGraphConfigManager, type WikiGraphContinuationContext, WikiGraphContinuationManager, type WikiGraphContinuationOptions, type WikiGraphContinuationPage, WikiGraphConversionManager, WikiGraphJobManager, WikiGraphJobRuntime, WikiGraphLibrary, type WikiGraphLibraryAddArchiveOptions, type WikiGraphLibraryArchiveContent, type WikiGraphLibraryArchiveReadOptions, type WikiGraphLibraryArchiveSnapshot, type WikiGraphLibraryEvidenceOptions, WikiGraphLibraryManager, type WikiGraphLibraryMoveArchiveOptions, type WikiGraphLibraryPageOptions, type WikiGraphLibraryRelatedOptions, type WikiGraphLibraryReplaceArchiveOptions, type WikiGraphLibraryScanSnapshot, type WikiGraphLibrarySearchOptions, type WikiGraphLibrarySnapshot, type WikiGraphLibraryTarget, WikiGraphMaintenanceManager, type WikiGraphProviderTestResult, WikiGraphSDK, type WikiGraphSDKEnvPolicy, WikiGraphSDKHost, type WikiGraphSDKOptions, WikiGraphSDKProviders, type WikiGraphSDKRuntimeContext, createWikiGraphSDK, getWikiGraphSDKProviders, getWikiGraphSDKRuntimeContext, getWikiGraphSDKStateDir, withWikiGraphSDKRuntimeContext };
|
package/dist/index.js
CHANGED
|
@@ -142,6 +142,7 @@ import * as yauzl from "yauzl";
|
|
|
142
142
|
import * as yazl from "yazl";
|
|
143
143
|
import { Environment, Loader } from "nunjucks";
|
|
144
144
|
import {
|
|
145
|
+
getWikiGraphPlatform,
|
|
145
146
|
getWikiGraphStorage,
|
|
146
147
|
installWikiGraphPlatform,
|
|
147
148
|
installWikiGraphStorage,
|
|
@@ -764,6 +765,9 @@ var nodeWikiGraphPlatform = {
|
|
|
764
765
|
write: writeNodeZip
|
|
765
766
|
}
|
|
766
767
|
};
|
|
768
|
+
function createNodeWikiGraphPlatform(options = {}) {
|
|
769
|
+
return options.lifecycle === void 0 ? nodeWikiGraphPlatform : { ...nodeWikiGraphPlatform, lifecycle: options.lifecycle };
|
|
770
|
+
}
|
|
767
771
|
var NodeTemplateLoader = class extends Loader {
|
|
768
772
|
#dataDirectory;
|
|
769
773
|
constructor(dataDirectory) {
|
|
@@ -809,10 +813,15 @@ function resolveNodeDataDirectory() {
|
|
|
809
813
|
directory = parent;
|
|
810
814
|
}
|
|
811
815
|
}
|
|
812
|
-
function createNodeWikiGraphStorage(
|
|
816
|
+
function createNodeWikiGraphStorage(stateRootOrOptions = pathModule.join(
|
|
817
|
+
os.homedir(),
|
|
818
|
+
".wikigraph"
|
|
819
|
+
)) {
|
|
820
|
+
const libraryRoot = typeof stateRootOrOptions === "string" ? stateRootOrOptions : stateRootOrOptions.libraryRoot;
|
|
821
|
+
const documentStoreRoot = typeof stateRootOrOptions === "string" ? pathModule.join(stateRootOrOptions, "documents") : stateRootOrOptions.documentStoreRoot;
|
|
813
822
|
return {
|
|
814
|
-
library: new NodeDirectory(
|
|
815
|
-
documentStore: new NodeDirectory(
|
|
823
|
+
library: new NodeDirectory(libraryRoot),
|
|
824
|
+
documentStore: new NodeDirectory(documentStoreRoot)
|
|
816
825
|
};
|
|
817
826
|
}
|
|
818
827
|
function installNodeWikiGraphPlatform(stateRoot) {
|
|
@@ -820,7 +829,11 @@ function installNodeWikiGraphPlatform(stateRoot) {
|
|
|
820
829
|
installWikiGraphStorage(createNodeWikiGraphStorage(stateRoot));
|
|
821
830
|
}
|
|
822
831
|
function ensureNodeWikiGraphPlatform() {
|
|
823
|
-
|
|
832
|
+
try {
|
|
833
|
+
getWikiGraphPlatform();
|
|
834
|
+
} catch {
|
|
835
|
+
installWikiGraphPlatform(nodeWikiGraphPlatform);
|
|
836
|
+
}
|
|
824
837
|
try {
|
|
825
838
|
getWikiGraphStorage();
|
|
826
839
|
} catch {
|
|
@@ -2309,6 +2322,13 @@ var WikiGraphArchiveHandle = class {
|
|
|
2309
2322
|
);
|
|
2310
2323
|
return status;
|
|
2311
2324
|
}
|
|
2325
|
+
/** Clear cached search sessions without changing the archive index. */
|
|
2326
|
+
async clearSearchSessions(options = {}) {
|
|
2327
|
+
await this.#runtime.run(
|
|
2328
|
+
async () => await deleteArchiveSearchSessions(this.path),
|
|
2329
|
+
options.signal
|
|
2330
|
+
);
|
|
2331
|
+
}
|
|
2312
2332
|
async listChapters(options = {}) {
|
|
2313
2333
|
return await this.#readDocument(
|
|
2314
2334
|
async (document) => await listChapters2(document),
|
|
@@ -3255,6 +3275,8 @@ async function createFindOptions(cursor, limit) {
|
|
|
3255
3275
|
cursor: cursor.cursor,
|
|
3256
3276
|
...cursor.evidenceLimit === void 0 ? {} : { evidenceLimit: cursor.evidenceLimit },
|
|
3257
3277
|
limit,
|
|
3278
|
+
...cursor.match === void 0 ? {} : { match: cursor.match },
|
|
3279
|
+
...cursor.order === void 0 ? {} : { order: cursor.order },
|
|
3258
3280
|
...cursor.queryMode === void 0 ? {} : { queryMode: cursor.queryMode },
|
|
3259
3281
|
...cursor.skipUnindexed === void 0 ? {} : { skipUnindexed: cursor.skipUnindexed },
|
|
3260
3282
|
...cursor.sourceContext === void 0 ? {} : { sourceContext: cursor.sourceContext },
|
|
@@ -3358,6 +3380,8 @@ function createContinuationPayload(context, cursor) {
|
|
|
3358
3380
|
indexScope: context.indexScope,
|
|
3359
3381
|
kind: "search",
|
|
3360
3382
|
...createLibraryQueryPayload(context),
|
|
3383
|
+
...context.match === void 0 ? {} : { match: context.match },
|
|
3384
|
+
...context.order === void 0 ? {} : { order: context.order },
|
|
3361
3385
|
...context.query === void 0 ? {} : { query: context.query },
|
|
3362
3386
|
...context.queryMode === void 0 ? {} : { queryMode: context.queryMode },
|
|
3363
3387
|
...context.skipUnindexed === void 0 ? {} : { skipUnindexed: context.skipUnindexed },
|
|
@@ -3584,16 +3608,48 @@ import {
|
|
|
3584
3608
|
resolveChapterPathReadonly as resolveChapterPathReadonly2,
|
|
3585
3609
|
WikiGraphArchiveFile as WikiGraphArchiveFile4
|
|
3586
3610
|
} from "wiki-graph-core";
|
|
3611
|
+
|
|
3612
|
+
// src/host.ts
|
|
3613
|
+
import {
|
|
3614
|
+
installWikiGraphPlatform as installWikiGraphPlatform2,
|
|
3615
|
+
withWikiGraphStorage as withWikiGraphStorage2
|
|
3616
|
+
} from "wiki-graph-core/platform";
|
|
3617
|
+
function prepareWikiGraphSDKHost(host) {
|
|
3618
|
+
if (host?.platform === void 0) {
|
|
3619
|
+
ensureNodeWikiGraphPlatform();
|
|
3620
|
+
return;
|
|
3621
|
+
}
|
|
3622
|
+
installWikiGraphPlatform2(host.platform);
|
|
3623
|
+
}
|
|
3624
|
+
function assertWikiGraphSDKHostOptions(options) {
|
|
3625
|
+
if (options.host?.storage !== void 0 && options.stateDir !== void 0) {
|
|
3626
|
+
throw new TypeError(
|
|
3627
|
+
"Wiki Graph SDK host.storage and stateDir cannot be used together."
|
|
3628
|
+
);
|
|
3629
|
+
}
|
|
3630
|
+
}
|
|
3631
|
+
async function withWikiGraphSDKHost(options, operation) {
|
|
3632
|
+
assertWikiGraphSDKHostOptions(options);
|
|
3633
|
+
prepareWikiGraphSDKHost(options.host);
|
|
3634
|
+
if (options.host?.storage !== void 0) {
|
|
3635
|
+
return await withWikiGraphStorage2(options.host.storage, operation);
|
|
3636
|
+
}
|
|
3637
|
+
return await withNodeWikiGraphStorage(options.stateDir, operation);
|
|
3638
|
+
}
|
|
3639
|
+
|
|
3640
|
+
// src/worker.ts
|
|
3587
3641
|
import {
|
|
3588
3642
|
applyChapterJobArtifactFile as applyChapterJobArtifactFile2,
|
|
3589
3643
|
createLocalChapterJobFileExecutor,
|
|
3590
3644
|
writeChapterJobInputFile as writeChapterJobInputFile2
|
|
3591
3645
|
} from "wiki-graph-core/worker";
|
|
3592
3646
|
async function runBuildJobWorker(options) {
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3647
|
+
const { host, stateDir, ...coreOptions } = options;
|
|
3648
|
+
await withWikiGraphSDKHost(
|
|
3649
|
+
{
|
|
3650
|
+
...host === void 0 ? {} : { host },
|
|
3651
|
+
...stateDir === void 0 ? {} : { stateDir }
|
|
3652
|
+
},
|
|
3597
3653
|
async () => await runCoreBuildJobWorker(coreOptions)
|
|
3598
3654
|
);
|
|
3599
3655
|
}
|
|
@@ -5073,11 +5129,13 @@ var WikiGraphSDK = class {
|
|
|
5073
5129
|
libraries;
|
|
5074
5130
|
maintenance;
|
|
5075
5131
|
constructor(options = {}) {
|
|
5076
|
-
|
|
5132
|
+
assertWikiGraphSDKHostOptions(options);
|
|
5133
|
+
prepareWikiGraphSDKHost(options.host);
|
|
5077
5134
|
this.#context = {
|
|
5078
5135
|
cwd: options.cwd ?? process.cwd(),
|
|
5079
5136
|
env: { ...process.env, ...options.env },
|
|
5080
5137
|
envPolicy: options.envPolicy ?? "production",
|
|
5138
|
+
...options.host === void 0 ? {} : { host: options.host },
|
|
5081
5139
|
providers: { ...options.providers },
|
|
5082
5140
|
...options.stateDir === void 0 ? {} : { stateDir: options.stateDir }
|
|
5083
5141
|
};
|
|
@@ -5103,8 +5161,11 @@ var WikiGraphSDK = class {
|
|
|
5103
5161
|
}
|
|
5104
5162
|
return await operation();
|
|
5105
5163
|
});
|
|
5106
|
-
const result =
|
|
5107
|
-
|
|
5164
|
+
const result = await withWikiGraphSDKHost(
|
|
5165
|
+
{
|
|
5166
|
+
...this.#context.host === void 0 ? {} : { host: this.#context.host },
|
|
5167
|
+
...this.#context.stateDir === void 0 ? {} : { stateDir: this.#context.stateDir }
|
|
5168
|
+
},
|
|
5108
5169
|
runWithContext
|
|
5109
5170
|
);
|
|
5110
5171
|
throwIfAborted2(signal);
|
|
@@ -5132,8 +5193,12 @@ import {
|
|
|
5132
5193
|
formatLocatedChapterSourceCollectionUri,
|
|
5133
5194
|
formatLocatedChapterUri as formatLocatedChapterUri3,
|
|
5134
5195
|
formatLocatedWikiGraphUri as formatLocatedWikiGraphUri3,
|
|
5196
|
+
formatSourceArtifactUri,
|
|
5197
|
+
formatSourceLocatorFragment,
|
|
5135
5198
|
formatWikiGraphCommandUri,
|
|
5136
5199
|
formatWikiGraphLibraryUri as formatWikiGraphLibraryUri3,
|
|
5200
|
+
isWikiGraphJobUri,
|
|
5201
|
+
isWikiGraphUri,
|
|
5137
5202
|
isSourceLocatorScopeUri as isSourceLocatorScopeUri2,
|
|
5138
5203
|
isWikiGraphLibraryUri,
|
|
5139
5204
|
parseChapterPath,
|
|
@@ -5141,8 +5206,12 @@ import {
|
|
|
5141
5206
|
parseChapterUriPath,
|
|
5142
5207
|
parseLocatedWikiGraphUri as parseLocatedWikiGraphUri3,
|
|
5143
5208
|
parseSourceTextJsonl,
|
|
5209
|
+
parseSourceLocatorFragment,
|
|
5144
5210
|
parseWikiGraphLibraryUri as parseWikiGraphLibraryUri4,
|
|
5145
|
-
parseWikiGraphUriSyntax
|
|
5211
|
+
parseWikiGraphUriSyntax,
|
|
5212
|
+
requireArchiveUri,
|
|
5213
|
+
requireLocatedObjectOrArchiveUri,
|
|
5214
|
+
requireLocatedObjectUri
|
|
5146
5215
|
} from "wiki-graph-core";
|
|
5147
5216
|
export {
|
|
5148
5217
|
DANGEROUS_RUNTIME_ENV_NAMES,
|
|
@@ -5175,6 +5244,7 @@ export {
|
|
|
5175
5244
|
createEntryRuntimeContext,
|
|
5176
5245
|
createGenerationPerformanceHints,
|
|
5177
5246
|
createNodeTemplateEnvironment,
|
|
5247
|
+
createNodeWikiGraphPlatform,
|
|
5178
5248
|
createNodeWikiGraphStorage,
|
|
5179
5249
|
createStageLLM,
|
|
5180
5250
|
createWikiGraphSDK,
|
|
@@ -5189,6 +5259,8 @@ export {
|
|
|
5189
5259
|
formatLocatedChapterSourceCollectionUri,
|
|
5190
5260
|
formatLocatedChapterUri3 as formatLocatedChapterUri,
|
|
5191
5261
|
formatLocatedWikiGraphUri3 as formatLocatedWikiGraphUri,
|
|
5262
|
+
formatSourceArtifactUri,
|
|
5263
|
+
formatSourceLocatorFragment,
|
|
5192
5264
|
formatWikiGraphCommandUri,
|
|
5193
5265
|
formatWikiGraphLibraryUri3 as formatWikiGraphLibraryUri,
|
|
5194
5266
|
getNodeResourcePath,
|
|
@@ -5198,7 +5270,9 @@ export {
|
|
|
5198
5270
|
inspectWikiGraphArchive,
|
|
5199
5271
|
installNodeWikiGraphPlatform,
|
|
5200
5272
|
isSourceLocatorScopeUri2 as isSourceLocatorScopeUri,
|
|
5273
|
+
isWikiGraphJobUri,
|
|
5201
5274
|
isWikiGraphLibraryUri,
|
|
5275
|
+
isWikiGraphUri,
|
|
5202
5276
|
loadRequiredStageConfig,
|
|
5203
5277
|
loadWikiGraphRuntimeConfig,
|
|
5204
5278
|
maskLocalConfigSection,
|
|
@@ -5210,6 +5284,7 @@ export {
|
|
|
5210
5284
|
parseChapterUriPath,
|
|
5211
5285
|
parseLocalConfigSection,
|
|
5212
5286
|
parseLocatedWikiGraphUri3 as parseLocatedWikiGraphUri,
|
|
5287
|
+
parseSourceLocatorFragment,
|
|
5213
5288
|
parseSourceTextJsonl,
|
|
5214
5289
|
parseWikiGraphLibraryUri4 as parseWikiGraphLibraryUri,
|
|
5215
5290
|
parseWikiGraphUriSyntax,
|
|
@@ -5218,7 +5293,10 @@ export {
|
|
|
5218
5293
|
readLocalConfigSection,
|
|
5219
5294
|
readWikiGraphEmbeddingConfig,
|
|
5220
5295
|
replaceLocalConfigSection,
|
|
5296
|
+
requireArchiveUri,
|
|
5221
5297
|
requireKnowledgeGraphWikispineConfig,
|
|
5298
|
+
requireLocatedObjectOrArchiveUri,
|
|
5299
|
+
requireLocatedObjectUri,
|
|
5222
5300
|
resolveExtractionPrompt,
|
|
5223
5301
|
resolveHostedProviderEndpoint,
|
|
5224
5302
|
resolveKnowledgeGraphRecallPrompt,
|