Add Feishu as an external Bot channel - #413
Draft
luw2007 wants to merge 13 commits into
Draft
Conversation
Four callers now build a Bot for a person — a chat request, a routine's headless turn, a hop delivered to another Bot, and the boundary's own lookup — and each passed the same eleven collaborators positionally. One of them getting an argument wrong is a Bot that runs and quietly holds different tools or a different role from the one the person is talking to. ActorAgentResolver binds them once. Choosing a coworker moves out of the HTTP route for the same reason: it was the routing model call, the visibility rule, and the channel.routed row all written inside a Hono handler, so nothing that is not an HTTP request could route. CoworkerRoutingService owns the decision, and the route turns its outcome into status codes. That move makes an explicit name cheap enough to honour: a message that names exactly one coworker on the asking person's roster no longer pays a model call to be told what the person already said. Two matches are refused with both names rather than guessed at.
A person mentions @openBot in a Slack thread and names or describes the coworker they want. The thread is pinned to that coworker and replies continue with it, without another mention. Channels SDK owns Slack ingress, delivery, streaming and files. This deployment stays the authority for everything that decides what may happen: every turn re-resolves the Slack speaker to an OpenBot user and reloads THAT person's roster, grants, policy and audit identity. A second person in the same thread who cannot see the pinned coworker is refused rather than run as the person who started it. The coworker is built by the same resolver a browser turn uses, so a Slack turn holds the same tools, the same standing role, the same signed run assertion and the same stall guard. Its computer runs through the same gateway, which means the same boundary decides, and the same audit row is written. Secrets, sign-in control and 2FA are never asked for in Slack. The thread gets an expiring link to this deployment's own screen, and the bounded assistance wait resumes when control is released there. An unlinked Slack user is told so and handed a signed, expiring link; the agent does not run. An exact match between a verified Slack email and one active OpenBot account may create the first link. Nothing already linked is ever silently reassigned. State lives in Postgres, not in the process: the thread binding, the transcript, the identity link and the approval decisions are all tables, so a reply delivered to a second replica finds the same conversation. The bindings table is append-only by trigger.
The Slack side of a conversation was only in Slack: a person could not read what their coworker had done, and the account link and the secure prompt a Slack turn sends somebody to had nowhere to land. Three surfaces, all behind the existing session guard. Confirming a Slack account is theirs happens on a page that reads the signed link token and binds only to the OpenBot user completing the flow, with a sign-in return that comes back to the same confirmation rather than the roster. Taking the wheel or answering a secure prompt happens on the coworker's own screen, reached from the expiring link in the thread. And a Slack thread appears in the conversation sidebar, labelled, next to the channels it already lists, opening a read-only transcript of the turns as they were stored. The computer tools a Slack turn calls are declared once, in shared, so the browser and the channel offer the same contract rather than two drifting copies of it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
OpenBot has no Feishu/Lark transport. Deployments using Feishu cannot message a coworker, link their Feishu identity, or inspect those external conversations in OpenBot.
Change
Configuration
Set
OPENBOT_FEISHU_APPS_FILEto a server-local JSON file containingappId,appSecret, andtenantKey. Unset means disabled. Seedocs/feishu.md.Verification
bun run typecheckbun test server/tests/feishu-channel.test.ts server/tests/config.test.ts server/tests/external-link-routes.test.ts server/tests/external-link-token.test.ts app/tests/external-thread-route.test.ts app/tests/sidebar-roster.test.ts(159 pass)Review note
This draft is based on the still-open Slack architecture in #297. Current
mainhas moved 53 commits and does not contain that prerequisite, so the branch intentionally remains a draft until #297 lands or this stack is restacked onto its successor.