zen-code 4.9.1 → 4.10.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.
Files changed (123) hide show
  1. package/dist/app.js +175 -166
  2. package/dist/chunk-075hks9v.js +1 -0
  3. package/dist/chunk-0fj768k4.js +112 -0
  4. package/dist/chunk-19mf2aa7.js +1 -0
  5. package/dist/chunk-1mq2jmfy.js +2 -0
  6. package/dist/chunk-1v863afn.js +278 -0
  7. package/dist/chunk-1vn8d8b8.js +1 -0
  8. package/dist/{chunk-mmq834zt.js → chunk-1w19w1bm.js} +1 -1
  9. package/dist/chunk-3dnayvgx.js +224 -0
  10. package/dist/chunk-4hg13vwj.js +1 -0
  11. package/dist/chunk-4scrkcqv.js +1 -0
  12. package/dist/chunk-54cdhhqm.js +1 -0
  13. package/dist/chunk-5m4yb9av.js +91 -0
  14. package/dist/chunk-5yd4ntp6.js +8 -0
  15. package/dist/{chunk-b52b0t16.js → chunk-6scjjkn3.js} +1 -1
  16. package/dist/chunk-7jatn15w.js +2 -0
  17. package/dist/{chunk-4nsg4vcd.js → chunk-7w9y11hj.js} +1 -1
  18. package/dist/chunk-7yzv6385.js +1 -0
  19. package/dist/{chunk-g377vrpj.js → chunk-875hayaj.js} +3 -3
  20. package/dist/chunk-8bs8r50r.js +1 -0
  21. package/dist/chunk-8waww0j9.js +6 -0
  22. package/dist/chunk-8ysg0rga.js +1 -0
  23. package/dist/chunk-9czhw5k6.js +4 -0
  24. package/dist/chunk-9tgp14v7.js +16 -0
  25. package/dist/chunk-a239dn0b.js +1 -0
  26. package/dist/chunk-arv4h3h1.js +2 -0
  27. package/dist/chunk-b2551zfb.js +2 -0
  28. package/dist/chunk-b9emn03n.js +1 -0
  29. package/dist/chunk-bm7578sn.js +1 -0
  30. package/dist/{chunk-1y82m5kn.js → chunk-bytq4kd1.js} +3 -125
  31. package/dist/chunk-c2wfgbj6.js +1 -0
  32. package/dist/{chunk-gcm4jp0d.js → chunk-cef4vbtb.js} +1 -1
  33. package/dist/chunk-cnzhxgn5.js +4 -0
  34. package/dist/chunk-d2770b2z.js +1 -0
  35. package/dist/chunk-d72063sm.js +2 -0
  36. package/dist/{chunk-9k5d9vf1.js → chunk-d988tv30.js} +1 -1
  37. package/dist/{chunk-va71tsw3.js → chunk-dx9k6sdd.js} +3 -3
  38. package/dist/chunk-e6ggkg36.js +2 -0
  39. package/dist/chunk-fjqtrakn.js +1 -0
  40. package/dist/chunk-gbfpab0j.js +1 -0
  41. package/dist/chunk-gkvx829z.js +1 -0
  42. package/dist/{chunk-9dahn9h7.js → chunk-gwf8b14k.js} +1 -1
  43. package/dist/chunk-gz7fz9fg.js +1 -0
  44. package/dist/chunk-h0q3dvnv.js +5 -0
  45. package/dist/chunk-h0qb9jk1.js +1 -0
  46. package/dist/chunk-h9y136h8.js +1 -0
  47. package/dist/chunk-hrcxdj3c.js +54 -0
  48. package/dist/chunk-hz9yw7cs.js +166 -0
  49. package/dist/chunk-j4y5rjne.js +79 -0
  50. package/dist/chunk-k12y05c3.js +3 -0
  51. package/dist/chunk-k6fxqssr.js +18 -0
  52. package/dist/{chunk-rncpxz1b.js → chunk-kmxdq21k.js} +2 -2
  53. package/dist/chunk-mcb8rewr.js +213 -0
  54. package/dist/{chunk-wn43r152.js → chunk-mm9w91rj.js} +1 -1
  55. package/dist/chunk-mv0xzmq8.js +2 -0
  56. package/dist/chunk-n849zsd3.js +1 -0
  57. package/dist/chunk-nm253hhf.js +81 -0
  58. package/dist/chunk-prg6489q.js +1 -0
  59. package/dist/{chunk-cggjws6a.js → chunk-pxdgy0vr.js} +1 -1
  60. package/dist/chunk-qhzm2qw9.js +2 -0
  61. package/dist/{chunk-98f6hg43.js → chunk-qmxtys9q.js} +1 -1
  62. package/dist/chunk-r0cfe5c1.js +294 -0
  63. package/dist/chunk-rtjytfhh.js +1 -0
  64. package/dist/chunk-s7ttf0pm.js +2 -0
  65. package/dist/chunk-t01t72t2.js +140 -0
  66. package/dist/{chunk-ns6tjjkq.js → chunk-t0f66x64.js} +1 -1
  67. package/dist/chunk-tn356gwf.js +93 -0
  68. package/dist/chunk-vd8kwzra.js +41 -0
  69. package/dist/chunk-vhn13anh.js +233 -0
  70. package/dist/chunk-vnewbtjy.js +1 -0
  71. package/dist/chunk-wbm7rn9w.js +2 -0
  72. package/dist/chunk-wd3gkd45.js +3 -0
  73. package/dist/chunk-whdf0vbb.js +1 -0
  74. package/dist/{chunk-j7a40ww9.js → chunk-ws232ksq.js} +2 -2
  75. package/dist/{chunk-8g2zdcy0.js → chunk-yerf10k7.js} +1 -1
  76. package/dist/{chunk-heasksrr.js → chunk-yzv3n8mw.js} +2 -2
  77. package/dist/chunk-z3e4c424.js +2 -0
  78. package/dist/chunk-znw7fpep.js +6 -0
  79. package/dist/chunk-zq2g4rfd.js +1 -0
  80. package/dist/cli.js +1 -1
  81. package/dist/nonInteractive.js +314 -4
  82. package/dist/zen-keyboard.js +1 -1
  83. package/package.json +37 -37
  84. package/dist/chunk-02vv5584.js +0 -1
  85. package/dist/chunk-13nyfrmm.js +0 -310
  86. package/dist/chunk-1edvf7b5.js +0 -1
  87. package/dist/chunk-1rmnbdef.js +0 -1
  88. package/dist/chunk-1ttywx0y.js +0 -6
  89. package/dist/chunk-30sq2w0d.js +0 -8
  90. package/dist/chunk-32ase1cw.js +0 -2
  91. package/dist/chunk-3490ntd8.js +0 -1
  92. package/dist/chunk-3pcybja5.js +0 -7
  93. package/dist/chunk-5rr85f28.js +0 -1
  94. package/dist/chunk-5x8nxw0t.js +0 -137
  95. package/dist/chunk-6rfc36jg.js +0 -1
  96. package/dist/chunk-76h8pe7x.js +0 -2
  97. package/dist/chunk-7kdvr78m.js +0 -31
  98. package/dist/chunk-8z38ybz7.js +0 -1
  99. package/dist/chunk-b8dxq9rq.js +0 -1
  100. package/dist/chunk-cjqarwdn.js +0 -1
  101. package/dist/chunk-cs73xbzz.js +0 -1
  102. package/dist/chunk-cyexd09c.js +0 -2
  103. package/dist/chunk-ep2es95e.js +0 -81
  104. package/dist/chunk-f8ewggk1.js +0 -1
  105. package/dist/chunk-g7pm00z7.js +0 -253
  106. package/dist/chunk-hfve7nf5.js +0 -2
  107. package/dist/chunk-j9aysaeb.js +0 -1
  108. package/dist/chunk-jbf8ve63.js +0 -3
  109. package/dist/chunk-jfhc5c0d.js +0 -1
  110. package/dist/chunk-jxsfzfac.js +0 -2
  111. package/dist/chunk-kba8akjs.js +0 -2
  112. package/dist/chunk-m76ya904.js +0 -1
  113. package/dist/chunk-mjzeawnq.js +0 -6
  114. package/dist/chunk-nwy6n6b6.js +0 -274
  115. package/dist/chunk-qd305hg1.js +0 -1
  116. package/dist/chunk-qez6ejd4.js +0 -1
  117. package/dist/chunk-r2h3x9zv.js +0 -2
  118. package/dist/chunk-rz3b356n.js +0 -1
  119. package/dist/chunk-trjpzw1n.js +0 -91
  120. package/dist/chunk-xhnvpygg.js +0 -2
  121. package/dist/chunk-xkz5z0zn.js +0 -1
  122. package/dist/chunk-zwxjkwqd.js +0 -26
  123. package/dist/chunk-zz32kgt2.js +0 -1
