| 61 | names.every((n) => Boolean(process.env[n])); |
| 62 | |
| 63 | async function main() { |
| 64 | const agentUrl = required("AGENT_URL"); |
| 65 | const agentHeaders = process.env.AGENT_AUTH_HEADER |
| 66 | ? { Authorization: process.env.AGENT_AUTH_HEADER } |
| 67 | : undefined; |
| 68 | |
| 69 | // Build the platform list from whichever secrets are present. Each adapter |
| 70 | // contributes its own built-in tools (e.g. `lookup_slack_user` / |
| 71 | // `lookup_discord_user` / `lookup_telegram_user`) and context (tagging + |
| 72 | // formatting guidance), added only when that platform is active so the model |
| 73 | // isn't handed a different platform's conventions. |
| 74 | const adapters: PlatformAdapter[] = []; |
| 75 | const tools: BotTool[] = [...appTools]; |
| 76 | const context: ContextEntry[] = [...appContext]; |
| 77 | |
| 78 | if (have("SLACK_BOT_TOKEN", "SLACK_APP_TOKEN")) { |
| 79 | adapters.push( |
| 80 | slack({ |
| 81 | botToken: required("SLACK_BOT_TOKEN"), |
| 82 | appToken: required("SLACK_APP_TOKEN"), |
| 83 | // Don't surface tool-call progress in the UI (no task_update timeline, |
| 84 | // `:wrench:` rows, or pane "is using `tool`…" status). Tools still run; |
| 85 | // only the display is hidden. |
| 86 | showToolStatus: false, |
| 87 | // Kite keeps DMs conversational and responds to explicit app mentions |
| 88 | // in channels/threads. Plain channel thread replies stay quiet unless |
| 89 | // they mention Kite again. |
| 90 | respondTo: { |
| 91 | directMessages: true, |
| 92 | appMentions: { reply: "thread" }, |
| 93 | threadReplies: "mentionsOnly", |
| 94 | }, |
| 95 | // Assistant-pane behavior is ON by default; this just customizes it. |
| 96 | // The greeting + chips show when a user opens the pane (matching the |
| 97 | // app manifest's `assistant_view`); native streaming + status need no |
| 98 | // config. Pass `assistant: false` / `streaming: "legacy"` to opt out. |
| 99 | assistant: { |
| 100 | greeting: "Hi! I can triage issues, search docs, and more.", |
| 101 | suggestedPrompts: [ |
| 102 | { |
| 103 | title: "Triage my open issues", |
| 104 | message: "Triage my open issues", |
| 105 | }, |
| 106 | { |
| 107 | title: "What shipped this week?", |
| 108 | message: "Summarize what shipped this week", |
| 109 | }, |
| 110 | ], |
| 111 | }, |
| 112 | }), |
| 113 | ); |
| 114 | tools.push(...defaultSlackTools); |
| 115 | context.push(...defaultSlackContext); |
| 116 | } |
| 117 | |
| 118 | if (have("DISCORD_BOT_TOKEN", "DISCORD_APP_ID")) { |
| 119 | adapters.push( |
| 120 | discord({ |