zen-code 4.5.0 → 4.6.1

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 (37) hide show
  1. package/dist/MultiLineTextInput-B4NEXnFm.mjs +23343 -0
  2. package/dist/cli.mjs +44 -20
  3. package/dist/devtools-BHqoL8a6.mjs +11653 -0
  4. package/dist/graphBuilder-B3IJ7dB2.mjs +2641 -0
  5. package/dist/{index-BHwkVemt.mjs → index-DEcMgCTj.mjs} +1 -1
  6. package/dist/{memories-B8HqG014.mjs → memories-rSGKIPk5.mjs} +1 -1
  7. package/dist/metadata-XVTVXthy.mjs +6 -0
  8. package/dist/nonInteractive.mjs +7 -6
  9. package/dist/{subTasks-BTMXARkP.mjs → subTasks-5KLIr9iy.mjs} +47 -48
  10. package/dist/zen-code.mjs +8654 -2
  11. package/dist/zen-keyboard.mjs +7 -6
  12. package/package.json +7 -9
  13. package/dist/MultiLineTextInput-e7hD79Wp.mjs +0 -24631
  14. package/dist/app-DtYW5k3J.mjs +0 -16061
  15. package/dist/assets/worker-I4QjJYba.js +0 -1
  16. package/dist/checkpoint-1sAx_j1E-4BdN8r-w.mjs +0 -319
  17. package/dist/checkpoint-DxiUsHMy-BV-8KBKD.mjs +0 -394
  18. package/dist/chunk-YWE62C55-DID9N9eS.mjs +0 -193
  19. package/dist/devtools-CzaVuYnh.mjs +0 -2667
  20. package/dist/graphBuilder-B0bC88R_.mjs +0 -48756
  21. package/dist/id-Cu7CRpDw.mjs +0 -79
  22. package/dist/index-BUGHAUbY.mjs +0 -117
  23. package/dist/index-Bgm_TqjU.mjs +0 -212
  24. package/dist/index-C5j-48Ft.mjs +0 -75
  25. package/dist/index-CSvPIzA-.mjs +0 -464
  26. package/dist/index-DS5HVciX.mjs +0 -216
  27. package/dist/kysely-Bchvsze0.mjs +0 -4316
  28. package/dist/load-Cjl9cJ0o.mjs +0 -105
  29. package/dist/migrator-BatO36Tk.mjs +0 -592
  30. package/dist/pg-adapter-BFtir1GE-BU2H39HC.mjs +0 -62
  31. package/dist/postgres-dialect-DaHvQ_AZ.mjs +0 -211
  32. package/dist/queue-Bfg-8ehP-Lko1egu-.mjs +0 -106
  33. package/dist/remote-threads-CrG03ZS7-C9duTCnB.mjs +0 -157
  34. package/dist/shallow-DAx5vVov.mjs +0 -332
  35. package/dist/sql-CJsUpKEQ.mjs +0 -8106
  36. package/dist/sqlite-adapter-Bbonr5S5-DQLjfvyu.mjs +0 -68
  37. package/dist/zen-init.mjs +0 -1
@@ -1,4 +1,4 @@
1
- import { A as s, C as m, F as o, e as c, S as i, a as p, d as h, b as k, h as n, f as g, g as T, T as f, c as l } from "./graphBuilder-B0bC88R_.mjs";
1
+ import { A as s, C as m, F as o, e as c, S as i, a as p, d as h, b as k, h as n, f as g, g as T, T as f, c as l } from "./graphBuilder-B3IJ7dB2.mjs";
2
2
  import { FileSystemSkillStore as y } from "./FileSystemSkillStore-yvEvcRxB.mjs";
3
3
  import { FileSystemPluginStore as F } from "./FileSystemPluginStore-ChortK7z.mjs";
4
4
  import "lowdb";
@@ -1,5 +1,5 @@
1
1
  import { l } from "./load-Bh8eo6qE.mjs";