@@ -1,4 +1,4 @@
1
- import{Ja as f,La as g}from"./chunk-5x8nxw0t.js";import{Sa as b}from"./chunk-13nyfrmm.js";import{yb as i}from"./chunk-kba8akjs.js";import{AgentPackage as E,MemoryStorage as L}from"@langgraph-js/standard-agent";import{tool as U}from"@langchain/core/tools";import{z as o}from"zod";var I=o.object({content:o.string().min(1),status:o.enum(["pending","in_progress","completed"]),id:o.string()}),A=o.object({todos:o.array(I).describe("The updated todo list")}),u=U(async()=>{return"todo saved successfully"},{name:"todo_write",description:`Use this tool to create and manage a structured task list for your current coding session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.
1
+ import{Gk as t}from"./chunk-tn356gwf.js";import{vl as e}from"./chunk-vd8kwzra.js";var s=e.object({content:e.string().min(1),status:e.enum(["pending","in_progress","completed"]),id:e.string()}),a=e.object({todos:e.array(s).describe("The updated todo list")}),n=t(async()=>{return"todo saved successfully"},{name:"todo_write",description:`Use this tool to create and manage a structured task list for your current coding session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.
2
2
  It also helps the user understand the progress of the task and overall progress of their requests.
3
3
  ## When to Use This Tool
4
4
  Use this tool proactively in these scenarios:
@@ -172,127 +172,5 @@ The assistant did not use the todo list because this is a single command executi
172
172
  - Use clear, descriptive task names
173
173
 
174
174
  When in doubt, use this tool. Being proactive with task management demonstrates attentiveness and ensures you complete all requirements successfully.
175
- `,schema:A});import{z as n}from"zod";import{tool as z}from"langchain";var C=n.object({label:n.string().min(1).max(50).describe("选项显示文本,简洁明了(1-50 字符)")}),W=n.object({description:n.string().min(1).describe("向用户提出的问题,清晰具体,包含必要的上下文"),type:n.enum(["single_select","multi_select"]).describe("选择类型:single_select(单选)或 multi_select(多选)"),options:n.array(C).min(2).max(6).describe("选项列表,至少 2 个,最多 6 个"),allow_custom_input:n.boolean().default(!0).describe("是否允许用户输入自定义文本,默认 true"),placeholder:n.string().optional().describe("自定义输入框的占位符文本")}),h=z(()=>{},{name:"ask_user_questions",description:"Ask the user a question with selectable options",schema:W});var q=[h,u];async function _(e,t){await e.addTool({id:t.name,name:t.name,description:t.description});let l={id:t.name,name:t.name,description:t.description,paramsSchema:t.schema,execute:async(d)=>{let a=await t.invoke(d);if(a&&typeof a==="object"&&"content"in a)return a.content;return a}};e.tools.registerImplementation(l)}async function p(e){return await Promise.all(q.map((t)=>_(e,t)))}async function y(e){let t={id:"filesystem",name:"filesystem",description:"File and directory operations (read, write, search, glob)",execute:async()=>{return new f}};await e.addMiddleware(t),e.middlewares.registerImplementation(t);let l={id:"terminal",name:"terminal",description:"Terminal command execution (Bash/CMD, background processes)",execute:async()=>{return new g}};await e.addMiddleware(l),e.middlewares.registerImplementation(l);let d={id:"subagents",name:"subagents",description:"Task delegation to specialized agents",execute:async()=>{let{createSubAgentsMiddleware:s}=await import("./chunk-1rmnbdef.js");return await s(e)}};await e.addMiddleware(d),e.middlewares.registerImplementation(d);let a={id:"memories",name:"memories",description:"Knowledge persistence",execute:async(s)=>{s.projectMemoriesDir=s.projectMemoriesDir||"./.claude/memories";let{MemoriesMiddleware:r}=await import("./chunk-rz3b356n.js");return new r(s)}};await e.addMiddleware(a),e.middlewares.registerImplementation(a);let c={id:"skills",name:"skills",description:"Progressive skills disclosure",execute:async(s)=>{if(s.projectSkillsDir=s.projectSkillsDir||"./.claude/skills",!s.skillsDir){let v=await import("os"),x=await import("path");s.skillsDir=x.join(v.homedir(),".claude","skills")}let{SkillsMiddleware:r}=await import("@langgraph-js/standard-agent");return new r(s)}};await e.addMiddleware(c),e.middlewares.registerImplementation(c);let m={id:"agents_md",name:"agents_md",description:"Inject agent documentation",execute:async(s)=>{let{AgentsMdMiddleware:r}=await import("@langgraph-js/standard-agent");return new r({projectRoot:s?.projectRoot})}};await e.addMiddleware(m),e.middlewares.registerImplementation(m)}var k=`# 架构师 - 任务派发协调者
176
-
177
- 你是一位**任务派发架构师**,核心职责是将用户需求分析并拆解为子任务,然后委派给合适的子 agent 执行。
178
-
179
- ## 核心职责
180
-
181
- **你的唯一任务**:
182
- 1. 理解用户需求
183
- 2. 拆解为可执行的子任务
184
- 3. 委派给合适的子 agent
185
- 4. 跟踪和汇总结果
186
-
187
- **不要做的事**:
188
- - ❌ 不要自己编写代码
189
- - ❌ 不要自己读取文件或搜索代码
190
- - ❌ 不要自己执行终端命令
191
- - ❌ 不要做具体的架构分析或设计文档
192
-
193
- ## 工作流程
194
-
195
- ### 步骤 1:需求分析
196
-
197
- 当收到用户请求时,快速判断:
198
-
199
- 1. **任务类型**:
200
- - 代码实现/修改 → 委派给 \`agents/default\`
201
- - 任务规划/协调 → 委派给 \`agents/manager\`
202
- - 复杂任务 → 先由 \`agents/manager\` 规划,再由 \`agents/default\` 执行
203
-
204
- 2. **任务规模**:
205
- - 单一任务 → 直接委派
206
- - 多任务 → 拆分后分别委派
207
-
208
- ### 步骤 2:任务拆解
209
-
210
- 使用 \`task\` 工具委派任务:
211
-
212
- \`\`\`typescript
213
- // 示例:委派代码实现任务
214
- {
215
- subagent_id: "agents/default",
216
- task_description: "实现用户认证功能,包括登录、注册、登出三个接口",
217
- data_transfer: {
218
- requirements: "使用 JWT 认证,密码需要加密存储",
219
- constraints: "使用现有的数据库连接池"
220
- }
221
- }
222
- \`\`\`
223
-
224
- ### 步骤 3:结果汇总
225
-
226
- 子 agent 完成后:
227
- 1. 检查执行结果
228
- 2. 如果有多个子任务,协调依赖关系
229
- 3. 向用户汇报整体进度和结果
230
-
231
- ## 委派策略
232
-
233
- ### 简单任务
234
-
235
- 用户请求单一功能时,直接委派:
236
-
237
- > 用户:添加一个日志工具函数
238
-
239
- → 委派给 \`agents/default\`,任务描述清晰完整
240
-
241
- ### 复杂任务
242
-
243
- 用户请求多功能时,拆分后委派:
244
-
245
- > 用户:重构用户模块并添加测试
246
-
247
- → 拆分为:
248
- 1. 委派 \`agents/default\`:重构用户模块代码
249
- 2. 等第一步完成后,委派 \`agents/default\`:为用户模块编写测试
250
-
251
- ### 规划任务
252
-
253
- 用户需要方案设计时:
254
-
255
- > 用户:设计一个新的权限系统
256
-
257
- → 委派 \`agents/manager\` 进行任务规划,然后按规划执行
258
-
259
- ## 输出格式
260
-
261
- ### 委派时
262
-
263
- \`\`\`markdown
264
- ## 任务分析
265
-
266
- **用户需求**:{用户原始请求}
267
-
268
- **任务拆解**:
269
- 1. 任务 A → 委派给 agents/default
270
- 2. 任务 B → 委派给 agents/manager
271
-
272
- **开始执行**...
273
- \`\`\`
274
-
275
- ### 汇报时
276
-
277
- \`\`\`markdown
278
- ## 执行结果
279
-
280
- **已完成**:
281
- - ✅ 任务 A:{简要结果}
282
- - ✅ 任务 B:{简要结果}
283
-
284
- **总结**:{整体结果摘要}
285
- \`\`\`
286
-
287
- ## 重要约束
288
-
289
- 1. **立即委派**:收到任务后,不要犹豫,立即分析并委派
290
- 2. **清晰描述**:给子 agent 的任务描述要完整、清晰
291
- 3. **传递上下文**:使用 \`data_transfer\` 传递必要的背景信息
292
- 4. **不要插手**:相信子 agent 的能力,不要自己动手做具体工作
293
- 5. **保持简洁**:你的输出应该简短,重点是协调和汇总
294
-
295
- ---
296
-
297
- **记住**:你是协调者,不是执行者。快速分析需求,立即委派任务,高效汇总结果。`;async function w(){let e=new L,t=new E(e);return await t.addModel({id:"glm-4.7",model_name:"glm-4.7",model_provider:process.env.MODEL_PROVIDER||"openai",stream_usage:!0,enable_thinking:!0,temperature:0.7,max_tokens:4096,top_p:1,frequency_penalty:0,presence_penalty:0}),await t.addPrompt({id:"prompts/default",name:"default",content:b}),await t.addPrompt({id:"prompts/manager",name:"manager",content:k}),await p(t),await y(t),await t.addAgent({id:"agents/default",name:"Jarvis",description:"代码实现助手",system_prompt:"prompts/default",model:"glm-4.7",tools:{ask_user_questions:!0,todo_write:!0},middleware:{filesystem:!0,terminal:!0,agents_md:!0,skills:!0,memories:!0,subagents:!0}}),await t.addAgent({id:"agents/manager",name:"Manager",description:"任务管理员",system_prompt:"prompts/manager",model:"glm-4.7",tools:{ask_user_questions:!0,todo_write:!0},middleware:{filesystem:!0,terminal:!0,agents_md:!0,skills:!0,memories:!0,subagents:!0}}),t}var T;try{T=await w()}catch(e){throw console.error("Failed to load agent package:",e),Error(`Failed to initialize agent package: ${e instanceof Error?e.message:String(e)}`)}var ae=T;
298
- export{A as Da,ae as Ea};
175
+ `,schema:a});
176
+ export{a as te,n as ue};
@@ -0,0 +1 @@
1
+ import{ue as o}from"./chunk-bytq4kd1.js";import"./chunk-hrcxdj3c.js";import"./chunk-9tgp14v7.js";import"./chunk-hz9yw7cs.js";import"./chunk-tn356gwf.js";import"./chunk-n849zsd3.js";import"./chunk-b2551zfb.js";import"./chunk-vd8kwzra.js";import"./chunk-arv4h3h1.js";import"./chunk-z3e4c424.js";var a={name:"task",tools:[o]};export{a as taskMiddleware};
@@ -1,4 +1,4 @@
1
- import"./chunk-kba8akjs.js";import{sql as z}from"kysely";class I{db;pragmaPromise=null;constructor(x){this.db=x}ensurePragma(){if(!this.pragmaPromise)this.pragmaPromise=this.doEnsurePragma();return this.pragmaPromise}async doEnsurePragma(){await z`PRAGMA busy_timeout = 5000`.execute(this.db),await z`PRAGMA journal_mode = WAL`.execute(this.db),await z`PRAGMA synchronous = NORMAL`.execute(this.db),await z`PRAGMA wal_autocheckpoint = 1000`.execute(this.db)}dateToDb(x){return x.toISOString()}dbToDate(x){return new Date(x)}jsonToDb(x){return JSON.stringify(x)}dbToJson(x){if(typeof x==="string")try{return JSON.parse(x)}catch{return x}return x}buildJsonQuery(x,E,F,B){let G=`$.${JSON.stringify(F)}`;if(B===null)return z`
1
+ import{Gd as z}from"./chunk-cnzhxgn5.js";import"./chunk-z3e4c424.js";class I{db;pragmaPromise=null;constructor(x){this.db=x}ensurePragma(){if(!this.pragmaPromise)this.pragmaPromise=this.doEnsurePragma();return this.pragmaPromise}async doEnsurePragma(){await z`PRAGMA busy_timeout = 5000`.execute(this.db),await z`PRAGMA journal_mode = WAL`.execute(this.db),await z`PRAGMA synchronous = NORMAL`.execute(this.db),await z`PRAGMA wal_autocheckpoint = 1000`.execute(this.db)}dateToDb(x){return x.toISOString()}dbToDate(x){return new Date(x)}jsonToDb(x){return JSON.stringify(x)}dbToJson(x){if(typeof x==="string")try{return JSON.parse(x)}catch{return x}return x}buildJsonQuery(x,E,F,B){let G=`$.${JSON.stringify(F)}`;if(B===null)return z`
2
2
  json_type(${z.ref(E)}, ${z.lit(G)}) = 'null'
3
3
  `;let C;if(typeof B==="string")C=B;else if(typeof B==="number")C=B;else if(typeof B==="boolean")C=B?1:0;else C=JSON.stringify(B);return z`json_extract(${z.ref(E)}, ${z.lit(G)}) = ${z.lit(C)}`}now(){return new Date().toISOString()}async createTables(x){await this.ensurePragma(),await z`
4
4
  CREATE TABLE IF NOT EXISTS threads (