agentdev 0.1.9 → 0.1.10

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.
@@ -6,7 +6,7 @@ import {
6
6
  TemplateComposer,
7
7
  createLLM,
8
8
  loadConfigSync
9
- } from "./chunk-A354ZCZF.js";
9
+ } from "./chunk-3AR3JBW6.js";
10
10
 
11
11
  // src/agents/system/ExplorerAgent.ts
12
12
  import { existsSync } from "fs";
@@ -62,7 +62,7 @@ var ExplorerAgent = class _ExplorerAgent extends AgentBase {
62
62
  this.getTools().disable("safe_trash_list");
63
63
  this.getTools().disable("safe_trash_restore");
64
64
  this.registerAgentType("ExplorerAgent", () => new _ExplorerAgent({ llm: this.llm }));
65
- this.registerAgentType("BasicAgent", () => import("./BasicAgent-UWXLSZP2.js").then((m) => new m.BasicAgent({ llm: this.llm })));
65
+ this.registerAgentType("BasicAgent", () => import("./BasicAgent-R7DYGTHF.js").then((m) => new m.BasicAgent({ llm: this.llm })));
66
66
  }
67
67
  /**
68
68
  * Agent 初始化钩子
@@ -86,4 +86,4 @@ var ExplorerAgent = class _ExplorerAgent extends AgentBase {
86
86
  export {
87
87
  ExplorerAgent
88
88
  };
89
- //# sourceMappingURL=chunk-QFHPUAUQ.js.map
89
+ //# sourceMappingURL=chunk-72H6A6NB.js.map
@@ -7,7 +7,7 @@ import {
7
7
  createLLM,
8
8
  getDefaultMCPConfigDir,
9
9
  loadConfigSync
10
- } from "./chunk-A354ZCZF.js";
10
+ } from "./chunk-3AR3JBW6.js";
11
11
 
12
12
  // src/agents/system/BasicAgent.ts
13
13
  import { existsSync } from "fs";
@@ -75,7 +75,7 @@ var BasicAgent = class _BasicAgent extends AgentBase {
75
75
  this.getTools().disable("list_agents");
76
76
  this.getTools().disable("close_agent");
77
77
  this.registerAgentType("BasicAgent", () => new _BasicAgent({ llm: this.llm }));
78
- this.registerAgentType("ExplorerAgent", () => import("./ExplorerAgent-LCM3JQS4.js").then((m) => new m.ExplorerAgent({ llm: this.llm })));
78
+ this.registerAgentType("ExplorerAgent", () => import("./ExplorerAgent-DXY3OQ5U.js").then((m) => new m.ExplorerAgent({ llm: this.llm })));
79
79
  }
80
80
  /**
81
81
  * 获取系统环境信息
@@ -100,4 +100,4 @@ var BasicAgent = class _BasicAgent extends AgentBase {
100
100
  export {
101
101
  BasicAgent
102
102
  };
103
- //# sourceMappingURL=chunk-5T4C2XRT.js.map
103
+ //# sourceMappingURL=chunk-REOJZCSZ.js.map
@@ -20,6 +20,7 @@ async function createFeature(featureName2) {
20
20
  mkdirSync(join(targetDir, "scripts"), { recursive: true });
21
21
  generatePackageJson(targetDir, packageName, featureSlug);
22
22
  generateTsConfig(targetDir);
23
+ generateTsupConfig(targetDir);
23
24
  generateCopyAssetsScript(targetDir);
24
25
  generateMinimalFeatureClass(targetDir, featureClass);
25
26
  generateMinimalReadme(targetDir, packageName, featureSlug);
@@ -45,13 +46,6 @@ function generatePackageJson(targetDir, packageName, featureSlug) {
45
46
  "copy-assets": "node scripts/copy-assets.mjs",
46
47
  prepublishOnly: "npm run build"
47
48
  },
48
- tsup: {
49
- entry: ["src/index.ts", "src/templates/*.render.ts"],
50
- format: "esm",
51
- dts: true,
52
- clean: true,
53
- sourcemap: true
54
- },
55
49
  peerDependencies: {
56
50
  agentdev: ">=0.1.0"
57
51
  },
@@ -88,6 +82,31 @@ function generateTsConfig(targetDir) {
88
82
  };
89
83
  writeFileSync(join(targetDir, "tsconfig.json"), JSON.stringify(tsConfig, null, 2));
90
84
  }
85
+ function generateTsupConfig(targetDir) {
86
+ const content = `import { existsSync, readdirSync } from 'fs';
87
+ import { defineConfig } from 'tsup';
88
+
89
+ function getTemplateEntries(): string[] {
90
+ const templateDir = 'src/templates';
91
+ if (!existsSync(templateDir)) {
92
+ return [];
93
+ }
94
+
95
+ return readdirSync(templateDir)
96
+ .filter((name) => name.endsWith('.render.ts'))
97
+ .map((name) => \`\${templateDir}/\${name}\`);
98
+ }
99
+
100
+ export default defineConfig({
101
+ entry: ['src/index.ts', ...getTemplateEntries()],
102
+ format: ['esm'],
103
+ dts: true,
104
+ clean: true,
105
+ sourcemap: true,
106
+ });
107
+ `;
108
+ writeFileSync(join(targetDir, "tsup.config.ts"), content);
109
+ }
91
110
  function generateMinimalFeatureClass(targetDir, featureClass) {
92
111
  const className = toCamelCase(featureClass);
93
112
  const content = `/**
package/dist/index.d.ts CHANGED
@@ -1187,6 +1187,11 @@ declare class AgentBase {
1187
1187
  * 确保 Feature 工具已注册
1188
1188
  */
