@botbotgo/agent-harness 0.0.308 → 0.0.310
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 +17 -1
- package/README.zh.md +17 -1
- package/dist/acp.d.ts +1 -116
- package/dist/acp.js +1 -310
- package/dist/api.d.ts +4 -2
- package/dist/api.js +4 -1
- package/dist/cli/chat-interactive.d.ts +24 -0
- package/dist/cli/chat-interactive.js +244 -0
- package/dist/cli/chat-rendering.d.ts +9 -0
- package/dist/cli/chat-rendering.js +102 -0
- package/dist/cli/chat-stream.d.ts +23 -0
- package/dist/cli/chat-stream.js +330 -0
- package/dist/cli/chat-ui.d.ts +20 -0
- package/dist/cli/chat-ui.js +198 -0
- package/dist/cli/chat-workspace.d.ts +15 -0
- package/dist/cli/chat-workspace.js +205 -0
- package/dist/cli/main.d.ts +52 -0
- package/dist/cli/main.js +323 -0
- package/dist/cli/managed-service-commands.d.ts +23 -0
- package/dist/cli/managed-service-commands.js +63 -0
- package/dist/cli/managed-service.d.ts +27 -0
- package/dist/cli/managed-service.js +61 -0
- package/dist/cli/options-init-chat.d.ts +16 -0
- package/dist/cli/options-init-chat.js +108 -0
- package/dist/cli/options-runtime.d.ts +27 -0
- package/dist/cli/options-runtime.js +158 -0
- package/dist/cli/options-serve.d.ts +24 -0
- package/dist/cli/options-serve.js +166 -0
- package/dist/cli/options.d.ts +5 -0
- package/dist/cli/options.js +47 -0
- package/dist/cli/process-guards.d.ts +14 -0
- package/dist/cli/process-guards.js +139 -0
- package/dist/cli/request-tree.d.ts +12 -0
- package/dist/cli/request-tree.js +296 -0
- package/dist/cli/runtime-commands.d.ts +15 -0
- package/dist/cli/runtime-commands.js +247 -0
- package/dist/cli/runtime-output.d.ts +5 -0
- package/dist/cli/runtime-output.js +124 -0
- package/dist/cli/server-commands.d.ts +36 -0
- package/dist/cli/server-commands.js +250 -0
- package/dist/cli/workspace.d.ts +6 -0
- package/dist/cli/workspace.js +71 -0
- package/dist/cli.d.ts +1 -67
- package/dist/cli.js +2 -2734
- package/dist/client/acp.d.ts +1 -50
- package/dist/client/acp.js +1 -219
- package/dist/client/in-process.d.ts +5 -5
- package/dist/client/index.d.ts +2 -2
- package/dist/client/index.js +1 -1
- package/dist/contracts/runtime-evaluation.d.ts +103 -0
- package/dist/contracts/runtime-evaluation.js +1 -0
- package/dist/contracts/runtime-memory.d.ts +162 -0
- package/dist/contracts/runtime-memory.js +1 -0
- package/dist/contracts/runtime-observability.d.ts +248 -0
- package/dist/contracts/runtime-observability.js +1 -0
- package/dist/contracts/runtime-requests.d.ts +342 -0
- package/dist/contracts/runtime-requests.js +1 -0
- package/dist/contracts/runtime-scheduling.d.ts +146 -0
- package/dist/contracts/runtime-scheduling.js +1 -0
- package/dist/contracts/runtime.d.ts +5 -1042
- package/dist/contracts/runtime.js +27 -1
- package/dist/flow/build-flow-graph.js +4 -875
- package/dist/flow/flow-graph-normalization.d.ts +56 -0
- package/dist/flow/flow-graph-normalization.js +214 -0
- package/dist/flow/flow-graph-runtime.d.ts +8 -0
- package/dist/flow/flow-graph-runtime.js +107 -0
- package/dist/flow/flow-graph-upstream.d.ts +18 -0
- package/dist/flow/flow-graph-upstream.js +498 -0
- package/dist/flow/types.d.ts +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/init-project.d.ts +1 -12
- package/dist/init-project.js +1 -651
- package/dist/{procedural → knowledge/procedural}/manager.d.ts +3 -3
- package/dist/{procedural → knowledge/procedural}/manager.js +6 -6
- package/dist/mcp.d.ts +2 -62
- package/dist/mcp.js +2 -253
- package/dist/package-version.d.ts +1 -1
- package/dist/package-version.js +1 -1
- package/dist/persistence/file-store.js +1 -1
- package/dist/persistence/sqlite-runtime.d.ts +19 -0
- package/dist/persistence/sqlite-runtime.js +86 -0
- package/dist/persistence/sqlite-store.js +11 -99
- package/dist/{request-events.d.ts → projections/request-events.d.ts} +1 -1
- package/dist/{upstream-events.js → projections/upstream-events.js} +1 -1
- package/dist/protocol/a2a/http-discovery.d.ts +39 -0
- package/dist/protocol/a2a/http-discovery.js +178 -0
- package/dist/protocol/a2a/http-rpc.d.ts +28 -0
- package/dist/protocol/a2a/http-rpc.js +623 -0
- package/dist/protocol/a2a/http.d.ts +72 -1
- package/dist/protocol/a2a/http.js +14 -1124
- package/dist/protocol/a2a/task-state.d.ts +29 -0
- package/dist/protocol/a2a/task-state.js +317 -0
- package/dist/protocol/acp/client.js +1 -1
- package/dist/protocol/acp/harness-client.d.ts +50 -0
- package/dist/protocol/acp/harness-client.js +219 -0
- package/dist/protocol/acp/server.d.ts +116 -0
- package/dist/protocol/acp/server.js +310 -0
- package/dist/protocol/ag-ui/http.js +1 -1
- package/dist/protocol/mcp/server.d.ts +76 -0
- package/dist/protocol/mcp/server.js +428 -0
- package/dist/resource/backend/workspace-scoped-backend.d.ts +40 -0
- package/dist/resource/backend/workspace-scoped-backend.js +296 -0
- package/dist/resource/mcp/tool-support.d.ts +35 -0
- package/dist/resource/mcp/tool-support.js +296 -0
- package/dist/resource/mcp-tool-support.d.ts +2 -35
- package/dist/resource/mcp-tool-support.js +2 -296
- package/dist/resource/providers/resource-provider.d.ts +22 -0
- package/dist/resource/providers/resource-provider.js +215 -0
- package/dist/resource/resource-impl.d.ts +3 -33
- package/dist/resource/resource-impl.js +2 -808
- package/dist/resource/resource-types.d.ts +33 -0
- package/dist/resource/resource-types.js +1 -0
- package/dist/resource/tools/function-tool-resolver.d.ts +2 -0
- package/dist/resource/tools/function-tool-resolver.js +306 -0
- package/dist/runtime/adapter/middleware-assembly.js +1 -1
- package/dist/runtime/adapter/model/invocation-request.js +2 -2
- package/dist/runtime/adapter/model/message-assembly.js +1 -1
- package/dist/runtime/agent-runtime-adapter.d.ts +3 -63
- package/dist/runtime/agent-runtime-adapter.js +5 -233
- package/dist/runtime/agent-runtime-assembly.d.ts +67 -0
- package/dist/runtime/agent-runtime-assembly.js +211 -0
- package/dist/runtime/harness/background-runtime.d.ts +1 -1
- package/dist/runtime/harness/events/event-sink.js +1 -1
- package/dist/runtime/harness/events/runtime-event-operations.d.ts +1 -1
- package/dist/runtime/harness/events/streaming.js +1 -1
- package/dist/runtime/harness/public-shapes.d.ts +43 -0
- package/dist/runtime/harness/public-shapes.js +186 -0
- package/dist/runtime/harness/run/inspection.js +2 -2
- package/dist/runtime/harness/run/resources.js +1 -1
- package/dist/runtime/harness/run/surface-semantics.js +1 -1
- package/dist/runtime/harness/system/inventory.d.ts +1 -1
- package/dist/runtime/harness/system/inventory.js +2 -2
- package/dist/runtime/harness/system/policy-engine.js +1 -1
- package/dist/runtime/harness/system/runtime-memory-manager.js +1 -1
- package/dist/runtime/harness/system/skill-requirements.d.ts +1 -1
- package/dist/runtime/harness/system/skill-requirements.js +1 -1
- package/dist/runtime/harness.d.ts +3 -2
- package/dist/runtime/harness.js +11 -191
- package/dist/runtime/maintenance/checkpoint-maintenance.js +1 -1
- package/dist/runtime/maintenance/runtime-record-maintenance.js +1 -1
- package/dist/runtime/parsing/output-content.d.ts +11 -0
- package/dist/runtime/parsing/output-content.js +442 -0
- package/dist/runtime/parsing/output-parsing.d.ts +3 -29
- package/dist/runtime/parsing/output-parsing.js +3 -806
- package/dist/runtime/parsing/output-recovery.d.ts +14 -0
- package/dist/runtime/parsing/output-recovery.js +288 -0
- package/dist/runtime/parsing/output-tool-args.d.ts +4 -0
- package/dist/runtime/parsing/output-tool-args.js +120 -0
- package/dist/runtime/support/runtime-factories.js +1 -1
- package/dist/scaffold/init-project.d.ts +12 -0
- package/dist/scaffold/init-project.js +651 -0
- package/dist/{extensions.d.ts → tooling/extensions.d.ts} +1 -1
- package/dist/{extensions.js → tooling/extensions.js} +3 -3
- package/dist/{tool-modules.d.ts → tooling/module-loader.d.ts} +1 -1
- package/dist/{tool-modules.js → tooling/module-loader.js} +2 -2
- package/dist/workspace/agent-binding-compiler.js +2 -2
- package/dist/workspace/compile.js +2 -2
- package/dist/workspace/object-loader-paths.d.ts +11 -0
- package/dist/workspace/object-loader-paths.js +75 -0
- package/dist/workspace/object-loader-readers.d.ts +21 -0
- package/dist/workspace/object-loader-readers.js +187 -0
- package/dist/workspace/object-loader.d.ts +0 -1
- package/dist/workspace/object-loader.js +6 -260
- package/dist/workspace/resource-compilers.js +1 -1
- package/dist/workspace/support/discovery.js +1 -1
- package/package.json +1 -1
- package/dist/runtime/adapter/index.d.ts +0 -13
- package/dist/runtime/adapter/index.js +0 -13
- package/dist/runtime/harness/index.d.ts +0 -19
- package/dist/runtime/harness/index.js +0 -19
- package/dist/runtime/maintenance/index.d.ts +0 -4
- package/dist/runtime/maintenance/index.js +0 -4
- package/dist/runtime/parsing/index.d.ts +0 -2
- package/dist/runtime/parsing/index.js +0 -2
- package/dist/runtime/support/index.d.ts +0 -4
- package/dist/runtime/support/index.js +0 -4
- package/dist/workspace/support/index.d.ts +0 -2
- package/dist/workspace/support/index.js +0 -2
- /package/dist/{procedural → knowledge/procedural}/config.d.ts +0 -0
- /package/dist/{procedural → knowledge/procedural}/config.js +0 -0
- /package/dist/{procedural → knowledge/procedural}/index.d.ts +0 -0
- /package/dist/{procedural → knowledge/procedural}/index.js +0 -0
- /package/dist/{presentation.d.ts → projections/presentation.d.ts} +0 -0
- /package/dist/{presentation.js → projections/presentation.js} +0 -0
- /package/dist/{request-events.js → projections/request-events.js} +0 -0
- /package/dist/{upstream-events.d.ts → projections/upstream-events.d.ts} +0 -0
- /package/dist/runtime/{support → env}/runtime-env.d.ts +0 -0
- /package/dist/runtime/{support → env}/runtime-env.js +0 -0
- /package/dist/runtime/{support → layout}/runtime-layout.d.ts +0 -0
- /package/dist/runtime/{support → layout}/runtime-layout.js +0 -0
- /package/dist/runtime/{support → prompts}/runtime-prompts.d.ts +0 -0
- /package/dist/runtime/{support → prompts}/runtime-prompts.js +0 -0
- /package/dist/runtime/{support → skills}/skill-metadata.d.ts +0 -0
- /package/dist/runtime/{support → skills}/skill-metadata.js +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { getSkillInheritancePolicy, resolveToolTargets } from "../extensions.js";
|
|
2
|
+
import { getSkillInheritancePolicy, resolveToolTargets } from "../tooling/extensions.js";
|
|
3
3
|
import { attachLegacyExecutionAliases } from "../utils/compiled-binding.js";
|
|
4
4
|
import { compileModel, compileTool } from "./resource-compilers.js";
|
|
5
5
|
import { inferAgentCapabilities } from "./support/agent-capabilities.js";
|
|
6
6
|
import { getAgentExecutionConfigValue, getAgentExecutionObject, getAgentExecutionString } from "./support/agent-execution-config.js";
|
|
7
7
|
import { discoverSkillPaths } from "./support/discovery.js";
|
|
8
8
|
import { compileAgentMemories, getProceduralMemoryDefaults, getResilienceConfig, getRuntimeDefaults, getRuntimeMemoryDefaults, getRuntimeStorageRoots, getWorkspaceObject, resolvePromptValue, resolveRefId, } from "./support/workspace-ref-utils.js";
|
|
9
|
-
import { WORKSPACE_BOUNDARY_GUIDANCE } from "../runtime/
|
|
9
|
+
import { WORKSPACE_BOUNDARY_GUIDANCE } from "../runtime/prompts/runtime-prompts.js";
|
|
10
10
|
function requireSkills(pathEntries, workspaceRoot) {
|
|
11
11
|
return Array.from(new Set(discoverSkillPaths(pathEntries, workspaceRoot)));
|
|
12
12
|
}
|
|
@@ -5,7 +5,7 @@ import { pathToFileURL } from "node:url";
|
|
|
5
5
|
import { ensureResourceSources } from "../resource/resource.js";
|
|
6
6
|
import { ensureExternalResourceSource, isExternalSourceLocator, resolveResourcePackageRoot } from "../resource/sources.js";
|
|
7
7
|
import { loadWorkspaceObjects, readToolModuleItems, readYamlItems } from "./object-loader.js";
|
|
8
|
-
import { validateSkillMetadata } from "../runtime/
|
|
8
|
+
import { validateSkillMetadata } from "../runtime/skills/skill-metadata.js";
|
|
9
9
|
import { parseEmbeddingModelObject, parseMcpServerObject, parseModelObject, parseToolObject, parseVectorStoreObject, validateEmbeddingModelObject, validateMcpServerObject, validateModelObject, validateToolObject, validateVectorStoreObject, } from "./resource-compilers.js";
|
|
10
10
|
import { validateAgent, validateTopology } from "./validate.js";
|
|
11
11
|
import { compileBinding } from "./agent-binding-compiler.js";
|
|
@@ -16,7 +16,7 @@ import { hydrateAgentMcpTools, hydrateResourceAndExternalTools } from "./tool-hy
|
|
|
16
16
|
import { traceStartupStage } from "../runtime/startup-tracing.js";
|
|
17
17
|
import { shouldSkipScanDirectory } from "../utils/fs.js";
|
|
18
18
|
import { ensureRemoteSkillSource, ensureToolPackageSource, isFileSourceUri, isHttpSourceUri, isNpmSourceUri, resolveFileSourcePath, } from "./support/source-protocols.js";
|
|
19
|
-
import { discoverToolModuleDefinitions } from "../
|
|
19
|
+
import { discoverToolModuleDefinitions } from "../tooling/module-loader.js";
|
|
20
20
|
function mergeObjectValues(base, override) {
|
|
21
21
|
if (override === undefined) {
|
|
22
22
|
return base;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const CONVENTIONAL_OBJECT_DIRECTORIES: readonly ["tools"];
|
|
2
|
+
export declare const MODULE_AGENT_FILENAMES: readonly ["agent.yaml", "agent.yml"];
|
|
3
|
+
export declare const MODULE_TOOL_FILENAMES: readonly ["tool.yaml", "tool.yml"];
|
|
4
|
+
export declare const MODULE_TOOL_ENTRY_FILENAMES: readonly ["index.mjs", "index.js", "index.cjs"];
|
|
5
|
+
export declare function moduleCollectionRoot(root: string, kind: "agents" | "tools" | "skills"): string;
|
|
6
|
+
export declare function moduleRootForSourcePath(sourcePath: string, kind: "agents" | "tools"): string | undefined;
|
|
7
|
+
export declare function conventionalConfigRoot(root: string): string | null;
|
|
8
|
+
export declare function conventionalPackageRoots(root: string, relativeDir: "tools" | "skills"): string[];
|
|
9
|
+
export declare function conventionalObjectRoots(root: string): string[];
|
|
10
|
+
export declare function frameworkWorkspaceRoot(): string;
|
|
11
|
+
export declare function resolveModuleRelativePath(value: string, moduleRoot: string | undefined): string;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { existsSync, statSync } from "node:fs";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { isExternalSourceLocator, resolveResourcePackageRoot } from "../resource/sources.js";
|
|
5
|
+
export const CONVENTIONAL_OBJECT_DIRECTORIES = ["tools"];
|
|
6
|
+
export const MODULE_AGENT_FILENAMES = ["agent.yaml", "agent.yml"];
|
|
7
|
+
export const MODULE_TOOL_FILENAMES = ["tool.yaml", "tool.yml"];
|
|
8
|
+
export const MODULE_TOOL_ENTRY_FILENAMES = ["index.mjs", "index.js", "index.cjs"];
|
|
9
|
+
export function moduleCollectionRoot(root, kind) {
|
|
10
|
+
return path.join(root, "modules", kind);
|
|
11
|
+
}
|
|
12
|
+
function isModuleDefinitionPath(sourcePath, kind) {
|
|
13
|
+
const normalized = sourcePath.split(path.sep).join("/");
|
|
14
|
+
const suffix = kind === "agents" ? "/agent.yaml" : "/tool.yaml";
|
|
15
|
+
const altSuffix = kind === "agents" ? "/agent.yml" : "/tool.yml";
|
|
16
|
+
return normalized.includes(`/modules/${kind}/`) && (normalized.endsWith(suffix) || normalized.endsWith(altSuffix));
|
|
17
|
+
}
|
|
18
|
+
export function moduleRootForSourcePath(sourcePath, kind) {
|
|
19
|
+
if (!isModuleDefinitionPath(sourcePath, kind)) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
return path.dirname(sourcePath);
|
|
23
|
+
}
|
|
24
|
+
export function conventionalConfigRoot(root) {
|
|
25
|
+
if (path.basename(root) === "config" && existsSync(root) && statSync(root).isDirectory()) {
|
|
26
|
+
return root;
|
|
27
|
+
}
|
|
28
|
+
const candidate = path.join(root, "config");
|
|
29
|
+
if (existsSync(candidate) && statSync(candidate).isDirectory()) {
|
|
30
|
+
return candidate;
|
|
31
|
+
}
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
function conventionalDirectoryRoots(root, relativeDir) {
|
|
35
|
+
const resourceRoot = resolveResourcePackageRoot(root);
|
|
36
|
+
const candidates = [
|
|
37
|
+
...(resourceRoot ? [path.join(resourceRoot, relativeDir)] : []),
|
|
38
|
+
path.join(root, relativeDir),
|
|
39
|
+
];
|
|
40
|
+
return Array.from(new Set(candidates));
|
|
41
|
+
}
|
|
42
|
+
export function conventionalPackageRoots(root, relativeDir) {
|
|
43
|
+
const resourceRoot = resolveResourcePackageRoot(root);
|
|
44
|
+
const candidates = resourceRoot ? [path.join(resourceRoot, relativeDir), resourceRoot] : [];
|
|
45
|
+
return Array.from(new Set(candidates));
|
|
46
|
+
}
|
|
47
|
+
export function conventionalObjectRoots(root) {
|
|
48
|
+
return CONVENTIONAL_OBJECT_DIRECTORIES.flatMap((directory) => conventionalDirectoryRoots(root, directory));
|
|
49
|
+
}
|
|
50
|
+
export function frameworkWorkspaceRoot() {
|
|
51
|
+
const resolved = fileURLToPath(new URL("../..", import.meta.url));
|
|
52
|
+
const distSegment = `${path.sep}dist`;
|
|
53
|
+
if (!resolved.endsWith(distSegment)) {
|
|
54
|
+
return resolved;
|
|
55
|
+
}
|
|
56
|
+
const sourceRoot = resolved.slice(0, -distSegment.length);
|
|
57
|
+
if (!existsSync(sourceRoot)) {
|
|
58
|
+
return resolved;
|
|
59
|
+
}
|
|
60
|
+
try {
|
|
61
|
+
return statSync(sourceRoot).mtimeMs >= statSync(resolved).mtimeMs ? sourceRoot : resolved;
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
return sourceRoot;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function isModuleRelativePathCandidate(value) {
|
|
68
|
+
return !path.isAbsolute(value) && !isExternalSourceLocator(value) && !value.includes("://");
|
|
69
|
+
}
|
|
70
|
+
export function resolveModuleRelativePath(value, moduleRoot) {
|
|
71
|
+
if (!moduleRoot || !isModuleRelativePathCandidate(value)) {
|
|
72
|
+
return value;
|
|
73
|
+
}
|
|
74
|
+
return path.resolve(moduleRoot, value);
|
|
75
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ParsedAgentObject, ParsedAgentToolBinding } from "../contracts/types.js";
|
|
2
|
+
export declare function toArray(value: unknown): unknown[];
|
|
3
|
+
export declare function asObject(value: unknown): Record<string, unknown> | undefined;
|
|
4
|
+
export declare function asMutableObject(value: unknown): Record<string, unknown> | undefined;
|
|
5
|
+
export declare function cloneConfigValue(value: unknown): unknown;
|
|
6
|
+
export declare function readRefArray(items: unknown): string[];
|
|
7
|
+
export declare function readStringRecord(value: unknown): Record<string, string> | undefined;
|
|
8
|
+
export declare function readAsyncSubAgentArray(items: unknown): ParsedAgentObject["asyncSubagents"];
|
|
9
|
+
export declare function readPrefixedRefArray(items: unknown, prefix: string): string[];
|
|
10
|
+
export declare function normalizeToolUsageOverrides(value: unknown): Record<string, unknown> | undefined;
|
|
11
|
+
export declare function readToolBindingArray(items: unknown): ParsedAgentToolBinding[];
|
|
12
|
+
export declare function readPathArray(items: unknown): string[];
|
|
13
|
+
export declare function readStringArray(items: unknown): string[];
|
|
14
|
+
export declare function readSingleRef(value: unknown): string | undefined;
|
|
15
|
+
export declare function readMiddlewareArray(items: unknown): Array<Record<string, unknown>> | undefined;
|
|
16
|
+
export declare function readObjectArray(items: unknown): Array<Record<string, unknown>> | undefined;
|
|
17
|
+
export declare function readMcpServerArray(items: unknown): Array<Record<string, unknown>> | undefined;
|
|
18
|
+
export declare function readCapabilities(value: unknown): {
|
|
19
|
+
delegation?: boolean;
|
|
20
|
+
memory?: boolean;
|
|
21
|
+
} | undefined;
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
export function toArray(value) {
|
|
2
|
+
return Array.isArray(value) ? value : [];
|
|
3
|
+
}
|
|
4
|
+
export function asObject(value) {
|
|
5
|
+
return typeof value === "object" && value ? value : undefined;
|
|
6
|
+
}
|
|
7
|
+
export function asMutableObject(value) {
|
|
8
|
+
return typeof value === "object" && value !== null && !Array.isArray(value)
|
|
9
|
+
? { ...value }
|
|
10
|
+
: undefined;
|
|
11
|
+
}
|
|
12
|
+
export function cloneConfigValue(value) {
|
|
13
|
+
if (Array.isArray(value)) {
|
|
14
|
+
return value.map((item) => cloneConfigValue(item));
|
|
15
|
+
}
|
|
16
|
+
if (typeof value === "object" && value !== null) {
|
|
17
|
+
return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, cloneConfigValue(entry)]));
|
|
18
|
+
}
|
|
19
|
+
return value;
|
|
20
|
+
}
|
|
21
|
+
export function readRefArray(items) {
|
|
22
|
+
return toArray(items)
|
|
23
|
+
.map((item) => typeof item === "string"
|
|
24
|
+
? item
|
|
25
|
+
: typeof item === "object" && item && "ref" in item
|
|
26
|
+
? item.ref
|
|
27
|
+
: undefined)
|
|
28
|
+
.filter((item) => Boolean(item));
|
|
29
|
+
}
|
|
30
|
+
export function readStringRecord(value) {
|
|
31
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
const entries = Object.entries(value)
|
|
35
|
+
.filter((entry) => typeof entry[1] === "string");
|
|
36
|
+
return entries.length > 0 ? Object.fromEntries(entries) : undefined;
|
|
37
|
+
}
|
|
38
|
+
export function readAsyncSubAgentArray(items) {
|
|
39
|
+
return toArray(items)
|
|
40
|
+
.flatMap((item) => {
|
|
41
|
+
if (typeof item !== "object" || item === null || Array.isArray(item)) {
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
44
|
+
const typed = item;
|
|
45
|
+
const name = typeof typed.name === "string" ? typed.name.trim() : "";
|
|
46
|
+
const description = typeof typed.description === "string" ? typed.description.trim() : "";
|
|
47
|
+
const graphId = typeof typed.graphId === "string" ? typed.graphId.trim() : "";
|
|
48
|
+
if (!name || !description || !graphId) {
|
|
49
|
+
return [];
|
|
50
|
+
}
|
|
51
|
+
const headers = readStringRecord(typed.headers);
|
|
52
|
+
return [{
|
|
53
|
+
name,
|
|
54
|
+
description,
|
|
55
|
+
graphId,
|
|
56
|
+
...(typeof typed.url === "string" && typed.url.trim().length > 0 ? { url: typed.url.trim() } : {}),
|
|
57
|
+
...(headers ? { headers } : {}),
|
|
58
|
+
}];
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
export function readPrefixedRefArray(items, prefix) {
|
|
62
|
+
return toArray(items)
|
|
63
|
+
.map((item) => {
|
|
64
|
+
if (typeof item === "string") {
|
|
65
|
+
const value = item.trim();
|
|
66
|
+
if (!value) {
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
return value.startsWith(`${prefix}/`) ? value : `${prefix}/${value}`;
|
|
70
|
+
}
|
|
71
|
+
if (typeof item === "object" && item && "ref" in item && typeof item.ref === "string") {
|
|
72
|
+
const value = String(item.ref).trim();
|
|
73
|
+
return value || undefined;
|
|
74
|
+
}
|
|
75
|
+
return undefined;
|
|
76
|
+
})
|
|
77
|
+
.filter((item) => Boolean(item));
|
|
78
|
+
}
|
|
79
|
+
export function normalizeToolUsageOverrides(value) {
|
|
80
|
+
const record = asMutableObject(value);
|
|
81
|
+
if (!record) {
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
const directKeys = new Set(["config", "hitl", "retryable", "subprocess", "embeddingModel", "embeddingModelRef"]);
|
|
85
|
+
const directOverrides = {};
|
|
86
|
+
const configOverrides = {};
|
|
87
|
+
for (const [key, entry] of Object.entries(record)) {
|
|
88
|
+
if (directKeys.has(key)) {
|
|
89
|
+
directOverrides[key] = cloneConfigValue(entry);
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
configOverrides[key] = cloneConfigValue(entry);
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
...directOverrides,
|
|
96
|
+
...(Object.keys(configOverrides).length > 0
|
|
97
|
+
? {
|
|
98
|
+
config: {
|
|
99
|
+
...(asMutableObject(directOverrides.config) ?? {}),
|
|
100
|
+
...configOverrides,
|
|
101
|
+
},
|
|
102
|
+
}
|
|
103
|
+
: {}),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
export function readToolBindingArray(items) {
|
|
107
|
+
return toArray(items)
|
|
108
|
+
.map((item) => {
|
|
109
|
+
if (typeof item === "string") {
|
|
110
|
+
return { ref: item };
|
|
111
|
+
}
|
|
112
|
+
if (typeof item !== "object" || !item || Array.isArray(item)) {
|
|
113
|
+
return undefined;
|
|
114
|
+
}
|
|
115
|
+
const entries = Object.entries(item);
|
|
116
|
+
if (entries.length !== 1 || typeof entries[0]?.[0] !== "string") {
|
|
117
|
+
throw new Error("Agent tools entries must be either a tool name string or a single-key override object");
|
|
118
|
+
}
|
|
119
|
+
const [ref, rawOverride] = entries[0];
|
|
120
|
+
const overrides = normalizeToolUsageOverrides(rawOverride);
|
|
121
|
+
return {
|
|
122
|
+
ref,
|
|
123
|
+
...(overrides ? { overrides } : {}),
|
|
124
|
+
};
|
|
125
|
+
})
|
|
126
|
+
.filter((item) => Boolean(item));
|
|
127
|
+
}
|
|
128
|
+
export function readPathArray(items) {
|
|
129
|
+
return toArray(items)
|
|
130
|
+
.map((item) => typeof item === "string"
|
|
131
|
+
? item
|
|
132
|
+
: typeof item === "object" && item && "path" in item && typeof item.path === "string"
|
|
133
|
+
? item.path
|
|
134
|
+
: undefined)
|
|
135
|
+
.filter((item) => Boolean(item));
|
|
136
|
+
}
|
|
137
|
+
export function readStringArray(items) {
|
|
138
|
+
return toArray(items)
|
|
139
|
+
.filter((item) => typeof item === "string" && item.trim().length > 0)
|
|
140
|
+
.map((item) => item.trim());
|
|
141
|
+
}
|
|
142
|
+
export function readSingleRef(value) {
|
|
143
|
+
if (typeof value === "string" && value.trim()) {
|
|
144
|
+
return value;
|
|
145
|
+
}
|
|
146
|
+
if (typeof value === "object" && value && "ref" in value && typeof value.ref === "string") {
|
|
147
|
+
return value.ref;
|
|
148
|
+
}
|
|
149
|
+
return undefined;
|
|
150
|
+
}
|
|
151
|
+
export function readMiddlewareArray(items) {
|
|
152
|
+
const middleware = toArray(items)
|
|
153
|
+
.filter((item) => typeof item === "object" && item !== null && !Array.isArray(item))
|
|
154
|
+
.map((item) => ({ ...item }));
|
|
155
|
+
return middleware.length > 0 ? middleware : undefined;
|
|
156
|
+
}
|
|
157
|
+
export function readObjectArray(items) {
|
|
158
|
+
const records = toArray(items)
|
|
159
|
+
.filter((item) => typeof item === "object" && item !== null && !Array.isArray(item))
|
|
160
|
+
.map((item) => ({ ...item }));
|
|
161
|
+
return records.length > 0 ? records : undefined;
|
|
162
|
+
}
|
|
163
|
+
export function readMcpServerArray(items) {
|
|
164
|
+
const records = toArray(items)
|
|
165
|
+
.map((item) => {
|
|
166
|
+
if (typeof item === "string" && item.trim()) {
|
|
167
|
+
return { ref: item.startsWith("mcp/") ? item : `mcp/${item.trim()}` };
|
|
168
|
+
}
|
|
169
|
+
if (typeof item === "object" && item !== null && !Array.isArray(item)) {
|
|
170
|
+
return { ...item };
|
|
171
|
+
}
|
|
172
|
+
return undefined;
|
|
173
|
+
})
|
|
174
|
+
.filter((item) => Boolean(item));
|
|
175
|
+
return records.length > 0 ? records : undefined;
|
|
176
|
+
}
|
|
177
|
+
export function readCapabilities(value) {
|
|
178
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
179
|
+
return undefined;
|
|
180
|
+
}
|
|
181
|
+
const typed = value;
|
|
182
|
+
const capabilities = {
|
|
183
|
+
...(typeof typed.delegation === "boolean" ? { delegation: typed.delegation } : {}),
|
|
184
|
+
...(typeof typed.memory === "boolean" ? { memory: typed.memory } : {}),
|
|
185
|
+
};
|
|
186
|
+
return Object.keys(capabilities).length > 0 ? capabilities : undefined;
|
|
187
|
+
}
|
|
@@ -6,7 +6,6 @@ export type WorkspaceObjects = {
|
|
|
6
6
|
refs: RefMap;
|
|
7
7
|
agents: ParsedAgentObject[];
|
|
8
8
|
};
|
|
9
|
-
export declare function conventionalPackageRoots(root: string, relativeDir: "tools" | "skills"): string[];
|
|
10
9
|
export declare function parseAgentItem(item: Record<string, unknown>, sourcePath: string): ParsedAgentObject;
|
|
11
10
|
export declare function readToolModuleItems(root: string, options?: {
|
|
12
11
|
scope?: ToolModuleDiscoveryScope;
|
|
@@ -1,251 +1,15 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { existsSync
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
3
|
import { readdir, readFile, stat } from "node:fs/promises";
|
|
4
|
-
import {
|
|
4
|
+
import { pathToFileURL } from "node:url";
|
|
5
5
|
import { resolveIsolatedResourceModulePath } from "../resource/isolation.js";
|
|
6
|
-
import {
|
|
7
|
-
import { discoverToolModuleDefinitions, isSupportedToolModulePath, loadToolModuleDefinition } from "../tool-modules.js";
|
|
6
|
+
import { discoverToolModuleDefinitions, isSupportedToolModulePath, loadToolModuleDefinition } from "../tooling/module-loader.js";
|
|
8
7
|
import { fileExists, shouldSkipScanDirectory } from "../utils/fs.js";
|
|
9
8
|
import { isFileSourceUri, readRuntimeSources, resolveFileSourcePath } from "./support/source-protocols.js";
|
|
10
9
|
import { readNamedYamlItems, readYamlItems, } from "./yaml-object-reader.js";
|
|
10
|
+
import { CONVENTIONAL_OBJECT_DIRECTORIES, MODULE_AGENT_FILENAMES, MODULE_TOOL_ENTRY_FILENAMES, MODULE_TOOL_FILENAMES, conventionalConfigRoot, conventionalObjectRoots, frameworkWorkspaceRoot, moduleCollectionRoot, moduleRootForSourcePath, resolveModuleRelativePath, } from "./object-loader-paths.js";
|
|
11
|
+
import { asMutableObject, asObject, cloneConfigValue, readAsyncSubAgentArray, readCapabilities, readMcpServerArray, readMiddlewareArray, readPathArray, readPrefixedRefArray, readRefArray, readSingleRef, readToolBindingArray, } from "./object-loader-readers.js";
|
|
11
12
|
export { normalizeYamlItem, readYamlItems } from "./yaml-object-reader.js";
|
|
12
|
-
const CONVENTIONAL_OBJECT_DIRECTORIES = ["tools"];
|
|
13
|
-
const MODULE_AGENT_FILENAMES = ["agent.yaml", "agent.yml"];
|
|
14
|
-
const MODULE_TOOL_FILENAMES = ["tool.yaml", "tool.yml"];
|
|
15
|
-
const MODULE_TOOL_ENTRY_FILENAMES = ["index.mjs", "index.js", "index.cjs"];
|
|
16
|
-
function moduleCollectionRoot(root, kind) {
|
|
17
|
-
return path.join(root, "modules", kind);
|
|
18
|
-
}
|
|
19
|
-
function isModuleDefinitionPath(sourcePath, kind) {
|
|
20
|
-
const normalized = sourcePath.split(path.sep).join("/");
|
|
21
|
-
const suffix = kind === "agents" ? "/agent.yaml" : "/tool.yaml";
|
|
22
|
-
const altSuffix = kind === "agents" ? "/agent.yml" : "/tool.yml";
|
|
23
|
-
return normalized.includes(`/modules/${kind}/`) && (normalized.endsWith(suffix) || normalized.endsWith(altSuffix));
|
|
24
|
-
}
|
|
25
|
-
function moduleRootForSourcePath(sourcePath, kind) {
|
|
26
|
-
if (!isModuleDefinitionPath(sourcePath, kind)) {
|
|
27
|
-
return undefined;
|
|
28
|
-
}
|
|
29
|
-
return path.dirname(sourcePath);
|
|
30
|
-
}
|
|
31
|
-
function conventionalConfigRoot(root) {
|
|
32
|
-
if (path.basename(root) === "config" && existsSync(root) && statSync(root).isDirectory()) {
|
|
33
|
-
return root;
|
|
34
|
-
}
|
|
35
|
-
const candidate = path.join(root, "config");
|
|
36
|
-
if (existsSync(candidate) && statSync(candidate).isDirectory()) {
|
|
37
|
-
return candidate;
|
|
38
|
-
}
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
function conventionalDirectoryRoots(root, relativeDir) {
|
|
42
|
-
const resourceRoot = resolveResourcePackageRoot(root);
|
|
43
|
-
const candidates = [
|
|
44
|
-
...(resourceRoot ? [path.join(resourceRoot, relativeDir)] : []),
|
|
45
|
-
path.join(root, relativeDir),
|
|
46
|
-
];
|
|
47
|
-
return Array.from(new Set(candidates));
|
|
48
|
-
}
|
|
49
|
-
export function conventionalPackageRoots(root, relativeDir) {
|
|
50
|
-
const resourceRoot = resolveResourcePackageRoot(root);
|
|
51
|
-
const candidates = resourceRoot ? [path.join(resourceRoot, relativeDir), resourceRoot] : [];
|
|
52
|
-
return Array.from(new Set(candidates));
|
|
53
|
-
}
|
|
54
|
-
function frameworkWorkspaceRoot() {
|
|
55
|
-
const resolved = fileURLToPath(new URL("../..", import.meta.url));
|
|
56
|
-
const distSegment = `${path.sep}dist`;
|
|
57
|
-
if (!resolved.endsWith(distSegment)) {
|
|
58
|
-
return resolved;
|
|
59
|
-
}
|
|
60
|
-
const sourceRoot = resolved.slice(0, -distSegment.length);
|
|
61
|
-
if (!existsSync(sourceRoot)) {
|
|
62
|
-
return resolved;
|
|
63
|
-
}
|
|
64
|
-
try {
|
|
65
|
-
return statSync(sourceRoot).mtimeMs >= statSync(resolved).mtimeMs ? sourceRoot : resolved;
|
|
66
|
-
}
|
|
67
|
-
catch {
|
|
68
|
-
return sourceRoot;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
function toArray(value) {
|
|
72
|
-
return Array.isArray(value) ? value : [];
|
|
73
|
-
}
|
|
74
|
-
function asObject(value) {
|
|
75
|
-
return typeof value === "object" && value ? value : undefined;
|
|
76
|
-
}
|
|
77
|
-
function asMutableObject(value) {
|
|
78
|
-
return typeof value === "object" && value !== null && !Array.isArray(value)
|
|
79
|
-
? { ...value }
|
|
80
|
-
: undefined;
|
|
81
|
-
}
|
|
82
|
-
function readRefArray(items) {
|
|
83
|
-
return toArray(items)
|
|
84
|
-
.map((item) => typeof item === "string"
|
|
85
|
-
? item
|
|
86
|
-
: typeof item === "object" && item && "ref" in item
|
|
87
|
-
? item.ref
|
|
88
|
-
: undefined)
|
|
89
|
-
.filter((item) => Boolean(item));
|
|
90
|
-
}
|
|
91
|
-
function readStringRecord(value) {
|
|
92
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
93
|
-
return undefined;
|
|
94
|
-
}
|
|
95
|
-
const entries = Object.entries(value)
|
|
96
|
-
.filter((entry) => typeof entry[1] === "string");
|
|
97
|
-
return entries.length > 0 ? Object.fromEntries(entries) : undefined;
|
|
98
|
-
}
|
|
99
|
-
function readAsyncSubAgentArray(items) {
|
|
100
|
-
return toArray(items)
|
|
101
|
-
.flatMap((item) => {
|
|
102
|
-
if (typeof item !== "object" || item === null || Array.isArray(item)) {
|
|
103
|
-
return [];
|
|
104
|
-
}
|
|
105
|
-
const typed = item;
|
|
106
|
-
const name = typeof typed.name === "string" ? typed.name.trim() : "";
|
|
107
|
-
const description = typeof typed.description === "string" ? typed.description.trim() : "";
|
|
108
|
-
const graphId = typeof typed.graphId === "string" ? typed.graphId.trim() : "";
|
|
109
|
-
if (!name || !description || !graphId) {
|
|
110
|
-
return [];
|
|
111
|
-
}
|
|
112
|
-
const headers = readStringRecord(typed.headers);
|
|
113
|
-
return [{
|
|
114
|
-
name,
|
|
115
|
-
description,
|
|
116
|
-
graphId,
|
|
117
|
-
...(typeof typed.url === "string" && typed.url.trim().length > 0 ? { url: typed.url.trim() } : {}),
|
|
118
|
-
...(headers ? { headers } : {}),
|
|
119
|
-
}];
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
function readPrefixedRefArray(items, prefix) {
|
|
123
|
-
return toArray(items)
|
|
124
|
-
.map((item) => {
|
|
125
|
-
if (typeof item === "string") {
|
|
126
|
-
const value = item.trim();
|
|
127
|
-
if (!value) {
|
|
128
|
-
return undefined;
|
|
129
|
-
}
|
|
130
|
-
return value.startsWith(`${prefix}/`) ? value : `${prefix}/${value}`;
|
|
131
|
-
}
|
|
132
|
-
if (typeof item === "object" && item && "ref" in item && typeof item.ref === "string") {
|
|
133
|
-
const value = String(item.ref).trim();
|
|
134
|
-
return value || undefined;
|
|
135
|
-
}
|
|
136
|
-
return undefined;
|
|
137
|
-
})
|
|
138
|
-
.filter((item) => Boolean(item));
|
|
139
|
-
}
|
|
140
|
-
function normalizeToolUsageOverrides(value) {
|
|
141
|
-
const record = asMutableObject(value);
|
|
142
|
-
if (!record) {
|
|
143
|
-
return undefined;
|
|
144
|
-
}
|
|
145
|
-
const directKeys = new Set(["config", "hitl", "retryable", "subprocess", "embeddingModel", "embeddingModelRef"]);
|
|
146
|
-
const directOverrides = {};
|
|
147
|
-
const configOverrides = {};
|
|
148
|
-
for (const [key, entry] of Object.entries(record)) {
|
|
149
|
-
if (directKeys.has(key)) {
|
|
150
|
-
directOverrides[key] = cloneConfigValue(entry);
|
|
151
|
-
continue;
|
|
152
|
-
}
|
|
153
|
-
configOverrides[key] = cloneConfigValue(entry);
|
|
154
|
-
}
|
|
155
|
-
return {
|
|
156
|
-
...directOverrides,
|
|
157
|
-
...(Object.keys(configOverrides).length > 0
|
|
158
|
-
? {
|
|
159
|
-
config: {
|
|
160
|
-
...(asMutableObject(directOverrides.config) ?? {}),
|
|
161
|
-
...configOverrides,
|
|
162
|
-
},
|
|
163
|
-
}
|
|
164
|
-
: {}),
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
function readToolBindingArray(items) {
|
|
168
|
-
return toArray(items)
|
|
169
|
-
.map((item) => {
|
|
170
|
-
if (typeof item === "string") {
|
|
171
|
-
return { ref: item };
|
|
172
|
-
}
|
|
173
|
-
if (typeof item !== "object" || !item || Array.isArray(item)) {
|
|
174
|
-
return undefined;
|
|
175
|
-
}
|
|
176
|
-
const entries = Object.entries(item);
|
|
177
|
-
if (entries.length !== 1 || typeof entries[0]?.[0] !== "string") {
|
|
178
|
-
throw new Error("Agent tools entries must be either a tool name string or a single-key override object");
|
|
179
|
-
}
|
|
180
|
-
const [ref, rawOverride] = entries[0];
|
|
181
|
-
const overrides = normalizeToolUsageOverrides(rawOverride);
|
|
182
|
-
return {
|
|
183
|
-
ref,
|
|
184
|
-
...(overrides ? { overrides } : {}),
|
|
185
|
-
};
|
|
186
|
-
})
|
|
187
|
-
.filter((item) => Boolean(item));
|
|
188
|
-
}
|
|
189
|
-
function readPathArray(items) {
|
|
190
|
-
return toArray(items)
|
|
191
|
-
.map((item) => typeof item === "string"
|
|
192
|
-
? item
|
|
193
|
-
: typeof item === "object" && item && "path" in item && typeof item.path === "string"
|
|
194
|
-
? item.path
|
|
195
|
-
: undefined)
|
|
196
|
-
.filter((item) => Boolean(item));
|
|
197
|
-
}
|
|
198
|
-
function readStringArray(items) {
|
|
199
|
-
return toArray(items)
|
|
200
|
-
.filter((item) => typeof item === "string" && item.trim().length > 0)
|
|
201
|
-
.map((item) => item.trim());
|
|
202
|
-
}
|
|
203
|
-
function readSingleRef(value) {
|
|
204
|
-
if (typeof value === "string" && value.trim()) {
|
|
205
|
-
return value;
|
|
206
|
-
}
|
|
207
|
-
if (typeof value === "object" && value && "ref" in value && typeof value.ref === "string") {
|
|
208
|
-
return value.ref;
|
|
209
|
-
}
|
|
210
|
-
return undefined;
|
|
211
|
-
}
|
|
212
|
-
function readMiddlewareArray(items) {
|
|
213
|
-
const middleware = toArray(items)
|
|
214
|
-
.filter((item) => typeof item === "object" && item !== null && !Array.isArray(item))
|
|
215
|
-
.map((item) => ({ ...item }));
|
|
216
|
-
return middleware.length > 0 ? middleware : undefined;
|
|
217
|
-
}
|
|
218
|
-
function readObjectArray(items) {
|
|
219
|
-
const records = toArray(items)
|
|
220
|
-
.filter((item) => typeof item === "object" && item !== null && !Array.isArray(item))
|
|
221
|
-
.map((item) => ({ ...item }));
|
|
222
|
-
return records.length > 0 ? records : undefined;
|
|
223
|
-
}
|
|
224
|
-
function readMcpServerArray(items) {
|
|
225
|
-
const records = toArray(items)
|
|
226
|
-
.map((item) => {
|
|
227
|
-
if (typeof item === "string" && item.trim()) {
|
|
228
|
-
return { ref: item.startsWith("mcp/") ? item : `mcp/${item.trim()}` };
|
|
229
|
-
}
|
|
230
|
-
if (typeof item === "object" && item !== null && !Array.isArray(item)) {
|
|
231
|
-
return { ...item };
|
|
232
|
-
}
|
|
233
|
-
return undefined;
|
|
234
|
-
})
|
|
235
|
-
.filter((item) => Boolean(item));
|
|
236
|
-
return records.length > 0 ? records : undefined;
|
|
237
|
-
}
|
|
238
|
-
function readCapabilities(value) {
|
|
239
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
240
|
-
return undefined;
|
|
241
|
-
}
|
|
242
|
-
const typed = value;
|
|
243
|
-
const capabilities = {
|
|
244
|
-
...(typeof typed.delegation === "boolean" ? { delegation: typed.delegation } : {}),
|
|
245
|
-
...(typeof typed.memory === "boolean" ? { memory: typed.memory } : {}),
|
|
246
|
-
};
|
|
247
|
-
return Object.keys(capabilities).length > 0 ? capabilities : undefined;
|
|
248
|
-
}
|
|
249
13
|
const CONSUMED_AGENT_CONFIG_KEYS = [
|
|
250
14
|
"systemPrompt",
|
|
251
15
|
"checkpointer",
|
|
@@ -401,24 +165,6 @@ function readProceduralMemoryConfig(item, runtime) {
|
|
|
401
165
|
}
|
|
402
166
|
return undefined;
|
|
403
167
|
}
|
|
404
|
-
function cloneConfigValue(value) {
|
|
405
|
-
if (Array.isArray(value)) {
|
|
406
|
-
return value.map((item) => cloneConfigValue(item));
|
|
407
|
-
}
|
|
408
|
-
if (typeof value === "object" && value !== null) {
|
|
409
|
-
return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, cloneConfigValue(entry)]));
|
|
410
|
-
}
|
|
411
|
-
return value;
|
|
412
|
-
}
|
|
413
|
-
function isModuleRelativePathCandidate(value) {
|
|
414
|
-
return !path.isAbsolute(value) && !isExternalSourceLocator(value) && !value.includes("://");
|
|
415
|
-
}
|
|
416
|
-
function resolveModuleRelativePath(value, moduleRoot) {
|
|
417
|
-
if (!moduleRoot || !isModuleRelativePathCandidate(value)) {
|
|
418
|
-
return value;
|
|
419
|
-
}
|
|
420
|
-
return path.resolve(moduleRoot, value);
|
|
421
|
-
}
|
|
422
168
|
function normalizeModulePromptConfig(value, moduleRoot) {
|
|
423
169
|
if (!moduleRoot || typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
424
170
|
return value;
|
|
@@ -688,7 +434,7 @@ async function loadConventionalObjectsForRoot(root, runtimeRoot, mergedObjects,
|
|
|
688
434
|
const configuredToolRoots = readRuntimeSources(runtimeDefaults).tools
|
|
689
435
|
.filter((source) => isFileSourceUri(source))
|
|
690
436
|
.map((source) => resolveFileSourcePath(source, runtimeRoot));
|
|
691
|
-
const conventionalToolRoots =
|
|
437
|
+
const conventionalToolRoots = conventionalObjectRoots(root);
|
|
692
438
|
const objectRoots = root === runtimeRoot
|
|
693
439
|
? Array.from(new Set([
|
|
694
440
|
...conventionalToolRoots,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { compileToolWithRegistry, validateToolWithRegistry } from "../extensions.js";
|
|
1
|
+
import { compileToolWithRegistry, validateToolWithRegistry } from "../tooling/extensions.js";
|
|
2
2
|
function asObject(value) {
|
|
3
3
|
return typeof value === "object" && value ? value : undefined;
|
|
4
4
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { existsSync, readdirSync, statSync } from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { defaultResourceConfigRoot, defaultResourceSkillsRoot } from "../../resource/resource.js";
|
|
4
|
-
import { validateSkillMetadata } from "../../runtime/
|
|
4
|
+
import { validateSkillMetadata } from "../../runtime/skills/skill-metadata.js";
|
|
5
5
|
import { ensureExternalResourceSource, isDirectoryPath, isExternalSourceLocator, resolveExternalResourcePath, resolveResourcePackageRoot, } from "../../resource/sources.js";
|
|
6
6
|
import { parseAgentItem, readYamlItems } from "../object-loader.js";
|
|
7
7
|
function isBundledResourceRef(ref) {
|
package/package.json
CHANGED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export * from "./tool/declared-middleware.js";
|
|
2
|
-
export * from "./compat/deepagent-compat.js";
|
|
3
|
-
export * from "./tool/interrupt-policy.js";
|
|
4
|
-
export * from "./model/invocation-request.js";
|
|
5
|
-
export * from "./model/message-assembly.js";
|
|
6
|
-
export * from "./model/model-providers.js";
|
|
7
|
-
export * from "./compat/openai-compatible.js";
|
|
8
|
-
export * from "./tool/provider-tool.js";
|
|
9
|
-
export * from "./resilience.js";
|
|
10
|
-
export * from "./tool/resolved-tool.js";
|
|
11
|
-
export * from "./tool/tool-arguments.js";
|
|
12
|
-
export * from "./tool/tool-hitl.js";
|
|
13
|
-
export * from "./tool/tool-name-mapping.js";
|