2
- import { l as h } from "./graphBuilder-B0bC88R_.mjs";
2
+ import { SystemMessage as h } from "@langchain/core/messages";
3
3
  const M = `## Memory System
4
4
 
5
5
  你可以访问一个包含之前任务和经验知识的记忆库。
@@ -0,0 +1,6 @@
1
+ const a = {
2
+ path: process.cwd()
3
+ };
4
+ export {
5
+ a as m
6
+ };
@@ -1,11 +1,12 @@
1
1
  import { HumanMessage as c } from "langchain";
2
- import { i as d, j as m, k as l } from "./graphBuilder-B0bC88R_.mjs";
3
- import "@langchain/langgraph";
4
- import "zod";
5
- import "@langchain/openai";
2
+ import { i as d, j as m, k as l } from "./graphBuilder-B3IJ7dB2.mjs";
3
+ import "@langgraph-js/pro";
6
4
  import "@langchain/anthropic";
7
5
  import "@langchain/google-genai";
8
6
  import "yaml";
7
+ import "@langchain/core/messages";
8
+ import "@langgraph-js/standard-agent";
9
+ import "@langgraph-js/auk";
9
10
  async function p() {
10
11
  return new Promise((t, n) => {
11
12
  let r = "";
@@ -18,7 +19,7 @@ async function p() {
18
19
  });
19
20
  });
20
21
  }
21
- async function y(t, n = !1) {
22
+ async function b(t, n = !1) {
22
23
  await d();
23
24
  const r = await m();
24
25
  let e = t || "";
@@ -47,5 +48,5 @@ async function y(t, n = !1) {
47
48
  }
48
49
  }
49
50
  export {
50
- y as runNonInteractive
51
+ b as runNonInteractive
51
52
  };
@@ -1,34 +1,37 @@
1
- import { tool as p, HumanMessage as d, SystemMessage as m } from "langchain";
2
- import { Command as f, Annotation as b } from "@langchain/langgraph";
3
- import { z as i } from "zod";
4
- import { m as w, n as y } from "./graphBuilder-B0bC88R_.mjs";
5
- import "@langchain/openai";
6
- const k = i.object({
7
- task_store: i.record(i.string(), i.any()).default({})
1
+ import { tool as g, HumanMessage as h, SystemMessage as p } from "langchain";
2
+ import { Command as m, Annotation as f } from "@langchain/langgraph";
3
+ import { z as n } from "zod";
4
+ import { createState as b } from "@langgraph-js/pro";
5
+ import { l as y, m as w } from "./graphBuilder-B3IJ7dB2.mjs";
6
+ n.object({
7
+ task_store: n.record(n.string(), n.any()).default({})
8
8
  });
9
- w().build({
10
- task_store: b({
9
+ b().build({
10
+ task_store: f({
11
11
  reducer: (r, t) => ({ ...r, ...t }),
12
12
  default: () => ({})
13
13
  })
14
14
  });
15
- const _ = i.object({
16
- task_id: i.string().optional().describe("The task id to ask the subagent, if not provided, will use the tool call id"),
17
- subagent_type: i.string().describe(
18
- "The type of subagent to use. Must be one of the available agent types listed in the tool description."
15
+ const k = n.object({
16
+ task_id: n.string().optional().describe("The task id to ask the subagent, if not provided, will use the tool call id"),
17
+ subagent_id: n.string().describe(
18
+ 'REQUIRED. The specific ID of the subagent to invoke (e.g., "agents/default", "agents/manager"). Must match exactly one of the available subagents listed in the system prompt.'
19
19
  ),
20
- task_description: i.string().describe("Describe the user state and what you want the subagent to do."),
21
- data_transfer: i.any().optional().describe("Data to transfer to the subagent.")
22
- }), v = (r, t) => p(
20
+ subagent_type: n.string().describe(
21
+ 'REQUIRED. The type/category of subagent (e.g., "general-purpose", "statusline-setup"). Must be one of the available agent types listed in the tool description.'
22
+ ),
23
+ task_description: n.string().describe("Describe the user state and what you want the subagent to do."),
24
+ data_transfer: n.any().optional().describe("Data to transfer to the subagent.")
25
+ }), _ = (r, t) => g(
23
26
  async (e, s) => {
24
27
  const a = s.state, o = e.task_id || s.toolCall.id;
25
- let n = {
28
+ let i = {
26
29
  messages: []
27
30
  };
28
- o && a?.task_store?.[o] ? n = a?.task_store[o] : (n = JSON.parse(JSON.stringify(a)), n.messages = [], n.task_store = {});
29
- const u = await r(o, e, a);
30
- n.messages.push(new d({ content: e.task_description })), e.data_transfer && n.messages.push(
31
- new d({
31
+ o && a?.task_store?.[o] ? i = a?.task_store[o] : (i = JSON.parse(JSON.stringify(a)), i.messages = [], i.task_store = {});
32
+ const l = await r(o, e, a);
33
+ i.messages.push(new h({ content: e.task_description })), e.data_transfer && i.messages.push(
34
+ new h({
32
35
  content: `Here is the data to help you complete the task: ${JSON.stringify(
33
36
  e.data_transfer,
34
37
  null,
@@ -36,25 +39,23 @@ const _ = i.object({
36
39
  )}`
37
40
  })
38
41
  );
39
- const l = await u.invoke(n), g = l.messages.at(-1), c = {
42
+ const u = await l.invoke(i), c = u.messages.at(-1), d = {
40
43
  task_store: {
41
44
  ...a?.task_store || {},
42
- [o]: l
45
+ [o]: u
43
46
  },
44
47
  messages: [
45
48
  {
46
49
  role: "tool",
47
50
  content: `task_id: ${o}
48
51
  ---
49
- ` + (g?.text || ""),
52
+ ` + (c?.text || ""),
50
53
  tool_call_id: s.toolCall.id
51
54
  }
52
55
  ]
53
56
  };
