Skip to content

KiteBot on CopilotKit Intelligence — Phase 1 (channels migration + Intelligence Gateway)#6

Open
jerelvelarde wants to merge 12 commits into
mainfrom
jerel/copilotkit-channels-intelligence-40037b
Open

KiteBot on CopilotKit Intelligence — Phase 1 (channels migration + Intelligence Gateway)#6
jerelvelarde wants to merge 12 commits into
mainfrom
jerel/copilotkit-channels-intelligence-40037b

Conversation

@jerelvelarde

Copy link
Copy Markdown
Collaborator

KiteBot on CopilotKit Intelligence — Phase 1 (foundation)

Migrates OpenTag off the deprecated @copilotkit/bot* packages onto the renamed
@copilotkit/channels*, renames the bot to KiteBot, drops Redis, and adds an
Intelligence Gateway run mode. Spec + plan under docs/superpowers/.

What changed

  • Package migration @copilotkit/bot*@copilotkit/channels* (pure rename; API
    identifiers unchanged). All packages are now published on npm, so standalone
    pnpm install from this repo works — the old "monorepo-only" caveat is gone.
  • app/managed.ts — a new Intelligence Gateway channel host (pnpm channel) using the
    published two-process pattern: createBot + startChannelsOverRealtimeGateway
    (@copilotkit/channels-intelligence). Same bot, no Slack tokens — Intelligence owns the
    Slack edge. The agent brain is reached over AG-UI at AGENT_URL (the existing
    runtime.ts triage backend for now; a LangGraph deep agent in Phase 2).
  • KiteBot identity — Slack display name + agent persona + channel name kitebot. The
    OpenTag project name is unchanged.
  • Redis droppeddemo-restart.tsx, docker-compose.yml, demo:restart, and the
    redis-store dep removed (matches upstream examples/slack).
  • Docs — README/setup.md lead with the Intelligence Gateway deploy as recommended,
    self-hosted as the alternative; .env.example gains the INTELLIGENCE_* block.

Deviations from the original plan (surfaced during execution)

  1. The unified CopilotRuntime({ channels }) / createChannel API (from the initial
    snippet) is main-only and unpublished on npm — so this uses the published
    two-process createBot + startChannelsOverRealtimeGateway pattern instead.
  2. A duplicate-rxjs skew across the channels packages broke the AbstractAgent type; fixed
    with a pnpm.overrides.rxjs ^7.8.2.
  3. @copilotkit/channels-discord/-telegram/-whatsapp are only published at 0.0.x; pinned
    to their latest published versions.

Code review

Ran a multi-agent CR (Opus). The pr-review-toolkit plugin wasn't available in-session, so
a fallback 7-slot general-purpose review was used. Two fix cycles landed genuine fixes:
PORT validation, onThreadStarted guard, error-wrapping for slash-command runAgent,
render-table truncation-notes surfacing, page-list block cap, priority rendering, HITL
no-response vs decline, a notion-mcp secret-in-argv hygiene fix, the OpenAI-only docs
correction, and ~29 new tests (65 → 94).

Accepted as by-design / not changed (documented rather than "fixed"):

  • AGENT_MODEL cast to the OpenAI model union — no runtime union to validate against;
    the caveat is documented in-code.
  • as ModalView in file-issue.tsx — necessary because channels-ui JSX types as BotNode
    (verified); commented.
  • "unchecked thread.post" — a false positive: post throws on failure and the run-loop
    wraps throws into { error } for the agent (verified against the installed .d.ts).
  • The intentional post-timeout MCP-connect catch in runtime.ts.
  • The fallback whole-file review does not converge to zero (it audits the whole
    pre-existing app, not the diff). The canonical diff-scoped pr-review-toolkit CR should
    be run in a fresh session
    as the authoritative gate — a handful of low-value pre-existing
    coverage nitpicks (e.g. page-list editedBy, render-table center alignment) remain
    deferred.

Verification

  • pnpm check-types clean; pnpm test 94/94.
  • Not yet done (needs live creds): the gateway smoke test — set the real INTELLIGENCE_*
    values + confirm the channel slug (kitebot) and dev apiUrl/wsUrl, run pnpm runtime
    • pnpm channel, and confirm the KiteBot dashboard flips Waiting for runtime → live.

