@botbotgo/agent-harness 0.0.181 → 0.0.183
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 +13 -0
- package/README.zh.md +13 -0
- package/dist/package-version.d.ts +1 -1
- package/dist/package-version.js +1 -1
- package/dist/resource/sources.js +13 -20
- package/dist/workspace/compile.js +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -326,6 +326,19 @@ const runtime: AgentHarnessRuntime = await createAgentHarness("/absolute/path/to
|
|
|
326
326
|
|
|
327
327
|
`createAgentHarness(...)` loads the workspace, resolves `resources/`, initializes persistence under `runRoot`, and starts runtime maintenance.
|
|
328
328
|
|
|
329
|
+
`runtime.spec.resources` may attach multiple extra resource packages. Each entry may point either to a package root that contains `resources/`, or directly to a resource folder that contains its own `package.json`.
|
|
330
|
+
|
|
331
|
+
```yaml
|
|
332
|
+
apiVersion: agent-harness/v1alpha1
|
|
333
|
+
kind: Runtime
|
|
334
|
+
metadata:
|
|
335
|
+
name: default
|
|
336
|
+
spec:
|
|
337
|
+
resources:
|
|
338
|
+
- ../shared-tools
|
|
339
|
+
- file:../shared-skills
|
|
340
|
+
```
|
|
341
|
+
|
|
329
342
|
`createAgentHarness(..., { load })` accepts workspace loading controls.
|
|
330
343
|
|
|
331
344
|
Merge order is deterministic:
|
package/README.zh.md
CHANGED
|
@@ -322,6 +322,19 @@ const runtime: AgentHarnessRuntime = await createAgentHarness("/absolute/path/to
|
|
|
322
322
|
|
|
323
323
|
`createAgentHarness(...)` 会加载工作区、解析 `resources/`、在 `runRoot` 下初始化持久化,并启动运行时维护任务。
|
|
324
324
|
|
|
325
|
+
`runtime.spec.resources` 可以挂载多个额外资源包。每个条目既可以指向“包根目录下带有 `resources/` 的目录”,也可以直接指向“自身带有 `package.json` 的资源目录”。
|
|
326
|
+
|
|
327
|
+
```yaml
|
|
328
|
+
apiVersion: agent-harness/v1alpha1
|
|
329
|
+
kind: Runtime
|
|
330
|
+
metadata:
|
|
331
|
+
name: default
|
|
332
|
+
spec:
|
|
333
|
+
resources:
|
|
334
|
+
- ../shared-tools
|
|
335
|
+
- file:../shared-skills
|
|
336
|
+
```
|
|
337
|
+
|
|
325
338
|
`createAgentHarness(..., { load })` 支持工作区加载控制。
|
|
326
339
|
|
|
327
340
|
合并顺序是确定性的:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const AGENT_HARNESS_VERSION = "0.0.
|
|
1
|
+
export declare const AGENT_HARNESS_VERSION = "0.0.182";
|
package/dist/package-version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const AGENT_HARNESS_VERSION = "0.0.
|
|
1
|
+
export const AGENT_HARNESS_VERSION = "0.0.182";
|
package/dist/resource/sources.js
CHANGED
|
@@ -31,6 +31,15 @@ export function resolveResourcePackageRoot(root) {
|
|
|
31
31
|
}
|
|
32
32
|
return null;
|
|
33
33
|
}
|
|
34
|
+
function resolveExplicitResourceRoot(root) {
|
|
35
|
+
if (isDirectoryPath(root)) {
|
|
36
|
+
const packageJsonPath = path.join(root, "package.json");
|
|
37
|
+
if (existsSync(packageJsonPath)) {
|
|
38
|
+
return root;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return resolveResourcePackageRoot(root);
|
|
42
|
+
}
|
|
34
43
|
export function isExternalSourceLocator(value) {
|
|
35
44
|
return typeof value === "string" && /^(npm|tgz|file):/.test(value);
|
|
36
45
|
}
|
|
@@ -198,17 +207,9 @@ export async function ensureExternalResourceSource(locator, workspaceRoot) {
|
|
|
198
207
|
const parsed = parseExternalSourceLocator(locator);
|
|
199
208
|
const baseLocator = `${parsed.kind}:${parsed.spec}`;
|
|
200
209
|
const packageRoot = await ensureExternalSource(baseLocator, workspaceRoot);
|
|
201
|
-
const
|
|
202
|
-
if (!existsSync(resourcesRoot) || !statSync(resourcesRoot).isDirectory()) {
|
|
203
|
-
throw new Error(`External source ${baseLocator} is missing resources/.`);
|
|
204
|
-
}
|
|
205
|
-
const resourcePackageJson = path.join(resourcesRoot, "package.json");
|
|
206
|
-
if (!existsSync(resourcePackageJson)) {
|
|
207
|
-
throw new Error(`External source ${baseLocator} is missing resources/package.json.`);
|
|
208
|
-
}
|
|
209
|
-
const resourcePackageRoot = resolveResourcePackageRoot(packageRoot);
|
|
210
|
+
const resourcePackageRoot = resolveExplicitResourceRoot(packageRoot);
|
|
210
211
|
if (!resourcePackageRoot) {
|
|
211
|
-
throw new Error(`External source ${baseLocator} is missing resources/package.json.`);
|
|
212
|
+
throw new Error(`External source ${baseLocator} is missing a resource package root or resources/package.json.`);
|
|
212
213
|
}
|
|
213
214
|
return parsed.subpath ? path.join(resourcePackageRoot, parsed.subpath) : resourcePackageRoot;
|
|
214
215
|
}
|
|
@@ -235,17 +236,9 @@ export function resolveExternalResourcePath(locator, workspaceRoot) {
|
|
|
235
236
|
const parsed = parseExternalSourceLocator(locator);
|
|
236
237
|
const baseLocator = `${parsed.kind}:${parsed.spec}`;
|
|
237
238
|
const packageRoot = resolveExternalSourcePath(baseLocator, workspaceRoot);
|
|
238
|
-
const
|
|
239
|
-
if (!existsSync(resourcesRoot) || !statSync(resourcesRoot).isDirectory()) {
|
|
240
|
-
throw new Error(`External source ${baseLocator} is missing resources/.`);
|
|
241
|
-
}
|
|
242
|
-
const resourcePackageJson = path.join(resourcesRoot, "package.json");
|
|
243
|
-
if (!existsSync(resourcePackageJson)) {
|
|
244
|
-
throw new Error(`External source ${baseLocator} is missing resources/package.json.`);
|
|
245
|
-
}
|
|
246
|
-
const resourcePackageRoot = resolveResourcePackageRoot(packageRoot);
|
|
239
|
+
const resourcePackageRoot = resolveExplicitResourceRoot(packageRoot);
|
|
247
240
|
if (!resourcePackageRoot) {
|
|
248
|
-
throw new Error(`External source ${baseLocator} is missing resources/package.json.`);
|
|
241
|
+
throw new Error(`External source ${baseLocator} is missing a resource package root or resources/package.json.`);
|
|
249
242
|
}
|
|
250
243
|
return parsed.subpath ? path.join(resourcePackageRoot, parsed.subpath) : resourcePackageRoot;
|
|
251
244
|
}
|
|
@@ -100,9 +100,10 @@ function validateRoutingTargets(refs, agentsList) {
|
|
|
100
100
|
}
|
|
101
101
|
function resolveLocalResourceRoot(candidate, workspaceRoot) {
|
|
102
102
|
const resolved = path.resolve(workspaceRoot, candidate);
|
|
103
|
-
const
|
|
103
|
+
const directPackageJsonPath = path.join(resolved, "package.json");
|
|
104
|
+
const resourceRoot = existsSync(directPackageJsonPath) ? resolved : resolveResourcePackageRoot(resolved);
|
|
104
105
|
if (!resourceRoot) {
|
|
105
|
-
throw new Error(`Workspace resource ${candidate} is missing resources/package.json.`);
|
|
106
|
+
throw new Error(`Workspace resource ${candidate} is missing package.json or resources/package.json.`);
|
|
106
107
|
}
|
|
107
108
|
return resourceRoot;
|
|
108
109
|
}
|