@namzu/sdk 5.0.0 → 5.2.0
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/CHANGELOG.md +463 -0
- package/README.md +2 -2
- package/dist/agents/__tests__/run-agent-forwarding.test.d.ts +2 -0
- package/dist/agents/__tests__/run-agent-forwarding.test.d.ts.map +1 -0
- package/dist/agents/__tests__/run-agent-forwarding.test.js +76 -0
- package/dist/agents/__tests__/run-agent-forwarding.test.js.map +1 -0
- package/dist/agents/__tests__/run-completed-stop-reason.test.d.ts +2 -0
- package/dist/agents/__tests__/run-completed-stop-reason.test.d.ts.map +1 -0
- package/dist/agents/__tests__/run-completed-stop-reason.test.js +50 -0
- package/dist/agents/__tests__/run-completed-stop-reason.test.js.map +1 -0
- package/dist/agents/index.d.ts +1 -0
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +4 -0
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/runAgent.d.ts +34 -0
- package/dist/agents/runAgent.d.ts.map +1 -1
- package/dist/agents/runAgent.js +5 -3
- package/dist/agents/runAgent.js.map +1 -1
- package/dist/config/runtime.d.ts +30 -30
- package/dist/constants/tools/__tests__/dangerous-patterns.test.d.ts +2 -0
- package/dist/constants/tools/__tests__/dangerous-patterns.test.d.ts.map +1 -0
- package/dist/constants/tools/__tests__/dangerous-patterns.test.js +54 -0
- package/dist/constants/tools/__tests__/dangerous-patterns.test.js.map +1 -0
- package/dist/constants/tools/index.d.ts.map +1 -1
- package/dist/constants/tools/index.js +28 -1
- package/dist/constants/tools/index.js.map +1 -1
- package/dist/contracts/a2a.d.ts +44 -44
- package/dist/directory/__tests__/derive.test.d.ts +2 -0
- package/dist/directory/__tests__/derive.test.d.ts.map +1 -0
- package/dist/directory/__tests__/derive.test.js +111 -0
- package/dist/directory/__tests__/derive.test.js.map +1 -0
- package/dist/directory/__tests__/load-diagnostics.test.d.ts +2 -0
- package/dist/directory/__tests__/load-diagnostics.test.d.ts.map +1 -0
- package/dist/directory/__tests__/load-diagnostics.test.js +106 -0
- package/dist/directory/__tests__/load-diagnostics.test.js.map +1 -0
- package/dist/directory/__tests__/load-directory.test.d.ts +2 -0
- package/dist/directory/__tests__/load-directory.test.d.ts.map +1 -0
- package/dist/directory/__tests__/load-directory.test.js +196 -0
- package/dist/directory/__tests__/load-directory.test.js.map +1 -0
- package/dist/directory/__tests__/subagents.test.d.ts +2 -0
- package/dist/directory/__tests__/subagents.test.d.ts.map +1 -0
- package/dist/directory/__tests__/subagents.test.js +117 -0
- package/dist/directory/__tests__/subagents.test.js.map +1 -0
- package/dist/directory/__tests__/supervisor-budget.test.d.ts +2 -0
- package/dist/directory/__tests__/supervisor-budget.test.d.ts.map +1 -0
- package/dist/directory/__tests__/supervisor-budget.test.js +97 -0
- package/dist/directory/__tests__/supervisor-budget.test.js.map +1 -0
- package/dist/directory/derive-supervisor.d.ts +58 -0
- package/dist/directory/derive-supervisor.d.ts.map +1 -0
- package/dist/directory/derive-supervisor.js +88 -0
- package/dist/directory/derive-supervisor.js.map +1 -0
- package/dist/directory/derive.d.ts +12 -0
- package/dist/directory/derive.d.ts.map +1 -0
- package/dist/directory/derive.js +58 -0
- package/dist/directory/derive.js.map +1 -0
- package/dist/directory/index.d.ts +7 -0
- package/dist/directory/index.d.ts.map +1 -0
- package/dist/directory/index.js +5 -0
- package/dist/directory/index.js.map +1 -0
- package/dist/directory/load.d.ts +14 -0
- package/dist/directory/load.d.ts.map +1 -0
- package/dist/directory/load.js +488 -0
- package/dist/directory/load.js.map +1 -0
- package/dist/directory/scan.d.ts +36 -0
- package/dist/directory/scan.d.ts.map +1 -0
- package/dist/directory/scan.js +136 -0
- package/dist/directory/scan.js.map +1 -0
- package/dist/directory/types.d.ts +215 -0
- package/dist/directory/types.d.ts.map +1 -0
- package/dist/directory/types.js +8 -0
- package/dist/directory/types.js.map +1 -0
- package/dist/plugin/__tests__/path-containment.test.d.ts +2 -0
- package/dist/plugin/__tests__/path-containment.test.d.ts.map +1 -0
- package/dist/plugin/__tests__/path-containment.test.js +91 -0
- package/dist/plugin/__tests__/path-containment.test.js.map +1 -0
- package/dist/plugin/lifecycle.d.ts.map +1 -1
- package/dist/plugin/lifecycle.js +3 -3
- package/dist/plugin/lifecycle.js.map +1 -1
- package/dist/plugin/loader.d.ts.map +1 -1
- package/dist/plugin/loader.js +12 -2
- package/dist/plugin/loader.js.map +1 -1
- package/dist/provider/__tests__/model-version.test.d.ts +2 -0
- package/dist/provider/__tests__/model-version.test.d.ts.map +1 -0
- package/dist/provider/__tests__/model-version.test.js +80 -0
- package/dist/provider/__tests__/model-version.test.js.map +1 -0
- package/dist/provider/__tests__/strict-schema.test.d.ts +2 -0
- package/dist/provider/__tests__/strict-schema.test.d.ts.map +1 -0
- package/dist/provider/__tests__/strict-schema.test.js +109 -0
- package/dist/provider/__tests__/strict-schema.test.js.map +1 -0
- package/dist/provider/__tests__/typed-error-classification.test.d.ts +2 -0
- package/dist/provider/__tests__/typed-error-classification.test.d.ts.map +1 -0
- package/dist/provider/__tests__/typed-error-classification.test.js +123 -0
- package/dist/provider/__tests__/typed-error-classification.test.js.map +1 -0
- package/dist/provider/model-version.d.ts +60 -0
- package/dist/provider/model-version.d.ts.map +1 -0
- package/dist/provider/model-version.js +64 -0
- package/dist/provider/model-version.js.map +1 -0
- package/dist/provider/retry.d.ts.map +1 -1
- package/dist/provider/retry.js +23 -7
- package/dist/provider/retry.js.map +1 -1
- package/dist/provider/strict-schema.d.ts +49 -0
- package/dist/provider/strict-schema.d.ts.map +1 -0
- package/dist/provider/strict-schema.js +112 -0
- package/dist/provider/strict-schema.js.map +1 -0
- package/dist/public-runtime.d.ts +6 -1
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +21 -1
- package/dist/public-runtime.js.map +1 -1
- package/dist/public-tools.d.ts +1 -0
- package/dist/public-tools.d.ts.map +1 -1
- package/dist/public-tools.js +4 -0
- package/dist/public-tools.js.map +1 -1
- package/dist/public-types.d.ts +2 -0
- package/dist/public-types.d.ts.map +1 -1
- package/dist/registry/tool/__tests__/strict-registration.test.d.ts +2 -0
- package/dist/registry/tool/__tests__/strict-registration.test.d.ts.map +1 -0
- package/dist/registry/tool/__tests__/strict-registration.test.js +82 -0
- package/dist/registry/tool/__tests__/strict-registration.test.js.map +1 -0
- package/dist/registry/tool/execute.d.ts.map +1 -1
- package/dist/registry/tool/execute.js +16 -0
- package/dist/registry/tool/execute.js.map +1 -1
- package/dist/runtime/query/__tests__/stream-recovery.test.js +5 -0
- package/dist/runtime/query/__tests__/stream-recovery.test.js.map +1 -1
- package/dist/runtime/query/result.d.ts.map +1 -1
- package/dist/runtime/query/result.js +5 -0
- package/dist/runtime/query/result.js.map +1 -1
- package/dist/tools/builtins/__tests__/edit-insert-reachable.test.js +7 -1
- package/dist/tools/builtins/__tests__/edit-insert-reachable.test.js.map +1 -1
- package/dist/tools/builtins/__tests__/edit.test.js +1 -1
- package/dist/tools/builtins/__tests__/edit.test.js.map +1 -1
- package/dist/tools/builtins/edit.d.ts.map +1 -1
- package/dist/tools/builtins/edit.js +20 -2
- package/dist/tools/builtins/edit.js.map +1 -1
- package/dist/types/plugin/index.d.ts +4 -4
- package/dist/types/provider/errors.d.ts +0 -17
- package/dist/types/provider/errors.d.ts.map +1 -1
- package/dist/types/provider/errors.js +60 -0
- package/dist/types/provider/errors.js.map +1 -1
- package/dist/types/run/events.d.ts +17 -2
- package/dist/types/run/events.d.ts.map +1 -1
- package/dist/types/run/events.js.map +1 -1
- package/dist/types/verification/index.d.ts +6 -6
- package/package.json +1 -1
- package/src/agents/__tests__/run-agent-forwarding.test.ts +85 -0
- package/src/agents/__tests__/run-completed-stop-reason.test.ts +59 -0
- package/src/agents/index.ts +8 -0
- package/src/agents/runAgent.ts +30 -4
- package/src/constants/tools/__tests__/dangerous-patterns.test.ts +62 -0
- package/src/constants/tools/index.ts +28 -1
- package/src/directory/__tests__/derive.test.ts +135 -0
- package/src/directory/__tests__/load-diagnostics.test.ts +126 -0
- package/src/directory/__tests__/load-directory.test.ts +243 -0
- package/src/directory/__tests__/subagents.test.ts +155 -0
- package/src/directory/__tests__/supervisor-budget.test.ts +117 -0
- package/src/directory/derive-supervisor.ts +149 -0
- package/src/directory/derive.ts +70 -0
- package/src/directory/index.ts +27 -0
- package/src/directory/load.ts +556 -0
- package/src/directory/scan.ts +163 -0
- package/src/directory/types.ts +254 -0
- package/src/plugin/__tests__/path-containment.test.ts +107 -0
- package/src/plugin/lifecycle.ts +3 -3
- package/src/plugin/loader.ts +12 -2
- package/src/provider/__tests__/model-version.test.ts +93 -0
- package/src/provider/__tests__/strict-schema.test.ts +133 -0
- package/src/provider/__tests__/typed-error-classification.test.ts +143 -0
- package/src/provider/model-version.ts +98 -0
- package/src/provider/retry.ts +23 -7
- package/src/provider/strict-schema.ts +125 -0
- package/src/public-runtime.ts +31 -0
- package/src/public-tools.ts +4 -0
- package/src/public-types.ts +8 -0
- package/src/registry/tool/__tests__/strict-registration.test.ts +115 -0
- package/src/registry/tool/execute.ts +16 -0
- package/src/runtime/query/__tests__/stream-recovery.test.ts +5 -0
- package/src/runtime/query/result.ts +5 -0
- package/src/tools/builtins/__tests__/edit-insert-reachable.test.ts +8 -2
- package/src/tools/builtins/__tests__/edit.test.ts +1 -1
- package/src/tools/builtins/edit.ts +20 -2
- package/src/types/provider/errors.ts +71 -0
- package/src/types/run/events.ts +15 -2
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { RunAgentOptions } from '../agents/runAgent.js';
|
|
2
|
+
import type { DeriveRunOptionsInput, DirectoryManifest } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Turn a loaded project into the options `runAgent` takes.
|
|
5
|
+
*
|
|
6
|
+
* One direction, no second engine. Everything this produces is an ordinary
|
|
7
|
+
* `RunAgentOptions` field, so a caller who needs something this does not cover
|
|
8
|
+
* spreads `overrides` or stops using this function — there is no behaviour
|
|
9
|
+
* reachable only through the convention.
|
|
10
|
+
*/
|
|
11
|
+
export declare function deriveRunOptions(manifest: DirectoryManifest, input: DeriveRunOptionsInput): RunAgentOptions;
|
|
12
|
+
//# sourceMappingURL=derive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derive.d.ts","sourceRoot":"","sources":["../../src/directory/derive.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAG5D,OAAO,KAAK,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAE1E;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC/B,QAAQ,EAAE,iBAAiB,EAC3B,KAAK,EAAE,qBAAqB,GAC1B,eAAe,CAqDjB"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { ToolRegistry } from '../registry/tool/execute.js';
|
|
2
|
+
/**
|
|
3
|
+
* Turn a loaded project into the options `runAgent` takes.
|
|
4
|
+
*
|
|
5
|
+
* One direction, no second engine. Everything this produces is an ordinary
|
|
6
|
+
* `RunAgentOptions` field, so a caller who needs something this does not cover
|
|
7
|
+
* spreads `overrides` or stops using this function — there is no behaviour
|
|
8
|
+
* reachable only through the convention.
|
|
9
|
+
*/
|
|
10
|
+
export function deriveRunOptions(manifest, input) {
|
|
11
|
+
if (manifest.modules === 'skip') {
|
|
12
|
+
// The manifest is structurally complete and its tools were never
|
|
13
|
+
// imported, so `manifest.tools` is empty for a reason that has nothing
|
|
14
|
+
// to do with the project. Running it would produce an agent with no
|
|
15
|
+
// capabilities and no indication why.
|
|
16
|
+
throw new Error('This manifest was loaded with modules: "skip", so no tool was imported and none can be registered. Load with modules: "evaluate" before deriving run options.');
|
|
17
|
+
}
|
|
18
|
+
const model = input.model ?? manifest.config.model;
|
|
19
|
+
if (!model) {
|
|
20
|
+
throw new Error(`No model. Declare one in ${manifest.root}/agent.ts as \`export default { model: "…" }\`, or pass \`model\` here.`);
|
|
21
|
+
}
|
|
22
|
+
const tools = new ToolRegistry();
|
|
23
|
+
for (const entry of manifest.tools)
|
|
24
|
+
tools.register(entry.definition);
|
|
25
|
+
return {
|
|
26
|
+
provider: input.provider,
|
|
27
|
+
prompt: input.prompt,
|
|
28
|
+
model,
|
|
29
|
+
tools,
|
|
30
|
+
// The one value the project knows and `runAgent` cannot infer. Left
|
|
31
|
+
// unset it would default to the host's own cwd, pointing the file
|
|
32
|
+
// tools' containment at the host's source tree rather than at the
|
|
33
|
+
// project. The root is `agent/` itself, not its parent — narrower is
|
|
34
|
+
// the safe direction, and widening it is the caller's explicit call
|
|
35
|
+
// through `overrides`.
|
|
36
|
+
workingDirectory: manifest.root,
|
|
37
|
+
...(manifest.instructions ? { instructions: manifest.instructions } : {}),
|
|
38
|
+
...(manifest.skills.length > 0 ? { skills: manifest.skills.map((s) => s.skill) } : {}),
|
|
39
|
+
// Only when declared. A name guessed from a directory basename becomes
|
|
40
|
+
// the agent id in traces, where two sibling projects called `agent`
|
|
41
|
+
// would silently merge into one attribution bucket — worse than the
|
|
42
|
+
// SDK's own default, which at least does not pretend to be specific.
|
|
43
|
+
...(manifest.config.name ? { name: manifest.config.name } : {}),
|
|
44
|
+
...(manifest.config.temperature !== undefined
|
|
45
|
+
? { temperature: manifest.config.temperature }
|
|
46
|
+
: {}),
|
|
47
|
+
...(manifest.config.maxIterations !== undefined
|
|
48
|
+
? { maxIterations: manifest.config.maxIterations }
|
|
49
|
+
: {}),
|
|
50
|
+
...(manifest.config.tokenBudget !== undefined
|
|
51
|
+
? { tokenBudget: manifest.config.tokenBudget }
|
|
52
|
+
: {}),
|
|
53
|
+
...(manifest.config.timeoutMs !== undefined ? { timeoutMs: manifest.config.timeoutMs } : {}),
|
|
54
|
+
...(input.identity ?? {}),
|
|
55
|
+
...(input.overrides ?? {}),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=derive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derive.js","sourceRoot":"","s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C,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACtF,uEAAuE;QACvE,oEAAoE;QACpE,oEAAoE;QACpE,qEAAqE;QACrE,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/D,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,WAAW,KAAK,SAAS;YAC5C,CAAC,CAAC,EAAE,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE;YAC9C,CAAC,CAAC,EAAE,CAAC;QACN,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,aAAa,KAAK,SAAS;YAC9C,CAAC,CAAC,EAAE,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,aAAa,EAAE;YAClD,CAAC,CAAC,EAAE,CAAC;QACN,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,WAAW,KAAK,SAAS;YAC5C,CAAC,CAAC,EAAE,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE;YAC9C,CAAC,CAAC,EAAE,CAAC;QACN,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5F,GAAG,CAAC,KAAK,CAAC,QAAQ,IAAI,EAAE,CAAC;QACzB,GAAG,CAAC,KAAK,CAAC,SAAS,IAAI,EAAE,CAAC;KAC1B,CAAA;AACF,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { loadDirectory } from './load.js';
|
|
2
|
+
export { deriveRunOptions } from './derive.js';
|
|
3
|
+
export { deriveSupervisorOptions } from './derive-supervisor.js';
|
|
4
|
+
export type { DelegatePlan, DeriveSupervisorInput, SupervisorPlan, } from './derive-supervisor.js';
|
|
5
|
+
export type { DeriveRunOptionsInput, DirectoryDiagnosticCode, DirectoryDiagnosticSeverity, LoadDirectoryOptions, ModuleImporter, ModuleMode, DirectoryConfig, DirectoryDiagnostic, DirectoryLoadResult, DirectoryManifest, DirectorySlot, SkillEntry, SourceOutcome, SourceRef, SubAgentEntry, ToolEntry, } from './types.js';
|
|
6
|
+
export { ALL_SLOTS } from './types.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/directory/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAA;AAChE,YAAY,EACX,YAAY,EACZ,qBAAqB,EACrB,cAAc,GACd,MAAM,wBAAwB,CAAA;AAC/B,YAAY,EACX,qBAAqB,EACrB,uBAAuB,EACvB,2BAA2B,EAC3B,oBAAoB,EACpB,cAAc,EACd,UAAU,EACV,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,UAAU,EACV,aAAa,EACb,SAAS,EACT,aAAa,EACb,SAAS,GACT,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/directory/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAA;AAwBhE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DirectoryLoadResult, LoadDirectoryOptions } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Read a conventional agent directory into typed, inspectable definitions.
|
|
4
|
+
*
|
|
5
|
+
* A LOADER, not a runner: it produces what is there and hands it back. Running
|
|
6
|
+
* it — a turn, a server, a schedule — is the host's job, which is what keeps
|
|
7
|
+
* this package free of any hosting model.
|
|
8
|
+
*
|
|
9
|
+
* It never throws on authored content. A broken tool, a missing file, a
|
|
10
|
+
* malformed config all come back as diagnostics, because a loader that throws
|
|
11
|
+
* on the first bad file tells you about one problem when you wanted the list.
|
|
12
|
+
*/
|
|
13
|
+
export declare function loadDirectory(dir: string, options?: LoadDirectoryOptions): Promise<DirectoryLoadResult>;
|
|
14
|
+
//# sourceMappingURL=load.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../src/directory/load.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAGX,mBAAmB,EAEnB,oBAAoB,EAQpB,MAAM,YAAY,CAAA;AA2MnB;;;;;;;;;;GAUG;AACH,wBAAsB,aAAa,CAClC,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,oBAAyB,GAChC,OAAO,CAAC,mBAAmB,CAAC,CAE9B"}
|
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { pathToFileURL } from 'node:url';
|
|
3
|
+
import { loadSkill } from '../skills/loader.js';
|
|
4
|
+
import { canonicalRoot, scanSlot } from './scan.js';
|
|
5
|
+
import { ALL_SLOTS } from './types.js';
|
|
6
|
+
const DEFAULT_MODULE_TIMEOUT_MS = 10_000;
|
|
7
|
+
/**
|
|
8
|
+
* Import a module with a deadline that bounds the LOADER, not the module.
|
|
9
|
+
*
|
|
10
|
+
* `import()` cannot be cancelled. When this races out, the module is still
|
|
11
|
+
* executing: it may finish, its top-level side effects may land after
|
|
12
|
+
* `loadDirectory` has returned, and Node caches the result — so a second load in
|
|
13
|
+
* the same process can see the same file resolve instantly. That was verified
|
|
14
|
+
* rather than assumed, and it is why `'abandoned'` exists as an outcome
|
|
15
|
+
* separate from `'failed'`.
|
|
16
|
+
*/
|
|
17
|
+
async function importWithDeadline(fileUrl, importModule, timeoutMs) {
|
|
18
|
+
let timer;
|
|
19
|
+
const deadline = new Promise((resolve) => {
|
|
20
|
+
timer = setTimeout(() => resolve({ status: 'abandoned' }), timeoutMs);
|
|
21
|
+
});
|
|
22
|
+
try {
|
|
23
|
+
const result = await Promise.race([
|
|
24
|
+
importModule(fileUrl).then((module) => ({
|
|
25
|
+
status: 'loaded',
|
|
26
|
+
module,
|
|
27
|
+
})),
|
|
28
|
+
deadline,
|
|
29
|
+
]);
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
catch (err) {
|
|
33
|
+
const code = err?.code;
|
|
34
|
+
return {
|
|
35
|
+
status: 'failed',
|
|
36
|
+
cause: err instanceof Error ? err.message : String(err),
|
|
37
|
+
...(typeof code === 'string' ? { code } : {}),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
finally {
|
|
41
|
+
if (timer)
|
|
42
|
+
clearTimeout(timer);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Translate Node's module-loading errors into something an author can act on.
|
|
47
|
+
*
|
|
48
|
+
* The codes matter more than the messages: `ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX`
|
|
49
|
+
* means the file used a construct type STRIPPING cannot express (an `enum`, a
|
|
50
|
+
* decorator, a parameter property) — stripping erases types, it does not
|
|
51
|
+
* transform code, and no flag rescues those. That is a different problem from
|
|
52
|
+
* a plain syntax error, and pointing at the wrong one costs an author an hour.
|
|
53
|
+
*
|
|
54
|
+
* That sentence was true and this function still matched on `cause`, which is
|
|
55
|
+
* `err.message` — and Node does not put the code in the message. Probed:
|
|
56
|
+
* `ERR_MODULE_NOT_FOUND` arrives as *"Cannot find module …"*, and
|
|
57
|
+
* `ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX` as *"TypeScript enum is not supported in
|
|
58
|
+
* strip-only mode"*. Neither contains its code, so every branch below was
|
|
59
|
+
* unreachable and every author got the bare message the doc-comment was
|
|
60
|
+
* explaining why not to give them. The code is read from `err.code` now, which
|
|
61
|
+
* is where it always was.
|
|
62
|
+
*/
|
|
63
|
+
function explainImportFailure(cause, code) {
|
|
64
|
+
if (code === 'ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX') {
|
|
65
|
+
return `${cause}\n\nNode strips types, it does not compile them: enums, decorators, parameter properties and runtime namespaces have no stripped form. Rewrite as plain TypeScript, or pass \`importModule\` with a transforming loader.`;
|
|
66
|
+
}
|
|
67
|
+
if (code === 'ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING') {
|
|
68
|
+
return `${cause}\n\nNode refuses to strip types from any .ts file resolved under node_modules/. If this is a workspace package, have it ship built .js.`;
|
|
69
|
+
}
|
|
70
|
+
if (code === 'ERR_MODULE_NOT_FOUND') {
|
|
71
|
+
return `${cause}\n\nRelative imports need their real extension here — write "./util.ts", not "./util". tsconfig "paths" aliases are not resolved; pass \`importModule\` if you need them.`;
|
|
72
|
+
}
|
|
73
|
+
// Node ≥20 but <22.6 has no type stripping at all, so the golden path — a
|
|
74
|
+
// `.ts` tool — dies here rather than at any of the codes above.
|
|
75
|
+
if (code === 'ERR_UNKNOWN_FILE_EXTENSION' && /\.[cm]?ts"?$/.test(cause)) {
|
|
76
|
+
return `${cause}\n\nThis Node cannot run TypeScript directly. Use Node 22.18 or newer, or pass \`importModule\` with a loader that transpiles.`;
|
|
77
|
+
}
|
|
78
|
+
return cause;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The fields `ToolDefinition` declares without a `?`.
|
|
82
|
+
*
|
|
83
|
+
* Checking `name` and `execute` alone was not a weaker version of this check,
|
|
84
|
+
* it was a check that let the failure through and moved it: a default export
|
|
85
|
+
* with no `inputSchema` passed here, registered clean, and then died inside
|
|
86
|
+
* `toLLMTools()` reading `inputSchema._def` — a `TypeError` naming a file this
|
|
87
|
+
* loader never mentions, at a point where the author is no longer looking at
|
|
88
|
+
* their tool. A loader whose job is to report bad files must reject the ones
|
|
89
|
+
* that crash later, not only the ones that are obviously not tools.
|
|
90
|
+
*
|
|
91
|
+
* Exactly the required set, and no more. `isReadOnly`, `isDestructive` and the
|
|
92
|
+
* other `defineTool` niceties are not on the interface, so demanding them would
|
|
93
|
+
* make this loader refuse a hand-written object that satisfies the SDK's own
|
|
94
|
+
* published type — the loader overruling the SDK.
|
|
95
|
+
*/
|
|
96
|
+
function isToolDefinition(value) {
|
|
97
|
+
if (typeof value !== 'object' || value === null)
|
|
98
|
+
return false;
|
|
99
|
+
const c = value;
|
|
100
|
+
return (typeof c.name === 'string' &&
|
|
101
|
+
typeof c.description === 'string' &&
|
|
102
|
+
typeof c.execute === 'function' &&
|
|
103
|
+
typeof c.inputSchema === 'object' &&
|
|
104
|
+
c.inputSchema !== null);
|
|
105
|
+
}
|
|
106
|
+
/** The default export, tolerating a namespace that only has named exports. */
|
|
107
|
+
function defaultExport(module) {
|
|
108
|
+
if (typeof module !== 'object' || module === null)
|
|
109
|
+
return undefined;
|
|
110
|
+
return module.default;
|
|
111
|
+
}
|
|
112
|
+
function readConfig(value, diagnostics, path) {
|
|
113
|
+
if (value === undefined)
|
|
114
|
+
return {};
|
|
115
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
116
|
+
diagnostics.push({
|
|
117
|
+
code: 'invalid_config',
|
|
118
|
+
severity: 'error',
|
|
119
|
+
message: 'agent.ts must default-export a plain object.',
|
|
120
|
+
path,
|
|
121
|
+
});
|
|
122
|
+
return {};
|
|
123
|
+
}
|
|
124
|
+
// Read field by field rather than spread: an unknown key is the author's
|
|
125
|
+
// business, but a known key of the wrong type would reach `runAgent` and
|
|
126
|
+
// fail somewhere with no mention of this file.
|
|
127
|
+
const raw = value;
|
|
128
|
+
const config = {};
|
|
129
|
+
const take = (key, ok, expected) => {
|
|
130
|
+
const found = raw[key];
|
|
131
|
+
if (found === undefined)
|
|
132
|
+
return;
|
|
133
|
+
if (!ok(found)) {
|
|
134
|
+
diagnostics.push({
|
|
135
|
+
code: 'invalid_config',
|
|
136
|
+
severity: 'error',
|
|
137
|
+
message: `agent.ts: "${key}" must be a ${expected}, received ${typeof found}.`,
|
|
138
|
+
path,
|
|
139
|
+
});
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
config[key] = found;
|
|
143
|
+
};
|
|
144
|
+
const isString = (v) => typeof v === 'string';
|
|
145
|
+
// Rejects NaN and Infinity too. A budget of NaN compares false against
|
|
146
|
+
// every limit, so it would read as "no cap" rather than as a bad value.
|
|
147
|
+
const isNumber = (v) => typeof v === 'number' && Number.isFinite(v);
|
|
148
|
+
take('model', isString, 'string');
|
|
149
|
+
take('name', isString, 'string');
|
|
150
|
+
take('temperature', isNumber, 'finite number');
|
|
151
|
+
take('maxIterations', isNumber, 'finite number');
|
|
152
|
+
take('tokenBudget', isNumber, 'finite number');
|
|
153
|
+
take('timeoutMs', isNumber, 'finite number');
|
|
154
|
+
// `metadata` is typed `Record<string, string>` and was admitted on
|
|
155
|
+
// `typeof === 'object'` alone — which an array also satisfies, and which
|
|
156
|
+
// says nothing about the values. So `{ tags: ['a'] }` and `{ n: 1 }` both
|
|
157
|
+
// reached a consumer that had been promised strings, and the type was a
|
|
158
|
+
// claim this loader did not keep. Every other field here is checked; this
|
|
159
|
+
// one is the reason to check the values too, since it is the only field
|
|
160
|
+
// whose contents are forwarded verbatim to an inspector.
|
|
161
|
+
if (raw.metadata !== undefined) {
|
|
162
|
+
const m = raw.metadata;
|
|
163
|
+
if (typeof m !== 'object' || m === null || Array.isArray(m)) {
|
|
164
|
+
diagnostics.push({
|
|
165
|
+
code: 'invalid_config',
|
|
166
|
+
severity: 'error',
|
|
167
|
+
message: `agent.ts: "metadata" must be an object of string values, received ${Array.isArray(m) ? 'array' : typeof m}.`,
|
|
168
|
+
path,
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
const bad = Object.entries(m).filter(([, v]) => typeof v !== 'string');
|
|
173
|
+
if (bad.length > 0) {
|
|
174
|
+
diagnostics.push({
|
|
175
|
+
code: 'invalid_config',
|
|
176
|
+
severity: 'error',
|
|
177
|
+
message: `agent.ts: "metadata" values must be strings; ${bad
|
|
178
|
+
.map(([k, v]) => `"${k}" is ${v === null ? 'null' : typeof v}`)
|
|
179
|
+
.join(', ')}.`,
|
|
180
|
+
path,
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
config.metadata = m;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return config;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Read a conventional agent directory into typed, inspectable definitions.
|
|
192
|
+
*
|
|
193
|
+
* A LOADER, not a runner: it produces what is there and hands it back. Running
|
|
194
|
+
* it — a turn, a server, a schedule — is the host's job, which is what keeps
|
|
195
|
+
* this package free of any hosting model.
|
|
196
|
+
*
|
|
197
|
+
* It never throws on authored content. A broken tool, a missing file, a
|
|
198
|
+
* malformed config all come back as diagnostics, because a loader that throws
|
|
199
|
+
* on the first bad file tells you about one problem when you wanted the list.
|
|
200
|
+
*/
|
|
201
|
+
export async function loadDirectory(dir, options = {}) {
|
|
202
|
+
return loadAt(dir, options, 0);
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Depth 0 is the project the caller named; 1 is a delegate it declares.
|
|
206
|
+
*
|
|
207
|
+
* A delegate does not get delegates of its own. The cap is a real decision,
|
|
208
|
+
* not a missing feature: unbounded nesting is a topology question — who may
|
|
209
|
+
* spawn whom, and how deep a run may fan out — and answering it by default is
|
|
210
|
+
* how a directory layout ends up deciding a system's shape. It also removes
|
|
211
|
+
* the cycle: `agents/a/agents/b/agents/a` cannot be built if the second level
|
|
212
|
+
* is never read.
|
|
213
|
+
*/
|
|
214
|
+
const MAX_DEPTH = 1;
|
|
215
|
+
async function loadAt(dir, options, depth) {
|
|
216
|
+
if (typeof dir !== 'string' || dir.length === 0) {
|
|
217
|
+
throw new TypeError('loadDirectory(dir): dir must be a non-empty string.');
|
|
218
|
+
}
|
|
219
|
+
const modules = options.modules ?? 'evaluate';
|
|
220
|
+
const importModule = options.importModule ?? ((url) => import(url));
|
|
221
|
+
const timeoutMs = options.moduleTimeoutMs ?? DEFAULT_MODULE_TIMEOUT_MS;
|
|
222
|
+
// `?? ALL_SLOTS`, never `|| ALL_SLOTS`: an empty list means "scan nothing",
|
|
223
|
+
// which is the closed reading of an allow-list. The tuple type keeps a
|
|
224
|
+
// TypeScript caller from writing it at all.
|
|
225
|
+
const included = options.include ?? ALL_SLOTS;
|
|
226
|
+
const diagnostics = [];
|
|
227
|
+
const sources = [];
|
|
228
|
+
const tools = [];
|
|
229
|
+
const skills = [];
|
|
230
|
+
const agents = [];
|
|
231
|
+
let config = {};
|
|
232
|
+
let instructions = '';
|
|
233
|
+
const root = await canonicalRoot(dir);
|
|
234
|
+
if (!root) {
|
|
235
|
+
diagnostics.push({
|
|
236
|
+
code: 'root_missing',
|
|
237
|
+
severity: 'error',
|
|
238
|
+
message: `No directory at ${dir}.`,
|
|
239
|
+
});
|
|
240
|
+
return {
|
|
241
|
+
manifest: {
|
|
242
|
+
root: dir,
|
|
243
|
+
name: 'agent',
|
|
244
|
+
instructions: '',
|
|
245
|
+
config: {},
|
|
246
|
+
tools: [],
|
|
247
|
+
skills: [],
|
|
248
|
+
agents: [],
|
|
249
|
+
sources: [],
|
|
250
|
+
included,
|
|
251
|
+
modules,
|
|
252
|
+
},
|
|
253
|
+
diagnostics,
|
|
254
|
+
ok: false,
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
const record = (file, slot, outcome) => {
|
|
258
|
+
const ref = { ...file, slot, outcome };
|
|
259
|
+
sources.push(ref);
|
|
260
|
+
return ref;
|
|
261
|
+
};
|
|
262
|
+
// ─── instructions ─────────────────────────────────────────────────────
|
|
263
|
+
if (included.includes('instructions')) {
|
|
264
|
+
try {
|
|
265
|
+
const body = await readFile(`${root}/instructions.md`, 'utf8');
|
|
266
|
+
instructions = body.trimEnd();
|
|
267
|
+
if (instructions.length === 0) {
|
|
268
|
+
// Asymmetric on purpose: an absent file is a choice, a present
|
|
269
|
+
// file that says nothing is a mistake.
|
|
270
|
+
diagnostics.push({
|
|
271
|
+
code: 'instructions_empty',
|
|
272
|
+
severity: 'error',
|
|
273
|
+
message: 'instructions.md exists but is empty.',
|
|
274
|
+
path: `${root}/instructions.md`,
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
record({
|
|
278
|
+
path: `${root}/instructions.md`,
|
|
279
|
+
relativePath: 'instructions.md',
|
|
280
|
+
id: 'instructions',
|
|
281
|
+
}, 'instructions', 'loaded');
|
|
282
|
+
}
|
|
283
|
+
catch {
|
|
284
|
+
// A warning, not an error: `runAgent` treats instructions as fully
|
|
285
|
+
// optional, and this package does not get to overrule the kernel
|
|
286
|
+
// about what a valid agent is.
|
|
287
|
+
diagnostics.push({
|
|
288
|
+
code: 'instructions_missing',
|
|
289
|
+
severity: 'warning',
|
|
290
|
+
message: 'No instructions.md. The agent will run without a system prompt.',
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
// ─── agent.ts ─────────────────────────────────────────────────────────
|
|
295
|
+
if (included.includes('agent')) {
|
|
296
|
+
const found = (await scanSlot(root, 'agent', '.')).files.find((f) => f.id === 'agent');
|
|
297
|
+
if (found) {
|
|
298
|
+
if (modules === 'skip') {
|
|
299
|
+
record(found, 'agent', 'not_loaded');
|
|
300
|
+
}
|
|
301
|
+
else {
|
|
302
|
+
const outcome = await importWithDeadline(pathToFileURL(found.path).href, importModule, timeoutMs);
|
|
303
|
+
if (outcome.status === 'loaded') {
|
|
304
|
+
config = readConfig(defaultExport(outcome.module), diagnostics, found.path);
|
|
305
|
+
record(found, 'agent', 'loaded');
|
|
306
|
+
}
|
|
307
|
+
else if (outcome.status === 'abandoned') {
|
|
308
|
+
diagnostics.push({
|
|
309
|
+
code: 'module_load_abandoned',
|
|
310
|
+
severity: 'error',
|
|
311
|
+
message: `agent.ts did not finish importing within ${timeoutMs}ms. The import was not cancelled and may still complete.`,
|
|
312
|
+
path: found.path,
|
|
313
|
+
});
|
|
314
|
+
record(found, 'agent', 'abandoned');
|
|
315
|
+
}
|
|
316
|
+
else {
|
|
317
|
+
diagnostics.push({
|
|
318
|
+
code: 'module_load_failed',
|
|
319
|
+
severity: 'error',
|
|
320
|
+
message: 'agent.ts could not be imported.',
|
|
321
|
+
path: found.path,
|
|
322
|
+
cause: explainImportFailure(outcome.cause, outcome.code),
|
|
323
|
+
});
|
|
324
|
+
record(found, 'agent', 'failed');
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
// ─── tools ────────────────────────────────────────────────────────────
|
|
330
|
+
if (included.includes('tools')) {
|
|
331
|
+
const scan = await scanSlot(root, 'tools', 'tools');
|
|
332
|
+
diagnostics.push(...scan.diagnostics);
|
|
333
|
+
const seen = new Map();
|
|
334
|
+
for (const file of scan.files) {
|
|
335
|
+
if (modules === 'skip') {
|
|
336
|
+
record(file, 'tools', 'not_loaded');
|
|
337
|
+
continue;
|
|
338
|
+
}
|
|
339
|
+
const outcome = await importWithDeadline(pathToFileURL(file.path).href, importModule, timeoutMs);
|
|
340
|
+
if (outcome.status === 'abandoned') {
|
|
341
|
+
diagnostics.push({
|
|
342
|
+
code: 'module_load_abandoned',
|
|
343
|
+
severity: 'error',
|
|
344
|
+
message: `${file.relativePath} did not finish importing within ${timeoutMs}ms. The import was not cancelled and may still complete.`,
|
|
345
|
+
path: file.path,
|
|
346
|
+
});
|
|
347
|
+
record(file, 'tools', 'abandoned');
|
|
348
|
+
continue;
|
|
349
|
+
}
|
|
350
|
+
if (outcome.status === 'failed') {
|
|
351
|
+
diagnostics.push({
|
|
352
|
+
code: 'module_load_failed',
|
|
353
|
+
severity: 'error',
|
|
354
|
+
message: `${file.relativePath} could not be imported.`,
|
|
355
|
+
path: file.path,
|
|
356
|
+
cause: explainImportFailure(outcome.cause, outcome.code),
|
|
357
|
+
});
|
|
358
|
+
record(file, 'tools', 'failed');
|
|
359
|
+
continue;
|
|
360
|
+
}
|
|
361
|
+
const exported = defaultExport(outcome.module);
|
|
362
|
+
if (exported === undefined) {
|
|
363
|
+
diagnostics.push({
|
|
364
|
+
code: 'no_default_export',
|
|
365
|
+
severity: 'error',
|
|
366
|
+
message: `${file.relativePath} has no default export. A tool file default-exports the result of defineTool().`,
|
|
367
|
+
path: file.path,
|
|
368
|
+
});
|
|
369
|
+
record(file, 'tools', 'failed');
|
|
370
|
+
continue;
|
|
371
|
+
}
|
|
372
|
+
if (!isToolDefinition(exported)) {
|
|
373
|
+
diagnostics.push({
|
|
374
|
+
code: 'not_a_tool',
|
|
375
|
+
severity: 'error',
|
|
376
|
+
message: `${file.relativePath} default-exports something that is not a tool definition (needs a "name" and an "execute").`,
|
|
377
|
+
path: file.path,
|
|
378
|
+
});
|
|
379
|
+
record(file, 'tools', 'failed');
|
|
380
|
+
continue;
|
|
381
|
+
}
|
|
382
|
+
const previous = seen.get(exported.name);
|
|
383
|
+
if (previous) {
|
|
384
|
+
// Refuse both rather than let one win. A registry would warn and
|
|
385
|
+
// overwrite; here the author has two files claiming one name and
|
|
386
|
+
// picking either silently is the thing that hides the mistake.
|
|
387
|
+
diagnostics.push({
|
|
388
|
+
code: 'duplicate_tool_name',
|
|
389
|
+
severity: 'error',
|
|
390
|
+
message: `Two tools both call themselves "${exported.name}": ${previous} and ${file.relativePath}. Neither was registered.`,
|
|
391
|
+
path: file.path,
|
|
392
|
+
});
|
|
393
|
+
record(file, 'tools', 'failed');
|
|
394
|
+
continue;
|
|
395
|
+
}
|
|
396
|
+
seen.set(exported.name, file.relativePath);
|
|
397
|
+
tools.push({
|
|
398
|
+
source: record(file, 'tools', 'loaded'),
|
|
399
|
+
definition: exported,
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
// ─── skills ───────────────────────────────────────────────────────────
|
|
404
|
+
if (included.includes('skills')) {
|
|
405
|
+
const scan = await scanSlot(root, 'skills', 'skills');
|
|
406
|
+
diagnostics.push(...scan.diagnostics);
|
|
407
|
+
for (const file of scan.files) {
|
|
408
|
+
try {
|
|
409
|
+
// Delegated, not reimplemented. `Skill.dirPath` is required and
|
|
410
|
+
// the prompt assembler renders `<location>{dirPath}/SKILL.md`,
|
|
411
|
+
// so a flat `skills/*.md` would produce a skill the model is
|
|
412
|
+
// told to read at a path that does not exist. Directory form is
|
|
413
|
+
// the only form that survives to runtime.
|
|
414
|
+
// `loadSkill` returns a result wrapper; the Skill is inside it.
|
|
415
|
+
const { skill } = await loadSkill(file.path);
|
|
416
|
+
skills.push({ source: record(file, 'skills', 'loaded'), skill });
|
|
417
|
+
}
|
|
418
|
+
catch (err) {
|
|
419
|
+
diagnostics.push({
|
|
420
|
+
code: 'skill_load_failed',
|
|
421
|
+
severity: 'error',
|
|
422
|
+
message: `${file.relativePath} is not a readable skill.`,
|
|
423
|
+
path: file.path,
|
|
424
|
+
cause: err instanceof Error ? err.message : String(err),
|
|
425
|
+
});
|
|
426
|
+
record(file, 'skills', 'failed');
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
// ─── agents (delegates) ───────────────────────────────────────────────
|
|
431
|
+
if (included.includes('agents')) {
|
|
432
|
+
const scan = await scanSlot(root, 'agents', 'agents');
|
|
433
|
+
diagnostics.push(...scan.diagnostics);
|
|
434
|
+
for (const entry of scan.files) {
|
|
435
|
+
if (depth >= MAX_DEPTH) {
|
|
436
|
+
diagnostics.push({
|
|
437
|
+
code: 'subagent_too_deep',
|
|
438
|
+
severity: 'warning',
|
|
439
|
+
message: entry.relativePath +
|
|
440
|
+
' was not loaded: a delegate may not declare delegates of its own.',
|
|
441
|
+
path: entry.path,
|
|
442
|
+
});
|
|
443
|
+
record(entry, 'agents', 'skipped');
|
|
444
|
+
continue;
|
|
445
|
+
}
|
|
446
|
+
const child = await loadAt(entry.path, options, depth + 1);
|
|
447
|
+
// The child's diagnostics are the parent's. A delegate that could
|
|
448
|
+
// not load is a fact about THIS project, and a caller reading one
|
|
449
|
+
// list should not have to walk the tree to find out the run will be
|
|
450
|
+
// short a specialist.
|
|
451
|
+
for (const d of child.diagnostics) {
|
|
452
|
+
diagnostics.push({ ...d, message: entry.relativePath + ': ' + d.message });
|
|
453
|
+
}
|
|
454
|
+
if (!child.ok) {
|
|
455
|
+
record(entry, 'agents', 'failed');
|
|
456
|
+
continue;
|
|
457
|
+
}
|
|
458
|
+
agents.push({
|
|
459
|
+
source: record(entry, 'agents', 'loaded'),
|
|
460
|
+
manifest: child.manifest,
|
|
461
|
+
id: entry.id,
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
const name = config.name ?? basenameOf(root);
|
|
466
|
+
return {
|
|
467
|
+
manifest: {
|
|
468
|
+
root,
|
|
469
|
+
name,
|
|
470
|
+
instructions,
|
|
471
|
+
config,
|
|
472
|
+
tools,
|
|
473
|
+
skills,
|
|
474
|
+
agents,
|
|
475
|
+
sources,
|
|
476
|
+
included,
|
|
477
|
+
modules,
|
|
478
|
+
},
|
|
479
|
+
diagnostics,
|
|
480
|
+
ok: diagnostics.every((d) => d.severity !== 'error'),
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
/** Basename, with the filesystem root falling back to a usable label. */
|
|
484
|
+
function basenameOf(root) {
|
|
485
|
+
const parts = root.split(/[\\/]/).filter(Boolean);
|
|
486
|
+
return parts[parts.length - 1] ?? 'agent';
|
|
487
|
+
}
|
|
488
|
+
//# sourceMappingURL=load.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load.js","sourceRoot":"","sources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