@cuylabs/agent-code 0.8.0 → 0.10.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/README.md +1 -1
- package/dist/{chunk-DXHZSPO6.js → chunk-554MRR24.js} +50 -12
- package/dist/index.d.ts +36 -15
- package/dist/index.js +70 -22
- package/dist/tools/index.d.ts +11 -11
- package/dist/tools/index.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ such as:
|
|
|
20
20
|
|
|
21
21
|
- middleware and prompt construction
|
|
22
22
|
- runtime helpers
|
|
23
|
-
- skills,
|
|
23
|
+
- skills, profiles, and subagent composition
|
|
24
24
|
- non-coding toolsets or framework-level customization
|
|
25
25
|
|
|
26
26
|
Focused tool imports are available from `@cuylabs/agent-code/tools`.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/tools/bash.ts
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import { Tool, truncateOutput } from "@cuylabs/agent-core";
|
|
3
|
+
import { Tool, getRequiredToolHost, truncateOutput } from "@cuylabs/agent-core";
|
|
4
4
|
var DEFAULT_TIMEOUT = 2 * 60 * 1e3;
|
|
5
5
|
var bashParameters = z.object({
|
|
6
6
|
command: z.string().describe("The shell command to execute"),
|
|
@@ -39,13 +39,19 @@ IMPORTANT:
|
|
|
39
39
|
- Output is automatically truncated if too long
|
|
40
40
|
- For pager commands, output is piped through 'cat' automatically`,
|
|
41
41
|
parameters: bashParameters,
|
|
42
|
+
hostRequirements: {
|
|
43
|
+
shell: true
|
|
44
|
+
},
|
|
42
45
|
replayPolicy: {
|
|
43
46
|
mode: "manual",
|
|
44
47
|
sideEffectLevel: "external",
|
|
45
48
|
reason: "Arbitrary shell execution may affect processes, services, or systems outside the current turn."
|
|
46
49
|
},
|
|
47
50
|
async execute(params, ctx) {
|
|
48
|
-
const host = ctx
|
|
51
|
+
const host = getRequiredToolHost(ctx, {
|
|
52
|
+
toolName: "bash",
|
|
53
|
+
usage: "shell execution"
|
|
54
|
+
});
|
|
49
55
|
const result = await executeBash(params, host, ctx.cwd, ctx.abort);
|
|
50
56
|
let output = "";
|
|
51
57
|
if (result.stdout) {
|
|
@@ -82,7 +88,7 @@ ${result.stderr}`;
|
|
|
82
88
|
// src/tools/read.ts
|
|
83
89
|
import { z as z2 } from "zod";
|
|
84
90
|
import * as path from "path";
|
|
85
|
-
import { Tool as Tool2 } from "@cuylabs/agent-core";
|
|
91
|
+
import { Tool as Tool2, getRequiredToolHost as getRequiredToolHost2 } from "@cuylabs/agent-core";
|
|
86
92
|
var DEFAULT_READ_LIMIT = 2e3;
|
|
87
93
|
var MAX_LINE_LENGTH = 2e3;
|
|
88
94
|
var MAX_BYTES = 50 * 1024;
|
|
@@ -164,12 +170,18 @@ IMPORTANT:
|
|
|
164
170
|
- Binary files cannot be read
|
|
165
171
|
- Images and PDFs are returned as attachments`,
|
|
166
172
|
parameters: readParameters,
|
|
173
|
+
hostRequirements: {
|
|
174
|
+
filesystem: "read"
|
|
175
|
+
},
|
|
167
176
|
replayPolicy: {
|
|
168
177
|
sideEffectLevel: "none",
|
|
169
178
|
reason: "Read-only file inspection is safe to replay."
|
|
170
179
|
},
|
|
171
180
|
async execute(params, ctx) {
|
|
172
|
-
const host = ctx
|
|
181
|
+
const host = getRequiredToolHost2(ctx, {
|
|
182
|
+
toolName: "read",
|
|
183
|
+
usage: "filesystem read access"
|
|
184
|
+
});
|
|
173
185
|
let filepath = params.filePath;
|
|
174
186
|
if (!path.isAbsolute(filepath)) {
|
|
175
187
|
filepath = path.resolve(ctx.cwd, filepath);
|
|
@@ -260,7 +272,7 @@ ${suggestions.join("\n")}`
|
|
|
260
272
|
// src/tools/edit.ts
|
|
261
273
|
import { z as z3 } from "zod";
|
|
262
274
|
import * as path2 from "path";
|
|
263
|
-
import { Tool as Tool3 } from "@cuylabs/agent-core";
|
|
275
|
+
import { Tool as Tool3, getRequiredToolHost as getRequiredToolHost3 } from "@cuylabs/agent-core";
|
|
264
276
|
function normalizeLineEndings(text) {
|
|
265
277
|
return text.replaceAll("\r\n", "\n");
|
|
266
278
|
}
|
|
@@ -369,6 +381,9 @@ IMPORTANT:
|
|
|
369
381
|
- Use replaceAll: true to replace all occurrences
|
|
370
382
|
- For creating new files, use the write tool instead`,
|
|
371
383
|
parameters: editParameters,
|
|
384
|
+
hostRequirements: {
|
|
385
|
+
filesystem: "write"
|
|
386
|
+
},
|
|
372
387
|
replayPolicy: {
|
|
373
388
|
mode: "manual",
|
|
374
389
|
sideEffectLevel: "local",
|
|
@@ -387,7 +402,10 @@ IMPORTANT:
|
|
|
387
402
|
if (!path2.isAbsolute(filepath)) {
|
|
388
403
|
filepath = path2.resolve(ctx.cwd, filepath);
|
|
389
404
|
}
|
|
390
|
-
const host = ctx
|
|
405
|
+
const host = getRequiredToolHost3(ctx, {
|
|
406
|
+
toolName: "edit",
|
|
407
|
+
usage: "filesystem write access"
|
|
408
|
+
});
|
|
391
409
|
const title = path2.relative(ctx.cwd, filepath);
|
|
392
410
|
if (params.oldString === "") {
|
|
393
411
|
await host.mkdir(path2.dirname(filepath));
|
|
@@ -453,7 +471,7 @@ ${diff}`,
|
|
|
453
471
|
// src/tools/write.ts
|
|
454
472
|
import { z as z4 } from "zod";
|
|
455
473
|
import * as path3 from "path";
|
|
456
|
-
import { Tool as Tool4 } from "@cuylabs/agent-core";
|
|
474
|
+
import { Tool as Tool4, getRequiredToolHost as getRequiredToolHost4 } from "@cuylabs/agent-core";
|
|
457
475
|
var writeParameters = z4.object({
|
|
458
476
|
filePath: z4.string().describe("The absolute path to the file to write"),
|
|
459
477
|
content: z4.string().describe("The content to write to the file")
|
|
@@ -467,6 +485,9 @@ IMPORTANT:
|
|
|
467
485
|
- Parent directories are created automatically
|
|
468
486
|
- Existing content is completely replaced`,
|
|
469
487
|
parameters: writeParameters,
|
|
488
|
+
hostRequirements: {
|
|
489
|
+
filesystem: "write"
|
|
490
|
+
},
|
|
470
491
|
replayPolicy: {
|
|
471
492
|
mode: "manual",
|
|
472
493
|
sideEffectLevel: "local",
|
|
@@ -483,7 +504,10 @@ IMPORTANT:
|
|
|
483
504
|
filepath = path3.resolve(ctx.cwd, filepath);
|
|
484
505
|
}
|
|
485
506
|
const title = path3.relative(ctx.cwd, filepath);
|
|
486
|
-
const host = ctx
|
|
507
|
+
const host = getRequiredToolHost4(ctx, {
|
|
508
|
+
toolName: "write",
|
|
509
|
+
usage: "filesystem write access"
|
|
510
|
+
});
|
|
487
511
|
let exists = false;
|
|
488
512
|
let oldContent = "";
|
|
489
513
|
try {
|
|
@@ -523,7 +547,7 @@ Created with ${lines} lines`;
|
|
|
523
547
|
// src/tools/grep.ts
|
|
524
548
|
import { z as z5 } from "zod";
|
|
525
549
|
import * as path4 from "path";
|
|
526
|
-
import { Tool as Tool5 } from "@cuylabs/agent-core";
|
|
550
|
+
import { Tool as Tool5, getRequiredToolHost as getRequiredToolHost5 } from "@cuylabs/agent-core";
|
|
527
551
|
var MAX_LINE_LENGTH2 = 2e3;
|
|
528
552
|
var MAX_RESULTS = 100;
|
|
529
553
|
function sq(s) {
|
|
@@ -600,6 +624,10 @@ IMPORTANT:
|
|
|
600
624
|
- Results are sorted by modification time (newest first)
|
|
601
625
|
- Maximum ${MAX_RESULTS} results returned`,
|
|
602
626
|
parameters: grepParameters,
|
|
627
|
+
hostRequirements: {
|
|
628
|
+
filesystem: "read",
|
|
629
|
+
shell: true
|
|
630
|
+
},
|
|
603
631
|
replayPolicy: {
|
|
604
632
|
sideEffectLevel: "none",
|
|
605
633
|
reason: "Content search is read-only and safe to repeat."
|
|
@@ -608,7 +636,10 @@ IMPORTANT:
|
|
|
608
636
|
if (!params.pattern) {
|
|
609
637
|
throw new Error("pattern is required");
|
|
610
638
|
}
|
|
611
|
-
const host = ctx
|
|
639
|
+
const host = getRequiredToolHost5(ctx, {
|
|
640
|
+
toolName: "grep",
|
|
641
|
+
usage: "filesystem search and shell execution"
|
|
642
|
+
});
|
|
612
643
|
const result = await executeGrep(params, host, ctx.cwd, ctx.abort);
|
|
613
644
|
if (result.matches.length === 0) {
|
|
614
645
|
return {
|
|
@@ -636,7 +667,7 @@ IMPORTANT:
|
|
|
636
667
|
// src/tools/glob.ts
|
|
637
668
|
import { z as z6 } from "zod";
|
|
638
669
|
import * as path5 from "path";
|
|
639
|
-
import { Tool as Tool6 } from "@cuylabs/agent-core";
|
|
670
|
+
import { Tool as Tool6, getRequiredToolHost as getRequiredToolHost6 } from "@cuylabs/agent-core";
|
|
640
671
|
var MAX_RESULTS2 = 100;
|
|
641
672
|
function sq2(s) {
|
|
642
673
|
return "'" + s.replace(/'/g, "'\\''") + "'";
|
|
@@ -709,12 +740,19 @@ IMPORTANT:
|
|
|
709
740
|
- Results are sorted by modification time (newest first)
|
|
710
741
|
- Maximum ${MAX_RESULTS2} results returned`,
|
|
711
742
|
parameters: globParameters,
|
|
743
|
+
hostRequirements: {
|
|
744
|
+
filesystem: "read",
|
|
745
|
+
shell: true
|
|
746
|
+
},
|
|
712
747
|
replayPolicy: {
|
|
713
748
|
sideEffectLevel: "none",
|
|
714
749
|
reason: "Filesystem discovery does not mutate state."
|
|
715
750
|
},
|
|
716
751
|
async execute(params, ctx) {
|
|
717
|
-
const host = ctx
|
|
752
|
+
const host = getRequiredToolHost6(ctx, {
|
|
753
|
+
toolName: "glob",
|
|
754
|
+
usage: "filesystem search"
|
|
755
|
+
});
|
|
718
756
|
const searchPath = params.path ? path5.isAbsolute(params.path) ? params.path : path5.resolve(ctx.cwd, params.path) : ctx.cwd;
|
|
719
757
|
const { files, truncated } = await findFiles(
|
|
720
758
|
params.pattern,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { AgentConfig, ToolSpec, ApprovalMiddlewareConfig, PromptCacheConfig, SkillConfig, SkillRegistry,
|
|
1
|
+
import { AgentConfig, ToolSpec, ApprovalMiddlewareConfig, PromptCacheConfig, SkillConfig, SkillRegistry, SessionManager, FileStorageOptions, Agent } from '@cuylabs/agent-core';
|
|
2
2
|
export * from '@cuylabs/agent-core';
|
|
3
|
+
export { Agent, ApprovalAction, ApprovalMiddlewareConfig, ApprovalRequest, LLMError, ModelEntry, PluginCommand, PluginRegistry, SkillMetadata, SkillRegistry, StaticSettings, configureResolver, createSkillRegistry, defaultRegistry, discoverPlugins, getDefaultResolver, isDefinedPlugin, loadPluginModule } from '@cuylabs/agent-core';
|
|
4
|
+
import { SubAgentConfig, SubAgentRole } from '@cuylabs/agent-core/subagents';
|
|
5
|
+
export { SubAgentRole, discoverSubAgentRoles } from '@cuylabs/agent-core/subagents';
|
|
3
6
|
export { z } from 'zod';
|
|
4
7
|
export { B as BashParams, E as EditParams, G as GlobParams, a as GrepParams, R as ReadParams, T as ToolsetBuilder, W as WriteParams, b as bashParameters, c as bashTool, d as defaultCodingTools, e as editParameters, f as editTool, g as executeBash, h as executeGrep, i as globParameters, j as globTool, k as grepParameters, l as grepTool, r as readParameters, m as readTool, n as resolveTools, s as setupToolRegistry, t as toolset, w as writeParameters, o as writeTool } from './toolset-DdlrWOqv.js';
|
|
5
8
|
|
|
@@ -17,15 +20,31 @@ interface CodingSessionStorageOptions extends Partial<Omit<FileStorageOptions, "
|
|
|
17
20
|
*/
|
|
18
21
|
appName?: string;
|
|
19
22
|
}
|
|
20
|
-
interface CodingSubAgentOptions extends Omit<
|
|
23
|
+
interface CodingSubAgentOptions extends Omit<SubAgentConfig, "roles"> {
|
|
21
24
|
/**
|
|
22
|
-
* Specialist
|
|
25
|
+
* Specialist roles exposed through `invoke_agent`.
|
|
23
26
|
*
|
|
24
|
-
* Defaults to `
|
|
27
|
+
* Defaults to `defaultCodingRoles`.
|
|
25
28
|
*/
|
|
26
|
-
|
|
29
|
+
roles?: SubAgentRole[];
|
|
30
|
+
/**
|
|
31
|
+
* Additional markdown agent file paths to load.
|
|
32
|
+
*
|
|
33
|
+
* Resolved relative to `cwd`. These are loaded in addition to
|
|
34
|
+
* the standard discovery directories.
|
|
35
|
+
*/
|
|
36
|
+
agentPaths?: string[];
|
|
37
|
+
/**
|
|
38
|
+
* Disable markdown agent discovery.
|
|
39
|
+
*
|
|
40
|
+
* When `true`, only built-in TypeScript roles (and any explicit
|
|
41
|
+
* `roles` array) are used — no filesystem scanning.
|
|
42
|
+
*
|
|
43
|
+
* @default false
|
|
44
|
+
*/
|
|
45
|
+
disableDiscovery?: boolean;
|
|
27
46
|
}
|
|
28
|
-
interface CodingAgentOptions extends AgentConfig {
|
|
47
|
+
interface CodingAgentOptions extends Omit<AgentConfig, "approval"> {
|
|
29
48
|
/**
|
|
30
49
|
* Coding tools to expose. Defaults to the full coding toolset.
|
|
31
50
|
*
|
|
@@ -51,12 +70,14 @@ interface CodingAgentOptions extends AgentConfig {
|
|
|
51
70
|
*/
|
|
52
71
|
skills?: boolean | SkillConfig | SkillRegistry;
|
|
53
72
|
/**
|
|
54
|
-
*
|
|
73
|
+
* Subagent delegation configuration.
|
|
55
74
|
*
|
|
56
75
|
* Defaults to `true`, which enables `invoke_agent` with the default
|
|
57
|
-
* coding specialist
|
|
76
|
+
* coding specialist roles. The concrete backend is selected by the host:
|
|
77
|
+
* local agents install the in-process backend, while compatible runtime
|
|
78
|
+
* packages can replace it with their own implementation.
|
|
58
79
|
*/
|
|
59
|
-
|
|
80
|
+
subagents?: boolean | CodingSubAgentOptions;
|
|
60
81
|
/**
|
|
61
82
|
* Explicit session manager. Overrides `sessionStorage` when provided.
|
|
62
83
|
*/
|
|
@@ -77,7 +98,7 @@ interface CodingAgentSetupResult {
|
|
|
77
98
|
* Assemble a batteries-included coding agent from `agent-core` primitives.
|
|
78
99
|
*
|
|
79
100
|
* This wires the coding toolset, optional approval middleware, skill tools,
|
|
80
|
-
* persistent sessions, and
|
|
101
|
+
* persistent sessions, and subagent delegation into a reusable package-level
|
|
81
102
|
* surface. UI-specific concerns stay outside this helper.
|
|
82
103
|
*/
|
|
83
104
|
declare function setupCodingAgent(options: CodingAgentOptions): Promise<CodingAgentSetupResult>;
|
|
@@ -90,11 +111,11 @@ declare function setupCodingAgent(options: CodingAgentOptions): Promise<CodingAg
|
|
|
90
111
|
declare function createCodingAgent(options: CodingAgentOptions): Promise<Agent>;
|
|
91
112
|
|
|
92
113
|
/**
|
|
93
|
-
* Default specialist
|
|
114
|
+
* Default specialist roles for coding-focused subagents.
|
|
94
115
|
*
|
|
95
|
-
* These are the
|
|
96
|
-
* `
|
|
116
|
+
* These are the roles enabled by `setupCodingAgent()` when
|
|
117
|
+
* `subagents: true` is used.
|
|
97
118
|
*/
|
|
98
|
-
declare const
|
|
119
|
+
declare const defaultCodingRoles: SubAgentRole[];
|
|
99
120
|
|
|
100
|
-
export { type CodingAgentOptions, type CodingAgentSetupResult, type CodingSessionStorageOptions, type CodingSubAgentOptions, createCodingAgent,
|
|
121
|
+
export { type CodingAgentOptions, type CodingAgentSetupResult, type CodingSessionStorageOptions, type CodingSubAgentOptions, createCodingAgent, defaultCodingRoles, setupCodingAgent };
|
package/dist/index.js
CHANGED
|
@@ -18,10 +18,27 @@ import {
|
|
|
18
18
|
toolset,
|
|
19
19
|
writeParameters,
|
|
20
20
|
writeTool
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-554MRR24.js";
|
|
22
22
|
|
|
23
23
|
// src/index.ts
|
|
24
24
|
export * from "@cuylabs/agent-core";
|
|
25
|
+
import {
|
|
26
|
+
Agent,
|
|
27
|
+
configureResolver,
|
|
28
|
+
createSkillRegistry as createSkillRegistry2,
|
|
29
|
+
defaultRegistry,
|
|
30
|
+
discoverPlugins,
|
|
31
|
+
getDefaultResolver,
|
|
32
|
+
isDefinedPlugin,
|
|
33
|
+
LLMError,
|
|
34
|
+
loadPluginModule,
|
|
35
|
+
PluginRegistry,
|
|
36
|
+
SkillRegistry as SkillRegistry2,
|
|
37
|
+
StaticSettings
|
|
38
|
+
} from "@cuylabs/agent-core";
|
|
39
|
+
import {
|
|
40
|
+
discoverSubAgentRoles as discoverSubAgentRoles2
|
|
41
|
+
} from "@cuylabs/agent-core/subagents";
|
|
25
42
|
import { z } from "zod";
|
|
26
43
|
|
|
27
44
|
// src/create.ts
|
|
@@ -35,36 +52,40 @@ import {
|
|
|
35
52
|
createAgent,
|
|
36
53
|
createSkillRegistry,
|
|
37
54
|
createSkillTools,
|
|
38
|
-
createSubAgentTools,
|
|
39
55
|
getProjectSessionsDir,
|
|
40
56
|
promptCacheMiddleware
|
|
41
57
|
} from "@cuylabs/agent-core";
|
|
58
|
+
import {
|
|
59
|
+
configureSubAgents,
|
|
60
|
+
discoverSubAgentRoles,
|
|
61
|
+
installLocalSubAgents
|
|
62
|
+
} from "@cuylabs/agent-core/subagents";
|
|
42
63
|
|
|
43
|
-
// src/
|
|
44
|
-
import {
|
|
45
|
-
var
|
|
64
|
+
// src/roles.ts
|
|
65
|
+
import { Profiles } from "@cuylabs/agent-core/profiles";
|
|
66
|
+
var defaultCodingRoles = [
|
|
46
67
|
{
|
|
47
68
|
name: "explorer",
|
|
48
69
|
description: 'Fast read-only codebase search and exploration. Use for finding files by pattern, searching code for keywords, reading file contents, answering questions about the codebase, and mapping project structure. Starts with glob/grep to discover paths. Specify thoroughness: "quick" for basic lookups, "thorough" for deep analysis across multiple locations.',
|
|
49
|
-
|
|
70
|
+
profile: Profiles.explore,
|
|
50
71
|
maxSteps: 20
|
|
51
72
|
},
|
|
52
73
|
{
|
|
53
74
|
name: "coder",
|
|
54
75
|
description: "Full-power implementation agent for writing, editing, and modifying code. Use for implementing features, fixing bugs, refactoring, writing tests, and any task that requires file modifications. Reads context first, follows existing conventions, verifies changes. Iterates until done.",
|
|
55
|
-
|
|
76
|
+
profile: Profiles.code,
|
|
56
77
|
maxSteps: 40
|
|
57
78
|
},
|
|
58
79
|
{
|
|
59
80
|
name: "planner",
|
|
60
81
|
description: "Read-only analysis and planning agent. Use when you need a detailed implementation plan before starting work. Breaks down complex tasks into numbered, actionable steps. Does not make changes.",
|
|
61
|
-
|
|
82
|
+
profile: Profiles.plan,
|
|
62
83
|
maxSteps: 15
|
|
63
84
|
},
|
|
64
85
|
{
|
|
65
86
|
name: "runner",
|
|
66
87
|
description: "Process execution and monitoring agent. Use for running test suites, builds, lint, or any command that takes time. Executes the command, waits for output, and reports a clear pass/fail summary. Does not modify files.",
|
|
67
|
-
|
|
88
|
+
profile: Profiles.watch,
|
|
68
89
|
maxSteps: 10
|
|
69
90
|
}
|
|
70
91
|
];
|
|
@@ -97,17 +118,32 @@ async function resolveSkillRegistry(cwd, skills) {
|
|
|
97
118
|
const config = skills === true || skills === void 0 ? void 0 : skills;
|
|
98
119
|
return await createSkillRegistry(cwd, config);
|
|
99
120
|
}
|
|
100
|
-
function resolveSubAgentOptions(
|
|
101
|
-
if (
|
|
121
|
+
function resolveSubAgentOptions(subagents, cwd) {
|
|
122
|
+
if (subagents === false) {
|
|
102
123
|
return null;
|
|
103
124
|
}
|
|
104
|
-
const config =
|
|
105
|
-
|
|
106
|
-
if (
|
|
125
|
+
const config = subagents && subagents !== true ? subagents : void 0;
|
|
126
|
+
let roles;
|
|
127
|
+
if (config?.roles) {
|
|
128
|
+
roles = config.roles;
|
|
129
|
+
} else if (config?.disableDiscovery) {
|
|
130
|
+
roles = defaultCodingRoles;
|
|
131
|
+
} else {
|
|
132
|
+
const discovery = discoverSubAgentRoles({
|
|
133
|
+
cwd,
|
|
134
|
+
builtInRoles: defaultCodingRoles,
|
|
135
|
+
configPaths: config?.agentPaths
|
|
136
|
+
});
|
|
137
|
+
roles = discovery.roles;
|
|
138
|
+
for (const { path: p, error } of discovery.errors) {
|
|
139
|
+
console.error(`[agents] ${p}: ${error}`);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if (roles.length === 0) {
|
|
107
143
|
return null;
|
|
108
144
|
}
|
|
109
145
|
return {
|
|
110
|
-
|
|
146
|
+
roles,
|
|
111
147
|
maxConcurrent: config?.maxConcurrent,
|
|
112
148
|
maxDepth: config?.maxDepth,
|
|
113
149
|
currentDepth: config?.currentDepth,
|
|
@@ -145,7 +181,7 @@ async function setupCodingAgent(options) {
|
|
|
145
181
|
approval = false,
|
|
146
182
|
promptCache = false,
|
|
147
183
|
skills = true,
|
|
148
|
-
|
|
184
|
+
subagents = true,
|
|
149
185
|
sessionManager,
|
|
150
186
|
sessionStorage = true,
|
|
151
187
|
middleware,
|
|
@@ -179,11 +215,10 @@ async function setupCodingAgent(options) {
|
|
|
179
215
|
...resolvedMiddleware.length > 0 ? { middleware: resolvedMiddleware } : {},
|
|
180
216
|
...tools.length > 0 ? { tools } : {}
|
|
181
217
|
});
|
|
182
|
-
const subAgentConfig = resolveSubAgentOptions(
|
|
183
|
-
if (subAgentConfig
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}
|
|
218
|
+
const subAgentConfig = resolveSubAgentOptions(subagents, cwd);
|
|
219
|
+
if (subAgentConfig) {
|
|
220
|
+
configureSubAgents(agent, subAgentConfig);
|
|
221
|
+
installLocalSubAgents(agent, subAgentConfig);
|
|
187
222
|
}
|
|
188
223
|
return { agent, skillRegistry };
|
|
189
224
|
}
|
|
@@ -192,20 +227,33 @@ async function createCodingAgent(options) {
|
|
|
192
227
|
return agent;
|
|
193
228
|
}
|
|
194
229
|
export {
|
|
230
|
+
Agent,
|
|
231
|
+
LLMError,
|
|
232
|
+
PluginRegistry,
|
|
233
|
+
SkillRegistry2 as SkillRegistry,
|
|
234
|
+
StaticSettings,
|
|
195
235
|
ToolsetBuilder,
|
|
196
236
|
bashParameters,
|
|
197
237
|
bashTool,
|
|
238
|
+
configureResolver,
|
|
198
239
|
createCodingAgent,
|
|
199
|
-
|
|
240
|
+
createSkillRegistry2 as createSkillRegistry,
|
|
241
|
+
defaultCodingRoles,
|
|
200
242
|
defaultCodingTools,
|
|
243
|
+
defaultRegistry,
|
|
244
|
+
discoverPlugins,
|
|
245
|
+
discoverSubAgentRoles2 as discoverSubAgentRoles,
|
|
201
246
|
editParameters,
|
|
202
247
|
editTool,
|
|
203
248
|
executeBash,
|
|
204
249
|
executeGrep,
|
|
250
|
+
getDefaultResolver,
|
|
205
251
|
globParameters,
|
|
206
252
|
globTool,
|
|
207
253
|
grepParameters,
|
|
208
254
|
grepTool,
|
|
255
|
+
isDefinedPlugin,
|
|
256
|
+
loadPluginModule,
|
|
209
257
|
readParameters,
|
|
210
258
|
readTool,
|
|
211
259
|
resolveTools,
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -16,12 +16,12 @@ declare const planEntrySchema: z.ZodObject<{
|
|
|
16
16
|
status: z.ZodEnum<["pending", "in-progress", "done"]>;
|
|
17
17
|
}, "strip", z.ZodTypeAny, {
|
|
18
18
|
id: number;
|
|
19
|
-
status: "done" | "pending" | "in-progress";
|
|
20
19
|
title: string;
|
|
20
|
+
status: "pending" | "done" | "in-progress";
|
|
21
21
|
}, {
|
|
22
22
|
id: number;
|
|
23
|
-
status: "done" | "pending" | "in-progress";
|
|
24
23
|
title: string;
|
|
24
|
+
status: "pending" | "done" | "in-progress";
|
|
25
25
|
}>;
|
|
26
26
|
declare const planParameters: z.ZodObject<{
|
|
27
27
|
entries: z.ZodArray<z.ZodObject<{
|
|
@@ -30,24 +30,24 @@ declare const planParameters: z.ZodObject<{
|
|
|
30
30
|
status: z.ZodEnum<["pending", "in-progress", "done"]>;
|
|
31
31
|
}, "strip", z.ZodTypeAny, {
|
|
32
32
|
id: number;
|
|
33
|
-
status: "done" | "pending" | "in-progress";
|
|
34
33
|
title: string;
|
|
34
|
+
status: "pending" | "done" | "in-progress";
|
|
35
35
|
}, {
|
|
36
36
|
id: number;
|
|
37
|
-
status: "done" | "pending" | "in-progress";
|
|
38
37
|
title: string;
|
|
38
|
+
status: "pending" | "done" | "in-progress";
|
|
39
39
|
}>, "many">;
|
|
40
40
|
}, "strip", z.ZodTypeAny, {
|
|
41
41
|
entries: {
|
|
42
42
|
id: number;
|
|
43
|
-
status: "done" | "pending" | "in-progress";
|
|
44
43
|
title: string;
|
|
44
|
+
status: "pending" | "done" | "in-progress";
|
|
45
45
|
}[];
|
|
46
46
|
}, {
|
|
47
47
|
entries: {
|
|
48
48
|
id: number;
|
|
49
|
-
status: "done" | "pending" | "in-progress";
|
|
50
49
|
title: string;
|
|
50
|
+
status: "pending" | "done" | "in-progress";
|
|
51
51
|
}[];
|
|
52
52
|
}>;
|
|
53
53
|
type PlanParams = z.infer<typeof planParameters>;
|
|
@@ -59,30 +59,30 @@ declare const planTool: Tool.Info<z.ZodObject<{
|
|
|
59
59
|
status: z.ZodEnum<["pending", "in-progress", "done"]>;
|
|
60
60
|
}, "strip", z.ZodTypeAny, {
|
|
61
61
|
id: number;
|
|
62
|
-
status: "done" | "pending" | "in-progress";
|
|
63
62
|
title: string;
|
|
63
|
+
status: "pending" | "done" | "in-progress";
|
|
64
64
|
}, {
|
|
65
65
|
id: number;
|
|
66
|
-
status: "done" | "pending" | "in-progress";
|
|
67
66
|
title: string;
|
|
67
|
+
status: "pending" | "done" | "in-progress";
|
|
68
68
|
}>, "many">;
|
|
69
69
|
}, "strip", z.ZodTypeAny, {
|
|
70
70
|
entries: {
|
|
71
71
|
id: number;
|
|
72
|
-
status: "done" | "pending" | "in-progress";
|
|
73
72
|
title: string;
|
|
73
|
+
status: "pending" | "done" | "in-progress";
|
|
74
74
|
}[];
|
|
75
75
|
}, {
|
|
76
76
|
entries: {
|
|
77
77
|
id: number;
|
|
78
|
-
status: "done" | "pending" | "in-progress";
|
|
79
78
|
title: string;
|
|
79
|
+
status: "pending" | "done" | "in-progress";
|
|
80
80
|
}[];
|
|
81
81
|
}>, {
|
|
82
82
|
entries: {
|
|
83
83
|
id: number;
|
|
84
|
-
status: "done" | "pending" | "in-progress";
|
|
85
84
|
title: string;
|
|
85
|
+
status: "pending" | "done" | "in-progress";
|
|
86
86
|
}[];
|
|
87
87
|
done: number;
|
|
88
88
|
active: number;
|
package/dist/tools/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cuylabs/agent-code",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Embeddable AI coding agent built on @cuylabs/agent-core",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"ai": "^6.0.67",
|
|
26
26
|
"zod": "^3.24.0",
|
|
27
|
-
"@cuylabs/agent-core": "^0.
|
|
27
|
+
"@cuylabs/agent-core": "^0.10.0"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@ai-sdk/anthropic": "^3.0.0",
|