zilmate 1.6.2 → 1.7.2

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 (92) hide show
  1. package/SDK.md +320 -0
  2. package/agent-docs.md +12 -0
  3. package/dist/agents/automation-planner.agent.d.ts +4 -4
  4. package/dist/agents/automation-planner.agent.d.ts.map +1 -1
  5. package/dist/agents/coding.agent.d.ts +102 -0
  6. package/dist/agents/coding.agent.d.ts.map +1 -1
  7. package/dist/agents/coding.agent.js +89 -5
  8. package/dist/agents/coding.agent.js.map +1 -1
  9. package/dist/agents/image.agent.d.ts +13 -0
  10. package/dist/agents/image.agent.d.ts.map +1 -1
  11. package/dist/agents/image.agent.js +39 -3
  12. package/dist/agents/image.agent.js.map +1 -1
  13. package/dist/agents/manager.d.ts +157 -5
  14. package/dist/agents/manager.d.ts.map +1 -1
  15. package/dist/agents/manager.js +16 -4
  16. package/dist/agents/manager.js.map +1 -1
  17. package/dist/agents/security.agent.d.ts +2 -2
  18. package/dist/cli/composer.d.ts +3 -0
  19. package/dist/cli/composer.d.ts.map +1 -0
  20. package/dist/cli/composer.js +11 -0
  21. package/dist/cli/composer.js.map +1 -0
  22. package/dist/cli/format.d.ts.map +1 -1
  23. package/dist/cli/format.js +29 -3
  24. package/dist/cli/format.js.map +1 -1
  25. package/dist/cli/interactive.d.ts.map +1 -1
  26. package/dist/cli/interactive.js +65 -14
  27. package/dist/cli/interactive.js.map +1 -1
  28. package/dist/cli/models.d.ts +17 -0
  29. package/dist/cli/models.d.ts.map +1 -0
  30. package/dist/cli/models.js +116 -0
  31. package/dist/cli/models.js.map +1 -0
  32. package/dist/cli/render.d.ts +13 -0
  33. package/dist/cli/render.d.ts.map +1 -0
  34. package/dist/cli/render.js +59 -0
  35. package/dist/cli/render.js.map +1 -0
  36. package/dist/cli/setup.d.ts.map +1 -1
  37. package/dist/cli/setup.js +23 -1
  38. package/dist/cli/setup.js.map +1 -1
  39. package/dist/cli/theme.d.ts +23 -0
  40. package/dist/cli/theme.d.ts.map +1 -0
  41. package/dist/cli/theme.js +34 -0
  42. package/dist/cli/theme.js.map +1 -0
  43. package/dist/cli/triggers.d.ts.map +1 -1
  44. package/dist/cli/triggers.js +26 -16
  45. package/dist/cli/triggers.js.map +1 -1
  46. package/dist/config/model-store.d.ts +14 -0
  47. package/dist/config/model-store.d.ts.map +1 -0
  48. package/dist/config/model-store.js +60 -0
  49. package/dist/config/model-store.js.map +1 -0
  50. package/dist/config/models.d.ts.map +1 -1
  51. package/dist/config/models.js +14 -11
  52. package/dist/config/models.js.map +1 -1
  53. package/dist/index.js +9 -13
  54. package/dist/index.js.map +1 -1
  55. package/dist/jobs/trigger-router.d.ts.map +1 -1
  56. package/dist/jobs/trigger-router.js +8 -3
  57. package/dist/jobs/trigger-router.js.map +1 -1
  58. package/dist/server.d.ts +49 -1
  59. package/dist/server.d.ts.map +1 -1
  60. package/dist/server.js +13 -1
  61. package/dist/server.js.map +1 -1
  62. package/dist/tools/code-intelligence.tool.d.ts +68 -0
  63. package/dist/tools/code-intelligence.tool.d.ts.map +1 -0
  64. package/dist/tools/code-intelligence.tool.js +176 -0
  65. package/dist/tools/code-intelligence.tool.js.map +1 -0
  66. package/dist/tools/computer-use.tool.d.ts +2 -2
  67. package/dist/tools/computer-use.tool.js +66 -66
  68. package/dist/tools/image-generate.tool.d.ts +10 -0
  69. package/dist/tools/image-generate.tool.d.ts.map +1 -1
  70. package/dist/tools/image-generate.tool.js +115 -22
  71. package/dist/tools/image-generate.tool.js.map +1 -1
  72. package/dist/tools/notebook.tool.js +5 -5
  73. package/dist/tools/notebook.tool.js.map +1 -1
  74. package/dist/tools/osint-install.tool.js +8 -8
  75. package/dist/tools/osint.tool.d.ts +4 -4
  76. package/dist/tools/session-continuity.tool.d.ts +25 -0
  77. package/dist/tools/session-continuity.tool.d.ts.map +1 -0
  78. package/dist/tools/session-continuity.tool.js +90 -0
  79. package/dist/tools/session-continuity.tool.js.map +1 -0
  80. package/dist/tools/situational-awareness.tool.d.ts +71 -0
  81. package/dist/tools/situational-awareness.tool.d.ts.map +1 -0
  82. package/dist/tools/situational-awareness.tool.js +90 -0
  83. package/dist/tools/situational-awareness.tool.js.map +1 -0
  84. package/dist/tools/triggers.tool.d.ts +4 -4
  85. package/dist/tools/triggers.tool.d.ts.map +1 -1
  86. package/dist/tools/weather.tool.d.ts +88 -0
  87. package/dist/tools/weather.tool.d.ts.map +1 -0
  88. package/dist/tools/weather.tool.js +228 -0
  89. package/dist/tools/weather.tool.js.map +1 -0
  90. package/package.json +8 -3
  91. package/scripts/release-github.mjs +12 -11
  92. package/src/doc/worker-support-playbook.md +159 -159
