@aggroot-team/aggroot 1.9.3 → 1.9.5

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.
Files changed (2) hide show
  1. package/dist/index.cjs +99 -63
  2. package/package.json +1 -2
package/dist/index.cjs CHANGED
@@ -44369,36 +44369,73 @@ Steps:
44369
44369
  The commit message should:
44370
44370
  - Be concise but descriptive
44371
44371
  - Explain why, not just what
44372
- - Reference any related issues`}},{name:"create-agent",description:"\u521B\u5EFA\u81EA\u5B9A\u4E49 Agent\uFF08\u63D0\u793A\u8BCD+\u5DE5\u5177\u7EC4\u5408\uFF09",source:"builtin",whenToUse:"\u7528\u6237\u60F3\u5728 AggRoot \u4E0A\u521B\u5EFA\u81EA\u5B9A\u4E49 Agent\uFF0C\u6216\u9700\u8981\u4E86\u89E3 Agent \u5F00\u53D1\u683C\u5F0F\u548C\u89C4\u8303",arguments:[{name:"name",description:'Agent \u540D\u79F0\uFF0C\u5982"\u7FFB\u8BD1\u52A9\u624B"\u3001"\u6570\u636E\u5206\u6790\u5E08"',required:!0},{name:"description",description:"Agent \u7B80\u8981\u63CF\u8FF0",required:!0},{name:"identity",description:"Agent \u8EAB\u4EFD/\u4EBA\u8BBE\u63D0\u793A\u8BCD\uFF0C\u5B9A\u4E49 Agent \u7684\u89D2\u8272\u548C\u884C\u4E3A",required:!0},{name:"tools",description:"Agent \u53EF\u7528\u7684\u5DE5\u5177\u540D\u79F0\u5217\u8868\uFF0C\u9017\u53F7\u5206\u9694\uFF0C\u5982 GetCurrentTime,WebSearch"},{name:"scope",description:"\u4FDD\u5B58\u4F4D\u7F6E: user(\u5168\u5C40 ~/.aggroot/agents/) \u6216 project(\u9879\u76EE .aggroot/agents/)",default:"user"}],allowedTools:["write_file","read_file","glob"],getPrompt:async(n,e)=>{let r=n.name,s=n.description,a=n.identity,u=(n.tools||"").split(",").map(w=>w.trim()).filter(Boolean),f=n.scope||"user",m=u.length>0?`
44373
- "tools": ${JSON.stringify(u)},`:"",g=JSON.stringify({agent:{name:r,version:"1.0.0",description:s,agent_type:"conversational",identity:a,...u.length>0?{tools:u}:{},approval_mode:"safe_only"}},null,2),b=f==="project"?".aggroot/agents/":"~/.aggroot/agents/",E=r.replace(/[^a-zA-Z0-9\u4e00-\u9fff-_]/g,"-").toLowerCase()+".json";return`\u6839\u636E\u4EE5\u4E0B\u4FE1\u606F\u521B\u5EFA\u81EA\u5B9A\u4E49 Agent\uFF0C\u5E76\u5199\u5165\u6587\u4EF6\u3002
44372
+ - Reference any related issues`}},{name:"create-agent",description:"\u7BA1\u7406\u81EA\u5B9A\u4E49 Agent\uFF08\u521B\u5EFA/\u67E5\u770B/\u7F16\u8F91/\u5220\u9664\uFF09\uFF0CAgent = \u63D0\u793A\u8BCD + \u5DE5\u5177",source:"builtin",whenToUse:"\u7528\u6237\u60F3\u521B\u5EFA\u3001\u67E5\u770B\u3001\u4FEE\u6539\u6216\u5220\u9664\u81EA\u5B9A\u4E49 Agent\uFF0C\u6216\u9700\u8981\u4E86\u89E3 Agent \u5F00\u53D1\u683C\u5F0F",arguments:[{name:"action",description:"\u64CD\u4F5C: create(\u521B\u5EFA), read(\u67E5\u770B), edit(\u7F16\u8F91), delete(\u5220\u9664), list(\u5217\u8868)",required:!0},{name:"name",description:"Agent \u540D\u79F0"},{name:"scope",description:"\u4F4D\u7F6E: user(\u5168\u5C40 ~/.aggroot/agents/) \u6216 project(\u9879\u76EE .aggroot/agents/)",default:"user"}],allowedTools:["write_file","read_file","replace","search_file_content","glob","run_shell_command"],getPrompt:async(n,e)=>{let r=(n.action||"").toLowerCase(),s=n.name||"",a=n.scope||"user",u=a==="project"?".aggroot/agents":"~/.aggroot/agents",f=a==="project"?".aggroot/agents":`${e?.projectRoot?"":process.env.AGGROOT_HOME||"~/.aggroot"}/agents`,m=`\u5217\u51FA\u6240\u6709\u81EA\u5B9A\u4E49 Agent\u3002
44373
+
44374
+ \u64CD\u4F5C\uFF1A\u4F7F\u7528 Shell \u5DE5\u5177\u6267\u884C "ls -la ${u}/*.json 2>/dev/null || echo \u76EE\u5F55\u4E3A\u7A7A"
44375
+ \u7136\u540E\u7528 Read \u5DE5\u5177\u9010\u4E2A\u8BFB\u53D6 JSON \u6587\u4EF6\uFF0C\u5C55\u793A\u6BCF\u4E2A Agent \u7684\u540D\u79F0\u3001\u63CF\u8FF0\u548C\u5DE5\u5177\u5217\u8868\u3002
44376
+ \u5982\u679C\u76EE\u5F55\u4E0D\u5B58\u5728\uFF0C\u63D0\u793A\u7528\u6237\u8FD8\u6CA1\u6709\u81EA\u5B9A\u4E49 Agent\u3002`,g=`\u67E5\u770B Agent\u300C${s}\u300D\u7684\u914D\u7F6E\u3002
44377
+
44378
+ \u64CD\u4F5C\uFF1A
44379
+ 1. \u4F7F\u7528 Glob \u5DE5\u5177\u641C\u7D22 ${u}/*.json
44380
+ 2. \u7528 Read \u5DE5\u5177\u8BFB\u53D6\u5339\u914D\u7684\u6587\u4EF6\uFF0C\u627E\u5230 name \u4E3A\u300C${s}\u300D\u7684\u914D\u7F6E
44381
+ 3. \u5C55\u793A\u5B8C\u6574\u914D\u7F6E\u5185\u5BB9`,b=`\u5220\u9664 Agent\u300C${s}\u300D\u3002
44382
+
44383
+ \u64CD\u4F5C\uFF1A
44384
+ 1. \u5148\u7528 Glob \u641C\u7D22 ${u}/*.json\uFF0C\u627E\u5230\u5305\u542B\u300C${s}\u300D\u7684\u6587\u4EF6
44385
+ 2. \u7528 Read \u5DE5\u5177\u786E\u8BA4\u6587\u4EF6\u5185\u5BB9
44386
+ 3. \u7528 Shell \u5DE5\u5177\u6267\u884C rm \u5220\u9664\u8BE5\u6587\u4EF6
44387
+ 4. \u544A\u77E5\u7528\u6237\u5DF2\u5220\u9664`,E=`\u7F16\u8F91 Agent\u300C${s}\u300D\u7684\u914D\u7F6E\u3002
44388
+
44389
+ \u64CD\u4F5C\uFF1A
44390
+ 1. \u7528 Glob \u641C\u7D22 ${u}/*.json\uFF0C\u627E\u5230\u76EE\u6807\u6587\u4EF6
44391
+ 2. \u7528 Read \u5DE5\u5177\u8BFB\u53D6\u5F53\u524D\u914D\u7F6E
44392
+ 3. \u6839\u636E\u7528\u6237\u8981\u6C42\u7684\u4FEE\u6539\uFF0C\u7528 Edit \u5DE5\u5177\u4FEE\u6539\u6587\u4EF6
44393
+ 4. \u4FEE\u6539\u5B8C\u6210\u540E\u7528 Read \u5DE5\u5177\u786E\u8BA4\u7ED3\u679C`,w=`\u521B\u5EFA\u81EA\u5B9A\u4E49 Agent\u3002**\u4F60\u5FC5\u987B\u8C03\u7528 Write \u5DE5\u5177\u5199\u5165\u6587\u4EF6\uFF0C\u4E0D\u80FD\u53EA\u8F93\u51FA\u6587\u672C\uFF01**
44374
44394
 
44375
44395
  ## Agent \u6838\u5FC3\u6982\u5FF5
44376
44396
 
44377
44397
  Agent = \u63D0\u793A\u8BCD + \u5DE5\u5177\u3002Agent \u7684\u672C\u8D28\u662F\u4E00\u4E2A JSON \u914D\u7F6E\u6587\u4EF6\u3002
44378
44398
 
44379
- ## \u8981\u521B\u5EFA\u7684 Agent
44380
-
44381
- ${g}
44399
+ ## Agent JSON \u683C\u5F0F
44400
+
44401
+ \`\`\`json
44402
+ {
44403
+ "agent": {
44404
+ "name": "Agent\u540D\u79F0",
44405
+ "version": "1.0.0",
44406
+ "description": "\u7B80\u8981\u63CF\u8FF0",
44407
+ "agent_type": "conversational",
44408
+ "identity": "\u8EAB\u4EFD\u5B9A\u4E49\uFF0C\u6700\u91CD\u8981\u7684\u5B57\u6BB5",
44409
+ "tools": ["\u5DE5\u5177\u540D1", "\u5DE5\u5177\u540D2"],
44410
+ "personality": ["\u6027\u683C\u7279\u8D28"],
44411
+ "speaking_style": ["\u8BF4\u8BDD\u98CE\u683C"],
44412
+ "behavior_guidelines": ["\u884C\u4E3A\u51C6\u5219"],
44413
+ "prohibited_actions": ["\u7981\u6B62\u884C\u4E3A"],
44414
+ "approval_mode": "safe_only",
44415
+ "when_to_use": ["\u9002\u7528\u573A\u666F"],
44416
+ "when_not_to_use": ["\u4E0D\u9002\u7528\u573A\u666F"]
44417
+ }
44418
+ }
44419
+ \`\`\`
44382
44420
 
44383
- ## Agent JSON \u5B57\u6BB5\u8BF4\u660E
44421
+ ## \u5B57\u6BB5\u8BF4\u660E
44384
44422
 
44385
44423
  | \u5B57\u6BB5 | \u5FC5\u586B | \u8BF4\u660E |
44386
44424
  |------|------|------|
44387
44425
  | name | \u662F | Agent \u540D\u79F0\uFF0C\u5728 # \u83DC\u5355\u4E2D\u663E\u793A |
44388
- | version | \u5426 | \u8BED\u4E49\u7248\u672C\u53F7\uFF0C\u9ED8\u8BA4 1.0.0 |
44389
- | description | \u662F | \u7B80\u8981\u63CF\u8FF0\uFF0C\u5728 Agent \u5217\u8868\u4E2D\u663E\u793A |
44390
- | agent_type | \u5426 | conversational\uFF08\u5BF9\u8BDD\u5F0F\uFF09\u6216 task_oriented\uFF08\u4EFB\u52A1\u5F0F\uFF09 |
44391
- | identity | \u662F | \u8EAB\u4EFD\u5B9A\u4E49\uFF0C\u6700\u91CD\u8981\u7684\u5B57\u6BB5\u2014\u2014\u5B9A\u4E49\u89D2\u8272\u3001\u884C\u4E3A\u65B9\u5F0F |
44392
- | tools | \u5426 | \u5DE5\u5177\u540D\u79F0\u6570\u7EC4\uFF0C\u5BF9\u5E94 ~/.aggroot/tools/ \u4E0B\u7684\u81EA\u5B9A\u4E49\u5DE5\u5177\u6216\u5185\u7F6E\u5DE5\u5177 |
44393
- | personality | \u5426 | \u6027\u683C\u7279\u8D28\u5217\u8868\uFF0C\u5982 ["\u51C6\u65F6","\u7CBE\u786E"] |
44394
- | speaking_style | \u5426 | \u8BF4\u8BDD\u98CE\u683C\u5217\u8868\uFF0C\u5982 ["\u7B80\u6D01\u660E\u4E86"] |
44426
+ | description | \u662F | \u7B80\u8981\u63CF\u8FF0 |
44427
+ | identity | \u662F | \u8EAB\u4EFD\u5B9A\u4E49\uFF0C\u6700\u5173\u952E\u7684\u5B57\u6BB5\uFF0C\u5B9A\u4E49\u89D2\u8272\u548C\u884C\u4E3A\u65B9\u5F0F |
44428
+ | tools | \u5426 | \u5DE5\u5177\u540D\u79F0\u6570\u7EC4 |
44429
+ | agent_type | \u5426 | conversational \u6216 task_oriented |
44430
+ | personality | \u5426 | \u6027\u683C\u7279\u8D28\u5217\u8868 |
44431
+ | speaking_style | \u5426 | \u8BF4\u8BDD\u98CE\u683C\u5217\u8868 |
44395
44432
  | behavior_guidelines | \u5426 | \u884C\u4E3A\u51C6\u5219\u5217\u8868 |
44396
44433
  | prohibited_actions | \u5426 | \u7981\u6B62\u884C\u4E3A\u5217\u8868 |
44397
- | approval_mode | \u5426 | auto/safe_only/always_ask |
44434
+ | approval_mode | \u5426 | auto / safe_only / always_ask |
44398
44435
  | when_to_use | \u5426 | \u9002\u7528\u573A\u666F |
44399
44436
  | when_not_to_use | \u5426 | \u4E0D\u9002\u7528\u573A\u666F |
44400
44437
 
44401
- ## \u53EF\u7528\u7684\u5185\u7F6E\u5DE5\u5177
44438
+ ## \u53EF\u7528\u5185\u7F6E\u5DE5\u5177
44402
44439
 
44403
44440
  AskUser, Read, Write, Edit, Glob, Grep, Shell, WebSearch, WebFetch, Skill, ListSkills, EnterPlanMode, ExitPlanMode
44404
44441
 
@@ -44406,69 +44443,69 @@ AskUser, Read, Write, Edit, Glob, Grep, Shell, WebSearch, WebFetch, Skill, ListS
44406
44443
 
44407
44444
  \u7528 /create-tool \u521B\u5EFA\uFF0C\u653E\u5728 ~/.aggroot/tools/ \u4E0B\uFF0C\u5728 tools \u6570\u7EC4\u4E2D\u5F15\u7528\u540D\u79F0\u5373\u53EF\u3002
44408
44445
 
44409
- ## \u6267\u884C\u6B65\u9AA4
44446
+ ## \u26A0\uFE0F \u5FC5\u987B\u6267\u884C\u7684\u64CD\u4F5C
44410
44447
 
44411
- 1. \u6839\u636E\u7528\u6237\u9700\u6C42\uFF0C\u5B8C\u5584 Agent \u914D\u7F6E\uFF08\u7279\u522B\u662F identity \u8981\u5199\u6E05\u695A\u89D2\u8272\u5B9A\u4E49\u548C\u5DE5\u4F5C\u65B9\u5F0F\uFF09
44412
- 2. \u5C06 JSON \u6587\u4EF6\u5199\u5165: ${b}${E}
44413
- 3. \u63D0\u793A\u7528\u6237\u91CD\u542F CLI \u6216\u6309 # \u5207\u6362\u5230\u65B0 Agent`}},{name:"create-tool",description:"\u521B\u5EFA\u81EA\u5B9A\u4E49\u5DE5\u5177\uFF08Agent \u53EF\u8C03\u7528\u7684\u80FD\u529B\u63D2\u4EF6\uFF09",source:"builtin",whenToUse:"\u7528\u6237\u60F3\u4E3A Agent \u521B\u5EFA\u81EA\u5B9A\u4E49\u5DE5\u5177/\u63D2\u4EF6\uFF0C\u6216\u9700\u8981\u4E86\u89E3 Tool \u5F00\u53D1\u683C\u5F0F\u548C\u89C4\u8303",arguments:[{name:"name",description:"\u5DE5\u5177\u540D\u79F0\uFF0C\u5982 GetCurrentTime\u3001FetchStockPrice",required:!0},{name:"description",description:"\u5DE5\u5177\u529F\u80FD\u63CF\u8FF0\uFF08\u7ED9 AI \u770B\uFF0C\u51B3\u5B9A\u4F55\u65F6\u8C03\u7528\u6B64\u5DE5\u5177\uFF09",required:!0},{name:"scope",description:"\u4FDD\u5B58\u4F4D\u7F6E: user(\u5168\u5C40 ~/.aggroot/tools/) \u6216 project(\u9879\u76EE .aggroot/tools/)",default:"user"}],allowedTools:["write_file","read_file","run_shell_command"],getPrompt:async(n,e)=>{let r=n.name,s=n.description,u=(n.scope||"user")==="project"?".aggroot/tools/":"~/.aggroot/tools/",f=r.replace(/([A-Z])/g,"-$1").toLowerCase().replace(/^-/,"")+".mjs";return`\u6839\u636E\u4EE5\u4E0B\u4FE1\u606F\u521B\u5EFA\u81EA\u5B9A\u4E49\u5DE5\u5177\uFF0C\u5E76\u5199\u5165\u6587\u4EF6\u3002
44448
+ 1. \u6839\u636E\u7528\u6237\u9700\u6C42\u8BBE\u8BA1 Agent \u914D\u7F6E
44449
+ 2. **\u5FC5\u987B\u8C03\u7528 Shell \u5DE5\u5177**\u6267\u884C: mkdir -p ${u}
44450
+ 3. **\u5FC5\u987B\u8C03\u7528 Write \u5DE5\u5177**\u5C06 JSON \u5199\u5165: ${u}/${s||"agent"}.json
44451
+ 4. \u544A\u77E5\u7528\u6237\u91CD\u542F CLI \u6216\u6309 # \u5207\u6362\u5230\u65B0 Agent`;return{create:w,read:g,edit:E,delete:b,list:m}[r]||w}},{name:"create-tool",description:"\u7BA1\u7406\u81EA\u5B9A\u4E49\u5DE5\u5177\uFF08\u521B\u5EFA/\u67E5\u770B/\u7F16\u8F91/\u5220\u9664\uFF09\uFF0CAgent \u53EF\u8C03\u7528\u7684\u80FD\u529B\u63D2\u4EF6",source:"builtin",whenToUse:"\u7528\u6237\u60F3\u521B\u5EFA\u3001\u67E5\u770B\u3001\u4FEE\u6539\u6216\u5220\u9664\u81EA\u5B9A\u4E49\u5DE5\u5177/\u63D2\u4EF6\uFF0C\u6216\u9700\u8981\u4E86\u89E3 Tool \u5F00\u53D1\u683C\u5F0F",arguments:[{name:"action",description:"\u64CD\u4F5C: create(\u521B\u5EFA), read(\u67E5\u770B), edit(\u7F16\u8F91), delete(\u5220\u9664), list(\u5217\u8868)",required:!0},{name:"name",description:"\u5DE5\u5177\u540D\u79F0\uFF0C\u5982 GetCurrentTime\u3001FetchStockPrice"},{name:"scope",description:"\u4F4D\u7F6E: user(\u5168\u5C40 ~/.aggroot/tools/) \u6216 project(\u9879\u76EE .aggroot/tools/)",default:"user"}],allowedTools:["write_file","read_file","replace","search_file_content","glob","run_shell_command"],getPrompt:async(n,e)=>{let r=(n.action||"").toLowerCase(),s=n.name||"",u=(n.scope||"user")==="project"?".aggroot/tools":"~/.aggroot/tools",f=`\u5217\u51FA\u6240\u6709\u81EA\u5B9A\u4E49\u5DE5\u5177\u3002
44414
44452
 
44415
- ## Tool \u6838\u5FC3\u6982\u5FF5
44453
+ \u64CD\u4F5C\uFF1A\u4F7F\u7528 Shell \u5DE5\u5177\u6267\u884C "ls -la ${u}/*.mjs ${u}/*.js 2>/dev/null || echo \u76EE\u5F55\u4E3A\u7A7A"
44454
+ \u7136\u540E\u7528 Read \u5DE5\u5177\u9010\u4E2A\u8BFB\u53D6\u6587\u4EF6\uFF0C\u5C55\u793A\u6BCF\u4E2A\u5DE5\u5177\u7684\u540D\u79F0\u3001\u63CF\u8FF0\u548C\u53C2\u6570\u3002`,m=`\u67E5\u770B\u5DE5\u5177\u300C${s}\u300D\u7684\u4EE3\u7801\u3002
44416
44455
 
44417
- Tool \u662F Agent \u53EF\u8C03\u7528\u7684\u80FD\u529B\u63D2\u4EF6\u3002Agent \u901A\u8FC7 tools \u6570\u7EC4\u5F15\u7528\u5DE5\u5177\u540D\uFF0C\u5DE5\u5177\u5B9A\u4E49\u4E86\u53C2\u6570\u683C\u5F0F\u548C\u6267\u884C\u903B\u8F91\u3002
44456
+ \u64CD\u4F5C\uFF1A
44457
+ 1. \u4F7F\u7528 Glob \u641C\u7D22 ${u}/*.mjs
44458
+ 2. \u7528 Read \u8BFB\u53D6\u5339\u914D\u7684\u6587\u4EF6\uFF0C\u627E\u5230 name \u4E3A\u300C${s}\u300D\u7684\u5DE5\u5177
44459
+ 3. \u5C55\u793A\u5B8C\u6574\u4EE3\u7801`,g=`\u5220\u9664\u5DE5\u5177\u300C${s}\u300D\u3002
44418
44460
 
44419
- ## Tool \u6587\u4EF6\u683C\u5F0F\uFF08.mjs\uFF0CES Module\uFF09
44461
+ \u64CD\u4F5C\uFF1A
44462
+ 1. \u7528 Glob \u641C\u7D22 ${u}/*.mjs\uFF0C\u627E\u5230\u76EE\u6807\u6587\u4EF6
44463
+ 2. \u7528 Read \u786E\u8BA4\u6587\u4EF6\u5185\u5BB9
44464
+ 3. \u7528 Shell \u6267\u884C rm \u5220\u9664
44465
+ 4. \u544A\u77E5\u7528\u6237\u5DF2\u5220\u9664\uFF0C\u63D0\u9192\u540C\u6B65\u4FEE\u6539\u5F15\u7528\u6B64\u5DE5\u5177\u7684 Agent`,b=`\u7F16\u8F91\u5DE5\u5177\u300C${s}\u300D\u7684\u4EE3\u7801\u3002
44466
+
44467
+ \u64CD\u4F5C\uFF1A
44468
+ 1. \u7528 Glob \u641C\u7D22 ${u}/*.mjs\uFF0C\u627E\u5230\u76EE\u6807\u6587\u4EF6
44469
+ 2. \u7528 Read \u8BFB\u53D6\u5F53\u524D\u4EE3\u7801
44470
+ 3. \u6839\u636E\u7528\u6237\u8981\u6C42\u7684\u4FEE\u6539\uFF0C\u7528 Edit \u5DE5\u5177\u4FEE\u6539\u6587\u4EF6
44471
+ 4. \u4FEE\u6539\u540E\u7528 Read \u786E\u8BA4\u7ED3\u679C`,E=`\u521B\u5EFA\u81EA\u5B9A\u4E49\u5DE5\u5177\u3002**\u4F60\u5FC5\u987B\u8C03\u7528 Write \u5DE5\u5177\u5199\u5165\u6587\u4EF6\uFF0C\u4E0D\u80FD\u53EA\u8F93\u51FA\u6587\u672C\uFF01**
44472
+
44473
+ ## Tool \u683C\u5F0F\uFF08.mjs\uFF0CES Module\uFF09
44420
44474
 
44421
44475
  \`\`\`javascript
44422
44476
  export default {
44423
- name: '${r}', // \u5FC5\u586B\uFF1A\u5DE5\u5177\u540D\u79F0\uFF0C\u4E0E Agent JSON \u4E2D tools \u5F15\u7528\u4E00\u81F4
44424
- description: '${s}', // \u5FC5\u586B\uFF1A\u7ED9 AI \u770B\u7684\u63CF\u8FF0\uFF0C\u51B3\u5B9A\u4F55\u65F6\u8C03\u7528
44425
- parameters: { // \u5FC5\u586B\uFF1A\u53C2\u6570 JSON Schema
44477
+ name: 'ToolName', // \u5FC5\u586B\uFF1A\u5DE5\u5177\u540D\u79F0\uFF0C\u4E0E Agent JSON \u4E2D tools \u5F15\u7528\u4E00\u81F4
44478
+ description: '\u5DE5\u5177\u63CF\u8FF0', // \u5FC5\u586B\uFF1A\u7ED9 AI \u770B\u7684\u63CF\u8FF0
44479
+ parameters: { // \u5FC5\u586B\uFF1A\u53C2\u6570 JSON Schema
44426
44480
  type: 'object',
44427
44481
  properties: {
44428
- // \u5728\u6B64\u5B9A\u4E49\u53C2\u6570
44482
+ param1: { type: 'string', description: '\u53C2\u6570\u63CF\u8FF0' },
44429
44483
  },
44430
- required: [], // \u5FC5\u586B\u53C2\u6570\u5217\u8868
44484
+ required: [],
44431
44485
  },
44432
- riskLevel: 'safe', // \u53EF\u9009\uFF1Asafe | medium | dangerous
44433
- requiresConfirmation: false, // \u53EF\u9009\uFF1A\u6267\u884C\u524D\u662F\u5426\u9700\u8981\u7528\u6237\u786E\u8BA4
44434
- execute: async (args) => { // \u5FC5\u586B\uFF1A\u6267\u884C\u51FD\u6570
44435
- // args \u662F\u53C2\u6570\u5BF9\u8C61
44436
- // \u6210\u529F: return { success: true, stdout: '\u7ED3\u679C' };
44437
- // \u5931\u8D25: return { success: false, stderr: '\u9519\u8BEF\u4FE1\u606F' };
44486
+ riskLevel: 'safe', // \u53EF\u9009\uFF1Asafe | medium | dangerous
44487
+ requiresConfirmation: false, // \u53EF\u9009\uFF1A\u6267\u884C\u524D\u662F\u5426\u9700\u8981\u7528\u6237\u786E\u8BA4
44488
+ execute: async (args) => { // \u5FC5\u586B\uFF1A\u6267\u884C\u51FD\u6570
44489
+ return { success: true, stdout: '\u7ED3\u679C' };
44438
44490
  },
44439
44491
  };
44440
44492
  \`\`\`
44441
44493
 
44442
44494
  ## \u5173\u952E\u89C4\u5219
44443
44495
 
44444
- 1. **\u6587\u4EF6\u5FC5\u987B\u7528 .mjs \u6269\u5C55\u540D**\uFF08ES Module \u683C\u5F0F\uFF09
44445
- 2. **\u4E0D\u80FD\u4F7F\u7528 TypeScript \u8BED\u6CD5**\uFF08\u5982 as string\u3001\u7C7B\u578B\u6CE8\u89E3\uFF09\uFF0CNode.js \u76F4\u63A5\u6267\u884C
44496
+ 1. **\u5FC5\u987B\u7528 .mjs \u6269\u5C55\u540D**\uFF08ES Module\uFF09
44497
+ 2. **\u4E0D\u80FD\u7528 TypeScript \u8BED\u6CD5**\uFF08\u5982 as string\uFF09\uFF0CNode.js \u76F4\u63A5\u6267\u884C
44446
44498
  3. **execute \u5FC5\u987B\u662F async \u51FD\u6570**
44447
- 4. **name \u533A\u5206\u5927\u5C0F\u5199**\uFF0C\u5FC5\u987B\u4E0E Agent \u7684 tools \u5F15\u7528\u5B8C\u5168\u4E00\u81F4
44448
- 5. **execute \u8FD4\u56DE\u503C**\u5FC5\u987B\u5305\u542B success \u5B57\u6BB5\uFF1A
44449
- - \u6210\u529F: \`{ success: true, stdout: '\u7ED3\u679C\u6587\u672C' }\`
44450
- - \u5931\u8D25: \`{ success: false, stderr: '\u9519\u8BEF\u4FE1\u606F' }\`
44499
+ 4. **name \u533A\u5206\u5927\u5C0F\u5199**\uFF0C\u4E0E Agent \u7684 tools \u5F15\u7528\u5FC5\u987B\u4E00\u81F4
44500
+ 5. \u8FD4\u56DE\u503C\u683C\u5F0F\uFF1A\u6210\u529F \`{ success: true, stdout: '...' }\`\uFF0C\u5931\u8D25 \`{ success: false, stderr: '...' }\`
44451
44501
 
44452
- ## parameters JSON Schema \u793A\u4F8B
44502
+ ## parameters \u793A\u4F8B
44453
44503
 
44454
44504
  \`\`\`javascript
44455
- // \u57FA\u7840\u53C2\u6570
44456
- parameters: {
44457
- type: 'object',
44458
- properties: {
44459
- query: { type: 'string', description: '\u641C\u7D22\u5173\u952E\u8BCD' },
44460
- limit: { type: 'number', description: '\u8FD4\u56DE\u6570\u91CF\u4E0A\u9650' },
44461
- },
44462
- required: ['query'],
44463
- }
44464
-
44465
- // \u679A\u4E3E\u53C2\u6570
44466
- parameters: {
44467
- type: 'object',
44468
- properties: {
44469
- format: { type: 'string', enum: ['json', 'csv', 'text'], description: '\u8F93\u51FA\u683C\u5F0F' },
44470
- },
44471
- }
44505
+ // \u57FA\u7840
44506
+ { type: 'object', properties: { query: { type: 'string', description: '\u641C\u7D22\u8BCD' } }, required: ['query'] }
44507
+ // \u679A\u4E3E
44508
+ { type: 'object', properties: { format: { type: 'string', enum: ['json','csv'], description: '\u683C\u5F0F' } } }
44472
44509
  \`\`\`
44473
44510
 
44474
44511
  ## \u5B8C\u6574\u793A\u4F8B
@@ -44497,13 +44534,12 @@ export default {
44497
44534
  };
44498
44535
  \`\`\`
44499
44536
 
44500
- ## \u6267\u884C\u6B65\u9AA4
44537
+ ## \u26A0\uFE0F \u5FC5\u987B\u6267\u884C\u7684\u64CD\u4F5C
44501
44538
 
44502
- 1. \u4E86\u89E3\u7528\u6237\u9700\u8981\u7684\u5DE5\u5177\u529F\u80FD
44503
- 2. \u8BBE\u8BA1\u53C2\u6570\u683C\u5F0F\u548C\u6267\u884C\u903B\u8F91
44504
- 3. \u7F16\u5199 .mjs \u6587\u4EF6
44505
- 4. \u5199\u5165: ${u}${f}
44506
- 5. \u63D0\u9192\u7528\u6237\u5728 Agent JSON \u7684 tools \u6570\u7EC4\u4E2D\u5F15\u7528 "${r}"`}}]});var zbn,Bbn,WL,s3,EXr,xXr,wXr,AXr,aWe,jbn=kt(()=>{"use strict";F();zbn=require("node:fs"),Bbn=require("node:child_process"),WL=require("node:path");Eu();DU();s3=Ms("prompt-preprocessor"),EXr=10*1024,xXr=5e3,wXr=["/etc/shadow","/etc/passwd","/etc/ssh","/root/.ssh","/proc/","/sys/","c:\\windows\\system32\\config\\","c:\\programdata\\","\\\\"],AXr=[".ssh","id_rsa","id_ed25519","id_ecdsa",".gnupg",".aws",".kube","sam","system","security","ntuser.dat"],aWe=class{async process(e,r){let s=e;return s=this.substituteVariables(s,r),s=await this.injectFiles(s,r),s=this.executeShellCommands(s,r),s=this.substituteArgs(s,r.args),s}substituteVariables(e,r){let s=e;return s=s.replace(/\$\{SKILL_DIR\}/g,r.skillDir??""),s=s.replace(/\$\{PROJECT_ROOT\}/g,r.projectRoot),s=s.replace(/\$\{CWD\}/g,r.cwd),s}async injectFiles(e,r){let s=r.maxFileSize??EXr,a=/\$\{file:([^}]+)\}/g;return e.replace(a,(u,f)=>{try{if(f.includes("\0"))return s3.warn({filePath:f},"Null byte in file path blocked"),"[Error: Invalid file path]";if(f.includes(".."))return s3.warn({filePath:f},"Path traversal in file injection blocked"),"[Error: Path traversal not allowed]";let m=(0,WL.isAbsolute)(f)?(0,WL.normalize)(f):(0,WL.resolve)(r.projectRoot,f),g=[(0,WL.normalize)(r.projectRoot)];if(r.skillDir&&g.push((0,WL.normalize)(r.skillDir)),!g.some(L=>m===L||m.startsWith(L+WL.sep)))return s3.warn({resolvedPath:m,allowedRoots:g},"File path outside allowed directories blocked"),"[Error: File path must be under project root or skill directory]";let E=m.toLowerCase();for(let L of wXr)if(E.startsWith(L)||E===L.slice(0,-1))return s3.warn({resolvedPath:m},"Access to system path blocked"),"[Error: Access to system path blocked]";let w=E.split(/[/\\]/);for(let L of AXr)if(w.includes(L))return s3.warn({resolvedPath:m,segment:L},"Access to sensitive path segment blocked"),"[Error: Access to sensitive path blocked]";let C=(0,zbn.readFileSync)(m,"utf-8");return C.length>s?`${C.slice(0,s)}
44539
+ 1. \u6839\u636E\u7528\u6237\u9700\u6C42\u8BBE\u8BA1\u5DE5\u5177
44540
+ 2. **\u5FC5\u987B\u8C03\u7528 Shell \u5DE5\u5177**\u6267\u884C: mkdir -p ${u}
44541
+ 3. **\u5FC5\u987B\u8C03\u7528 Write \u5DE5\u5177**\u5C06 .mjs \u5199\u5165: ${u}/${s||"tool"}.mjs
44542
+ 4. \u63D0\u9192\u7528\u6237\u5728 Agent JSON \u7684 tools \u6570\u7EC4\u4E2D\u5F15\u7528\u6B64\u5DE5\u5177\u540D`;return{create:E,read:m,edit:b,delete:g,list:f}[r]||E}}]});var zbn,Bbn,WL,s3,EXr,xXr,wXr,AXr,aWe,jbn=kt(()=>{"use strict";F();zbn=require("node:fs"),Bbn=require("node:child_process"),WL=require("node:path");Eu();DU();s3=Ms("prompt-preprocessor"),EXr=10*1024,xXr=5e3,wXr=["/etc/shadow","/etc/passwd","/etc/ssh","/root/.ssh","/proc/","/sys/","c:\\windows\\system32\\config\\","c:\\programdata\\","\\\\"],AXr=[".ssh","id_rsa","id_ed25519","id_ecdsa",".gnupg",".aws",".kube","sam","system","security","ntuser.dat"],aWe=class{async process(e,r){let s=e;return s=this.substituteVariables(s,r),s=await this.injectFiles(s,r),s=this.executeShellCommands(s,r),s=this.substituteArgs(s,r.args),s}substituteVariables(e,r){let s=e;return s=s.replace(/\$\{SKILL_DIR\}/g,r.skillDir??""),s=s.replace(/\$\{PROJECT_ROOT\}/g,r.projectRoot),s=s.replace(/\$\{CWD\}/g,r.cwd),s}async injectFiles(e,r){let s=r.maxFileSize??EXr,a=/\$\{file:([^}]+)\}/g;return e.replace(a,(u,f)=>{try{if(f.includes("\0"))return s3.warn({filePath:f},"Null byte in file path blocked"),"[Error: Invalid file path]";if(f.includes(".."))return s3.warn({filePath:f},"Path traversal in file injection blocked"),"[Error: Path traversal not allowed]";let m=(0,WL.isAbsolute)(f)?(0,WL.normalize)(f):(0,WL.resolve)(r.projectRoot,f),g=[(0,WL.normalize)(r.projectRoot)];if(r.skillDir&&g.push((0,WL.normalize)(r.skillDir)),!g.some(L=>m===L||m.startsWith(L+WL.sep)))return s3.warn({resolvedPath:m,allowedRoots:g},"File path outside allowed directories blocked"),"[Error: File path must be under project root or skill directory]";let E=m.toLowerCase();for(let L of wXr)if(E.startsWith(L)||E===L.slice(0,-1))return s3.warn({resolvedPath:m},"Access to system path blocked"),"[Error: Access to system path blocked]";let w=E.split(/[/\\]/);for(let L of AXr)if(w.includes(L))return s3.warn({resolvedPath:m,segment:L},"Access to sensitive path segment blocked"),"[Error: Access to sensitive path blocked]";let C=(0,zbn.readFileSync)(m,"utf-8");return C.length>s?`${C.slice(0,s)}
44507
44543
  ... [file truncated, ${C.length-s} characters omitted]`:C}catch(m){return s3.warn({filePath:f,error:String(m)},"Failed to inject file content"),`[Error: Could not read file ${f}]`}})}executeShellCommands(e,r){let s=r.commandTimeout??xXr,a=/!`([^`]+)`/g;return e.replace(a,(u,f)=>{try{let m=RU(f);return m.valid?(0,Bbn.execSync)(f,{timeout:s,cwd:r.cwd,encoding:"utf-8",stdio:["pipe","pipe","pipe"],maxBuffer:10*1024}).trim():(s3.warn({command:f},"Dangerous command in prompt template blocked"),`[Error: ${m.error}]`)}catch(m){s3.warn({command:f,error:String(m)},"Shell command in prompt failed");let g=m.stderr?.toString()?.trim()??"";return`[Command failed: ${f}${g?` \u2014 ${g}`:""}]`}})}substituteArgs(e,r){let s=e;for(let[a,u]of Object.entries(r)){let f=a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");s=s.replace(new RegExp(`\\{\\{${f}\\}\\}`,"g"),String(u))}return s}}});var $bn={};Wl($bn,{createListSkillsTool:()=>_vt,createSkillTool:()=>mvt,formatSkillListing:()=>hvt});function mvt(n,e,r,s){return{id:"Skill",name:"Skill",displayName:"\u8C03\u7528\u6280\u80FD",description:'Invoke a registered skill by name. Skills are reusable prompt templates for specialized tasks (e.g. code review, commit, explain). When users reference a "skill" or "/<something>", they are referring to a skill. Skills can execute in two modes: inline (prompt injected into current conversation) or fork (runs in a separate agent context). Use ListSkills to discover available skills. REQUIRED: name (string). Optional: args (string \u2014 arguments passed to the skill), file_path (string \u2014 load a reference file from the skill directory instead of executing).',parameters:{type:"object",properties:{name:{type:"string",description:'Skill name to invoke (REQUIRED). E.g. "explain", "refactor", "commit". Use ListSkills to see all available skills.'},args:{type:"string",description:'Arguments to pass to the skill as a raw string. The skill parses this according to its own argument definition. E.g. for "explain" skill, pass the topic; for "refactor", pass the file path.'},file_path:{type:"string",description:'Load a reference file from the skill directory instead of executing the skill. Must be under allowed subdirs: references, templates, scripts, assets. E.g. "references/api-guide.md".'}},required:["name"]},execute:async b=>{let E=b.name,w=b.args||"",C=b.file_path,L=n.get(E);if(!L){let re=n.list().map(Se=>Se.name).join(", ");return{success:!1,stderr:`Skill not found: ${E}
44508
44544
  Available skills: ${re}`,data:{skillName:E}}}if(C)try{let{readFile:re}=await import("node:fs/promises"),{join:Se}=await import("node:path"),{existsSync:Pe}=await import("node:fs"),{homedir:Ae}=await import("node:os"),{AGGROOT_HOME:ke}=await Promise.resolve().then(()=>(pf(),n9t)),{readdir:He}=await import("node:fs/promises"),qe=Se(ke,"skills"),et=null;if(qe&&Pe(qe)){let Nr=await He(qe,{withFileTypes:!0});for(let Ot of Nr){if(!Ot.isDirectory())continue;let Ar=Se(qe,Ot.name),Lr=Se(Ar,"SKILL.md");if(Ot.name===E&&Pe(Lr)){et=Ar;break}try{let Gr=await He(Ar,{withFileTypes:!0});for(let Vr of Gr){if(!Vr.isDirectory())continue;let Go=Se(Ar,Vr.name),In=Se(Go,"SKILL.md");if(Vr.name===E&&Pe(In)){et=Go;break}}}catch{}if(et)break}}if(!et)return{success:!1,stderr:`Skill directory not found: ${E}`,data:{skillName:E}};let Pt=new Set(["references","templates","scripts","assets"]),mn=C.split(/[/\\]/);if(mn.length<2||!Pt.has(mn[0]))return{success:!1,stderr:`File must be under one of: ${[...Pt].sort().join(", ")}. Got: '${C}'`,data:{skillName:E}};if(C.includes(".."))return{success:!1,stderr:"Path traversal is not allowed.",data:{skillName:E}};let yt=Se(et,C);return yt.startsWith(et)?Pe(yt)?{success:!0,stdout:await re(yt,"utf-8"),data:{skillName:E,file_path:C},summary:`Loaded ${C} from skill ${E}`}:{success:!1,stderr:`File not found: ${C}`,data:{skillName:E,hint:"Use ListSkills to see the skill, then check its files."}}:{success:!1,stderr:"Path escapes skill directory.",data:{skillName:E}}}catch(re){return{success:!1,stderr:`Failed to read skill file: ${re instanceof Error?re.message:String(re)}`,data:{skillName:E,file_path:C}}}if(L.disableModelInvocation)return{success:!1,stderr:`Skill "${E}" cannot be invoked by the model. It is user-invocable only.`,data:{skillName:E}};let k=CXr(w,L.arguments);if(Qfe.info({skillName:E,rawArgs:w,parsedArgs:k},"Invoking skill"),s&&s.bumpUse(E).catch(()=>{}),L.arguments){for(let re of L.arguments)if(re.required&&!(re.name in k))return{success:!1,stderr:`Missing required argument: ${re.name}. Usage: skill({name: "${E}", args: "<${re.name}>${re.description?" - "+re.description:""}"})`,data:{skillName:E}}}let M=L.allowedTools,U;if(L.allowedTools&&L.allowedTools.length>0&&e){let re=e(),{resolved:Se,unresolved:Pe}=pst(L.allowedTools,re);M=Array.from(Se.values()),Pe.length>0&&(U=Pe,Qfe.warn({skillName:E,unresolved:Pe,available:re},"Some skill tools not available in agent"))}let H=L.filePath,Q=H?(0,Gbn.dirname)(H):void 0,te={cwd:process.cwd(),projectRoot:process.cwd(),skillDir:Q};try{if(L.context==="fork"&&r){let Ae=await r.execute(L,k,te);return Ae.success?{success:!0,stdout:Ae.forkOutput??"Skill completed with no output",data:{skillName:E,skillDescription:L.description,allowedTools:M,context:"fork",model:L.model,...U?{toolWarnings:U}:{}},summary:`Skill completed (fork): ${E}`}:{success:!1,stderr:Ae.error??Ae.forkOutput??"Fork execution failed",data:{skillName:E}}}let re=await L.getPrompt(k,te);re=await new aWe().process(re,{skillDir:te.skillDir,projectRoot:te.projectRoot,cwd:te.cwd,args:k}),Qfe.debug({skillName:E,promptLength:re.length},"Skill prompt generated");let Pe={};if(L.contextModifier)try{let Ae=await L.contextModifier(k);if(Pe={systemContext:Ae.systemContext,modifierAllowedTools:Ae.addAllowedTools},Ae.addAllowedTools&&e){let ke=e(),{resolved:He}=pst(Ae.addAllowedTools,ke),qe=Array.from(He.values());M=[...M??[],...qe]}}catch(Ae){Qfe.warn({skillName:E,error:String(Ae)},"contextModifier failed")}return{success:!0,stdout:re,data:{skillName:E,skillDescription:L.description,allowedTools:M,context:L.context,model:L.model,_isSkillResult:!0,prompt:re,...U?{toolWarnings:U}:{},...Pe},summary:`Skill invoked: ${E}`}}catch(re){return Qfe.error({skillName:E,error:String(re)},"Skill execution failed"),{success:!1,stderr:`Skill execution failed: ${re instanceof Error?re.message:String(re)}`,data:{skillName:E}}}},riskLevel:"safe",requiresConfirmation:!1}}function CXr(n,e){if(!e||e.length===0)return n?{input:n}:{};let r={};if(e.length===1){let a=e[0];return n.trim()&&(r[a.name]=n.trim()),a.default!==void 0&&!(a.name in r)&&(r[a.name]=a.default),r}let s=IXr(n);for(let a=0;a<e.length;a++){let u=e[a];a<s.length&&s[a]!==void 0?r[u.name]=s[a]:u.default!==void 0&&(r[u.name]=u.default)}if(s.length>e.length&&e.length>0){let a=e[e.length-1],u=s.slice(e.length-1).join(" ");r[a.name]=u}return r}function IXr(n){let e=[],r="",s=!1,a="";for(let u of n)s?u===a?s=!1:r+=u:u==='"'||u==="'"?(s=!0,a=u):u===" "||u===" "?r&&(e.push(r),r=""):r+=u;return r&&e.push(r),e}function hvt(n){let e=n.list();if(e.length===0)return"No skills available.";let r=e.filter(m=>m.userInvocable!==!1),s=new Map,a=[];for(let m of r)if(m.category){let g=s.get(m.category)||[];g.push(m),s.set(m.category,g)}else a.push(m);let u=[],f=n.listCategories();for(let m of f.sort((g,b)=>g.name.localeCompare(b.name))){let g=s.get(m.name);if(!g)continue;let b=m.description?`: ${m.description}`:"";u.push(m.name+b);for(let E of g.sort((w,C)=>w.name.localeCompare(C.name))){let w=E.arguments?.map(C=>C.required?`<${C.name}>`:`[${C.name}]`).join(" ")||"";u.push(` - ${E.name}${w?" "+w:""}: ${E.description}`)}}if(a.length>0){u.length>0&&u.push("");for(let m of a.sort((g,b)=>g.name.localeCompare(b.name))){let g=m.arguments?.map(b=>b.required?`<${b.name}>`:`[${b.name}]`).join(" ")||"";u.push(`- ${m.name}${g?" "+g:""}: ${m.description}`)}}return`Before replying, scan the skills below. If a skill matches or is even partially relevant to your task, you MUST invoke it with skill({name: "..."}) and follow its instructions. Err on the side of invoking \u2014 it is always better to have context you don't need than to miss critical steps, pitfalls, or established workflows.
44509
44545
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aggroot-team/aggroot",
3
- "version": "1.9.3",
3
+ "version": "1.9.5",
4
4
  "description": "AggRoot - AI Assistant (Node.js/TypeScript Version)",
5
5
  "keywords": [
6
6
  "ai",
@@ -66,7 +66,6 @@
66
66
  "install:all": "npm install && npm run rebuild-native"
67
67
  },
68
68
  "dependencies": {
69
- "@aggroot-team/server": "workspace:*",
70
69
  "@modelcontextprotocol/sdk": "^1.29.0",
71
70
  "@sqlite.org/sqlite-wasm": "3.53.0-build1",
72
71
  "@vscode/ripgrep": "^1.17.1",