@botbotgo/agent-harness 0.0.319 → 0.0.320
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 +5 -2
- package/README.zh.md +5 -2
- package/dist/package-version.d.ts +1 -1
- package/dist/package-version.js +1 -1
- package/dist/workspace/compile.js +19 -5
- package/dist/workspace/support/source-protocols.d.ts +3 -3
- package/dist/workspace/support/source-protocols.js +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -500,18 +500,20 @@ spec:
|
|
|
500
500
|
- npm://@acme/agent-tools
|
|
501
501
|
skills:
|
|
502
502
|
- file://./resources/skills
|
|
503
|
+
- npm://@acme/agent-skills
|
|
503
504
|
- https://example.com/skills/review/SKILL.md
|
|
504
505
|
```
|
|
505
506
|
|
|
506
507
|
Tool-source rules:
|
|
507
508
|
|
|
508
509
|
- `file://...` scans only the configured folder
|
|
509
|
-
- `npm://...` resolves one package, auto-installs it when missing, and discovers
|
|
510
|
+
- `npm://...` resolves one package, auto-installs it when missing, and discovers tools from `package/tools/`
|
|
510
511
|
- tool discovery never traverses `node_modules/**`
|
|
511
512
|
|
|
512
513
|
Skill-source rules:
|
|
513
514
|
|
|
514
515
|
- `file://...` accepts a skill collection folder, a single skill root, or a direct `SKILL.md` path
|
|
516
|
+
- `npm://...` resolves one package, auto-installs it when missing, and discovers skills from `package/skills/`
|
|
515
517
|
- `http://...` and `https://...` currently accept a single remote `SKILL.md`
|
|
516
518
|
|
|
517
519
|
`runtime.spec.resources` remains supported as a compatibility path for attached resource packages.
|
|
@@ -867,11 +869,12 @@ Important fields:
|
|
|
867
869
|
`sources.tools` controls which tool roots or packages participate in workspace discovery:
|
|
868
870
|
|
|
869
871
|
- `file://...` for folder scanning
|
|
870
|
-
- `npm://...` for package
|
|
872
|
+
- `npm://...` for package discovery under `tools/` plus auto-install when missing
|
|
871
873
|
|
|
872
874
|
`sources.skills` controls which skill folders or skill documents participate in workspace discovery:
|
|
873
875
|
|
|
874
876
|
- `file://...` for local folders, skill roots, or direct `SKILL.md`
|
|
877
|
+
- `npm://...` for package discovery under `skills/` plus auto-install when missing
|
|
875
878
|
- `http://...` / `https://...` for one remote `SKILL.md`
|
|
876
879
|
|
|
877
880
|
`toolModuleDiscovery.scope` controls how local `resources/tools/`-style file discovery walks tool directories:
|
package/README.zh.md
CHANGED
|
@@ -495,18 +495,20 @@ spec:
|
|
|
495
495
|
- npm://@acme/agent-tools
|
|
496
496
|
skills:
|
|
497
497
|
- file://./resources/skills
|
|
498
|
+
- npm://@acme/agent-skills
|
|
498
499
|
- https://example.com/skills/review/SKILL.md
|
|
499
500
|
```
|
|
500
501
|
|
|
501
502
|
tool source 规则:
|
|
502
503
|
|
|
503
504
|
- `file://...` 只扫描显式配置的目录
|
|
504
|
-
- `npm://...`
|
|
505
|
+
- `npm://...` 只解析单个包;本地缺失时会自动安装,再从 `package/tools/` 发现工具
|
|
505
506
|
- tool 发现永远不会遍历 `node_modules/**`
|
|
506
507
|
|
|
507
508
|
skill source 规则:
|
|
508
509
|
|
|
509
510
|
- `file://...` 可以指向 skill 集合目录、单个 skill root,或直接指向 `SKILL.md`
|
|
511
|
+
- `npm://...` 只解析单个包;本地缺失时会自动安装,再从 `package/skills/` 发现 skills
|
|
510
512
|
- `http://...` 与 `https://...` 当前只支持一个远程 `SKILL.md`
|
|
511
513
|
|
|
512
514
|
`runtime.spec.resources` 仍保留为兼容旧 attached resource package 的路径。
|
|
@@ -834,11 +836,12 @@ await stop(runtime);
|
|
|
834
836
|
`sources.tools` 用来声明哪些 tool root 或 package 参与工作区发现:
|
|
835
837
|
|
|
836
838
|
- `file://...` 用于目录扫描
|
|
837
|
-
- `npm://...`
|
|
839
|
+
- `npm://...` 用于 `tools/` 目录发现;本地缺失时自动安装
|
|
838
840
|
|
|
839
841
|
`sources.skills` 用来声明哪些 skill 目录或 skill 文档参与工作区发现:
|
|
840
842
|
|
|
841
843
|
- `file://...` 用于本地目录、skill root 或直接 `SKILL.md`
|
|
844
|
+
- `npm://...` 用于 `skills/` 目录发现;本地缺失时自动安装
|
|
842
845
|
- `http://...` / `https://...` 用于单个远程 `SKILL.md`
|
|
843
846
|
|
|
844
847
|
`toolModuleDiscovery.scope` 用来控制本地 `resources/tools/` 风格 file source 的发现范围:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const AGENT_HARNESS_VERSION = "0.0.
|
|
1
|
+
export declare const AGENT_HARNESS_VERSION = "0.0.319";
|
package/dist/package-version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const AGENT_HARNESS_VERSION = "0.0.
|
|
1
|
+
export const AGENT_HARNESS_VERSION = "0.0.319";
|
|
@@ -15,7 +15,7 @@ import { getRoutingDefaultAgentId, getRuntimeSources, getRuntimeResources, getRu
|
|
|
15
15
|
import { hydrateAgentMcpTools, hydrateResourceAndExternalTools } from "./tool-hydration.js";
|
|
16
16
|
import { traceStartupStage } from "../runtime/startup-tracing.js";
|
|
17
17
|
import { shouldSkipScanDirectory } from "../utils/fs.js";
|
|
18
|
-
import {
|
|
18
|
+
import { ensurePackageSource, ensureRemoteSkillSource, isFileSourceUri, isHttpSourceUri, isNpmSourceUri, resolveFileSourcePath, } from "./support/source-protocols.js";
|
|
19
19
|
import { discoverToolModuleDefinitions } from "../tooling/module-loader.js";
|
|
20
20
|
function mergeObjectValues(base, override) {
|
|
21
21
|
if (override === undefined) {
|
|
@@ -195,7 +195,12 @@ async function resolveConfiguredSkillSourceRoots(sources, workspaceRoot) {
|
|
|
195
195
|
resolved.push(await ensureRemoteSkillSource(source));
|
|
196
196
|
continue;
|
|
197
197
|
}
|
|
198
|
-
|
|
198
|
+
if (isNpmSourceUri(source)) {
|
|
199
|
+
const installed = await ensurePackageSource(source, workspaceRoot);
|
|
200
|
+
resolved.push(path.join(installed.packageRoot, "skills"));
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
throw new Error(`Unsupported skill source ${source}. Use file://, npm://, or https://.`);
|
|
199
204
|
}
|
|
200
205
|
return resolved;
|
|
201
206
|
}
|
|
@@ -219,8 +224,16 @@ async function registerToolFolderSource(tools, folderRoot, toolModuleDiscoverySc
|
|
|
219
224
|
tools.set(parsed.id, mergeParsedToolObject(tools.get(parsed.id), parsed));
|
|
220
225
|
}
|
|
221
226
|
}
|
|
222
|
-
async function registerToolPackageSource(tools, source, workspaceRoot) {
|
|
223
|
-
const installed = await
|
|
227
|
+
async function registerToolPackageSource(tools, source, workspaceRoot, toolModuleDiscoveryScope) {
|
|
228
|
+
const installed = await ensurePackageSource(source, workspaceRoot);
|
|
229
|
+
const toolsRoot = path.join(installed.packageRoot, "tools");
|
|
230
|
+
if (existsSync(toolsRoot)) {
|
|
231
|
+
await registerToolFolderSource(tools, toolsRoot, toolModuleDiscoveryScope);
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
if (!installed.entryPath) {
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
224
237
|
const imported = await import(pathToFileURL(installed.entryPath).href);
|
|
225
238
|
const definitions = discoverToolModuleDefinitions("", imported);
|
|
226
239
|
for (const definition of definitions) {
|
|
@@ -347,7 +360,7 @@ export async function loadWorkspace(workspaceRoot, options = {}) {
|
|
|
347
360
|
continue;
|
|
348
361
|
}
|
|
349
362
|
if (isNpmSourceUri(source)) {
|
|
350
|
-
await traceStartupStage("workspace.register.toolPackageSource", () => registerToolPackageSource(tools, source, workspaceRoot), {
|
|
363
|
+
await traceStartupStage("workspace.register.toolPackageSource", () => registerToolPackageSource(tools, source, workspaceRoot, toolModuleDiscoveryConfig.scope), {
|
|
351
364
|
workspaceRoot,
|
|
352
365
|
source,
|
|
353
366
|
});
|
|
@@ -402,6 +415,7 @@ export async function loadWorkspace(workspaceRoot, options = {}) {
|
|
|
402
415
|
const resources = Array.from(new Set([
|
|
403
416
|
...(localResourceRoot ? [localResourceRoot] : []),
|
|
404
417
|
...runtimeSources.tools.filter((source) => isNpmSourceUri(source)),
|
|
418
|
+
...runtimeSources.skills.filter((source) => isNpmSourceUri(source)),
|
|
405
419
|
...collectedResources,
|
|
406
420
|
]));
|
|
407
421
|
await traceStartupStage("workspace.validate.resources", async () => {
|
|
@@ -4,8 +4,8 @@ export type RuntimeSourceConfig = {
|
|
|
4
4
|
tools: string[];
|
|
5
5
|
skills: string[];
|
|
6
6
|
};
|
|
7
|
-
type
|
|
8
|
-
entryPath
|
|
7
|
+
type PackageSourceInstallation = {
|
|
8
|
+
entryPath?: string;
|
|
9
9
|
packageRoot: string;
|
|
10
10
|
packageName: string;
|
|
11
11
|
};
|
|
@@ -14,6 +14,6 @@ export declare function isFileSourceUri(value: string): boolean;
|
|
|
14
14
|
export declare function isNpmSourceUri(value: string): boolean;
|
|
15
15
|
export declare function isHttpSourceUri(value: string): boolean;
|
|
16
16
|
export declare function resolveFileSourcePath(uri: string, workspaceRoot: string): string;
|
|
17
|
-
export declare function
|
|
17
|
+
export declare function ensurePackageSource(uri: string, workspaceRoot: string): Promise<PackageSourceInstallation>;
|
|
18
18
|
export declare function ensureRemoteSkillSource(uri: string): Promise<string>;
|
|
19
19
|
export {};
|
|
@@ -113,7 +113,7 @@ function resolveInstalledPackageRoot(packageName, workspaceRoot) {
|
|
|
113
113
|
}
|
|
114
114
|
return null;
|
|
115
115
|
}
|
|
116
|
-
async function
|
|
116
|
+
async function installPackageSource(spec, workspaceRoot) {
|
|
117
117
|
const packageName = parseToolPackageName(spec, workspaceRoot);
|
|
118
118
|
const installRoot = packageInstallCacheRoot(spec);
|
|
119
119
|
const packageJsonPath = path.join(installRoot, "package.json");
|
|
@@ -136,7 +136,7 @@ async function installPackageToolSource(spec, workspaceRoot) {
|
|
|
136
136
|
entryPath: resolvePackageEntry(installedRoot, packageJson),
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
|
-
export async function
|
|
139
|
+
export async function ensurePackageSource(uri, workspaceRoot) {
|
|
140
140
|
if (!isNpmSourceUri(uri)) {
|
|
141
141
|
throw new Error(`Unsupported package source URI ${uri}`);
|
|
142
142
|
}
|
|
@@ -154,7 +154,7 @@ export async function ensureToolPackageSource(uri, workspaceRoot) {
|
|
|
154
154
|
entryPath: resolvePackageEntry(installedRoot, packageJson),
|
|
155
155
|
};
|
|
156
156
|
}
|
|
157
|
-
return
|
|
157
|
+
return installPackageSource(spec, workspaceRoot);
|
|
158
158
|
}
|
|
159
159
|
function parseSkillFrontmatterName(document) {
|
|
160
160
|
const match = document.match(/^---\s*\n([\s\S]*?)\n---\s*(?:\n|$)/);
|