@cuylabs/agent-code 0.9.0 → 0.11.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 +22 -17
- package/dist/index.js +63 -30
- 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,13 +20,13 @@ 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[];
|
|
27
30
|
/**
|
|
28
31
|
* Additional markdown agent file paths to load.
|
|
29
32
|
*
|
|
@@ -34,14 +37,14 @@ interface CodingSubAgentOptions extends Omit<SubAgentToolConfig, "profiles"> {
|
|
|
34
37
|
/**
|
|
35
38
|
* Disable markdown agent discovery.
|
|
36
39
|
*
|
|
37
|
-
* When `true`, only built-in TypeScript
|
|
38
|
-
* `
|
|
40
|
+
* When `true`, only built-in TypeScript roles (and any explicit
|
|
41
|
+
* `roles` array) are used — no filesystem scanning.
|
|
39
42
|
*
|
|
40
43
|
* @default false
|
|
41
44
|
*/
|
|
42
45
|
disableDiscovery?: boolean;
|
|
43
46
|
}
|
|
44
|
-
interface CodingAgentOptions extends AgentConfig {
|
|
47
|
+
interface CodingAgentOptions extends Omit<AgentConfig, "approval"> {
|
|
45
48
|
/**
|
|
46
49
|
* Coding tools to expose. Defaults to the full coding toolset.
|
|
47
50
|
*
|
|
@@ -67,12 +70,14 @@ interface CodingAgentOptions extends AgentConfig {
|
|
|
67
70
|
*/
|
|
68
71
|
skills?: boolean | SkillConfig | SkillRegistry;
|
|
69
72
|
/**
|
|
70
|
-
*
|
|
73
|
+
* Subagent delegation configuration.
|
|
71
74
|
*
|
|
72
75
|
* Defaults to `true`, which enables `invoke_agent` with the default
|
|
73
|
-
* 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.
|
|
74
79
|
*/
|
|
75
|
-
|
|
80
|
+
subagents?: boolean | CodingSubAgentOptions;
|
|
76
81
|
/**
|
|
77
82
|
* Explicit session manager. Overrides `sessionStorage` when provided.
|
|
78
83
|
*/
|
|
@@ -93,7 +98,7 @@ interface CodingAgentSetupResult {
|
|
|
93
98
|
* Assemble a batteries-included coding agent from `agent-core` primitives.
|
|
94
99
|
*
|
|
95
100
|
* This wires the coding toolset, optional approval middleware, skill tools,
|
|
96
|
-
* persistent sessions, and
|
|
101
|
+
* persistent sessions, and subagent delegation into a reusable package-level
|
|
97
102
|
* surface. UI-specific concerns stay outside this helper.
|
|
98
103
|
*/
|
|
99
104
|
declare function setupCodingAgent(options: CodingAgentOptions): Promise<CodingAgentSetupResult>;
|
|
@@ -106,11 +111,11 @@ declare function setupCodingAgent(options: CodingAgentOptions): Promise<CodingAg
|
|
|
106
111
|
declare function createCodingAgent(options: CodingAgentOptions): Promise<Agent>;
|
|
107
112
|
|
|
108
113
|
/**
|
|
109
|
-
* Default specialist
|
|
114
|
+
* Default specialist roles for coding-focused subagents.
|
|
110
115
|
*
|
|
111
|
-
* These are the
|
|
112
|
-
* `
|
|
116
|
+
* These are the roles enabled by `setupCodingAgent()` when
|
|
117
|
+
* `subagents: true` is used.
|
|
113
118
|
*/
|
|
114
|
-
declare const
|
|
119
|
+
declare const defaultCodingRoles: SubAgentRole[];
|
|
115
120
|
|
|
116
|
-
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,37 +52,40 @@ import {
|
|
|
35
52
|
createAgent,
|
|
36
53
|
createSkillRegistry,
|
|
37
54
|
createSkillTools,
|
|
38
|
-
createSubAgentTools,
|
|
39
|
-
discoverAgentProfiles,
|
|
40
55
|
getProjectSessionsDir,
|
|
41
56
|
promptCacheMiddleware
|
|
42
57
|
} from "@cuylabs/agent-core";
|
|
58
|
+
import {
|
|
59
|
+
configureSubAgents,
|
|
60
|
+
discoverSubAgentRoles,
|
|
61
|
+
installLocalSubAgents
|
|
62
|
+
} from "@cuylabs/agent-core/subagents";
|
|
43
63
|
|
|
44
|
-
// src/
|
|
45
|
-
import {
|
|
46
|
-
var
|
|
64
|
+
// src/roles.ts
|
|
65
|
+
import { Profiles } from "@cuylabs/agent-core/profiles";
|
|
66
|
+
var defaultCodingRoles = [
|
|
47
67
|
{
|
|
48
68
|
name: "explorer",
|
|
49
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.',
|
|
50
|
-
|
|
70
|
+
profile: Profiles.explore,
|
|
51
71
|
maxSteps: 20
|
|
52
72
|
},
|
|
53
73
|
{
|
|
54
74
|
name: "coder",
|
|
55
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.",
|
|
56
|
-
|
|
76
|
+
profile: Profiles.code,
|
|
57
77
|
maxSteps: 40
|
|
58
78
|
},
|
|
59
79
|
{
|
|
60
80
|
name: "planner",
|
|
61
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.",
|
|
62
|
-
|
|
82
|
+
profile: Profiles.plan,
|
|
63
83
|
maxSteps: 15
|
|
64
84
|
},
|
|
65
85
|
{
|
|
66
86
|
name: "runner",
|
|
67
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.",
|
|
68
|
-
|
|
88
|
+
profile: Profiles.watch,
|
|
69
89
|
maxSteps: 10
|
|
70
90
|
}
|
|
71
91
|
];
|
|
@@ -98,32 +118,33 @@ async function resolveSkillRegistry(cwd, skills) {
|
|
|
98
118
|
const config = skills === true || skills === void 0 ? void 0 : skills;
|
|
99
119
|
return await createSkillRegistry(cwd, config);
|
|
100
120
|
}
|
|
101
|
-
function resolveSubAgentOptions(
|
|
102
|
-
if (
|
|
121
|
+
function resolveSubAgentOptions(subagents, cwd) {
|
|
122
|
+
if (subagents === false) {
|
|
103
123
|
return null;
|
|
104
124
|
}
|
|
105
|
-
const config =
|
|
106
|
-
let
|
|
107
|
-
if (config?.
|
|
108
|
-
|
|
125
|
+
const config = subagents && subagents !== true ? subagents : void 0;
|
|
126
|
+
let roles;
|
|
127
|
+
if (config?.roles) {
|
|
128
|
+
roles = config.roles;
|
|
109
129
|
} else if (config?.disableDiscovery) {
|
|
110
|
-
|
|
130
|
+
roles = defaultCodingRoles;
|
|
111
131
|
} else {
|
|
112
|
-
const discovery =
|
|
132
|
+
const discovery = discoverSubAgentRoles({
|
|
113
133
|
cwd,
|
|
114
|
-
|
|
134
|
+
builtInRoles: defaultCodingRoles,
|
|
115
135
|
configPaths: config?.agentPaths
|
|
116
136
|
});
|
|
117
|
-
|
|
137
|
+
roles = discovery.roles;
|
|
118
138
|
for (const { path: p, error } of discovery.errors) {
|
|
119
|
-
|
|
139
|
+
process.stderr.write(`[agents] ${p}: ${error}
|
|
140
|
+
`);
|
|
120
141
|
}
|
|
121
142
|
}
|
|
122
|
-
if (
|
|
143
|
+
if (roles.length === 0) {
|
|
123
144
|
return null;
|
|
124
145
|
}
|
|
125
146
|
return {
|
|
126
|
-
|
|
147
|
+
roles,
|
|
127
148
|
maxConcurrent: config?.maxConcurrent,
|
|
128
149
|
maxDepth: config?.maxDepth,
|
|
129
150
|
currentDepth: config?.currentDepth,
|
|
@@ -161,7 +182,7 @@ async function setupCodingAgent(options) {
|
|
|
161
182
|
approval = false,
|
|
162
183
|
promptCache = false,
|
|
163
184
|
skills = true,
|
|
164
|
-
|
|
185
|
+
subagents = true,
|
|
165
186
|
sessionManager,
|
|
166
187
|
sessionStorage = true,
|
|
167
188
|
middleware,
|
|
@@ -195,11 +216,10 @@ async function setupCodingAgent(options) {
|
|
|
195
216
|
...resolvedMiddleware.length > 0 ? { middleware: resolvedMiddleware } : {},
|
|
196
217
|
...tools.length > 0 ? { tools } : {}
|
|
197
218
|
});
|
|
198
|
-
const subAgentConfig = resolveSubAgentOptions(
|
|
199
|
-
if (subAgentConfig
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}
|
|
219
|
+
const subAgentConfig = resolveSubAgentOptions(subagents, cwd);
|
|
220
|
+
if (subAgentConfig) {
|
|
221
|
+
configureSubAgents(agent, subAgentConfig);
|
|
222
|
+
installLocalSubAgents(agent, subAgentConfig);
|
|
203
223
|
}
|
|
204
224
|
return { agent, skillRegistry };
|
|
205
225
|
}
|
|
@@ -208,20 +228,33 @@ async function createCodingAgent(options) {
|
|
|
208
228
|
return agent;
|
|
209
229
|
}
|
|
210
230
|
export {
|
|
231
|
+
Agent,
|
|
232
|
+
LLMError,
|
|
233
|
+
PluginRegistry,
|
|
234
|
+
SkillRegistry2 as SkillRegistry,
|
|
235
|
+
StaticSettings,
|
|
211
236
|
ToolsetBuilder,
|
|
212
237
|
bashParameters,
|
|
213
238
|
bashTool,
|
|
239
|
+
configureResolver,
|
|
214
240
|
createCodingAgent,
|
|
215
|
-
|
|
241
|
+
createSkillRegistry2 as createSkillRegistry,
|
|
242
|
+
defaultCodingRoles,
|
|
216
243
|
defaultCodingTools,
|
|
244
|
+
defaultRegistry,
|
|
245
|
+
discoverPlugins,
|
|
246
|
+
discoverSubAgentRoles2 as discoverSubAgentRoles,
|
|
217
247
|
editParameters,
|
|
218
248
|
editTool,
|
|
219
249
|
executeBash,
|
|
220
250
|
executeGrep,
|
|
251
|
+
getDefaultResolver,
|
|
221
252
|
globParameters,
|
|
222
253
|
globTool,
|
|
223
254
|
grepParameters,
|
|
224
255
|
grepTool,
|
|
256
|
+
isDefinedPlugin,
|
|
257
|
+
loadPluginModule,
|
|
225
258
|
readParameters,
|
|
226
259
|
readTool,
|
|
227
260
|
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.11.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.11.0"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@ai-sdk/anthropic": "^3.0.0",
|