@botbotgo/agent-harness 0.0.298 → 0.0.299

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.
Files changed (166) hide show
  1. package/README.md +77 -37
  2. package/README.zh.md +79 -30
  3. package/dist/acp.d.ts +3 -0
  4. package/dist/acp.js +10 -2
  5. package/dist/api.d.ts +14 -2
  6. package/dist/api.js +19 -3
  7. package/dist/cli.d.ts +18 -1
  8. package/dist/cli.js +1408 -319
  9. package/dist/client/acp.d.ts +9 -3
  10. package/dist/client/acp.js +55 -1
  11. package/dist/client/in-process.d.ts +5 -2
  12. package/dist/client/in-process.js +4 -6
  13. package/dist/client/index.d.ts +1 -1
  14. package/dist/client/types.d.ts +6 -5
  15. package/dist/config/agents/direct.yaml +7 -17
  16. package/dist/config/agents/orchestra.yaml +9 -65
  17. package/dist/config/catalogs/embedding-models.yaml +1 -1
  18. package/dist/config/catalogs/stores.yaml +1 -1
  19. package/dist/config/knowledge/knowledge-runtime.yaml +36 -2
  20. package/dist/config/knowledge/procedural-memory-runtime.yaml +78 -0
  21. package/dist/config/{catalogs/models.yaml → models.yaml} +2 -2
  22. package/dist/config/prompts/direct-system.md +16 -0
  23. package/dist/config/prompts/orchestra-system.md +62 -0
  24. package/dist/config/prompts/routing-system.md +14 -0
  25. package/dist/config/runtime/runtime-memory.yaml +39 -5
  26. package/dist/config/runtime/workspace.yaml +7 -16
  27. package/dist/contracts/runtime.d.ts +242 -1
  28. package/dist/contracts/workspace.d.ts +2 -0
  29. package/dist/index.d.ts +5 -3
  30. package/dist/index.js +2 -1
  31. package/dist/init-project.js +178 -33
  32. package/dist/knowledge/contracts.d.ts +5 -0
  33. package/dist/knowledge/module.d.ts +5 -0
  34. package/dist/knowledge/module.js +340 -18
  35. package/dist/package-version.d.ts +1 -1
  36. package/dist/package-version.js +1 -1
  37. package/dist/persistence/file-store.d.ts +5 -1
  38. package/dist/persistence/file-store.js +16 -0
  39. package/dist/persistence/sqlite-store.d.ts +4 -1
  40. package/dist/persistence/sqlite-store.js +88 -14
  41. package/dist/persistence/types.d.ts +4 -1
  42. package/dist/procedural/config.d.ts +63 -0
  43. package/dist/procedural/config.js +125 -0
  44. package/dist/procedural/index.d.ts +2 -0
  45. package/dist/procedural/index.js +1 -0
  46. package/dist/protocol/ag-ui/http.d.ts +3 -0
  47. package/dist/protocol/ag-ui/http.js +10 -0
  48. package/dist/request-events.d.ts +63 -0
  49. package/dist/request-events.js +400 -0
  50. package/dist/resource/isolation.js +11 -0
  51. package/dist/resource/resource-impl.d.ts +1 -0
  52. package/dist/resource/resource-impl.js +103 -12
  53. package/dist/resources/init-templates/agent-context/deep-research.md +5 -0
  54. package/dist/resources/init-templates/prompts/research-analyst-basic.md +1 -0
  55. package/dist/resources/init-templates/prompts/research-analyst-web-search.md +1 -0
  56. package/dist/resources/init-templates/prompts/research-host-deep-research-basic.md +1 -0
  57. package/dist/resources/init-templates/prompts/research-host-deep-research-web-search.md +1 -0
  58. package/dist/resources/init-templates/prompts/research-host-single-agent-basic.md +1 -0
  59. package/dist/resources/init-templates/prompts/research-host-single-agent-web-search.md +1 -0
  60. package/dist/resources/prompts/runtime/browser-capability-disclaimer-recovery.md +1 -0
  61. package/dist/resources/prompts/runtime/default-subagent.md +2 -0
  62. package/dist/resources/prompts/runtime/durable-memory-context.md +7 -0
  63. package/dist/resources/prompts/runtime/execution-with-tool-evidence-retry.md +1 -0
  64. package/dist/resources/prompts/runtime/execution-with-tool-evidence.md +1 -0
  65. package/dist/resources/prompts/runtime/invalid-tool-selection-recovery.md +1 -0
  66. package/dist/resources/prompts/runtime/memory-manager.md +31 -0
  67. package/dist/resources/prompts/runtime/memory-mutation-reconciliation.md +22 -0
  68. package/dist/resources/prompts/runtime/slash-command-skill.md +6 -0
  69. package/dist/resources/prompts/runtime/strict-tool-json.md +1 -0
  70. package/dist/resources/prompts/runtime/workspace-boundary-guidance.md +3 -0
  71. package/dist/resources/prompts/runtime/workspace-relative-path.md +1 -0
  72. package/dist/resources/prompts/runtime/write-todos-descriptive-content.md +1 -0
  73. package/dist/resources/prompts/runtime/write-todos-full-entry.md +1 -0
  74. package/dist/resources/prompts/runtime/write-todos-non-empty-initial-list.md +1 -0
  75. package/dist/resources/tools/_runtime_tool_helpers.mjs +152 -0
  76. package/dist/resources/tools/cancel_request.mjs +21 -0
  77. package/dist/resources/tools/fetch_url.mjs +23 -0
  78. package/dist/resources/tools/http_request.mjs +30 -0
  79. package/dist/resources/tools/inspect_approvals.mjs +27 -0
  80. package/dist/resources/tools/inspect_artifacts.mjs +21 -0
  81. package/dist/resources/tools/inspect_events.mjs +21 -0
  82. package/dist/resources/tools/inspect_requests.mjs +27 -0
  83. package/dist/resources/tools/inspect_sessions.mjs +21 -0
  84. package/dist/resources/tools/list_files.mjs +27 -0
  85. package/dist/resources/tools/read_artifact.mjs +22 -0
  86. package/dist/resources/tools/request_approval.mjs +27 -0
  87. package/dist/resources/tools/run_command.mjs +21 -0
  88. package/dist/resources/tools/schedule_task.mjs +76 -0
  89. package/dist/resources/tools/search_files.mjs +47 -0
  90. package/dist/resources/tools/send_message.mjs +23 -0
  91. package/dist/runtime/adapter/direct-builtin-utility.d.ts +1 -0
  92. package/dist/runtime/adapter/direct-builtin-utility.js +90 -0
  93. package/dist/runtime/adapter/flow/execution-context.d.ts +1 -1
  94. package/dist/runtime/adapter/flow/execution-context.js +1 -1
  95. package/dist/runtime/adapter/flow/invocation-flow.d.ts +1 -0
  96. package/dist/runtime/adapter/flow/invocation-flow.js +9 -1
  97. package/dist/runtime/adapter/flow/invoke-runtime.d.ts +1 -1
  98. package/dist/runtime/adapter/flow/stream-runtime.d.ts +5 -1
  99. package/dist/runtime/adapter/flow/stream-runtime.js +556 -35
  100. package/dist/runtime/adapter/invocation-result.js +3 -2
  101. package/dist/runtime/adapter/local-tool-invocation.d.ts +1 -1
  102. package/dist/runtime/adapter/local-tool-invocation.js +28 -4
  103. package/dist/runtime/adapter/middleware-assembly.js +3 -1
  104. package/dist/runtime/adapter/model/invocation-request.d.ts +4 -1
  105. package/dist/runtime/adapter/model/invocation-request.js +138 -16
  106. package/dist/runtime/adapter/model/message-assembly.js +2 -6
  107. package/dist/runtime/adapter/model/model-providers.js +103 -5
  108. package/dist/runtime/adapter/resilience.js +17 -2
  109. package/dist/runtime/adapter/runtime-adapter-support.d.ts +11 -7
  110. package/dist/runtime/adapter/runtime-adapter-support.js +39 -5
  111. package/dist/runtime/adapter/tool/builtin-middleware-tools.d.ts +63 -1
  112. package/dist/runtime/adapter/tool/builtin-middleware-tools.js +193 -21
  113. package/dist/runtime/adapter/tool/tool-arguments.d.ts +3 -1
  114. package/dist/runtime/adapter/tool/tool-arguments.js +52 -17
  115. package/dist/runtime/adapter/tool-resolution.d.ts +1 -0
  116. package/dist/runtime/adapter/tool-resolution.js +4 -2
  117. package/dist/runtime/agent-runtime-adapter.d.ts +27 -0
  118. package/dist/runtime/agent-runtime-adapter.js +163 -11
  119. package/dist/runtime/harness/events/event-bus.d.ts +1 -0
  120. package/dist/runtime/harness/events/event-bus.js +3 -0
  121. package/dist/runtime/harness/events/event-sink.d.ts +3 -0
  122. package/dist/runtime/harness/events/event-sink.js +16 -7
  123. package/dist/runtime/harness/events/streaming.d.ts +18 -1
  124. package/dist/runtime/harness/events/streaming.js +23 -10
  125. package/dist/runtime/harness/run/inspection.js +26 -5
  126. package/dist/runtime/harness/run/stream-run.d.ts +13 -4
  127. package/dist/runtime/harness/run/stream-run.js +448 -4
  128. package/dist/runtime/harness/run/surface-semantics.js +7 -34
  129. package/dist/runtime/harness/system/runtime-memory-manager.d.ts +3 -0
  130. package/dist/runtime/harness/system/runtime-memory-manager.js +384 -69
  131. package/dist/runtime/harness/system/runtime-memory-policy.d.ts +20 -1
  132. package/dist/runtime/harness/system/runtime-memory-policy.js +65 -17
  133. package/dist/runtime/harness/system/runtime-memory-records.js +100 -0
  134. package/dist/runtime/harness/system/runtime-memory-sync.js +2 -2
  135. package/dist/runtime/harness/system/store.d.ts +4 -0
  136. package/dist/runtime/harness/system/store.js +153 -0
  137. package/dist/runtime/harness.d.ts +9 -1
  138. package/dist/runtime/harness.js +141 -7
  139. package/dist/runtime/maintenance/sqlite-checkpoint-saver.d.ts +8 -3
  140. package/dist/runtime/maintenance/sqlite-checkpoint-saver.js +152 -53
  141. package/dist/runtime/parsing/output-parsing.d.ts +10 -2
  142. package/dist/runtime/parsing/output-parsing.js +223 -16
  143. package/dist/runtime/parsing/stream-event-parsing.d.ts +7 -0
  144. package/dist/runtime/parsing/stream-event-parsing.js +51 -1
  145. package/dist/runtime/scheduling/system-schedule-manager.d.ts +41 -0
  146. package/dist/runtime/scheduling/system-schedule-manager.js +532 -0
  147. package/dist/runtime/support/embedding-models.d.ts +1 -1
  148. package/dist/runtime/support/embedding-models.js +5 -2
  149. package/dist/runtime/support/runtime-factories.js +1 -1
  150. package/dist/runtime/support/runtime-layout.d.ts +3 -0
  151. package/dist/runtime/support/runtime-layout.js +10 -1
  152. package/dist/runtime/support/runtime-prompts.d.ts +30 -0
  153. package/dist/runtime/support/runtime-prompts.js +55 -0
  154. package/dist/runtime/support/vector-stores.d.ts +1 -1
  155. package/dist/runtime/support/vector-stores.js +5 -2
  156. package/dist/upstream-events.js +8 -7
  157. package/dist/utils/bundled-text.d.ts +3 -0
  158. package/dist/utils/bundled-text.js +25 -0
  159. package/dist/utils/id.js +3 -2
  160. package/dist/workspace/agent-binding-compiler.js +53 -13
  161. package/dist/workspace/object-loader.js +64 -2
  162. package/dist/workspace/support/workspace-ref-utils.d.ts +2 -1
  163. package/dist/workspace/support/workspace-ref-utils.js +24 -5
  164. package/dist/workspace/yaml-object-reader.d.ts +1 -0
  165. package/dist/workspace/yaml-object-reader.js +95 -17
  166. package/package.json +11 -5
