Commit Graph

23 Commits

Author SHA1 Message Date
tylerslaton f4e19e2039 chore: release channels-intelligence v0.1.1 2026-07-10 22:44:50 +00:00
Tyler Slaton 001dda539a chore(channels-intelligence): complete channel terminology sweep 2026-07-10 14:47:06 -07:00
Tyler Slaton 68e43fefe1 refactor(channels-intelligence): rename remaining channel APIs 2026-07-10 14:39:56 -07:00
Tyler Slaton ea9910ae93 refactor(channels-intelligence): introduce realtime gateway abstraction 2026-07-10 14:10:30 -07:00
Tyler Slaton 4dddabd79f test(channels-intelligence): align claim test with provider-agnostic flow 2026-07-10 13:44:11 -07:00
Tyler Slaton 21d3b8c7df Merge remote-tracking branch 'origin/main' into update-intelligence-channels 2026-07-10 13:43:04 -07:00
Tyler Slaton 67fce71690 refactor(channels-intelligence): migrate HTTP contract to channels 2026-07-10 13:25:17 -07:00
Tyler Slaton 5c217538ab fix(channels-intelligence): claim deliveries provider-agnostically (#5914)
## Problem

A managed bot with **both** a Slack and a Teams adapter attached only
ever received its **Slack** deliveries. Teams deliveries stayed `queued`
forever — never claimed, never sent.

## Root cause

`channels-intelligence`'s runtime claim loop (`http-transports.ts` →
`claimOnce()`) posted a per-provider filter to
`/api/bots/listener/claim`:

```ts
{
  runtimeInstanceId: this.cfg.runtimeInstanceId,
  adapters: [this.cfg.adapter], // defaults to "slack"
}
```

app-api filters claimable deliveries by that list (`$adapters IS NULL OR
bie.provider = ANY($adapters)`), so a runtime declaring only `"slack"`
is never handed the same bot's Teams deliveries.

But the managed runtime is **provider-agnostic**: it emits abstract
render frames and Intelligence renders each reply per the delivery's own
reply target. There is no reason for the runtime to constrain claims by
provider — one `intelligenceAdapter()` should serve every channel its
bot has attached.

## Fix

Drop the `adapters` field from the claim body. `adapters` is already
optional on the app-api side (absent → `NULL` → no provider filter → all
providers), so this needs no coordinated backend change.
`this.cfg.adapter` is still used for the heartbeat's declared bots and
for egress, both unaffected.

## Testing

Verified end-to-end locally against a managed Teams bot: inbound Bot
Framework JWT → claim → agent run → render → Bot Connector egress all
`succeed` with this change. Slack continues to work unchanged.
2026-07-10 12:52:32 -07:00
Benjamin Taylor 150164a4bd fix(channels-intelligence): derive conversationKey per provider (Teams-safe)
Follow-up to the provider-agnostic claim change on this branch. Now that the
runtime claims deliveries for every provider its bot has attached, Teams
deliveries flow through the same bridge — and their reply target is a distinct
shape (serviceUrl/conversationId/tenantId, no teamId/channel/threadTs). Deriving
conversationKey from Slack-only fields collapsed every Teams conversation onto
one degenerate key, and conversationKey keys the agent/session
(getOrCreate -> makeAgent), so distinct Teams conversations would share
state/memory.