package/SDK.md ADDED
@@ -0,0 +1,320 @@
1
+ # ZilMate SDK
2
+
3
+ Use ZilMate as a programmable agent layer in Next.js, server routes, background workers, and automation scripts. The SDK wraps the same manager, subagents, memory, jobs, and voice stack as the CLI.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install zilmate
9
+ ```
10
+
11
+ Set environment variables (see `.env.example`):
12
+
13
+ ```env
14
+ AI_GATEWAY_API_KEY=...
15
+ ZILMATE_USER_ID=zilmate-your-id
16
+ ```
17
+
18
+ Optional: `COMPOSIO_API_KEY`, `TAVILY_API_KEY`, Upstash Redis/QStash, `DEEPGRAM_API_KEY`.
19
+
20
+ ## Quick start (Node / Next.js server)
21
+
22
+ ```ts
23
+ import { createZilMate } from 'zilmate/server';
24
+
25
+ const zilmate = createZilMate({
26
+ sessionId: 'dashboard-user-123',
27
+ onProgress: (event) => console.log(event.type, event.label),
28
+ });
29
+
30
+ const { text } = await zilmate.manager({ message: 'Summarize my open jobs and suggest next steps.' });
31
+ console.log(text);
32
+ ```
33
+
34
+ ## Next.js App Router — streaming chat route
35
+
36
+ Create `app/api/zilmate/route.ts`:
37
+
38
+ ```ts
39
+ import { createZilMate } from 'zilmate/server';
40
+
41
+ export const runtime = 'nodejs';
42
+ export const maxDuration = 120;
43
+
44
+ export async function POST(request: Request) {
45
+ const { message, sessionId = 'web-default' } = await request.json();
46
+
47
+ const encoder = new TextEncoder();
48
+ const stream = new ReadableStream({
49
+ async start(controller) {
50
+ const send = (payload: unknown) => {
51
+ controller.enqueue(encoder.encode(`${JSON.stringify(payload)}\n`));
52
+ };
53
+
54
+ const zilmate = createZilMate({
55
+ sessionId,
56
+ onProgress: (event) => send({ type: 'progress', event }),
57
+ });
58
+
59
+ try {
60
+ const { text } = await zilmate.manager({ message });
61
+ send({ type: 'done', text });
62
+ } catch (error) {
63
+ send({
64
+ type: 'error',
65
+ message: error instanceof Error ? error.message : String(error),
66
+ });
67
+ } finally {
68
+ controller.close();
69
+ }
70
+ },
71
+ });
72
+
73
+ return new Response(stream, {
74
+ headers: {
75
+ 'Content-Type': 'application/x-ndjson',
76
+ 'Cache-Control': 'no-cache',
77
+ },
78
+ });
79
+ }
80
+ ```
81
+
82
+ Client hook (React):
83
+
84
+ ```tsx
85
+ 'use client';
86
+
87
+ import { useState } from 'react';
88
+
89
+ export function ZilMateChat() {
90
+ const [input, setInput] = useState('');
91
+ const [reply, setReply] = useState('');
92
+ const [progress, setProgress] = useState<string[]>([]);
93
+
94
+ async function send() {
95
+ setProgress([]);
96
+ const res = await fetch('/api/zilmate', {
97
+ method: 'POST',
98
+ headers: { 'Content-Type': 'application/json' },
99
+ body: JSON.stringify({ message: input, sessionId: 'web-1' }),
100
+ });
101
+
102
+ const reader = res.body!.getReader();
103
+ const decoder = new TextDecoder();
104
+ let buffer = '';
105
+
106
+ while (true) {
107
+ const { done, value } = await reader.read();
108
+ if (done) break;
109
+ buffer += decoder.decode(value, { stream: true });
110
+ const lines = buffer.split('\n');
111
+ buffer = lines.pop() ?? '';
112
+ for (const line of lines) {
113
+ if (!line.trim()) continue;
114
+ const chunk = JSON.parse(line);
115
+ if (chunk.type === 'progress') setProgress((p) => [...p, chunk.event.label]);
116
+ if (chunk.type === 'done') setReply(chunk.text);
117
+ }
118
+ }
119
+ }
120
+
121
+ return (
122
+ <div>
123
+ <textarea value={input} onChange={(e) => setInput(e.target.value)} />
124
+ <button onClick={send}>Ask ZilMate</button>
125
+ <ul>{progress.map((p) => <li key={p}>{p}</li>)}</ul>
126
+ <pre>{reply}</pre>
127
+ </div>
128
+ );
129
+ }
130
+ ```
131
+
132
+ ## Subagents
133
+
134
+ The manager orchestrates specialized subagents. Call them directly when you do not need full orchestration.
135
+
136
+ | Method | Agent | Best for |
137
+ |--------|-------|----------|
138
+ | `manager()` | Main orchestrator | General tasks, routing, tools, memory |
139
+ | `coding()` | Coding agent + appBuilder + qaIntegration | Repo edits, builds, tests, patches |
140
+ | `imageAgent()` | Image director | Prompt refinement + generation/editing |
141
+ | `goalManager()` | Goal planner | Break goals into steps and schedules |
142
+ | `research()` | Docs/web research | Sourced answers |
143
+ | `help()` | Quick help | Usage and troubleshooting |
144
+ | `post()` | Copywriter | Short social/status posts |
145
+
146
+ ### Coding agent with sub-coders
147
+
148
+ ```ts
149
+ const zilmate = createZilMate({ sessionId: 'repo-session' });
150
+
151
+ const { text } = await zilmate.coding({
152
+ prompt: [
153
+ 'In this Next.js repo:',
154
+ '1) Add a /api/health route',
155
+ '2) Run typecheck',
156
+ '3) Return files changed and test output',
157
+ ].join('\n'),
158
+ });
159
+ ```
160
+
161
+ Internally, the coding agent can delegate to:
162
+
163
+ - **appBuilder** — full app/game/UI implementation
164
+ - **qaIntegration** — tests, build fixes, release checks
165
+
166
+ It also uses **code intelligence tools**: `grepCodebase`, `reviewWorkingTree`, `explainSymbol`, `scaffoldFiles`, `runProjectChecks`.
167
+
168
+ ### Image director
169
+
170
+ ```ts
171
+ const { text } = await zilmate.imageAgent({
172
+ prompt: 'Product hero image: dark SaaS dashboard on laptop, cyan accent, no text gibberish, 16:9',
173
+ });
174
+ ```
175
+
176
+ The image agent runs `enhanceImagePrompt` then `generateImage` for precise visuals.
177
+
178
+ ## Agentic features (10x differentiators)
179
+
180
+ ### 1. Situational awareness
181
+
182
+ Before major work, the manager can call `getSituationBrief` (cwd, git, workspace, models, jobs, memory, projects). Use directly:
183
+
184
+ ```ts
185
+ const brief = await zilmate.situation({ sessionId: 'default' });
186
+ console.log(brief.git, brief.recentJobs, brief.models);
187
+ ```
188
+
189
+ ### 2. Session continuity (handoffs)
190
+
191
+ Resume work across sessions:
192
+
193
+ ```ts
194
+ const handoff = await zilmate.handoff({ sessionId: 'default' });
195
+ if (handoff) {
196
+ await zilmate.manager({
197
+ message: `Continue from handoff:\n${handoff.summary}\nNext: ${handoff.nextActions.join(', ')}`,
198
+ });
199
+ }
200
+ ```
201
+
202
+ The manager can also call `generateSessionHandoff` / `saveSessionHandoff` before ending a long task.
203
+
204
+ ## Model selection
205
+
206
+ CLI users run `/model pick`. In code, persist selections to the workspace:
207
+
208
+ ```ts
209
+ import { applyStoredModelSelections, saveModelSelection } from 'zilmate/server';
210
+
211
+ await applyStoredModelSelections();
212
+ await saveModelSelection('manager', 'anthropic/claude-sonnet-4');
213
+ await saveModelSelection('coding', 'openai/gpt-5.4-mini');
214
+ ```
215
+
216
+ Models are stored in `~/Downloads/ZilMate/config/models.json` (or `ZILMATE_WORKSPACE`).
217
+
218
+ ## Memory
219
+
220
+ ```ts
221
+ await zilmate.remember({ text: 'User prefers pnpm and App Router', tags: ['prefs'] });
222
+ const hits = await zilmate.recall({ query: 'package manager', limit: 5 });
223
+ ```
224
+
225
+ ## Background jobs
226
+
227
+ ```ts
228
+ const job = await zilmate.createJob({
229
+ task: 'Weekly summary of GitHub PRs',
230
+ schedule: '0 9 * * 1',
231
+ });
232
+
233
+ await zilmate.runDueJobs();
234
+ const logs = await zilmate.getJobLogs(job.id);
235
+ ```
236
+
237
+ Expose webhooks for QStash:
238
+
239
+ ```ts
240
+ // app/api/jobs/webhook/route.ts
241
+ import { createZilMate } from 'zilmate/server';
242
+
243
+ export async function POST(req: Request) {
244
+ const body = await req.json();
245
+ const zilmate = createZilMate();
246
+ const job = await zilmate.handleJobWebhook(body, process.env.ZILMATE_JOB_WEBHOOK_SECRET);
247
+ return Response.json({ ok: true, jobId: job.id });
248
+ }
249
+ ```
250
+
251
+ Use `zilmate jobs listen --tunnel` (Cloudflare quick tunnel) during local development.
252
+
253
+ ## Voice (Deepgram)
254
+
255
+ ```ts
256
+ const session = await zilmate.startVoiceSession({
257
+ onProgress: (e) => console.log(e.label),
258
+ });
259
+
260
+ // session exposes Deepgram agent wiring — see src/voice/deepgram.ts
261
+ console.log(session.config.listenModel);
262
+ await session.close?.();
263
+ ```
264
+
265
+ ## Confirmation in server contexts
266
+
267
+ Destructive tools require explicit approval. Provide a handler:
268
+
269
+ ```ts
270
+ import type { ConfirmationHandler } from 'zilmate/server';
271
+
272
+ const confirm: ConfirmationHandler = async (request) => {
273
+ // In a web app, push to UI and await user click
274
+ console.log('Approve?', request.message);
275
+ return true;
276
+ };
277
+
278
+ const zilmate = createZilMate({ confirm });
279
+ ```
280
+
281
+ ## Exports reference
282
+
283
+ ```ts
284
+ import {
285
+ createZilMate,
286
+ chat,
287
+ help,
288
+ post,
289
+ research,
290
+ image,
291
+ applyStoredModelSelections,
292
+ buildSituationBrief,
293
+ loadSessionHandoff,
294
+ clearSessionApprovals,
295
+ } from 'zilmate/server';
296
+ ```
297
+
298
+ ## CLI parity
299
+
300
+ | CLI | SDK |
301
+ |-----|-----|
302
+ | `zilmate talk` | `createZilMate().manager()` |
303
+ | `zilmate coding "..."` | `createZilMate().coding()` |
304
+ | `zilmate heal` | manager + heal tools (via manager) |
305
+ | `zilmate jobs worker` | `runDueJobs()` + worker process |
306
+ | `/model pick` | `saveModelSelection()` |
307
+
308
+ ## Production checklist
309
+
310
+ 1. Run `zilmate setup` once per environment (merge-safe).
311
+ 2. Set `ZILMATE_WORKSPACE` for durable notebook/knowledge/skills.
312
+ 3. Enable Redis for multi-instance memory and jobs.
313
+ 4. Use QStash + Cloudflare tunnel for hosted schedules.
314
+ 5. Never expose `AI_GATEWAY_API_KEY` to the browser — keep SDK calls on the server.
315
+
316
+ ## Learn more
317
+
318
+ - Repository: https://github.com/zester4/zilo-manager
319
+ - Agent skill: `plugins/zilmate/skills/zilmate/SKILL.md`
320
+ - AI SDK patterns: https://sdk.vercel.ai/docs
package/agent-docs.md CHANGED
@@ -1,3 +1,15 @@
1
+ ZilMate coding-agent note
2
+
3
+ ZilMate uses the AI SDK v6 subagent pattern for coding work:
4
+
5
+ - Manager delegates software work to the main Coding Agent.
6
+ - Coding Agent stays responsible for orchestration and the final report.
7
+ - Coding Agent can call `appBuilder` for full app/game/software implementation.
8
+ - Coding Agent can call `qaIntegration` for builds, tests, debugging, and release-readiness checks.
9
+ - Both internal coding delegates use skills, file tools, shell tools, and notebook tools.
10
+ - Use scratchpad for temporary run coordination and notebook for durable project memory.
11
+ - Delegate tools pass `abortSignal` into subagents and emit subagent progress events so the CLI can show what is happening.
12
+
1
13
  Building Subagents in the Vercel AI SDK v6
2
14
  11 min read
3
15
  ·
@@ -116,12 +116,12 @@ export declare function createAutomationPlannerAgent(): ToolLoopAgent<never, {
116
116
  limit?: number | undefined;
117
117
  }, {
118
118
  items: {
119
- slug: string;
120
119
  name: string;
121
120
  description: string;
121
+ slug: string;
122
122
  toolkit: {
123
- slug: string;
124
123
  name: string;
124
+ slug: string;
125
125
  logo: string;
126
126
  };
127
127
  payload: Record<string, unknown>;
@@ -135,12 +135,12 @@ export declare function createAutomationPlannerAgent(): ToolLoopAgent<never, {
135
135
  showTriggerType: import("ai").Tool<{
136
136
  triggerSlug: string;
137
137
  }, {
138
- slug: string;
139
138
  name: string;
140
139
  description: string;
140
+ slug: string;
141
141
  toolkit: {
142
- slug: string;
143
142
  name: string;
143
+ slug: string;
144
144
  logo: string;
145
145
  };
146
146
  payload: Record<string, unknown>;
@@ -1 +1 @@
1
- {"version":3,"file":"automation-planner.agent.d.ts","sourceRoot":"","sources":["../../src/agents/automation-planner.agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,aAAa,EAAE,MAAM,IAAI,CAAC;AAUhD,wBAAgB,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBA2BksyG,CAAC;wBAAsC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAAz2S,CAAC;uBAAqC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UADn9/F"}
1
+ {"version":3,"file":"automation-planner.agent.d.ts","sourceRoot":"","sources":["../../src/agents/automation-planner.agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,aAAa,EAAE,MAAM,IAAI,CAAC;AAUhD,wBAAgB,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBA2B8+uG,CAAC;wBAAsC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAAz2S,CAAC;uBAAqC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAD/v8F"}
@@ -4,6 +4,35 @@ export declare function createCodingAgent(runId?: string): ToolLoopAgent<never,
4
4
  appendScratchpad: import("ai").Tool<{
5
5
  note: string;
6
6
  }, string>;
7
+ readNotebook: import("ai").Tool<{
8
+ limitChars?: number | undefined;
9
+ }, {
10
+ paths: {
11
+ markdown: string;
12
+ json: string;
13
+ };
14
+ content: string;
15
+ }>;
16
+ appendNotebook: import("ai").Tool<{
17
+ title: string;
18
+ body: string;
19
+ tags?: string[] | undefined;
20
+ }, import("../memory/notebook.js").NotebookEntry>;
21
+ searchNotebook: import("ai").Tool<{
22
+ query: string;
23
+ limit?: number | undefined;
24
+ }, import("../memory/notebook.js").NotebookEntry[]>;
25
+ listNotebookEntries: import("ai").Tool<{
26
+ limit?: number | undefined;
27
+ }, import("../memory/notebook.js").NotebookEntry[]>;
28
+ quickNotebookNote: import("ai").Tool<{
29
+ section: string;
30
+ content: string;
31
+ }, {
32
+ path: string;
33
+ section: string;
34
+ appendedAt: string;
35
+ }>;
7
36
  listSkills: import("ai").Tool<Record<string, never>, {
8
37
  skills: import("../skills/loader.js").SkillSummary[];
9
38
  searchPaths: string[];
@@ -266,6 +295,71 @@ export declare function createCodingAgent(runId?: string): ToolLoopAgent<never,
266
295
  isSymlink: boolean;
267
296
  mode: string;
268
297
  }>;
298
+ grepCodebase: import("ai").Tool<{
299
+ pattern: string;
300
+ cwd?: string | undefined;
301
+ glob?: string | undefined;
302
+ limit?: number | undefined;
303
+ }, {
304
+ root: string;
305
+ pattern: string;
306
+ output: string;
307
+ error?: never;
308
+ } | {
309
+ root: string;
310
+ pattern: string;
311
+ error: string;
312
+ output?: never;
313
+ }>;
314
+ reviewWorkingTree: import("ai").Tool<{
315
+ cwd?: string | undefined;
316
+ focus?: string | undefined;
317
+ }, {
318
+ root: string;
319
+ review: string;
320
+ }>;
321
+ explainSymbol: import("ai").Tool<{
322
+ symbol: string;
323
+ cwd?: string | undefined;
324
+ }, {
325
+ symbol: string;
326
+ root: string;
327
+ explanation: string;
328
+ hits: string;
329
+ }>;
330
+ scaffoldFiles: import("ai").Tool<{
331
+ files: {
332
+ path: string;
333
+ content: string;
334
+ overwrite?: boolean | undefined;
335
+ }[];
336
+ cwd?: string | undefined;
337
+ }, {
338
+ created: string[];
339
+ count: number;
340
+ }>;
341
+ runProjectChecks: import("ai").Tool<{
342
+ cwd?: string | undefined;
343
+ scripts?: string[] | undefined;
344
+ }, {
345
+ root: string;
346
+ ran: never[];
347
+ note: string;
348
+ available: Record<string, string>;
349
+ results?: never;
350
+ allPassed?: never;
351
+ } | {
352
+ root: string;
353
+ results: {
354
+ script: string;
355
+ output: string;
356
+ ok: boolean;
357
+ }[];
358
+ allPassed: boolean;
359
+ ran?: never;
360
+ note?: never;
361
+ available?: never;
362
+ }>;
269
363
  gitStatus: import("ai").Tool<{
270
364
  short: boolean;
271
365
  cwd?: string | undefined;
@@ -348,5 +442,13 @@ export declare function createCodingAgent(runId?: string): ToolLoopAgent<never,
348
442
  timeZone: string;
349
443
  formatted: string;
350
444
  }>;
445
+ appBuilder: import("ai").Tool<{
446
+ task: string;
447
+ context?: string | undefined;
448
+ }, string>;
449
+ qaIntegration: import("ai").Tool<{
450
+ task: string;
451
+ context?: string | undefined;
452
+ }, string>;
351
453
  }, never>;
352
454
  //# sourceMappingURL=coding.agent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"coding.agent.d.ts","sourceRoot":"","sources":["../../src/agents/coding.agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,aAAa,EAAE,MAAM,IAAI,CAAC;AAUhD,wBAAgB,iBAAiB,CAAC,KAAK,SAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAwBlD"}
1
+ {"version":3,"file":"coding.agent.d.ts","sourceRoot":"","sources":["../../src/agents/coding.agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,aAAa,EAAQ,MAAM,IAAI,CAAC;AA8FtD,wBAAgB,iBAAiB,CAAC,KAAK,SAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAiClD"}
@@ -1,31 +1,115 @@
1
- import { stepCountIs, ToolLoopAgent } from 'ai';
1
+ import { stepCountIs, ToolLoopAgent, tool } from 'ai';
2
+ import { z } from 'zod';
2
3
  import { models } from '../config/models.js';
3
4
  import { createScratchpadTools } from '../tools/scratchpad.tool.js';
5
+ import { notebookTools } from '../tools/notebook.tool.js';
4
6
  import { fileSystemTools } from '../tools/filesystem.tool.js';
7
+ import { codeIntelligenceTools } from '../tools/code-intelligence.tool.js';
5
8
  import { gitTools } from '../tools/git.tool.js';
6
9
  import { shellTools } from '../tools/shell.tool.js';
7
10
  import { skillTools } from '../tools/skills.tool.js';
8
11
  import { timeTools } from '../tools/time.tool.js';
9
12
  import { limits } from '../safety/limits.js';
13
+ import { emitProgress } from '../runtime/progress.js';
14
+ function createAppBuilderAgent(runId = 'default') {
15
+ const scratchpadTools = createScratchpadTools(`${runId}:app-builder`);
16
+ return new ToolLoopAgent({
17
+ model: models.coding,
18
+ instructions: [
19
+ 'You are ZilMate App Builder, an internal coding subagent for building complete apps, games, tools, and software projects end to end.',
20
+ 'Use skills first when the task matches a framework or domain: searchSkills/readSkill before designing Vite, Next.js, React, shadcn, ai-elements, AI SDK, Composio, Supabase, games, or desktop workflows.',
21
+ 'Choose the existing stack when inside a repo. For new frontend apps, prefer Vite for lightweight apps/games and Next.js when routing, server APIs, auth, SDK routes, or deployment structure matter.',
22
+ 'Implement real working screens and workflows, not placeholder landing pages. For games, build actual gameplay. For apps, build the usable first screen and the expected controls/states.',
23
+ 'Use file tools for targeted edits, shell tools for installs/builds/tests, and notebook tools to save durable project decisions, commands, ports, and follow-up context.',
24
+ 'When external apps are needed, design around Composio search/link/execute workflows and keep user secrets server-side.',
25
+ 'Return a concise builder report: files changed, commands run, dev server or build status, and what remains.',
26
+ ].join('\n'),
27
+ tools: {
28
+ ...timeTools,
29
+ ...fileSystemTools,
30
+ ...codeIntelligenceTools,
31
+ ...shellTools,
32
+ ...skillTools,
33
+ ...notebookTools,
34
+ ...scratchpadTools,
35
+ },
36
+ stopWhen: stepCountIs(limits.subagentSteps),
37
+ });
38
+ }
39
+ function createQaIntegrationAgent(runId = 'default') {
40
+ const scratchpadTools = createScratchpadTools(`${runId}:qa`);
41
+ return new ToolLoopAgent({
42
+ model: models.coding,
43
+ instructions: [
44
+ 'You are ZilMate QA and Integration Builder, an internal coding subagent for verification, debugging, test coverage, dependency checks, and release readiness.',
45
+ 'Read the implementation and repo scripts before testing. Use skills when framework-specific testing or build rules exist.',
46
+ 'Run the narrowest useful checks first, then broaden when shared behavior or user-facing workflows are touched.',
47
+ 'Fix build/type/lint/runtime failures when the cause is clear. Do not hide failed checks; report command, exit state, and useful error lines.',
48
+ 'Use notebook tools to persist durable verification notes, recurring gotchas, release steps, and environment assumptions.',
49
+ 'For Composio or external-app features, verify connection/setup paths separately from write-like actions and keep destructive actions behind confirmation.',
50
+ 'Return a concise QA report: checks run, failures fixed, remaining risks, and exact next command for the main agent/user.',
51
+ ].join('\n'),
52
+ tools: {
53
+ ...timeTools,
54
+ ...gitTools,
55
+ ...codeIntelligenceTools,
56
+ ...fileSystemTools,
57
+ ...shellTools,
58
+ ...skillTools,
59
+ ...notebookTools,
60
+ ...scratchpadTools,
61
+ },
62
+ stopWhen: stepCountIs(limits.subagentSteps),
63
+ });
64
+ }
65
+ function codingDelegateTool(name, description, agent) {
66
+ return tool({
67
+ description,
68
+ inputSchema: z.object({
69
+ task: z.string().min(10),
70
+ context: z.string().optional(),
71
+ }),
72
+ execute: async ({ task, context }, { abortSignal }) => {
73
+ emitProgress({ type: 'subagent:start', agent: name, label: 'Delegated coding work', detail: task.slice(0, 160) });
74
+ emitProgress({ type: 'subagent:step', agent: name, label: 'Running focused build loop' });
75
+ const prompt = context ? `${context}\n\nTask:\n${task}` : task;
76
+ const result = await agent.generate({
77
+ prompt,
78
+ ...(abortSignal ? { abortSignal } : {}),
79
+ });
80
+ emitProgress({ type: 'subagent:end', agent: name, label: 'Delegate finished' });
81
+ return result.text;
82
+ },
83
+ });
84
+ }
10
85
  export function createCodingAgent(runId = 'default') {
11
86
  const scratchpadTools = createScratchpadTools(runId);
87
+ const appBuilder = createAppBuilderAgent(runId);
88
+ const qaBuilder = createQaIntegrationAgent(runId);
12
89
  return new ToolLoopAgent({
13
90
  model: models.coding,
14
91
  instructions: [
15
- 'You are ZilMate Coding Agent a focused software engineering partner for this machine.',
92
+ 'You are ZilMate Coding Agent, the main coding orchestrator reporting back to the Manager.',
93
+ 'You manage two internal coding delegates: appBuilder for full app/game/software implementation, and qaIntegration for testing, debugging, integration, and release checks.',
94
+ 'Delegate substantial end-to-end build work to appBuilder. Delegate verification, failing builds, test strategy, and integration cleanup to qaIntegration. Keep ownership of the final user-facing report.',
16
95
  'Prefer small, reviewable changes: read files, use gitDiff, applyUnifiedPatch for surgical edits instead of rewriting entire files.',
17
- 'Workflow: gitStatus read affected files gitDiff patch or targeted writeFile run tests via executeCommand gitStage gitCommit (only when user asked to commit).',
96
+ 'Workflow: gitStatus -> search/read skills -> read affected files -> plan/delegate if useful -> patch or targeted writeFile -> run tests via executeCommand or qaIntegration -> gitDiff -> gitStage/gitCommit only when user asked to commit.',
18
97
  'Use git tools for branch awareness, diffs, staging, and commits. Never force-push unless the user explicitly requests it.',
19
- 'Use searchSkills/readSkill when a repo skill documents conventions.',
20
- 'Report what you changed, which files, and test/build output. Keep scratchpad notes for multi-file refactors.',
98
+ 'Use searchSkills/readSkill when a repo skill documents conventions. For AI SDK work, verify against local ai docs/source. For Composio integrations, follow search -> link -> execute patterns and keep secrets server-side.',
99
+ 'Use scratchpad for temporary run planning. Use notebook tools for durable project memory: architecture decisions, setup steps, known failures, ports, commands, and handoff notes.',
100
+ 'Report what you changed, which files, subagents used, and test/build output. Keep the final concise but include failures honestly.',
21
101
  'Do not claim tests passed unless executeCommand output shows success.',
22
102
  ].join(' '),
23
103
  tools: {
104
+ appBuilder: codingDelegateTool('appBuilder', 'Delegate full app, game, software, Vite, Next.js, UI, or end-to-end implementation work to the internal app builder.', appBuilder),
105
+ qaIntegration: codingDelegateTool('qaIntegration', 'Delegate testing, debugging, build fixes, integration checks, and release-readiness verification to the internal QA/integration builder.', qaBuilder),
24
106
  ...timeTools,
25
107
  ...gitTools,
108
+ ...codeIntelligenceTools,
26
109
  ...fileSystemTools,
27
110
  ...shellTools,
28
111
  ...skillTools,
112
+ ...notebookTools,
29
113
  ...scratchpadTools,
30
114
  },
31
115
  stopWhen: stepCountIs(limits.subagentSteps),
@@ -1 +1 @@
1
- {"version":3,"file":"coding.agent.js","sourceRoot":"","sources":["../../src/agents/coding.agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;A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CAAC,KAAK,GAAG,SAAS;IACjD,MAAM,eAAe,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC;IACrD,MAAM,UAAU,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC;IAChD,MAAM,SAAS,GAAG,wBAAwB,CAAC,KAAK,CAAC,CAAC;IAElD,OAAO,IAAI,aAAa,CAAC;QACvB,KAAK,EAAE,MAAM,CAAC,MAAM;QACpB,YAAY,EAAE;YACZ,2FAA2F;YAC3F,4KAA4K;YAC5K,2MAA2M;YAC3M,oIAAoI;YACpI,8OAA8O;YAC9O,2HAA2H;YAC3H,8NAA8N;YAC9N,oLAAoL;YACpL,oIAAoI;YACpI,uEAAuE;SACxE,CAAC,IAAI,CAAC,GAAG,CAAC;QACX,KAAK,EAAE;YACL,UAAU,EAAE,kBAAkB,CAAC,YAAY,EAAE,sHAAsH,EAAE,UAAU,CAAC;YAChL,aAAa,EAAE,kBAAkB,CAAC,eAAe,EAAE,0IAA0I,EAAE,SAAS,CAAC;YACzM,GAAG,SAAS;YACZ,GAAG,QAAQ;YACX,GAAG,qBAAqB;YACxB,GAAG,eAAe;YAClB,GAAG,UAAU;YACb,GAAG,UAAU;YACb,GAAG,aAAa;YAChB,GAAG,eAAe;SACnB;QACD,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,aAAa,CAAC;KAC5C,CAAC,CAAC;AACL,CAAC"}
@@ -1,9 +1,22 @@
1
1
  import { ToolLoopAgent } from 'ai';
2
2
  export declare function createImageAgent(): ToolLoopAgent<never, {
3
+ enhanceImagePrompt: import("ai").Tool<{
4
+ idea: string;
5
+ style?: "product" | "cinematic" | "ui" | "illustration" | "photoreal" | undefined;
6
+ mustInclude?: string[] | undefined;
7
+ avoid?: string[] | undefined;
8
+ }, {
9
+ prompt: string;
10
+ style: string;
11
+ }>;
3
12
  generateImage: import("ai").Tool<{
4
13
  prompt: string;
5
14
  provider?: "openai" | "gemini" | "chatgpt" | "google" | "default" | undefined;
6
15
  size?: string | undefined;
16
+ imagePaths?: string[] | undefined;
17
+ imageUrls?: string[] | undefined;
18
+ maskPath?: string | undefined;
19
+ maskUrl?: string | undefined;
7
20
  }, import("../tools/image-generate.tool.js").ImageGenerationResult>;
8
21
  }, never>;
9
22
  //# sourceMappingURL=image.agent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"image.agent.d.ts","sourceRoot":"","sources":["../../src/agents/image.agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,aAAa,EAAE,MAAM,IAAI,CAAC;AAKhD,wBAAgB,gBAAgB;;;;;;UAO/B"}
1
+ {"version":3,"file":"image.agent.d.ts","sourceRoot":"","sources":["../../src/agents/image.agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,aAAa,EAAQ,MAAM,IAAI,CAAC;AAgBtD,wBAAgB,gBAAgB;;;;;;;;;;;;;;;;;;;UAiC/B"}