@shuyhere/takotako 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +84 -0
- package/LICENSE +21 -0
- package/README.md +171 -0
- package/dist/agents/communication.d.ts +48 -0
- package/dist/agents/communication.d.ts.map +1 -0
- package/dist/agents/communication.js +123 -0
- package/dist/agents/communication.js.map +1 -0
- package/dist/agents/config.d.ts +52 -0
- package/dist/agents/config.d.ts.map +1 -0
- package/dist/agents/config.js +65 -0
- package/dist/agents/config.js.map +1 -0
- package/dist/agents/model-catalog.d.ts +49 -0
- package/dist/agents/model-catalog.d.ts.map +1 -0
- package/dist/agents/model-catalog.js +79 -0
- package/dist/agents/model-catalog.js.map +1 -0
- package/dist/agents/registry.d.ts +71 -0
- package/dist/agents/registry.d.ts.map +1 -0
- package/dist/agents/registry.js +297 -0
- package/dist/agents/registry.js.map +1 -0
- package/dist/agents/roles.d.ts +79 -0
- package/dist/agents/roles.d.ts.map +1 -0
- package/dist/agents/roles.js +174 -0
- package/dist/agents/roles.js.map +1 -0
- package/dist/agents/subagent.d.ts +124 -0
- package/dist/agents/subagent.d.ts.map +1 -0
- package/dist/agents/subagent.js +352 -0
- package/dist/agents/subagent.js.map +1 -0
- package/dist/agents/templates.d.ts +18 -0
- package/dist/agents/templates.d.ts.map +1 -0
- package/dist/agents/templates.js +341 -0
- package/dist/agents/templates.js.map +1 -0
- package/dist/agents/thread-binding.d.ts +77 -0
- package/dist/agents/thread-binding.d.ts.map +1 -0
- package/dist/agents/thread-binding.js +167 -0
- package/dist/agents/thread-binding.js.map +1 -0
- package/dist/auth/agent-profiles.d.ts +46 -0
- package/dist/auth/agent-profiles.d.ts.map +1 -0
- package/dist/auth/agent-profiles.js +97 -0
- package/dist/auth/agent-profiles.js.map +1 -0
- package/dist/auth/allow-from.d.ts +27 -0
- package/dist/auth/allow-from.d.ts.map +1 -0
- package/dist/auth/allow-from.js +118 -0
- package/dist/auth/allow-from.js.map +1 -0
- package/dist/auth/oauth.d.ts +66 -0
- package/dist/auth/oauth.d.ts.map +1 -0
- package/dist/auth/oauth.js +253 -0
- package/dist/auth/oauth.js.map +1 -0
- package/dist/auth/storage.d.ts +69 -0
- package/dist/auth/storage.d.ts.map +1 -0
- package/dist/auth/storage.js +157 -0
- package/dist/auth/storage.js.map +1 -0
- package/dist/cache/file-cache.d.ts +68 -0
- package/dist/cache/file-cache.d.ts.map +1 -0
- package/dist/cache/file-cache.js +176 -0
- package/dist/cache/file-cache.js.map +1 -0
- package/dist/cache/manager.d.ts +69 -0
- package/dist/cache/manager.d.ts.map +1 -0
- package/dist/cache/manager.js +117 -0
- package/dist/cache/manager.js.map +1 -0
- package/dist/cache/symbol-index.d.ts +75 -0
- package/dist/cache/symbol-index.d.ts.map +1 -0
- package/dist/cache/symbol-index.js +267 -0
- package/dist/cache/symbol-index.js.map +1 -0
- package/dist/cache/tool-cache.d.ts +75 -0
- package/dist/cache/tool-cache.d.ts.map +1 -0
- package/dist/cache/tool-cache.js +173 -0
- package/dist/cache/tool-cache.js.map +1 -0
- package/dist/channels/channel.d.ts +156 -0
- package/dist/channels/channel.d.ts.map +1 -0
- package/dist/channels/channel.js +25 -0
- package/dist/channels/channel.js.map +1 -0
- package/dist/channels/cli.d.ts +35 -0
- package/dist/channels/cli.d.ts.map +1 -0
- package/dist/channels/cli.js +94 -0
- package/dist/channels/cli.js.map +1 -0
- package/dist/channels/delivery-queue.d.ts +31 -0
- package/dist/channels/delivery-queue.d.ts.map +1 -0
- package/dist/channels/delivery-queue.js +127 -0
- package/dist/channels/delivery-queue.js.map +1 -0
- package/dist/channels/discord.d.ts +124 -0
- package/dist/channels/discord.d.ts.map +1 -0
- package/dist/channels/discord.js +664 -0
- package/dist/channels/discord.js.map +1 -0
- package/dist/channels/retry.d.ts +31 -0
- package/dist/channels/retry.d.ts.map +1 -0
- package/dist/channels/retry.js +94 -0
- package/dist/channels/retry.js.map +1 -0
- package/dist/channels/telegram.d.ts +69 -0
- package/dist/channels/telegram.d.ts.map +1 -0
- package/dist/channels/telegram.js +499 -0
- package/dist/channels/telegram.js.map +1 -0
- package/dist/channels/tui.d.ts +42 -0
- package/dist/channels/tui.d.ts.map +1 -0
- package/dist/channels/tui.js +126 -0
- package/dist/channels/tui.js.map +1 -0
- package/dist/cli/acp.d.ts +10 -0
- package/dist/cli/acp.d.ts.map +1 -0
- package/dist/cli/acp.js +69 -0
- package/dist/cli/acp.js.map +1 -0
- package/dist/cli/audit.d.ts +11 -0
- package/dist/cli/audit.d.ts.map +1 -0
- package/dist/cli/audit.js +55 -0
- package/dist/cli/audit.js.map +1 -0
- package/dist/cli/cache.d.ts +10 -0
- package/dist/cli/cache.d.ts.map +1 -0
- package/dist/cli/cache.js +77 -0
- package/dist/cli/cache.js.map +1 -0
- package/dist/cli/config.d.ts +5 -0
- package/dist/cli/config.d.ts.map +1 -0
- package/dist/cli/config.js +168 -0
- package/dist/cli/config.js.map +1 -0
- package/dist/cli/cron.d.ts +5 -0
- package/dist/cli/cron.d.ts.map +1 -0
- package/dist/cli/cron.js +192 -0
- package/dist/cli/cron.js.map +1 -0
- package/dist/cli/extensions.d.ts +5 -0
- package/dist/cli/extensions.d.ts.map +1 -0
- package/dist/cli/extensions.js +53 -0
- package/dist/cli/extensions.js.map +1 -0
- package/dist/cli/logs.d.ts +5 -0
- package/dist/cli/logs.d.ts.map +1 -0
- package/dist/cli/logs.js +49 -0
- package/dist/cli/logs.js.map +1 -0
- package/dist/cli/memory.d.ts +5 -0
- package/dist/cli/memory.d.ts.map +1 -0
- package/dist/cli/memory.js +78 -0
- package/dist/cli/memory.js.map +1 -0
- package/dist/cli/message.d.ts +5 -0
- package/dist/cli/message.d.ts.map +1 -0
- package/dist/cli/message.js +69 -0
- package/dist/cli/message.js.map +1 -0
- package/dist/cli/service.d.ts +14 -0
- package/dist/cli/service.d.ts.map +1 -0
- package/dist/cli/service.js +181 -0
- package/dist/cli/service.js.map +1 -0
- package/dist/cli/symphony.d.ts +5 -0
- package/dist/cli/symphony.d.ts.map +1 -0
- package/dist/cli/symphony.js +114 -0
- package/dist/cli/symphony.js.map +1 -0
- package/dist/cli/update.d.ts +5 -0
- package/dist/cli/update.d.ts.map +1 -0
- package/dist/cli/update.js +48 -0
- package/dist/cli/update.js.map +1 -0
- package/dist/commands/channel-setup.d.ts +31 -0
- package/dist/commands/channel-setup.d.ts.map +1 -0
- package/dist/commands/channel-setup.js +138 -0
- package/dist/commands/channel-setup.js.map +1 -0
- package/dist/commands/dispatch.d.ts +48 -0
- package/dist/commands/dispatch.d.ts.map +1 -0
- package/dist/commands/dispatch.js +68 -0
- package/dist/commands/dispatch.js.map +1 -0
- package/dist/commands/model-picker.d.ts +16 -0
- package/dist/commands/model-picker.d.ts.map +1 -0
- package/dist/commands/model-picker.js +120 -0
- package/dist/commands/model-picker.js.map +1 -0
- package/dist/commands/parser.d.ts +32 -0
- package/dist/commands/parser.d.ts.map +1 -0
- package/dist/commands/parser.js +39 -0
- package/dist/commands/parser.js.map +1 -0
- package/dist/commands/registry.d.ts +76 -0
- package/dist/commands/registry.d.ts.map +1 -0
- package/dist/commands/registry.js +351 -0
- package/dist/commands/registry.js.map +1 -0
- package/dist/commands/skill-commands.d.ts +35 -0
- package/dist/commands/skill-commands.d.ts.map +1 -0
- package/dist/commands/skill-commands.js +61 -0
- package/dist/commands/skill-commands.js.map +1 -0
- package/dist/config/resolve.d.ts +25 -0
- package/dist/config/resolve.d.ts.map +1 -0
- package/dist/config/resolve.js +289 -0
- package/dist/config/resolve.js.map +1 -0
- package/dist/config/schema.d.ts +520 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +123 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/core/agent-loop.d.ts +137 -0
- package/dist/core/agent-loop.d.ts.map +1 -0
- package/dist/core/agent-loop.js +700 -0
- package/dist/core/agent-loop.js.map +1 -0
- package/dist/core/audit.d.ts +87 -0
- package/dist/core/audit.d.ts.map +1 -0
- package/dist/core/audit.js +224 -0
- package/dist/core/audit.js.map +1 -0
- package/dist/core/bootstrap.d.ts +23 -0
- package/dist/core/bootstrap.d.ts.map +1 -0
- package/dist/core/bootstrap.js +162 -0
- package/dist/core/bootstrap.js.map +1 -0
- package/dist/core/context.d.ts +44 -0
- package/dist/core/context.d.ts.map +1 -0
- package/dist/core/context.js +65 -0
- package/dist/core/context.js.map +1 -0
- package/dist/core/cron.d.ts +111 -0
- package/dist/core/cron.d.ts.map +1 -0
- package/dist/core/cron.js +284 -0
- package/dist/core/cron.js.map +1 -0
- package/dist/core/exec-approvals.d.ts +50 -0
- package/dist/core/exec-approvals.d.ts.map +1 -0
- package/dist/core/exec-approvals.js +187 -0
- package/dist/core/exec-approvals.js.map +1 -0
- package/dist/core/heartbeat.d.ts +71 -0
- package/dist/core/heartbeat.d.ts.map +1 -0
- package/dist/core/heartbeat.js +214 -0
- package/dist/core/heartbeat.js.map +1 -0
- package/dist/core/message-queue.d.ts +60 -0
- package/dist/core/message-queue.d.ts.map +1 -0
- package/dist/core/message-queue.js +182 -0
- package/dist/core/message-queue.js.map +1 -0
- package/dist/core/network-policy.d.ts +39 -0
- package/dist/core/network-policy.d.ts.map +1 -0
- package/dist/core/network-policy.js +121 -0
- package/dist/core/network-policy.js.map +1 -0
- package/dist/core/progress.d.ts +48 -0
- package/dist/core/progress.d.ts.map +1 -0
- package/dist/core/progress.js +81 -0
- package/dist/core/progress.js.map +1 -0
- package/dist/core/prompt.d.ts +105 -0
- package/dist/core/prompt.d.ts.map +1 -0
- package/dist/core/prompt.js +411 -0
- package/dist/core/prompt.js.map +1 -0
- package/dist/core/pruning.d.ts +40 -0
- package/dist/core/pruning.d.ts.map +1 -0
- package/dist/core/pruning.js +165 -0
- package/dist/core/pruning.js.map +1 -0
- package/dist/core/rate-limiter.d.ts +64 -0
- package/dist/core/rate-limiter.d.ts.map +1 -0
- package/dist/core/rate-limiter.js +142 -0
- package/dist/core/rate-limiter.js.map +1 -0
- package/dist/core/reactions.d.ts +31 -0
- package/dist/core/reactions.d.ts.map +1 -0
- package/dist/core/reactions.js +67 -0
- package/dist/core/reactions.js.map +1 -0
- package/dist/core/retry-queue.d.ts +56 -0
- package/dist/core/retry-queue.d.ts.map +1 -0
- package/dist/core/retry-queue.js +106 -0
- package/dist/core/retry-queue.js.map +1 -0
- package/dist/core/sanitizer.d.ts +38 -0
- package/dist/core/sanitizer.d.ts.map +1 -0
- package/dist/core/sanitizer.js +181 -0
- package/dist/core/sanitizer.js.map +1 -0
- package/dist/core/secret-scanner.d.ts +39 -0
- package/dist/core/secret-scanner.d.ts.map +1 -0
- package/dist/core/secret-scanner.js +96 -0
- package/dist/core/secret-scanner.js.map +1 -0
- package/dist/core/secrets.d.ts +38 -0
- package/dist/core/secrets.d.ts.map +1 -0
- package/dist/core/secrets.js +137 -0
- package/dist/core/secrets.js.map +1 -0
- package/dist/core/security.d.ts +58 -0
- package/dist/core/security.d.ts.map +1 -0
- package/dist/core/security.js +120 -0
- package/dist/core/security.js.map +1 -0
- package/dist/core/self-awareness.d.ts +19 -0
- package/dist/core/self-awareness.d.ts.map +1 -0
- package/dist/core/self-awareness.js +124 -0
- package/dist/core/self-awareness.js.map +1 -0
- package/dist/core/session-init.d.ts +34 -0
- package/dist/core/session-init.d.ts.map +1 -0
- package/dist/core/session-init.js +68 -0
- package/dist/core/session-init.js.map +1 -0
- package/dist/core/streaming.d.ts +82 -0
- package/dist/core/streaming.d.ts.map +1 -0
- package/dist/core/streaming.js +264 -0
- package/dist/core/streaming.js.map +1 -0
- package/dist/core/symphony/orchestrator.d.ts +61 -0
- package/dist/core/symphony/orchestrator.d.ts.map +1 -0
- package/dist/core/symphony/orchestrator.js +476 -0
- package/dist/core/symphony/orchestrator.js.map +1 -0
- package/dist/core/symphony/status.d.ts +11 -0
- package/dist/core/symphony/status.d.ts.map +1 -0
- package/dist/core/symphony/status.js +133 -0
- package/dist/core/symphony/status.js.map +1 -0
- package/dist/core/symphony/types.d.ts +84 -0
- package/dist/core/symphony/types.d.ts.map +1 -0
- package/dist/core/symphony/types.js +5 -0
- package/dist/core/symphony/types.js.map +1 -0
- package/dist/core/symphony/workflow.d.ts +18 -0
- package/dist/core/symphony/workflow.d.ts.map +1 -0
- package/dist/core/symphony/workflow.js +149 -0
- package/dist/core/symphony/workflow.js.map +1 -0
- package/dist/core/symphony/workspace.d.ts +24 -0
- package/dist/core/symphony/workspace.d.ts.map +1 -0
- package/dist/core/symphony/workspace.js +94 -0
- package/dist/core/symphony/workspace.js.map +1 -0
- package/dist/core/thinking.d.ts +27 -0
- package/dist/core/thinking.d.ts.map +1 -0
- package/dist/core/thinking.js +83 -0
- package/dist/core/thinking.js.map +1 -0
- package/dist/core/thread-bindings.d.ts +47 -0
- package/dist/core/thread-bindings.d.ts.map +1 -0
- package/dist/core/thread-bindings.js +94 -0
- package/dist/core/thread-bindings.js.map +1 -0
- package/dist/core/timezone.d.ts +28 -0
- package/dist/core/timezone.d.ts.map +1 -0
- package/dist/core/timezone.js +72 -0
- package/dist/core/timezone.js.map +1 -0
- package/dist/core/tool-loop-detector.d.ts +41 -0
- package/dist/core/tool-loop-detector.d.ts.map +1 -0
- package/dist/core/tool-loop-detector.js +83 -0
- package/dist/core/tool-loop-detector.js.map +1 -0
- package/dist/core/tool-validator.d.ts +44 -0
- package/dist/core/tool-validator.d.ts.map +1 -0
- package/dist/core/tool-validator.js +175 -0
- package/dist/core/tool-validator.js.map +1 -0
- package/dist/core/typing.d.ts +25 -0
- package/dist/core/typing.d.ts.map +1 -0
- package/dist/core/typing.js +48 -0
- package/dist/core/typing.js.map +1 -0
- package/dist/core/usage-tracker.d.ts +66 -0
- package/dist/core/usage-tracker.d.ts.map +1 -0
- package/dist/core/usage-tracker.js +163 -0
- package/dist/core/usage-tracker.js.map +1 -0
- package/dist/daemon/commands.d.ts +16 -0
- package/dist/daemon/commands.d.ts.map +1 -0
- package/dist/daemon/commands.js +445 -0
- package/dist/daemon/commands.js.map +1 -0
- package/dist/daemon/pid.d.ts +30 -0
- package/dist/daemon/pid.d.ts.map +1 -0
- package/dist/daemon/pid.js +62 -0
- package/dist/daemon/pid.js.map +1 -0
- package/dist/doctor/checks/browser.d.ts +9 -0
- package/dist/doctor/checks/browser.d.ts.map +1 -0
- package/dist/doctor/checks/browser.js +54 -0
- package/dist/doctor/checks/browser.js.map +1 -0
- package/dist/doctor/checks/channels.d.ts +9 -0
- package/dist/doctor/checks/channels.d.ts.map +1 -0
- package/dist/doctor/checks/channels.js +90 -0
- package/dist/doctor/checks/channels.js.map +1 -0
- package/dist/doctor/checks/config.d.ts +10 -0
- package/dist/doctor/checks/config.d.ts.map +1 -0
- package/dist/doctor/checks/config.js +89 -0
- package/dist/doctor/checks/config.js.map +1 -0
- package/dist/doctor/checks/memory.d.ts +10 -0
- package/dist/doctor/checks/memory.d.ts.map +1 -0
- package/dist/doctor/checks/memory.js +82 -0
- package/dist/doctor/checks/memory.js.map +1 -0
- package/dist/doctor/checks/permissions.d.ts +9 -0
- package/dist/doctor/checks/permissions.d.ts.map +1 -0
- package/dist/doctor/checks/permissions.js +53 -0
- package/dist/doctor/checks/permissions.js.map +1 -0
- package/dist/doctor/checks/providers.d.ts +10 -0
- package/dist/doctor/checks/providers.d.ts.map +1 -0
- package/dist/doctor/checks/providers.js +93 -0
- package/dist/doctor/checks/providers.js.map +1 -0
- package/dist/doctor/checks/sessions.d.ts +10 -0
- package/dist/doctor/checks/sessions.d.ts.map +1 -0
- package/dist/doctor/checks/sessions.js +86 -0
- package/dist/doctor/checks/sessions.js.map +1 -0
- package/dist/doctor/doctor.d.ts +35 -0
- package/dist/doctor/doctor.d.ts.map +1 -0
- package/dist/doctor/doctor.js +51 -0
- package/dist/doctor/doctor.js.map +1 -0
- package/dist/doctor/repairs.d.ts +14 -0
- package/dist/doctor/repairs.d.ts.map +1 -0
- package/dist/doctor/repairs.js +34 -0
- package/dist/doctor/repairs.js.map +1 -0
- package/dist/gateway/compaction.d.ts +63 -0
- package/dist/gateway/compaction.d.ts.map +1 -0
- package/dist/gateway/compaction.js +235 -0
- package/dist/gateway/compaction.js.map +1 -0
- package/dist/gateway/gateway.d.ts +94 -0
- package/dist/gateway/gateway.d.ts.map +1 -0
- package/dist/gateway/gateway.js +466 -0
- package/dist/gateway/gateway.js.map +1 -0
- package/dist/gateway/lock.d.ts +24 -0
- package/dist/gateway/lock.d.ts.map +1 -0
- package/dist/gateway/lock.js +88 -0
- package/dist/gateway/lock.js.map +1 -0
- package/dist/gateway/protocol.d.ts +117 -0
- package/dist/gateway/protocol.d.ts.map +1 -0
- package/dist/gateway/protocol.js +5 -0
- package/dist/gateway/protocol.js.map +1 -0
- package/dist/gateway/session.d.ts +123 -0
- package/dist/gateway/session.d.ts.map +1 -0
- package/dist/gateway/session.js +573 -0
- package/dist/gateway/session.js.map +1 -0
- package/dist/hooks/hooks.d.ts +18 -0
- package/dist/hooks/hooks.d.ts.map +1 -0
- package/dist/hooks/hooks.js +45 -0
- package/dist/hooks/hooks.js.map +1 -0
- package/dist/hooks/types.d.ts +112 -0
- package/dist/hooks/types.d.ts.map +1 -0
- package/dist/hooks/types.js +23 -0
- package/dist/hooks/types.js.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2900 -0
- package/dist/index.js.map +1 -0
- package/dist/media/storage.d.ts +25 -0
- package/dist/media/storage.d.ts.map +1 -0
- package/dist/media/storage.js +97 -0
- package/dist/media/storage.js.map +1 -0
- package/dist/memory/embeddings.d.ts +46 -0
- package/dist/memory/embeddings.d.ts.map +1 -0
- package/dist/memory/embeddings.js +118 -0
- package/dist/memory/embeddings.js.map +1 -0
- package/dist/memory/hybrid.d.ts +35 -0
- package/dist/memory/hybrid.d.ts.map +1 -0
- package/dist/memory/hybrid.js +156 -0
- package/dist/memory/hybrid.js.map +1 -0
- package/dist/memory/markdown.d.ts +48 -0
- package/dist/memory/markdown.d.ts.map +1 -0
- package/dist/memory/markdown.js +228 -0
- package/dist/memory/markdown.js.map +1 -0
- package/dist/memory/store.d.ts +88 -0
- package/dist/memory/store.d.ts.map +1 -0
- package/dist/memory/store.js +21 -0
- package/dist/memory/store.js.map +1 -0
- package/dist/memory/vector.d.ts +24 -0
- package/dist/memory/vector.d.ts.map +1 -0
- package/dist/memory/vector.js +63 -0
- package/dist/memory/vector.js.map +1 -0
- package/dist/mods/mod.d.ts +100 -0
- package/dist/mods/mod.d.ts.map +1 -0
- package/dist/mods/mod.js +242 -0
- package/dist/mods/mod.js.map +1 -0
- package/dist/onboard/channels.d.ts +12 -0
- package/dist/onboard/channels.d.ts.map +1 -0
- package/dist/onboard/channels.js +283 -0
- package/dist/onboard/channels.js.map +1 -0
- package/dist/onboard/models.d.ts +13 -0
- package/dist/onboard/models.d.ts.map +1 -0
- package/dist/onboard/models.js +491 -0
- package/dist/onboard/models.js.map +1 -0
- package/dist/onboard/onboard.d.ts +12 -0
- package/dist/onboard/onboard.d.ts.map +1 -0
- package/dist/onboard/onboard.js +1137 -0
- package/dist/onboard/onboard.js.map +1 -0
- package/dist/providers/anthropic.d.ts +83 -0
- package/dist/providers/anthropic.d.ts.map +1 -0
- package/dist/providers/anthropic.js +583 -0
- package/dist/providers/anthropic.js.map +1 -0
- package/dist/providers/failover.d.ts +46 -0
- package/dist/providers/failover.d.ts.map +1 -0
- package/dist/providers/failover.js +149 -0
- package/dist/providers/failover.js.map +1 -0
- package/dist/providers/litellm.d.ts +38 -0
- package/dist/providers/litellm.d.ts.map +1 -0
- package/dist/providers/litellm.js +349 -0
- package/dist/providers/litellm.js.map +1 -0
- package/dist/providers/openai.d.ts +28 -0
- package/dist/providers/openai.d.ts.map +1 -0
- package/dist/providers/openai.js +321 -0
- package/dist/providers/openai.js.map +1 -0
- package/dist/providers/prompt-cache.d.ts +50 -0
- package/dist/providers/prompt-cache.d.ts.map +1 -0
- package/dist/providers/prompt-cache.js +96 -0
- package/dist/providers/prompt-cache.js.map +1 -0
- package/dist/providers/provider.d.ts +173 -0
- package/dist/providers/provider.d.ts.map +1 -0
- package/dist/providers/provider.js +22 -0
- package/dist/providers/provider.js.map +1 -0
- package/dist/sandbox/config.d.ts +42 -0
- package/dist/sandbox/config.d.ts.map +1 -0
- package/dist/sandbox/config.js +20 -0
- package/dist/sandbox/config.js.map +1 -0
- package/dist/sandbox/container.d.ts +71 -0
- package/dist/sandbox/container.d.ts.map +1 -0
- package/dist/sandbox/container.js +193 -0
- package/dist/sandbox/container.js.map +1 -0
- package/dist/sandbox/sandbox.d.ts +82 -0
- package/dist/sandbox/sandbox.d.ts.map +1 -0
- package/dist/sandbox/sandbox.js +176 -0
- package/dist/sandbox/sandbox.js.map +1 -0
- package/dist/skills/channel-loader.d.ts +18 -0
- package/dist/skills/channel-loader.d.ts.map +1 -0
- package/dist/skills/channel-loader.js +35 -0
- package/dist/skills/channel-loader.js.map +1 -0
- package/dist/skills/extension-loader.d.ts +15 -0
- package/dist/skills/extension-loader.d.ts.map +1 -0
- package/dist/skills/extension-loader.js +63 -0
- package/dist/skills/extension-loader.js.map +1 -0
- package/dist/skills/extension-registry.d.ts +32 -0
- package/dist/skills/extension-registry.d.ts.map +1 -0
- package/dist/skills/extension-registry.js +57 -0
- package/dist/skills/extension-registry.js.map +1 -0
- package/dist/skills/extensions.d.ts +91 -0
- package/dist/skills/extensions.d.ts.map +1 -0
- package/dist/skills/extensions.js +14 -0
- package/dist/skills/extensions.js.map +1 -0
- package/dist/skills/loader.d.ts +64 -0
- package/dist/skills/loader.d.ts.map +1 -0
- package/dist/skills/loader.js +382 -0
- package/dist/skills/loader.js.map +1 -0
- package/dist/skills/marketplace.d.ts +56 -0
- package/dist/skills/marketplace.d.ts.map +1 -0
- package/dist/skills/marketplace.js +183 -0
- package/dist/skills/marketplace.js.map +1 -0
- package/dist/skills/types.d.ts +94 -0
- package/dist/skills/types.d.ts.map +1 -0
- package/dist/skills/types.js +9 -0
- package/dist/skills/types.js.map +1 -0
- package/dist/tools/acp-sessions.d.ts +89 -0
- package/dist/tools/acp-sessions.d.ts.map +1 -0
- package/dist/tools/acp-sessions.js +391 -0
- package/dist/tools/acp-sessions.js.map +1 -0
- package/dist/tools/acp.d.ts +18 -0
- package/dist/tools/acp.d.ts.map +1 -0
- package/dist/tools/acp.js +102 -0
- package/dist/tools/acp.js.map +1 -0
- package/dist/tools/agent-tools.d.ts +24 -0
- package/dist/tools/agent-tools.d.ts.map +1 -0
- package/dist/tools/agent-tools.js +611 -0
- package/dist/tools/agent-tools.js.map +1 -0
- package/dist/tools/browser.d.ts +26 -0
- package/dist/tools/browser.d.ts.map +1 -0
- package/dist/tools/browser.js +242 -0
- package/dist/tools/browser.js.map +1 -0
- package/dist/tools/comms.d.ts +8 -0
- package/dist/tools/comms.d.ts.map +1 -0
- package/dist/tools/comms.js +39 -0
- package/dist/tools/comms.js.map +1 -0
- package/dist/tools/cron-tools.d.ts +9 -0
- package/dist/tools/cron-tools.d.ts.map +1 -0
- package/dist/tools/cron-tools.js +117 -0
- package/dist/tools/cron-tools.js.map +1 -0
- package/dist/tools/exec-safety.d.ts +71 -0
- package/dist/tools/exec-safety.d.ts.map +1 -0
- package/dist/tools/exec-safety.js +141 -0
- package/dist/tools/exec-safety.js.map +1 -0
- package/dist/tools/exec.d.ts +24 -0
- package/dist/tools/exec.d.ts.map +1 -0
- package/dist/tools/exec.js +191 -0
- package/dist/tools/exec.js.map +1 -0
- package/dist/tools/fs.d.ts +15 -0
- package/dist/tools/fs.d.ts.map +1 -0
- package/dist/tools/fs.js +249 -0
- package/dist/tools/fs.js.map +1 -0
- package/dist/tools/git.d.ts +9 -0
- package/dist/tools/git.d.ts.map +1 -0
- package/dist/tools/git.js +56 -0
- package/dist/tools/git.js.map +1 -0
- package/dist/tools/image.d.ts +15 -0
- package/dist/tools/image.d.ts.map +1 -0
- package/dist/tools/image.js +106 -0
- package/dist/tools/image.js.map +1 -0
- package/dist/tools/introspect.d.ts +22 -0
- package/dist/tools/introspect.d.ts.map +1 -0
- package/dist/tools/introspect.js +223 -0
- package/dist/tools/introspect.js.map +1 -0
- package/dist/tools/memory.d.ts +11 -0
- package/dist/tools/memory.d.ts.map +1 -0
- package/dist/tools/memory.js +101 -0
- package/dist/tools/memory.js.map +1 -0
- package/dist/tools/message.d.ts +24 -0
- package/dist/tools/message.d.ts.map +1 -0
- package/dist/tools/message.js +205 -0
- package/dist/tools/message.js.map +1 -0
- package/dist/tools/model.d.ts +14 -0
- package/dist/tools/model.d.ts.map +1 -0
- package/dist/tools/model.js +62 -0
- package/dist/tools/model.js.map +1 -0
- package/dist/tools/policy.d.ts +101 -0
- package/dist/tools/policy.d.ts.map +1 -0
- package/dist/tools/policy.js +168 -0
- package/dist/tools/policy.js.map +1 -0
- package/dist/tools/registry.d.ts +52 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +154 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/search.d.ts +10 -0
- package/dist/tools/search.d.ts.map +1 -0
- package/dist/tools/search.js +78 -0
- package/dist/tools/search.js.map +1 -0
- package/dist/tools/session.d.ts +13 -0
- package/dist/tools/session.d.ts.map +1 -0
- package/dist/tools/session.js +142 -0
- package/dist/tools/session.js.map +1 -0
- package/dist/tools/spawn.d.ts +10 -0
- package/dist/tools/spawn.d.ts.map +1 -0
- package/dist/tools/spawn.js +72 -0
- package/dist/tools/spawn.js.map +1 -0
- package/dist/tools/symphony.d.ts +12 -0
- package/dist/tools/symphony.d.ts.map +1 -0
- package/dist/tools/symphony.js +142 -0
- package/dist/tools/symphony.js.map +1 -0
- package/dist/tools/system-tools.d.ts +11 -0
- package/dist/tools/system-tools.d.ts.map +1 -0
- package/dist/tools/system-tools.js +39 -0
- package/dist/tools/system-tools.js.map +1 -0
- package/dist/tools/tool.d.ts +119 -0
- package/dist/tools/tool.d.ts.map +1 -0
- package/dist/tools/tool.js +29 -0
- package/dist/tools/tool.js.map +1 -0
- package/dist/tools/web.d.ts +10 -0
- package/dist/tools/web.d.ts.map +1 -0
- package/dist/tools/web.js +105 -0
- package/dist/tools/web.js.map +1 -0
- package/dist/tui/App.d.ts +43 -0
- package/dist/tui/App.d.ts.map +1 -0
- package/dist/tui/App.js +265 -0
- package/dist/tui/App.js.map +1 -0
- package/dist/tui/bridge.d.ts +40 -0
- package/dist/tui/bridge.d.ts.map +1 -0
- package/dist/tui/bridge.js +29 -0
- package/dist/tui/bridge.js.map +1 -0
- package/dist/tui/components/Header.d.ts +14 -0
- package/dist/tui/components/Header.d.ts.map +1 -0
- package/dist/tui/components/Header.js +7 -0
- package/dist/tui/components/Header.js.map +1 -0
- package/dist/tui/components/InputBar.d.ts +10 -0
- package/dist/tui/components/InputBar.d.ts.map +1 -0
- package/dist/tui/components/InputBar.js +121 -0
- package/dist/tui/components/InputBar.js.map +1 -0
- package/dist/tui/components/MessageList.d.ts +18 -0
- package/dist/tui/components/MessageList.d.ts.map +1 -0
- package/dist/tui/components/MessageList.js +34 -0
- package/dist/tui/components/MessageList.js.map +1 -0
- package/dist/tui/components/Spinner.d.ts +9 -0
- package/dist/tui/components/Spinner.d.ts.map +1 -0
- package/dist/tui/components/Spinner.js +18 -0
- package/dist/tui/components/Spinner.js.map +1 -0
- package/dist/tui/components/StatusBar.d.ts +16 -0
- package/dist/tui/components/StatusBar.d.ts.map +1 -0
- package/dist/tui/components/StatusBar.js +15 -0
- package/dist/tui/components/StatusBar.js.map +1 -0
- package/dist/tui/components/ToolCallBox.d.ts +12 -0
- package/dist/tui/components/ToolCallBox.d.ts.map +1 -0
- package/dist/tui/components/ToolCallBox.js +12 -0
- package/dist/tui/components/ToolCallBox.js.map +1 -0
- package/dist/tui/theme.d.ts +58 -0
- package/dist/tui/theme.d.ts.map +1 -0
- package/dist/tui/theme.js +80 -0
- package/dist/tui/theme.js.map +1 -0
- package/dist/utils/logger.d.ts +16 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +70 -0
- package/dist/utils/logger.js.map +1 -0
- package/docs/DEVELOPMENT.md +74 -0
- package/docs/INSTALL.md +161 -0
- package/docs/USAGE.md +94 -0
- package/docs/architecture.md +128 -0
- package/docs/channels.md +140 -0
- package/docs/configuration.md +209 -0
- package/docs/io-system.md +430 -0
- package/docs/providers.md +99 -0
- package/docs/skill-channels.md +113 -0
- package/docs/skills.md +246 -0
- package/package.json +89 -0
- package/skills/acp-router/SKILL.md +41 -0
- package/skills/acp-router/tools/acp-router.mjs +239 -0
- package/skills/find-skills/SKILL.md +133 -0
- package/skills/security-audit/SKILL.md +181 -0
- package/skills/security-audit/audit.sh +67 -0
- package/skills/skill-creator/SKILL.md +479 -0
- package/skills/skill-security-audit/.clawhub/origin.json +7 -0
- package/skills/skill-security-audit/SKILL.md +196 -0
- package/skills/skill-security-audit/_meta.json +6 -0
- package/skills/skill-security-audit/references/prompt-injection-patterns.md +276 -0
- package/skills/skill-security-audit/references/vulnerability-patterns.md +348 -0
- package/skills/symphony/README.md +53 -0
- package/skills/symphony/SKILL.md +75 -0
- package/skills/symphony/tools/symphony-orchestrator.ts +8 -0
- package/tako.example.json +33 -0
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
# Tako I/O System Analysis
|
|
2
|
+
|
|
3
|
+
> Deep analysis of message flow, streaming architecture, backpressure handling,
|
|
4
|
+
> and error propagation through Tako's I/O pipeline.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 1. Full I/O Flow Diagram
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
┌──────────────────────┐
|
|
12
|
+
│ External World │
|
|
13
|
+
│ (Discord, Telegram, │
|
|
14
|
+
│ CLI stdin, WebSocket)│
|
|
15
|
+
└──────────┬───────────┘
|
|
16
|
+
│
|
|
17
|
+
┌────────────────────┼────────────────────┐
|
|
18
|
+
│ │ │
|
|
19
|
+
┌─────▼──────┐ ┌──────▼──────┐ ┌──────▼──────┐
|
|
20
|
+
│ CLIChannel │ │DiscordChan │ │TelegramChan │
|
|
21
|
+
│ (readline) │ │ (discord.js)│ │ (grammY) │
|
|
22
|
+
└─────┬──────┘ └──────┬──────┘ └──────┬──────┘
|
|
23
|
+
│ │ │
|
|
24
|
+
│ InboundMessage │ InboundMessage │ InboundMessage
|
|
25
|
+
│ { id, channelId, │ │
|
|
26
|
+
│ author, content }│ │
|
|
27
|
+
└────────────────────┼────────────────────┘
|
|
28
|
+
│
|
|
29
|
+
┌──────────▼───────────┐
|
|
30
|
+
│ index.ts (router) │
|
|
31
|
+
│ wireChannel() │
|
|
32
|
+
│ onMessage handler │
|
|
33
|
+
└──────────┬───────────┘
|
|
34
|
+
│
|
|
35
|
+
┌──────────────┼──────────────┐
|
|
36
|
+
│ │ │
|
|
37
|
+
hooks.emit getSession() hooks.emit
|
|
38
|
+
'message_ (Map lookup 'before_prompt_
|
|
39
|
+
received' or create) build'
|
|
40
|
+
│ │ │
|
|
41
|
+
└──────────────┼──────────────┘
|
|
42
|
+
│
|
|
43
|
+
┌──────────▼───────────┐
|
|
44
|
+
│ AgentLoop.run() │
|
|
45
|
+
│ (AsyncGenerator) │
|
|
46
|
+
└──────────┬───────────┘
|
|
47
|
+
│
|
|
48
|
+
┌────────────────────┼────────────────────┐
|
|
49
|
+
│ │ │
|
|
50
|
+
PromptBuilder ContextManager ToolRegistry
|
|
51
|
+
.build('full') .needsCompaction() .getActiveTools()
|
|
52
|
+
│ │ │
|
|
53
|
+
│ system prompt │ token check │ Tool[]
|
|
54
|
+
│ (up to 150KB) │ │
|
|
55
|
+
└────────────────────┼────────────────────┘
|
|
56
|
+
│
|
|
57
|
+
┌──────────▼───────────┐
|
|
58
|
+
│ AnthropicProvider │
|
|
59
|
+
│ .chat(req) │
|
|
60
|
+
│ (AsyncIterable) │
|
|
61
|
+
└──────────┬───────────┘
|
|
62
|
+
│
|
|
63
|
+
┌──────────▼───────────┐
|
|
64
|
+
│ Anthropic SSE Stream │
|
|
65
|
+
│ │
|
|
66
|
+
│ message_start │
|
|
67
|
+
│ content_block_start │
|
|
68
|
+
│ content_block_delta ─┼──► yield { text: "..." }
|
|
69
|
+
│ content_block_stop │
|
|
70
|
+
│ message_delta │
|
|
71
|
+
│ message_stop ────────┼──► yield { tool_calls, done }
|
|
72
|
+
└──────────┬───────────┘
|
|
73
|
+
│
|
|
74
|
+
┌──────────▼───────────┐
|
|
75
|
+
│ Tool Execution │
|
|
76
|
+
│ (sequential loop) │
|
|
77
|
+
│ │
|
|
78
|
+
│ for (tc of calls) { │
|
|
79
|
+
│ hooks: before_call │
|
|
80
|
+
│ tool.execute() │
|
|
81
|
+
│ hooks: after_call │
|
|
82
|
+
│ push toolMsg │
|
|
83
|
+
│ } │
|
|
84
|
+
└──────────┬───────────┘
|
|
85
|
+
│
|
|
86
|
+
│ (loop back to Provider
|
|
87
|
+
│ if tool_calls existed)
|
|
88
|
+
│
|
|
89
|
+
┌──────────▼───────────┐
|
|
90
|
+
│ Response Delivery │
|
|
91
|
+
│ │
|
|
92
|
+
│ CLI: stdout.write() │
|
|
93
|
+
│ Discord: channel.send│
|
|
94
|
+
│ Telegram: api.send │
|
|
95
|
+
│ Gateway: ws.send() │
|
|
96
|
+
└──────────────────────┘
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## 2. Message Flow — Detailed Trace
|
|
102
|
+
|
|
103
|
+
### Phase 1: Channel Intake
|
|
104
|
+
|
|
105
|
+
A message arrives at a channel adapter. Each adapter normalizes it into `InboundMessage`:
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
User types "hello" in Discord
|
|
109
|
+
→ discord.js Events.MessageCreate fires
|
|
110
|
+
→ DiscordChannel.convertInbound() creates:
|
|
111
|
+
{
|
|
112
|
+
id: "1234567890",
|
|
113
|
+
channelId: "discord:987654321",
|
|
114
|
+
author: { id: "user123", name: "alice" },
|
|
115
|
+
content: "hello",
|
|
116
|
+
attachments: [],
|
|
117
|
+
timestamp: "2026-03-05T00:00:00.000Z"
|
|
118
|
+
}
|
|
119
|
+
→ handler(inbound) called
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**Key design**: All three channel adapters (CLI, Discord, Telegram) produce identical `InboundMessage` objects. The agent loop never sees channel-specific types.
|
|
123
|
+
|
|
124
|
+
### Phase 2: Session Resolution
|
|
125
|
+
|
|
126
|
+
In `index.ts`, the `wireChannel()` closure handles routing:
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
function getSession(msg: InboundMessage) {
|
|
130
|
+
const key = `${msg.channelId}:${msg.author.id}`; // e.g. "discord:987654321:user123"
|
|
131
|
+
let session = channelSessions.get(key);
|
|
132
|
+
if (!session) {
|
|
133
|
+
session = sessions.create({ name: `${msg.channelId}/${msg.author.name}` });
|
|
134
|
+
channelSessions.set(key, session);
|
|
135
|
+
}
|
|
136
|
+
return session;
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Sessions are keyed by `channelId:authorId`. A user on Discord gets a different session than the same concept on Telegram. Sessions persist to disk via `SessionManager` (JSON files in `.sessions/`).
|
|
141
|
+
|
|
142
|
+
### Phase 3: Agent Loop
|
|
143
|
+
|
|
144
|
+
`AgentLoop.run()` is an `AsyncGenerator` that yields text chunks:
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
1. Fire 'agent_start' hook
|
|
148
|
+
2. Fire 'before_prompt_build' hook
|
|
149
|
+
3. PromptBuilder.build({ mode: 'full' })
|
|
150
|
+
→ Read SOUL.md, IDENTITY.md, AGENTS.md, TOOLS.md, USER.md, HEARTBEAT.md, BOOTSTRAP.md
|
|
151
|
+
→ Read memory/MEMORY.md (curated memory)
|
|
152
|
+
→ Append skill instructions
|
|
153
|
+
→ Append runtime context (date, platform, workspace)
|
|
154
|
+
→ Concatenate with "---" separators (up to 150KB total)
|
|
155
|
+
4. Append user message to session.messages
|
|
156
|
+
5. Get tool definitions from ToolRegistry
|
|
157
|
+
6. LOOP (max 20 turns):
|
|
158
|
+
a. Check context window (ContextManager.needsCompaction)
|
|
159
|
+
b. Provider.chat() → stream chunks
|
|
160
|
+
→ yield text chunks as they arrive
|
|
161
|
+
→ accumulate tool_calls
|
|
162
|
+
c. Append assistant message to session
|
|
163
|
+
d. If no tool_calls → break
|
|
164
|
+
e. Execute tools sequentially
|
|
165
|
+
→ Fire 'before_tool_call' for each
|
|
166
|
+
→ tool.execute(params, ctx)
|
|
167
|
+
→ Fire 'after_tool_call' for each
|
|
168
|
+
→ Append tool result messages to session
|
|
169
|
+
f. Continue loop (next inference with tool results)
|
|
170
|
+
7. Fire 'agent_end' hook
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Phase 4: Response Delivery
|
|
174
|
+
|
|
175
|
+
For **CLI**: Text chunks are written to `stdout` immediately as they arrive from the generator:
|
|
176
|
+
```typescript
|
|
177
|
+
for await (const chunk of agentLoop.run(session, msg.content)) {
|
|
178
|
+
process.stdout.write(chunk); // Real-time streaming
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
For **Discord/Telegram**: The entire response is accumulated, then sent:
|
|
183
|
+
```typescript
|
|
184
|
+
let response = '';
|
|
185
|
+
for await (const chunk of agentLoop.run(session, msg.content)) {
|
|
186
|
+
response += chunk;
|
|
187
|
+
}
|
|
188
|
+
if (response) {
|
|
189
|
+
await channel.send({ target, content: response, replyTo: msg.id });
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
For **Gateway (WebSocket)**: Chunks are forwarded individually:
|
|
194
|
+
```typescript
|
|
195
|
+
for await (const chunk of this.deps.agentLoop.run(session, content)) {
|
|
196
|
+
this.sendToClient(client, { type: 'chunk', sessionId, text: chunk });
|
|
197
|
+
}
|
|
198
|
+
this.sendToClient(client, { type: 'done', sessionId });
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## 3. Streaming Architecture
|
|
204
|
+
|
|
205
|
+
### Anthropic SSE → AsyncIterable → Channel
|
|
206
|
+
|
|
207
|
+
The streaming pipeline has three stages:
|
|
208
|
+
|
|
209
|
+
```
|
|
210
|
+
Stage 1: Anthropic HTTP SSE
|
|
211
|
+
↓ HTTP chunked transfer encoding
|
|
212
|
+
↓ Server-Sent Events (text/event-stream)
|
|
213
|
+
↓ Event types: message_start, content_block_start,
|
|
214
|
+
↓ content_block_delta, content_block_stop,
|
|
215
|
+
↓ message_delta, message_stop
|
|
216
|
+
|
|
217
|
+
Stage 2: AnthropicProvider.chatStreaming()
|
|
218
|
+
↓ Parses SSE events into ChatChunk objects
|
|
219
|
+
↓ Text deltas yielded immediately: { text: "...", done: false }
|
|
220
|
+
↓ Tool call JSON accumulated incrementally (input_json_delta)
|
|
221
|
+
↓ Final chunk: { tool_calls: [...], done: true, usage: {...} }
|
|
222
|
+
|
|
223
|
+
Stage 3: AgentLoop.run()
|
|
224
|
+
↓ Re-yields text chunks from provider
|
|
225
|
+
↓ Accumulates tool calls
|
|
226
|
+
↓ On provider completion: executes tools, loops back
|
|
227
|
+
|
|
228
|
+
Stage 4: Channel delivery
|
|
229
|
+
↓ CLI: immediate stdout.write per chunk
|
|
230
|
+
↓ Discord/Telegram: accumulate full response, then send
|
|
231
|
+
↓ Gateway WS: forward each chunk as JSON frame
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### Tool Call Streaming Detail
|
|
235
|
+
|
|
236
|
+
Tool calls are streamed incrementally from Anthropic:
|
|
237
|
+
|
|
238
|
+
```
|
|
239
|
+
content_block_start → { type: "tool_use", id: "toolu_xxx", name: "read" }
|
|
240
|
+
input_json_delta → '{"pa'
|
|
241
|
+
input_json_delta → 'th": '
|
|
242
|
+
input_json_delta → '"src/index.ts"}'
|
|
243
|
+
content_block_stop → (tool call complete)
|
|
244
|
+
message_stop → (parse accumulated JSON, emit as ToolCall)
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
The `AnthropicProvider` accumulates `inputJson` as a string and only parses it on `message_stop`. This means tool calls are not available until the full response is complete.
|
|
248
|
+
|
|
249
|
+
### Streaming Gaps
|
|
250
|
+
|
|
251
|
+
1. **Discord/Telegram don't stream**: They buffer the entire response. reference architecture's channel trait includes `send_draft()` / `update_draft()` / `finalize_draft()` for progressive updates — Tako doesn't have this yet.
|
|
252
|
+
|
|
253
|
+
2. **Tool results aren't streamed to WebSocket**: The Gateway sends `chunk` messages for text but doesn't emit `tool_call` / `tool_result` events (the protocol types exist but aren't used in `handleChat()`).
|
|
254
|
+
|
|
255
|
+
3. **No thinking stream**: When using extended thinking, thinking tokens aren't surfaced to the consumer.
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## 4. Backpressure Analysis
|
|
260
|
+
|
|
261
|
+
### Does Tako Handle Slow Consumers?
|
|
262
|
+
|
|
263
|
+
**Short answer: No.** There is no backpressure mechanism.
|
|
264
|
+
|
|
265
|
+
### Analysis by Component
|
|
266
|
+
|
|
267
|
+
#### CLI Channel
|
|
268
|
+
- **Producer**: `agentLoop.run()` yields chunks
|
|
269
|
+
- **Consumer**: `process.stdout.write(chunk)`
|
|
270
|
+
- **Backpressure**: stdout is a writable stream with internal buffering. If the terminal can't keep up, `write()` returns `false`, but Tako ignores the return value. In practice, terminals are fast enough that this never matters.
|
|
271
|
+
|
|
272
|
+
#### Discord Channel
|
|
273
|
+
- **Producer**: Full response accumulated in string
|
|
274
|
+
- **Consumer**: `channel.send()` → Discord API HTTP POST
|
|
275
|
+
- **Backpressure**: Discord rate limits (5 messages/5 seconds per channel). Tako's `splitMessage()` sends chunks sequentially with `await`, so rate limits would cause the sender to wait. But there's no queue or retry — if Discord rejects, the error propagates up.
|
|
276
|
+
|
|
277
|
+
#### Telegram Channel
|
|
278
|
+
- **Producer**: Full response accumulated
|
|
279
|
+
- **Consumer**: `bot.api.sendMessage()` → Telegram Bot API
|
|
280
|
+
- **Backpressure**: Similar to Discord. Telegram rate limits are per-bot. No queue.
|
|
281
|
+
|
|
282
|
+
#### Gateway WebSocket
|
|
283
|
+
- **Producer**: `agentLoop.run()` yields chunks
|
|
284
|
+
- **Consumer**: `client.ws.send(JSON.stringify(msg))`
|
|
285
|
+
- **Backpressure**: The `ws` library buffers sends internally. If the WebSocket buffer fills (client can't drain fast enough), `send()` calls accumulate in memory. The only protection is the `readyState` check:
|
|
286
|
+
```typescript
|
|
287
|
+
if (client.ws.readyState !== WebSocket.OPEN) break;
|
|
288
|
+
```
|
|
289
|
+
This stops sending if the connection drops, but doesn't handle slow consumers.
|
|
290
|
+
|
|
291
|
+
### What Happens When a Channel Can't Keep Up?
|
|
292
|
+
|
|
293
|
+
1. **Memory grows**: Undelivered messages accumulate in Node.js heap
|
|
294
|
+
2. **Event loop blocks**: Sequential message sends block other handlers
|
|
295
|
+
3. **No circuit breaker**: A slow channel blocks the agent loop for that session (but not other sessions, since each session's handler runs independently)
|
|
296
|
+
|
|
297
|
+
### Recommendations
|
|
298
|
+
|
|
299
|
+
1. **Add WebSocket buffering limits**: Track `ws.bufferedAmount` and pause the generator if backlog exceeds a threshold
|
|
300
|
+
2. **Add channel send timeouts**: Wrap `channel.send()` with `AbortSignal.timeout()`
|
|
301
|
+
3. **Implement draft updates for Discord/Telegram**: Progressive message editing instead of buffering the full response
|
|
302
|
+
4. **Consider `for await` with buffering**: Use a bounded async queue between the generator and the consumer
|
|
303
|
+
|
|
304
|
+
---
|
|
305
|
+
|
|
306
|
+
## 5. Error Propagation
|
|
307
|
+
|
|
308
|
+
### Error Flow Diagram
|
|
309
|
+
|
|
310
|
+
```
|
|
311
|
+
Anthropic API Error
|
|
312
|
+
↓ thrown inside provider.chat() generator
|
|
313
|
+
↓ caught by for-await-of in AgentLoop.run()
|
|
314
|
+
↓ NOT caught — propagates out of the generator
|
|
315
|
+
↓
|
|
316
|
+
wireChannel handler catches it:
|
|
317
|
+
catch (err) {
|
|
318
|
+
console.error('[tako] Error:', err.message);
|
|
319
|
+
}
|
|
320
|
+
↓ CLI: error printed, re-prompt shown
|
|
321
|
+
↓ Discord/Telegram: error logged, no response sent to user
|
|
322
|
+
↓ Gateway: caught in handleChat(), sent as { type: 'error' }
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
### Error Sources and Handling
|
|
326
|
+
|
|
327
|
+
| Error Source | Where Caught | User Impact |
|
|
328
|
+
|-------------|-------------|-------------|
|
|
329
|
+
| **API auth failure (401/403)** | `AnthropicProvider.wrapAuthError()` | Thrown, logged, no response |
|
|
330
|
+
| **API rate limit (429)** | `AnthropicProvider.chat()` — tries next key | Transparent if multiple keys, error if all exhausted |
|
|
331
|
+
| **API timeout** | Node.js fetch timeout | Thrown, no response |
|
|
332
|
+
| **Tool execution error** | `tool.execute()` returns `{ success: false }` | Model sees error, retries or reports |
|
|
333
|
+
| **JSON parse error (tool args)** | `JSON.parse(tc.inputJson)` in streaming | Thrown, breaks agent loop |
|
|
334
|
+
| **File read error (prompt)** | `PromptBuilder.loadFile()` returns `''` | Silent — missing file treated as empty |
|
|
335
|
+
| **Session not found** | Various — returns error result | Reported to client |
|
|
336
|
+
| **WebSocket disconnect** | `readyState` check in Gateway | Stops streaming, no cleanup |
|
|
337
|
+
| **Channel send failure** | Per-channel error handling | Logged, no retry |
|
|
338
|
+
|
|
339
|
+
### Error Handling Patterns
|
|
340
|
+
|
|
341
|
+
**Good patterns in Tako:**
|
|
342
|
+
1. **Graceful file missing**: `loadFile()` catches errors and returns empty string — missing workspace files don't crash
|
|
343
|
+
2. **Key rotation**: Anthropic provider tries multiple API keys before failing
|
|
344
|
+
3. **Tool error isolation**: A failing tool returns `ToolResult { success: false }` — the model sees the error and can retry or report it
|
|
345
|
+
4. **Auth error wrapping**: `wrapAuthError()` provides clear messages for 401/403
|
|
346
|
+
|
|
347
|
+
**Gaps in error handling:**
|
|
348
|
+
1. **No retry logic**: Network errors on provider calls are not retried
|
|
349
|
+
2. **Silent channel failures**: If Discord/Telegram `send()` fails, the user gets no response and no notification
|
|
350
|
+
3. **JSON parse crash**: If Anthropic sends malformed tool call JSON, `JSON.parse()` throws and breaks the loop — should catch and return error to model
|
|
351
|
+
4. **No error hook**: There's no `'error'` hook event for skills to observe
|
|
352
|
+
5. **Memory store errors are swallowed**: `HybridMemoryStore.initialize()` catches all errors silently — a corrupted index goes unnoticed
|
|
353
|
+
|
|
354
|
+
### Error Recovery Recommendations
|
|
355
|
+
|
|
356
|
+
1. **Add retry with exponential backoff** for provider API calls (network errors, 500s)
|
|
357
|
+
2. **Wrap JSON.parse in try/catch** in the streaming tool call accumulator
|
|
358
|
+
3. **Send error messages to channels** — if the agent loop fails, send a user-visible error like "Something went wrong, please try again"
|
|
359
|
+
4. **Add `'error'` hook event** — skills should be able to observe and react to errors
|
|
360
|
+
5. **Log + alert on repeated failures** — if the same provider/channel fails repeatedly, surface it in `tako doctor`
|
|
361
|
+
|
|
362
|
+
---
|
|
363
|
+
|
|
364
|
+
## 6. Data Contracts Between Layers
|
|
365
|
+
|
|
366
|
+
### Channel → Router
|
|
367
|
+
|
|
368
|
+
```typescript
|
|
369
|
+
InboundMessage {
|
|
370
|
+
id: string // platform-specific message ID
|
|
371
|
+
channelId: string // "cli" | "discord:{channelId}" | "telegram:{chatId}"
|
|
372
|
+
author: { id: string; name: string }
|
|
373
|
+
content: string // plain text
|
|
374
|
+
timestamp: string // ISO-8601
|
|
375
|
+
}
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
### Router → Agent Loop
|
|
379
|
+
|
|
380
|
+
```typescript
|
|
381
|
+
// Passes:
|
|
382
|
+
session: Session // from SessionManager
|
|
383
|
+
userMessage: string // msg.content
|
|
384
|
+
// Returns:
|
|
385
|
+
AsyncIterable<string> // text chunks
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
### Agent Loop → Provider
|
|
389
|
+
|
|
390
|
+
```typescript
|
|
391
|
+
ChatRequest {
|
|
392
|
+
model: string
|
|
393
|
+
messages: ChatMessage[] // system + history + user
|
|
394
|
+
tools?: ToolDefinition[]
|
|
395
|
+
stream: true
|
|
396
|
+
}
|
|
397
|
+
// Returns:
|
|
398
|
+
AsyncIterable<ChatChunk> // text + tool_calls
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
### Agent Loop → Tools
|
|
402
|
+
|
|
403
|
+
```typescript
|
|
404
|
+
// Input:
|
|
405
|
+
params: unknown // parsed from model's tool_call.input
|
|
406
|
+
ctx: ToolContext {
|
|
407
|
+
sessionId: string
|
|
408
|
+
workDir: string
|
|
409
|
+
workspaceRoot: string
|
|
410
|
+
}
|
|
411
|
+
// Output:
|
|
412
|
+
ToolResult {
|
|
413
|
+
output: string // fed back to model
|
|
414
|
+
success: boolean
|
|
415
|
+
}
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
### Gateway → WebSocket Client
|
|
419
|
+
|
|
420
|
+
```typescript
|
|
421
|
+
ServerMessage =
|
|
422
|
+
| { type: 'chunk'; sessionId; text } // streaming text
|
|
423
|
+
| { type: 'done'; sessionId } // response complete
|
|
424
|
+
| { type: 'error'; sessionId; message } // error
|
|
425
|
+
| { type: 'session_created'; ... } // session lifecycle
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
---
|
|
429
|
+
|
|
430
|
+
*Analysis based on Tako v0.4.0 source code, March 2026.*
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Providers
|
|
2
|
+
|
|
3
|
+
Providers adapt LLM APIs into Tako's unified streaming interface.
|
|
4
|
+
|
|
5
|
+
## Anthropic (Built-in)
|
|
6
|
+
|
|
7
|
+
The primary provider with full native implementation.
|
|
8
|
+
|
|
9
|
+
**Configuration:**
|
|
10
|
+
```json
|
|
11
|
+
{
|
|
12
|
+
"providers": {
|
|
13
|
+
"primary": "anthropic/claude-sonnet-4-6"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
**Auth options:**
|
|
19
|
+
- **Setup token (OAuth):** `tako models auth login --provider anthropic`
|
|
20
|
+
- **API key:** `ANTHROPIC_API_KEY` env var or via `tako onboard`
|
|
21
|
+
- **Multi-key rotation:** `ANTHROPIC_API_KEYS=key1,key2` (comma-separated, rotated per request)
|
|
22
|
+
|
|
23
|
+
**Available models:**
|
|
24
|
+
|
|
25
|
+
| Model | Context | Max Output | Capabilities |
|
|
26
|
+
|-------|---------|------------|--------------|
|
|
27
|
+
| `claude-opus-4-6` | 200K | 32K | vision, tools, streaming |
|
|
28
|
+
| `claude-sonnet-4-6` | 200K | 8K | vision, tools, streaming |
|
|
29
|
+
| `claude-haiku-4-5` | 200K | 8K | vision, tools, streaming |
|
|
30
|
+
|
|
31
|
+
**Features:**
|
|
32
|
+
- Streaming via Server-Sent Events (SSE)
|
|
33
|
+
- Incremental tool call parsing (`input_json_delta`)
|
|
34
|
+
- System prompt extraction from message array
|
|
35
|
+
- Token usage tracking
|
|
36
|
+
- Tool use/result pairing repair for API compatibility
|
|
37
|
+
|
|
38
|
+
## OpenAI (Built-in)
|
|
39
|
+
|
|
40
|
+
OpenAI Chat Completions API support.
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
{
|
|
44
|
+
"providers": {
|
|
45
|
+
"primary": "openai/gpt-5.2"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Auth:** `OPENAI_API_KEY` env var or `tako models auth login --provider openai`
|
|
51
|
+
|
|
52
|
+
## LiteLLM (Built-in)
|
|
53
|
+
|
|
54
|
+
Universal proxy adapter for 100+ providers via LiteLLM's OpenAI-compatible API.
|
|
55
|
+
|
|
56
|
+
```json
|
|
57
|
+
{
|
|
58
|
+
"providers": {
|
|
59
|
+
"primary": "litellm/anthropic/claude-sonnet-4-6",
|
|
60
|
+
"litellm": {
|
|
61
|
+
"baseUrl": "http://localhost:4000",
|
|
62
|
+
"model": "anthropic/claude-sonnet-4-6"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**Features:**
|
|
69
|
+
- Preset endpoint support for popular proxies
|
|
70
|
+
- Dynamic model fetching from proxy `/models` endpoint
|
|
71
|
+
- Automatic retry on 400 errors (proxy warmup/transient failures)
|
|
72
|
+
- Message sanitization for proxy compatibility
|
|
73
|
+
|
|
74
|
+
**Setup:** `tako onboard` includes LiteLLM configuration with proxy URL and model selection.
|
|
75
|
+
|
|
76
|
+
## Custom Providers
|
|
77
|
+
|
|
78
|
+
Implement the `Provider` interface in `src/providers/provider.ts`:
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
import type { Provider, ChatRequest, ChatChunk, ModelInfo } from './provider.js';
|
|
82
|
+
|
|
83
|
+
export class MyProvider implements Provider {
|
|
84
|
+
id = 'my-provider';
|
|
85
|
+
|
|
86
|
+
async *chat(req: ChatRequest): AsyncIterable<ChatChunk> {
|
|
87
|
+
// Stream chunks from your API
|
|
88
|
+
yield { text: 'Hello!', done: true };
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
models(): ModelInfo[] {
|
|
92
|
+
return [{ id: 'my-model', name: 'My Model', provider: 'my-provider', context_window: 128000, max_output_tokens: 4096, capabilities: ['tools'] }];
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
supports(capability: string): boolean {
|
|
96
|
+
return ['tools', 'streaming'].includes(capability);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
```
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Skill-Loaded Channels
|
|
2
|
+
|
|
3
|
+
Skills can provide channel adapters, letting Tako connect to any messaging
|
|
4
|
+
platform without modifying the kernel.
|
|
5
|
+
|
|
6
|
+
## Skill structure
|
|
7
|
+
|
|
8
|
+
```
|
|
9
|
+
skills/feishu/
|
|
10
|
+
├── SKILL.md # Frontmatter + instructions
|
|
11
|
+
├── channel/
|
|
12
|
+
│ └── index.ts # exports createChannel(config) → Channel
|
|
13
|
+
├── tools/ # Optional tools
|
|
14
|
+
│ └── feishu-tools.ts
|
|
15
|
+
└── package.json # Platform SDK dependency
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## SKILL.md
|
|
19
|
+
|
|
20
|
+
```yaml
|
|
21
|
+
---
|
|
22
|
+
name: feishu
|
|
23
|
+
description: Feishu/Lark messaging channel
|
|
24
|
+
user-invocable: false
|
|
25
|
+
requires: {"env": ["FEISHU_APP_ID", "FEISHU_APP_SECRET"]}
|
|
26
|
+
---
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Channel module
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
// channel/index.ts
|
|
33
|
+
import type { Channel, InboundMessage, OutboundMessage, MessageHandler } from 'tako/channels/channel';
|
|
34
|
+
|
|
35
|
+
export function createChannel(config: { appId: string; appSecret: string }): Channel {
|
|
36
|
+
return new FeishuChannel(config);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
class FeishuChannel implements Channel {
|
|
40
|
+
id = 'feishu';
|
|
41
|
+
private handler: MessageHandler | null = null;
|
|
42
|
+
|
|
43
|
+
constructor(private config: { appId: string; appSecret: string }) {}
|
|
44
|
+
|
|
45
|
+
async connect(): Promise<void> {
|
|
46
|
+
// Connect to Feishu API, start webhook listener, etc.
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async disconnect(): Promise<void> {
|
|
50
|
+
// Clean up connections
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async send(msg: OutboundMessage): Promise<void> {
|
|
54
|
+
// Send message via Feishu API
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
onMessage(handler: MessageHandler): void {
|
|
58
|
+
this.handler = handler;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Configuration (tako.json)
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"skillChannels": {
|
|
68
|
+
"feishu": {
|
|
69
|
+
"appId": "cli_xxx",
|
|
70
|
+
"appSecret": "secret"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## How it works
|
|
77
|
+
|
|
78
|
+
1. The skill loader discovers skills with a `channel/` subdirectory and sets
|
|
79
|
+
`hasChannel: true` on the manifest.
|
|
80
|
+
|
|
81
|
+
2. During startup, after all built-in channels (CLI, Discord, Telegram) are
|
|
82
|
+
connected, Tako iterates loaded skills and calls `loadChannelFromSkill()`
|
|
83
|
+
for each skill with `hasChannel`.
|
|
84
|
+
|
|
85
|
+
3. The channel module's `createChannel(config)` function is called with
|
|
86
|
+
configuration from `skillChannels.<name>` in `tako.json`.
|
|
87
|
+
|
|
88
|
+
4. The returned `Channel` instance is wired into the same message router as
|
|
89
|
+
built-in channels — it receives the same message handling, session
|
|
90
|
+
management, and command routing.
|
|
91
|
+
|
|
92
|
+
5. The gateway also exposes `registerChannel()` / `unregisterChannel()` for
|
|
93
|
+
skills that need to register channels dynamically at runtime via hooks
|
|
94
|
+
(e.g., on `gateway_start`).
|
|
95
|
+
|
|
96
|
+
## Dynamic registration via hooks
|
|
97
|
+
|
|
98
|
+
Skills can also register channels at runtime through the hook system:
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
// In a skill's hook handler
|
|
102
|
+
hooks.on('gateway_start', async (ctx) => {
|
|
103
|
+
const { registerChannel } = ctx.data;
|
|
104
|
+
const channel = createMyChannel(config);
|
|
105
|
+
await registerChannel(channel);
|
|
106
|
+
});
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
The `gateway_start` hook context includes:
|
|
110
|
+
- `gateway` — the Gateway instance
|
|
111
|
+
- `registerChannel(channel)` — register and connect a channel
|
|
112
|
+
- `unregisterChannel(id)` — disconnect and remove a channel
|
|
113
|
+
- `config` — gateway configuration
|