Make replyTarget a discriminated union (slack|teams) and derive conversationKey
per provider: teams:{tenantId}:{conversationId}, matching Intelligence app-api's
thread_key (OSS-441 slice 2, Intelligence #511) so client and server agree on
conversation identity. Unknown adapters fail loud (the claim loop's existing
catch nacks, not wedges).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-10 14:34:09 -05:00
Benjamin Taylor 57ddcb9532 fix(channels-intelligence): enforce runtimeInstanceId on OnChannel + leak-path tests + fail-loud managed entrypoint (OSS-406 review r3) 2026-07-10 12:31:24 -05:00
Alem Tuzlak 2a16becf61 fix(channels-intelligence): claim deliveries provider-agnostically
The managed runtime's claimOnce() declared `adapters: [this.cfg.adapter]`
(defaulting to "slack"), which Intelligence used to filter claimable
deliveries by provider. A runtime serving a bot with both Slack and Teams
adapters would therefore never receive the bot's Teams deliveries — they
stayed queued forever while Slack worked.

The managed runtime is provider-agnostic: it emits abstract render frames
and Intelligence renders per the delivery's own reply target. So the claim
must not filter by provider. Drop the adapter filter from the claim body;
one config-free `intelligenceAdapter()` now serves every channel its bot
has attached.

Verified end-to-end locally against managed Teams: inbound JWT -> claim ->
agent -> render -> Bot Connector egress all succeed with this change.
2026-07-10 19:06:44 +02:00
github-actions[bot] 2851d83a8e style: auto-fix formatting 2026-07-10 16:49:23 +00:00
Benjamin Taylor 852bd04a13 fix(channels-intelligence): single-bot guard + startup/join socket cleanup + authoritative runtimeInstanceId (OSS-406 review r2) 2026-07-10 11:48:23 -05:00
github-actions[bot] 1441768b73 style: auto-fix formatting 2026-07-10 16:42:07 +00:00
Benjamin Taylor df7d3e348f fix(channels-intelligence): fail-fast bot names + richer activation join + stop() cleanup (OSS-406 review) 2026-07-10 11:40:32 -05:00
Benjamin Taylor f35f2829b8 docs(channels-intelligence): drop deprecated 'coworker' term from launcher comment 2026-07-10 11:40:31 -05:00
Benjamin Taylor 786d08171b feat(channels-intelligence): managed-over-Phoenix launcher + slack managed entrypoint (OSS-406 Phase 1)
The realtime primitives (startManagedBots, connectPhoenixHostedBotChannel,
PhoenixRealtimeTransport) existed but nothing composed them into a launcher, so
the managed path defaulted to HTTP and Phoenix was never actually used.

- startManagedBotsOnChannel(bots, { channel, scope, runtimeInstanceId }) — wraps
  an already-connected channel in a PhoenixRealtimeTransport (delivery source +
  render sink) and starts the bots via startManagedBots. Split out so the
  behavior is unit-testable against a fake channel.
- startManagedBotsOverPhoenix(bots, config) — thin glue: connect the gateway
  bot-IO channel, delegate, disconnect on stop().
- phoenixEgress: fail-loud EgressSink (Phoenix routes all egress through the
  render sink).
- examples/slack/app/managed.ts — a REAL consumer of the launcher: the same
  Slack bot as index.ts (agent/tools/context/commands/handlers identical) run in
  managed mode over Phoenix instead of the native slack() adapter. No native
  index.ts changes.

Tests drive a real createBot through the full managed path over a fake channel:
delivered turn → render frame → completion INTENT (never self-ack); throwing
handler → fail intent. Live-stack E2E + manual validation are the OSS-406 proof;
scale-out (Teams, etc.) is OSS-459.
2026-07-10 11:40:31 -05:00
Benjamin Taylor 2bca275008 feat(channels-intelligence): emit leaseToken on render-accept + complete (OSS-446)
SDK-emit half of OSS-446 (lease-token fencing for hosted-bot render/complete).
The fail path already sends the lease token; render-accept and the completion
intent did not, so app-api fell back to instance-id + expiry there.

- HTTP: HttpRenderEventSink.push now includes leaseToken (new leaseTokenFor()
  bridge on HttpDeliverySource, mirroring scopeFor). (ack already sent it.)
- Phoenix: push (render-accept) and complete_requested now carry leaseToken
  from DeliveryState (fail already did).

Optional/forward-compatible: app-api + gateway already accept and fence on the
token when present (verified render/complete validators + fencing SQL), falling
back to the old check when absent — so this deploys safely ahead of the app-api
flip-to-required (OSS-446 half B), which waits on #511 settling managed-bots
service.ts.
2026-07-09 14:53:12 -05:00
Benjamin Taylor b5dad876ab fix(channels-intelligence): make Phoenix delivery drops observable + cover new behaviors
Review follow-ups for the managed delivery-ownership change:
- add an optional `log` seam to PhoenixTransportConfig; the transport was
  otherwise silent, so the two new drop paths were invisible failure modes.
- log the leaseToken-missing drop distinctly (the gateway/SDK version-skew
  hazard: without it, every delivery silently re-loops on lease lapse) and the
  nack no-delivery-state drop, instead of bare returns.
- refresh TSDoc: toIngressEnvelope's new return shape + drop semantics, and the
  DeliveryState.leaseToken/scope fields.
- tests: leaseToken-required drop, nack no-state no-op, and per-delivery scope
  stamping on render + fail (the scope field previously had no coverage).
2026-07-09 08:10:44 -05:00
Benjamin Taylor 6798ef84d4 Merge origin/main into codex/oss-402-sdk-handoff-fixes (Bots→Channels rename)
Reconcile #5800 with the @copilotkit/bot*→@copilotkit/channels* rename (#5849)
now on main. Only runtime.ts conflicted:
- import: new @copilotkit/channels name + keep #5800's RenderEventSink import
- startManagedBots: combine main's partial-start rollback (#5761) with #5800's
  renderSink threading into intelligenceAdapter
2026-07-08 16:56:12 -05:00
github-actions[bot] 27aa946fff style: auto-fix formatting 2026-07-08 19:43:25 +00:00
Benjamin Taylor 900af9751f Merge origin/main into codex/managed-slack-hitl (Bots→Channels rename)
Reconcile #5814 with the @copilotkit/bot*→@copilotkit/channels* rename (#5849):
- relocate the new files (content-parts, intelligence-state-store[.test]) into
  packages/channels-intelligence and rename their imports to @copilotkit/channels*
- resolve the intelligence-adapter.ts / http-transports.test.ts import-header
  conflicts to the new package names (keeping #5814's symbol set — no unused
  AgentContentPart; vi/afterEach retained for the fetch-stubbing tests)
- rename lingering imports in transports.ts / http-transports.ts
2026-07-08 14:42:43 -05:00
Benjamin Taylor b394f06fdc refactor(channels): rename @copilotkit/bot* packages to @copilotkit/channels* (OSS-438)
Renames the Bots SDK to the Channels SDK. Names only — no behavior change.

- 8 packages @copilotkit/bot* -> @copilotkit/channels* (git mv dirs, names,
  workspace: cross-deps). Now includes @copilotkit/bot-intelligence ->
  @copilotkit/channels-intelligence (landed on main via #5761; unpublished, so
  renamed fresh with the family).
- release.config.json scope keys + versionSource; ReleaseScope union;
  canary/stable-release/publish-release scope dropdowns; verify script
- examples/slack (Kite) + examples/teams: deps, jsxImportSource, imports
- showcase/shell-docs: content dirs docs/bots->docs/channels and
  reference/bot->reference/channels, nav registry, redirects

createBot and other API names unchanged. Old @copilotkit/bot* to be deprecated
after the new packages publish (bot-intelligence was never published).

Re-derived onto latest main (was conflicting after #5761 landed).

Refs OSS-438
2026-07-08 13:27:35 -05:00