@desplega.ai/agent-swarm 1.49.0 → 1.52.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/README.md +1 -1
- package/openapi.json +2070 -728
- package/package.json +10 -1
- package/src/agentmail/handlers.ts +65 -10
- package/src/agentmail/templates.ts +111 -0
- package/src/be/db.ts +1233 -7
- package/src/be/migrations/014_prompt_templates.sql +33 -0
- package/src/be/migrations/015_workflow_workspace.sql +3 -0
- package/src/be/migrations/016_active_session_runner_session.sql +4 -0
- package/src/be/migrations/017_channel_activity_cursors.sql +6 -0
- package/src/be/migrations/018_fix_seed_double_version.sql +30 -0
- package/src/be/migrations/019_skills.sql +65 -0
- package/src/be/migrations/020_approval_requests.sql +41 -0
- package/src/be/seed.ts +62 -0
- package/src/be/skill-parser.ts +70 -0
- package/src/be/skill-sync.ts +106 -0
- package/src/commands/runner.ts +320 -132
- package/src/commands/templates.ts +172 -0
- package/src/github/handlers.ts +292 -77
- package/src/github/mentions-aliases.test.ts +73 -0
- package/src/github/mentions.test.ts +3 -3
- package/src/github/mentions.ts +32 -6
- package/src/github/templates.ts +398 -0
- package/src/gitlab/handlers.ts +63 -22
- package/src/gitlab/templates.ts +140 -0
- package/src/heartbeat/heartbeat.ts +19 -10
- package/src/heartbeat/templates.ts +30 -0
- package/src/http/active-sessions.ts +27 -0
- package/src/http/approval-requests.ts +247 -0
- package/src/http/config.ts +3 -3
- package/src/http/index.ts +9 -2
- package/src/http/poll.ts +135 -14
- package/src/http/prompt-templates.ts +412 -0
- package/src/http/schedules.ts +35 -0
- package/src/http/skills.ts +479 -0
- package/src/http/workflows.ts +8 -0
- package/src/linear/sync.ts +28 -4
- package/src/linear/templates.ts +47 -0
- package/src/prompts/base-prompt.ts +41 -490
- package/src/prompts/registry.ts +57 -0
- package/src/prompts/resolver.ts +296 -0
- package/src/prompts/session-templates.ts +604 -0
- package/src/providers/claude-adapter.ts +15 -2
- package/src/providers/pi-mono-extension.ts +5 -1
- package/src/scheduler/scheduler.ts +125 -91
- package/src/server.ts +44 -0
- package/src/slack/assistant.ts +7 -4
- package/src/slack/channel-activity.ts +177 -0
- package/src/slack/handlers.ts +21 -6
- package/src/slack/templates.ts +55 -0
- package/src/tests/approval-requests.test.ts +735 -0
- package/src/tests/artifact-sdk.test.ts +12 -12
- package/src/tests/base-prompt.test.ts +49 -49
- package/src/tests/channel-activity.test.ts +363 -0
- package/src/tests/heartbeat.test.ts +1 -0
- package/src/tests/linear-webhook.test.ts +7 -3
- package/src/tests/pool-session-logs.test.ts +199 -0
- package/src/tests/prompt-template-github.test.ts +682 -0
- package/src/tests/prompt-template-remaining.test.ts +504 -0
- package/src/tests/prompt-template-resolver.test.ts +621 -0
- package/src/tests/prompt-template-session.test.ts +363 -0
- package/src/tests/prompt-templates-db.test.ts +616 -0
- package/src/tests/self-improvement.test.ts +8 -7
- package/src/tests/skill-parser.test.ts +178 -0
- package/src/tests/skill-sync.test.ts +171 -0
- package/src/tests/slack-metadata-inheritance.test.ts +1 -1
- package/src/tests/slack-thread-followups.test.ts +1 -1
- package/src/tests/structured-output.test.ts +0 -4
- package/src/tests/tool-annotations.test.ts +2 -1
- package/src/tests/update-profile-agentid.test.ts +248 -0
- package/src/tests/update-profile-auth.test.ts +195 -0
- package/src/tests/workflow-async-v2.test.ts +126 -4
- package/src/tests/workflow-definition-validation.test.ts +76 -0
- package/src/tests/workflow-executors.test.ts +4 -2
- package/src/tests/workflow-retry-v2.test.ts +1 -1
- package/src/tests/workflow-schedule-trigger.test.ts +104 -0
- package/src/tests/workflow-workspace.test.ts +272 -0
- package/src/tools/prompt-templates/delete.ts +86 -0
- package/src/tools/prompt-templates/get.ts +89 -0
- package/src/tools/prompt-templates/index.ts +5 -0
- package/src/tools/prompt-templates/list.ts +95 -0
- package/src/tools/prompt-templates/preview.ts +84 -0
- package/src/tools/prompt-templates/set.ts +117 -0
- package/src/tools/request-human-input.ts +106 -0
- package/src/tools/skills/index.ts +11 -0
- package/src/tools/skills/skill-create.ts +105 -0
- package/src/tools/skills/skill-delete.ts +67 -0
- package/src/tools/skills/skill-get.ts +75 -0
- package/src/tools/skills/skill-install-remote.ts +152 -0
- package/src/tools/skills/skill-install.ts +101 -0
- package/src/tools/skills/skill-list.ts +77 -0
- package/src/tools/skills/skill-publish.ts +123 -0
- package/src/tools/skills/skill-search.ts +43 -0
- package/src/tools/skills/skill-sync-remote.ts +128 -0
- package/src/tools/skills/skill-uninstall.ts +60 -0
- package/src/tools/skills/skill-update.ts +128 -0
- package/src/tools/store-progress.ts +22 -4
- package/src/tools/task-action.ts +20 -0
- package/src/tools/templates.ts +53 -0
- package/src/tools/tool-config.ts +23 -0
- package/src/tools/update-profile.ts +106 -34
- package/src/tools/workflows/create-workflow.ts +19 -1
- package/src/tools/workflows/update-workflow.ts +16 -1
- package/src/types.ts +109 -2
- package/src/workflows/definition.ts +30 -12
- package/src/workflows/engine.ts +40 -14
- package/src/workflows/executors/agent-task.ts +14 -3
- package/src/workflows/executors/human-in-the-loop.ts +160 -0
- package/src/workflows/executors/registry.ts +2 -0
- package/src/workflows/index.ts +1 -1
- package/src/workflows/recovery.ts +72 -0
- package/src/workflows/resume.ts +162 -12
- package/src/workflows/triggers.ts +31 -2
- package/src/workflows/version.ts +2 -0
- package/.claude/settings.json +0 -84
- package/.claude/settings.local.json +0 -117
- package/.dockerignore +0 -61
- package/.editorconfig +0 -15
- package/.entire/settings.json +0 -4
- package/.env.docker.example +0 -56
- package/.env.example +0 -78
- package/.github/ISSUE_TEMPLATE/bug_report.yml +0 -78
- package/.github/ISSUE_TEMPLATE/community-template.yml +0 -77
- package/.github/ISSUE_TEMPLATE/config.yml +0 -8
- package/.github/ISSUE_TEMPLATE/feature_request.yml +0 -60
- package/.github/PULL_REQUEST_TEMPLATE/community-template.md +0 -29
- package/.github/workflows/ci.yml +0 -52
- package/.github/workflows/docker-and-deploy.yml +0 -132
- package/.github/workflows/merge-gate.yml +0 -233
- package/.opencode/plugins/entire.ts +0 -133
- package/.superset/config.json +0 -6
- package/.wts-config.json +0 -4
- package/.wts-setup.ts +0 -171
- package/CHANGELOG.md +0 -447
- package/CLAUDE.md +0 -521
- package/CONTRIBUTING.md +0 -315
- package/DEPLOYMENT.md +0 -622
- package/Dockerfile +0 -65
- package/Dockerfile.worker +0 -189
- package/MCP.md +0 -841
- package/UI.md +0 -40
- package/api-entrypoint.sh +0 -56
- package/assets/agent-swarm-logo-orange.png +0 -0
- package/assets/agent-swarm-logo.png +0 -0
- package/assets/agent-swarm.mp4 +0 -0
- package/assets/agent-swarm.png +0 -0
- package/biome.json +0 -39
- package/deploy/DEPLOY.md +0 -60
- package/deploy/agent-swarm.service +0 -17
- package/deploy/docker-push.ts +0 -30
- package/deploy/install.ts +0 -85
- package/deploy/prod-db.ts +0 -42
- package/deploy/uninstall.ts +0 -12
- package/deploy/update.ts +0 -21
- package/depot.json +0 -1
- package/docker-compose.example.yml +0 -350
- package/docker-compose.local.yml +0 -119
- package/docker-entrypoint.sh +0 -632
- package/docs-site/app/api/search/route.ts +0 -4
- package/docs-site/app/docs/[[...slug]]/page.tsx +0 -87
- package/docs-site/app/docs/layout.tsx +0 -12
- package/docs-site/app/globals.css +0 -24
- package/docs-site/app/layout.config.tsx +0 -34
- package/docs-site/app/layout.tsx +0 -119
- package/docs-site/app/llms-full.txt/route.ts +0 -11
- package/docs-site/app/llms.mdx/docs/[[...slug]]/route.ts +0 -24
- package/docs-site/app/llms.txt/route.ts +0 -8
- package/docs-site/app/page.tsx +0 -5
- package/docs-site/app/robots.ts +0 -13
- package/docs-site/app/sitemap.ts +0 -37
- package/docs-site/components/api-page.client.tsx +0 -4
- package/docs-site/components/api-page.tsx +0 -7
- package/docs-site/components/mdx/mermaid.tsx +0 -55
- package/docs-site/content/docs/(documentation)/architecture/agents.mdx +0 -117
- package/docs-site/content/docs/(documentation)/architecture/hooks.mdx +0 -77
- package/docs-site/content/docs/(documentation)/architecture/memory.mdx +0 -96
- package/docs-site/content/docs/(documentation)/architecture/meta.json +0 -4
- package/docs-site/content/docs/(documentation)/architecture/overview.mdx +0 -172
- package/docs-site/content/docs/(documentation)/concepts/epics.mdx +0 -98
- package/docs-site/content/docs/(documentation)/concepts/meta.json +0 -4
- package/docs-site/content/docs/(documentation)/concepts/scheduling.mdx +0 -136
- package/docs-site/content/docs/(documentation)/concepts/services.mdx +0 -104
- package/docs-site/content/docs/(documentation)/concepts/task-lifecycle.mdx +0 -148
- package/docs-site/content/docs/(documentation)/concepts/workflows.mdx +0 -209
- package/docs-site/content/docs/(documentation)/contributing.mdx +0 -158
- package/docs-site/content/docs/(documentation)/getting-started.mdx +0 -157
- package/docs-site/content/docs/(documentation)/guides/agentmail-integration.mdx +0 -79
- package/docs-site/content/docs/(documentation)/guides/deployment.mdx +0 -171
- package/docs-site/content/docs/(documentation)/guides/github-integration.mdx +0 -81
- package/docs-site/content/docs/(documentation)/guides/gitlab-integration.mdx +0 -93
- package/docs-site/content/docs/(documentation)/guides/linear-integration.mdx +0 -98
- package/docs-site/content/docs/(documentation)/guides/meta.json +0 -13
- package/docs-site/content/docs/(documentation)/guides/sentry-integration.mdx +0 -52
- package/docs-site/content/docs/(documentation)/guides/slack-integration.mdx +0 -179
- package/docs-site/content/docs/(documentation)/guides/x402-payments.mdx +0 -154
- package/docs-site/content/docs/(documentation)/index.mdx +0 -65
- package/docs-site/content/docs/(documentation)/meta.json +0 -19
- package/docs-site/content/docs/(documentation)/reference/cli.mdx +0 -241
- package/docs-site/content/docs/(documentation)/reference/environment-variables.mdx +0 -205
- package/docs-site/content/docs/(documentation)/reference/mcp-tools.mdx +0 -449
- package/docs-site/content/docs/(documentation)/reference/meta.json +0 -4
- package/docs-site/content/docs/api-reference/active-sessions.mdx +0 -9
- package/docs-site/content/docs/api-reference/agents.mdx +0 -9
- package/docs-site/content/docs/api-reference/channels.mdx +0 -9
- package/docs-site/content/docs/api-reference/config.mdx +0 -9
- package/docs-site/content/docs/api-reference/debug.mdx +0 -9
- package/docs-site/content/docs/api-reference/ecosystem.mdx +0 -9
- package/docs-site/content/docs/api-reference/epics.mdx +0 -9
- package/docs-site/content/docs/api-reference/index.mdx +0 -32
- package/docs-site/content/docs/api-reference/memory.mdx +0 -9
- package/docs-site/content/docs/api-reference/meta.json +0 -25
- package/docs-site/content/docs/api-reference/poll.mdx +0 -9
- package/docs-site/content/docs/api-reference/repos.mdx +0 -9
- package/docs-site/content/docs/api-reference/schedules.mdx +0 -9
- package/docs-site/content/docs/api-reference/session-data.mdx +0 -9
- package/docs-site/content/docs/api-reference/stats.mdx +0 -9
- package/docs-site/content/docs/api-reference/tasks.mdx +0 -9
- package/docs-site/content/docs/api-reference/trackers.mdx +0 -9
- package/docs-site/content/docs/api-reference/webhooks.mdx +0 -9
- package/docs-site/content/docs/api-reference/workflows.mdx +0 -9
- package/docs-site/content/docs/meta.json +0 -3
- package/docs-site/lib/get-llm-text.ts +0 -10
- package/docs-site/lib/openapi.ts +0 -23
- package/docs-site/lib/source.ts +0 -8
- package/docs-site/mdx-components.tsx +0 -13
- package/docs-site/next.config.mjs +0 -29
- package/docs-site/package.json +0 -35
- package/docs-site/pnpm-lock.yaml +0 -5407
- package/docs-site/postcss.config.mjs +0 -8
- package/docs-site/public/logo.png +0 -0
- package/docs-site/scripts/generate-docs.ts +0 -171
- package/docs-site/source.config.ts +0 -17
- package/docs-site/tsconfig.json +0 -46
- package/ecosystem.config.cjs +0 -66
- package/landing/next.config.ts +0 -14
- package/landing/package.json +0 -31
- package/landing/pnpm-lock.yaml +0 -1091
- package/landing/postcss.config.mjs +0 -8
- package/landing/public/apple-touch-icon.png +0 -0
- package/landing/public/favicon.ico +0 -0
- package/landing/public/logo.png +0 -0
- package/landing/public/og-image.png +0 -0
- package/landing/public/omghost-desplega.svg +0 -30
- package/landing/public/omghost-openfort.svg +0 -9
- package/landing/src/app/actions/waitlist.ts +0 -25
- package/landing/src/app/blog/openfort-hackathon/page.tsx +0 -863
- package/landing/src/app/blog/page.tsx +0 -162
- package/landing/src/app/blog/swarm-metrics/page.tsx +0 -685
- package/landing/src/app/examples/page.tsx +0 -174
- package/landing/src/app/examples/x402/page.tsx +0 -456
- package/landing/src/app/globals.css +0 -122
- package/landing/src/app/layout.tsx +0 -134
- package/landing/src/app/page.tsx +0 -27
- package/landing/src/app/robots.ts +0 -13
- package/landing/src/app/sitemap.ts +0 -44
- package/landing/src/components/architecture.tsx +0 -163
- package/landing/src/components/cta.tsx +0 -52
- package/landing/src/components/features.tsx +0 -160
- package/landing/src/components/footer.tsx +0 -100
- package/landing/src/components/hero.tsx +0 -217
- package/landing/src/components/how-it-works.tsx +0 -165
- package/landing/src/components/navbar.tsx +0 -147
- package/landing/src/components/waitlist.tsx +0 -110
- package/landing/src/components/why-choose.tsx +0 -149
- package/landing/src/components/workshops.tsx +0 -328
- package/landing/src/lib/utils.ts +0 -6
- package/landing/tsconfig.json +0 -41
- package/misc/transcripts/2026-03-09-pi-mono-e2e-verification.md +0 -154
- package/new-ui/CLAUDE.md +0 -92
- package/new-ui/README.md +0 -73
- package/new-ui/biome.json +0 -42
- package/new-ui/components.json +0 -21
- package/new-ui/index.html +0 -25
- package/new-ui/package.json +0 -49
- package/new-ui/pnpm-lock.yaml +0 -4845
- package/new-ui/public/logo.png +0 -0
- package/new-ui/src/api/client.ts +0 -814
- package/new-ui/src/api/hooks/index.ts +0 -64
- package/new-ui/src/api/hooks/use-agents.ts +0 -58
- package/new-ui/src/api/hooks/use-channels.ts +0 -115
- package/new-ui/src/api/hooks/use-config-api.ts +0 -46
- package/new-ui/src/api/hooks/use-costs.ts +0 -122
- package/new-ui/src/api/hooks/use-db-query.ts +0 -29
- package/new-ui/src/api/hooks/use-epics.ts +0 -75
- package/new-ui/src/api/hooks/use-repos.ts +0 -61
- package/new-ui/src/api/hooks/use-schedules.ts +0 -81
- package/new-ui/src/api/hooks/use-services.ts +0 -16
- package/new-ui/src/api/hooks/use-stats.ts +0 -27
- package/new-ui/src/api/hooks/use-tasks.ts +0 -89
- package/new-ui/src/api/hooks/use-workflows.ts +0 -109
- package/new-ui/src/api/types.ts +0 -549
- package/new-ui/src/app/App.tsx +0 -13
- package/new-ui/src/app/providers.tsx +0 -32
- package/new-ui/src/app/router.tsx +0 -52
- package/new-ui/src/components/layout/app-header.tsx +0 -47
- package/new-ui/src/components/layout/app-sidebar.tsx +0 -128
- package/new-ui/src/components/layout/breadcrumbs.tsx +0 -57
- package/new-ui/src/components/layout/config-guard.tsx +0 -22
- package/new-ui/src/components/layout/root-layout.tsx +0 -40
- package/new-ui/src/components/layout/swarm-switcher.tsx +0 -85
- package/new-ui/src/components/shared/command-menu.tsx +0 -131
- package/new-ui/src/components/shared/data-grid.tsx +0 -141
- package/new-ui/src/components/shared/empty-state.tsx +0 -24
- package/new-ui/src/components/shared/error-boundary.tsx +0 -72
- package/new-ui/src/components/shared/json-viewer.tsx +0 -47
- package/new-ui/src/components/shared/name-connection-modal.tsx +0 -99
- package/new-ui/src/components/shared/page-skeleton.tsx +0 -16
- package/new-ui/src/components/shared/session-log-viewer.tsx +0 -364
- package/new-ui/src/components/shared/stats-bar.tsx +0 -132
- package/new-ui/src/components/shared/status-badge.tsx +0 -131
- package/new-ui/src/components/shared/usage-summary.tsx +0 -179
- package/new-ui/src/components/ui/alert-dialog.tsx +0 -176
- package/new-ui/src/components/ui/alert.tsx +0 -60
- package/new-ui/src/components/ui/avatar.tsx +0 -96
- package/new-ui/src/components/ui/badge.tsx +0 -46
- package/new-ui/src/components/ui/button.tsx +0 -62
- package/new-ui/src/components/ui/card.tsx +0 -75
- package/new-ui/src/components/ui/command.tsx +0 -160
- package/new-ui/src/components/ui/dialog.tsx +0 -143
- package/new-ui/src/components/ui/dropdown-menu.tsx +0 -226
- package/new-ui/src/components/ui/input.tsx +0 -21
- package/new-ui/src/components/ui/label.tsx +0 -19
- package/new-ui/src/components/ui/progress.tsx +0 -26
- package/new-ui/src/components/ui/scroll-area.tsx +0 -54
- package/new-ui/src/components/ui/select.tsx +0 -175
- package/new-ui/src/components/ui/separator.tsx +0 -28
- package/new-ui/src/components/ui/sheet.tsx +0 -132
- package/new-ui/src/components/ui/sidebar.tsx +0 -691
- package/new-ui/src/components/ui/skeleton.tsx +0 -13
- package/new-ui/src/components/ui/sonner.tsx +0 -35
- package/new-ui/src/components/ui/switch.tsx +0 -33
- package/new-ui/src/components/ui/table.tsx +0 -92
- package/new-ui/src/components/ui/tabs.tsx +0 -79
- package/new-ui/src/components/ui/textarea.tsx +0 -18
- package/new-ui/src/components/ui/tooltip.tsx +0 -51
- package/new-ui/src/components/workflows/action-node.tsx +0 -53
- package/new-ui/src/components/workflows/condition-node.tsx +0 -50
- package/new-ui/src/components/workflows/graph-utils.ts +0 -124
- package/new-ui/src/components/workflows/json-tree.tsx +0 -189
- package/new-ui/src/components/workflows/node-styles.ts +0 -10
- package/new-ui/src/components/workflows/step-detail-sheet.tsx +0 -87
- package/new-ui/src/components/workflows/trigger-node.tsx +0 -41
- package/new-ui/src/components/workflows/workflow-graph.tsx +0 -65
- package/new-ui/src/hooks/use-auto-scroll.ts +0 -82
- package/new-ui/src/hooks/use-config.ts +0 -203
- package/new-ui/src/hooks/use-keyboard-shortcuts.ts +0 -41
- package/new-ui/src/hooks/use-mobile.ts +0 -19
- package/new-ui/src/hooks/use-theme.ts +0 -60
- package/new-ui/src/lib/config.ts +0 -188
- package/new-ui/src/lib/slugs.ts +0 -71
- package/new-ui/src/lib/utils.ts +0 -120
- package/new-ui/src/main.tsx +0 -11
- package/new-ui/src/pages/agents/[id]/page.tsx +0 -492
- package/new-ui/src/pages/agents/page.tsx +0 -134
- package/new-ui/src/pages/chat/page.tsx +0 -674
- package/new-ui/src/pages/config/page.tsx +0 -1109
- package/new-ui/src/pages/dashboard/page.tsx +0 -454
- package/new-ui/src/pages/debug/page.tsx +0 -275
- package/new-ui/src/pages/epics/[id]/page.tsx +0 -809
- package/new-ui/src/pages/epics/page.tsx +0 -321
- package/new-ui/src/pages/not-found/page.tsx +0 -18
- package/new-ui/src/pages/repos/page.tsx +0 -369
- package/new-ui/src/pages/schedules/[id]/page.tsx +0 -664
- package/new-ui/src/pages/schedules/page.tsx +0 -477
- package/new-ui/src/pages/services/page.tsx +0 -128
- package/new-ui/src/pages/tasks/[id]/page.tsx +0 -670
- package/new-ui/src/pages/tasks/page.tsx +0 -592
- package/new-ui/src/pages/usage/page.tsx +0 -195
- package/new-ui/src/pages/workflow-runs/[id]/page.tsx +0 -363
- package/new-ui/src/pages/workflows/[id]/page.tsx +0 -417
- package/new-ui/src/pages/workflows/page.tsx +0 -266
- package/new-ui/src/styles/ag-grid.css +0 -36
- package/new-ui/src/styles/globals.css +0 -213
- package/new-ui/test-results/.last-run.json +0 -4
- package/new-ui/tsconfig.app.json +0 -34
- package/new-ui/tsconfig.json +0 -4
- package/new-ui/tsconfig.node.json +0 -26
- package/new-ui/vercel.json +0 -4
- package/new-ui/vite.config.ts +0 -28
- package/plugin/README.md +0 -1
- package/plugin/build-pi-skills.ts +0 -233
- package/plugin/hooks/hooks.json +0 -71
- package/prek.toml +0 -75
- package/pyproject.toml +0 -9
- package/scripts/check-db-boundary.sh +0 -60
- package/scripts/e2e-docker-provider.ts +0 -820
- package/scripts/e2e-io-schemas-test.ts +0 -807
- package/scripts/e2e-provider-test.ts +0 -220
- package/scripts/e2e-workflow-redesign.sh +0 -229
- package/scripts/e2e-workflow-test.sh +0 -285
- package/scripts/e2e-workflow-test.ts +0 -857
- package/scripts/generate-mcp-docs.ts +0 -415
- package/scripts/generate-openapi.ts +0 -26
- package/scripts/measure-tool-tokens.ts +0 -118
- package/scripts/x402-e2e-test.ts +0 -195
- package/scripts/x402-test-server.ts +0 -236
- package/scripts/x402-testnet-e2e.ts +0 -668
- package/slack-manifest.json +0 -88
- package/templates-ui/README.md +0 -46
- package/templates-ui/components.json +0 -17
- package/templates-ui/eslint.config.mjs +0 -18
- package/templates-ui/next.config.ts +0 -7
- package/templates-ui/package.json +0 -35
- package/templates-ui/pnpm-lock.yaml +0 -4571
- package/templates-ui/postcss.config.mjs +0 -7
- package/templates-ui/public/file.svg +0 -1
- package/templates-ui/public/globe.svg +0 -1
- package/templates-ui/public/logo.png +0 -0
- package/templates-ui/public/next.svg +0 -1
- package/templates-ui/public/vercel.svg +0 -1
- package/templates-ui/public/window.svg +0 -1
- package/templates-ui/src/app/[category]/[name]/page.tsx +0 -89
- package/templates-ui/src/app/api/templates/[...slug]/route.ts +0 -52
- package/templates-ui/src/app/api/templates/route.ts +0 -18
- package/templates-ui/src/app/builder/page.tsx +0 -37
- package/templates-ui/src/app/globals.css +0 -94
- package/templates-ui/src/app/layout.tsx +0 -79
- package/templates-ui/src/app/page.tsx +0 -38
- package/templates-ui/src/app/robots.ts +0 -11
- package/templates-ui/src/app/sitemap.ts +0 -31
- package/templates-ui/src/components/compose-builder.tsx +0 -442
- package/templates-ui/src/components/compose-preview.tsx +0 -117
- package/templates-ui/src/components/file-preview.tsx +0 -77
- package/templates-ui/src/components/footer.tsx +0 -40
- package/templates-ui/src/components/header.tsx +0 -41
- package/templates-ui/src/components/template-card.tsx +0 -87
- package/templates-ui/src/components/template-detail.tsx +0 -125
- package/templates-ui/src/components/template-gallery.tsx +0 -263
- package/templates-ui/src/components/ui/badge.tsx +0 -36
- package/templates-ui/src/components/ui/button.tsx +0 -57
- package/templates-ui/src/components/ui/card.tsx +0 -76
- package/templates-ui/src/components/ui/separator.tsx +0 -31
- package/templates-ui/src/components/ui/tooltip.tsx +0 -32
- package/templates-ui/src/lib/compose-generator.ts +0 -241
- package/templates-ui/src/lib/templates.ts +0 -137
- package/templates-ui/src/lib/utils.ts +0 -6
- package/templates-ui/tsconfig.json +0 -34
- package/thoughts/research/2026-02-28-openfort-viem-x402-research.md +0 -679
- package/thoughts/research/2026-02-28-x402-payments-research.md +0 -686
- package/thoughts/researcher/plans/2026-02-20-agent-self-improvement-plan.md +0 -282
- package/thoughts/researcher/research/2026-02-20-agent-self-improvement.md +0 -492
- package/thoughts/shared/plans/.gitkeep +0 -0
- package/thoughts/shared/plans/2025-12-18-slack-integration.md +0 -1195
- package/thoughts/shared/plans/2025-12-19-agent-log-streaming.md +0 -732
- package/thoughts/shared/plans/2025-12-19-role-based-swarm-plugin.md +0 -361
- package/thoughts/shared/plans/2025-12-20-mobile-responsive-ui.md +0 -501
- package/thoughts/shared/plans/2025-12-20-startup-team-swarm.md +0 -560
- package/thoughts/shared/plans/2025-12-23-runner-level-polling.md +0 -934
- package/thoughts/shared/plans/2025-12-23-runner-session-logs.md +0 -1000
- package/thoughts/shared/plans/2025-12-23-worker-lead-spawn-triggers.md +0 -568
- package/thoughts/shared/plans/2026-01-09-inverse-teleport.md +0 -1516
- package/thoughts/shared/plans/2026-01-12-agent-rename-pm2-control.md +0 -1133
- package/thoughts/shared/plans/2026-01-12-github-app-integration.md +0 -380
- package/thoughts/shared/plans/2026-01-12-lead-inbox-model.md +0 -876
- package/thoughts/shared/plans/2026-01-12-ralph-wiggum-integration.md +0 -463
- package/thoughts/shared/plans/2026-01-13-agent-concurrency.md +0 -691
- package/thoughts/shared/plans/2026-01-13-github-assignment-handling.md +0 -690
- package/thoughts/shared/plans/2026-01-13-prevent-duplicate-trigger-processing.md +0 -1071
- package/thoughts/shared/plans/2026-01-14-fix-slack-thread-context.md +0 -507
- package/thoughts/shared/plans/2026-01-15-scheduled-tasks-implementation.md +0 -565
- package/thoughts/shared/plans/2026-01-15-usage-cost-tracking-ui.md +0 -1479
- package/thoughts/shared/plans/2026-01-16-epics-feature-implementation.md +0 -1230
- package/thoughts/shared/plans/2026-02-26-mcp-tool-context-reduction.md +0 -282
- package/thoughts/shared/plans/2026-03-02-claude-context-mode-integration.md +0 -328
- package/thoughts/shared/plans/2026-03-02-code-level-heartbeat.md +0 -224
- package/thoughts/shared/research/.gitkeep +0 -0
- package/thoughts/shared/research/2025-01-09-inverse-teleport-plan-review.md +0 -420
- package/thoughts/shared/research/2025-12-18-slack-integration.md +0 -442
- package/thoughts/shared/research/2025-12-19-agent-log-streaming.md +0 -339
- package/thoughts/shared/research/2025-12-19-agent-secrets-cli-research.md +0 -390
- package/thoughts/shared/research/2025-12-21-gemini-cli-integration.md +0 -376
- package/thoughts/shared/research/2025-12-22-runner-loop-architecture.md +0 -582
- package/thoughts/shared/research/2025-12-22-setup-experience-improvements.md +0 -264
- package/thoughts/shared/research/2026-01-13-lead-duplicate-trigger-processing.md +0 -223
- package/thoughts/shared/research/2026-01-14-lead-slack-thread-context.md +0 -277
- package/thoughts/shared/research/2026-01-15-ai-tracker-agent-swarm-integration.md +0 -376
- package/thoughts/shared/research/2026-01-15-auto-starting-processes-in-worker-containers.md +0 -787
- package/thoughts/shared/research/2026-01-15-scheduled-tasks.md +0 -390
- package/thoughts/shared/research/2026-01-16-epics-feature-research.md +0 -437
- package/thoughts/shared/research/2026-02-26-cliffy-mcp-tools.md +0 -159
- package/thoughts/shared/research/2026-03-03-database-migration-system-refactor.md +0 -337
- package/thoughts/swarm-researcher/plans/2026-02-23-openclaw-improvements-plan.md +0 -778
- package/thoughts/swarm-researcher/plans/2026-02-26-artifacts-localtunnel-plan.md +0 -1269
- package/thoughts/swarm-researcher/research/2026-02-23-openclaw-vs-agent-swarm-comparison.md +0 -411
- package/thoughts/swarm-researcher/research/2026-02-26-artifacts-localtunnel.md +0 -724
- package/thoughts/taras/brainstorms/2026-03-20-prompt-template-registry.md +0 -443
- package/thoughts/taras/brainstorms/2026-03-20-setup-cli-onboarding.md +0 -307
- package/thoughts/taras/plans/2026-01-22-agent-swarm-schemas.md +0 -98
- package/thoughts/taras/plans/2026-01-28-per-worker-claude-md.md +0 -617
- package/thoughts/taras/plans/2026-01-28-sentry-cli-integration.md +0 -214
- package/thoughts/taras/plans/2026-02-20-auto-improvement.md +0 -803
- package/thoughts/taras/plans/2026-02-20-env-management.md +0 -538
- package/thoughts/taras/plans/2026-02-20-memory-system.md +0 -882
- package/thoughts/taras/plans/2026-02-20-repos-knowledge.md +0 -806
- package/thoughts/taras/plans/2026-02-20-session-attach.md +0 -647
- package/thoughts/taras/plans/2026-02-20-worker-identity.md +0 -820
- package/thoughts/taras/plans/2026-02-25-feat-new-ui-visual-redesign-plan.md +0 -768
- package/thoughts/taras/plans/2026-03-04-fix-buildSystemPrompt-missing-fields.md +0 -77
- package/thoughts/taras/plans/2026-03-04-new-ui-missing-actions.md +0 -543
- package/thoughts/taras/plans/2026-03-06-one-time-scheduled-tasks.md +0 -373
- package/thoughts/taras/plans/2026-03-08-memory-self-improvement-enhancements.md +0 -512
- package/thoughts/taras/plans/2026-03-08-pi-mono-provider-implementation.md +0 -919
- package/thoughts/taras/plans/2026-03-09-templates-registry.md +0 -723
- package/thoughts/taras/plans/2026-03-10-task-working-directory.md +0 -371
- package/thoughts/taras/plans/2026-03-11-archil-per-agent-write-strategy.md +0 -621
- package/thoughts/taras/plans/2026-03-12-eliminate-inbox-route-to-tasks.md +0 -61
- package/thoughts/taras/plans/2026-03-12-slack-thread-followup-additive.md +0 -488
- package/thoughts/taras/plans/2026-03-13-slack-ai-improvements.md +0 -644
- package/thoughts/taras/plans/2026-03-16-route-wrapper-openapi.md +0 -636
- package/thoughts/taras/plans/2026-03-17-multi-api-config.md +0 -444
- package/thoughts/taras/plans/2026-03-18-agent-fs-integration.md +0 -591
- package/thoughts/taras/plans/2026-03-18-debug-db-explorer.md +0 -446
- package/thoughts/taras/plans/2026-03-18-workflow-redesign.md +0 -987
- package/thoughts/taras/plans/2026-03-19-compound-learnings.md +0 -403
- package/thoughts/taras/plans/2026-03-19-ticket-tracker-linear-integration.md +0 -860
- package/thoughts/taras/plans/2026-03-19-workflow-io-schemas-and-bugs.md +0 -899
- package/thoughts/taras/plans/2026-03-20-setup-cli-onboarding.md +0 -874
- package/thoughts/taras/plans/2026-03-20-workflow-structured-output-validation-workspace.md +0 -723
- package/thoughts/taras/research/2026-01-22-vercel-cli-integration.md +0 -287
- package/thoughts/taras/research/2026-01-27-excessive-polling-issue.md +0 -311
- package/thoughts/taras/research/2026-01-28-per-worker-claude-md.md +0 -383
- package/thoughts/taras/research/2026-01-28-sentry-cli-integration.md +0 -240
- package/thoughts/taras/research/2026-02-19-agent-native-swarm-architecture.md +0 -390
- package/thoughts/taras/research/2026-02-19-swarm-gaps-implementation.md +0 -594
- package/thoughts/taras/research/2026-02-25-dashboard-ui-design-best-practices.md +0 -825
- package/thoughts/taras/research/2026-02-26-task-detail-page-redesign.md +0 -393
- package/thoughts/taras/research/2026-03-03-new-ui-missing-actions.md +0 -168
- package/thoughts/taras/research/2026-03-05-pi-mono-provider-research.md +0 -230
- package/thoughts/taras/research/2026-03-06-workflow-engine-design.md +0 -445
- package/thoughts/taras/research/2026-03-08-drive-loop-concept.md +0 -375
- package/thoughts/taras/research/2026-03-08-pi-mono-deep-dive.md +0 -869
- package/thoughts/taras/research/2026-03-09-templates-registry.md +0 -373
- package/thoughts/taras/research/2026-03-10-agent-working-directory.md +0 -223
- package/thoughts/taras/research/2026-03-10-configurable-event-prompts.md +0 -339
- package/thoughts/taras/research/2026-03-11-archil-production-setup.md +0 -181
- package/thoughts/taras/research/2026-03-11-archil-shared-disk-write-strategies.md +0 -437
- package/thoughts/taras/research/2026-03-13-slack-ai-features.md +0 -258
- package/thoughts/taras/research/2026-03-16-openapi-docs-generation.md +0 -335
- package/thoughts/taras/research/2026-03-16-route-wrapper-openapi.md +0 -670
- package/thoughts/taras/research/2026-03-16-slack-thread-followups-e2e.md +0 -54
- package/thoughts/taras/research/2026-03-18-agent-fs-integration.md +0 -558
- package/thoughts/taras/research/2026-03-18-linear-integration-finalization.md +0 -526
- package/thoughts/taras/research/2026-03-18-workflow-redesign.md +0 -797
- package/thoughts/taras/research/2026-03-19-workflow-node-io-schemas-and-bugs.md +0 -563
- package/thoughts/taras/research/2026-03-19-workflow-structured-output-validation-workspace.md +0 -486
- package/thoughts/taras/research/2026-03-20-prompt-template-registry.md +0 -469
- package/tsconfig.json +0 -37
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
date: 2026-03-13
|
|
3
|
-
researcher: claude
|
|
4
|
-
git_commit: 3df5660
|
|
5
|
-
git_branch: main
|
|
6
|
-
tags: [slack, ai, integration, streaming, assistant-threads, block-kit]
|
|
7
|
-
status: complete
|
|
8
|
-
last_updated: 2026-03-13
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# Research: Slack AI Features & Richer Task Notifications
|
|
12
|
-
|
|
13
|
-
## Research Question
|
|
14
|
-
|
|
15
|
-
How can we improve the current Slack integration to use native Slack AI features? Specifically: pushing more detailed info from task logs to chat, leveraging assistant threads, streaming, and rich messaging.
|
|
16
|
-
|
|
17
|
-
## Summary
|
|
18
|
-
|
|
19
|
-
The current Slack integration uses a simple polling watcher that posts plain-text completion/progress messages to threads. Slack's platform has evolved significantly with AI-native features that could dramatically improve the agent-swarm UX. The three highest-impact opportunities are:
|
|
20
|
-
|
|
21
|
-
1. **Assistant Threads** — gives agent-swarm a native AI container in Slack's sidebar with status indicators, suggested prompts, and conversation history
|
|
22
|
-
2. **Chat Streaming** — stream LLM responses token-by-token instead of waiting for full completion
|
|
23
|
-
3. **Richer Block Kit messages** — structured progress updates with expandable sections, feedback buttons, and task metadata
|
|
24
|
-
|
|
25
|
-
---
|
|
26
|
-
|
|
27
|
-
## Detailed Findings
|
|
28
|
-
|
|
29
|
-
### 1. Current Slack Integration Architecture
|
|
30
|
-
|
|
31
|
-
#### Entry Point & Lifecycle
|
|
32
|
-
- `src/slack/app.ts` — Initializes `@slack/bolt` App in **Socket Mode**, registers handlers, starts task watcher
|
|
33
|
-
- `src/slack/index.ts` — Barrel export for all Slack modules
|
|
34
|
-
|
|
35
|
-
#### Inbound Flow (Slack → Swarm)
|
|
36
|
-
- `src/slack/handlers.ts:316` — `registerMessageHandler()` listens to `app.event("message")`
|
|
37
|
-
- Handles: user filtering, deduplication, rate limiting, bot mention detection
|
|
38
|
-
- `src/slack/router.ts:17` — `routeMessage()` routes messages by priority: `swarm#<uuid>` → `swarm#all` → thread follow-up → lead fallback
|
|
39
|
-
- `src/slack/thread-buffer.ts` — Additive buffer for non-mention thread replies (feature flag: `ADDITIVE_SLACK=true`), debounces 10s, creates batched follow-up tasks with dependency chaining
|
|
40
|
-
- `src/slack/commands.ts` — Slash commands: `/agent-swarm-status`, `/agent-swarm-help`
|
|
41
|
-
|
|
42
|
-
#### Outbound Flow (Swarm → Slack)
|
|
43
|
-
- `src/slack/watcher.ts:24` — `startTaskWatcher()` polls DB every 3 seconds
|
|
44
|
-
- Checks `getInProgressSlackTasks()` for progress changes → `sendProgressUpdate()`
|
|
45
|
-
- Checks `getCompletedSlackTasks()` for completions → `sendTaskResponse()`
|
|
46
|
-
- Throttling: 1s minimum between sends per task, dedup via `sentProgress` map
|
|
47
|
-
- `src/slack/responses.ts:57` — `sendTaskResponse()` posts completion/failure with agent persona (custom username + emoji via `chat:write.customize` scope)
|
|
48
|
-
- `src/slack/responses.ts:110` — `sendProgressUpdate()` posts progress with hourglass emoji
|
|
49
|
-
- Both use a single `section` block with `mrkdwn` text — no rich blocks, no updates, no streaming
|
|
50
|
-
|
|
51
|
-
#### MCP Tools (Agent → Slack)
|
|
52
|
-
- `src/tools/slack-post.ts` — Post new channel message (lead-only)
|
|
53
|
-
- `src/tools/slack-reply.ts` — Reply to thread (by inbox message or task ID)
|
|
54
|
-
- `src/tools/slack-read.ts` — Read channel messages
|
|
55
|
-
- `src/tools/slack-upload-file.ts` — Upload files to channels/threads
|
|
56
|
-
- `src/tools/store-progress.ts` — Stores progress + creates follow-up tasks for lead on completion; this is where the watcher picks up changes
|
|
57
|
-
|
|
58
|
-
#### Current Manifest Scopes
|
|
59
|
-
```json
|
|
60
|
-
"bot": [
|
|
61
|
-
"app_mentions:read", "channels:history", "channels:read",
|
|
62
|
-
"chat:write", "chat:write.customize", "chat:write.public",
|
|
63
|
-
"commands", "files:read", "files:write",
|
|
64
|
-
"groups:history", "groups:read", "im:history", "im:read", "im:write",
|
|
65
|
-
"mpim:history", "mpim:read", "mpim:write",
|
|
66
|
-
"reactions:write", "users:read"
|
|
67
|
-
]
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
#### Current Event Subscriptions
|
|
71
|
-
```json
|
|
72
|
-
"bot_events": ["app_mention", "message.channels", "message.groups", "message.im", "message.mpim"]
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
---
|
|
76
|
-
|
|
77
|
-
### 2. Slack AI Platform Features (Available to Third-Party Apps)
|
|
78
|
-
|
|
79
|
-
#### 2a. Agents & AI Apps Feature
|
|
80
|
-
|
|
81
|
-
**What it is:** A Slack platform feature that gives your app a dedicated AI container in Slack's sidebar. Users can start threads with the app directly (not just @mention in channels).
|
|
82
|
-
|
|
83
|
-
**Key capabilities:**
|
|
84
|
-
- Dedicated split-view surface in Slack UI
|
|
85
|
-
- Loading/thinking status indicators
|
|
86
|
-
- Suggested prompts for user guidance
|
|
87
|
-
- Conversation history tab
|
|
88
|
-
- Thread context awareness (knows which channel the user is viewing)
|
|
89
|
-
|
|
90
|
-
**Events:**
|
|
91
|
-
- `assistant_thread_started` — fired when user opens a new conversation with your app
|
|
92
|
-
- `assistant_thread_context_changed` — fired when user switches channels while container is open
|
|
93
|
-
|
|
94
|
-
**API Methods:**
|
|
95
|
-
| Method | Description | Scope Required |
|
|
96
|
-
|--------|-------------|----------------|
|
|
97
|
-
| `assistant.threads.setStatus` | Show loading/thinking indicator | `chat:write` (or `assistant:write`) |
|
|
98
|
-
| `assistant.threads.setTitle` | Set thread title for history | `chat:write` (or `assistant:write`) |
|
|
99
|
-
| `assistant.threads.setSuggestedPrompts` | Show suggested prompts | `chat:write` (or `assistant:write`) |
|
|
100
|
-
|
|
101
|
-
**Manifest changes needed:**
|
|
102
|
-
- Enable "Agents & AI Apps" in app settings
|
|
103
|
-
- Subscribe to `assistant_thread_started` and `assistant_thread_context_changed` events
|
|
104
|
-
- Add `assistant:write` scope (or just use existing `chat:write`)
|
|
105
|
-
|
|
106
|
-
**Bolt.js integration:** The `Assistant` class in `@slack/bolt` handles these events natively with `threadStarted`, `threadContextChanged`, and `userMessage` handlers.
|
|
107
|
-
|
|
108
|
-
**Source:** [Slack AI Assistant Tutorial (Bolt.js)](https://docs.slack.dev/tools/bolt-js/tutorials/ai-assistant/), [Developing AI Apps](https://docs.slack.dev/ai/developing-ai-apps/)
|
|
109
|
-
|
|
110
|
-
#### 2b. Chat Streaming
|
|
111
|
-
|
|
112
|
-
**What it is:** Three new API methods that let apps stream text responses token-by-token, providing a ChatGPT-like experience in Slack.
|
|
113
|
-
|
|
114
|
-
**API Methods:**
|
|
115
|
-
| Method | Description |
|
|
116
|
-
|--------|-------------|
|
|
117
|
-
| `chat.startStream` | Begin a text stream in a thread |
|
|
118
|
-
| `chat.appendStream` | Append text chunks to the stream |
|
|
119
|
-
| `chat.stopStream` | End the stream, finalize the message |
|
|
120
|
-
|
|
121
|
-
**Bolt.js helper:** `client.chatStream()` returns a streamer object with `.append()` and `.stop()` methods.
|
|
122
|
-
|
|
123
|
-
**Additional feature:** `feedback_buttons` block element lets users rate AI responses (thumbs up/down), sending a `block_action` event to your app.
|
|
124
|
-
|
|
125
|
-
**Source:** [Chat Streaming Changelog](https://docs.slack.dev/changelog/2025/10/7/chat-streaming/)
|
|
126
|
-
|
|
127
|
-
#### 2c. Slack MCP Server (GA)
|
|
128
|
-
|
|
129
|
-
**What it is:** Slack's official MCP server lets AI agents use Slack tools (search, messaging, canvases) via the Model Context Protocol.
|
|
130
|
-
|
|
131
|
-
**Relevance:** This is the inverse of what we do — we bring Slack into agent-swarm via `@slack/bolt`, while Slack's MCP server brings Slack into standalone AI agents. Not directly useful for our integration but worth knowing about.
|
|
132
|
-
|
|
133
|
-
**Source:** [Slack MCP Server](https://docs.slack.dev/ai/slack-mcp-server/)
|
|
134
|
-
|
|
135
|
-
#### 2d. Message Metadata API
|
|
136
|
-
|
|
137
|
-
**What it is:** Invisible structured data payloads attached to messages via a `metadata` field containing `event_type` and `event_payload`.
|
|
138
|
-
|
|
139
|
-
**Structure:**
|
|
140
|
-
```json
|
|
141
|
-
{
|
|
142
|
-
"metadata": {
|
|
143
|
-
"event_type": "task_completed",
|
|
144
|
-
"event_payload": {
|
|
145
|
-
"task_id": "abc-123",
|
|
146
|
-
"agent_name": "Alpha",
|
|
147
|
-
"status": "completed",
|
|
148
|
-
"duration_ms": "45000"
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
**Key properties:**
|
|
155
|
-
- Not visible to users in the message UI
|
|
156
|
-
- Can be read by other apps/automations via `include_all_metadata=true`
|
|
157
|
-
- Can trigger Workflow Builder automations
|
|
158
|
-
- Flat key-value structure only (no nested objects)
|
|
159
|
-
|
|
160
|
-
**Source:** [Message Metadata](https://api.slack.com/metadata), [Metadata Schema](https://api.slack.com/reference/metadata)
|
|
161
|
-
|
|
162
|
-
---
|
|
163
|
-
|
|
164
|
-
### 3. Slack Rich Messaging Capabilities
|
|
165
|
-
|
|
166
|
-
#### 3a. Block Kit Limits & Capabilities
|
|
167
|
-
|
|
168
|
-
| Constraint | Limit |
|
|
169
|
-
|------------|-------|
|
|
170
|
-
| Max blocks per message | 50 |
|
|
171
|
-
| Section text max chars | ~3,000 |
|
|
172
|
-
| Markdown block max chars | ~12,000 |
|
|
173
|
-
| Max message text (fallback) | 40,000 chars |
|
|
174
|
-
|
|
175
|
-
**Block types relevant for task info:**
|
|
176
|
-
- `header` — Large bold text (task title)
|
|
177
|
-
- `section` — Text with optional accessory (button, overflow menu)
|
|
178
|
-
- `context` — Small gray metadata text (agent name, task ID, duration)
|
|
179
|
-
- `divider` — Horizontal line
|
|
180
|
-
- `actions` — Interactive buttons, select menus
|
|
181
|
-
- `rich_text` — Rich text with code blocks, lists, quotes
|
|
182
|
-
|
|
183
|
-
**Missing:** No native collapsible/expandable sections in Block Kit. Workaround: post summary in thread root, details in thread reply.
|
|
184
|
-
|
|
185
|
-
#### 3b. Message Updates (`chat.update`)
|
|
186
|
-
|
|
187
|
-
**Rate limits:**
|
|
188
|
-
- Same as `chat.postMessage`: ~1 message/second per channel (Tier 3)
|
|
189
|
-
- Can update any message posted by your app
|
|
190
|
-
- Blocks, text, and attachments can all be updated
|
|
191
|
-
|
|
192
|
-
**Use case:** Post a "task assigned" message, then update it as progress comes in — avoids thread spam.
|
|
193
|
-
|
|
194
|
-
#### 3c. File Uploads
|
|
195
|
-
|
|
196
|
-
Currently supported via `src/slack/files.ts` using `filesUploadV2`. Can share logs, diffs, or artifacts as threaded file attachments.
|
|
197
|
-
|
|
198
|
-
---
|
|
199
|
-
|
|
200
|
-
### 4. Current Integration Gaps
|
|
201
|
-
|
|
202
|
-
| Area | Current State | What's Available |
|
|
203
|
-
|------|--------------|-----------------|
|
|
204
|
-
| Task status display | Plain text `:hourglass:` progress messages | Block Kit with structured sections, context blocks, action buttons |
|
|
205
|
-
| Response delivery | Full text dump on completion | Chat streaming (token-by-token) |
|
|
206
|
-
| Progress updates | New message per update (thread spam) | `chat.update` on a single pinned progress message |
|
|
207
|
-
| AI container | Only works via @mentions in channels | Assistant Threads with dedicated sidebar UI |
|
|
208
|
-
| Loading indicators | None | `assistant.threads.setStatus` |
|
|
209
|
-
| Suggested prompts | None | `assistant.threads.setSuggestedPrompts` |
|
|
210
|
-
| Conversation history | Users must scroll threads | Assistant thread history tab |
|
|
211
|
-
| User feedback | None | `feedback_buttons` block element |
|
|
212
|
-
| Structured metadata | None | Message Metadata API for automation triggers |
|
|
213
|
-
| Log detail | Link to dashboard only | Expandable rich text blocks, file uploads for logs |
|
|
214
|
-
|
|
215
|
-
---
|
|
216
|
-
|
|
217
|
-
## Code References
|
|
218
|
-
|
|
219
|
-
| File | Lines | Description |
|
|
220
|
-
|------|-------|-------------|
|
|
221
|
-
| `src/slack/app.ts` | 1-75 | App init, socket mode, handler registration, watcher start |
|
|
222
|
-
| `src/slack/handlers.ts` | 316-588 | Message event handler, routing, additive buffer integration |
|
|
223
|
-
| `src/slack/router.ts` | 17-71 | Message routing logic (swarm#id → swarm#all → thread → lead) |
|
|
224
|
-
| `src/slack/watcher.ts` | 1-120 | 3s polling loop for progress/completion → Slack notifications |
|
|
225
|
-
| `src/slack/responses.ts` | 1-184 | `sendTaskResponse()`, `sendProgressUpdate()`, persona logic |
|
|
226
|
-
| `src/slack/thread-buffer.ts` | 1-213 | Additive buffer with debounce, dependency chaining, !now |
|
|
227
|
-
| `src/slack/commands.ts` | 1-102 | Slash commands (/status, /help) |
|
|
228
|
-
| `src/slack/files.ts` | 1-303 | File upload/download via Slack API |
|
|
229
|
-
| `src/slack/types.ts` | 1-20 | Shared types (SlackMessageContext, AgentMatch, SlackConfig) |
|
|
230
|
-
| `src/slack/HEURISTICS.md` | 1-106 | Documentation of routing & buffering heuristics |
|
|
231
|
-
| `src/tools/slack-post.ts` | 1-105 | MCP tool: post to channel (lead-only) |
|
|
232
|
-
| `src/tools/slack-reply.ts` | 1-144 | MCP tool: reply to thread |
|
|
233
|
-
| `src/tools/store-progress.ts` | 1-317 | MCP tool: store progress, complete/fail tasks, create follow-ups |
|
|
234
|
-
| `slack-manifest.json` | 1-72 | App manifest: scopes, events, slash commands |
|
|
235
|
-
|
|
236
|
-
---
|
|
237
|
-
|
|
238
|
-
## Key Terminology
|
|
239
|
-
|
|
240
|
-
| Term | Definition |
|
|
241
|
-
|------|-----------|
|
|
242
|
-
| **Assistant Thread** | Slack's native AI conversation container in the sidebar, separate from channel threads |
|
|
243
|
-
| **Chat Streaming** | Token-by-token message delivery via `chat.startStream/appendStream/stopStream` |
|
|
244
|
-
| **Message Metadata** | Invisible structured payload (`event_type` + `event_payload`) on messages |
|
|
245
|
-
| **Agents & AI Apps** | Slack platform feature that enables assistant threads, status, and suggested prompts |
|
|
246
|
-
| **Block Kit** | Slack's UI framework for rich message layouts |
|
|
247
|
-
| **Additive Buffer** | agent-swarm's debounce system for batching non-mention thread replies into tasks |
|
|
248
|
-
| **Task Watcher** | 3s polling loop in `watcher.ts` that bridges DB task changes to Slack messages |
|
|
249
|
-
|
|
250
|
-
---
|
|
251
|
-
|
|
252
|
-
## Decisions (from review)
|
|
253
|
-
|
|
254
|
-
1. **Assistant Threads vs Channel Threads** — **Support both.** Assistant threads for 1:1 agent conversations, channel threads for team visibility. The implementation should be backward-compatible (works even if Agents & AI Apps feature isn't enabled in the Slack app).
|
|
255
|
-
2. **Streaming granularity** — **Stream full task output.** No need to truncate or summarize.
|
|
256
|
-
3. **chat.update vs new messages** — **Use chat.update** to update a single progress message instead of posting new ones.
|
|
257
|
-
4. **Manifest migration** — Already enabled manually. Implementation should be backward-compatible so it works even without the feature toggle.
|
|
258
|
-
5. **Custom buttons** — Yes, Slack supports custom interactive buttons via Block Kit `actions` blocks with `button` elements. They fire `block_action` events to your app. Additionally, the Agents & AI Apps feature provides a dedicated `feedback_buttons` block element for thumbs up/down AI response ratings. Both approaches work — standard buttons for custom actions (e.g., "View Full Logs", "Retry Task", "Cancel"), and `feedback_buttons` for AI response quality feedback. Destination TBD.
|
|
@@ -1,335 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
date: 2026-03-16T12:00:00-05:00
|
|
3
|
-
researcher: Claude
|
|
4
|
-
git_commit: 3f114cc
|
|
5
|
-
branch: main
|
|
6
|
-
repository: agent-swarm
|
|
7
|
-
topic: "OpenAPI documentation generation for the agent-swarm REST API"
|
|
8
|
-
tags: [research, openapi, api-docs, zod-to-openapi, scalar, documentation]
|
|
9
|
-
status: complete
|
|
10
|
-
autonomy: autopilot
|
|
11
|
-
last_updated: 2026-03-16
|
|
12
|
-
last_updated_by: Claude
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
# Research: OpenAPI Documentation Generation for the Agent Swarm REST API
|
|
16
|
-
|
|
17
|
-
**Date**: 2026-03-16
|
|
18
|
-
**Researcher**: Claude
|
|
19
|
-
**Git Commit**: 3f114cc
|
|
20
|
-
**Branch**: main
|
|
21
|
-
|
|
22
|
-
## Research Question
|
|
23
|
-
|
|
24
|
-
What is the best approach for auto-generating OpenAPI documentation for the agent-swarm REST API? The API has ~62 endpoints using raw `node:http` with Bun, Zod schemas for domain entities, and an existing auto-generated MCP tools reference (`MCP.md`). The goal is an automatic approach that doesn't require manual maintenance.
|
|
25
|
-
|
|
26
|
-
## Summary
|
|
27
|
-
|
|
28
|
-
The agent-swarm REST API has **62 endpoints** across 17 handler files, with **zero documentation** outside of the auto-generated `MCP.md` for MCP tools. The REST API (used by the dashboard, external integrations, and `curl`) is completely undocumented.
|
|
29
|
-
|
|
30
|
-
The recommended approach is a **build-time script** using `@asteasolutions/zod-to-openapi` that generates an OpenAPI 3.1 spec from route definitions + existing Zod schemas, paired with **Scalar** as a zero-dependency docs viewer served at `/docs`. This mirrors the existing `generate-mcp-docs.ts` pattern and requires no framework migration. A CI freshness check can enforce the spec stays in sync.
|
|
31
|
-
|
|
32
|
-
Migration to Hono was evaluated and **rejected** — the OpenAPI "auto-generation" claim is misleading (you still write all schemas manually), and the migration cost (~77 route rewrites across 14 files) doesn't justify the benefit.
|
|
33
|
-
|
|
34
|
-
## Detailed Findings
|
|
35
|
-
|
|
36
|
-
### 1. Current API Surface
|
|
37
|
-
|
|
38
|
-
The REST API is served via `node:http` `createServer` (`src/http/index.ts:52`), with a custom handler chain pattern. Each handler module (`src/http/*.ts`) exports a function like `handleTasks(req, res, pathSegments, queryParams, myAgentId)` that returns `Promise<boolean>` — first match wins.
|
|
39
|
-
|
|
40
|
-
**62 endpoints** were cataloged across these domains:
|
|
41
|
-
|
|
42
|
-
| Domain | Endpoints | Handler File |
|
|
43
|
-
|--------|-----------|--------------|
|
|
44
|
-
| Core | 7 | `src/http/core.ts` |
|
|
45
|
-
| Agents | 7 | `src/http/agents.ts` |
|
|
46
|
-
| Tasks | 10 | `src/http/tasks.ts` |
|
|
47
|
-
| Epics | 5 | `src/http/epics.ts` |
|
|
48
|
-
| Channels + Messages | 6 | `src/http/epics.ts` |
|
|
49
|
-
| Workflows | 9 | `src/http/workflows.ts` |
|
|
50
|
-
| Schedules | 5 | `src/http/schedules.ts` |
|
|
51
|
-
| Config | 5 | `src/http/config.ts` |
|
|
52
|
-
| Memory | 2 | `src/http/memory.ts` |
|
|
53
|
-
| Stats | 5 | `src/http/stats.ts` |
|
|
54
|
-
| Repos | 5 | `src/http/repos.ts` |
|
|
55
|
-
| Poll | 1 | `src/http/poll.ts` |
|
|
56
|
-
| Ecosystem | 1 | `src/http/ecosystem.ts` |
|
|
57
|
-
| Session Data | 6 | `src/http/session-data.ts` |
|
|
58
|
-
| Active Sessions | 6 | `src/http/active-sessions.ts` |
|
|
59
|
-
| Webhooks | 3 | `src/http/webhooks.ts` |
|
|
60
|
-
| MCP | 3 | `src/http/mcp.ts` |
|
|
61
|
-
|
|
62
|
-
Route matching uses `matchRoute()` (`src/http/utils.ts:69-87`) with literal and dynamic (`null`) segment patterns.
|
|
63
|
-
|
|
64
|
-
### 2. Existing Zod Schemas
|
|
65
|
-
|
|
66
|
-
`src/types.ts` contains **28 Zod schemas** covering all domain entities:
|
|
67
|
-
|
|
68
|
-
- `AgentTaskSchema`, `AgentTaskStatusSchema`, `AgentTaskSourceSchema`
|
|
69
|
-
- `AgentSchema`, `AgentStatusSchema`, `AgentWithTasksSchema`
|
|
70
|
-
- `EpicSchema`, `EpicStatusSchema`, `EpicWithProgressSchema`
|
|
71
|
-
- `WorkflowSchema`, `WorkflowDefinitionSchema`, `WorkflowNodeSchema`, `WorkflowEdgeSchema`
|
|
72
|
-
- `WorkflowRunSchema`, `WorkflowRunStepSchema`
|
|
73
|
-
- `ScheduledTaskSchema`
|
|
74
|
-
- `SwarmConfigSchema`, `SwarmConfigScopeSchema`
|
|
75
|
-
- `SwarmRepoSchema`
|
|
76
|
-
- `AgentMemorySchema`, `AgentMemoryScopeSchema`, `AgentMemorySourceSchema`
|
|
77
|
-
- `ChannelSchema`, `ChannelMessageSchema`, `ChannelTypeSchema`
|
|
78
|
-
- `ServiceSchema`, `ServiceStatusSchema`
|
|
79
|
-
- `SessionLogSchema`, `SessionCostSchema`
|
|
80
|
-
- `ActiveSessionSchema`
|
|
81
|
-
- `AgentLogSchema`, `AgentLogEventTypeSchema`
|
|
82
|
-
- `ContextVersionSchema`, `ChangeSourceSchema`, `VersionableFieldSchema`
|
|
83
|
-
- `InboxMessageSchema`, `InboxMessageStatusSchema`
|
|
84
|
-
|
|
85
|
-
These schemas represent ~70% of the OpenAPI component definitions needed.
|
|
86
|
-
|
|
87
|
-
### 3. Recommended Approach: `@asteasolutions/zod-to-openapi` + Script
|
|
88
|
-
|
|
89
|
-
#### Library: `@asteasolutions/zod-to-openapi`
|
|
90
|
-
|
|
91
|
-
- **Maturity**: ~1.7M weekly npm downloads, ~1,500 GitHub stars, MIT license
|
|
92
|
-
- **How it works**: Framework-agnostic. Provides `OpenAPIRegistry` to register schemas and paths, then `OpenApiGeneratorV31` to emit a plain JS object (the OpenAPI spec)
|
|
93
|
-
- **Key API**:
|
|
94
|
-
- `extendZodWithOpenApi(z)` — adds `.openapi()` method to Zod types
|
|
95
|
-
- `registry.register(name, zodSchema)` — register component schema
|
|
96
|
-
- `registry.registerPath({method, path, request, responses})` — register endpoint
|
|
97
|
-
- `generator.generateDocument(config)` — produce full OpenAPI spec object
|
|
98
|
-
- **Zod compatibility**: v7.x for Zod v3 (which agent-swarm uses), v8.x for Zod v4
|
|
99
|
-
|
|
100
|
-
#### Script Pattern: `scripts/generate-openapi.ts`
|
|
101
|
-
|
|
102
|
-
Create a script analogous to `scripts/generate-mcp-docs.ts` that:
|
|
103
|
-
|
|
104
|
-
1. Imports all Zod schemas from `src/types.ts`
|
|
105
|
-
2. Extends them with `.openapi()` metadata (names, examples, descriptions)
|
|
106
|
-
3. Defines route registrations for all 62 endpoints using `registry.registerPath()`
|
|
107
|
-
4. Generates the full OpenAPI 3.1.0 spec
|
|
108
|
-
5. Writes to `openapi.json` (and optionally `API.md` for markdown reference)
|
|
109
|
-
|
|
110
|
-
**Route definition approach**: Create a `src/http/openapi-routes.ts` file that defines all route metadata in a declarative structure:
|
|
111
|
-
|
|
112
|
-
```typescript
|
|
113
|
-
import { OpenAPIRegistry } from "@asteasolutions/zod-to-openapi";
|
|
114
|
-
import { AgentTaskSchema, AgentSchema, ... } from "../types";
|
|
115
|
-
|
|
116
|
-
export function registerRoutes(registry: OpenAPIRegistry) {
|
|
117
|
-
// ── Tasks ──
|
|
118
|
-
registry.registerPath({
|
|
119
|
-
method: "get",
|
|
120
|
-
path: "/api/tasks",
|
|
121
|
-
summary: "List tasks",
|
|
122
|
-
request: {
|
|
123
|
-
query: z.object({
|
|
124
|
-
status: AgentTaskStatusSchema.optional(),
|
|
125
|
-
agentId: z.string().uuid().optional(),
|
|
126
|
-
epicId: z.string().uuid().optional(),
|
|
127
|
-
limit: z.number().int().optional(),
|
|
128
|
-
offset: z.number().int().optional(),
|
|
129
|
-
}),
|
|
130
|
-
},
|
|
131
|
-
responses: {
|
|
132
|
-
200: {
|
|
133
|
-
description: "Task list",
|
|
134
|
-
content: {
|
|
135
|
-
"application/json": {
|
|
136
|
-
schema: z.object({
|
|
137
|
-
tasks: z.array(AgentTaskSchema),
|
|
138
|
-
total: z.number(),
|
|
139
|
-
}),
|
|
140
|
-
},
|
|
141
|
-
},
|
|
142
|
-
},
|
|
143
|
-
},
|
|
144
|
-
});
|
|
145
|
-
// ... more routes
|
|
146
|
-
}
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
**CI enforcement**: Add to `.github/workflows/merge-gate.yml`:
|
|
150
|
-
```yaml
|
|
151
|
-
- name: Check OpenAPI freshness
|
|
152
|
-
run: |
|
|
153
|
-
bun run docs:openapi
|
|
154
|
-
git diff --exit-code openapi.json
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
#### Alternative considered: `zod-openapi` (by samchungy)
|
|
158
|
-
|
|
159
|
-
- Uses Zod's native `.meta()` instead of extending prototypes
|
|
160
|
-
- Smaller community (~121 dependents vs 1.7M downloads)
|
|
161
|
-
- Cleaner approach but less battle-tested
|
|
162
|
-
- **Verdict**: `@asteasolutions/zod-to-openapi` is the safer choice for a production project
|
|
163
|
-
|
|
164
|
-
### 4. Docs Viewer: Scalar
|
|
165
|
-
|
|
166
|
-
**Recommendation: Scalar** — zero npm dependencies, single CDN script, modern UI.
|
|
167
|
-
|
|
168
|
-
| Feature | Scalar | Swagger UI | Redoc | RapiDoc |
|
|
169
|
-
|---------|--------|-----------|-------|---------|
|
|
170
|
-
| CDN files needed | 1 (JS) | 2 (JS+CSS) | 1 (JS) | 1 (JS) |
|
|
171
|
-
| "Try It" client | Yes | Yes | Paid only | Yes |
|
|
172
|
-
| UI quality | Excellent | Dated | Excellent | Good |
|
|
173
|
-
| Bundle size | ~1MB | ~1.5MB | ~800KB | ~300KB |
|
|
174
|
-
| Maintenance | Very active | Moderate | Active | Low |
|
|
175
|
-
|
|
176
|
-
**Integration** — serve a static HTML page at `/docs`:
|
|
177
|
-
|
|
178
|
-
```typescript
|
|
179
|
-
const DOCS_HTML = `<!doctype html>
|
|
180
|
-
<html>
|
|
181
|
-
<head>
|
|
182
|
-
<title>Agent Swarm API</title>
|
|
183
|
-
<meta charset="utf-8" />
|
|
184
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
185
|
-
</head>
|
|
186
|
-
<body>
|
|
187
|
-
<div id="app"></div>
|
|
188
|
-
<script src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"></script>
|
|
189
|
-
<script>
|
|
190
|
-
Scalar.createApiReference('#app', { url: '/openapi.json' })
|
|
191
|
-
</script>
|
|
192
|
-
</body>
|
|
193
|
-
</html>`;
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
Add to `handleCore` in `src/http/core.ts`:
|
|
197
|
-
```typescript
|
|
198
|
-
if (req.url === "/docs") {
|
|
199
|
-
res.writeHead(200, { "Content-Type": "text/html" });
|
|
200
|
-
res.end(DOCS_HTML);
|
|
201
|
-
return true;
|
|
202
|
-
}
|
|
203
|
-
if (req.url === "/openapi.json") {
|
|
204
|
-
res.writeHead(200, { "Content-Type": "application/json" });
|
|
205
|
-
res.end(await Bun.file("openapi.json").text());
|
|
206
|
-
return true;
|
|
207
|
-
}
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
No npm install required. No CSS file. Same-origin means no CORS issues. Dark mode and themes built in.
|
|
211
|
-
|
|
212
|
-
### 5. Hono Migration: NOT Recommended
|
|
213
|
-
|
|
214
|
-
A thorough evaluation of migrating to Hono for OpenAPI concluded it's **not worth it**:
|
|
215
|
-
|
|
216
|
-
| Factor | Assessment |
|
|
217
|
-
|--------|-----------|
|
|
218
|
-
| Migration effort | High: 77 `matchRoute()` calls across 14 files, full rewrite |
|
|
219
|
-
| OpenAPI "automation" | Misleading: `@hono/zod-openapi` still requires manual Zod schemas per route |
|
|
220
|
-
| MCP compatibility | Solvable via `@hono/mcp` but changes integration pattern |
|
|
221
|
-
| Performance | Would actually improve (ironic — `Bun.serve()` > `node:http` compat) |
|
|
222
|
-
| Incremental path | Poor: essentially all-or-nothing |
|
|
223
|
-
|
|
224
|
-
**Key insight**: Hono's OpenAPI integration (`@hono/zod-openapi`) requires rewriting every route with `createRoute()` and adding schema annotations to every endpoint. You'd be paying the migration cost AND still writing all the schemas manually. The script-based `zod-to-openapi` approach achieves the same result without touching any runtime code.
|
|
225
|
-
|
|
226
|
-
**If Hono migration is desired later** (for framework benefits, not OpenAPI), it should be a separate initiative budgeting 3-4 days. Hono is already in `package.json` (used by artifact SDK), and `@hono/mcp` exists for the MCP transport.
|
|
227
|
-
|
|
228
|
-
### 6. Existing Docs Pattern: `generate-mcp-docs.ts`
|
|
229
|
-
|
|
230
|
-
The project already has a precedent: `scripts/generate-mcp-docs.ts` (`bun run docs:mcp`):
|
|
231
|
-
|
|
232
|
-
- Discovers tool categories from `src/server.ts`
|
|
233
|
-
- Discovers tool files via glob in `src/tools/`
|
|
234
|
-
- Parses Zod schema fields from each tool file (regex-based extraction)
|
|
235
|
-
- Generates `MCP.md` with tables for each tool's parameters
|
|
236
|
-
|
|
237
|
-
The OpenAPI generation script should follow the same pattern:
|
|
238
|
-
- `bun run docs:openapi` — generates `openapi.json`
|
|
239
|
-
- CI freshness check — `git diff --exit-code openapi.json`
|
|
240
|
-
- Same location in `scripts/` directory
|
|
241
|
-
|
|
242
|
-
## Code References
|
|
243
|
-
|
|
244
|
-
| File | Line | Description |
|
|
245
|
-
|------|------|-------------|
|
|
246
|
-
| `src/http/index.ts` | 52-115 | Main HTTP server + handler chain |
|
|
247
|
-
| `src/http/utils.ts` | 69-87 | `matchRoute()` function |
|
|
248
|
-
| `src/http/utils.ts` | 40-58 | `parseBody()`, `json()`, `jsonError()` helpers |
|
|
249
|
-
| `src/http/core.ts` | 36-278 | Core routes (health, auth, me, ping, close) |
|
|
250
|
-
| `src/types.ts` | 1-643 | All 28 Zod schemas |
|
|
251
|
-
| `scripts/generate-mcp-docs.ts` | 1-416 | MCP docs generator (pattern to follow) |
|
|
252
|
-
| `src/tools/send-task.ts` | 16-40 | Example MCP tool with Zod inputSchema |
|
|
253
|
-
|
|
254
|
-
## Architecture Documentation
|
|
255
|
-
|
|
256
|
-
### Authentication Model
|
|
257
|
-
- API key via `Authorization: Bearer <API_KEY>` (env-based, optional)
|
|
258
|
-
- Agent identity via `X-Agent-ID` header (required for agent-scoped operations)
|
|
259
|
-
- Webhook routes skip API key auth, use their own signature verification
|
|
260
|
-
- No role-based access control at HTTP layer
|
|
261
|
-
|
|
262
|
-
### Handler Chain Pattern
|
|
263
|
-
1. `handleCore` runs first — handles OPTIONS, `/health` (pre-auth), auth gate, then `/me`, `/cancelled-tasks`, `/ping`, `/close`
|
|
264
|
-
2. Remaining handlers iterate in order (lines 89-106) — first match wins
|
|
265
|
-
3. 404 returned if no handler matches
|
|
266
|
-
|
|
267
|
-
### Request/Response Conventions
|
|
268
|
-
- JSON responses with `Content-Type: application/json`
|
|
269
|
-
- List endpoints return `{ items: T[], total?: number }`
|
|
270
|
-
- Create endpoints return 201 with created object
|
|
271
|
-
- Delete endpoints return `{ success: true }` or 204
|
|
272
|
-
- Errors return `{ error: string }` with appropriate status code
|
|
273
|
-
|
|
274
|
-
## Historical Context
|
|
275
|
-
|
|
276
|
-
No prior research exists on API documentation for this project. The `MCP.md` auto-generation pattern (commit history) was established as the project's documentation convention and should be extended to cover the REST API.
|
|
277
|
-
|
|
278
|
-
## Related Research
|
|
279
|
-
- No directly related research documents exist in `thoughts/taras/research/`
|
|
280
|
-
|
|
281
|
-
## Open Questions
|
|
282
|
-
|
|
283
|
-
> **Resolved**: All endpoints should be documented in the OpenAPI spec. For the initial research catalog/map we can skip some, but the spec itself should be comprehensive.
|
|
284
|
-
|
|
285
|
-
- ~~Should the OpenAPI spec cover webhook endpoints?~~ **Yes** — document all endpoints. Webhooks can be tagged separately and note their different auth model (signature verification vs Bearer token)
|
|
286
|
-
- ~~Should internal endpoints be included?~~ **Yes** — mark with `x-internal: true` or tag as "Internal" so Scalar can visually distinguish them
|
|
287
|
-
- Should the MCP endpoint (`/mcp`) be documented in the OpenAPI spec, or kept separate in `MCP.md`? The JSON-RPC protocol doesn't map cleanly to REST — **Recommendation: keep separate**, just link to `MCP.md` from the spec description
|
|
288
|
-
- What level of response schema detail is needed? Some endpoints return complex nested objects (e.g., `GET /api/poll` returns different shapes based on trigger type) — use `oneOf` / discriminated unions where appropriate
|
|
289
|
-
|
|
290
|
-
## Proposed Implementation Plan
|
|
291
|
-
|
|
292
|
-
### Phase 1: OpenAPI Spec Generation Script
|
|
293
|
-
|
|
294
|
-
**Estimated file sizes:**
|
|
295
|
-
- `src/openapi/schemas.ts` — ~200-300 lines. Imports the 28 existing Zod schemas from `src/types.ts` and registers them with `.openapi("Name")` metadata. Mostly boilerplate wrapping
|
|
296
|
-
- `src/openapi/routes.ts` — ~1,500-2,000 lines. The bulk of the work: 62 `registry.registerPath()` calls, each ~25-35 lines (method, path, summary, tags, request params/body, response schema). This is the tedious-but-straightforward part
|
|
297
|
-
- `scripts/generate-openapi.ts` — ~50-80 lines. Imports schemas + routes, calls `generateDocument()`, writes to file
|
|
298
|
-
- Generated `openapi.json` — ~3,000-5,000 lines (typical for 62 endpoints with full schemas). For reference, a 40-endpoint API typically produces ~100-150KB of OpenAPI JSON
|
|
299
|
-
|
|
300
|
-
**Steps:**
|
|
301
|
-
1. Install `@asteasolutions/zod-to-openapi`
|
|
302
|
-
2. Create `src/openapi/schemas.ts` — register existing Zod schemas with OpenAPI metadata
|
|
303
|
-
3. Create `src/openapi/routes.ts` — declarative route definitions for all 62 endpoints
|
|
304
|
-
4. Create `scripts/generate-openapi.ts` — generates `openapi.json`
|
|
305
|
-
5. Add `"docs:openapi": "bun scripts/generate-openapi.ts"` to `package.json`
|
|
306
|
-
|
|
307
|
-
### Phase 2: Docs Viewer
|
|
308
|
-
1. Add `/openapi.json` endpoint in `src/http/core.ts` (serves generated file)
|
|
309
|
-
2. Add `/docs` endpoint in `src/http/core.ts` (serves Scalar HTML)
|
|
310
|
-
3. Both endpoints are pre-auth (like `/health`)
|
|
311
|
-
|
|
312
|
-
### Phase 3: CI Integration — No-Drift Guarantee
|
|
313
|
-
|
|
314
|
-
The spec is generated from code, so drift is prevented by treating the generated `openapi.json` as a build artifact with a CI freshness check:
|
|
315
|
-
|
|
316
|
-
1. **Merge gate step** — Add to `.github/workflows/merge-gate.yml`:
|
|
317
|
-
```yaml
|
|
318
|
-
- name: Check OpenAPI spec freshness
|
|
319
|
-
run: |
|
|
320
|
-
bun run docs:openapi
|
|
321
|
-
git diff --exit-code openapi.json || {
|
|
322
|
-
echo "::error::openapi.json is out of date. Run 'bun run docs:openapi' and commit the result."
|
|
323
|
-
exit 1
|
|
324
|
-
}
|
|
325
|
-
```
|
|
326
|
-
This is the same pattern used for `bun run build:pi-skills` freshness enforcement.
|
|
327
|
-
|
|
328
|
-
2. **Pre-PR checklist** — Add `bun run docs:openapi` to `CLAUDE.md` pre-PR checklist alongside `bun run lint:fix` and `bun run tsc:check`
|
|
329
|
-
|
|
330
|
-
3. **How it works**: When a developer adds/changes an endpoint in `src/http/*.ts`, they must also update the corresponding route definition in `src/openapi/routes.ts` and regenerate. If they forget, CI fails. The Zod schemas in `src/types.ts` are imported directly (not duplicated), so schema changes automatically flow through on next `bun run docs:openapi`.
|
|
331
|
-
|
|
332
|
-
### Estimated Effort
|
|
333
|
-
- Phase 1: The bulk of the work (~80%). `routes.ts` at ~1,500-2,000 lines is tedious but mechanical — each endpoint is ~30 lines of declarative metadata
|
|
334
|
-
- Phase 2: ~20 lines of code
|
|
335
|
-
- Phase 3: ~5 lines of YAML + docs update
|