wiki-graph-sdk 0.8.2 → 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -3
- package/dist/archives.cjs +18 -19
- package/dist/archives.cjs.map +1 -1
- package/dist/archives.js +6 -7
- package/dist/archives.js.map +1 -1
- package/dist/conversions.cjs +11 -12
- package/dist/conversions.cjs.map +1 -1
- package/dist/conversions.js +6 -7
- package/dist/conversions.js.map +1 -1
- package/dist/default-worker.cjs +40 -17
- package/dist/default-worker.cjs.map +1 -1
- package/dist/default-worker.js +37 -14
- package/dist/default-worker.js.map +1 -1
- package/dist/embedding.cjs +6 -7
- package/dist/embedding.cjs.map +1 -1
- package/dist/embedding.js +6 -7
- package/dist/embedding.js.map +1 -1
- package/dist/gc.cjs +61 -9
- package/dist/gc.cjs.map +1 -1
- package/dist/gc.d.ts +1 -1
- package/dist/gc.js +61 -9
- package/dist/gc.js.map +1 -1
- package/dist/host-IbqJ8WSV.d.ts +18 -0
- package/dist/index.cjs +48 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +36 -16
- package/dist/index.js.map +1 -1
- package/dist/local-config.cjs +6 -7
- package/dist/local-config.cjs.map +1 -1
- package/dist/local-config.js +6 -7
- package/dist/local-config.js.map +1 -1
- package/dist/maintenance.cjs.map +1 -1
- package/dist/maintenance.js.map +1 -1
- package/dist/runtime-config.cjs +6 -7
- package/dist/runtime-config.cjs.map +1 -1
- package/dist/runtime-config.js +6 -7
- package/dist/runtime-config.js.map +1 -1
- package/dist/stage.cjs +6 -7
- package/dist/stage.cjs.map +1 -1
- package/dist/stage.js +6 -7
- package/dist/stage.js.map +1 -1
- package/dist/worker.cjs +55 -31
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.d.ts +1 -1
- package/dist/worker.js +61 -37
- package/dist/worker.js.map +1 -1
- package/package.json +2 -2
- package/dist/host-pQiVAKEY.d.ts +0 -10
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export { WikiGraphConversionFormat, WikiGraphConversionInput, WikiGraphConversio
|
|
|
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-
|
|
16
|
+
import { W as WikiGraphSDKHost } from './host-IbqJ8WSV.js';
|
|
17
17
|
export { buildWikiGraphLLMOptions } from './llm.js';
|
|
18
18
|
import { WikiGraphMaintenanceManager } from './maintenance.js';
|
|
19
19
|
export { WikiGraphLegacyMigrationResult, WikiGraphMaintenanceTarget } from './maintenance.js';
|
package/dist/index.js
CHANGED
|
@@ -884,13 +884,15 @@ function getWikiGraphSDKRuntimeContext() {
|
|
|
884
884
|
};
|
|
885
885
|
}
|
|
886
886
|
function getWikiGraphSDKStateDir() {
|
|
887
|
-
|
|
887
|
+
const context = getWikiGraphSDKRuntimeContext();
|
|
888
|
+
return context.host?.stateDir ?? context.stateDir;
|
|
888
889
|
}
|
|
889
890
|
function getWikiGraphSDKProviders() {
|
|
890
891
|
return getWikiGraphSDKRuntimeContext().providers ?? {};
|
|
891
892
|
}
|
|
892
893
|
|
|
893
894
|
// src/local-config.ts
|
|
895
|
+
import { mkdir as mkdir2 } from "fs/promises";
|
|
894
896
|
import { join as join2 } from "path";
|
|
895
897
|
import { homedir as homedir2 } from "os";
|
|
896
898
|
var LOCAL_CONFIG_SECTIONS = [
|
|
@@ -991,13 +993,10 @@ function validateLocalConfigSection(section, value) {
|
|
|
991
993
|
}
|
|
992
994
|
}
|
|
993
995
|
async function withLocalConfigDatabase(operation) {
|
|
996
|
+
const stateDir = getWikiGraphSDKStateDir() ?? join2(homedir2(), ".wikigraph");
|
|
997
|
+
await mkdir2(stateDir, { recursive: true });
|
|
994
998
|
const database = await openSharedStateDatabase(
|
|
995
|
-
new NodeFile(
|
|
996
|
-
join2(
|
|
997
|
-
getWikiGraphSDKStateDir() ?? join2(homedir2(), ".wikigraph"),
|
|
998
|
-
"core.sqlite"
|
|
999
|
-
)
|
|
1000
|
-
),
|
|
999
|
+
new NodeFile(join2(stateDir, "core.sqlite")),
|
|
1001
1000
|
LOCAL_CONFIG_SCHEMA_SQL
|
|
1002
1001
|
);
|
|
1003
1002
|
try {
|
|
@@ -3622,19 +3621,40 @@ function prepareWikiGraphSDKHost(host) {
|
|
|
3622
3621
|
installWikiGraphPlatform2(host.platform);
|
|
3623
3622
|
}
|
|
3624
3623
|
function assertWikiGraphSDKHostOptions(options) {
|
|
3625
|
-
if (options.host?.storage !== void 0 && options.stateDir
|
|
3624
|
+
if (options.host?.storage !== void 0 && options.host.stateDir === void 0) {
|
|
3626
3625
|
throw new TypeError(
|
|
3627
|
-
"Wiki Graph SDK host.storage
|
|
3626
|
+
"Wiki Graph SDK host.storage requires host.stateDir so SDK configuration cannot fall back to the default user state directory."
|
|
3627
|
+
);
|
|
3628
|
+
}
|
|
3629
|
+
if (options.stateDir !== void 0 && (options.host?.stateDir !== void 0 || options.host?.storage !== void 0)) {
|
|
3630
|
+
throw new TypeError(
|
|
3631
|
+
"Wiki Graph SDK host state/storage and top-level stateDir cannot be used together. Put the state directory in host.stateDir when providing host.storage."
|
|
3628
3632
|
);
|
|
3629
3633
|
}
|
|
3630
3634
|
}
|
|
3631
3635
|
async function withWikiGraphSDKHost(options, operation) {
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
+
const current = getWikiGraphSDKRuntimeContext();
|
|
3637
|
+
const effective = {
|
|
3638
|
+
...options.host === void 0 ? current.host === void 0 ? {} : { host: current.host } : { host: options.host },
|
|
3639
|
+
...options.stateDir === void 0 ? current.stateDir === void 0 ? {} : { stateDir: current.stateDir } : { stateDir: options.stateDir }
|
|
3640
|
+
};
|
|
3641
|
+
assertWikiGraphSDKHostOptions(effective);
|
|
3642
|
+
prepareWikiGraphSDKHost(effective.host);
|
|
3643
|
+
const runWithContext = async () => await withWikiGraphSDKRuntimeContext(
|
|
3644
|
+
{
|
|
3645
|
+
...current,
|
|
3646
|
+
...effective.host === void 0 ? {} : { host: effective.host },
|
|
3647
|
+
...effective.stateDir === void 0 ? {} : { stateDir: effective.stateDir }
|
|
3648
|
+
},
|
|
3649
|
+
operation
|
|
3650
|
+
);
|
|
3651
|
+
if (effective.host?.storage !== void 0) {
|
|
3652
|
+
return await withWikiGraphStorage2(effective.host.storage, runWithContext);
|
|
3636
3653
|
}
|
|
3637
|
-
return await withNodeWikiGraphStorage(
|
|
3654
|
+
return await withNodeWikiGraphStorage(
|
|
3655
|
+
effective.host?.stateDir ?? effective.stateDir,
|
|
3656
|
+
runWithContext
|
|
3657
|
+
);
|
|
3638
3658
|
}
|
|
3639
3659
|
|
|
3640
3660
|
// src/worker.ts
|
|
@@ -4590,7 +4610,7 @@ import {
|
|
|
4590
4610
|
scanWikiGraphLibrary,
|
|
4591
4611
|
withWikiGraphLibraryLock
|
|
4592
4612
|
} from "wiki-graph-core";
|
|
4593
|
-
import { mkdir as
|
|
4613
|
+
import { mkdir as mkdir3 } from "fs/promises";
|
|
4594
4614
|
async function resolveQueryEmbeddingProvider(queryMode) {
|
|
4595
4615
|
if (queryMode === "fts") return void 0;
|
|
4596
4616
|
const provider = await createConfiguredEmbeddingProvider();
|
|
@@ -4609,7 +4629,7 @@ var WikiGraphLibraryManager = class {
|
|
|
4609
4629
|
async create(folder) {
|
|
4610
4630
|
const record = await this.#runtime.run(async () => {
|
|
4611
4631
|
const path = resolveWikiGraphRuntimePath(folder);
|
|
4612
|
-
await
|
|
4632
|
+
await mkdir3(path);
|
|
4613
4633
|
return await createWikiGraphLibrary({ folder: new NodeDirectory(path) });
|
|
4614
4634
|
});
|
|
4615
4635
|
return new WikiGraphLibrary(this.#runtime, record);
|