@botbotgo/agent-harness 0.0.474 → 0.0.476
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 +3 -1234
- package/README.zh.md +3 -1191
- package/dist/acp.js +1 -1
- package/dist/api.js +1 -404
- package/dist/benchmark/checkpoint-resume-cost-benchmark.js +1 -55
- package/dist/benchmark/deepagent-local-model-benchmark.js +2 -35
- package/dist/benchmark/upstream-runtime-ab-benchmark.js +1 -179
- package/dist/cli/chat-interactive.js +25 -244
- package/dist/cli/chat-rendering.js +6 -100
- package/dist/cli/chat-stream.js +23 -512
- package/dist/cli/chat-ui.js +21 -199
- package/dist/cli/chat-workspace.js +2 -210
- package/dist/cli/main.js +21 -428
- package/dist/cli/managed-service-commands.js +9 -63
- package/dist/cli/managed-service.js +2 -137
- package/dist/cli/options-init-chat.js +1 -108
- package/dist/cli/options-runtime.js +1 -158
- package/dist/cli/options-serve.js +1 -282
- package/dist/cli/options.js +2 -19
- package/dist/cli/process-guards.js +1 -139
- package/dist/cli/request-tree.js +7 -296
- package/dist/cli/runtime-commands.js +12 -258
- package/dist/cli/runtime-output.js +16 -155
- package/dist/cli/server-commands.js +16 -270
- package/dist/cli/workspace.js +1 -67
- package/dist/cli.js +1 -7
- package/dist/client/acp.js +1 -1
- package/dist/client/in-process.js +1 -67
- package/dist/client/index.js +1 -2
- package/dist/client/types.js +0 -1
- package/dist/client.js +1 -1
- package/dist/contracts/core.js +1 -1
- package/dist/contracts/runtime-evaluation.js +0 -1
- package/dist/contracts/runtime-memory.js +0 -1
- package/dist/contracts/runtime-observability.js +0 -1
- package/dist/contracts/runtime-requests.js +0 -1
- package/dist/contracts/runtime-scheduling.js +0 -1
- package/dist/contracts/runtime.js +1 -27
- package/dist/contracts/types.js +1 -3
- package/dist/contracts/workspace.js +0 -1
- package/dist/flow/build-flow-graph.js +1 -50
- package/dist/flow/export-mermaid.js +2 -464
- package/dist/flow/export-sequence-mermaid.js +2 -325
- package/dist/flow/flow-graph-normalization.js +1 -214
- package/dist/flow/flow-graph-runtime.js +1 -107
- package/dist/flow/flow-graph-upstream.js +1 -494
- package/dist/flow/index.js +1 -3
- package/dist/flow/types.js +0 -1
- package/dist/index.js +1 -5
- package/dist/init-project.js +1 -1
- package/dist/knowledge/config.js +1 -32
- package/dist/knowledge/contracts.js +0 -1
- package/dist/knowledge/index.js +1 -2
- package/dist/knowledge/module.js +12 -909
- package/dist/knowledge/procedural/config.js +1 -125
- package/dist/knowledge/procedural/index.js +1 -2
- package/dist/knowledge/procedural/manager.js +9 -345
- package/dist/mcp.js +1 -2
- package/dist/package-version.d.ts +2 -2
- package/dist/package-version.js +1 -2
- package/dist/persistence/file-store.js +3 -758
- package/dist/persistence/sqlite-request-context-store.js +5 -54
- package/dist/persistence/sqlite-request-queue-store.js +10 -108
- package/dist/persistence/sqlite-runtime.js +1 -86
- package/dist/persistence/sqlite-store.js +62 -810
- package/dist/persistence/types.js +0 -1
- package/dist/projections/presentation.js +37 -206
- package/dist/projections/request-events.js +2 -502
- package/dist/projections/upstream-events.js +1 -201
- package/dist/protocol/a2a/http-discovery.js +1 -178
- package/dist/protocol/a2a/http-rpc.js +6 -622
- package/dist/protocol/a2a/http.js +1 -138
- package/dist/protocol/a2a/task-state.js +3 -317
- package/dist/protocol/acp/client.js +8 -294
- package/dist/protocol/acp/harness-client.js +1 -218
- package/dist/protocol/acp/http.js +5 -130
- package/dist/protocol/acp/server.js +1 -310
- package/dist/protocol/acp/stdio.js +2 -69
- package/dist/protocol/ag-ui/http.js +3 -378
- package/dist/protocol/mcp/server.js +1 -428
- package/dist/resource/backend/workspace-scoped-backend.js +1 -319
- package/dist/resource/isolation.js +1 -237
- package/dist/resource/mcp/tool-support.js +3 -296
- package/dist/resource/mcp-tool-support.js +1 -2
- package/dist/resource/providers/resource-provider.js +1 -215
- package/dist/resource/resource-impl.js +1 -3
- package/dist/resource/resource-types.js +0 -1
- package/dist/resource/resource.js +1 -1
- package/dist/resource/sources.js +1 -247
- package/dist/resource/tools/function-tool-resolver.js +2 -272
- package/dist/runtime/adapter/compat/deepagent-compat.js +1 -29
- package/dist/runtime/adapter/compat/openai-compatible.js +1 -55
- package/dist/runtime/adapter/direct-builtin-utility.js +2 -90
- package/dist/runtime/adapter/flow/execution-context.js +1 -71
- package/dist/runtime/adapter/flow/invocation-flow.js +8 -411
- package/dist/runtime/adapter/flow/invoke-runtime.js +1 -20
- package/dist/runtime/adapter/flow/stream-runtime.js +11 -1395
- package/dist/runtime/adapter/invocation-result.js +2 -473
- package/dist/runtime/adapter/local-tool-invocation.js +6 -638
- package/dist/runtime/adapter/middleware/context-hygiene.js +1 -83
- package/dist/runtime/adapter/middleware-assembly.js +5 -477
- package/dist/runtime/adapter/model/invocation-request.js +3 -183
- package/dist/runtime/adapter/model/message-assembly.js +1 -28
- package/dist/runtime/adapter/model/model-providers.js +23 -1089
- package/dist/runtime/adapter/model/prompted-json-tool-call-capture.js +1 -40
- package/dist/runtime/adapter/model/prompted-json-tool-policy.js +1 -22
- package/dist/runtime/adapter/resilience.js +1 -104
- package/dist/runtime/adapter/runtime-adapter-support.js +3 -141
- package/dist/runtime/adapter/runtime-shell.js +5 -166
- package/dist/runtime/adapter/stream-event-projection.js +2 -622
- package/dist/runtime/adapter/stream-text-consumption.js +1 -18
- package/dist/runtime/adapter/terminal-status.js +2 -67
- package/dist/runtime/adapter/tool/builtin-middleware-tools.js +6 -627
- package/dist/runtime/adapter/tool/declared-middleware.js +1 -154
- package/dist/runtime/adapter/tool/interrupt-policy.js +1 -34
- package/dist/runtime/adapter/tool/provider-tool.js +1 -25
- package/dist/runtime/adapter/tool/resolved-tool.js +1 -225
- package/dist/runtime/adapter/tool/tool-arguments.js +3 -486
- package/dist/runtime/adapter/tool/tool-hitl.js +1 -346
- package/dist/runtime/adapter/tool/tool-name-mapping.js +1 -128
- package/dist/runtime/adapter/tool/tool-output-artifacts.js +2 -88
- package/dist/runtime/adapter/tool/tool-replay.js +1 -37
- package/dist/runtime/adapter/tool-resolution.js +1 -86
- package/dist/runtime/adapter/upstream-configurable-keys.js +1 -2
- package/dist/runtime/agent-runtime-adapter.js +60 -2338
- package/dist/runtime/agent-runtime-assembly.js +7 -249
- package/dist/runtime/env/runtime-env.js +1 -62
- package/dist/runtime/harness/background-runtime.js +1 -8
- package/dist/runtime/harness/bindings.js +1 -58
- package/dist/runtime/harness/events/event-bus.js +1 -16
- package/dist/runtime/harness/events/event-sink.js +1 -61
- package/dist/runtime/harness/events/events.js +1 -80
- package/dist/runtime/harness/events/listener-runtime.js +1 -13
- package/dist/runtime/harness/events/runtime-event-operations.js +1 -9
- package/dist/runtime/harness/events/streaming.js +1 -100
- package/dist/runtime/harness/events/timeline.js +1 -52
- package/dist/runtime/harness/public-shapes.js +1 -186
- package/dist/runtime/harness/run/artifact-paths.js +1 -15
- package/dist/runtime/harness/run/governance.js +1 -295
- package/dist/runtime/harness/run/helpers.js +1 -71
- package/dist/runtime/harness/run/inspection.js +1 -409
- package/dist/runtime/harness/run/operator-overview.js +1 -80
- package/dist/runtime/harness/run/queue-diagnostics.js +1 -15
- package/dist/runtime/harness/run/recovery.js +1 -162
- package/dist/runtime/harness/run/resources.js +1 -60
- package/dist/runtime/harness/run/resume.js +1 -56
- package/dist/runtime/harness/run/routing.js +1 -48
- package/dist/runtime/harness/run/run-lifecycle.js +1 -66
- package/dist/runtime/harness/run/run-operations.js +1 -217
- package/dist/runtime/harness/run/run-queue.js +1 -43
- package/dist/runtime/harness/run/run-slot-acquisition.js +1 -157
- package/dist/runtime/harness/run/session-records.js +1 -97
- package/dist/runtime/harness/run/start-run.js +1 -120
- package/dist/runtime/harness/run/startup-runtime.js +1 -69
- package/dist/runtime/harness/run/stream-run.js +8 -1418
- package/dist/runtime/harness/run/surface-semantics.js +1 -79
- package/dist/runtime/harness/runtime-defaults.js +1 -39
- package/dist/runtime/harness/system/boundary-analysis.js +1 -234
- package/dist/runtime/harness/system/health-monitor.js +1 -258
- package/dist/runtime/harness/system/inventory.js +1 -129
- package/dist/runtime/harness/system/mem0-ingestion-sync.js +5 -345
- package/dist/runtime/harness/system/policy-engine.js +1 -175
- package/dist/runtime/harness/system/runtime-memory-candidates.js +4 -110
- package/dist/runtime/harness/system/runtime-memory-consolidation.js +1 -51
- package/dist/runtime/harness/system/runtime-memory-manager.js +10 -693
- package/dist/runtime/harness/system/runtime-memory-policy.js +1 -155
- package/dist/runtime/harness/system/runtime-memory-records.js +11 -577
- package/dist/runtime/harness/system/runtime-memory-sync.js +5 -206
- package/dist/runtime/harness/system/session-memory-sync.js +3 -113
- package/dist/runtime/harness/system/skill-requirements.js +1 -112
- package/dist/runtime/harness/system/store.js +9 -365
- package/dist/runtime/harness/tool-gateway/index.js +1 -2
- package/dist/runtime/harness/tool-gateway/policy.js +1 -45
- package/dist/runtime/harness/tool-gateway/validation.js +1 -176
- package/dist/runtime/harness/tool-schema.js +1 -3
- package/dist/runtime/harness.js +3 -1490
- package/dist/runtime/index.js +1 -3
- package/dist/runtime/layout/runtime-layout.js +1 -31
- package/dist/runtime/maintenance/checkpoint-maintenance.js +2 -178
- package/dist/runtime/maintenance/file-checkpoint-saver.js +1 -106
- package/dist/runtime/maintenance/runtime-record-maintenance.js +2 -169
- package/dist/runtime/maintenance/sqlite-checkpoint-saver.js +4 -289
- package/dist/runtime/parsing/output-content.js +10 -550
- package/dist/runtime/parsing/output-parsing.js +1 -4
- package/dist/runtime/parsing/output-recovery.js +3 -213
- package/dist/runtime/parsing/output-tool-args.js +7 -663
- package/dist/runtime/parsing/stream-event-parsing.js +3 -362
- package/dist/runtime/prompts/runtime-prompts.js +4 -73
- package/dist/runtime/scheduling/system-schedule-manager.js +11 -532
- package/dist/runtime/skills/skill-metadata.js +1 -197
- package/dist/runtime/startup-tracing.js +2 -37
- package/dist/runtime/support/compiled-binding.js +1 -290
- package/dist/runtime/support/embedding-models.js +1 -118
- package/dist/runtime/support/harness-support.js +5 -137
- package/dist/runtime/support/llamaindex.js +1 -108
- package/dist/runtime/support/runtime-adapter-options.js +1 -29
- package/dist/runtime/support/runtime-factories.js +1 -51
- package/dist/runtime/support/vector-stores.js +9 -270
- package/dist/scaffold/init-project.js +54 -233
- package/dist/tooling/extensions.js +1 -311
- package/dist/tooling/module-loader.js +1 -55
- package/dist/tools.js +1 -176
- package/dist/utils/agent-display.js +1 -18
- package/dist/utils/bundled-text.js +4 -39
- package/dist/utils/compiled-binding.js +1 -33
- package/dist/utils/fs.js +2 -45
- package/dist/utils/id.js +1 -9
- package/dist/utils/message-content.js +1 -30
- package/dist/utils/object.js +1 -6
- package/dist/workspace/agent-binding-compiler.js +3 -613
- package/dist/workspace/compile.js +1 -472
- package/dist/workspace/framework-contract-validation.js +2 -322
- package/dist/workspace/index.js +1 -1
- package/dist/workspace/object-loader-paths.js +1 -71
- package/dist/workspace/object-loader-readers.js +1 -187
- package/dist/workspace/object-loader.js +1 -754
- package/dist/workspace/resource-compilers.js +1 -374
- package/dist/workspace/support/agent-capabilities.js +1 -37
- package/dist/workspace/support/agent-execution-config.js +1 -44
- package/dist/workspace/support/discovery.js +1 -147
- package/dist/workspace/support/source-collectors.js +1 -30
- package/dist/workspace/support/source-protocols.js +2 -192
- package/dist/workspace/support/workspace-ref-utils.js +1 -362
- package/dist/workspace/tool-hydration.js +1 -280
- package/dist/workspace/validate.js +1 -99
- package/dist/workspace/yaml-object-reader.js +1 -285
- package/package.json +7 -3
|
@@ -1,70 +1,20 @@
|
|
|
1
|
-
import path from "node:
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
.replace(/^-+|-+$/g, "");
|
|
12
|
-
return normalized || "agent-harness-app";
|
|
13
|
-
}
|
|
14
|
-
function toDisplayName(projectName) {
|
|
15
|
-
return projectName
|
|
16
|
-
.trim()
|
|
17
|
-
.split(/[-_\s]+/)
|
|
18
|
-
.filter(Boolean)
|
|
19
|
-
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
|
20
|
-
.join(" ");
|
|
21
|
-
}
|
|
22
|
-
function resolveOptions(options = {}) {
|
|
23
|
-
return {
|
|
24
|
-
template: options.template ?? "deep-research",
|
|
25
|
-
provider: options.provider?.trim() || "openai",
|
|
26
|
-
model: options.model?.trim() || "gpt-4o-mini",
|
|
27
|
-
withWebSearch: options.withWebSearch ?? true,
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
function renderPackageJson(projectSlug, template) {
|
|
31
|
-
return `${JSON.stringify({
|
|
32
|
-
name: projectSlug,
|
|
33
|
-
version: "0.0.1",
|
|
34
|
-
private: true,
|
|
35
|
-
type: "module",
|
|
36
|
-
description: `Starter ${template} application generated by agent-harness init.`,
|
|
37
|
-
scripts: {
|
|
38
|
-
start: "node ./src/run.mjs",
|
|
39
|
-
},
|
|
40
|
-
dependencies: {
|
|
41
|
-
"@botbotgo/agent-harness": `^${AGENT_HARNESS_VERSION}`,
|
|
42
|
-
},
|
|
43
|
-
}, null, 2)}\n`;
|
|
44
|
-
}
|
|
45
|
-
function renderReadme(displayName, projectSlug, options) {
|
|
46
|
-
const webSearchLine = options.withWebSearch
|
|
47
|
-
? `- ${options.provider} native web search enabled through \`config/catalogs/tools.yaml\``
|
|
48
|
-
: "- no provider-native web search by default";
|
|
49
|
-
const providerEnvLine = options.provider === "openai" ? "export OPENAI_API_KEY=your_key_here\n" : "";
|
|
50
|
-
const templateLine = options.template === "deep-research"
|
|
51
|
-
? "- a host research agent plus an analyst subagent"
|
|
52
|
-
: "- a single host research agent for direct iteration";
|
|
53
|
-
return `# ${displayName}
|
|
54
|
-
|
|
55
|
-
This project was scaffolded with \`agent-harness init ${projectSlug}\`.
|
|
56
|
-
|
|
57
|
-
It is a minimal ${options.template} workspace with:
|
|
58
|
-
|
|
59
|
-
${templateLine}
|
|
60
|
-
${webSearchLine}
|
|
1
|
+
import d from"node:path";import{writeFile as h}from"node:fs/promises";import{AGENT_HARNESS_VERSION as g}from"../package-version.js";import{readBundledText as c,renderBundledTemplate as f}from"../utils/bundled-text.js";import{ensureDir as u,fileExists as w}from"../utils/fs.js";function y(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"agent-harness-app"}function k(e){return e.trim().split(/[-_\s]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function b(e={}){return{template:e.template??"deep-research",provider:e.provider?.trim()||"openai",model:e.model?.trim()||"gpt-4o-mini",withWebSearch:e.withWebSearch??!0}}function v(e,t){return`${JSON.stringify({name:e,version:"0.0.1",private:!0,type:"module",description:`Starter ${t} application generated by agent-harness init.`,scripts:{start:"node ./src/run.mjs"},dependencies:{"@botbotgo/agent-harness":`^${g}`}},null,2)}
|
|
2
|
+
`}function R(e,t,n){const r=n.withWebSearch?`- ${n.provider} native web search enabled through \`config/catalogs/tools.yaml\``:"- no provider-native web search by default",a=n.provider==="openai"?`export OPENAI_API_KEY=your_key_here
|
|
3
|
+
`:"",o=n.template==="deep-research"?"- a host research agent plus an analyst subagent":"- a single host research agent for direct iteration";return`# ${e}
|
|
4
|
+
|
|
5
|
+
This project was scaffolded with \`agent-harness init ${t}\`.
|
|
6
|
+
|
|
7
|
+
It is a minimal ${n.template} workspace with:
|
|
8
|
+
|
|
9
|
+
${o}
|
|
10
|
+
${r}
|
|
61
11
|
- one host agent that already carries the default behavior skills for inspection, safe edits, approvals, and clean completion
|
|
62
12
|
|
|
63
13
|
## Run
|
|
64
14
|
|
|
65
15
|
\`\`\`bash
|
|
66
16
|
npm install
|
|
67
|
-
${
|
|
17
|
+
${a}npm run start -- "Research the latest model serving stack for agent products and summarize the tradeoffs."
|
|
68
18
|
\`\`\`
|
|
69
19
|
|
|
70
20
|
## Fast first prompts
|
|
@@ -91,15 +41,9 @@ ${providerEnvLine}npm run start -- "Research the latest model serving stack for
|
|
|
91
41
|
- add local \`tool({...})\` tools under \`resources/tools/\`
|
|
92
42
|
- add product-specific skills under \`resources/skills/\`
|
|
93
43
|
- edit the prompt files in \`config/prompts/\` to turn this into your own product
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
function renderGitignore() {
|
|
97
|
-
return `node_modules
|
|
44
|
+
`}function x(){return`node_modules
|
|
98
45
|
.agent
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
function renderWorkspaceYaml() {
|
|
102
|
-
return `apiVersion: agent-harness/v1alpha1
|
|
46
|
+
`}function S(){return`apiVersion: agent-harness/v1alpha1
|
|
103
47
|
kind: Runtime
|
|
104
48
|
metadata:
|
|
105
49
|
name: default
|
|
@@ -107,42 +51,15 @@ spec:
|
|
|
107
51
|
applicationRoot: .
|
|
108
52
|
dataRoot: ./.botbotgo
|
|
109
53
|
profile: default
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
function resolveResearchHostPromptTemplate(options) {
|
|
113
|
-
return options.template === "deep-research"
|
|
114
|
-
? (options.withWebSearch
|
|
115
|
-
? "init-templates/prompts/research-host-deep-research-web-search.md"
|
|
116
|
-
: "init-templates/prompts/research-host-deep-research-basic.md")
|
|
117
|
-
: (options.withWebSearch
|
|
118
|
-
? "init-templates/prompts/research-host-single-agent-web-search.md"
|
|
119
|
-
: "init-templates/prompts/research-host-single-agent-basic.md");
|
|
120
|
-
}
|
|
121
|
-
function resolveResearchAnalystPromptTemplate(options) {
|
|
122
|
-
return options.withWebSearch
|
|
123
|
-
? "init-templates/prompts/research-analyst-web-search.md"
|
|
124
|
-
: "init-templates/prompts/research-analyst-basic.md";
|
|
125
|
-
}
|
|
126
|
-
function renderAgentContext(options) {
|
|
127
|
-
return renderBundledTemplate("init-templates/agent-context/deep-research.md", {
|
|
128
|
-
webSearchGuidance: options.withWebSearch
|
|
129
|
-
? "- Favor recent, attributable sources when the request depends on current information."
|
|
130
|
-
: "- Favor clear internal reasoning and add search or local tools as your product needs evolve.",
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
function renderModelsYaml(options) {
|
|
134
|
-
return `apiVersion: agent-harness/v1alpha1
|
|
54
|
+
`}function I(e){return e.template==="deep-research"?e.withWebSearch?"init-templates/prompts/research-host-deep-research-web-search.md":"init-templates/prompts/research-host-deep-research-basic.md":e.withWebSearch?"init-templates/prompts/research-host-single-agent-web-search.md":"init-templates/prompts/research-host-single-agent-basic.md"}function P(e){return e.withWebSearch?"init-templates/prompts/research-analyst-web-search.md":"init-templates/prompts/research-analyst-basic.md"}function M(e){return f("init-templates/agent-context/deep-research.md",{webSearchGuidance:e.withWebSearch?"- Favor recent, attributable sources when the request depends on current information.":"- Favor clear internal reasoning and add search or local tools as your product needs evolve."})}function q(e){return`apiVersion: agent-harness/v1alpha1
|
|
135
55
|
kind: Models
|
|
136
56
|
spec:
|
|
137
57
|
- name: default
|
|
138
58
|
kind: Model
|
|
139
|
-
provider: ${
|
|
140
|
-
model: ${
|
|
59
|
+
provider: ${e.provider}
|
|
60
|
+
model: ${e.model}
|
|
141
61
|
temperature: 0.2
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
function renderBackendsYaml() {
|
|
145
|
-
return `apiVersion: agent-harness/v1alpha1
|
|
62
|
+
`}function j(){return`apiVersion: agent-harness/v1alpha1
|
|
146
63
|
kind: Backends
|
|
147
64
|
spec:
|
|
148
65
|
- kind: Backend
|
|
@@ -155,10 +72,7 @@ spec:
|
|
|
155
72
|
routes:
|
|
156
73
|
/memories/:
|
|
157
74
|
kind: StoreBackend
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
function renderRuntimeMemoryYaml(projectSlug) {
|
|
161
|
-
return `apiVersion: agent-harness/v1alpha1
|
|
75
|
+
`}function A(e){return`apiVersion: agent-harness/v1alpha1
|
|
162
76
|
kind: RuntimeMemory
|
|
163
77
|
metadata:
|
|
164
78
|
name: default
|
|
@@ -214,7 +128,7 @@ spec:
|
|
|
214
128
|
- Use \`create\` for a newly introduced knowledge item, \`update\` for a revised active state of an existing knowledge item, and \`delete\` when the candidate says an existing knowledge item should no longer remain active.
|
|
215
129
|
- If an existing relevant record already represents the same underlying knowledge item, reuse that record's \`knowledge_identity\` instead of inventing a new one.
|
|
216
130
|
- Do not invent a second identity just because the new statement negates, revokes, deletes, or replaces the old wording. That is usually the same knowledge item with a different mutation operation.
|
|
217
|
-
- The stored \`content\` must be canonical knowledge text, not an assistant acknowledgement such as "
|
|
131
|
+
- The stored \`content\` must be canonical knowledge text, not an assistant acknowledgement such as "\u5DF2\u8BB0\u4F4F" or "I will remember".
|
|
218
132
|
- You may optionally include \`operationalRule\` when the knowledge is a durable user-approved rule, instruction, or recurring procedure. Do not use it for assistant-only workflow guidance inferred from one conversation. Treat it as structured metadata, not as the primary identity mechanism.
|
|
219
133
|
- Prefer semantic/episodic/procedural kinds only.
|
|
220
134
|
- Prefer scopes session/agent/workspace/user/project only.
|
|
@@ -246,13 +160,10 @@ spec:
|
|
|
246
160
|
mem0:
|
|
247
161
|
enabled: false
|
|
248
162
|
apiKeyEnv: MEM0_API_KEY
|
|
249
|
-
appId: ${
|
|
163
|
+
appId: ${e}
|
|
250
164
|
stateStorePath: knowledge/mem0-sync-state.json
|
|
251
165
|
maxMessagesPerRequest: 200
|
|
252
|
-
|
|
253
|
-
}
|
|
254
|
-
function renderKnowledgeRuntimeYaml(projectSlug) {
|
|
255
|
-
return `apiVersion: agent-harness/v1alpha1
|
|
166
|
+
`}function _(e){return`apiVersion: agent-harness/v1alpha1
|
|
256
167
|
kind: KnowledgeRuntime
|
|
257
168
|
metadata:
|
|
258
169
|
name: default
|
|
@@ -293,7 +204,7 @@ spec:
|
|
|
293
204
|
- Use \`create\` for a newly introduced knowledge item, \`update\` for a revised active state of an existing knowledge item, and \`delete\` when the candidate says an existing knowledge item should no longer remain active.
|
|
294
205
|
- If an existing relevant record already represents the same underlying knowledge item, reuse that record's \`knowledge_identity\` instead of inventing a new one.
|
|
295
206
|
- Do not invent a second identity just because the new statement negates, revokes, deletes, or replaces the old wording. That is usually the same knowledge item with a different mutation operation.
|
|
296
|
-
- The stored \`content\` must be canonical knowledge text, not an assistant acknowledgement such as "
|
|
207
|
+
- The stored \`content\` must be canonical knowledge text, not an assistant acknowledgement such as "\u5DF2\u8BB0\u4F4F" or "I will remember".
|
|
297
208
|
- You may optionally include \`operationalRule\` when the knowledge is a durable user-approved rule, instruction, or recurring procedure. Do not use it for assistant-only workflow guidance inferred from one conversation. Treat it as structured metadata, not as the primary identity mechanism.
|
|
298
209
|
- Prefer semantic/episodic/procedural kinds only.
|
|
299
210
|
- Prefer scopes session/agent/workspace/user/project only.
|
|
@@ -323,13 +234,10 @@ spec:
|
|
|
323
234
|
mem0:
|
|
324
235
|
enabled: false
|
|
325
236
|
apiKeyEnv: MEM0_API_KEY
|
|
326
|
-
appId: ${
|
|
237
|
+
appId: ${e}
|
|
327
238
|
stateStorePath: knowledge/mem0-sync-state.json
|
|
328
239
|
maxMessagesPerRequest: 200
|
|
329
|
-
|
|
330
|
-
}
|
|
331
|
-
function renderProceduralMemoryRuntimeYaml() {
|
|
332
|
-
return `apiVersion: agent-harness/v1alpha1
|
|
240
|
+
`}function T(){return`apiVersion: agent-harness/v1alpha1
|
|
333
241
|
kind: ProceduralMemoryRuntime
|
|
334
242
|
metadata:
|
|
335
243
|
name: default
|
|
@@ -392,32 +300,27 @@ spec:
|
|
|
392
300
|
pruning:
|
|
393
301
|
minScore: 0.2
|
|
394
302
|
minFrequency: 2
|
|
395
|
-
|
|
396
|
-
}
|
|
397
|
-
function renderToolsYaml(options) {
|
|
398
|
-
if (!options.withWebSearch) {
|
|
399
|
-
return `apiVersion: agent-harness/v1alpha1
|
|
400
|
-
kind: ToolSets
|
|
401
|
-
spec: []
|
|
402
|
-
`;
|
|
403
|
-
}
|
|
404
|
-
return `apiVersion: agent-harness/v1alpha1
|
|
303
|
+
`}function D(e){return e.withWebSearch?`apiVersion: agent-harness/v1alpha1
|
|
405
304
|
kind: ToolSets
|
|
406
305
|
spec:
|
|
407
306
|
- name: web-search
|
|
408
307
|
type: provider
|
|
409
308
|
description: Use this when the runtime needs current web discovery for research tasks. Do not use this as a substitute for synthesis or comparison.
|
|
410
309
|
providerTool:
|
|
411
|
-
provider: ${
|
|
310
|
+
provider: ${e.provider}
|
|
412
311
|
tool: webSearch
|
|
413
312
|
args:
|
|
414
313
|
searchContextSize: medium
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
314
|
+
`:`apiVersion: agent-harness/v1alpha1
|
|
315
|
+
kind: ToolSets
|
|
316
|
+
spec: []
|
|
317
|
+
`}function $(e){const t=e.withWebSearch?` tools:
|
|
318
|
+
- web-search
|
|
319
|
+
`:` tools: []
|
|
320
|
+
`,n=e.template==="deep-research"?` subagents:
|
|
321
|
+
- research-analyst
|
|
322
|
+
`:` subagents: []
|
|
323
|
+
`;return`apiVersion: agent-harness/v1alpha1
|
|
421
324
|
kind: Agent
|
|
422
325
|
metadata:
|
|
423
326
|
name: research
|
|
@@ -428,22 +331,18 @@ spec:
|
|
|
428
331
|
proceduralMemory: default
|
|
429
332
|
backend: deepagent
|
|
430
333
|
modelRef: model/default
|
|
431
|
-
${
|
|
334
|
+
${t} skills:
|
|
432
335
|
- workspace-inspection
|
|
433
336
|
- safe-editing
|
|
434
337
|
- delegation-discipline
|
|
435
338
|
- approval-execution-policy
|
|
436
339
|
- completion-discipline
|
|
437
340
|
- deep-research
|
|
438
|
-
${
|
|
341
|
+
${n} config:
|
|
439
342
|
backend: default
|
|
440
343
|
systemPrompt:
|
|
441
344
|
path: ../prompts/research-system.md
|
|
442
|
-
|
|
443
|
-
}
|
|
444
|
-
function renderResearchAnalystYaml(options) {
|
|
445
|
-
const toolsBlock = options.withWebSearch ? " tools:\n - web-search\n" : " tools: []\n";
|
|
446
|
-
return `apiVersion: agent-harness/v1alpha1
|
|
345
|
+
`}function E(e){return`apiVersion: agent-harness/v1alpha1
|
|
447
346
|
kind: Agent
|
|
448
347
|
metadata:
|
|
449
348
|
name: research-analyst
|
|
@@ -454,7 +353,10 @@ spec:
|
|
|
454
353
|
proceduralMemory: default
|
|
455
354
|
backend: deepagent
|
|
456
355
|
modelRef: model/default
|
|
457
|
-
${
|
|
356
|
+
${e.withWebSearch?` tools:
|
|
357
|
+
- web-search
|
|
358
|
+
`:` tools: []
|
|
359
|
+
`} skills:
|
|
458
360
|
- workspace-inspection
|
|
459
361
|
- approval-execution-policy
|
|
460
362
|
- completion-discipline
|
|
@@ -463,22 +365,8 @@ ${toolsBlock} skills:
|
|
|
463
365
|
backend: default
|
|
464
366
|
systemPrompt:
|
|
465
367
|
path: ../prompts/research-analyst-system.md
|
|
466
|
-
|
|
467
|
-
}
|
|
468
|
-
function renderResourcePackageJson(projectSlug) {
|
|
469
|
-
return `${JSON.stringify({
|
|
470
|
-
name: `${projectSlug}-resources`,
|
|
471
|
-
version: "0.0.1",
|
|
472
|
-
private: true,
|
|
473
|
-
type: "module",
|
|
474
|
-
description: "Resource package for a generated agent-harness project.",
|
|
475
|
-
}, null, 2)}\n`;
|
|
476
|
-
}
|
|
477
|
-
function renderSkill(options) {
|
|
478
|
-
const stepTwo = options.withWebSearch
|
|
479
|
-
? "2. Use `web-search` to collect recent primary or otherwise authoritative sources."
|
|
480
|
-
: "2. Collect the key facts and assumptions needed to answer the request cleanly.";
|
|
481
|
-
return `---
|
|
368
|
+
`}function C(e){return`${JSON.stringify({name:`${e}-resources`,version:"0.0.1",private:!0,type:"module",description:"Resource package for a generated agent-harness project."},null,2)}
|
|
369
|
+
`}function K(e){return`---
|
|
482
370
|
name: deep-research
|
|
483
371
|
description: Default research workflow for product investigations that need careful synthesis.
|
|
484
372
|
---
|
|
@@ -490,7 +378,7 @@ Use this skill when the user wants comparisons, source-backed analysis, or a con
|
|
|
490
378
|
## Workflow
|
|
491
379
|
|
|
492
380
|
1. Clarify the target question and what "done" looks like.
|
|
493
|
-
${
|
|
381
|
+
${e.withWebSearch?"2. Use `web-search` to collect recent primary or otherwise authoritative sources.":"2. Collect the key facts and assumptions needed to answer the request cleanly."}
|
|
494
382
|
3. Compare evidence instead of trusting a single source.
|
|
495
383
|
4. Separate verified facts from inference.
|
|
496
384
|
5. End with a concise synthesis, explicit caveats, and source links when available.
|
|
@@ -500,11 +388,7 @@ ${stepTwo}
|
|
|
500
388
|
- Do not rely on one source when the question requires comparison.
|
|
501
389
|
- Do not present inference as a verified fact.
|
|
502
390
|
- If current information is required, prefer fresh sources over model memory.
|
|
503
|
-
|
|
504
|
-
}
|
|
505
|
-
function renderStarterSkill(name) {
|
|
506
|
-
if (name === "workspace-inspection") {
|
|
507
|
-
return `---
|
|
391
|
+
`}function s(e){return e==="workspace-inspection"?`---
|
|
508
392
|
name: workspace-inspection
|
|
509
393
|
description: Inspect the current workspace before making claims or edits.
|
|
510
394
|
---
|
|
@@ -515,10 +399,7 @@ description: Inspect the current workspace before making claims or edits.
|
|
|
515
399
|
2. Read only the files needed to establish the relevant facts.
|
|
516
400
|
3. Ground each conclusion in inspected workspace evidence instead of guesses.
|
|
517
401
|
4. If the workspace does not contain the needed evidence, say that plainly before proposing a next step.
|
|
518
|
-
|
|
519
|
-
}
|
|
520
|
-
if (name === "safe-editing") {
|
|
521
|
-
return `---
|
|
402
|
+
`:e==="safe-editing"?`---
|
|
522
403
|
name: safe-editing
|
|
523
404
|
description: Make the smallest workspace change that solves the task, then verify it.
|
|
524
405
|
---
|
|
@@ -529,10 +410,7 @@ description: Make the smallest workspace change that solves the task, then verif
|
|
|
529
410
|
2. Prefer bounded edits over large rewrites.
|
|
530
411
|
3. Keep local conventions intact.
|
|
531
412
|
4. Run the smallest reasonable verification step before you finish.
|
|
532
|
-
|
|
533
|
-
}
|
|
534
|
-
if (name === "delegation-discipline") {
|
|
535
|
-
return `---
|
|
413
|
+
`:e==="delegation-discipline"?`---
|
|
536
414
|
name: delegation-discipline
|
|
537
415
|
description: Delegate only when a subagent is clearly the best fit and the handoff can be bounded cleanly.
|
|
538
416
|
---
|
|
@@ -542,10 +420,7 @@ description: Delegate only when a subagent is clearly the best fit and the hando
|
|
|
542
420
|
1. Keep the next critical-path step local unless a subagent is clearly better.
|
|
543
421
|
2. Delegate only with one bounded ask and a clear purpose.
|
|
544
422
|
3. Integrate delegated results into one final answer instead of forwarding raw output.
|
|
545
|
-
|
|
546
|
-
}
|
|
547
|
-
if (name === "approval-execution-policy") {
|
|
548
|
-
return `---
|
|
423
|
+
`:e==="approval-execution-policy"?`---
|
|
549
424
|
name: approval-execution-policy
|
|
550
425
|
description: Treat side effects, command execution, and external actions as governed runtime decisions.
|
|
551
426
|
---
|
|
@@ -555,9 +430,7 @@ description: Treat side effects, command execution, and external actions as gove
|
|
|
555
430
|
1. Inspect first when the safest next step is still unclear.
|
|
556
431
|
2. Request approval before destructive, external, privileged, or ambiguous actions.
|
|
557
432
|
3. After approval, execute only the action that was approved and report the outcome plainly.
|
|
558
|
-
|
|
559
|
-
}
|
|
560
|
-
return `---
|
|
433
|
+
`:`---
|
|
561
434
|
name: completion-discipline
|
|
562
435
|
description: Finish the task cleanly, verify what you can, and leave the user with a clear outcome.
|
|
563
436
|
---
|
|
@@ -568,13 +441,7 @@ description: Finish the task cleanly, verify what you can, and leave the user wi
|
|
|
568
441
|
2. Verify the changed or inspected area with the smallest relevant check.
|
|
569
442
|
3. Distinguish completed work, unverified areas, and blocked follow-up.
|
|
570
443
|
4. Return a concise final answer that makes the outcome easy to trust.
|
|
571
|
-
|
|
572
|
-
}
|
|
573
|
-
function renderRunScript(options) {
|
|
574
|
-
const defaultInput = options.withWebSearch
|
|
575
|
-
? "Research the latest model and tooling trends for AI product teams. Return a concise brief with sources and caveats."
|
|
576
|
-
: "Analyze the current architecture direction for this product and return a concise brief with assumptions and caveats.";
|
|
577
|
-
return `import { fileURLToPath } from "node:url";
|
|
444
|
+
`}function L(e){const t=e.withWebSearch?"Research the latest model and tooling trends for AI product teams. Return a concise brief with sources and caveats.":"Analyze the current architecture direction for this product and return a concise brief with assumptions and caveats.";return`import { fileURLToPath } from "node:url";
|
|
578
445
|
import { createAgentHarness, request, stop } from "@botbotgo/agent-harness";
|
|
579
446
|
|
|
580
447
|
const appRoot = fileURLToPath(new URL("..", import.meta.url));
|
|
@@ -597,7 +464,7 @@ for (let index = 0; index < args.length; index += 1) {
|
|
|
597
464
|
}
|
|
598
465
|
|
|
599
466
|
const input = inputParts.join(" ").trim() ||
|
|
600
|
-
${JSON.stringify(
|
|
467
|
+
${JSON.stringify(t)};
|
|
601
468
|
|
|
602
469
|
const runtime = await createAgentHarness(appRoot);
|
|
603
470
|
|
|
@@ -610,50 +477,4 @@ try {
|
|
|
610
477
|
} finally {
|
|
611
478
|
await stop(runtime);
|
|
612
479
|
}
|
|
613
|
-
|
|
614
|
-
}
|
|
615
|
-
export async function initProject(projectRoot, projectName, options = {}) {
|
|
616
|
-
if (await fileExists(projectRoot)) {
|
|
617
|
-
throw new Error(`Target path already exists: ${projectRoot}`);
|
|
618
|
-
}
|
|
619
|
-
const resolved = resolveOptions(options);
|
|
620
|
-
const projectSlug = toProjectSlug(projectName);
|
|
621
|
-
const displayName = toDisplayName(projectName) || "Agent Harness App";
|
|
622
|
-
const files = new Map([
|
|
623
|
-
["package.json", renderPackageJson(projectSlug, resolved.template)],
|
|
624
|
-
[".gitignore", renderGitignore()],
|
|
625
|
-
["README.md", renderReadme(displayName, projectSlug, resolved)],
|
|
626
|
-
["src/run.mjs", renderRunScript(resolved)],
|
|
627
|
-
["config/runtime/workspace.yaml", renderWorkspaceYaml()],
|
|
628
|
-
["config/agent-context.md", renderAgentContext(resolved)],
|
|
629
|
-
["config/prompts/research-system.md", readBundledText(resolveResearchHostPromptTemplate(resolved)).trim()],
|
|
630
|
-
["config/models.yaml", renderModelsYaml(resolved)],
|
|
631
|
-
["config/knowledge/knowledge-runtime.yaml", renderKnowledgeRuntimeYaml(projectSlug)],
|
|
632
|
-
["config/knowledge/procedural-memory-runtime.yaml", renderProceduralMemoryRuntimeYaml()],
|
|
633
|
-
["config/runtime/runtime-memory.yaml", renderRuntimeMemoryYaml(projectSlug)],
|
|
634
|
-
["config/catalogs/backends.yaml", renderBackendsYaml()],
|
|
635
|
-
["config/catalogs/tools.yaml", renderToolsYaml(resolved)],
|
|
636
|
-
["config/agents/research.yaml", renderResearchAgentYaml(resolved)],
|
|
637
|
-
["resources/package.json", renderResourcePackageJson(projectSlug)],
|
|
638
|
-
["resources/skills/deep-research/SKILL.md", renderSkill(resolved)],
|
|
639
|
-
["resources/skills/workspace-inspection/SKILL.md", renderStarterSkill("workspace-inspection")],
|
|
640
|
-
["resources/skills/safe-editing/SKILL.md", renderStarterSkill("safe-editing")],
|
|
641
|
-
["resources/skills/delegation-discipline/SKILL.md", renderStarterSkill("delegation-discipline")],
|
|
642
|
-
["resources/skills/approval-execution-policy/SKILL.md", renderStarterSkill("approval-execution-policy")],
|
|
643
|
-
["resources/skills/completion-discipline/SKILL.md", renderStarterSkill("completion-discipline")],
|
|
644
|
-
]);
|
|
645
|
-
if (resolved.template === "deep-research") {
|
|
646
|
-
files.set("config/prompts/research-analyst-system.md", readBundledText(resolveResearchAnalystPromptTemplate(resolved)).trim());
|
|
647
|
-
files.set("config/agents/research-analyst.yaml", renderResearchAnalystYaml(resolved));
|
|
648
|
-
}
|
|
649
|
-
await ensureDir(projectRoot);
|
|
650
|
-
for (const [relativePath, content] of files) {
|
|
651
|
-
const filePath = path.join(projectRoot, relativePath);
|
|
652
|
-
await ensureDir(path.dirname(filePath));
|
|
653
|
-
await writeFile(filePath, content, "utf8");
|
|
654
|
-
}
|
|
655
|
-
return {
|
|
656
|
-
projectRoot,
|
|
657
|
-
projectSlug,
|
|
658
|
-
};
|
|
659
|
-
}
|
|
480
|
+
`}async function B(e,t,n={}){if(await w(e))throw new Error(`Target path already exists: ${e}`);const r=b(n),a=y(t),o=k(t)||"Agent Harness App",i=new Map([["package.json",v(a,r.template)],[".gitignore",x()],["README.md",R(o,a,r)],["src/run.mjs",L(r)],["config/runtime/workspace.yaml",S()],["config/agent-context.md",M(r)],["config/prompts/research-system.md",c(I(r)).trim()],["config/models.yaml",q(r)],["config/knowledge/knowledge-runtime.yaml",_(a)],["config/knowledge/procedural-memory-runtime.yaml",T()],["config/runtime/runtime-memory.yaml",A(a)],["config/catalogs/backends.yaml",j()],["config/catalogs/tools.yaml",D(r)],["config/agents/research.yaml",$(r)],["resources/package.json",C(a)],["resources/skills/deep-research/SKILL.md",K(r)],["resources/skills/workspace-inspection/SKILL.md",s("workspace-inspection")],["resources/skills/safe-editing/SKILL.md",s("safe-editing")],["resources/skills/delegation-discipline/SKILL.md",s("delegation-discipline")],["resources/skills/approval-execution-policy/SKILL.md",s("approval-execution-policy")],["resources/skills/completion-discipline/SKILL.md",s("completion-discipline")]]);r.template==="deep-research"&&(i.set("config/prompts/research-analyst-system.md",c(P(r)).trim()),i.set("config/agents/research-analyst.yaml",E(r))),await u(e);for(const[p,m]of i){const l=d.join(e,p);await u(d.dirname(l)),await h(l,m,"utf8")}return{projectRoot:e,projectSlug:a}}export{B as initProject};
|