@@ -1,29 +1,103 @@
1
1
  import path from "node:path";
2
+ import { existsSync, readFileSync } from "node:fs";
2
3
  import { readdir } from "node:fs/promises";
3
4
  import { parseAllDocuments } from "yaml";
4
5
  import { fileExists, listFilesRecursive, readYamlOrJson } from "../utils/fs.js";
5
- const ENV_PLACEHOLDER_PATTERN = /\$\{env:([A-Za-z_][A-Za-z0-9_]*)\}/g;
6
+ const ENV_PLACEHOLDER_PATTERN = /\$\{env:([A-Za-z_][A-Za-z0-9_]*)(?::-(.*?))?\}/g;
7
+ const DOTENV_LINE_PATTERN = /^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)?\s*$/;
6
8
  function asObject(value) {
7
9
  return typeof value === "object" && value ? value : undefined;
8
10
  }
9
- function interpolateEnvString(value, sourcePath) {
10
- return value.replaceAll(ENV_PLACEHOLDER_PATTERN, (_match, envName) => {
11
- const resolved = process.env[envName];
11
+ function stripMatchingQuotes(value) {
12
+ const trimmed = value.trim();
13
+ if (trimmed.length >= 2 &&
14
+ ((trimmed.startsWith("\"") && trimmed.endsWith("\"")) || (trimmed.startsWith("'") && trimmed.endsWith("'")))) {
15
+ return trimmed.slice(1, -1);
16
+ }
17
+ return trimmed;
18
+ }
19
+ function parseDotenvFile(content) {
20
+ const parsed = {};
21
+ for (const rawLine of content.split(/\r?\n/u)) {
22
+ const line = rawLine.trim();
23
+ if (!line || line.startsWith("#")) {
24
+ continue;
25
+ }
26
+ const match = DOTENV_LINE_PATTERN.exec(rawLine);
27
+ if (!match) {
28
+ continue;
29
+ }
30
+ const [, key, rawValue = ""] = match;
31
+ parsed[key] = stripMatchingQuotes(rawValue);
32
+ }
33
+ return parsed;
34
+ }
35
+ function readNearestDotenvSync(startDirectory) {
36
+ const normalizedStart = path.resolve(startDirectory);
37
+ let current = normalizedStart;
38
+ while (true) {
39
+ const dotenvPath = path.join(current, ".env");
40
+ if (existsSync(dotenvPath)) {
41
+ return Object.freeze(parseDotenvFile(readFileSync(dotenvPath, "utf8")));
42
+ }
43
+ const parent = path.dirname(current);
44
+ if (parent === current) {
45
+ break;
46
+ }
47
+ current = parent;
48
+ }
49
+ return Object.freeze({});
50
+ }
51
+ function resolveInterpolationEnv(sourcePath, envOverrides) {
52
+ const merged = { ...readNearestDotenvSync(path.dirname(sourcePath)) };
53
+ for (const [key, value] of Object.entries(process.env)) {
54
+ if (typeof value === "string") {
55
+ merged[key] = value;
56
+ }
57
+ }
58
+ if (envOverrides) {
59
+ for (const [key, value] of Object.entries(envOverrides)) {
60
+ if (typeof value === "string") {
61
+ merged[key] = value;
62
+ }
63
+ else {
64
+ delete merged[key];
65
+ }
66
+ }
67
+ }
68
+ return merged;
69
+ }
70
+ function interpolateEnvString(value, sourcePath, envValues) {
71
+ return value.replaceAll(ENV_PLACEHOLDER_PATTERN, (_match, envName, defaultValue) => {
72
+ const resolved = envValues[envName];
73
+ if (typeof resolved === "string" && resolved.length > 0) {
74
+ return resolved;
75
+ }
76
+ if (typeof defaultValue === "string") {
77
+ return defaultValue;
78
+ }
12
79
  if (typeof resolved !== "string" || resolved.length === 0) {
13
80
  throw new Error(`YAML document ${sourcePath} references missing environment variable ${envName}`);
14
81
  }
15
82
  return resolved;
16
83
  });
17
84
  }
18
- function interpolateEnvPlaceholders(value, sourcePath) {
85
+ export function interpolateEnvPlaceholders(value, sourcePath, envOverrides) {
86
+ const envValues = resolveInterpolationEnv(sourcePath, envOverrides);
87
+ return interpolateEnvPlaceholdersWithEnv(value, sourcePath, envValues);
88
+ }
89
+ function interpolateEnvPlaceholdersWithEnv(value, sourcePath, envValues) {
19
90
  if (typeof value === "string") {
20
- return interpolateEnvString(value, sourcePath);
91
+ return interpolateEnvString(value, sourcePath, envValues);
21
92
  }
22
93
  if (Array.isArray(value)) {
23
- return value.map((entry) => interpolateEnvPlaceholders(entry, sourcePath));
94
+ return value.map((entry) => interpolateEnvPlaceholdersWithEnv(entry, sourcePath, envValues));
24
95
  }
25
96
  if (typeof value === "object" && value !== null) {
26
- return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, interpolateEnvPlaceholders(entry, sourcePath)]));
97
+ return Object.fromEntries(Object.entries(value).map(([key, entry]) => [
98
+ key,
99
+ interpolateEnvPlaceholdersWithEnv(entry, sourcePath, envValues),
100
+ ]));
27
101
  }
28
102
  return value;
29
103
  }
@@ -95,6 +169,8 @@ function normalizeKind(kind) {
95
169
  return "runtime";
96
170
  case "RuntimeMemory":
97
171
  return "runtime-memory";
172
+ case "ProceduralMemoryRuntime":
173
+ return "procedural-memory";
98
174
  case "Prompt":
99
175
  return "prompt";
100
176
  case "McpServer":
@@ -141,15 +217,17 @@ async function objectItemsFromDocument(document, sourcePath) {
141
217
  ? normalizeCatalogSpec(document, { defaultKind: "Model" })
142
218
  : catalogKind === "EmbeddingModels"
143
219
  ? normalizeCatalogSpec(document, { defaultKind: "EmbeddingModel" })
144
- : catalogKind === "Stores"
145
- ? normalizeCatalogSpec(document)
146
- : catalogKind === "Backends"
147
- ? normalizeCatalogSpec(document, { defaultKind: "Backend" })
148
- : catalogKind === "Tools" || catalogKind === "ToolSets"
149
- ? normalizeCatalogSpec(document, { defaultKind: "Tool" })
150
- : catalogKind === "McpServers"
151
- ? normalizeCatalogSpec(document, { defaultKind: "McpServer" })
152
- : [];
220
+ : catalogKind === "VectorStores"
221
+ ? normalizeCatalogSpec(document, { defaultKind: "VectorStore" })
222
+ : catalogKind === "Stores"
223
+ ? normalizeCatalogSpec(document)
224
+ : catalogKind === "Backends"
225
+ ? normalizeCatalogSpec(document, { defaultKind: "Backend" })
226
+ : catalogKind === "Tools" || catalogKind === "ToolSets"
227
+ ? normalizeCatalogSpec(document, { defaultKind: "Tool" })
228
+ : catalogKind === "McpServers"
229
+ ? normalizeCatalogSpec(document, { defaultKind: "McpServer" })
230
+ : [];
153
231
  if (catalogItems.length > 0) {
154
232
  return catalogItems;
155
233
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botbotgo/agent-harness",
3
- "version": "0.0.298",
3
+ "version": "0.0.299",
4
4
  "description": "Workspace runtime for multi-agent applications",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -8,7 +8,8 @@
8
8
  "main": "./dist/index.js",
9
9
  "types": "./dist/index.d.ts",
10
10
  "bin": {
11
- "agent-harness": "./dist/cli.js"
11
+ "agent-harness": "./dist/cli.js",
12
+ "botbotgo": "./dist/cli.js"
12
13
  },
13
14
  "files": [
14
15
  "dist"
@@ -68,11 +69,16 @@
68
69
  "scripts": {
69
70
  "agent-harness": "npm run build --silent && node dist/cli.js",
70
71
  "chat": "npm run build --silent && node dist/cli.js chat",
71
- "build": "rm -rf dist tsconfig.tsbuildinfo && tsc -p tsconfig.json && cp -R config resources dist/",
72
+ "build": "rm -rf dist tsconfig.tsbuildinfo && tsc -p tsconfig.json && cp -R config resources dist/ && chmod +x dist/cli.js",
72
73
  "check": "tsc -p tsconfig.json --noEmit",
73
74
  "test": "vitest run $(find test -name '*.test.ts' -print | sort)",
75
+ "test:ci:runtime": "node ./scripts/run-vitest-suite.mjs ci-runtime",
76
+ "test:ci:public-api": "node ./scripts/run-vitest-suite.mjs ci-public-api",
77
+ "test:ci:docs-examples": "node ./scripts/run-vitest-suite.mjs ci-docs-examples",
78
+ "test:release": "node ./scripts/run-vitest-suite.mjs release",
79
+ "test:providers": "node ./scripts/run-vitest-suite.mjs providers",
74
80
  "test:upstream-ab-real": "vitest run test/benchmark/upstream-runtime-ab-real.test.ts",
75
- "test:real-providers": "vitest run test/providers/real-provider-harness.test.ts",
81
+ "test:real-providers": "npm run test:providers",
76
82
  "security:ci": "npm audit --omit=dev --audit-level=high",
77
83
  "security:report": "npm audit --omit=dev --json > security-audit-report.json || true",
78
84
  "docs:sync-dev-nav": "node ./scripts/sync-developer-docs-nav.mjs",
@@ -86,7 +92,7 @@
86
92
  "@types/node": "^25.5.2",
87
93
  "typescript": "^6.0.2",
88
94
  "vite": "^7.3.2",
89
- "vitest": "^3.2.4"
95
+ "vitest": "^4.1.4"
90
96
  },
91
97
  "overrides": {
92
98
  "axios": "^1.15.0",