54
- return t?.pass_through_keys?.forEach((h) => {
55
- h in l && (c[h] = l[h]);
56
- }), new f({
57
- update: c
57
+ return new m({
58
+ update: d
58
59
  });
59
60
  },
60
61
  {
@@ -66,9 +67,10 @@ Available agent types and the tools they have access to:
66
67
  - statusline-setup: Use this agent to configure the user's Claude Code status line setting. (Tools: Read, Edit)
67
68
  - output-style-setup: Use this agent to create a Claude Code output style. (Tools: Read, Write, Edit, Glob, LS, Grep)
68
69
 
69
- When using the Task tool, you must specify a subagent_type parameter to select which agent type to use.
70
-
70
+ **IMPORTANT: Both subagent_id AND subagent_type are REQUIRED parameters. You must provide BOTH.**
71
71
 
72
+ - subagent_id: The specific ID of the subagent (e.g., "agents/default", "agents/manager")
73
+ - subagent_type: The type category of the subagent (e.g., "general-purpose", "statusline-setup")
72
74
 
73
75
  When NOT to use the Agent tool:
74
76
  - If you want to read a specific file path, use the Read or Glob tool instead of the Agent tool, to find the match more quickly
@@ -121,9 +123,9 @@ Since the user is greeting, use the greeting-responder agent to respond with a f
121
123
  assistant: "I'm going to use the Task tool to launch the with the greeting-responder agent"
122
124
  </example>
123
125
  `,
124
- schema: _
126
+ schema: k
125
127
  }
126
- ), S = `
128
+ ), v = `
127
129
 
128
130
  ## SubAgents System
129
131
 
@@ -138,7 +140,7 @@ You have access to a subagent system that can delegate specialized tasks to othe
138
140
  SubAgents follow a **progressive disclosure** pattern - you know they exist (name + description above), but you only delegate tasks when needed:
139
141
 
140
142
  1. **Recognize when to delegate**: Check if the user's task matches a subagent's specialization
141
- 2. **Use the ask_subagents tool**: Call the tool with the subagent's ID and a clear task description
143
+ 2. **Use the task tool**: Call the tool with the subagent's ID and a clear task description
142
144
  3. **Provide context**: Use the \`data_transfer\` parameter to pass relevant information
143
145
  4. **Get results**: The subagent will process the task and return results
144
146
 
@@ -150,7 +152,7 @@ SubAgents follow a **progressive disclosure** pattern - you know they exist (nam
150
152
 
151
153
  **SubAgent Tool Usage:**
152
154
 
153
- The \`ask_subagents\` tool is available for delegation:
155
+ The \`task\` tool is available for delegation:
154
156
 
155
157
  - **subagent_id**: The ID of the subagent to delegate to
156
158
  - **task_description**: Clear description of what needs to be done
@@ -162,24 +164,21 @@ The \`ask_subagents\` tool is available for delegation:
162
164
  User: "Can you have the research agent look into quantum computing developments?"
163
165
 
164
166
  1. Check available subagents above → See "research" subagent with ID
165
- 2. Use ask_subagents tool with appropriate parameters
167
+ 2. Use task tool with appropriate parameters
166
168
  3. Provide clear task description and any necessary context
167
169
  4. Process the results from the subagent
168
170
 
169
171
  Remember: SubAgents are tools to distribute work and leverage specialized capabilities. When in doubt, check if a subagent exists for the task!
170
172
  `;
171
- class W {
173
+ class U {
172
174
  name = "SubAgentsMiddleware";
173
- stateSchema = k;
174
- contextSchema = void 0;
175
+ stateSchema = y;
176
+ // contextSchema = undefined;
175
177
  tools = [];
176
178
  agentList = Promise.resolve("");
177
179
  constructor(t) {
178
180
  this.agentList = this.formatSubAgentsList(t), this.tools.push(
179
- v(
180
- async (e, s, a) => await y("agents/default", t, a, {}, { subagent_id: e }),
181
- {}
182
- )
181
+ _(async (e, s, a) => await w(s.subagent_id, t, a, {}, { parent_id: e }))
183
182
  );
184
183
  }
185
184
  /**
@@ -188,23 +187,23 @@ class W {
188
187
  async formatSubAgentsList(t) {
189
188
  const e = [];
190
189
  for (const s of await t.listAgents())
191
- e.push(`- **${s.id}**: ${s.description}`), e.push(` → Use ask_subagents with subagent_id: "${s.id}"`);
190
+ e.push(`- **${s.id}**: ${s.description}`), e.push(` → Use task with subagent_id: "${s.id}"`);
192
191
  return e.join(`
193
192
  `);
194
193
  }
195
194
  async wrapModelCall(t, e) {
196
- const s = await this.agentList, a = S.replace("{subagents_list}", s);
195
+ const s = await this.agentList, a = v.replace("{subagents_list}", s);
197
196
  let o;
198
197
  t.systemPrompt ? o = t.systemPrompt + `
199
198
 
200
199
  ` + a : o = a;
201
- const n = new m(o), u = {
200
+ const i = new p(o), l = {
202
201
  ...t,
203
- systemMessage: n
202
+ systemMessage: i
204
203
  };
205
- return await e(u);
204
+ return await e(l);
206
205
  }
207
206
  }
208
207
  export {
209
- W as SubAgentsMiddleware
208
+ U as SubAgentsMiddleware
210
209
  };