zilmate 1.7.2 → 1.7.6
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.
- package/.env.example +36 -36
- package/README.md +503 -503
- package/SDK.md +320 -320
- package/agent-docs.md +276 -276
- package/dist/agents/automation-planner.agent.d.ts.map +1 -1
- package/dist/agents/coding.agent.d.ts +18 -0
- package/dist/agents/coding.agent.d.ts.map +1 -1
- package/dist/agents/finance.agent.d.ts +60 -0
- package/dist/agents/finance.agent.d.ts.map +1 -0
- package/dist/agents/finance.agent.js +30 -0
- package/dist/agents/finance.agent.js.map +1 -0
- package/dist/agents/manager.d.ts +94 -1
- package/dist/agents/manager.d.ts.map +1 -1
- package/dist/agents/manager.js +102 -36
- package/dist/agents/manager.js.map +1 -1
- package/dist/agents/swarm/engineering/qa.d.ts +3 -0
- package/dist/agents/swarm/engineering/qa.d.ts.map +1 -0
- package/dist/agents/swarm/engineering/qa.js +19 -0
- package/dist/agents/swarm/engineering/qa.js.map +1 -0
- package/dist/agents/swarm/growth/seo.d.ts +3 -0
- package/dist/agents/swarm/growth/seo.d.ts.map +1 -0
- package/dist/agents/swarm/growth/seo.js +19 -0
- package/dist/agents/swarm/growth/seo.js.map +1 -0
- package/dist/agents/swarm/main.d.ts +22 -0
- package/dist/agents/swarm/main.d.ts.map +1 -0
- package/dist/agents/swarm/main.js +65 -0
- package/dist/agents/swarm/main.js.map +1 -0
- package/dist/agents/swarm/operations/finance.d.ts +3 -0
- package/dist/agents/swarm/operations/finance.d.ts.map +1 -0
- package/dist/agents/swarm/operations/finance.js +19 -0
- package/dist/agents/swarm/operations/finance.js.map +1 -0
- package/dist/agents/swarm/registry.d.ts +4 -0
- package/dist/agents/swarm/registry.d.ts.map +1 -0
- package/dist/agents/swarm/registry.js +361 -0
- package/dist/agents/swarm/registry.js.map +1 -0
- package/dist/cli/chat.d.ts +2 -0
- package/dist/cli/chat.d.ts.map +1 -0
- package/dist/cli/chat.js +61 -0
- package/dist/cli/chat.js.map +1 -0
- package/dist/cli/composer.d.ts.map +1 -1
- package/dist/cli/composer.js +54 -4
- package/dist/cli/composer.js.map +1 -1
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +13 -0
- package/dist/cli/doctor.js.map +1 -1
- package/dist/cli/format.d.ts.map +1 -1
- package/dist/cli/format.js +46 -53
- package/dist/cli/format.js.map +1 -1
- package/dist/cli/interactive.d.ts.map +1 -1
- package/dist/cli/interactive.js +51 -6
- package/dist/cli/interactive.js.map +1 -1
- package/dist/cli/models.d.ts +1 -1
- package/dist/cli/models.d.ts.map +1 -1
- package/dist/cli/models.js +21 -21
- package/dist/cli/models.js.map +1 -1
- package/dist/cli/prompt.d.ts +2 -2
- package/dist/cli/prompt.d.ts.map +1 -1
- package/dist/cli/prompt.js +58 -14
- package/dist/cli/prompt.js.map +1 -1
- package/dist/cli/render.d.ts.map +1 -1
- package/dist/cli/render.js +25 -17
- package/dist/cli/render.js.map +1 -1
- package/dist/cli/setup.d.ts +1 -0
- package/dist/cli/setup.d.ts.map +1 -1
- package/dist/cli/setup.js +74 -2
- package/dist/cli/setup.js.map +1 -1
- package/dist/cli/swarm.d.ts +4 -0
- package/dist/cli/swarm.d.ts.map +1 -0
- package/dist/cli/swarm.js +21 -0
- package/dist/cli/swarm.js.map +1 -0
- package/dist/cli/theme.d.ts +67 -1
- package/dist/cli/theme.d.ts.map +1 -1
- package/dist/cli/theme.js +66 -4
- package/dist/cli/theme.js.map +1 -1
- package/dist/cli/tunnel.d.ts.map +1 -1
- package/dist/cli/tunnel.js +2 -1
- package/dist/cli/tunnel.js.map +1 -1
- package/dist/cli/voice.js +11 -11
- package/dist/cli/welcome.d.ts.map +1 -1
- package/dist/cli/welcome.js +2 -0
- package/dist/cli/welcome.js.map +1 -1
- package/dist/config/model-store.d.ts +1 -1
- package/dist/config/model-store.d.ts.map +1 -1
- package/dist/config/model-store.js +14 -1
- package/dist/config/model-store.js.map +1 -1
- package/dist/config/models.d.ts +7 -0
- package/dist/config/models.d.ts.map +1 -1
- package/dist/config/models.js +30 -6
- package/dist/config/models.js.map +1 -1
- package/dist/documents/pdf.d.ts.map +1 -1
- package/dist/documents/pdf.js +143 -41
- package/dist/documents/pdf.js.map +1 -1
- package/dist/index.js +19 -1
- package/dist/index.js.map +1 -1
- package/dist/jobs/anomaly.js +5 -5
- package/dist/memory/heal.js +43 -43
- package/dist/observability/doctor.d.ts +3 -0
- package/dist/observability/doctor.d.ts.map +1 -0
- package/dist/observability/doctor.js +33 -0
- package/dist/observability/doctor.js.map +1 -0
- package/dist/observability/usage.d.ts +13 -0
- package/dist/observability/usage.d.ts.map +1 -0
- package/dist/observability/usage.js +34 -0
- package/dist/observability/usage.js.map +1 -0
- package/dist/runtime/chat-bridge.d.ts +32 -0
- package/dist/runtime/chat-bridge.d.ts.map +1 -0
- package/dist/runtime/chat-bridge.js +92 -0
- package/dist/runtime/chat-bridge.js.map +1 -0
- package/dist/runtime/confirm.d.ts.map +1 -1
- package/dist/runtime/confirm.js +12 -2
- package/dist/runtime/confirm.js.map +1 -1
- package/dist/runtime/progress.d.ts.map +1 -1
- package/dist/runtime/progress.js +3 -1
- package/dist/runtime/progress.js.map +1 -1
- package/dist/runtime/prompts/builder.d.ts +11 -0
- package/dist/runtime/prompts/builder.d.ts.map +1 -0
- package/dist/runtime/prompts/builder.js +29 -0
- package/dist/runtime/prompts/builder.js.map +1 -0
- package/dist/runtime/registry.d.ts +14 -0
- package/dist/runtime/registry.d.ts.map +1 -0
- package/dist/runtime/registry.js +39 -0
- package/dist/runtime/registry.js.map +1 -0
- package/dist/runtime/storage/interface.d.ts +16 -0
- package/dist/runtime/storage/interface.d.ts.map +1 -0
- package/dist/runtime/storage/interface.js +19 -0
- package/dist/runtime/storage/interface.js.map +1 -0
- package/dist/runtime/storage/local.d.ts +12 -0
- package/dist/runtime/storage/local.d.ts.map +1 -0
- package/dist/runtime/storage/local.js +48 -0
- package/dist/runtime/storage/local.js.map +1 -0
- package/dist/runtime/storage/redis.d.ts +11 -0
- package/dist/runtime/storage/redis.d.ts.map +1 -0
- package/dist/runtime/storage/redis.js +21 -0
- package/dist/runtime/storage/redis.js.map +1 -0
- package/dist/runtime/swarm/reports.d.ts +9 -0
- package/dist/runtime/swarm/reports.d.ts.map +1 -0
- package/dist/runtime/swarm/reports.js +43 -0
- package/dist/runtime/swarm/reports.js.map +1 -0
- package/dist/runtime/swarm.d.ts +38 -0
- package/dist/runtime/swarm.d.ts.map +1 -0
- package/dist/runtime/swarm.js +110 -0
- package/dist/runtime/swarm.js.map +1 -0
- package/dist/runtime/telemetry.d.ts +15 -0
- package/dist/runtime/telemetry.d.ts.map +1 -0
- package/dist/runtime/telemetry.js +25 -0
- package/dist/runtime/telemetry.js.map +1 -0
- package/dist/runtime/tool-utils.d.ts +12 -0
- package/dist/runtime/tool-utils.d.ts.map +1 -0
- package/dist/runtime/tool-utils.js +31 -0
- package/dist/runtime/tool-utils.js.map +1 -0
- package/dist/tools/browser.tool.d.ts +54 -0
- package/dist/tools/browser.tool.d.ts.map +1 -0
- package/dist/tools/browser.tool.js +193 -0
- package/dist/tools/browser.tool.js.map +1 -0
- package/dist/tools/business-apps.tool.d.ts +18 -0
- package/dist/tools/business-apps.tool.d.ts.map +1 -0
- package/dist/tools/business-apps.tool.js +43 -0
- package/dist/tools/business-apps.tool.js.map +1 -0
- package/dist/tools/computer-use.tool.js +66 -66
- package/dist/tools/cross-app-ledger.tool.d.ts +7 -0
- package/dist/tools/cross-app-ledger.tool.d.ts.map +1 -0
- package/dist/tools/cross-app-ledger.tool.js +70 -0
- package/dist/tools/cross-app-ledger.tool.js.map +1 -0
- package/dist/tools/daytona-browser.tool.d.ts +113 -0
- package/dist/tools/daytona-browser.tool.d.ts.map +1 -0
- package/dist/tools/daytona-browser.tool.js +348 -0
- package/dist/tools/daytona-browser.tool.js.map +1 -0
- package/dist/tools/desktop.tool.js +10 -10
- package/dist/tools/documents.tool.js +5 -5
- package/dist/tools/finance.tool.d.ts +18 -0
- package/dist/tools/finance.tool.d.ts.map +1 -0
- package/dist/tools/finance.tool.js +88 -0
- package/dist/tools/finance.tool.js.map +1 -0
- package/dist/tools/image-intelligence.tool.d.ts +12 -0
- package/dist/tools/image-intelligence.tool.d.ts.map +1 -0
- package/dist/tools/image-intelligence.tool.js +62 -0
- package/dist/tools/image-intelligence.tool.js.map +1 -0
- package/dist/tools/notify.tool.js +8 -8
- package/dist/tools/osint-install.tool.js +8 -8
- package/dist/tools/pentest-install.tool.js +6 -6
- package/dist/tools/setup-assistant.tool.d.ts +1 -1
- package/dist/tools/shell.tool.d.ts +18 -0
- package/dist/tools/shell.tool.d.ts.map +1 -1
- package/dist/tools/shell.tool.js +34 -0
- package/dist/tools/shell.tool.js.map +1 -1
- package/dist/tools/swarm-collaboration.tool.d.ts +29 -0
- package/dist/tools/swarm-collaboration.tool.d.ts.map +1 -0
- package/dist/tools/swarm-collaboration.tool.js +88 -0
- package/dist/tools/swarm-collaboration.tool.js.map +1 -0
- package/dist/tools/swarm-memory.tool.d.ts +16 -0
- package/dist/tools/swarm-memory.tool.d.ts.map +1 -0
- package/dist/tools/swarm-memory.tool.js +31 -0
- package/dist/tools/swarm-memory.tool.js.map +1 -0
- package/dist/tools/swarm-ops.tool.d.ts +20 -0
- package/dist/tools/swarm-ops.tool.d.ts.map +1 -0
- package/dist/tools/swarm-ops.tool.js +55 -0
- package/dist/tools/swarm-ops.tool.js.map +1 -0
- package/dist/tools/triggers.tool.d.ts.map +1 -1
- package/dist/tools/visual-audit.tool.d.ts +24 -0
- package/dist/tools/visual-audit.tool.d.ts.map +1 -0
- package/dist/tools/visual-audit.tool.js +48 -0
- package/dist/tools/visual-audit.tool.js.map +1 -0
- package/dist/tools/web-intelligence.tool.d.ts +12 -0
- package/dist/tools/web-intelligence.tool.d.ts.map +1 -0
- package/dist/tools/web-intelligence.tool.js +27 -0
- package/dist/tools/web-intelligence.tool.js.map +1 -0
- package/dist/workspace/init.js +18 -18
- package/dist/workspace/output-paths.d.ts +1 -1
- package/dist/workspace/output-paths.d.ts.map +1 -1
- package/dist/workspace/output-paths.js +1 -0
- package/dist/workspace/output-paths.js.map +1 -1
- package/dist/workspace/paths.d.ts +1 -0
- package/dist/workspace/paths.d.ts.map +1 -1
- package/dist/workspace/paths.js +1 -0
- package/dist/workspace/paths.js.map +1 -1
- package/install.ps1 +62 -62
- package/package.json +107 -103
- package/scripts/postinstall.mjs +42 -42
- package/scripts/release-github.mjs +91 -91
- package/src/doc/README.md +49 -49
- package/src/doc/admin-tools-and-sms-campaigns.md +99 -99
- package/src/doc/escalation-checklist.md +97 -97
- package/src/doc/payments-and-payouts.md +82 -82
- package/src/doc/shift-lifecycle-and-disputes.md +95 -95
- package/src/doc/support-macros.md +40 -40
- package/src/doc/venue-support-playbook.md +145 -145
- package/src/doc/verification-and-trust.md +88 -88
- package/src/doc/worker-support-playbook.md +159 -159
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { ToolLoopAgent, stepCountIs, tool } from 'ai';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { SwarmOrchestrator } from '../../runtime/swarm.js';
|
|
4
|
+
import { models } from '../../config/models.js';
|
|
5
|
+
import { limits } from '../../safety/limits.js';
|
|
6
|
+
import { createSwarmSpecialist } from './registry.js';
|
|
7
|
+
import { emitProgress } from '../../runtime/progress.js';
|
|
8
|
+
import { crossAppLedgerTools } from '../../tools/cross-app-ledger.tool.js';
|
|
9
|
+
export async function createDigitalCorporationMain(runId = 'default') {
|
|
10
|
+
const orchestrator = SwarmOrchestrator.getInstance();
|
|
11
|
+
return new ToolLoopAgent({
|
|
12
|
+
model: models.manager,
|
|
13
|
+
instructions: [
|
|
14
|
+
'You are the Digital Corporation Main Agent, the Chief Operating Officer of the ZilMate Swarm.',
|
|
15
|
+
'You manage five specialized departments: Strategy, Engineering, Growth, Operations, and Data.',
|
|
16
|
+
'Your core responsibility is to orchestrate these departments to run a real-world online business.',
|
|
17
|
+
'MANAGEMENT PHILOSOPHY:',
|
|
18
|
+
'1. DELEGATE, DON’T DO: Your primary role is routing and supervision. Assign tasks to specialists.',
|
|
19
|
+
'2. DATA-FIRST: Always use "correlateBusinessData" to get a unified view across Stripe, HubSpot, and GitHub before high-level planning.',
|
|
20
|
+
'3. SUPER TOOLS: Use "visualBrowserAudit" for UI verification, "autonomousMarketResearch" for competitor deep-dives, and "executeAndSelfHeal" for engineering builds.',
|
|
21
|
+
'4. CHAINED EXECUTION: For complex goals, plan a sequence. Example: Architect designs -> Coder builds -> QA tests -> DevOps deploys.',
|
|
22
|
+
'4. ACCOUNTABILITY: Monitor the .md reports created by specialists. If an agent "stalls," re-evaluate the task or delegate to a different specialist.',
|
|
23
|
+
'5. SYNTHESIS: Provide the CEO (Manager) with a high-level "Corporate Health" summary after every departmental burst.',
|
|
24
|
+
'DEPARTMENTAL DOMAINS:',
|
|
25
|
+
'- Strategy: CEO Orchestrator, Product Manager, Market Analyst, UX Researcher.',
|
|
26
|
+
'- Engineering: Architect, Full-Stack Coder, QA Engineer, DevOps SRE, Creative Director.',
|
|
27
|
+
'- Growth: Growth Hacker, SEO Expert, Content Writer, Social Media Manager, Ads Manager, Sales Ops.',
|
|
28
|
+
'- Operations: Finance Analyst, Customer Success, Legal Counsel, Logistics Lead, HR Recruiter.',
|
|
29
|
+
'- Data: Data Scientist, BI Reporter.',
|
|
30
|
+
'You have full authority to manage cross-departmental handoffs and ensure all specialists are aligned with business KPIs.',
|
|
31
|
+
].join('\n'),
|
|
32
|
+
tools: {
|
|
33
|
+
...crossAppLedgerTools,
|
|
34
|
+
delegateToSpecialist: tool({
|
|
35
|
+
description: 'Delegate a business task to a specialized swarm agent in the corporation.',
|
|
36
|
+
inputSchema: z.object({
|
|
37
|
+
task: z.string().min(10).describe('Detailed description of the task for the specialist.'),
|
|
38
|
+
agentKey: z.string().describe('The key of the specialist to use (e.g., productManager, fullStackCoder, financeAnalyst).'),
|
|
39
|
+
}),
|
|
40
|
+
execute: async ({ task, agentKey }) => {
|
|
41
|
+
emitProgress({ type: 'thinking', label: `COO delegating to ${agentKey}` });
|
|
42
|
+
const specialist = createSwarmSpecialist(agentKey);
|
|
43
|
+
const result = await specialist.run(task);
|
|
44
|
+
return { agent: agentKey, report: result };
|
|
45
|
+
},
|
|
46
|
+
}),
|
|
47
|
+
classifyAndDelegate: tool({
|
|
48
|
+
description: 'Analyze a complex business objective and automatically route it to the best specialist.',
|
|
49
|
+
inputSchema: z.object({
|
|
50
|
+
task: z.string().min(10).describe('The business objective (e.g., "Analyze why churn is increasing").'),
|
|
51
|
+
}),
|
|
52
|
+
execute: async ({ task }) => {
|
|
53
|
+
emitProgress({ type: 'thinking', label: 'COO classifying objective' });
|
|
54
|
+
const classification = await orchestrator.classifyTask(task);
|
|
55
|
+
emitProgress({ type: 'step', label: `Objective routed to ${classification.subagent}`, detail: classification.reasoning });
|
|
56
|
+
const specialist = createSwarmSpecialist(classification.subagent);
|
|
57
|
+
const result = await specialist.run(task);
|
|
58
|
+
return { agent: classification.subagent, department: classification.department, report: result };
|
|
59
|
+
},
|
|
60
|
+
}),
|
|
61
|
+
},
|
|
62
|
+
stopWhen: stepCountIs(limits.managerSteps),
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../src/agents/swarm/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,aAAa,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AACjE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,E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,2BAA2B,CAAC;AAGvD,wBAAgB,oBAAoB,eAenC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SwarmAgent } from '../../../runtime/swarm.js';
|
|
2
|
+
import { financeTools } from '../../../tools/finance.tool.js';
|
|
3
|
+
export function createFinanceAnalyst() {
|
|
4
|
+
return new SwarmAgent({
|
|
5
|
+
name: 'Finance Analyst',
|
|
6
|
+
department: 'Operations',
|
|
7
|
+
instructions: [
|
|
8
|
+
'Focus on real-time market data, P&L reporting, and business financial health.',
|
|
9
|
+
'Use Yahoo Finance for market trends and ticker quotes.',
|
|
10
|
+
'Use Stripe tools via Composio to check revenue, MRR, and payouts.',
|
|
11
|
+
'Summarize financial findings in a professional .md report.',
|
|
12
|
+
].join('\n'),
|
|
13
|
+
tools: {
|
|
14
|
+
...financeTools,
|
|
15
|
+
},
|
|
16
|
+
composioToolkits: ['stripe', 'finance'],
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=finance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finance.js","sourceRoot":"","sources":["../../../../src/agents/swarm/operations/finance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAE9D,MAAM,UAAU,oBAAoB;IAClC,OAAO,IAAI,UAAU,CAAC;QACpB,IAAI,EAAE,iBAAiB;QACvB,UAAU,EAAE,YAAY;QACxB,YAAY,EAAE;YACZ,+EAA+E;YAC/E,wDAAwD;YACxD,mEAAmE;YACnE,4DAA4D;SAC7D,CAAC,IAAI,CAAC,IAAI,CAAC;QACZ,KAAK,EAAE;YACL,GAAG,YAAY;SAChB;QACD,gBAAgB,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;KACxC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/agents/swarm/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAyB,MAAM,wBAAwB,CAAC;AA+V3E,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,cAWhD;AAED,wBAAgB,eAAe,aAE9B"}
|
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
import { SwarmAgent } from '../../runtime/swarm.js';
|
|
2
|
+
import { browserTools } from '../../tools/browser.tool.js';
|
|
3
|
+
import { financeTools } from '../../tools/finance.tool.js';
|
|
4
|
+
import { webIntelligenceTools } from '../../tools/web-intelligence.tool.js';
|
|
5
|
+
import { fileSystemTools } from '../../tools/filesystem.tool.js';
|
|
6
|
+
import { shellTools } from '../../tools/shell.tool.js';
|
|
7
|
+
import { gitTools } from '../../tools/git.tool.js';
|
|
8
|
+
import { postGenerateTool } from '../../tools/post-generate.tool.js';
|
|
9
|
+
const specialistRegistry = {
|
|
10
|
+
// ── Strategy & Leadership ───────────────────────────────────────────────
|
|
11
|
+
ceoOrchestrator: {
|
|
12
|
+
name: 'CEO Orchestrator',
|
|
13
|
+
department: 'Strategy',
|
|
14
|
+
instructions: [
|
|
15
|
+
'You are the visionary CEO of the Digital Swarm. Your role is high-level strategic alignment and multi-departmental orchestration.',
|
|
16
|
+
'OPERATING PROCEDURES:',
|
|
17
|
+
'1. Receive the user’s primary business vision and decompose it into departmental objectives.',
|
|
18
|
+
'2. Delegate technical builds to Engineering, growth tasks to Growth, and fiscal oversight to Operations.',
|
|
19
|
+
'3. Synthesize departmental reports into a single cohesive executive summary for the user.',
|
|
20
|
+
'4. Manage conflict resolution between sub-agents and ensure ROI-positive decision making.',
|
|
21
|
+
'KPIs: Business goal completion, departmental alignment, and resource efficiency.',
|
|
22
|
+
].join('\n'),
|
|
23
|
+
tools: { ...webIntelligenceTools },
|
|
24
|
+
composioToolkits: ['notion', 'linear', 'slack'],
|
|
25
|
+
},
|
|
26
|
+
productManager: {
|
|
27
|
+
name: 'Product Manager',
|
|
28
|
+
department: 'Strategy',
|
|
29
|
+
instructions: [
|
|
30
|
+
'You are the lead Product Manager responsible for feature specs, roadmap velocity, and project management.',
|
|
31
|
+
'OPERATING PROCEDURES:',
|
|
32
|
+
'1. Break down business goals into actionable Linear/Jira tickets via Composio.',
|
|
33
|
+
'2. Write detailed technical specifications for the Architect and Full-Stack Coder.',
|
|
34
|
+
'3. Prioritize the backlog based on user feedback (UX Researcher) and market conditions (Market Analyst).',
|
|
35
|
+
'4. Verify that completed PRs align with the original product vision.',
|
|
36
|
+
'KPIs: Sprint velocity, feature accuracy, and roadmap health.',
|
|
37
|
+
].join('\n'),
|
|
38
|
+
tools: { ...webIntelligenceTools },
|
|
39
|
+
composioToolkits: ['linear', 'github', 'notion'],
|
|
40
|
+
},
|
|
41
|
+
marketAnalyst: {
|
|
42
|
+
name: 'Market Analyst',
|
|
43
|
+
department: 'Strategy',
|
|
44
|
+
instructions: [
|
|
45
|
+
'You are a high-fidelity Market Intelligence Specialist focused on competitive research and positioning.',
|
|
46
|
+
'OPERATING PROCEDURES:',
|
|
47
|
+
'1. Use Firecrawl (Composio) to recursively crawl competitor sites and extract pricing, features, and marketing angles.',
|
|
48
|
+
'2. Perform SWOT analyses for any new feature or market entry proposal.',
|
|
49
|
+
'3. Monitor industry trends via Web Search and identify emerging threats.',
|
|
50
|
+
'4. Pass competitive intelligence to the SEO Expert and Content Writer for tactical response.',
|
|
51
|
+
'KPIs: Insight accuracy, identification of market gaps, and competitor response speed.',
|
|
52
|
+
].join('\n'),
|
|
53
|
+
tools: { ...webIntelligenceTools },
|
|
54
|
+
composioToolkits: ['firecrawl', 'tavily', 'crunchbase'],
|
|
55
|
+
},
|
|
56
|
+
uxResearcher: {
|
|
57
|
+
name: 'UX Researcher',
|
|
58
|
+
department: 'Strategy',
|
|
59
|
+
instructions: [
|
|
60
|
+
'You are the user experience guardian. You use visual and data-driven methods to optimize the product flow.',
|
|
61
|
+
'OPERATING PROCEDURES:',
|
|
62
|
+
'1. Analyze user session data and feedback from GitHub issues or support logs.',
|
|
63
|
+
'2. Use Browser tools to "Shadow User" the production environment, taking screenshots for UI auditing.',
|
|
64
|
+
'3. Compare live implementations against Figma/design-md specs using Vision models.',
|
|
65
|
+
'4. Propose surgical UI improvements to the Product Manager supported by visual evidence.',
|
|
66
|
+
'KPIs: User friction reduction, design-to-production consistency, and CSAT impact.',
|
|
67
|
+
].join('\n'),
|
|
68
|
+
tools: { ...browserTools },
|
|
69
|
+
composioToolkits: ['github', 'figma', 'intercom'],
|
|
70
|
+
},
|
|
71
|
+
// ── Engineering & Creative ──────────────────────────────────────────────
|
|
72
|
+
architect: {
|
|
73
|
+
name: 'Architect',
|
|
74
|
+
department: 'Engineering',
|
|
75
|
+
instructions: [
|
|
76
|
+
'You are the Lead Systems Architect responsible for the technical integrity of the corporation.',
|
|
77
|
+
'OPERATING PROCEDURES:',
|
|
78
|
+
'1. Design system schemas, database ERDs, and API contracts for the Coder to follow.',
|
|
79
|
+
'2. Review Pull Requests specifically for architectural consistency and security vulnerabilities.',
|
|
80
|
+
'3. Maintain the technical documentation and ADRs (Architecture Decision Records) in Notion.',
|
|
81
|
+
'4. Plan infrastructure scaling with the DevOps SRE.',
|
|
82
|
+
'KPIs: System uptime potential, technical debt reduction, and implementation speed.',
|
|
83
|
+
].join('\n'),
|
|
84
|
+
tools: { ...fileSystemTools },
|
|
85
|
+
composioToolkits: ['github', 'notion', 'supabase'],
|
|
86
|
+
},
|
|
87
|
+
fullStackCoder: {
|
|
88
|
+
name: 'Full-Stack Coder',
|
|
89
|
+
department: 'Engineering',
|
|
90
|
+
instructions: [
|
|
91
|
+
'You are a surgical implementation specialist. You build, patch, and refactor codebases with precision.',
|
|
92
|
+
'OPERATING PROCEDURES:',
|
|
93
|
+
'1. Implement feature specs from the PM and Architect using Git and Shell tools.',
|
|
94
|
+
'2. Prioritize unified patches for surgical edits over entire file rewrites.',
|
|
95
|
+
'3. Self-correct build/type failures by analyzing terminal output and fixing in-place.',
|
|
96
|
+
'4. Submit detailed PRs that explain both the "What" and "How" of the changes.',
|
|
97
|
+
'KPIs: Implementation speed, bug-to-code ratio, and merge success rate.',
|
|
98
|
+
].join('\n'),
|
|
99
|
+
tools: { ...fileSystemTools, ...shellTools, ...gitTools },
|
|
100
|
+
composioToolkits: ['github'],
|
|
101
|
+
},
|
|
102
|
+
qaEngineer: {
|
|
103
|
+
name: 'QA Engineer',
|
|
104
|
+
department: 'Engineering',
|
|
105
|
+
instructions: [
|
|
106
|
+
'You are the lead Quality Assurance Engineer. You ensure nothing breaks before it hits production.',
|
|
107
|
+
'OPERATING PROCEDURES:',
|
|
108
|
+
'1. Build and run Playwright-based automated test suites for every new feature.',
|
|
109
|
+
'2. Reproduce user-reported bugs from GitHub Issues autonomously using browser tools.',
|
|
110
|
+
'3. Use Visual Reasoning to verify UI state and layout against design specs.',
|
|
111
|
+
'4. Block the CEO from approving deployments if critical tests fail.',
|
|
112
|
+
'KPIs: Test coverage, bug leakage to production, and regression detection.',
|
|
113
|
+
].join('\n'),
|
|
114
|
+
tools: { ...browserTools },
|
|
115
|
+
composioToolkits: ['github', 'sentry'],
|
|
116
|
+
},
|
|
117
|
+
devopsSre: {
|
|
118
|
+
name: 'DevOps SRE',
|
|
119
|
+
department: 'Engineering',
|
|
120
|
+
instructions: [
|
|
121
|
+
'You are the Site Reliability Engineer responsible for infrastructure, CI/CD, and monitoring.',
|
|
122
|
+
'OPERATING PROCEDURES:',
|
|
123
|
+
'1. Manage GitHub Action workflows and ensure pipeline health.',
|
|
124
|
+
'2. Monitor production logs (Sentry/Datadog) and fix infrastructure anomalies proactively.',
|
|
125
|
+
'3. Optimize cloud costs and resource allocation for the CTO.',
|
|
126
|
+
'4. Manage secrets and secure environment variables.',
|
|
127
|
+
'KPIs: 99.9% uptime, pipeline speed, and mean time to recovery (MTTR).',
|
|
128
|
+
].join('\n'),
|
|
129
|
+
tools: { ...shellTools },
|
|
130
|
+
composioToolkits: ['github', 'sentry', 'datadog', 'vercel'],
|
|
131
|
+
},
|
|
132
|
+
creativeDirector: {
|
|
133
|
+
name: 'Creative Director',
|
|
134
|
+
department: 'Engineering',
|
|
135
|
+
instructions: [
|
|
136
|
+
'You manage the brand identity and visual assets of the corporation.',
|
|
137
|
+
'OPERATING PROCEDURES:',
|
|
138
|
+
'1. Generate professional image assets for marketing and UI using Image Intelligence tools.',
|
|
139
|
+
'2. Use background removal and image editing tools to prep high-quality PNGs.',
|
|
140
|
+
'3. Audit the UI (via UX Researcher) for brand alignment and color consistency.',
|
|
141
|
+
'4. Design high-converting ad creatives for the Ads Manager.',
|
|
142
|
+
'KPIs: Asset production speed, brand consistency score, and ad creative performance.',
|
|
143
|
+
].join('\n'),
|
|
144
|
+
tools: { ...browserTools },
|
|
145
|
+
composioToolkits: ['figma', 'unsplash', 'canva'],
|
|
146
|
+
},
|
|
147
|
+
// ── Growth & Marketing ──────────────────────────────────────────────────
|
|
148
|
+
growthHacker: {
|
|
149
|
+
name: 'Growth Hacker',
|
|
150
|
+
department: 'Growth',
|
|
151
|
+
instructions: [
|
|
152
|
+
'You are an experimentalist focused on the acquisition and conversion funnel.',
|
|
153
|
+
'OPERATING PROCEDURES:',
|
|
154
|
+
'1. Analyze GA4/Search Console data via Composio to find drop-off points.',
|
|
155
|
+
'2. Run A/B tests on landing pages using Browser tools to implement variant scripts.',
|
|
156
|
+
'3. Use Firecrawl to extract competitor growth loops (referral plans, viral hooks).',
|
|
157
|
+
'4. Correlate growth experiments with real-time ROI via the Financial Ledger.',
|
|
158
|
+
'KPIs: Conversion rate (CR), viral coefficient, and LTV/CAC ratio.',
|
|
159
|
+
].join('\n'),
|
|
160
|
+
tools: { ...browserTools },
|
|
161
|
+
composioToolkits: ['google_analytics', 'firecrawl', 'mixpanel'],
|
|
162
|
+
},
|
|
163
|
+
seoExpert: {
|
|
164
|
+
name: 'SEO Expert',
|
|
165
|
+
department: 'Growth',
|
|
166
|
+
instructions: [
|
|
167
|
+
'You are the organic visibility strategist responsible for search dominance.',
|
|
168
|
+
'OPERATING PROCEDURES:',
|
|
169
|
+
'1. Audit technical site health using Firecrawl and Search Console.',
|
|
170
|
+
'2. Research keyword opportunities and monitor rankings daily.',
|
|
171
|
+
'3. Assign content topics to the Content Writer based on search volume/difficulty.',
|
|
172
|
+
'4. Optimize on-page metadata and internal linking autonomously.',
|
|
173
|
+
'KPIs: Organic traffic, keyword rankings, and technical SEO score.',
|
|
174
|
+
].join('\n'),
|
|
175
|
+
tools: { ...webIntelligenceTools },
|
|
176
|
+
composioToolkits: ['google_search_console', 'firecrawl', 'semrush'],
|
|
177
|
+
},
|
|
178
|
+
contentWriter: {
|
|
179
|
+
name: 'Content Writer',
|
|
180
|
+
department: 'Growth',
|
|
181
|
+
instructions: [
|
|
182
|
+
'You are a lead content strategist responsible for blog, social, and newsletter copy.',
|
|
183
|
+
'OPERATING PROCEDURES:',
|
|
184
|
+
'1. Draft SEO-optimized articles based on topics provided by the SEO Expert.',
|
|
185
|
+
'2. Use the Post Subagent to generate multi-channel social variants (Twitter, LinkedIn).',
|
|
186
|
+
'3. Publish content directly to WordPress/Ghost/Medium via Composio.',
|
|
187
|
+
'4. Maintain a consistent and high-quality brand voice across all distribution.',
|
|
188
|
+
'KPIs: Content volume, engagement rate, and search ranking impact.',
|
|
189
|
+
].join('\n'),
|
|
190
|
+
tools: { postGenerateTool },
|
|
191
|
+
composioToolkits: ['wordpress', 'ghost', 'medium', 'notion'],
|
|
192
|
+
},
|
|
193
|
+
socialMediaManager: {
|
|
194
|
+
name: 'Social Media Manager',
|
|
195
|
+
department: 'Growth',
|
|
196
|
+
instructions: [
|
|
197
|
+
'You manage the brand’s community presence and social distribution.',
|
|
198
|
+
'OPERATING PROCEDURES:',
|
|
199
|
+
'1. Distribute content from the Content Writer across Twitter, LinkedIn, and Discord.',
|
|
200
|
+
'2. Engage with brand mentions and handle community outreach.',
|
|
201
|
+
'3. Run social-first growth campaigns (giveaways, polls, threads).',
|
|
202
|
+
'4. Monitor community sentiment and report feedback to the UX Researcher.',
|
|
203
|
+
'KPIs: Social follower growth, engagement metrics, and community sentiment.',
|
|
204
|
+
].join('\n'),
|
|
205
|
+
tools: { postGenerateTool },
|
|
206
|
+
composioToolkits: ['twitter', 'linkedin', 'discord', 'reddit'],
|
|
207
|
+
},
|
|
208
|
+
adsManager: {
|
|
209
|
+
name: 'Ads Manager',
|
|
210
|
+
department: 'Growth',
|
|
211
|
+
instructions: [
|
|
212
|
+
'You are the performance marketer responsible for paid growth and ROAS.',
|
|
213
|
+
'OPERATING PROCEDURES:',
|
|
214
|
+
'1. Launch and optimize search/social ad campaigns (Google/Meta).',
|
|
215
|
+
'2. Perform keyword bidding analysis and adjust budgets for maximum efficiency.',
|
|
216
|
+
'3. Analyze ad creative performance and request new assets from the Creative Director.',
|
|
217
|
+
'4. Report real-time ROAS (Return on Ad Spend) to the CFO.',
|
|
218
|
+
'KPIs: ROAS, cost per acquisition (CPA), and paid conversion volume.',
|
|
219
|
+
].join('\n'),
|
|
220
|
+
tools: { ...webIntelligenceTools },
|
|
221
|
+
composioToolkits: ['google_ads', 'meta_ads', 'linkedin_ads'],
|
|
222
|
+
},
|
|
223
|
+
salesOps: {
|
|
224
|
+
name: 'Sales Ops',
|
|
225
|
+
department: 'Growth',
|
|
226
|
+
instructions: [
|
|
227
|
+
'You manage the outbound pipeline, lead scoring, and CRM health.',
|
|
228
|
+
'OPERATING PROCEDURES:',
|
|
229
|
+
'1. Sourcing and enrich leads from LinkedIn/Apollo via Composio.',
|
|
230
|
+
'2. Automate outreach sequences in HubSpot/Salesforce and track responses.',
|
|
231
|
+
'3. Build automated reporting for lead-to-deal conversion velocity.',
|
|
232
|
+
'4. Coordinate with Finance Analyst to ensure customer billing is correct.',
|
|
233
|
+
'KPIs: Pipeline size, deal velocity, and lead conversion rate.',
|
|
234
|
+
].join('\n'),
|
|
235
|
+
tools: { ...webIntelligenceTools },
|
|
236
|
+
composioToolkits: ['hubspot', 'salesforce', 'apollo', 'gmail'],
|
|
237
|
+
},
|
|
238
|
+
// ── Operations & People ─────────────────────────────────────────────────
|
|
239
|
+
financeAnalyst: {
|
|
240
|
+
name: 'Finance Analyst',
|
|
241
|
+
department: 'Operations',
|
|
242
|
+
instructions: [
|
|
243
|
+
'You are the lead Financial Analyst responsible for P&L tracking and fiscal reporting.',
|
|
244
|
+
'OPERATING PROCEDURES:',
|
|
245
|
+
'1. Monitor MRR, net revenue, and payout statuses via Stripe tools.',
|
|
246
|
+
'2. Use Yahoo Finance to track market conditions that impact business strategy.',
|
|
247
|
+
'3. Use the Cross-App Ledger to correlate growth spend with revenue performance.',
|
|
248
|
+
'4. Generate weekly financial briefs for the CFO and CEO.',
|
|
249
|
+
'KPIs: Revenue reporting speed, burn rate accuracy, and ROI tracking precision.',
|
|
250
|
+
].join('\n'),
|
|
251
|
+
tools: { ...financeTools },
|
|
252
|
+
composioToolkits: ['stripe', 'finance', 'quickbooks'],
|
|
253
|
+
},
|
|
254
|
+
customerSuccess: {
|
|
255
|
+
name: 'Customer Success',
|
|
256
|
+
department: 'Operations',
|
|
257
|
+
instructions: [
|
|
258
|
+
'You are the customer advocate. You resolve tickets and improve retention.',
|
|
259
|
+
'OPERATING PROCEDURES:',
|
|
260
|
+
'1. Monitor and resolve support tickets in Zendesk/Intercom using Zilo docs.',
|
|
261
|
+
'2. Manage Slack/Discord support channels and ensure fast resolution times.',
|
|
262
|
+
'3. Gather and categorize feature requests for the Product Manager.',
|
|
263
|
+
'4. Proactively reach out to "at-risk" customers (low usage/payment fail).',
|
|
264
|
+
'KPIs: Mean time to resolution (MTTR), CSAT, and churn rate impact.',
|
|
265
|
+
].join('\n'),
|
|
266
|
+
tools: { ...webIntelligenceTools },
|
|
267
|
+
composioToolkits: ['zendesk', 'intercom', 'slack', 'discord'],
|
|
268
|
+
},
|
|
269
|
+
legalCounsel: {
|
|
270
|
+
name: 'Legal Counsel',
|
|
271
|
+
department: 'Operations',
|
|
272
|
+
instructions: [
|
|
273
|
+
'You are the compliance and legal specialist responsible for risk management.',
|
|
274
|
+
'OPERATING PROCEDURES:',
|
|
275
|
+
'1. Audit contracts and docs for compliance with GDPR, SOC2, and internal policy.',
|
|
276
|
+
'2. Manage document signing and execution via DocuSign (Composio).',
|
|
277
|
+
'3. Maintain the company Privacy Policy and Terms of Service.',
|
|
278
|
+
'4. Provide risk assessments for all new vendor integrations.',
|
|
279
|
+
'KPIs: Audit success rate, contract turnaround time, and risk reduction score.',
|
|
280
|
+
].join('\n'),
|
|
281
|
+
tools: { ...webIntelligenceTools },
|
|
282
|
+
composioToolkits: ['docusign', 'github', 'notion'],
|
|
283
|
+
},
|
|
284
|
+
logisticsLead: {
|
|
285
|
+
name: 'Logistics Lead',
|
|
286
|
+
department: 'Operations',
|
|
287
|
+
instructions: [
|
|
288
|
+
'You manage the physical supply chain and order fulfillment pipelines.',
|
|
289
|
+
'OPERATING PROCEDURES:',
|
|
290
|
+
'1. Monitor inventory levels in Shopify and trigger restocks proactively.',
|
|
291
|
+
'2. Resolve shipping delays via UPS/FedEx toolkits and notify Customers.',
|
|
292
|
+
'3. Optimize shipping costs and vendor relationships.',
|
|
293
|
+
'4. Coordinate returns and warehouse logistics.',
|
|
294
|
+
'KPIs: Fulfillment accuracy, shipping time, and inventory turnover.',
|
|
295
|
+
].join('\n'),
|
|
296
|
+
tools: { ...webIntelligenceTools },
|
|
297
|
+
composioToolkits: ['shopify', 'ups', 'fedex'],
|
|
298
|
+
},
|
|
299
|
+
hrRecruiter: {
|
|
300
|
+
name: 'HR Recruiter',
|
|
301
|
+
department: 'Operations',
|
|
302
|
+
instructions: [
|
|
303
|
+
'You manage talent sourcing and internal agent performance for the swarm.',
|
|
304
|
+
'OPERATING PROCEDURES:',
|
|
305
|
+
'1. Sourcing agent skills or technical talent via LinkedIn/Greenhouse.',
|
|
306
|
+
'2. Manage the onboarding and offboarding workflows.',
|
|
307
|
+
'3. Audit agent performance (error rates/token health) and propose role swaps.',
|
|
308
|
+
'4. Coordinate team-wide OKR tracking in Notion.',
|
|
309
|
+
'KPIs: Time-to-hire, agent uptime, and organizational efficiency.',
|
|
310
|
+
].join('\n'),
|
|
311
|
+
tools: { ...webIntelligenceTools },
|
|
312
|
+
composioToolkits: ['greenhouse', 'linkedin', 'notion'],
|
|
313
|
+
},
|
|
314
|
+
// ── Data & Intelligence ─────────────────────────────────────────────────
|
|
315
|
+
dataScientist: {
|
|
316
|
+
name: 'Data Scientist',
|
|
317
|
+
department: 'Data',
|
|
318
|
+
instructions: [
|
|
319
|
+
'You provide the "Quantitative Truth" that drives the business.',
|
|
320
|
+
'OPERATING PROCEDURES:',
|
|
321
|
+
'1. Build and run SQL queries across BigQuery/PostgreSQL/Snowflake.',
|
|
322
|
+
'2. Create predictive models for churn forecasting and revenue projection.',
|
|
323
|
+
'3. Clean and process multi-departmental data for executive reporting.',
|
|
324
|
+
'4. Correlate growth experiments with long-term retention data.',
|
|
325
|
+
'KPIs: Data accuracy, insight depth, and forecasting precision.',
|
|
326
|
+
].join('\n'),
|
|
327
|
+
tools: { ...shellTools },
|
|
328
|
+
composioToolkits: ['snowflake', 'bigquery', 'postgresql'],
|
|
329
|
+
},
|
|
330
|
+
biReporter: {
|
|
331
|
+
name: 'BI Reporter',
|
|
332
|
+
department: 'Data',
|
|
333
|
+
instructions: [
|
|
334
|
+
'You are the lead storyteller responsible for executive dashboards and reporting.',
|
|
335
|
+
'OPERATING PROCEDURES:',
|
|
336
|
+
'1. Synthesize complex data from the Data Scientist into professional summaries.',
|
|
337
|
+
'2. Generate Slide Decks and PDF briefings for the CEO’s Weekly Review.',
|
|
338
|
+
'3. Automate KPI tracking dashboards in Notion or GitHub Wikis.',
|
|
339
|
+
'4. Flag strategic business anomalies to the CEO before they become crises.',
|
|
340
|
+
'KPIs: Reporting timeliness, narrative clarity, and dashboard utility.',
|
|
341
|
+
].join('\n'),
|
|
342
|
+
tools: { ...webIntelligenceTools },
|
|
343
|
+
composioToolkits: ['github', 'notion', 'slack'],
|
|
344
|
+
},
|
|
345
|
+
};
|
|
346
|
+
export function createSwarmSpecialist(key) {
|
|
347
|
+
const config = specialistRegistry[key];
|
|
348
|
+
if (!config) {
|
|
349
|
+
return new SwarmAgent({
|
|
350
|
+
name: 'Business Operator',
|
|
351
|
+
department: 'Operations',
|
|
352
|
+
instructions: 'Handle general business operational tasks using available tools.',
|
|
353
|
+
tools: { ...webIntelligenceTools, ...financeTools },
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
return new SwarmAgent(config);
|
|
357
|
+
}
|
|
358
|
+
export function listSpecialists() {
|
|
359
|
+
return Object.keys(specialistRegistry);
|
|
360
|
+
}
|
|
361
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/agents/swarm/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAyB,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE,MAAM,kBAAkB,GAAqC;IAC3D,2EAA2E;IAC3E,eAAe,EAAE;QACf,IAAI,EAAE,kBAAkB;QACxB,UAAU,EAAE,UAAU;QACtB,YAAY,EAAE;YACZ,mIAAmI;YACnI,uBAAuB;YACvB,8FAA8F;YAC9F,0GAA0G;YAC1G,2FAA2F;YAC3F,2FAA2F;YAC3F,kFAAkF;SACnF,CAAC,IAAI,CAAC,IAAI,CAAC;QACZ,KAAK,EAAE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AkB,CAAC,GAAG,CAAC,CAAC;IACvC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,IAAI,UAAU,CAAC;YACpB,IAAI,EAAE,mBAAmB;YACzB,UAAU,EAAE,YAAY;YACxB,YAAY,EAAE,kEAAkE;YAChF,KAAK,EAAE,EAAE,GAAG,oBAAoB,EAAE,GAAG,YAAY,EAAE;SACpD,CAAC,CAAC;IACL,CAAC;IACD,OAAO,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,OAAO,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/cli/chat.ts"],"names":[],"mappings":"AAQA,wBAAsB,iBAAiB,kBA8DtC"}
|
package/dist/cli/chat.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Chat } from "chat";
|
|
2
|
+
import { createSlackAdapter } from "@chat-adapter/slack";
|
|
3
|
+
import { createTelegramAdapter } from "@chat-adapter/telegram";
|
|
4
|
+
import { createiMessageAdapter } from "chat-adapter-imessage";
|
|
5
|
+
import { handleChatMessage } from "../runtime/chat-bridge.js";
|
|
6
|
+
import { env, hasChatIntegration } from "../config/env.js";
|
|
7
|
+
import chalk from "chalk";
|
|
8
|
+
export async function startChatListener() {
|
|
9
|
+
if (!hasChatIntegration()) {
|
|
10
|
+
throw new Error("Chat integration is not configured. Run 'zilmate setup chat' first.");
|
|
11
|
+
}
|
|
12
|
+
console.log(chalk.cyan("\nStarting ZilMate Chat Listener..."));
|
|
13
|
+
const adapters = {};
|
|
14
|
+
if (env.slackBotToken) {
|
|
15
|
+
console.log(chalk.green(" - Slack adapter enabled"));
|
|
16
|
+
adapters.slack = createSlackAdapter({
|
|
17
|
+
token: env.slackBotToken,
|
|
18
|
+
signingSecret: env.slackSigningSecret,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
if (env.telegramBotToken) {
|
|
22
|
+
console.log(chalk.green(" - Telegram adapter enabled"));
|
|
23
|
+
adapters.telegram = createTelegramAdapter({
|
|
24
|
+
token: env.telegramBotToken,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
if (env.imessageEnabled) {
|
|
28
|
+
console.log(chalk.green(` - iMessage adapter enabled (${env.imessageLocal ? 'Local' : 'Remote'})`));
|
|
29
|
+
adapters.imessage = createiMessageAdapter({
|
|
30
|
+
local: env.imessageLocal,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
const bot = new Chat({
|
|
34
|
+
userName: "ZilMate",
|
|
35
|
+
adapters,
|
|
36
|
+
});
|
|
37
|
+
bot.onNewMention(async (thread, message) => {
|
|
38
|
+
const platform = message.adapter.name;
|
|
39
|
+
console.log(chalk.gray(`[${platform}] New message from ${message.author.id}`));
|
|
40
|
+
try {
|
|
41
|
+
await handleChatMessage({
|
|
42
|
+
text: message.text,
|
|
43
|
+
authorId: message.author.id,
|
|
44
|
+
platform,
|
|
45
|
+
threadId: thread.id,
|
|
46
|
+
onReply: (text) => thread.post(text),
|
|
47
|
+
onStep: async (label) => {
|
|
48
|
+
// You could send progress updates here, but it might be noisy for chat
|
|
49
|
+
// thread.post(`_Thinking: ${label}_`);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
console.error(chalk.red(`Error handling message: ${error}`));
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
console.log(chalk.yellow("\nZilMate is now listening for messages. Press Ctrl+C to stop."));
|
|
58
|
+
// Keep the process alive
|
|
59
|
+
await new Promise(() => { });
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=chat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat.js","sourceRoot":"","sources":["../../src/cli/chat.ts"],"names":[],"mappings":"AAAA,OAAO,E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I,OAAO,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composer.d.ts","sourceRoot":"","sources":["../../src/cli/composer.ts"],"names":[],"mappings":"AACA,OAAO,QAAQ,MAAM,wBAAwB,CAAC;AAG9C,wBAAsB,gBAAgB,CACpC,EAAE,EAAE,QAAQ,CAAC,SAAS,EACtB,WAAW,SAAsD,GAChE,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"composer.d.ts","sourceRoot":"","sources":["../../src/cli/composer.ts"],"names":[],"mappings":"AACA,OAAO,QAAQ,MAAM,wBAAwB,CAAC;AAG9C,wBAAsB,gBAAgB,CACpC,EAAE,EAAE,QAAQ,CAAC,SAAS,EACtB,WAAW,SAAsD,GAChE,OAAO,CAAC,MAAM,CAAC,CAwEjB"}
|
package/dist/cli/composer.js
CHANGED
|
@@ -1,11 +1,61 @@
|
|
|
1
|
-
import { theme, termWidth, boxLine } from './theme.js';
|
|
1
|
+
import { theme, termWidth, boxLine, wrapText } from './theme.js';
|
|
2
2
|
export async function readComposerLine(rl, placeholder = 'Try "plan my week" or "build a Next.js dashboard"') {
|
|
3
3
|
const w = termWidth(92);
|
|
4
|
+
let lines = [];
|
|
4
5
|
console.log('');
|
|
5
6
|
console.log(boxLine('top', w));
|
|
6
7
|
console.log(theme.accent('│ ') + theme.dim(placeholder));
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
let multilineMode = false;
|
|
9
|
+
while (true) {
|
|
10
|
+
const promptPrefix = theme.accent('│ ') + theme.brandBright(lines.length === 0 ? '> ' : ' ');
|
|
11
|
+
const answer = await rl.question(promptPrefix);
|
|
12
|
+
const trimmed = answer.trim();
|
|
13
|
+
if (lines.length === 0 && (trimmed === '/multiline' || trimmed === '/paste')) {
|
|
14
|
+
multilineMode = true;
|
|
15
|
+
console.log(theme.accent('│ ') + theme.muted(' (Multiline mode: Type your message. Send an empty line to finish.)'));
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
if (multilineMode) {
|
|
19
|
+
if (!trimmed)
|
|
20
|
+
break;
|
|
21
|
+
lines.push(answer);
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
if (trimmed.endsWith('\\')) {
|
|
25
|
+
lines.push(answer.slice(0, -1));
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
lines.push(answer);
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
const finalMessage = lines.join('\n');
|
|
32
|
+
// Calculate how many terminal lines we need to clear.
|
|
33
|
+
// This is tricky because the user input might wrap.
|
|
34
|
+
const promptLen = 4; // length of "│ > "
|
|
35
|
+
let linesUsed = 1; // Initial newline at top
|
|
36
|
+
linesUsed += 1; // boxLine('top')
|
|
37
|
+
linesUsed += 1; // placeholder line
|
|
38
|
+
if (multilineMode) {
|
|
39
|
+
linesUsed += 1; // The "(Multiline mode...)" hint line
|
|
40
|
+
}
|
|
41
|
+
for (let i = 0; i < lines.length; i++) {
|
|
42
|
+
const line = lines[i];
|
|
43
|
+
if (line !== undefined) {
|
|
44
|
+
const wrapped = wrapText(line, w - promptLen);
|
|
45
|
+
linesUsed += Math.max(1, wrapped.length);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (multilineMode) {
|
|
49
|
+
linesUsed += 1; // The final empty line entered to exit multiline mode
|
|
50
|
+
}
|
|
51
|
+
// Account for the fact that we might have had the command line /multiline too
|
|
52
|
+
if (multilineMode) {
|
|
53
|
+
linesUsed += 1;
|
|
54
|
+
}
|
|
55
|
+
// Clear everything we just printed to replace it with the pretty box
|
|
56
|
+
for (let i = 0; i < linesUsed; i++) {
|
|
57
|
+
process.stdout.write('\x1b[1A\x1b[2K');
|
|
58
|
+
}
|
|
59
|
+
return finalMessage;
|
|
10
60
|
}
|
|
11
61
|
//# sourceMappingURL=composer.js.map
|