@namzu/sdk 5.1.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 +361 -0
- 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/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/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-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/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/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/model-version.ts +98 -0
- package/src/provider/strict-schema.ts +125 -0
- package/src/public-runtime.ts +31 -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/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/run/events.ts +15 -2
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { mkdirSync, mkdtempSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { tmpdir } from 'node:os';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { describe, expect, it } from 'vitest';
|
|
5
|
+
import { deriveSupervisorOptions } from '../derive-supervisor.js';
|
|
6
|
+
import { loadDirectory } from '../load.js';
|
|
7
|
+
/**
|
|
8
|
+
* `BaseAgentConfig` declares `tokenBudget` and `timeoutMs` as REQUIRED, and
|
|
9
|
+
* `deriveSupervisorOptions` supplied them only when `agent.ts` happened to
|
|
10
|
+
* name them — which is the uncommon case. An `as SupervisorAgentConfig` made
|
|
11
|
+
* that compile, so the returned object was typed `tokenBudget: number` while
|
|
12
|
+
* holding `undefined`.
|
|
13
|
+
*
|
|
14
|
+
* The consequence is not a type-level nicety. `buildLimitConfig` defaults only
|
|
15
|
+
* `maxIterations`, so an undefined budget and timeout disable BOTH hard stops
|
|
16
|
+
* — a project-derived supervisor ran with no token cap and no wall clock. And
|
|
17
|
+
* the child-spawn guard computes a delegate's allocation from the parent
|
|
18
|
+
* budget, so `undefined` became `NaN`, and `NaN <= 0` is false: the refusal
|
|
19
|
+
* that exists to stop an unfunded child let it through.
|
|
20
|
+
*
|
|
21
|
+
* The cast is now `satisfies`, which is what keeps this from recurring — but
|
|
22
|
+
* a type check is not a test, so the values are asserted here too.
|
|
23
|
+
*/
|
|
24
|
+
const provider = { id: 'mock', name: 'Mock' };
|
|
25
|
+
const agentManager = { sendMessage: async () => ({}) };
|
|
26
|
+
function tree(files) {
|
|
27
|
+
const root = mkdtempSync(join(tmpdir(), 'namzu-budget-'));
|
|
28
|
+
for (const [relative, body] of Object.entries(files)) {
|
|
29
|
+
const full = join(root, relative);
|
|
30
|
+
mkdirSync(join(full, '..'), { recursive: true });
|
|
31
|
+
writeFileSync(full, body);
|
|
32
|
+
}
|
|
33
|
+
return root;
|
|
34
|
+
}
|
|
35
|
+
const MINIMAL = {
|
|
36
|
+
'agent.js': 'export default { model: "m" }',
|
|
37
|
+
'agents/researcher/agent.js': 'export default { model: "m2" }',
|
|
38
|
+
'agents/researcher/instructions.md': 'Research things.',
|
|
39
|
+
};
|
|
40
|
+
describe('a derived supervisor always has a budget and a clock', () => {
|
|
41
|
+
it('defaults both when agent.ts names neither', async () => {
|
|
42
|
+
const { manifest } = await loadDirectory(tree(MINIMAL));
|
|
43
|
+
const { config } = deriveSupervisorOptions(manifest, { provider, agentManager });
|
|
44
|
+
// The exact numbers matter less than that they are finite: a NaN or an
|
|
45
|
+
// undefined here is what silently disabled the limits.
|
|
46
|
+
expect(Number.isFinite(config.tokenBudget)).toBe(true);
|
|
47
|
+
expect(Number.isFinite(config.timeoutMs)).toBe(true);
|
|
48
|
+
expect(config.tokenBudget).toBeGreaterThan(0);
|
|
49
|
+
expect(config.timeoutMs).toBeGreaterThan(0);
|
|
50
|
+
});
|
|
51
|
+
it('uses the same defaults the SDK front door uses', async () => {
|
|
52
|
+
// Imported from the module that owns them rather than through the
|
|
53
|
+
// package entry: this file now lives inside that package, and a
|
|
54
|
+
// self-import resolves to the built `dist`, not to the source under
|
|
55
|
+
// test — which is how a stale build reads as a passing test.
|
|
56
|
+
const { DEFAULT_TIMEOUT_MS, DEFAULT_TOKEN_BUDGET } = await import('../../agents/runAgent.js');
|
|
57
|
+
const { manifest } = await loadDirectory(tree(MINIMAL));
|
|
58
|
+
const { config } = deriveSupervisorOptions(manifest, { provider, agentManager });
|
|
59
|
+
// Two front doors that default differently is a difference nobody would
|
|
60
|
+
// find until a run behaved unlike its sibling.
|
|
61
|
+
expect(config.tokenBudget).toBe(DEFAULT_TOKEN_BUDGET);
|
|
62
|
+
expect(config.timeoutMs).toBe(DEFAULT_TIMEOUT_MS);
|
|
63
|
+
});
|
|
64
|
+
it('still honours what agent.ts declares', async () => {
|
|
65
|
+
const { manifest } = await loadDirectory(tree({
|
|
66
|
+
...MINIMAL,
|
|
67
|
+
'agent.js': 'export default { model: "m", tokenBudget: 1234, timeoutMs: 5678 }',
|
|
68
|
+
}));
|
|
69
|
+
const { config } = deriveSupervisorOptions(manifest, { provider, agentManager });
|
|
70
|
+
expect(config.tokenBudget).toBe(1234);
|
|
71
|
+
expect(config.timeoutMs).toBe(5678);
|
|
72
|
+
});
|
|
73
|
+
it('lets an override win over both', async () => {
|
|
74
|
+
const { manifest } = await loadDirectory(tree(MINIMAL));
|
|
75
|
+
const { config } = deriveSupervisorOptions(manifest, {
|
|
76
|
+
provider,
|
|
77
|
+
agentManager,
|
|
78
|
+
overrides: { tokenBudget: 42 },
|
|
79
|
+
});
|
|
80
|
+
expect(config.tokenBudget).toBe(42);
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
describe('a derived supervisor carries the skills it loaded', () => {
|
|
84
|
+
it('passes skills through instead of dropping them', async () => {
|
|
85
|
+
const { manifest } = await loadDirectory(tree({
|
|
86
|
+
...MINIMAL,
|
|
87
|
+
'skills/plan-a-trip/SKILL.md': '---\nname: plan-a-trip\ndescription: Plan a trip\n---\n\nAsk for dates.',
|
|
88
|
+
}));
|
|
89
|
+
expect(manifest.skills).toHaveLength(1);
|
|
90
|
+
const { config } = deriveSupervisorOptions(manifest, { provider, agentManager });
|
|
91
|
+
// Loaded from disk, put on the manifest, and then — before this — left
|
|
92
|
+
// out of the config the supervisor actually runs with.
|
|
93
|
+
expect(config.skills).toHaveLength(1);
|
|
94
|
+
expect(config.skills?.[0]?.metadata.name).toBe('plan-a-trip');
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
//# sourceMappingURL=supervisor-budget.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supervisor-budget.test.js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,CAAC,CACF,CAAA;QACD,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAA;QAEvC,MAAM,EAAE,MAAM,EAAE,GAAG,uBAAuB,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,CAAA;QAEhF,uEAAuE;QACvE,uDAAuD;QACvD,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAA;QACrC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;IAC9D,CAAC,CAAC,CAAA;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { AgentIdentity } from '../agents/runAgent.js';
|
|
2
|
+
import { ToolRegistry } from '../registry/tool/execute.js';
|
|
3
|
+
import type { SupervisorAgentConfig } from '../types/agent/supervisor.js';
|
|
4
|
+
import type { LLMProvider } from '../types/provider/index.js';
|
|
5
|
+
import type { DirectoryManifest } from './types.js';
|
|
6
|
+
export interface DeriveSupervisorInput {
|
|
7
|
+
readonly provider: LLMProvider;
|
|
8
|
+
/** Wins over `agent.ts`. Required when `agent.ts` names no model. */
|
|
9
|
+
readonly model?: string;
|
|
10
|
+
readonly identity?: Required<AgentIdentity>;
|
|
11
|
+
/**
|
|
12
|
+
* The lifecycle object that actually spawns delegates.
|
|
13
|
+
*
|
|
14
|
+
* Supplied by the host and never built here. An `AgentManager` owns
|
|
15
|
+
* running processes, budgets and cancellation — it is a thing with a
|
|
16
|
+
* lifetime, not a description of one, and this package's whole boundary is
|
|
17
|
+
* that it describes and does not run. Handing back options that carry a
|
|
18
|
+
* manager we constructed would make it a runner wearing a loader's name.
|
|
19
|
+
*/
|
|
20
|
+
readonly agentManager: SupervisorAgentConfig['agentManager'];
|
|
21
|
+
readonly overrides?: Partial<SupervisorAgentConfig>;
|
|
22
|
+
}
|
|
23
|
+
export interface SupervisorPlan {
|
|
24
|
+
/** Ready for `new SupervisorAgent(...).run(input, config)`. */
|
|
25
|
+
readonly config: SupervisorAgentConfig;
|
|
26
|
+
/**
|
|
27
|
+
* What the host must register with its `AgentManager` before running,
|
|
28
|
+
* one per delegate, keyed by the id the supervisor will name.
|
|
29
|
+
*
|
|
30
|
+
* Returned rather than registered: registration is a mutation of the
|
|
31
|
+
* host's manager, and a function that quietly mutates an object it was
|
|
32
|
+
* handed for reference is the kind of surprise this package exists to
|
|
33
|
+
* avoid. The host does it, in one loop it can see.
|
|
34
|
+
*/
|
|
35
|
+
readonly delegates: readonly DelegatePlan[];
|
|
36
|
+
}
|
|
37
|
+
export interface DelegatePlan {
|
|
38
|
+
readonly id: string;
|
|
39
|
+
readonly manifest: DirectoryManifest;
|
|
40
|
+
/** The delegate's own instructions, tools and model, already assembled. */
|
|
41
|
+
readonly systemPrompt: string;
|
|
42
|
+
readonly tools: ToolRegistry;
|
|
43
|
+
readonly model: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Turn a project that declares delegates into a supervisor configuration.
|
|
47
|
+
*
|
|
48
|
+
* The counterpart to `deriveRunOptions` for the multi-agent shape, and the
|
|
49
|
+
* same contract: it converts, it does not run. `SupervisorAgent` needs an
|
|
50
|
+
* `agentIds` roster and a manager that can spawn them; this supplies the
|
|
51
|
+
* roster from the directory and leaves the manager to the host.
|
|
52
|
+
*
|
|
53
|
+
* The delegates come back as plans rather than registered agents because
|
|
54
|
+
* registration mutates the host's manager. Two lines in the host, and the host
|
|
55
|
+
* can see exactly what it just gained.
|
|
56
|
+
*/
|
|
57
|
+
export declare function deriveSupervisorOptions(manifest: DirectoryManifest, input: DeriveSupervisorInput): SupervisorPlan;
|
|
58
|
+
//# sourceMappingURL=derive-supervisor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derive-supervisor.d.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,qBAAqB,GAC1B,cAAc,CA+DhB"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { DEFAULT_TIMEOUT_MS, DEFAULT_TOKEN_BUDGET } from '../agents/runAgent.js';
|
|
2
|
+
import { ToolRegistry } from '../registry/tool/execute.js';
|
|
3
|
+
function toolsOf(manifest) {
|
|
4
|
+
const tools = new ToolRegistry();
|
|
5
|
+
for (const entry of manifest.tools)
|
|
6
|
+
tools.register(entry.definition);
|
|
7
|
+
return tools;
|
|
8
|
+
}
|
|
9
|
+
function delegatePlan(entry, fallbackModel) {
|
|
10
|
+
return {
|
|
11
|
+
id: entry.id,
|
|
12
|
+
manifest: entry.manifest,
|
|
13
|
+
systemPrompt: entry.manifest.instructions,
|
|
14
|
+
tools: toolsOf(entry.manifest),
|
|
15
|
+
// A delegate may name its own model — a cheap one for a narrow job is
|
|
16
|
+
// the common case — and inherits the supervisor's only when it does
|
|
17
|
+
// not. Inheriting unconditionally would silently bill every specialist
|
|
18
|
+
// at the coordinator's rate.
|
|
19
|
+
model: entry.manifest.config.model ?? fallbackModel,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Turn a project that declares delegates into a supervisor configuration.
|
|
24
|
+
*
|
|
25
|
+
* The counterpart to `deriveRunOptions` for the multi-agent shape, and the
|
|
26
|
+
* same contract: it converts, it does not run. `SupervisorAgent` needs an
|
|
27
|
+
* `agentIds` roster and a manager that can spawn them; this supplies the
|
|
28
|
+
* roster from the directory and leaves the manager to the host.
|
|
29
|
+
*
|
|
30
|
+
* The delegates come back as plans rather than registered agents because
|
|
31
|
+
* registration mutates the host's manager. Two lines in the host, and the host
|
|
32
|
+
* can see exactly what it just gained.
|
|
33
|
+
*/
|
|
34
|
+
export function deriveSupervisorOptions(manifest, input) {
|
|
35
|
+
if (manifest.modules === 'skip') {
|
|
36
|
+
throw new Error('This manifest was loaded with modules: "skip", so no tool was imported and no delegate was evaluated. Load with modules: "evaluate" before deriving supervisor options.');
|
|
37
|
+
}
|
|
38
|
+
if (manifest.agents.length === 0) {
|
|
39
|
+
// Not a warning that degrades into a supervisor with nobody to call.
|
|
40
|
+
// An empty roster makes `create_task` unmountable by design, so the
|
|
41
|
+
// result would be a coordinator that cannot coordinate — and the
|
|
42
|
+
// caller asked for a supervisor, which means they expected delegates.
|
|
43
|
+
throw new Error(`${manifest.root} declares no delegates, so there is nothing for a supervisor to coordinate. Add directories under agents/, or use deriveRunOptions for a single agent.`);
|
|
44
|
+
}
|
|
45
|
+
const model = input.model ?? manifest.config.model;
|
|
46
|
+
if (!model) {
|
|
47
|
+
throw new Error(`No model. Declare one in ${manifest.root}/agent.ts as \`export default { model: "…" }\`, or pass \`model\` here.`);
|
|
48
|
+
}
|
|
49
|
+
const delegates = manifest.agents.map((entry) => delegatePlan(entry, model));
|
|
50
|
+
const config = {
|
|
51
|
+
provider: input.provider,
|
|
52
|
+
model,
|
|
53
|
+
agentManager: input.agentManager,
|
|
54
|
+
agentIds: delegates.map((d) => d.id),
|
|
55
|
+
systemPrompt: manifest.instructions,
|
|
56
|
+
tools: toolsOf(manifest),
|
|
57
|
+
// Skills were loaded and then dropped. The manifest reads a whole
|
|
58
|
+
// `skills/` directory and `SupervisorAgentConfig` takes them, and the
|
|
59
|
+
// cast that used to close this object meant nobody was told the field
|
|
60
|
+
// had never been supplied.
|
|
61
|
+
...(manifest.skills.length > 0 ? { skills: manifest.skills.map((s) => s.skill) } : {}),
|
|
62
|
+
// `tokenBudget` and `timeoutMs` are REQUIRED by `BaseAgentConfig`, and
|
|
63
|
+
// this object supplied them only when `agent.ts` happened to declare
|
|
64
|
+
// them — which is the uncommon case. The `as SupervisorAgentConfig`
|
|
65
|
+
// below made that compile, so a directory that named no budget produced
|
|
66
|
+
// a config typed `tokenBudget: number` holding `undefined`, and
|
|
67
|
+
// `buildLimitConfig` then disabled BOTH hard stops: no token cap, no
|
|
68
|
+
// wall clock. Worse, the child-spawn refusal computes its allocation
|
|
69
|
+
// from the parent budget, so `undefined` became `NaN`, and `NaN <= 0`
|
|
70
|
+
// is false — the guard that exists to refuse an unfunded child let it
|
|
71
|
+
// through with a NaN budget.
|
|
72
|
+
//
|
|
73
|
+
// Defaulted to the same numbers `runAgent` uses rather than to a local
|
|
74
|
+
// guess, so the two front doors cannot drift.
|
|
75
|
+
tokenBudget: manifest.config.tokenBudget ?? DEFAULT_TOKEN_BUDGET,
|
|
76
|
+
timeoutMs: manifest.config.timeoutMs ?? DEFAULT_TIMEOUT_MS,
|
|
77
|
+
...(manifest.config.temperature !== undefined
|
|
78
|
+
? { temperature: manifest.config.temperature }
|
|
79
|
+
: {}),
|
|
80
|
+
...(manifest.config.maxIterations !== undefined
|
|
81
|
+
? { maxIterations: manifest.config.maxIterations }
|
|
82
|
+
: {}),
|
|
83
|
+
...(input.identity ?? {}),
|
|
84
|
+
...(input.overrides ?? {}),
|
|
85
|
+
};
|
|
86
|
+
return { config, delegates };
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=derive-supervisor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derive-supervisor.js","sourceRoot":"","sources":["../../src/directory/derive-supervisor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAEhF,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAgD1D,SAAS,OAAO,CAAC,QAA2B;IAC3C,MAAM,KAAK,GAAG,IAAI,YAAY,EAAE,CAAA;IAChC,KAAK,MAAM,KAAK,IAAI,QAAQ,CAAC,KAAK;QAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;IACpE,OAAO,KAAK,CAAA;AACb,CAAC;AAED,SAAS,YAAY,CAAC,KAAoB,EAAE,aAAqB;IAChE,OAAO;QACN,EAAE,EAAE,KAAK,CAAC,EAAE;QACZ,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,YAA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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":"","sources":["../../src/directory/derive.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAI1D;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAC/B,QAA2B,EAC3B,KAA4B;IAE5B,IAAI,QAAQ,CAAC,OAAO,KAAK,MAAM,EAAE,CAAC;QACjC,iEAAiE;QACjE,uEAAuE;QACvE,oEAAoE;QACpE,sCAAsC;QACtC,MAAM,IAAI,KAAK,CACd,+JAA+J,CAC/J,CAAA;IACF,CAAC;IAED,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,IAAI,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAA;IAClD,IAAI,CAAC,KAAK,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CACd,4BAA4B,QAAQ,CAAC,IAAI,yEAAyE,CAClH,CAAA;IACF,CAAC;IAED,MAAM,KAAK,GAAG,IAAI,YAAY,EAAE,CAAA;IAChC,KAAK,MAAM,KAAK,IAAI,QAAQ,CAAC,KAAK;QAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;IAEpE,OAAO;QACN,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,KAAK;QACL,KAAK;QACL,oEAAoE;QACpE,kEAAkE;QAClE,kEAAkE;QAClE,qEAAqE;QACrE,oEAAoE;QACpE,uBAAuB;QACvB,gBAAgB,EAAE,QAAQ,CAAC,IAAI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C5F,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"}
|