pulse-coder-engine 0.0.1-alpha.4 → 0.0.1-alpha.7

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.cts CHANGED
@@ -1,100 +1,9 @@
1
- import { FlexibleSchema, ModelMessage, LanguageModel, StepResult, ToolSet, streamText, Tool as Tool$1 } from 'ai';
2
- import { E as EnginePluginLoadOptions } from './index-DDqISE31.cjs';
3
- export { B as BuiltInSkillRegistry, a as EnginePlugin, b as EnginePluginContext, c as builtInMCPPlugin, d as builtInPlugins, e as builtInSkillsPlugin } from './index-DDqISE31.cjs';
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
+ import { StepResult, ModelMessage, ToolSet, streamText, Tool as Tool$1 } from 'ai';
4
4
  import { z } from 'zod';
5
5
  import 'events';
6
6
 
7
- /**
8
- * Custom LLM provider factory - receives a model name and returns a LanguageModel.
9
- * Use this to plug in any Vercel AI SDK-compatible provider.
10
- *
11
- * @example
12
- * import { createOpenAI } from '@ai-sdk/openai';
13
- * const provider: LLMProviderFactory = createOpenAI({ apiKey: '...' }).chat;
14
- *
15
- * @example
16
- * import { createAnthropic } from '@ai-sdk/anthropic';
17
- * const provider: LLMProviderFactory = createAnthropic({ apiKey: '...' });
18
- */
19
- type LLMProviderFactory = (model: string) => LanguageModel;
20
- /**
21
- * System prompt customization.
22
- * - `string` — replaces the built-in prompt entirely.
23
- * - `() => string` — factory evaluated on every request (supports dynamic prompts).
24
- * - `{ append: string }` — appends extra content after the built-in prompt.
25
- */
26
- type SystemPromptOption = string | (() => string) | {
27
- append: string;
28
- };
29
- /**
30
- * Hooks that fire around every tool execution.
31
- *
32
- * @example
33
- * const hooks: ToolHooks = {
34
- * onBeforeToolCall: (name, input) => {
35
- * if (name === 'bash') throw new Error('bash tool is disabled');
36
- * return input; // can return modified input
37
- * },
38
- * onAfterToolCall: (name, input, output) => {
39
- * auditLog(name, input, output);
40
- * return output; // can return modified output
41
- * },
42
- * };
43
- */
44
- interface ToolHooks {
45
- /**
46
- * Called before a tool executes.
47
- * Return a (possibly modified) input object, or throw to abort the call.
48
- */
49
- onBeforeToolCall?: (name: string, input: any) => any | Promise<any>;
50
- /**
51
- * Called after a tool executes.
52
- * Return a (possibly modified) output value.
53
- */
54
- onAfterToolCall?: (name: string, input: any, output: any) => any | Promise<any>;
55
- }
56
- interface ClarificationRequest {
57
- id: string;
58
- question: string;
59
- context?: string;
60
- defaultAnswer?: string;
61
- timeout: number;
62
- }
63
- interface ToolExecutionContext {
64
- onClarificationRequest?: (request: ClarificationRequest) => Promise<string>;
65
- abortSignal?: AbortSignal;
66
- }
67
- interface Tool<Input = any, Output = any> {
68
- name: string;
69
- description: string;
70
- inputSchema: FlexibleSchema<Input>;
71
- execute: (input: Input, context?: ToolExecutionContext) => Promise<Output>;
72
- }
73
- interface Context {
74
- messages: ModelMessage[];
75
- }
76
- interface IPlugin {
77
- name: string;
78
- version: string;
79
- extensions: Extension[];
80
- activate(context: IExtensionContext): Promise<void>;
81
- deactivate?(): Promise<void>;
82
- }
83
- interface Extension {
84
- type: 'skill' | 'mcp' | 'tool' | 'context';
85
- provider: any;
86
- }
87
- interface IExtensionContext {
88
- registerTools(toolName: string, tool: Tool<any, any>): void;
89
- logger: ILogger;
90
- }
91
- interface ILogger {
92
- debug(message: string, meta?: Record<string, unknown>): void;
93
- info(message: string, meta?: Record<string, unknown>): void;
94
- warn(message: string, meta?: Record<string, unknown>): void;
95
- error(message: string, error?: Error, meta?: Record<string, unknown>): void;
96
- }
97
-
98
7
  interface LoopOptions {
99
8
  onText?: (delta: string) => void;
100
9
  onToolCall?: (toolCall: any) => void;
@@ -150,10 +59,10 @@ interface UserConfigPlugin {
150
59
  */
151
60
  declare const ToolConfigSchema: z.ZodObject<{
152
61
  type: z.ZodEnum<{
153
- skill: "skill";
154
62
  bash: "bash";
155
63
  http: "http";
156
64
  javascript: "javascript";
65
+ skill: "skill";
157
66
  custom: "custom";
158
67
  }>;
159
68
  command: z.ZodOptional<z.ZodString>;
@@ -504,6 +413,7 @@ declare class Engine {
504
413
  * 准备引擎插件列表(包含内置插件)
505
414
  */
506
415
  private prepareEnginePlugins;
416
+ private applyRunHooks;
507
417
  /**
508
418
  * 运行AI循环
509
419
  */
@@ -515,6 +425,7 @@ declare class Engine {
515
425
  enginePlugins: string[];
516
426
  userConfigPlugins: string[];
517
427
  tools: string[];
428
+ runHooks: string[];
518
429
  services: string[];
519
430
  protocols: string[];
520
431
  };
@@ -543,6 +454,7 @@ declare class PluginManager {
543
454
  private enginePlugins;
544
455
  private userConfigPlugins;
545
456
  private tools;
457
+ private runHooks;
546
458
  private services;
547
459
  private protocols;
548
460
  private config;
@@ -590,6 +502,9 @@ declare class PluginManager {
590
502
  private applyUserConfig;
591
503
  /**
592
504
  * 验证核心能力
505
+ *
506
+ * - requiredCapabilities: 任意一个别名匹配即可,缺失时 **抛错** 阻止启动。
507
+ * - recommendedCapabilities: 缺失时仅 warn,不影响启动。
593
508
  */
594
509
  private validateCoreCapabilities;
595
510
  /**
@@ -600,6 +515,10 @@ declare class PluginManager {
600
515
  * 工具获取
601
516
  */
602
517
  getTools(): Record<string, any>;
518
+ /**
519
+ * 运行时钩子获取
520
+ */
521
+ getRunHooks(): EngineRunHook[];
603
522
  /**
604
523
  * 服务获取
605
524
  */
@@ -615,6 +534,7 @@ declare class PluginManager {
615
534
  enginePlugins: string[];
616
535
  userConfigPlugins: string[];
617
536
  tools: string[];
537
+ runHooks: string[];
618
538
  services: string[];
619
539
  protocols: string[];
620
540
  };
@@ -624,4 +544,4 @@ declare class PluginManager {
624
544
  private resolvePath;
625
545
  }
626
546
 
627
- export { BashTool, BuiltinTools, BuiltinToolsMap, type ClarificationRequest, ClarifyTool, type Context, EditTool, Engine, type Extension, GrepTool, type IExtensionContext, type ILogger, type IPlugin, type LLMProviderFactory, LsTool, PluginManager, Engine as PulseAgent, ReadTool, type SystemPromptOption, TavilyTool, type Tool, type ToolExecutionContext, type ToolHooks, type UserConfigPlugin, type UserConfigPluginLoadOptions, WriteTool, getFinalToolsMap, loop, maybeCompactContext, streamTextAI };
547
+ export { BashTool, BuiltinTools, BuiltinToolsMap, ClarificationRequest, ClarifyTool, Context, EditTool, Engine, GrepTool, ILogger, LLMProviderFactory, LsTool, PluginManager, Engine as PulseAgent, ReadTool, SystemPromptOption, TavilyTool, Tool, ToolExecutionContext, ToolHooks, type UserConfigPlugin, type UserConfigPluginLoadOptions, WriteTool, getFinalToolsMap, loop, maybeCompactContext, streamTextAI };
package/dist/index.d.ts CHANGED
@@ -1,100 +1,9 @@
1
- import { FlexibleSchema, ModelMessage, LanguageModel, StepResult, ToolSet, streamText, Tool as Tool$1 } from 'ai';
2
- import { E as EnginePluginLoadOptions } from './index-DDqISE31.js';
3
- export { B as BuiltInSkillRegistry, a as EnginePlugin, b as EnginePluginContext, c as builtInMCPPlugin, d as builtInPlugins, e as builtInSkillsPlugin } from './index-DDqISE31.js';
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
+ import { StepResult, ModelMessage, ToolSet, streamText, Tool as Tool$1 } from 'ai';
4
4
  import { z } from 'zod';
5
5
  import 'events';
6
6
 
7
- /**
8
- * Custom LLM provider factory - receives a model name and returns a LanguageModel.
9
- * Use this to plug in any Vercel AI SDK-compatible provider.
10
- *
11
- * @example
12
- * import { createOpenAI } from '@ai-sdk/openai';
13
- * const provider: LLMProviderFactory = createOpenAI({ apiKey: '...' }).chat;
14
- *
15
- * @example
16
- * import { createAnthropic } from '@ai-sdk/anthropic';
17
- * const provider: LLMProviderFactory = createAnthropic({ apiKey: '...' });
18
- */
19
- type LLMProviderFactory = (model: string) => LanguageModel;
20
- /**
21
- * System prompt customization.
22
- * - `string` — replaces the built-in prompt entirely.
23
- * - `() => string` — factory evaluated on every request (supports dynamic prompts).
24
- * - `{ append: string }` — appends extra content after the built-in prompt.
25
- */
26
- type SystemPromptOption = string | (() => string) | {
27
- append: string;
28
- };
29
- /**
30
- * Hooks that fire around every tool execution.
31
- *
32
- * @example
33
- * const hooks: ToolHooks = {
34
- * onBeforeToolCall: (name, input) => {
35
- * if (name === 'bash') throw new Error('bash tool is disabled');
36
- * return input; // can return modified input
37
- * },
38
- * onAfterToolCall: (name, input, output) => {
39
- * auditLog(name, input, output);
40
- * return output; // can return modified output
41
- * },
42
- * };
43
- */
44
- interface ToolHooks {
45
- /**
46
- * Called before a tool executes.
47
- * Return a (possibly modified) input object, or throw to abort the call.
48
- */
49
- onBeforeToolCall?: (name: string, input: any) => any | Promise<any>;
50
- /**
51
- * Called after a tool executes.
52
- * Return a (possibly modified) output value.
53
- */
54
- onAfterToolCall?: (name: string, input: any, output: any) => any | Promise<any>;
55
- }
56
- interface ClarificationRequest {
57
- id: string;
58
- question: string;
59
- context?: string;
60
- defaultAnswer?: string;
61
- timeout: number;
62
- }
63
- interface ToolExecutionContext {
64
- onClarificationRequest?: (request: ClarificationRequest) => Promise<string>;
65
- abortSignal?: AbortSignal;
66
- }
67
- interface Tool<Input = any, Output = any> {
68
- name: string;
69
- description: string;
70
- inputSchema: FlexibleSchema<Input>;
71
- execute: (input: Input, context?: ToolExecutionContext) => Promise<Output>;
72
- }
73
- interface Context {
74
- messages: ModelMessage[];
75
- }
76
- interface IPlugin {
77
- name: string;
78
- version: string;
79
- extensions: Extension[];
80
- activate(context: IExtensionContext): Promise<void>;
81
- deactivate?(): Promise<void>;
82
- }
83
- interface Extension {
84
- type: 'skill' | 'mcp' | 'tool' | 'context';
85
- provider: any;
86
- }
87
- interface IExtensionContext {
88
- registerTools(toolName: string, tool: Tool<any, any>): void;
89
- logger: ILogger;
90
- }
91
- interface ILogger {
92
- debug(message: string, meta?: Record<string, unknown>): void;
93
- info(message: string, meta?: Record<string, unknown>): void;
94
- warn(message: string, meta?: Record<string, unknown>): void;
95
- error(message: string, error?: Error, meta?: Record<string, unknown>): void;
96
- }
97
-
98
7
  interface LoopOptions {
99
8
  onText?: (delta: string) => void;
100
9
  onToolCall?: (toolCall: any) => void;
@@ -150,10 +59,10 @@ interface UserConfigPlugin {
150
59
  */
151
60
  declare const ToolConfigSchema: z.ZodObject<{
152
61
  type: z.ZodEnum<{
153
- skill: "skill";
154
62
  bash: "bash";
155
63
  http: "http";
156
64
  javascript: "javascript";
65
+ skill: "skill";
157
66
  custom: "custom";
158
67
  }>;
159
68
  command: z.ZodOptional<z.ZodString>;
@@ -504,6 +413,7 @@ declare class Engine {
504
413
  * 准备引擎插件列表(包含内置插件)
505
414
  */
506
415
  private prepareEnginePlugins;
416
+ private applyRunHooks;
507
417
  /**
508
418
  * 运行AI循环
509
419
  */
@@ -515,6 +425,7 @@ declare class Engine {
515
425
  enginePlugins: string[];
516
426
  userConfigPlugins: string[];
517
427
  tools: string[];
428
+ runHooks: string[];
518
429
  services: string[];
519
430
  protocols: string[];
520
431
  };
@@ -543,6 +454,7 @@ declare class PluginManager {
543
454
  private enginePlugins;
544
455
  private userConfigPlugins;
545
456
  private tools;
457
+ private runHooks;
546
458
  private services;
547
459
  private protocols;
548
460
  private config;
@@ -590,6 +502,9 @@ declare class PluginManager {
590
502
  private applyUserConfig;
591
503
  /**
592
504
  * 验证核心能力
505
+ *
506
+ * - requiredCapabilities: 任意一个别名匹配即可,缺失时 **抛错** 阻止启动。
507
+ * - recommendedCapabilities: 缺失时仅 warn,不影响启动。
593
508
  */
594
509
  private validateCoreCapabilities;
595
510
  /**
@@ -600,6 +515,10 @@ declare class PluginManager {
600
515
  * 工具获取
601
516
  */
602
517
  getTools(): Record<string, any>;
518
+ /**
519
+ * 运行时钩子获取
520
+ */
521
+ getRunHooks(): EngineRunHook[];
603
522
  /**
604
523
  * 服务获取
605
524
  */
@@ -615,6 +534,7 @@ declare class PluginManager {
615
534
  enginePlugins: string[];
616
535
  userConfigPlugins: string[];
617
536
  tools: string[];
537
+ runHooks: string[];
618
538
  services: string[];
619
539
  protocols: string[];
620
540
  };
@@ -624,4 +544,4 @@ declare class PluginManager {
624
544
  private resolvePath;
625
545
  }
626
546
 
627
- export { BashTool, BuiltinTools, BuiltinToolsMap, type ClarificationRequest, ClarifyTool, type Context, EditTool, Engine, type Extension, GrepTool, type IExtensionContext, type ILogger, type IPlugin, type LLMProviderFactory, LsTool, PluginManager, Engine as PulseAgent, ReadTool, type SystemPromptOption, TavilyTool, type Tool, type ToolExecutionContext, type ToolHooks, type UserConfigPlugin, type UserConfigPluginLoadOptions, WriteTool, getFinalToolsMap, loop, maybeCompactContext, streamTextAI };
547
+ export { BashTool, BuiltinTools, BuiltinToolsMap, ClarificationRequest, ClarifyTool, Context, EditTool, Engine, GrepTool, ILogger, LLMProviderFactory, LsTool, PluginManager, Engine as PulseAgent, ReadTool, SystemPromptOption, TavilyTool, Tool, ToolExecutionContext, ToolHooks, type UserConfigPlugin, type UserConfigPluginLoadOptions, WriteTool, getFinalToolsMap, loop, maybeCompactContext, streamTextAI };