wispy-ai 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +20 -0
- package/LICENSE +21 -0
- package/README.md +232 -0
- package/bin/wispy.js +3 -0
- package/dist/a2a/delegation.d.ts +19 -0
- package/dist/a2a/delegation.d.ts.map +1 -0
- package/dist/a2a/delegation.js +156 -0
- package/dist/a2a/delegation.js.map +1 -0
- package/dist/a2a/peer.d.ts +19 -0
- package/dist/a2a/peer.d.ts.map +1 -0
- package/dist/a2a/peer.js +27 -0
- package/dist/a2a/peer.js.map +1 -0
- package/dist/a2a/protocol.d.ts +36 -0
- package/dist/a2a/protocol.d.ts.map +1 -0
- package/dist/a2a/protocol.js +23 -0
- package/dist/a2a/protocol.js.map +1 -0
- package/dist/agents/collaboration.d.ts +59 -0
- package/dist/agents/collaboration.d.ts.map +1 -0
- package/dist/agents/collaboration.js +110 -0
- package/dist/agents/collaboration.js.map +1 -0
- package/dist/agents/orchestrator.d.ts +59 -0
- package/dist/agents/orchestrator.d.ts.map +1 -0
- package/dist/agents/orchestrator.js +171 -0
- package/dist/agents/orchestrator.js.map +1 -0
- package/dist/agents/tool-executor.d.ts +36 -0
- package/dist/agents/tool-executor.d.ts.map +1 -0
- package/dist/agents/tool-executor.js +363 -0
- package/dist/agents/tool-executor.js.map +1 -0
- package/dist/agents/types/coder.d.ts +10 -0
- package/dist/agents/types/coder.d.ts.map +1 -0
- package/dist/agents/types/coder.js +43 -0
- package/dist/agents/types/coder.js.map +1 -0
- package/dist/agents/types/data.d.ts +7 -0
- package/dist/agents/types/data.d.ts.map +1 -0
- package/dist/agents/types/data.js +30 -0
- package/dist/agents/types/data.js.map +1 -0
- package/dist/agents/types/designer.d.ts +7 -0
- package/dist/agents/types/designer.d.ts.map +1 -0
- package/dist/agents/types/designer.js +30 -0
- package/dist/agents/types/designer.js.map +1 -0
- package/dist/agents/types/devops.d.ts +7 -0
- package/dist/agents/types/devops.d.ts.map +1 -0
- package/dist/agents/types/devops.js +30 -0
- package/dist/agents/types/devops.js.map +1 -0
- package/dist/agents/types/planner.d.ts +7 -0
- package/dist/agents/types/planner.d.ts.map +1 -0
- package/dist/agents/types/planner.js +35 -0
- package/dist/agents/types/planner.js.map +1 -0
- package/dist/agents/types/researcher.d.ts +10 -0
- package/dist/agents/types/researcher.d.ts.map +1 -0
- package/dist/agents/types/researcher.js +33 -0
- package/dist/agents/types/researcher.js.map +1 -0
- package/dist/agents/types/security.d.ts +7 -0
- package/dist/agents/types/security.d.ts.map +1 -0
- package/dist/agents/types/security.js +30 -0
- package/dist/agents/types/security.js.map +1 -0
- package/dist/agents/types/writer.d.ts +7 -0
- package/dist/agents/types/writer.d.ts.map +1 -0
- package/dist/agents/types/writer.js +30 -0
- package/dist/agents/types/writer.js.map +1 -0
- package/dist/agents/workspace.d.ts +61 -0
- package/dist/agents/workspace.d.ts.map +1 -0
- package/dist/agents/workspace.js +115 -0
- package/dist/agents/workspace.js.map +1 -0
- package/dist/ai/embeddings.d.ts +4 -0
- package/dist/ai/embeddings.d.ts.map +1 -0
- package/dist/ai/embeddings.js +20 -0
- package/dist/ai/embeddings.js.map +1 -0
- package/dist/ai/gemini.d.ts +31 -0
- package/dist/ai/gemini.d.ts.map +1 -0
- package/dist/ai/gemini.js +121 -0
- package/dist/ai/gemini.js.map +1 -0
- package/dist/ai/model-registry.d.ts +73 -0
- package/dist/ai/model-registry.d.ts.map +1 -0
- package/dist/ai/model-registry.js +86 -0
- package/dist/ai/model-registry.js.map +1 -0
- package/dist/ai/prompts.d.ts +3 -0
- package/dist/ai/prompts.d.ts.map +1 -0
- package/dist/ai/prompts.js +42 -0
- package/dist/ai/prompts.js.map +1 -0
- package/dist/ai/providers/ollama.d.ts +22 -0
- package/dist/ai/providers/ollama.d.ts.map +1 -0
- package/dist/ai/providers/ollama.js +144 -0
- package/dist/ai/providers/ollama.js.map +1 -0
- package/dist/ai/providers/openai-compat.d.ts +25 -0
- package/dist/ai/providers/openai-compat.d.ts.map +1 -0
- package/dist/ai/providers/openai-compat.js +141 -0
- package/dist/ai/providers/openai-compat.js.map +1 -0
- package/dist/ai/router.d.ts +10 -0
- package/dist/ai/router.d.ts.map +1 -0
- package/dist/ai/router.js +23 -0
- package/dist/ai/router.js.map +1 -0
- package/dist/ai/tools.d.ts +15 -0
- package/dist/ai/tools.d.ts.map +1 -0
- package/dist/ai/tools.js +134 -0
- package/dist/ai/tools.js.map +1 -0
- package/dist/autostart/service.d.ts +24 -0
- package/dist/autostart/service.d.ts.map +1 -0
- package/dist/autostart/service.js +202 -0
- package/dist/autostart/service.js.map +1 -0
- package/dist/channels/dock.d.ts +22 -0
- package/dist/channels/dock.d.ts.map +1 -0
- package/dist/channels/dock.js +21 -0
- package/dist/channels/dock.js.map +1 -0
- package/dist/channels/rest/adapter.d.ts +4 -0
- package/dist/channels/rest/adapter.d.ts.map +1 -0
- package/dist/channels/rest/adapter.js +86 -0
- package/dist/channels/rest/adapter.js.map +1 -0
- package/dist/channels/telegram/adapter.d.ts +3 -0
- package/dist/channels/telegram/adapter.d.ts.map +1 -0
- package/dist/channels/telegram/adapter.js +56 -0
- package/dist/channels/telegram/adapter.js.map +1 -0
- package/dist/cli/commands.d.ts +17 -0
- package/dist/cli/commands.d.ts.map +1 -0
- package/dist/cli/commands.js +258 -0
- package/dist/cli/commands.js.map +1 -0
- package/dist/cli/doctor.d.ts +8 -0
- package/dist/cli/doctor.d.ts.map +1 -0
- package/dist/cli/doctor.js +34 -0
- package/dist/cli/doctor.js.map +1 -0
- package/dist/cli/history.d.ts +9 -0
- package/dist/cli/history.d.ts.map +1 -0
- package/dist/cli/history.js +32 -0
- package/dist/cli/history.js.map +1 -0
- package/dist/cli/postinstall.d.ts +5 -0
- package/dist/cli/postinstall.d.ts.map +1 -0
- package/dist/cli/postinstall.js +20 -0
- package/dist/cli/postinstall.js.map +1 -0
- package/dist/cli/program.d.ts +3 -0
- package/dist/cli/program.d.ts.map +1 -0
- package/dist/cli/program.js +537 -0
- package/dist/cli/program.js.map +1 -0
- package/dist/cli/repl.d.ts +7 -0
- package/dist/cli/repl.d.ts.map +1 -0
- package/dist/cli/repl.js +132 -0
- package/dist/cli/repl.js.map +1 -0
- package/dist/cli/setup/wizard.d.ts +17 -0
- package/dist/cli/setup/wizard.d.ts.map +1 -0
- package/dist/cli/setup/wizard.js +157 -0
- package/dist/cli/setup/wizard.js.map +1 -0
- package/dist/cli/ui/banner.d.ts +2 -0
- package/dist/cli/ui/banner.d.ts.map +1 -0
- package/dist/cli/ui/banner.js +9 -0
- package/dist/cli/ui/banner.js.map +1 -0
- package/dist/cli/ui/renderer.d.ts +6 -0
- package/dist/cli/ui/renderer.d.ts.map +1 -0
- package/dist/cli/ui/renderer.js +55 -0
- package/dist/cli/ui/renderer.js.map +1 -0
- package/dist/cli/ui/spinner.d.ts +7 -0
- package/dist/cli/ui/spinner.d.ts.map +1 -0
- package/dist/cli/ui/spinner.js +31 -0
- package/dist/cli/ui/spinner.js.map +1 -0
- package/dist/cli/ui/theme.d.ts +21 -0
- package/dist/cli/ui/theme.d.ts.map +1 -0
- package/dist/cli/ui/theme.js +28 -0
- package/dist/cli/ui/theme.js.map +1 -0
- package/dist/cli/ui/tool-display.d.ts +9 -0
- package/dist/cli/ui/tool-display.d.ts.map +1 -0
- package/dist/cli/ui/tool-display.js +19 -0
- package/dist/cli/ui/tool-display.js.map +1 -0
- package/dist/cli/voice/stt.d.ts +37 -0
- package/dist/cli/voice/stt.d.ts.map +1 -0
- package/dist/cli/voice/stt.js +115 -0
- package/dist/cli/voice/stt.js.map +1 -0
- package/dist/cli/voice/tts.d.ts +35 -0
- package/dist/cli/voice/tts.d.ts.map +1 -0
- package/dist/cli/voice/tts.js +142 -0
- package/dist/cli/voice/tts.js.map +1 -0
- package/dist/cli/voice/voice-mode.d.ts +35 -0
- package/dist/cli/voice/voice-mode.d.ts.map +1 -0
- package/dist/cli/voice/voice-mode.js +89 -0
- package/dist/cli/voice/voice-mode.js.map +1 -0
- package/dist/config/config.d.ts +5 -0
- package/dist/config/config.d.ts.map +1 -0
- package/dist/config/config.js +68 -0
- package/dist/config/config.js.map +1 -0
- package/dist/config/hot-reload.d.ts +3 -0
- package/dist/config/hot-reload.d.ts.map +1 -0
- package/dist/config/hot-reload.js +21 -0
- package/dist/config/hot-reload.js.map +1 -0
- package/dist/config/schema.d.ts +48 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +105 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/content/pipeline.d.ts +12 -0
- package/dist/content/pipeline.d.ts.map +1 -0
- package/dist/content/pipeline.js +55 -0
- package/dist/content/pipeline.js.map +1 -0
- package/dist/content/publisher.d.ts +26 -0
- package/dist/content/publisher.d.ts.map +1 -0
- package/dist/content/publisher.js +101 -0
- package/dist/content/publisher.js.map +1 -0
- package/dist/core/agent.d.ts +37 -0
- package/dist/core/agent.d.ts.map +1 -0
- package/dist/core/agent.js +170 -0
- package/dist/core/agent.js.map +1 -0
- package/dist/core/heartbeat.d.ts +15 -0
- package/dist/core/heartbeat.d.ts.map +1 -0
- package/dist/core/heartbeat.js +70 -0
- package/dist/core/heartbeat.js.map +1 -0
- package/dist/core/identity.d.ts +13 -0
- package/dist/core/identity.d.ts.map +1 -0
- package/dist/core/identity.js +16 -0
- package/dist/core/identity.js.map +1 -0
- package/dist/core/memory.d.ts +11 -0
- package/dist/core/memory.d.ts.map +1 -0
- package/dist/core/memory.js +58 -0
- package/dist/core/memory.js.map +1 -0
- package/dist/core/session.d.ts +29 -0
- package/dist/core/session.d.ts.map +1 -0
- package/dist/core/session.js +59 -0
- package/dist/core/session.js.map +1 -0
- package/dist/core/thinking.d.ts +3 -0
- package/dist/core/thinking.d.ts.map +1 -0
- package/dist/core/thinking.js +27 -0
- package/dist/core/thinking.js.map +1 -0
- package/dist/cron/service.d.ts +24 -0
- package/dist/cron/service.d.ts.map +1 -0
- package/dist/cron/service.js +74 -0
- package/dist/cron/service.js.map +1 -0
- package/dist/entry.d.ts +2 -0
- package/dist/entry.d.ts.map +1 -0
- package/dist/entry.js +26 -0
- package/dist/entry.js.map +1 -0
- package/dist/gateway/boot.d.ts +9 -0
- package/dist/gateway/boot.d.ts.map +1 -0
- package/dist/gateway/boot.js +64 -0
- package/dist/gateway/boot.js.map +1 -0
- package/dist/gateway/client.d.ts +19 -0
- package/dist/gateway/client.d.ts.map +1 -0
- package/dist/gateway/client.js +64 -0
- package/dist/gateway/client.js.map +1 -0
- package/dist/gateway/protocol/index.d.ts +41 -0
- package/dist/gateway/protocol/index.d.ts.map +1 -0
- package/dist/gateway/protocol/index.js +30 -0
- package/dist/gateway/protocol/index.js.map +1 -0
- package/dist/gateway/server.d.ts +9 -0
- package/dist/gateway/server.d.ts.map +1 -0
- package/dist/gateway/server.js +147 -0
- package/dist/gateway/server.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/infra/dotenv.d.ts +2 -0
- package/dist/infra/dotenv.d.ts.map +1 -0
- package/dist/infra/dotenv.js +7 -0
- package/dist/infra/dotenv.js.map +1 -0
- package/dist/infra/logger.d.ts +4 -0
- package/dist/infra/logger.d.ts.map +1 -0
- package/dist/infra/logger.js +12 -0
- package/dist/infra/logger.js.map +1 -0
- package/dist/infra/ports.d.ts +2 -0
- package/dist/infra/ports.d.ts.map +1 -0
- package/dist/infra/ports.js +12 -0
- package/dist/infra/ports.js.map +1 -0
- package/dist/integrations/ai-models/anthropic.d.ts +15 -0
- package/dist/integrations/ai-models/anthropic.d.ts.map +1 -0
- package/dist/integrations/ai-models/anthropic.js +91 -0
- package/dist/integrations/ai-models/anthropic.js.map +1 -0
- package/dist/integrations/ai-models/ollama.d.ts +17 -0
- package/dist/integrations/ai-models/ollama.d.ts.map +1 -0
- package/dist/integrations/ai-models/ollama.js +113 -0
- package/dist/integrations/ai-models/ollama.js.map +1 -0
- package/dist/integrations/ai-models/openai.d.ts +19 -0
- package/dist/integrations/ai-models/openai.d.ts.map +1 -0
- package/dist/integrations/ai-models/openai.js +136 -0
- package/dist/integrations/ai-models/openai.js.map +1 -0
- package/dist/integrations/base.d.ts +102 -0
- package/dist/integrations/base.d.ts.map +1 -0
- package/dist/integrations/base.js +44 -0
- package/dist/integrations/base.js.map +1 -0
- package/dist/integrations/categories.d.ts +13 -0
- package/dist/integrations/categories.d.ts.map +1 -0
- package/dist/integrations/categories.js +69 -0
- package/dist/integrations/categories.js.map +1 -0
- package/dist/integrations/chat/discord.d.ts +19 -0
- package/dist/integrations/chat/discord.d.ts.map +1 -0
- package/dist/integrations/chat/discord.js +122 -0
- package/dist/integrations/chat/discord.js.map +1 -0
- package/dist/integrations/chat/slack.d.ts +19 -0
- package/dist/integrations/chat/slack.d.ts.map +1 -0
- package/dist/integrations/chat/slack.js +113 -0
- package/dist/integrations/chat/slack.js.map +1 -0
- package/dist/integrations/chat/whatsapp.d.ts +18 -0
- package/dist/integrations/chat/whatsapp.d.ts.map +1 -0
- package/dist/integrations/chat/whatsapp.js +115 -0
- package/dist/integrations/chat/whatsapp.js.map +1 -0
- package/dist/integrations/credential-manager.d.ts +68 -0
- package/dist/integrations/credential-manager.d.ts.map +1 -0
- package/dist/integrations/credential-manager.js +156 -0
- package/dist/integrations/credential-manager.js.map +1 -0
- package/dist/integrations/google/calendar.d.ts +17 -0
- package/dist/integrations/google/calendar.d.ts.map +1 -0
- package/dist/integrations/google/calendar.js +126 -0
- package/dist/integrations/google/calendar.js.map +1 -0
- package/dist/integrations/google/docs.d.ts +19 -0
- package/dist/integrations/google/docs.d.ts.map +1 -0
- package/dist/integrations/google/docs.js +153 -0
- package/dist/integrations/google/docs.js.map +1 -0
- package/dist/integrations/google/drive.d.ts +17 -0
- package/dist/integrations/google/drive.d.ts.map +1 -0
- package/dist/integrations/google/drive.js +130 -0
- package/dist/integrations/google/drive.js.map +1 -0
- package/dist/integrations/google/gmail.d.ts +19 -0
- package/dist/integrations/google/gmail.d.ts.map +1 -0
- package/dist/integrations/google/gmail.js +124 -0
- package/dist/integrations/google/gmail.js.map +1 -0
- package/dist/integrations/google/maps.d.ts +20 -0
- package/dist/integrations/google/maps.d.ts.map +1 -0
- package/dist/integrations/google/maps.js +115 -0
- package/dist/integrations/google/maps.js.map +1 -0
- package/dist/integrations/google/meet.d.ts +16 -0
- package/dist/integrations/google/meet.d.ts.map +1 -0
- package/dist/integrations/google/meet.js +104 -0
- package/dist/integrations/google/meet.js.map +1 -0
- package/dist/integrations/google/oauth.d.ts +39 -0
- package/dist/integrations/google/oauth.d.ts.map +1 -0
- package/dist/integrations/google/oauth.js +134 -0
- package/dist/integrations/google/oauth.js.map +1 -0
- package/dist/integrations/google/search.d.ts +15 -0
- package/dist/integrations/google/search.d.ts.map +1 -0
- package/dist/integrations/google/search.js +66 -0
- package/dist/integrations/google/search.js.map +1 -0
- package/dist/integrations/google/sheets.d.ts +17 -0
- package/dist/integrations/google/sheets.d.ts.map +1 -0
- package/dist/integrations/google/sheets.js +118 -0
- package/dist/integrations/google/sheets.js.map +1 -0
- package/dist/integrations/google/youtube.d.ts +19 -0
- package/dist/integrations/google/youtube.d.ts.map +1 -0
- package/dist/integrations/google/youtube.js +128 -0
- package/dist/integrations/google/youtube.js.map +1 -0
- package/dist/integrations/loader.d.ts +15 -0
- package/dist/integrations/loader.d.ts.map +1 -0
- package/dist/integrations/loader.js +97 -0
- package/dist/integrations/loader.js.map +1 -0
- package/dist/integrations/music/spotify.d.ts +21 -0
- package/dist/integrations/music/spotify.d.ts.map +1 -0
- package/dist/integrations/music/spotify.js +161 -0
- package/dist/integrations/music/spotify.js.map +1 -0
- package/dist/integrations/productivity/github.d.ts +20 -0
- package/dist/integrations/productivity/github.d.ts.map +1 -0
- package/dist/integrations/productivity/github.js +146 -0
- package/dist/integrations/productivity/github.js.map +1 -0
- package/dist/integrations/productivity/linear.d.ts +19 -0
- package/dist/integrations/productivity/linear.d.ts.map +1 -0
- package/dist/integrations/productivity/linear.js +152 -0
- package/dist/integrations/productivity/linear.js.map +1 -0
- package/dist/integrations/productivity/notion.d.ts +20 -0
- package/dist/integrations/productivity/notion.d.ts.map +1 -0
- package/dist/integrations/productivity/notion.js +186 -0
- package/dist/integrations/productivity/notion.js.map +1 -0
- package/dist/integrations/productivity/obsidian.d.ts +21 -0
- package/dist/integrations/productivity/obsidian.d.ts.map +1 -0
- package/dist/integrations/productivity/obsidian.js +141 -0
- package/dist/integrations/productivity/obsidian.js.map +1 -0
- package/dist/integrations/registry.d.ts +78 -0
- package/dist/integrations/registry.d.ts.map +1 -0
- package/dist/integrations/registry.js +193 -0
- package/dist/integrations/registry.js.map +1 -0
- package/dist/integrations/smart-home/homeassistant.d.ts +21 -0
- package/dist/integrations/smart-home/homeassistant.d.ts.map +1 -0
- package/dist/integrations/smart-home/homeassistant.js +129 -0
- package/dist/integrations/smart-home/homeassistant.js.map +1 -0
- package/dist/integrations/smart-home/hue.d.ts +23 -0
- package/dist/integrations/smart-home/hue.d.ts.map +1 -0
- package/dist/integrations/smart-home/hue.js +144 -0
- package/dist/integrations/smart-home/hue.js.map +1 -0
- package/dist/integrations/social/email-smtp.d.ts +23 -0
- package/dist/integrations/social/email-smtp.d.ts.map +1 -0
- package/dist/integrations/social/email-smtp.js +168 -0
- package/dist/integrations/social/email-smtp.js.map +1 -0
- package/dist/integrations/social/twitter.d.ts +28 -0
- package/dist/integrations/social/twitter.d.ts.map +1 -0
- package/dist/integrations/social/twitter.js +168 -0
- package/dist/integrations/social/twitter.js.map +1 -0
- package/dist/integrations/tools/browser.d.ts +18 -0
- package/dist/integrations/tools/browser.d.ts.map +1 -0
- package/dist/integrations/tools/browser.js +131 -0
- package/dist/integrations/tools/browser.js.map +1 -0
- package/dist/integrations/tools/weather.d.ts +17 -0
- package/dist/integrations/tools/weather.d.ts.map +1 -0
- package/dist/integrations/tools/weather.js +113 -0
- package/dist/integrations/tools/weather.js.map +1 -0
- package/dist/integrations/tools/webhooks.d.ts +15 -0
- package/dist/integrations/tools/webhooks.d.ts.map +1 -0
- package/dist/integrations/tools/webhooks.js +89 -0
- package/dist/integrations/tools/webhooks.js.map +1 -0
- package/dist/mcp/client.d.ts +42 -0
- package/dist/mcp/client.d.ts.map +1 -0
- package/dist/mcp/client.js +164 -0
- package/dist/mcp/client.js.map +1 -0
- package/dist/mcp/server.d.ts +2 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +114 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tools-adapter.d.ts +14 -0
- package/dist/mcp/tools-adapter.d.ts.map +1 -0
- package/dist/mcp/tools-adapter.js +133 -0
- package/dist/mcp/tools-adapter.js.map +1 -0
- package/dist/memory/manager.d.ts +14 -0
- package/dist/memory/manager.d.ts.map +1 -0
- package/dist/memory/manager.js +49 -0
- package/dist/memory/manager.js.map +1 -0
- package/dist/memory/vector-store.d.ts +17 -0
- package/dist/memory/vector-store.d.ts.map +1 -0
- package/dist/memory/vector-store.js +65 -0
- package/dist/memory/vector-store.js.map +1 -0
- package/dist/security/action-guard.d.ts +12 -0
- package/dist/security/action-guard.d.ts.map +1 -0
- package/dist/security/action-guard.js +37 -0
- package/dist/security/action-guard.js.map +1 -0
- package/dist/security/api-key-guard.d.ts +3 -0
- package/dist/security/api-key-guard.d.ts.map +1 -0
- package/dist/security/api-key-guard.js +36 -0
- package/dist/security/api-key-guard.js.map +1 -0
- package/dist/security/auth.d.ts +17 -0
- package/dist/security/auth.d.ts.map +1 -0
- package/dist/security/auth.js +31 -0
- package/dist/security/auth.js.map +1 -0
- package/dist/security/device-identity.d.ts +11 -0
- package/dist/security/device-identity.d.ts.map +1 -0
- package/dist/security/device-identity.js +64 -0
- package/dist/security/device-identity.js.map +1 -0
- package/dist/security/encryption.d.ts +5 -0
- package/dist/security/encryption.d.ts.map +1 -0
- package/dist/security/encryption.js +13 -0
- package/dist/security/encryption.js.map +1 -0
- package/dist/security/isolation.d.ts +11 -0
- package/dist/security/isolation.d.ts.map +1 -0
- package/dist/security/isolation.js +37 -0
- package/dist/security/isolation.js.map +1 -0
- package/dist/skills/loader.d.ts +17 -0
- package/dist/skills/loader.d.ts.map +1 -0
- package/dist/skills/loader.js +68 -0
- package/dist/skills/loader.js.map +1 -0
- package/dist/token/estimator.d.ts +72 -0
- package/dist/token/estimator.d.ts.map +1 -0
- package/dist/token/estimator.js +165 -0
- package/dist/token/estimator.js.map +1 -0
- package/dist/utils/crypto.d.ts +4 -0
- package/dist/utils/crypto.d.ts.map +1 -0
- package/dist/utils/crypto.js +28 -0
- package/dist/utils/crypto.js.map +1 -0
- package/dist/utils/file.d.ts +14 -0
- package/dist/utils/file.d.ts.map +1 -0
- package/dist/utils/file.js +54 -0
- package/dist/utils/file.js.map +1 -0
- package/dist/utils/media.d.ts +6 -0
- package/dist/utils/media.d.ts.map +1 -0
- package/dist/utils/media.js +65 -0
- package/dist/utils/media.js.map +1 -0
- package/dist/wallet/x402.d.ts +22 -0
- package/dist/wallet/x402.d.ts.map +1 -0
- package/dist/wallet/x402.js +63 -0
- package/dist/wallet/x402.js.map +1 -0
- package/package.json +79 -0
- package/wispy/AGENTS.md +46 -0
- package/wispy/BOOT.md +28 -0
- package/wispy/CONTEXT.md +13 -0
- package/wispy/HEARTBEAT.md +17 -0
- package/wispy/IDENTITY.md +26 -0
- package/wispy/MEMORY.md +16 -0
- package/wispy/SOUL.md +35 -0
- package/wispy/TOOLS.md +45 -0
- package/wispy/USER.md +16 -0
- package/wispy/skills/a2a-delegate/SKILL.md +14 -0
- package/wispy/skills/content-creator/SKILL.md +14 -0
- package/wispy/skills/image-gen/SKILL.md +14 -0
- package/wispy/skills/wallet-ops/SKILL.md +14 -0
- package/wispy/skills/x-poster/SKILL.md +11 -0
package/.env.example
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Gemini API Key (required)
|
|
2
|
+
GEMINI_API_KEY=your_gemini_api_key_here
|
|
3
|
+
|
|
4
|
+
# Telegram Bot Token (optional)
|
|
5
|
+
TELEGRAM_BOT_TOKEN=
|
|
6
|
+
|
|
7
|
+
# WhatsApp (auto-configured via QR)
|
|
8
|
+
|
|
9
|
+
# x402 Wallet (auto-generated on first run)
|
|
10
|
+
# WALLET_ENCRYPTION_PASSWORD=
|
|
11
|
+
|
|
12
|
+
# Twitter/X API (optional, for content publishing)
|
|
13
|
+
TWITTER_API_KEY=
|
|
14
|
+
TWITTER_API_SECRET=
|
|
15
|
+
TWITTER_ACCESS_TOKEN=
|
|
16
|
+
TWITTER_ACCESS_SECRET=
|
|
17
|
+
|
|
18
|
+
# Dashboard
|
|
19
|
+
DASHBOARD_PORT=3000
|
|
20
|
+
GATEWAY_PORT=4000
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Brian Mwai
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
# Wispy ☁️👀
|
|
2
|
+
|
|
3
|
+
**Autonomous AI Agent Platform powered by Google Gemini**
|
|
4
|
+
|
|
5
|
+
Wispy is an open-source, self-hostable autonomous AI agent platform with a Claude Code-level CLI, 27+ integrations, multi-agent collaboration, voice mode, and support for both cloud and local models.
|
|
6
|
+
|
|
7
|
+
Built for the **Google DeepMind Gemini Hackathon**.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- **Multi-Agent System** — 8 specialized agents (Coder, Researcher, Writer, DevOps, Designer, Data, Security, Planner) that collaborate on complex tasks
|
|
14
|
+
- **27+ Integrations** — Google Calendar, Gmail, Drive, Docs, Sheets, Meet, Maps, YouTube, Discord, Slack, GitHub, Notion, Spotify, and more
|
|
15
|
+
- **Interactive CLI** — 19 commands + 16 slash commands, interactive REPL with markdown rendering
|
|
16
|
+
- **Voice Mode** — Whisper STT + Piper/espeak TTS for hands-free interaction
|
|
17
|
+
- **Token Management** — Budget limits, context windowing, cost estimation, smart model routing
|
|
18
|
+
- **MCP Server** — Model Context Protocol for Antigravity IDE / VS Code integration
|
|
19
|
+
- **Memory System** — Vector embeddings + keyword hybrid search with long-term recall
|
|
20
|
+
- **Multi-Model Support** — Gemini, Gemma (local via Ollama), OpenAI, Anthropic, and any OpenAI-compatible API
|
|
21
|
+
- **Agent-to-Agent** — Ed25519-signed task delegation between Wispy instances
|
|
22
|
+
- **x402 Wallet** — USDC on Base with encrypted key storage
|
|
23
|
+
- **Auto-Start** — Boot on login (Windows Task Scheduler, macOS launchd, Linux systemd)
|
|
24
|
+
- **7-Layer Security** — Device identity, AES-256-GCM encryption, API key scanning, action guards, session isolation
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Quick Start
|
|
29
|
+
|
|
30
|
+
### Install globally
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm i -g wispy-ai
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Setup
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
wispy setup
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
This launches the interactive setup wizard where you pick your AI model, select agents, connect integrations, and configure voice mode.
|
|
43
|
+
|
|
44
|
+
### Run
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
wispy chat # Interactive REPL (default)
|
|
48
|
+
wispy agent "Hello" # Send a single message
|
|
49
|
+
wispy doctor # Health check
|
|
50
|
+
wispy gateway # Start full gateway (WebSocket + REST + A2A)
|
|
51
|
+
wispy mcp-server # MCP server for Antigravity / VS Code
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### From source
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
git clone https://github.com/brn-mwai/wispy.git
|
|
58
|
+
cd wispy
|
|
59
|
+
npm install
|
|
60
|
+
npm run build
|
|
61
|
+
cp .env.example .env
|
|
62
|
+
# Add your GEMINI_API_KEY to .env
|
|
63
|
+
node bin/wispy.js setup
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Integrations (27+)
|
|
69
|
+
|
|
70
|
+
| Category | Integrations |
|
|
71
|
+
|----------|-------------|
|
|
72
|
+
| **Google** | Calendar, Gmail, Drive, Docs, Sheets, Meet, Maps, Search, YouTube |
|
|
73
|
+
| **Chat** | Discord, Slack, WhatsApp |
|
|
74
|
+
| **AI Models** | OpenAI, Anthropic, Ollama (local) |
|
|
75
|
+
| **Productivity** | Notion, Obsidian, GitHub, Linear |
|
|
76
|
+
| **Music** | Spotify |
|
|
77
|
+
| **Smart Home** | Philips Hue, Home Assistant |
|
|
78
|
+
| **Tools** | Browser, Webhooks, Weather |
|
|
79
|
+
| **Social** | Twitter/X, Email (SMTP) |
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Multi-Agent System
|
|
84
|
+
|
|
85
|
+
Users select agents during setup. The orchestrator routes tasks to the right agent(s), and agents collaborate with chain-depth limits to prevent infinite loops.
|
|
86
|
+
|
|
87
|
+
| Agent | Role |
|
|
88
|
+
|-------|------|
|
|
89
|
+
| **Coder** | Code generation, debugging, refactoring |
|
|
90
|
+
| **Researcher** | Web search, analysis, summarization |
|
|
91
|
+
| **Writer** | Content creation, copywriting, docs |
|
|
92
|
+
| **DevOps** | CI/CD, deployment, infrastructure |
|
|
93
|
+
| **Designer** | UI/UX design, accessibility |
|
|
94
|
+
| **Data** | SQL, data analysis, visualization |
|
|
95
|
+
| **Security** | Audit, vulnerability scanning |
|
|
96
|
+
| **Planner** | Task breakdown, project planning |
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Gemini Models
|
|
101
|
+
|
|
102
|
+
| Model | Use |
|
|
103
|
+
|-------|-----|
|
|
104
|
+
| Gemini 2.5 Pro | Reasoning, planning, analysis |
|
|
105
|
+
| Gemini 2.5 Flash | Quick tasks, classification |
|
|
106
|
+
| Gemini Pro Image | Image generation |
|
|
107
|
+
| text-embedding-004 | Vector memory embeddings |
|
|
108
|
+
| Gemma 3 (via Ollama) | Local/private inference |
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## CLI Commands
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
wispy setup Interactive setup wizard
|
|
116
|
+
wispy gateway Start the agent gateway
|
|
117
|
+
wispy doctor Health check
|
|
118
|
+
wispy status System status
|
|
119
|
+
wispy agent <msg> Send a message to the agent
|
|
120
|
+
wispy chat Interactive REPL (default)
|
|
121
|
+
wispy integrations list List all 27+ integrations
|
|
122
|
+
wispy integrations enable <id>
|
|
123
|
+
wispy autostart install Auto-start on boot
|
|
124
|
+
wispy mcp-server MCP server for IDE integration
|
|
125
|
+
wispy sessions list List sessions
|
|
126
|
+
wispy memory search <q> Search memory
|
|
127
|
+
wispy skills list List skills
|
|
128
|
+
wispy wallet status Wallet balance
|
|
129
|
+
wispy peers list A2A peers
|
|
130
|
+
wispy cron list Scheduled tasks
|
|
131
|
+
wispy config show Show configuration
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### REPL Slash Commands
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
/help Show commands
|
|
138
|
+
/status System status
|
|
139
|
+
/integrations List integrations
|
|
140
|
+
/voice on Start voice mode
|
|
141
|
+
/tokens Token usage stats
|
|
142
|
+
/memory <q> Search memory
|
|
143
|
+
/model pro Switch model
|
|
144
|
+
/session <key> Switch session
|
|
145
|
+
/history Conversation history
|
|
146
|
+
/skills List skills
|
|
147
|
+
/wallet Wallet status
|
|
148
|
+
/peers A2A peers
|
|
149
|
+
/export Export as markdown
|
|
150
|
+
/clear Clear screen
|
|
151
|
+
/exit Quit
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Architecture
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
User Goal → Orchestrator → Agent(s) → Tool Execution → Self-Correction → Result
|
|
160
|
+
↑ |
|
|
161
|
+
└────────────────────┘
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Project Structure
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
wispy/
|
|
168
|
+
├── src/
|
|
169
|
+
│ ├── agents/ # Multi-agent types, orchestrator, collaboration
|
|
170
|
+
│ ├── ai/ # Gemini SDK, model registry, providers (Ollama, OpenAI)
|
|
171
|
+
│ ├── autostart/ # Boot service (Windows/macOS/Linux)
|
|
172
|
+
│ ├── channels/ # Telegram, REST, WebSocket
|
|
173
|
+
│ ├── cli/ # Interactive CLI, REPL, voice mode, setup wizard
|
|
174
|
+
│ ├── config/ # Schema, hot-reload
|
|
175
|
+
│ ├── core/ # Agent loop, sessions, memory, thinking
|
|
176
|
+
│ ├── integrations/ # 27+ integrations (Google, Chat, AI, Productivity, etc.)
|
|
177
|
+
│ ├── gateway/ # WebSocket server, boot sequence
|
|
178
|
+
│ ├── mcp/ # MCP server + client
|
|
179
|
+
│ ├── memory/ # Vector store, embedding manager
|
|
180
|
+
│ ├── security/ # Device identity, encryption, API key guard
|
|
181
|
+
│ ├── token/ # Token estimation, budgets, context windowing
|
|
182
|
+
│ └── wallet/ # x402 USDC wallet
|
|
183
|
+
├── wispy/ # Soul files (SOUL.md, IDENTITY.md, skills/)
|
|
184
|
+
├── .env.example
|
|
185
|
+
├── package.json
|
|
186
|
+
└── tsconfig.json
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Two-Directory Design
|
|
190
|
+
|
|
191
|
+
- **`wispy/`** — Soul & identity files (version-controlled): SOUL.md, IDENTITY.md, AGENTS.md, skills/
|
|
192
|
+
- **`.wispy/`** — Runtime data (gitignored): config.yaml, device identity, sessions, vector DB, credentials
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Voice Mode
|
|
197
|
+
|
|
198
|
+
```
|
|
199
|
+
> /voice on
|
|
200
|
+
|
|
201
|
+
Listening...
|
|
202
|
+
You: "Create a React component for user profiles"
|
|
203
|
+
|
|
204
|
+
Thinking...
|
|
205
|
+
Wispy: "I'll create a UserProfile component..."
|
|
206
|
+
|
|
207
|
+
Listening...
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Requires `sox` for recording and `whisper` for transcription. TTS via `piper` or `espeak-ng`.
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## Tech Stack
|
|
215
|
+
|
|
216
|
+
- **Runtime**: TypeScript, Node.js 20+
|
|
217
|
+
- **AI**: Google Generative AI SDK (`@google/genai`)
|
|
218
|
+
- **CLI**: Commander.js, Chalk, Ora, Marked
|
|
219
|
+
- **Protocols**: MCP (`@modelcontextprotocol/sdk`), A2A (Ed25519), x402 (ethers.js)
|
|
220
|
+
- **Data**: SQLite + vector embeddings, YAML config
|
|
221
|
+
- **Security**: AES-256-GCM, Ed25519, API key regex scanner
|
|
222
|
+
- **Voice**: Whisper (STT), Piper/espeak-ng (TTS), SoX (recording)
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## License
|
|
227
|
+
|
|
228
|
+
MIT
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
Built for the Google DeepMind Gemini Hackathon ☁️👀
|
package/bin/wispy.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type TaskResponse } from "./protocol.js";
|
|
2
|
+
import { type Peer } from "./peer.js";
|
|
3
|
+
import type { Agent } from "../core/agent.js";
|
|
4
|
+
export declare class A2AServer {
|
|
5
|
+
private identity;
|
|
6
|
+
private agent;
|
|
7
|
+
private runtimeDir;
|
|
8
|
+
private soulDir;
|
|
9
|
+
private agentName;
|
|
10
|
+
private app;
|
|
11
|
+
constructor(runtimeDir: string, soulDir: string, agentName: string, agent: Agent);
|
|
12
|
+
private setupRoutes;
|
|
13
|
+
private getCapabilities;
|
|
14
|
+
private createResponse;
|
|
15
|
+
start(port: number): void;
|
|
16
|
+
delegateTask(peerDeviceId: string, instruction: string, context?: string): Promise<TaskResponse | null>;
|
|
17
|
+
discoverPeer(endpoint: string): Promise<Peer | null>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=delegation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delegation.d.ts","sourceRoot":"","sources":["../../src/a2a/delegation.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,YAAY,EAElB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAoB,KAAK,IAAI,EAAE,MAAM,WAAW,CAAC;AAIxD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAK9C,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAiB;IACjC,OAAO,CAAC,KAAK,CAAQ;IACrB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,GAAG,CAAkB;gBAG3B,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,KAAK;IAYd,OAAO,CAAC,WAAW;IAwEnB,OAAO,CAAC,eAAe;IAWvB,OAAO,CAAC,cAAc;IAUtB,KAAK,CAAC,IAAI,EAAE,MAAM;IAOZ,YAAY,CAChB,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAwCzB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;CAuB3D"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import express from "express";
|
|
2
|
+
import { createA2AMessage, verifyA2AMessage, } from "./protocol.js";
|
|
3
|
+
import { addPeer, getPeer } from "./peer.js";
|
|
4
|
+
import { loadOrCreateIdentity } from "../security/device-identity.js";
|
|
5
|
+
import { getAllChannels } from "../channels/dock.js";
|
|
6
|
+
import { loadSkills } from "../skills/loader.js";
|
|
7
|
+
import { createLogger } from "../infra/logger.js";
|
|
8
|
+
const log = createLogger("a2a-delegation");
|
|
9
|
+
export class A2AServer {
|
|
10
|
+
identity;
|
|
11
|
+
agent;
|
|
12
|
+
runtimeDir;
|
|
13
|
+
soulDir;
|
|
14
|
+
agentName;
|
|
15
|
+
app;
|
|
16
|
+
constructor(runtimeDir, soulDir, agentName, agent) {
|
|
17
|
+
this.runtimeDir = runtimeDir;
|
|
18
|
+
this.soulDir = soulDir;
|
|
19
|
+
this.agentName = agentName;
|
|
20
|
+
this.agent = agent;
|
|
21
|
+
this.identity = loadOrCreateIdentity(runtimeDir);
|
|
22
|
+
this.app = express();
|
|
23
|
+
this.app.use(express.json());
|
|
24
|
+
this.setupRoutes();
|
|
25
|
+
}
|
|
26
|
+
setupRoutes() {
|
|
27
|
+
// Receive A2A messages
|
|
28
|
+
this.app.post("/a2a/message", async (req, res) => {
|
|
29
|
+
const message = req.body;
|
|
30
|
+
// Verify signature
|
|
31
|
+
if (!verifyA2AMessage(message)) {
|
|
32
|
+
res.status(401).json({ error: "Invalid signature" });
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
// Register/update peer
|
|
36
|
+
addPeer(this.runtimeDir, {
|
|
37
|
+
deviceId: message.from.deviceId,
|
|
38
|
+
publicKey: message.from.publicKey,
|
|
39
|
+
name: message.from.name,
|
|
40
|
+
endpoint: req.headers["x-a2a-endpoint"] || "",
|
|
41
|
+
lastSeenAt: new Date().toISOString(),
|
|
42
|
+
});
|
|
43
|
+
try {
|
|
44
|
+
switch (message.type) {
|
|
45
|
+
case "ping":
|
|
46
|
+
res.json(this.createResponse("pong", {}));
|
|
47
|
+
break;
|
|
48
|
+
case "capability_query":
|
|
49
|
+
res.json(this.createResponse("capability_response", this.getCapabilities()));
|
|
50
|
+
break;
|
|
51
|
+
case "task_request": {
|
|
52
|
+
const task = message.payload;
|
|
53
|
+
log.info("Received task from %s: %s", message.from.name, task.instruction.slice(0, 80));
|
|
54
|
+
// Execute task in sub session
|
|
55
|
+
const result = await this.agent.chat(task.instruction, `a2a:${message.from.deviceId}`, "a2a", "sub");
|
|
56
|
+
const response = {
|
|
57
|
+
taskId: task.taskId,
|
|
58
|
+
status: "completed",
|
|
59
|
+
result: result.text,
|
|
60
|
+
};
|
|
61
|
+
res.json(this.createResponse("task_response", response));
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
default:
|
|
65
|
+
res.status(400).json({ error: "Unknown message type" });
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
catch (err) {
|
|
69
|
+
log.error({ err }, "A2A message handling failed");
|
|
70
|
+
res.status(500).json({ error: "Internal error" });
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
// Agent card (discovery endpoint)
|
|
74
|
+
this.app.get("/a2a/card", (_req, res) => {
|
|
75
|
+
res.json({
|
|
76
|
+
name: this.agentName,
|
|
77
|
+
deviceId: this.identity.deviceId,
|
|
78
|
+
publicKey: this.identity.publicKey,
|
|
79
|
+
capabilities: this.getCapabilities(),
|
|
80
|
+
protocol: "wispy-a2a/0.1",
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
getCapabilities() {
|
|
85
|
+
const skills = loadSkills(this.soulDir);
|
|
86
|
+
const channels = getAllChannels();
|
|
87
|
+
return {
|
|
88
|
+
name: this.agentName,
|
|
89
|
+
skills: skills.map((s) => s.name),
|
|
90
|
+
channels: channels.map((c) => c.name),
|
|
91
|
+
models: ["gemini-3-pro", "gemini-3-flash", "gemini-3-image"],
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
createResponse(type, payload) {
|
|
95
|
+
return createA2AMessage(this.identity, this.agentName, "", // broadcast
|
|
96
|
+
type, payload);
|
|
97
|
+
}
|
|
98
|
+
start(port) {
|
|
99
|
+
this.app.listen(port, () => {
|
|
100
|
+
log.info("A2A server listening on port %d", port);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
// Send a task to another agent
|
|
104
|
+
async delegateTask(peerDeviceId, instruction, context) {
|
|
105
|
+
const peer = getPeer(this.runtimeDir, peerDeviceId);
|
|
106
|
+
if (!peer || !peer.endpoint) {
|
|
107
|
+
log.error("Peer not found or no endpoint: %s", peerDeviceId);
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
const taskId = Math.random().toString(36).slice(2, 10);
|
|
111
|
+
const message = createA2AMessage(this.identity, this.agentName, peerDeviceId, "task_request", { taskId, instruction, context });
|
|
112
|
+
try {
|
|
113
|
+
const res = await fetch(`${peer.endpoint}/a2a/message`, {
|
|
114
|
+
method: "POST",
|
|
115
|
+
headers: {
|
|
116
|
+
"Content-Type": "application/json",
|
|
117
|
+
"X-A2A-Endpoint": `http://localhost:${4002}`, // TODO: dynamic
|
|
118
|
+
},
|
|
119
|
+
body: JSON.stringify(message),
|
|
120
|
+
});
|
|
121
|
+
if (!res.ok) {
|
|
122
|
+
log.error("Delegation failed: HTTP %d", res.status);
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
const responseMsg = (await res.json());
|
|
126
|
+
return responseMsg.payload;
|
|
127
|
+
}
|
|
128
|
+
catch (err) {
|
|
129
|
+
log.error({ err }, "Failed to delegate task to %s", peer.name);
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
// Discover a peer agent by endpoint
|
|
134
|
+
async discoverPeer(endpoint) {
|
|
135
|
+
try {
|
|
136
|
+
const res = await fetch(`${endpoint}/a2a/card`);
|
|
137
|
+
if (!res.ok)
|
|
138
|
+
return null;
|
|
139
|
+
const card = (await res.json());
|
|
140
|
+
const peer = {
|
|
141
|
+
deviceId: card.deviceId,
|
|
142
|
+
publicKey: card.publicKey,
|
|
143
|
+
name: card.name,
|
|
144
|
+
endpoint,
|
|
145
|
+
lastSeenAt: new Date().toISOString(),
|
|
146
|
+
};
|
|
147
|
+
addPeer(this.runtimeDir, peer);
|
|
148
|
+
return peer;
|
|
149
|
+
}
|
|
150
|
+
catch (err) {
|
|
151
|
+
log.error({ err }, "Failed to discover peer at %s", endpoint);
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=delegation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delegation.js","sourceRoot":"","sources":["../../src/a2a/delegation.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EACL,gBAAgB,EAChB,gBAAgB,GAKjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,OAAO,EAAa,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C/B,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,GAAG,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,EAAE,+BAA+B,EAAE,QAAQ,CAAC,CAAC;YAC9D,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface Peer {
|
|
2
|
+
deviceId: string;
|
|
3
|
+
publicKey: string;
|
|
4
|
+
name: string;
|
|
5
|
+
endpoint: string;
|
|
6
|
+
capabilities?: string[];
|
|
7
|
+
lastSeenAt: string;
|
|
8
|
+
trustedAt?: string;
|
|
9
|
+
}
|
|
10
|
+
interface PeerStore {
|
|
11
|
+
peers: Record<string, Peer>;
|
|
12
|
+
}
|
|
13
|
+
export declare function loadPeers(runtimeDir: string): PeerStore;
|
|
14
|
+
export declare function savePeers(runtimeDir: string, store: PeerStore): void;
|
|
15
|
+
export declare function addPeer(runtimeDir: string, peer: Peer): void;
|
|
16
|
+
export declare function getPeer(runtimeDir: string, deviceId: string): Peer | null;
|
|
17
|
+
export declare function listPeers(runtimeDir: string): Peer[];
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=peer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"peer.d.ts","sourceRoot":"","sources":["../../src/a2a/peer.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,IAAI;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,SAAS;IACjB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;CAC7B;AAED,wBAAgB,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAGvD;AAED,wBAAgB,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,QAG7D;AAED,wBAAgB,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,QAKrD;AAED,wBAAgB,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAGzE;AAED,wBAAgB,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,EAAE,CAGpD"}
|
package/dist/a2a/peer.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { resolve } from "path";
|
|
2
|
+
import { readJSON, writeJSON, ensureDir } from "../utils/file.js";
|
|
3
|
+
import { createLogger } from "../infra/logger.js";
|
|
4
|
+
const log = createLogger("a2a-peer");
|
|
5
|
+
export function loadPeers(runtimeDir) {
|
|
6
|
+
const path = resolve(runtimeDir, "peers", "peers.json");
|
|
7
|
+
return readJSON(path) || { peers: {} };
|
|
8
|
+
}
|
|
9
|
+
export function savePeers(runtimeDir, store) {
|
|
10
|
+
ensureDir(resolve(runtimeDir, "peers"));
|
|
11
|
+
writeJSON(resolve(runtimeDir, "peers", "peers.json"), store);
|
|
12
|
+
}
|
|
13
|
+
export function addPeer(runtimeDir, peer) {
|
|
14
|
+
const store = loadPeers(runtimeDir);
|
|
15
|
+
store.peers[peer.deviceId] = peer;
|
|
16
|
+
savePeers(runtimeDir, store);
|
|
17
|
+
log.info("Added peer: %s (%s)", peer.name, peer.deviceId.slice(0, 12));
|
|
18
|
+
}
|
|
19
|
+
export function getPeer(runtimeDir, deviceId) {
|
|
20
|
+
const store = loadPeers(runtimeDir);
|
|
21
|
+
return store.peers[deviceId] || null;
|
|
22
|
+
}
|
|
23
|
+
export function listPeers(runtimeDir) {
|
|
24
|
+
const store = loadPeers(runtimeDir);
|
|
25
|
+
return Object.values(store.peers);
|
|
26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IAC1D,MAAM,KAAK,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;IACpC,OAAO,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,UAAkB;IAC1C,MAAM,KAAK,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;IACpC,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type DeviceIdentity } from "../security/device-identity.js";
|
|
2
|
+
export interface A2AMessage {
|
|
3
|
+
type: "task_request" | "task_response" | "capability_query" | "capability_response" | "ping" | "pong";
|
|
4
|
+
from: {
|
|
5
|
+
deviceId: string;
|
|
6
|
+
publicKey: string;
|
|
7
|
+
name: string;
|
|
8
|
+
};
|
|
9
|
+
to: {
|
|
10
|
+
deviceId: string;
|
|
11
|
+
};
|
|
12
|
+
payload: unknown;
|
|
13
|
+
timestamp: string;
|
|
14
|
+
signature: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function createA2AMessage(identity: DeviceIdentity, agentName: string, toDeviceId: string, type: A2AMessage["type"], payload: unknown): A2AMessage;
|
|
17
|
+
export declare function verifyA2AMessage(message: A2AMessage): boolean;
|
|
18
|
+
export interface TaskRequest {
|
|
19
|
+
taskId: string;
|
|
20
|
+
instruction: string;
|
|
21
|
+
context?: string;
|
|
22
|
+
timeout?: number;
|
|
23
|
+
}
|
|
24
|
+
export interface TaskResponse {
|
|
25
|
+
taskId: string;
|
|
26
|
+
status: "completed" | "failed" | "rejected";
|
|
27
|
+
result?: string;
|
|
28
|
+
error?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface CapabilityResponse {
|
|
31
|
+
name: string;
|
|
32
|
+
skills: string[];
|
|
33
|
+
channels: string[];
|
|
34
|
+
models: string[];
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=protocol.d.ts.map
|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AAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { signPayload, verifySignature } from "../security/device-identity.js";
|
|
2
|
+
import { createLogger } from "../infra/logger.js";
|
|
3
|
+
const log = createLogger("a2a");
|
|
4
|
+
export function createA2AMessage(identity, agentName, toDeviceId, type, payload) {
|
|
5
|
+
const msg = {
|
|
6
|
+
type,
|
|
7
|
+
from: {
|
|
8
|
+
deviceId: identity.deviceId,
|
|
9
|
+
publicKey: identity.publicKey,
|
|
10
|
+
name: agentName,
|
|
11
|
+
},
|
|
12
|
+
to: { deviceId: toDeviceId },
|
|
13
|
+
payload,
|
|
14
|
+
timestamp: new Date().toISOString(),
|
|
15
|
+
};
|
|
16
|
+
const signature = signPayload(identity, JSON.stringify(msg));
|
|
17
|
+
return { ...msg, signature };
|
|
18
|
+
}
|
|
19
|
+
export function verifyA2AMessage(message) {
|
|
20
|
+
const { signature, ...rest } = message;
|
|
21
|
+
return verifySignature(message.from.publicKey, JSON.stringify(rest), signature);
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../src/a2a/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAuB,MAAM,gCAAgC,CAAC;AACnG,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,GAAG,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;AAWhC,MAAM,UAAU,gBAAgB,CAC9B,QAAwB,EACxB,SAAiB,EACjB,UAAkB,EAClB,IAAwB,EACxB,OAAgB;IAEhB,MAAM,GAAG,GAAkC;QACzC,IAAI;QACJ,IAAI,EAAE;YACJ,QAAQ,EAAE,QAAQ,CAAC,QAAQ;YAC3B,SAAS,EAAE,QAAQ,CAAC,SAAS;YAC7B,IAAI,EAAE,SAAS;SAChB;QACD,EAAE,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE;QAC5B,OAAO;QACP,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KACpC,CAAC;IAEF,MAAM,SAAS,GAAG,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7D,OAAO,EAAE,GAAG,GAAG,EAAE,SAAS,EAAE,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,OAAmB;IAClD,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;IACvC,OAAO,eAAe,CACpB,OAAO,CAAC,IAAI,CAAC,SAAS,EACtB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EACpB,SAAS,CACV,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inter-agent collaboration protocol.
|
|
3
|
+
*
|
|
4
|
+
* Enables agents to pass tasks and context between each other. The collaboration
|
|
5
|
+
* manager enforces chain depth limits to prevent infinite delegation loops.
|
|
6
|
+
*/
|
|
7
|
+
import type { Orchestrator, TaskAssignment } from "./orchestrator.js";
|
|
8
|
+
export interface CollaborationResult {
|
|
9
|
+
agentId: string;
|
|
10
|
+
task: string;
|
|
11
|
+
output: string;
|
|
12
|
+
success: boolean;
|
|
13
|
+
tokensUsed: number;
|
|
14
|
+
}
|
|
15
|
+
export interface CollaborationSession {
|
|
16
|
+
id: string;
|
|
17
|
+
initiator: string;
|
|
18
|
+
tasks: TaskAssignment[];
|
|
19
|
+
results: CollaborationResult[];
|
|
20
|
+
depth: number;
|
|
21
|
+
maxDepth: number;
|
|
22
|
+
startedAt: string;
|
|
23
|
+
completedAt?: string;
|
|
24
|
+
}
|
|
25
|
+
export declare class CollaborationManager {
|
|
26
|
+
private orchestrator;
|
|
27
|
+
private maxChainDepth;
|
|
28
|
+
private activeSessions;
|
|
29
|
+
constructor(orchestrator: Orchestrator, maxChainDepth?: number);
|
|
30
|
+
/**
|
|
31
|
+
* Start a collaboration session for a set of tasks.
|
|
32
|
+
*/
|
|
33
|
+
createSession(initiator: string, tasks: TaskAssignment[]): CollaborationSession;
|
|
34
|
+
/**
|
|
35
|
+
* Record a result from an agent in a collaboration session.
|
|
36
|
+
*/
|
|
37
|
+
recordResult(sessionId: string, result: CollaborationResult): void;
|
|
38
|
+
/**
|
|
39
|
+
* Check if an agent can delegate further (chain depth limit).
|
|
40
|
+
*/
|
|
41
|
+
canDelegate(sessionId: string): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Increment chain depth when a task is delegated.
|
|
44
|
+
*/
|
|
45
|
+
incrementDepth(sessionId: string): void;
|
|
46
|
+
/**
|
|
47
|
+
* Complete a collaboration session.
|
|
48
|
+
*/
|
|
49
|
+
complete(sessionId: string): CollaborationSession | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Build a summary of collaboration results for the user.
|
|
52
|
+
*/
|
|
53
|
+
summarize(session: CollaborationSession): string;
|
|
54
|
+
/**
|
|
55
|
+
* Get active session count.
|
|
56
|
+
*/
|
|
57
|
+
get activeCount(): number;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=collaboration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collaboration.d.ts","sourceRoot":"","sources":["../../src/agents/collaboration.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAMtE,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,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