@cuylabs/agent-code 0.8.0 → 0.9.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/dist/index.d.ts +16 -0
- package/dist/index.js +19 -3
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -24,6 +24,22 @@ interface CodingSubAgentOptions extends Omit<SubAgentToolConfig, "profiles"> {
|
|
|
24
24
|
* Defaults to `defaultCodingProfiles`.
|
|
25
25
|
*/
|
|
26
26
|
profiles?: AgentProfile[];
|
|
27
|
+
/**
|
|
28
|
+
* Additional markdown agent file paths to load.
|
|
29
|
+
*
|
|
30
|
+
* Resolved relative to `cwd`. These are loaded in addition to
|
|
31
|
+
* the standard discovery directories.
|
|
32
|
+
*/
|
|
33
|
+
agentPaths?: string[];
|
|
34
|
+
/**
|
|
35
|
+
* Disable markdown agent discovery.
|
|
36
|
+
*
|
|
37
|
+
* When `true`, only built-in TypeScript profiles (and any explicit
|
|
38
|
+
* `profiles` array) are used — no filesystem scanning.
|
|
39
|
+
*
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
disableDiscovery?: boolean;
|
|
27
43
|
}
|
|
28
44
|
interface CodingAgentOptions extends AgentConfig {
|
|
29
45
|
/**
|
package/dist/index.js
CHANGED
|
@@ -36,6 +36,7 @@ import {
|
|
|
36
36
|
createSkillRegistry,
|
|
37
37
|
createSkillTools,
|
|
38
38
|
createSubAgentTools,
|
|
39
|
+
discoverAgentProfiles,
|
|
39
40
|
getProjectSessionsDir,
|
|
40
41
|
promptCacheMiddleware
|
|
41
42
|
} from "@cuylabs/agent-core";
|
|
@@ -97,12 +98,27 @@ async function resolveSkillRegistry(cwd, skills) {
|
|
|
97
98
|
const config = skills === true || skills === void 0 ? void 0 : skills;
|
|
98
99
|
return await createSkillRegistry(cwd, config);
|
|
99
100
|
}
|
|
100
|
-
function resolveSubAgentOptions(subAgents) {
|
|
101
|
+
function resolveSubAgentOptions(subAgents, cwd) {
|
|
101
102
|
if (subAgents === false) {
|
|
102
103
|
return null;
|
|
103
104
|
}
|
|
104
105
|
const config = subAgents && subAgents !== true ? subAgents : void 0;
|
|
105
|
-
|
|
106
|
+
let profiles;
|
|
107
|
+
if (config?.profiles) {
|
|
108
|
+
profiles = config.profiles;
|
|
109
|
+
} else if (config?.disableDiscovery) {
|
|
110
|
+
profiles = defaultCodingProfiles;
|
|
111
|
+
} else {
|
|
112
|
+
const discovery = discoverAgentProfiles({
|
|
113
|
+
cwd,
|
|
114
|
+
builtInProfiles: defaultCodingProfiles,
|
|
115
|
+
configPaths: config?.agentPaths
|
|
116
|
+
});
|
|
117
|
+
profiles = discovery.profiles;
|
|
118
|
+
for (const { path: p, error } of discovery.errors) {
|
|
119
|
+
console.error(`[agents] ${p}: ${error}`);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
106
122
|
if (profiles.length === 0) {
|
|
107
123
|
return null;
|
|
108
124
|
}
|
|
@@ -179,7 +195,7 @@ async function setupCodingAgent(options) {
|
|
|
179
195
|
...resolvedMiddleware.length > 0 ? { middleware: resolvedMiddleware } : {},
|
|
180
196
|
...tools.length > 0 ? { tools } : {}
|
|
181
197
|
});
|
|
182
|
-
const subAgentConfig = resolveSubAgentOptions(subAgents);
|
|
198
|
+
const subAgentConfig = resolveSubAgentOptions(subAgents, cwd);
|
|
183
199
|
if (subAgentConfig && tools.length > 0) {
|
|
184
200
|
for (const tool of createSubAgentTools(agent, subAgentConfig)) {
|
|
185
201
|
agent.addTool(tool);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cuylabs/agent-code",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.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.9.0"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@ai-sdk/anthropic": "^3.0.0",
|