1189
1189
  private ensureFeatureTools;
1190
+ /**
1191
+ * 收集所有 Feature 自带的 skills
1192
+ * 约定:Feature 目录下存在 skills/ 目录则自动发现
1193
+ */
1194
+ private collectFeatureSkills;
1190
1195
  /**
1191
1196
  * 解析相对路径(处理 ./ 和 ../)
1192
1197
  * @param baseDir 基础目录
@@ -1592,6 +1597,8 @@ interface AuditFeatureConfig {
1592
1597
  dbPath?: string;
1593
1598
  /** 缓存有效期(天数,0 表示永久,默认 0) */
1594
1599
  cacheTtlDays?: number;
1600
+ /** 工作目录(默认 process.cwd()) */
1601
+ workspaceDir?: string;
1595
1602
  }
1596
1603
  /**
1597
1604
  * AuditFeature 实现
@@ -1712,6 +1719,8 @@ interface MemoryFeatureConfig {
1712
1719
  forceInject?: boolean;
1713
1720
  /** 读取 CLAUDE.md 的工作目录 */
1714
1721
  workspaceDir?: string;
1722
+ /** 宿主资源目录;如果提供,优先从这里读取 CLAUDE.md */
1723
+ resourceRoot?: string;
1715
1724
  }
1716
1725
  declare class MemoryFeature implements AgentFeature {
1717
1726
  readonly name = "memory";
@@ -1719,7 +1728,7 @@ declare class MemoryFeature implements AgentFeature {
1719
1728
  readonly source: string;
1720
1729
  readonly description = "\u81EA\u52A8\u8BFB\u53D6\u5E76\u6CE8\u5165\u9879\u76EE CLAUDE.md \u6587\u4EF6\u4F5C\u4E3A\u7CFB\u7EDF\u63D0\u793A\u8BCD\u3002";
1721
1730
  private filename;
1722
- private workspaceDir;
1731
+ private sourceRoot;
1723
1732
  private _packageInfo;
1724
1733
  constructor(config?: MemoryFeatureConfig);
1725
1734
  /**
@@ -1800,6 +1809,7 @@ declare class SkillFeature implements AgentFeature {
1800
1809
  readonly description = "\u53D1\u73B0\u672C\u5730 skills\uFF0C\u5E76\u63D0\u4F9B invoke_skill \u5DE5\u5177\u4E0E\u6280\u80FD\u6570\u636E\u6E90\u3002";
1801
1810
  private skillsDir?;
1802
1811
  private skills;
1812
+ private featureSkills;
1803
1813
  /**
1804
1814
  * 缓存包信息
1805
1815
  */
@@ -1827,6 +1837,11 @@ declare class SkillFeature implements AgentFeature {
1827
1837
  * 执行 Skills 发现并注册数据源
1828
1838
  */
1829
1839
  onInitiate(ctx: FeatureInitContext): Promise<void>;
1840
+ /**
1841
+ * 注入来自其他 Feature 的 skills
1842
+ * 由 Agent 在 onInitiate 之前调用
1843
+ */
1844
+ addFeatureSkills(skills: SkillMetadata[]): void;
1830
1845
  /**
1831
1846
  * 获取已加载的 Skills
1832
1847
  */
@@ -2218,6 +2233,10 @@ interface QQBotFeatureConfig {
2218
2233
  systemPrompt?: string;
2219
2234
  /** 附加配置(传递给 Gateway) */
2220
2235
  cfg?: Record<string, unknown>;
2236
+ /** 工作目录(默认 process.cwd()) */
2237
+ workspaceDir?: string;
2238
+ /** 宿主资源目录;默认从这里查找 .agentdev/qqbot.config.json */
2239
+ resourceRoot?: string;
2221
2240
  }
2222
2241
  /**
2223
2242
  * QQBotFeature - QQ 机器人 Feature
@@ -2297,6 +2316,7 @@ interface ShellExecutionResult {
2297
2316
 
2298
2317
  interface ShellFeatureConfig {
2299
2318
  workspaceDir?: string;
2319
+ workdir?: string;
2300
2320
  resourceRoot?: string;
2301
2321
  }
2302
2322
  /**
@@ -2310,6 +2330,7 @@ declare class ShellFeature implements AgentFeature {
2310
2330
  private bashDescription?;
2311
2331
  private _packageInfo;
2312
2332
  private readonly workspaceDir;
2333
+ private readonly workdir;
2313
2334
  private readonly resourceRoot;
2314
2335
  constructor(config?: ShellFeatureConfig);
2315
2336
  run(command: string): Promise<ShellExecutionResult>;
@@ -2697,6 +2718,8 @@ declare class TodoFeature implements AgentFeature {
2697
2718
  * TTS Feature 配置选项
2698
2719
  */
2699
2720
  interface TTSFeatureConfig {
2721
+ /** 工作目录(默认 process.cwd()) */
2722
+ workspaceDir?: string;
2700
2723
  /**
2701
2724
  * Python 可执行文件路径
2702
2725
  * 默认:项目 .venv 中的 Python 或系统 PATH 中的 python
@@ -3024,6 +3047,8 @@ interface VisualUnderstandingResult {
3024
3047
  * VisualFeature 配置
3025
3048
  */
3026
3049
  interface VisualFeatureConfig {
3050
+ /** 工作目录(默认 process.cwd()) */
3051
+ workspaceDir?: string;
3027
3052
  /** LLM 服务地址(默认 localhost:7575) */
3028
3053
  baseUrl?: string;
3029
3054
  /** 视觉理解模型名称(默认 Qwen3.5-4B-Q5_K_M) */
@@ -4373,4 +4398,4 @@ declare function renderMCPToolCall(serverName: string, toolName: string, args: R
4373
4398
  */
4374
4399
  declare function renderMCPToolResult(result: any, success?: boolean): string;
4375
4400
 
4376
- export { AgentBase as Agent, AgentConfig, type AgentConfigFile, type AgentFeature, AgentInfo, type AgentInitiateContext, AgentPool, AgentSession, type AgentSessionSnapshot, AnthropicLLM, AudioFeedbackFeature, AuditFeature, type AuditFeatureConfig, BasicAgent, type BasicAgentConfig, CallFinish, type CallFinishContext, CallStart, type CallStartContext, type CaptureResult, Context, type ContextInjector, DataSourceRegistry, type DataSourceRenderer, type DebugCapabilities, DebugHub, Decision, type DecisionResult, ExampleFeature, type ExampleFeatureConfig, type ExampleFeatureRuntimeState, type ExampleFeatureSnapshot, ExplorerAgent, type ExplorerAgentConfig, type SystemContext as ExplorerSystemContext, type FeatureContext, type FeatureInitContext, type FeatureStateSnapshot, FileSessionStore, type HookResult, InlineRenderTemplate, type KnownUser, LLMClient, LLMResponse, type LoadAllMCPConfigsOptions, type Logger, type LoggerBindings, MCPClient, type MCPClientConfig, type MCPConfig, type MCPConfigMountOptions, type MCPConnectionInfo, MCPConnectionManager, MCPConnectionState, type MCPDiscoveredTool, type MCPDiscoveredToolSet, MCPFeature, type MCPFeatureOptions, type MCPHTTPConfig, type MCPMountedConfigResult, type MCPMountedToolSet, type MCPSSEConfig, type MCPServerConfig, type MCPSstdioConfig, type MCPStatistics, MCPToolAdapter, type MCPToolAdapterConfig, type MCPToolCreationOptions, type MCPToolDiscoveryOptions, type MCPToolManagementOptions, type MCPToolPatch, type MCPToolResult, MCP_RENDER_TEMPLATES, MemoryFeature, type MemoryFeatureConfig, Message, MessageRole, type ModelConfig, OpenAILLM, OpencodeBasicFeature, type PackageInfo, PlaceholderContext, PlaceholderResolver, PluginCompatFeature, QQBotFeature, type QQBotFeatureConfig, type QQBotSendOptions, type QQBotSendResult, type SessionStore, ShellFeature, SkillFeature, type SkillFeatureConfig, type SkillMetadata, type SkillsOptions, StepFinish, type StepFinishedContext, StepStart, type StepStartContext, SubAgentFeature, type SystemContext$1 as SystemContext, TTSFeature, type TTSFeatureConfig, type TTSResult, type TTSState, type TaskStatus, TemplateLoader, TemplateSource, TodoFeature, type TodoFeatureConfig, type TodoTask, type TodoTaskSummary, Tool, ToolCall, type ToolContext, type ToolContextValue, ToolFinished, ToolRegistry, ToolRenderConfig, type ToolResult, ToolUse, UserInputFeature, type UserInputFeatureConfig, ViewerWorker, VisualFeature, type VisualFeatureConfig, type VisualUnderstandingResult, WebSearchFeature, type WebSearchFeatureConfig, type WindowInfo, assistant, compileContextForAnthropic, createAnthropicLLM, createDefaultMCPToolName, createLLM, createListRenderer, createLogger, createMCPTool, createMCPToolAdapters, createMCPToolsFromClient, createManagedMCPToolsFromClient, createMessage, createOpenAILLM, createTool, discover, discoverMCPTools, discoverManagedMCPTools, getClawRuntimeUrl, getDebugCapabilities, getDefaultMCPConfigDir, getDefaultSessionStore, getMCPRenderTemplate, getPackageInfoFromSource, installConsoleBridge, listConfigs, loadAllMCPConfigs, loadConfig, loadConfigSync, loadMCPConfigFromInput, mountMCPToolsFromConfig, renderMCPToolCall, renderMCPToolResult, resolveDebugTransportMode, runWithLogScope, system, toolResult, user };
4401
+ export { AgentBase as Agent, AgentConfig, type AgentConfigFile, type AgentFeature, AgentInfo, type AgentInitiateContext, AgentPool, AgentSession, type AgentSessionSnapshot, AnthropicLLM, AudioFeedbackFeature, AuditFeature, type AuditFeatureConfig, BasicAgent, type BasicAgentConfig, CallFinish, type CallFinishContext, CallStart, type CallStartContext, type CaptureResult, Context, type ContextInjector, type ContextSnapshot, DataSourceRegistry, type DataSourceRenderer, type DebugCapabilities, DebugHub, Decision, type DecisionResult, ExampleFeature, type ExampleFeatureConfig, type ExampleFeatureRuntimeState, type ExampleFeatureSnapshot, ExplorerAgent, type ExplorerAgentConfig, type SystemContext as ExplorerSystemContext, type FeatureContext, type FeatureInitContext, type FeatureStateSnapshot, FileSessionStore, type HookResult, InlineRenderTemplate, type KnownUser, LLMClient, LLMResponse, type LoadAllMCPConfigsOptions, type Logger, type LoggerBindings, MCPClient, type MCPClientConfig, type MCPConfig, type MCPConfigMountOptions, type MCPConnectionInfo, MCPConnectionManager, MCPConnectionState, type MCPDiscoveredTool, type MCPDiscoveredToolSet, MCPFeature, type MCPFeatureOptions, type MCPHTTPConfig, type MCPMountedConfigResult, type MCPMountedToolSet, type MCPSSEConfig, type MCPServerConfig, type MCPSstdioConfig, type MCPStatistics, MCPToolAdapter, type MCPToolAdapterConfig, type MCPToolCreationOptions, type MCPToolDiscoveryOptions, type MCPToolManagementOptions, type MCPToolPatch, type MCPToolResult, MCP_RENDER_TEMPLATES, MemoryFeature, type MemoryFeatureConfig, Message, MessageRole, type ModelConfig, OpenAILLM, OpencodeBasicFeature, type PackageInfo, PlaceholderContext, PlaceholderResolver, PluginCompatFeature, QQBotFeature, type QQBotFeatureConfig, type QQBotSendOptions, type QQBotSendResult, type SessionStore, ShellFeature, SkillFeature, type SkillFeatureConfig, type SkillMetadata, type SkillsOptions, StepFinish, type StepFinishedContext, StepStart, type StepStartContext, SubAgentFeature, type SystemContext$1 as SystemContext, TTSFeature, type TTSFeatureConfig, type TTSResult, type TTSState, type TaskStatus, TemplateLoader, TemplateSource, TodoFeature, type TodoFeatureConfig, type TodoTask, type TodoTaskSummary, Tool, ToolCall, type ToolContext, type ToolContextValue, ToolFinished, ToolRegistry, ToolRenderConfig, type ToolResult, ToolUse, UserInputFeature, type UserInputFeatureConfig, ViewerWorker, VisualFeature, type VisualFeatureConfig, type VisualUnderstandingResult, WebSearchFeature, type WebSearchFeatureConfig, type WindowInfo, assistant, compileContextForAnthropic, createAnthropicLLM, createDefaultMCPToolName, createLLM, createListRenderer, createLogger, createMCPTool, createMCPToolAdapters, createMCPToolsFromClient, createManagedMCPToolsFromClient, createMessage, createOpenAILLM, createTool, discover, discoverMCPTools, discoverManagedMCPTools, getClawRuntimeUrl, getDebugCapabilities, getDefaultMCPConfigDir, getDefaultSessionStore, getMCPRenderTemplate, getPackageInfoFromSource, installConsoleBridge, listConfigs, loadAllMCPConfigs, loadConfig, loadConfigSync, loadMCPConfigFromInput, mountMCPToolsFromConfig, renderMCPToolCall, renderMCPToolResult, resolveDebugTransportMode, runWithLogScope, system, toolResult, user };
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  BasicAgent
3
- } from "./chunk-5T4C2XRT.js";
3
+ } from "./chunk-REOJZCSZ.js";
4
4
  import {
5
5
  ExplorerAgent
6
- } from "./chunk-QFHPUAUQ.js";
6
+ } from "./chunk-72H6A6NB.js";
7
7
  import {
8
8
  AgentBase,
9
9
  AgentPool,
@@ -71,7 +71,7 @@ import {
71
71
  system,
72
72
  toolResult,
73
73
  user
74
- } from "./chunk-A354ZCZF.js";
74
+ } from "./chunk-3AR3JBW6.js";
75
75
  import {
76
76
  PlaceholderResolver
77
77
  } from "./chunk-BVF7RUXV.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentdev",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "A lightweight, decoupled AI agent framework with built-in debugger",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -19,7 +19,7 @@
19
19
  "@sliverp/qqbot"
20
20
  ],
21
21
  "scripts": {
22
- "build": "tsup && node scripts/generate-bin-cmds.mjs",
22
+ "build": "tsup && node scripts/copy-feature-skills.mjs && node scripts/generate-bin-cmds.mjs",
23
23
  "dev": "tsup --watch",
24
24
  "prepublishOnly": "npm run build",
25
25
  "create-feature": "node dist/create-feature-cli.js",