Out of scope (later phases)

  • Phase 2: LangGraph deep-agent backend behind AGENT_URL (co-marketing).
  • Phase 3: Railway one-click template.

🤖 Generated with Claude Code

jerelvelarde and others added 12 commits July 15, 2026 11:43
…esign

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…hannels-intelligence

channels-discord/-telegram/-whatsapp are only published at 0.0.x; pinned to
their latest published versions. jsxImportSource -> @copilotkit/channels-ui.
Commit the pnpm lockfile now that standalone install resolves.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…dupe rxjs

Global import-specifier rename across app/** (API identifiers unchanged:
createBot, defineBotTool, slack, SanitizingHttpAgent, etc.). The rename made
the slack agent import resolve correctly, exposing a latent duplicate-rxjs
skew (channels@7.8.1 vs channels-slack->core@7.8.2) that broke the
AbstractAgent structural type at app/index.ts. Fixed with a pnpm override
pinning rxjs ^7.8.2 to a single copy. check-types clean; 62 tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ltimeGateway)

app/managed.ts runs the same bot over the CopilotKit Intelligence Realtime
Gateway (published @copilotkit/channels-intelligence two-process pattern; the
unified CopilotRuntime({channels}) API is main-only/unpublished). Pure
createKiteBot() factory + unit test; 65 tests green, check-types clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…eBot mentions

.env.example gains the INTELLIGENCE_* block for pnpm channel (full gateway
scope). README + setup.md rename bot->channels, add channels-intelligence,
present the managed Intelligence deployment as the recommended default with
self-hosted as the alternative, drop Redis, and note packages now publish to
npm (standalone install works).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…st managed service

Relabel the pnpm channel mode 'Intelligence Gateway' (was 'Intelligence
(managed)') and reserve 'managed service' for the coming-soon hosted waitlist,
resolving the terminology collision.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…mands, render-table, components)

- managed.ts: drop bot.name! (local channelName const), guard onThreadStarted,
  extract+test pure helpers (promptFromMessage/buildAgentHeaders/parseProjectId)
- index.ts: log the swallowed error-post, harden shutdown (runShutdown wrapper,
  guarded closeBrowser, exit codes) mirroring managed.ts
- commands: wrap /agent /triage /file-issue-fallback runAgent (runAgentSafely
  helper, log + apology); test /triage-with-text and /preview no-user
- render-table: surface clamp truncation notes to user + agent, align 'Max 99'
  desc, right-align monospace fallback, log the native-post failure
- components: render priority in issue-list meta, cap page-list blocks
- render-chart: add JSON.parse/upload-failure/bytes tests
84 tests pass; check-types clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ntime, config)

- confirm-write-tool: distinguish no-response (timeout/dismissed) from explicit
  decline instead of silently reporting DECLINED
- confirm-write / showcase onClick handlers: guard fire-and-forget update/post
- file-issue: log swallowed apology-post; document the necessary ModalView cast;
  test success-path prompt + sender context
- read-thread: cover the handle fallback branch
- runtime.ts: narrowing instead of (reason as Error); drop the as never[] cast
  (types align); document the AGENT_MODEL cast caveat; platform-neutral framing
  (log prefix [runtime], doc header, SYSTEM_PROMPT) since the backend serves all
  platforms
- .env.example: header includes WhatsApp; setup.md: correct the table-renderer
  row (native Table, not Playwright); tsconfig: type-check scripts/ (+ fix childEnv)
89 tests pass; check-types clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…hygiene, coverage

- runtime.ts + index.ts: validate PORT (integer, 1-65535; reject 0 / out-of-range)
- index.ts: guard onThreadStarted (match managed.ts)
- managed.ts: type promptFromMessage (drop cast); instanceof narrowing; +parseProjectId edge tests
- scripts/start-notion-mcp.ts: drop --auth-token CLI arg (secret leaked via ps under shell:true; AUTH_TOKEN env suffices)
- docs: correct OpenAI-only reality (runtime is openaiText-only; Anthropic/Google not wired), AGENT_URL is required (not a code default), document NOTION_MCP_PORT/NOTION_VERSION
- tsconfig: drop stale 'agent' exclude; type-check scripts/
- tests: runAgentSafely error path, confirm-write no-response branch, render-chart DIAGRAM_PNG bytes + comment fix
94 tests pass; check-types clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant