pulse-coder-engine 0.0.1-alpha.6 → 0.0.1-alpha.8
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/built-in/index.cjs +12 -8
- package/dist/built-in/index.cjs.map +1 -1
- package/dist/built-in/index.d.cts +1 -1
- package/dist/built-in/index.d.ts +1 -1
- package/dist/built-in/index.js +12 -8
- package/dist/built-in/index.js.map +1 -1
- package/dist/{index-BkkQyz2L.d.cts → index-Dh5B8P2t.d.cts} +3 -17
- package/dist/{index-BkkQyz2L.d.ts → index-Dh5B8P2t.d.ts} +3 -17
- package/dist/index.cjs +36 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -3
- package/dist/index.d.ts +6 -3
- package/dist/index.js +36 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as ClarificationRequest, T as Tool, L as LLMProviderFactory, S as SystemPromptOption, a as ToolHooks, b as Context, c as ToolExecutionContext, E as EnginePluginLoadOptions, I as ILogger, d as EngineRunHook } from './index-
|
|
2
|
-
export { B as BuiltInPlanModeService, e as BuiltInSkillRegistry, f as EnginePlugin, g as EnginePluginContext,
|
|
1
|
+
import { C as ClarificationRequest, T as Tool, L as LLMProviderFactory, S as SystemPromptOption, a as ToolHooks, b as Context, c as ToolExecutionContext, E as EnginePluginLoadOptions, I as ILogger, d as EngineRunHook } from './index-Dh5B8P2t.cjs';
|
|
2
|
+
export { B as BuiltInPlanModeService, e as BuiltInSkillRegistry, f as EnginePlugin, g as EnginePluginContext, M as ModePolicy, P as PlanIntentLabel, h as PlanMode, i as PlanModeEvent, j as PlanModeEventName, k as PlanModeService, l as PlanModeTransitionResult, m as ToolCategory, n as ToolMeta, o as ToolRisk, p as builtInMCPPlugin, q as builtInPlanModePlugin, r as builtInPlugins, s as builtInSkillsPlugin } from './index-Dh5B8P2t.cjs';
|
|
3
3
|
import { StepResult, ModelMessage, ToolSet, streamText, Tool as Tool$1 } from 'ai';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import 'events';
|
|
@@ -59,10 +59,10 @@ interface UserConfigPlugin {
|
|
|
59
59
|
*/
|
|
60
60
|
declare const ToolConfigSchema: z.ZodObject<{
|
|
61
61
|
type: z.ZodEnum<{
|
|
62
|
-
skill: "skill";
|
|
63
62
|
bash: "bash";
|
|
64
63
|
http: "http";
|
|
65
64
|
javascript: "javascript";
|
|
65
|
+
skill: "skill";
|
|
66
66
|
custom: "custom";
|
|
67
67
|
}>;
|
|
68
68
|
command: z.ZodOptional<z.ZodString>;
|
|
@@ -502,6 +502,9 @@ declare class PluginManager {
|
|
|
502
502
|
private applyUserConfig;
|
|
503
503
|
/**
|
|
504
504
|
* 验证核心能力
|
|
505
|
+
*
|
|
506
|
+
* - requiredCapabilities: 任意一个别名匹配即可,缺失时 **抛错** 阻止启动。
|
|
507
|
+
* - recommendedCapabilities: 缺失时仅 warn,不影响启动。
|
|
505
508
|
*/
|
|
506
509
|
private validateCoreCapabilities;
|
|
507
510
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as ClarificationRequest, T as Tool, L as LLMProviderFactory, S as SystemPromptOption, a as ToolHooks, b as Context, c as ToolExecutionContext, E as EnginePluginLoadOptions, I as ILogger, d as EngineRunHook } from './index-
|
|
2
|
-
export { B as BuiltInPlanModeService, e as BuiltInSkillRegistry, f as EnginePlugin, g as EnginePluginContext,
|
|
1
|
+
import { C as ClarificationRequest, T as Tool, L as LLMProviderFactory, S as SystemPromptOption, a as ToolHooks, b as Context, c as ToolExecutionContext, E as EnginePluginLoadOptions, I as ILogger, d as EngineRunHook } from './index-Dh5B8P2t.js';
|
|
2
|
+
export { B as BuiltInPlanModeService, e as BuiltInSkillRegistry, f as EnginePlugin, g as EnginePluginContext, M as ModePolicy, P as PlanIntentLabel, h as PlanMode, i as PlanModeEvent, j as PlanModeEventName, k as PlanModeService, l as PlanModeTransitionResult, m as ToolCategory, n as ToolMeta, o as ToolRisk, p as builtInMCPPlugin, q as builtInPlanModePlugin, r as builtInPlugins, s as builtInSkillsPlugin } from './index-Dh5B8P2t.js';
|
|
3
3
|
import { StepResult, ModelMessage, ToolSet, streamText, Tool as Tool$1 } from 'ai';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import 'events';
|
|
@@ -59,10 +59,10 @@ interface UserConfigPlugin {
|
|
|
59
59
|
*/
|
|
60
60
|
declare const ToolConfigSchema: z.ZodObject<{
|
|
61
61
|
type: z.ZodEnum<{
|
|
62
|
-
skill: "skill";
|
|
63
62
|
bash: "bash";
|
|
64
63
|
http: "http";
|
|
65
64
|
javascript: "javascript";
|
|
65
|
+
skill: "skill";
|
|
66
66
|
custom: "custom";
|
|
67
67
|
}>;
|
|
68
68
|
command: z.ZodOptional<z.ZodString>;
|
|
@@ -502,6 +502,9 @@ declare class PluginManager {
|
|
|
502
502
|
private applyUserConfig;
|
|
503
503
|
/**
|
|
504
504
|
* 验证核心能力
|
|
505
|
+
*
|
|
506
|
+
* - requiredCapabilities: 任意一个别名匹配即可,缺失时 **抛错** 阻止启动。
|
|
507
|
+
* - recommendedCapabilities: 缺失时仅 warn,不影响启动。
|
|
505
508
|
*/
|
|
506
509
|
private validateCoreCapabilities;
|
|
507
510
|
/**
|
package/dist/index.js
CHANGED
|
@@ -197,9 +197,10 @@ var streamTextAI = (messages, tools, options) => {
|
|
|
197
197
|
const provider = options?.provider ?? CoderAI;
|
|
198
198
|
const model = options?.model ?? DEFAULT_MODEL;
|
|
199
199
|
const wrappedTools = options?.toolExecutionContext ? wrapToolsWithContext(tools, options.toolExecutionContext) : tools;
|
|
200
|
+
const finalSystemPrompt = resolveSystemPrompt(options?.systemPrompt);
|
|
200
201
|
return streamText({
|
|
201
202
|
model: provider(model),
|
|
202
|
-
system:
|
|
203
|
+
system: finalSystemPrompt,
|
|
203
204
|
messages,
|
|
204
205
|
tools: wrappedTools,
|
|
205
206
|
providerOptions,
|
|
@@ -1106,6 +1107,7 @@ var PluginManager = class {
|
|
|
1106
1107
|
});
|
|
1107
1108
|
},
|
|
1108
1109
|
getTool: (name) => this.tools.get(name),
|
|
1110
|
+
getTools: () => Object.fromEntries(this.tools),
|
|
1109
1111
|
registerRunHook: (name, hook) => {
|
|
1110
1112
|
this.runHooks.set(name, hook);
|
|
1111
1113
|
},
|
|
@@ -1243,15 +1245,32 @@ var PluginManager = class {
|
|
|
1243
1245
|
}
|
|
1244
1246
|
/**
|
|
1245
1247
|
* 验证核心能力
|
|
1248
|
+
*
|
|
1249
|
+
* - requiredCapabilities: 任意一个别名匹配即可,缺失时 **抛错** 阻止启动。
|
|
1250
|
+
* - recommendedCapabilities: 缺失时仅 warn,不影响启动。
|
|
1246
1251
|
*/
|
|
1247
1252
|
async validateCoreCapabilities() {
|
|
1248
|
-
const requiredCapabilities = [
|
|
1249
|
-
|
|
1250
|
-
|
|
1253
|
+
const requiredCapabilities = [];
|
|
1254
|
+
for (const cap of requiredCapabilities) {
|
|
1255
|
+
const found = cap.aliases.some((alias) => this.enginePlugins.has(alias));
|
|
1256
|
+
if (!found) {
|
|
1257
|
+
throw new Error(
|
|
1258
|
+
`Missing required capability "${cap.name}". Expected one of: ${cap.aliases.join(", ")}`
|
|
1259
|
+
);
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
const recommendedCapabilities = [
|
|
1263
|
+
{
|
|
1264
|
+
name: "skills",
|
|
1265
|
+
aliases: ["pulse-coder-engine/built-in-skills"]
|
|
1266
|
+
}
|
|
1251
1267
|
];
|
|
1252
|
-
for (const
|
|
1253
|
-
|
|
1254
|
-
|
|
1268
|
+
for (const cap of recommendedCapabilities) {
|
|
1269
|
+
const found = cap.aliases.some((alias) => this.enginePlugins.has(alias));
|
|
1270
|
+
if (!found) {
|
|
1271
|
+
this.logger.warn(
|
|
1272
|
+
`Missing recommended capability "${cap.name}". Expected one of: ${cap.aliases.join(", ")}`
|
|
1273
|
+
);
|
|
1255
1274
|
}
|
|
1256
1275
|
}
|
|
1257
1276
|
}
|
|
@@ -1952,6 +1971,13 @@ var builtInPlanModePlugin = {
|
|
|
1952
1971
|
async initialize(context) {
|
|
1953
1972
|
const service = new BuiltInPlanModeService(context.logger, context.events, "executing");
|
|
1954
1973
|
context.registerRunHook("plan-mode", ({ context: runContext, tools, systemPrompt, hooks }) => {
|
|
1974
|
+
const mode = service.getMode();
|
|
1975
|
+
if (mode === "executing") {
|
|
1976
|
+
return {
|
|
1977
|
+
systemPrompt,
|
|
1978
|
+
hooks
|
|
1979
|
+
};
|
|
1980
|
+
}
|
|
1955
1981
|
const transition = service.processContextMessages(runContext.messages);
|
|
1956
1982
|
const append = service.buildPromptAppend(Object.keys(tools), transition);
|
|
1957
1983
|
const finalSystemPrompt = appendSystemPrompt(systemPrompt, append);
|
|
@@ -2075,20 +2101,15 @@ var SubAgentPlugin = class {
|
|
|
2075
2101
|
async initialize(context) {
|
|
2076
2102
|
try {
|
|
2077
2103
|
const configs = await this.configLoader.loadAgentConfigs();
|
|
2078
|
-
const tools = this.getAvailableTools(context);
|
|
2079
2104
|
for (const config of configs) {
|
|
2080
|
-
this.registerAgentTool(context, config
|
|
2105
|
+
this.registerAgentTool(context, config);
|
|
2081
2106
|
}
|
|
2082
2107
|
context.logger.info(`SubAgentPlugin loaded ${configs.length} agents.`);
|
|
2083
2108
|
} catch (error) {
|
|
2084
2109
|
context.logger.error("Failed to initialize SubAgentPlugin", error);
|
|
2085
2110
|
}
|
|
2086
2111
|
}
|
|
2087
|
-
|
|
2088
|
-
const allTools = {};
|
|
2089
|
-
return BuiltinToolsMap;
|
|
2090
|
-
}
|
|
2091
|
-
registerAgentTool(context, config, tools) {
|
|
2112
|
+
registerAgentTool(context, config) {
|
|
2092
2113
|
const toolName = `${config.name}_agent`;
|
|
2093
2114
|
const tool2 = {
|
|
2094
2115
|
description: config.description,
|
|
@@ -2097,6 +2118,7 @@ var SubAgentPlugin = class {
|
|
|
2097
2118
|
context: z11.any().optional().describe("\u4EFB\u52A1\u4E0A\u4E0B\u6587\u4FE1\u606F")
|
|
2098
2119
|
}),
|
|
2099
2120
|
execute: async ({ task, context: taskContext }) => {
|
|
2121
|
+
const tools = { ...BuiltinToolsMap, ...context.getTools() };
|
|
2100
2122
|
try {
|
|
2101
2123
|
context.logger.info(`Running agent ${config.name}: ${task}`);
|
|
2102
2124
|
const result = await this.agentRunner.runAgent(config, task, taskContext, tools);
|