@botbotgo/agent-harness 0.0.281 → 0.0.283
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 +20 -9
- package/README.zh.md +20 -9
- package/dist/config/catalogs/stores.yaml +1 -1
- package/dist/config/catalogs/vector-stores.yaml +1 -1
- package/dist/config/knowledge/knowledge-runtime.yaml +60 -0
- package/dist/config/runtime/runtime-memory.yaml +3 -3
- package/dist/contracts/runtime.d.ts +9 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/init-project.js +50 -4
- package/dist/knowledge/config.d.ts +11 -0
- package/dist/knowledge/config.js +32 -0
- package/dist/knowledge/contracts.d.ts +45 -0
- package/dist/knowledge/contracts.js +1 -0
- package/dist/knowledge/index.d.ts +4 -0
- package/dist/knowledge/index.js +2 -0
- package/dist/knowledge/module.d.ts +21 -0
- package/dist/knowledge/module.js +594 -0
- package/dist/package-version.d.ts +1 -1
- package/dist/package-version.js +1 -1
- package/dist/persistence/file-store.d.ts +1 -0
- package/dist/persistence/file-store.js +29 -25
- package/dist/persistence/sqlite-store.js +1 -1
- package/dist/runtime/harness/run/resources.js +4 -2
- package/dist/runtime/harness/system/runtime-memory-policy.js +1 -1
- package/dist/runtime/harness/system/runtime-memory-records.js +4 -0
- package/dist/runtime/harness/system/runtime-memory-sync.js +2 -2
- package/dist/runtime/harness/system/thread-memory-sync.js +1 -1
- package/dist/runtime/harness.d.ts +1 -16
- package/dist/runtime/harness.js +95 -613
- package/dist/runtime/maintenance/checkpoint-maintenance.js +2 -1
- package/dist/runtime/maintenance/runtime-record-maintenance.js +2 -1
- package/dist/runtime/support/llamaindex.js +1 -1
- package/dist/runtime/support/runtime-factories.js +6 -3
- package/dist/runtime/support/runtime-layout.d.ts +6 -0
- package/dist/runtime/support/runtime-layout.js +19 -0
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { fileExists } from "../../utils/fs.js";
|
|
3
|
+
import { resolveRuntimeCheckpointerPath } from "../support/runtime-layout.js";
|
|
3
4
|
import { getRuntimeDefaults } from "../../workspace/support/workspace-ref-utils.js";
|
|
4
5
|
function asObject(value) {
|
|
5
6
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : undefined;
|
|
@@ -52,7 +53,7 @@ function resolveSqliteCheckpointPath(binding) {
|
|
|
52
53
|
if (kind !== "SqliteSaver") {
|
|
53
54
|
return null;
|
|
54
55
|
}
|
|
55
|
-
const configuredPath = typeof config.path === "string" ? String(config.path) : "checkpoints.sqlite";
|
|
56
|
+
const configuredPath = typeof config.path === "string" ? String(config.path) : resolveRuntimeCheckpointerPath(binding.harnessRuntime.runRoot, "checkpoints.sqlite");
|
|
56
57
|
return path.isAbsolute(configuredPath) ? configuredPath : path.join(binding.harnessRuntime.runRoot, configuredPath);
|
|
57
58
|
}
|
|
58
59
|
export function discoverCheckpointMaintenanceTargets(workspace) {
|
|
@@ -2,6 +2,7 @@ import path from "node:path";
|
|
|
2
2
|
import { rm } from "node:fs/promises";
|
|
3
3
|
import { createClient } from "@libsql/client";
|
|
4
4
|
import { fileExists } from "../../utils/fs.js";
|
|
5
|
+
import { resolveRuntimeSqlitePath } from "../support/runtime-layout.js";
|
|
5
6
|
import { getRuntimeDefaults } from "../../workspace/support/workspace-ref-utils.js";
|
|
6
7
|
function asObject(value) {
|
|
7
8
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : undefined;
|
|
@@ -50,7 +51,7 @@ export function discoverRuntimeRecordMaintenanceTargets(workspace) {
|
|
|
50
51
|
runRoots.add(binding.harnessRuntime.runRoot);
|
|
51
52
|
}
|
|
52
53
|
return Array.from(runRoots.values()).map((runRoot) => ({
|
|
53
|
-
dbPath:
|
|
54
|
+
dbPath: resolveRuntimeSqlitePath(runRoot),
|
|
54
55
|
}));
|
|
55
56
|
}
|
|
56
57
|
export async function maintainSqliteRuntimeRecords(dbPath, config, nowMs = Date.now()) {
|
|
@@ -42,7 +42,7 @@ export function createLlamaIndexEmbeddingModel(embeddingModel) {
|
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
export async function createLlamaIndexVectorStore(workspaceRoot, vectorStore, embeddings) {
|
|
45
|
-
const persistPath = resolveFilePath(vectorStore.url ?? ".agent/
|
|
45
|
+
const persistPath = resolveFilePath(vectorStore.url ?? ".agent/knowledge/vectors.json", workspaceRoot);
|
|
46
46
|
await mkdir(path.dirname(persistPath), { recursive: true });
|
|
47
47
|
const emptyStore = () => SimpleVectorStore.fromDict({
|
|
48
48
|
embeddingDict: {},
|
|
@@ -2,15 +2,16 @@ import path from "node:path";
|
|
|
2
2
|
import { MemorySaver } from "@langchain/langgraph";
|
|
3
3
|
import { FileCheckpointSaver } from "../maintenance/file-checkpoint-saver.js";
|
|
4
4
|
import { createInMemoryStore, FileBackedStore, SqliteBackedStore } from "../harness/system/store.js";
|
|
5
|
+
import { resolveKnowledgeFileStorePath, resolveKnowledgeStorePath, resolveRuntimeCheckpointerPath, } from "./runtime-layout.js";
|
|
5
6
|
export function createStoreForConfig(storeConfig, runRoot) {
|
|
6
7
|
const kind = typeof storeConfig.kind === "string" ? storeConfig.kind : "FileStore";
|
|
7
8
|
switch (kind) {
|
|
8
9
|
case "FileStore": {
|
|
9
|
-
const configuredPath = typeof storeConfig.path === "string" ? storeConfig.path : "
|
|
10
|
+
const configuredPath = typeof storeConfig.path === "string" ? storeConfig.path : resolveKnowledgeFileStorePath(runRoot, "records.json");
|
|
10
11
|
return new FileBackedStore(path.isAbsolute(configuredPath) ? configuredPath : path.join(runRoot, configuredPath));
|
|
11
12
|
}
|
|
12
13
|
case "SqliteStore": {
|
|
13
|
-
const configuredPath = typeof storeConfig.path === "string" ? storeConfig.path : "
|
|
14
|
+
const configuredPath = typeof storeConfig.path === "string" ? storeConfig.path : resolveKnowledgeStorePath(runRoot, "records.sqlite");
|
|
14
15
|
return new SqliteBackedStore(path.isAbsolute(configuredPath) ? configuredPath : path.join(runRoot, configuredPath));
|
|
15
16
|
}
|
|
16
17
|
case "InMemoryStore":
|
|
@@ -34,7 +35,9 @@ export function createCheckpointerForConfig(checkpointerConfig, runRoot) {
|
|
|
34
35
|
case "SqliteSaver":
|
|
35
36
|
throw new Error("Checkpointer kind SqliteSaver is not supported in this runtime right now");
|
|
36
37
|
case "FileCheckpointer": {
|
|
37
|
-
const configuredPath = typeof checkpointerConfig.path === "string"
|
|
38
|
+
const configuredPath = typeof checkpointerConfig.path === "string"
|
|
39
|
+
? String(checkpointerConfig.path)
|
|
40
|
+
: resolveRuntimeCheckpointerPath(runRoot, "checkpoints.json");
|
|
38
41
|
return new FileCheckpointSaver(path.isAbsolute(configuredPath) ? configuredPath : path.join(runRoot, configuredPath));
|
|
39
42
|
}
|
|
40
43
|
default:
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function resolveRuntimeArtifactsRoot(runRoot: string): string;
|
|
2
|
+
export declare function resolveRuntimeSqlitePath(runRoot: string): string;
|
|
3
|
+
export declare function resolveRuntimeCheckpointerPath(runRoot: string, fileName?: string): string;
|
|
4
|
+
export declare function resolveKnowledgeRoot(runRoot: string): string;
|
|
5
|
+
export declare function resolveKnowledgeStorePath(runRoot: string, fileName?: string): string;
|
|
6
|
+
export declare function resolveKnowledgeFileStorePath(runRoot: string, fileName?: string): string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
export function resolveRuntimeArtifactsRoot(runRoot) {
|
|
3
|
+
return path.join(runRoot, "artifacts");
|
|
4
|
+
}
|
|
5
|
+
export function resolveRuntimeSqlitePath(runRoot) {
|
|
6
|
+
return path.join(runRoot, "runtime.sqlite");
|
|
7
|
+
}
|
|
8
|
+
export function resolveRuntimeCheckpointerPath(runRoot, fileName = "checkpoints.json") {
|
|
9
|
+
return path.join(runRoot, fileName);
|
|
10
|
+
}
|
|
11
|
+
export function resolveKnowledgeRoot(runRoot) {
|
|
12
|
+
return path.join(runRoot, "knowledge");
|
|
13
|
+
}
|
|
14
|
+
export function resolveKnowledgeStorePath(runRoot, fileName = "records.sqlite") {
|
|
15
|
+
return path.join(resolveKnowledgeRoot(runRoot), fileName);
|
|
16
|
+
}
|
|
17
|
+
export function resolveKnowledgeFileStorePath(runRoot, fileName = "records.json") {
|
|
18
|
+
return path.join(resolveKnowledgeRoot(runRoot), fileName);
|
|
19
|
+
}
|