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,79 +0,0 @@
1
- import { I as P, J as d, K as _ } from "./graphBuilder-B0bC88R_.mjs";
2
- var v, m, g = 0, O = 0;
3
- function h(r, e, n) {
4
- var f = 0, t = e || new Array(16);
5
- r = r || {};
6
- var i = r.node, a = r.clockseq;
7
- if (r._v6 || (i || (i = v), a == null && (a = m)), i == null || a == null) {
8
- var u = r.random || (r.rng || P)();
9
- i == null && (i = [u[0], u[1], u[2], u[3], u[4], u[5]], !v && !r._v6 && (i[0] |= 1, v = i)), a == null && (a = (u[6] << 8 | u[7]) & 16383, m === void 0 && !r._v6 && (m = a));
10
- }
11
- var c = r.msecs !== void 0 ? r.msecs : Date.now(), o = r.nsecs !== void 0 ? r.nsecs : O + 1, j = c - g + (o - O) / 1e4;
12
- if (j < 0 && r.clockseq === void 0 && (a = a + 1 & 16383), (j < 0 || c > g) && r.nsecs === void 0 && (o = 0), o >= 1e4)
13
- throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");
14
- g = c, O = o, m = a, c += 122192928e5;
15
- var l = ((c & 268435455) * 1e4 + o) % 4294967296;
16
- t[f++] = l >>> 24 & 255, t[f++] = l >>> 16 & 255, t[f++] = l >>> 8 & 255, t[f++] = l & 255;
17
- var x = c / 4294967296 * 1e4 & 268435455;
18
- t[f++] = x >>> 8 & 255, t[f++] = x & 255, t[f++] = x >>> 24 & 15 | 16, t[f++] = x >>> 16 & 255, t[f++] = a >>> 8 | 128, t[f++] = a & 255;
19
- for (var b = 0; b < 6; ++b)
20
- t[f + b] = i[b];
21
- return e || d(t);
22
- }
23
- function s(r) {
24
- var e = typeof r == "string" ? _(r) : r, n = S(e);
25
- return typeof r == "string" ? d(n) : n;
26
- }
27
- function S(r, e = !1) {
28
- return Uint8Array.of((r[6] & 15) << 4 | r[7] >> 4 & 15, (r[7] & 15) << 4 | (r[4] & 240) >> 4, (r[4] & 15) << 4 | (r[5] & 240) >> 4, (r[5] & 15) << 4 | (r[0] & 240) >> 4, (r[0] & 15) << 4 | (r[1] & 240) >> 4, (r[1] & 15) << 4 | (r[2] & 240) >> 4, 96 | r[2] & 15, r[3], r[8], r[9], r[10], r[11], r[12], r[13], r[14], r[15]);
29
- }
30
- function p(r, e) {
31
- var n = Object.keys(r);
32
- if (Object.getOwnPropertySymbols) {
33
- var f = Object.getOwnPropertySymbols(r);
34
- e && (f = f.filter(function(t) {
35
- return Object.getOwnPropertyDescriptor(r, t).enumerable;
36
- })), n.push.apply(n, f);
37
- }
38
- return n;
39
- }
40
- function w(r) {
41
- for (var e = 1; e < arguments.length; e++) {
42
- var n = arguments[e] != null ? arguments[e] : {};
43
- e % 2 ? p(Object(n), !0).forEach(function(f) {
44
- k(r, f, n[f]);
45
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(n)) : p(Object(n)).forEach(function(f) {
46
- Object.defineProperty(r, f, Object.getOwnPropertyDescriptor(n, f));
47
- });
48
- }
49
- return r;
50
- }
51
- function k(r, e, n) {
52
- return (e = D(e)) in r ? Object.defineProperty(r, e, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : r[e] = n, r;
53
- }
54
- function D(r) {
55
- var e = q(r, "string");
56
- return typeof e == "symbol" ? e : e + "";
57
- }
58
- function q(r, e) {
59
- if (typeof r != "object" || !r) return r;
60
- var n = r[Symbol.toPrimitive];
61
- if (n !== void 0) {
62
- var f = n.call(r, e);
63
- if (typeof f != "object") return f;
64
- throw new TypeError("@@toPrimitive must return a primitive value.");
65
- }
66
- return (e === "string" ? String : Number)(r);
67
- }
68
- function E(r = {}, e, n = 0) {
69
- var f = h(w(w({}, r), {}, {
70
- _v6: !0
71
- }), new Uint8Array(16));
72
- return f = s(f), d(f);
73
- }
74
- function A(r) {
75
- return E({ clockseq: r });
76
- }
77
- export {
78
- A as u
79
- };
@@ -1,117 +0,0 @@
1
- import "bun:sqlite";
2
- import { B as f, c as k } from "./chunk-YWE62C55-DID9N9eS.mjs";
3
- import { aY as m } from "./sql-CJsUpKEQ.mjs";
4
- import { EventEmitter as p } from "node:events";
5
- var l = "0", h = "1", w = "2", c = "3", u = "4", y = (e, t) => e.onmessage = ({ data: r }) => t(r), E = class extends k {
6
- worker;
7
- mitt;
8
- constructor(e, t) {
9
- super(async () => {
10
- const r = await e();
11
- this.mitt = r.mitt, this.worker = r.worker, r.handle(
12
- this.worker,
13
- ([s, ...i]) => this.mitt.emit(s, ...i)
14
- ), this.worker.postMessage([
15
- l,
16
- r.data || {}
17
- ]), await new Promise((s, i) => {
18
- this.mitt.once(l, (a, o) => o ? i(o) : s());
19
- }), this.conn = new W(this.worker, this.mitt), await t?.(this.conn);
20
- });
21
- }
22
- async destroy() {
23
- if (this.worker)
24
- return this.worker.postMessage([w]), new Promise(
25
- (e, t) => this.mitt?.once(
26
- w,
27
- (r, s) => s ? t(s) : e()
28
- )
29
- ).finally(() => {
30
- this.worker?.terminate(), this.mitt?.off(), this.mitt = this.worker = void 0;
31
- });
32
- }
33
- }, W = class {
34
- constructor(e, t) {
35
- this.worker = e, this.mitt = t;
36
- }
37
- async *streamQuery({ parameters: e, sql: t, query: r }) {
38
- this.worker.postMessage([
39
- c,
40
- m.is(r),
41
- t,
42
- e
43
- ]);
44
- let s = !1, i, a;
45
- for (this.mitt.on(c, (o, n) => {
46
- n ? a(n) : i([{ rows: [o] }, !1]);
47
- }), this.mitt.on(u, (o, n) => {
48
- n ? a(n) : i([void 0, !0]);
49
- }); !s; ) {
50
- const [o, n] = await new Promise((v, d) => {
51
- i = v, a = d;
52
- });
53
- n ? (s = !0, this.mitt?.off(c), this.mitt?.off(u)) : yield o;
54
- }
55
- }
56
- async executeQuery(e) {
57
- const { parameters: t, sql: r, query: s } = e;
58
- return this.worker.postMessage([
59
- h,
60
- m.is(s),
61
- r,
62
- t
63
- ]), await new Promise((i, a) => {
64
- this.mitt || a(new Error("kysely instance has been destroyed")), this.mitt.once(h, (o, n) => !n && o ? i(o) : a(n));
65
- });
66
- }
67
- }, q = class extends f {
68
- /**
69
- * Dialect for generic SQLite that run SQLs in worker thread
70
- *
71
- * @param executor function to create {@link IGenericSqliteWorkerExecutor}
72
- * @param onCreateConnection optional callback after connection created
73
- */
74
- constructor(e, t) {
75
- super(() => new E(e, t));
76
- }
77
- }, x = class extends p {
78
- off(e) {
79
- return this.removeAllListeners(e);
80
- }
81
- };
82
- function S() {
83
- return new x();
84
- }
85
- var B = class extends q {
86
- /**
87
- * dialect for `bun:sqlite`, run sql in worker
88
- */
89
- constructor(e) {
90
- const {
91
- url: t = ":memory:",
92
- cacheStatment: r = !1,
93
- onCreateConnection: s,
94
- worker: i = new Worker(
95
- new URL(
96
- /* @vite-ignore */
97
- "/assets/worker-I4QjJYba.js",
98
- import.meta.url
99
- ),
100
- { type: "module" }
101
- ),
102
- dbOptions: a = { create: !0 }
103
- } = e || {};
104
- super(
105
- () => ({
106
- data: { cache: r, fileName: t, opt: a },
107
- mitt: S(),
108
- handle: y,
109
- worker: i
110
- }),
111
- s
112
- );
113
- }
114
- };
115
- export {
116
- B as BunWorkerDialect
117
- };
@@ -1,212 +0,0 @@
1
- import { l as n } from "./graphBuilder-B0bC88R_.mjs";
2
- import { B as b, t as j, x as v, s as R, z as T, y as L, D as x, E as A, q as $, v as C, r as _, M as I, P as E, w as z, p as U, u as F, o as W, H as K, G as Y } from "./graphBuilder-B0bC88R_.mjs";
3
- import r from "node:fs/promises";
4
- import { join as m } from "node:path";
5
- import { l as d } from "./load-Cjl9cJ0o.mjs";
6
- const k = `
7
-
8
- ## Project Documentation
9
-
10
- {docs_content}`;
11
- class g {
12
- name = "AgentsMdMiddleware";
13
- stateSchema = void 0;
14
- contextSchema = void 0;
15
- tools = [];
16
- projectRoot;
17
- systemPromptTemplate;
18
- /**
19
- * Initialize the documentation middleware.
20
- *
21
- * @param projectRoot - Path to the project root directory (defaults to process.cwd())
22
- */
23
- constructor(s = {}) {
24
- this.projectRoot = s.projectRoot || process.cwd(), this.systemPromptTemplate = k;
25
- }
26
- /**
27
- * Find and read the project documentation file.
28
- * Priority: CLAUDE.md > AGENTS.md
29
- *
30
- * @returns The content of the first found documentation file, or null if none exist
31
- */
32
- async findDocumentationFile() {
33
- const s = ["CLAUDE.md", "AGENTS.md"];
34
- for (const i of s) {
35
- const l = m(this.projectRoot, i);
36
- try {
37
- return await r.access(l), { content: await r.readFile(l, "utf-8"), filename: i };
38
- } catch {
39
- continue;
40
- }
41
- }
42
- return null;
43
- }
44
- /**
45
- * Inject project documentation into the system prompt.
46
- *
47
- * This runs on every model call to ensure documentation info is always available.
48
- *
49
- * @param request - The model request being processed
50
- * @param handler - The handler function to call with the modified request
51
- * @returns The model response from the handler
52
- */
53
- async wrapModelCall(s, i) {
54
- const l = await this.findDocumentationFile();
55
- if (!l)
56
- return await i(s);
57
- const t = this.systemPromptTemplate.replace("{docs_content}", l.content);
58
- let e;
59
- s.systemPrompt ? e = s.systemPrompt + `
60
-
61
- ` + t : e = t;
62
- const a = new n(e), o = {
63
- ...s,
64
- systemMessage: a
65
- };
66
- return await i(o);
67
- }
68
- }
69
- const u = `
70
-
71
- ## Skills System
72
-
73
- You have access to a skills library that provides specialized capabilities and domain knowledge.
74
-
75
- {skills_locations}
76
-
77
- **Available Skills:**
78
-
79
- {skills_list}
80
-
81
- **How to Use Skills (Progressive Disclosure):**
82
-
83
- Skills follow a **progressive disclosure** pattern - you know they exist (name + description above), but you only read the full instructions when needed:
84
-
85
- 1. **Recognize when a skill applies**: Check if the user's task matches any skill's description
86
- 2. **Read the skill's full instructions**: The skill list above shows the exact path to use with read_file
87
- 3. **Follow the skill's instructions**: SKILL.md contains step-by-step workflows, best practices, and examples
88
- 4. **Access supporting files**: Skills may include Python scripts, configs, or reference docs - use absolute paths
89
-
90
- **When to Use Skills:**
91
- - When the user's request matches a skill's domain (e.g., "research X" → web-research skill)
92
- - When you need specialized knowledge or structured workflows
93
- - When a skill provides proven patterns for complex tasks
94
-
95
- **Skills are Self-Documenting:**
96
- - Each SKILL.md tells you exactly what the skill does and how to use it
97
- - The skill list above shows the full path for each skill's SKILL.md file
98
-
99
- **Executing Skill Scripts:**
100
- Skills may contain Python scripts or other executable files. Always use absolute paths from the skill list.
101
-
102
- **Example Workflow:**
103
-
104
- User: "Can you research the latest developments in quantum computing?"
105
-
106
- 1. Check available skills above → See "web-research" skill with its full path
107
- 2. Read the skill using the path shown in the list
108
- 3. Follow the skill's research workflow (search → organize → synthesize)
109
- 4. Use any helper scripts with absolute paths
110
-
111
- Remember: Skills are tools to make you more capable and consistent. When in doubt, check if a skill exists for the task!
112
- `;
113
- class P {
114
- name = "SkillsMiddleware";
115
- // No context schema needed
116
- stateSchema = void 0;
117
- // No context schema needed
118
- contextSchema = void 0;
119
- // No additional tools
120
- tools = [];
121
- skillsDir;
122
- assistantId;
123
- projectSkillsDir;
124
- userSkillsDisplay;
125
- systemPromptTemplate;
126
- /**
127
- * Initialize the skills middleware.
128
- *
129
- * @param skillsDir - Path to the user-level skills directory (per-agent)
130
- * @param assistantId - The agent identifier for path references in prompts
131
- * @param projectSkillsDir - Optional path to project-level skills directory
132
- */
133
- constructor(s = {}) {
134
- this.skillsDir = s.skillsDir, this.assistantId = s.assistantId, this.projectSkillsDir = s.projectSkillsDir || "./.claude/skills", this.skillsDir && !this.assistantId && console.warn("user skills directory is provided, but assistant id is not provided"), this.assistantId && (this.userSkillsDisplay = `~/.claude/${this.assistantId}/skills`), this.systemPromptTemplate = u;
135
- }
136
- /**
137
- * Format skills locations for display in system prompt.
138
- */
139
- formatSkillsLocations() {
140
- const s = [];
141
- return this.userSkillsDisplay && s.push(`**User Skills**: \`${this.userSkillsDisplay}\``), this.projectSkillsDir && s.push(`**Project Skills**: \`${this.projectSkillsDir}\` (overrides user skills)`), s.join(`
142
- `);
143
- }
144
- /**
145
- * Format skills metadata for display in system prompt.
146
- */
147
- formatSkillsList(s) {
148
- if (!s.length) {
149
- const e = [`${this.userSkillsDisplay}/`];
150
- return this.projectSkillsDir && e.push(`${this.projectSkillsDir}/`), `(No skills available yet. You can create skills in ${e.join(" or ")})`;
151
- }
152
- const i = s.filter((e) => e.source === "user"), l = s.filter((e) => e.source === "project"), t = [];
153
- if (i.length) {
154
- t.push("**User Skills:**");
155
- for (const e of i)
156
- t.push(`- **${e.name}**: ${e.description}`), t.push(` → Read \`${e.path}\` for full instructions`);
157
- t.push("");
158
- }
159
- if (l.length) {
160
- t.push("**Project Skills:**");
161
- for (const e of l)
162
- t.push(`- **${e.name}**: ${e.description}`), t.push(` → Read \`${e.path}\` for full instructions`);
163
- }
164
- return t.join(`
165
- `);
166
- }
167
- /**
168
- * Inject skills documentation into the system prompt.
169
- *
170
- * This runs on every model call to ensure skills info is always available.
171
- *
172
- * @param request - The model request being processed
173
- * @param handler - The handler function to call with the modified request
174
- * @returns The model response from the handler
175
- */
176
- async wrapModelCall(s, i) {
177
- const l = d(this.skillsDir, this.projectSkillsDir), t = this.formatSkillsLocations(), e = this.formatSkillsList(l), a = this.systemPromptTemplate.replace("{skills_locations}", t).replace("{skills_list}", e);
178
- let o;
179
- s.systemPrompt ? o = s.systemPrompt + `
180
-
181
- ` + a : o = a;
182
- const h = new n(o), p = {
183
- ...s,
184
- systemMessage: h
185
- };
186
- return await i(p);
187
- }
188
- }
189
- export {
190
- b as AgentPackage,
191
- j as AgentPackageSchema,
192
- v as AgentRepository,
193
- R as AgentSchema,
194
- T as AgentSerializer,
195
- L as AgentValidator,
196
- g as AgentsMdMiddleware,
197
- x as BaseStorage,
198
- A as MemoryStorage,
199
- $ as MiddlewareCustomParamsSchema,
200
- C as MiddlewareRegistry,
201
- _ as MiddlewareSchema,
202
- I as ModelSchema,
203
- E as PromptSchema,
204
- P as SkillsMiddleware,
205
- z as StandardAgent,
206
- U as ToolCustomParamsSchema,
207
- F as ToolRegistry,
208
- W as ToolSchema,
209
- K as anthropicPromptCachingMiddleware,
210
- Y as fromLangChainTool,
211
- d as listSkills
212
- };
@@ -1,75 +0,0 @@
1
- import { B as i, c as o, d as c } from "./chunk-YWE62C55-DID9N9eS.mjs";
2
- import { aY as a } from "./sql-CJsUpKEQ.mjs";
3
- var u = class extends o {
4
- db;
5
- constructor(t, e) {
6
- super(async () => {
7
- this.db = await t(), this.conn = new l(this.db), await e?.(this.conn);
8
- });
9
- }
10
- async destroy() {
11
- await this.db?.close();
12
- }
13
- }, l = class {
14
- constructor(t) {
15
- this.db = t;
16
- }
17
- async *streamQuery({ parameters: t, query: e, sql: r }) {
18
- if (!this.db.iterator)
19
- throw new Error("streamQuery() is not supported.");
20
- const s = this.db.iterator(a.is(e), r, t);
21
- for await (const n of s)
22
- yield { rows: [n] };
23
- }
24
- async executeQuery({ parameters: t, query: e, sql: r }) {
25
- return await this.db.query(a.is(e), r, t);
26
- }
27
- }, d = class extends i {
28
- /**
29
- * Dialect for generic SQLite that run SQLs in current thread
30
- *
31
- * @param executor function to create {@link IGenericSqlite}
32
- * @param onCreateConnection optional callback after connection created
33
- */
34
- constructor(t, e) {
35
- super(() => new u(t, e));
36
- }
37
- };
38
- async function y(t) {
39
- return typeof t == "function" ? await t() : t;
40
- }
41
- var h = class extends d {
42
- /**
43
- * dialect for [node sqlite3 wasm](https://github.com/tndrle/node-sqlite3-wasm)
44
- */
45
- constructor(t) {
46
- super(
47
- async () => {
48
- const e = await y(t.database);
49
- return {
50
- db: e,
51
- close: () => e.close(),
52
- query: c({
53
- all: (r, s) => e.all(r, s),
54
- run: (r) => {
55
- const { changes: s, lastInsertRowid: n } = e.run(r);
56
- return {
57
- insertId: BigInt(n),
58
- numAffectedRows: BigInt(s)
59
- };
60
- }
61
- }),
62
- iterator: (r, s, n) => {
63
- if (!r)
64
- throw new Error("Only support select query");
65
- return e.prepare(s).iterate(n);
66
- }
67
- };
68
- },
69
- t.onCreateConnection
70
- );
71
- }
72
- };
73
- export {
74
- h as NodeWasmDialect
75
- };