Skip to content

feat(hub-zero)!: T5a hub reads chat through native mail threads (CL-8147) - #756

Merged
TheGreatAxios merged 1 commit into
mainfrom
cl-8147-hub-zero-t5a
Sep 17, 2026
Merged

TheGreatAxios merged 1 commit into
mainfrom
cl-8147-hub-zero-t5a

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Contributor

Summary

Slice 1 of 3 of CL-8129 (chat becomes native intx mail threads). Cuts three
of the hub's nine @corbits/chat call sites by giving the hub its own copy
of the pin-port types, since none of them name anything chat-specific:

  • apps/hub/src/pinned-package-credential-bindings.ts — declares
    PinnedPackageCredentialBindingsFor locally (native @intx/types
    CredentialBinding + ToolPackagePin only).
  • apps/hub/src/mcp-credential-bindings.ts — declares
    McpCredentialBindingsFor locally (native CredentialBinding only).
  • apps/hub/src/tool-grants.ts — declares PinnedToolGrantDeclaration /
    ToolGrantsForPins locally (native GrantEffect + ToolPackagePin
    only).
  • apps/hub/src/hub-error-handler.test.ts — hubErrorHandler matches
    InferenceResolutionError by a duck-typed string .name, never
    instanceof, so the test now throws a small local fake with the same
    {name, guidance, message} shape instead of importing the real
    chat-owned class.
  • apps/hub/src/mail-redelivery.ts and
    apps/hub/src/templates/template-block-routes.ts — reworded two
    comments that named @corbits/chat only in prose, never in an import.

All three port types are structurally identical to @corbits/chat's own
exports, so they remain assignable wherever createHubChatPlatform is
still wired up in index.ts.

T5c hand-off

rg "@corbits/chat|workbenchBelongsToTenant" apps/hub/src is not yet
empty. Two real dependencies remain, both load-bearing until a later
slice:

  • apps/hub/src/index.ts mounts createHubChatPlatform /
    createChatRoutes / @corbits/chat/mailbox-fanout — this is the chat
    route mount itself; removing it breaks the web app today. Its
    workbenchBelongsToTenant adapter (line ~2018) closes over chatStore,
    which is only constructed because the mount needs it.
  • apps/hub/src/mailbox-persist.ts imports
    resolveWorkbenchIdForAgentFrame, ChatStore, and RoomMessageStore to
    resolve which workbench an outbound agent frame belongs to before
    stamping the resolveRefs seam of createMailboxPersist (the
    CL-7445 dual-write). That resolution reads chat's own
    workbench_settings / room-message tables (findWorkbenchIdsByParticipantAddress,
    findByMailMessageId) — there is no native-only substitute until T5c
    deletes those tables and chat becomes a pure mail projection.

Both are exactly the "leave the mount" case called out in this issue's
scope; removing either now would regress a still-live feature, not just
fail a grep.

Test plan

  • bun run --cwd apps/hub typecheck
  • bun run lint (3 pre-existing unrelated errors in index.ts,
    untouched by this PR)
  • bun run check:structural
  • bun test apps/hub/src/hub-error-handler.test.ts

…ial-binding port types (CL-8147)

Three composition-root files imported PinnedPackageCredentialBindingsFor,
McpCredentialBindingsFor, PinnedToolGrantDeclaration, and ToolGrantsForPins
from @corbits/chat even though every one of those shapes names only native
@intx/types (CredentialBinding, GrantEffect, ToolPackagePin) with nothing
chat-specific in it. Declaring them locally in
pinned-package-credential-bindings.ts, mcp-credential-bindings.ts, and
tool-grants.ts cuts three of the hub's @corbits/chat call sites without
changing behavior — the functions they type are still structurally
assignable to createHubChatPlatform's deps.

Also drops the hub's error-handler test's InferenceResolutionError import:
hubErrorHandler matches by a duck-typed string .name, never instanceof, so
a small local fake with the same {name, guidance, message} shape verifies
the same mapping without needing the real chat-owned class. And rewords
two comments (mail-redelivery.ts, template-block-routes.ts) that named
@corbits/chat only in prose, not in an import.

Part of hub-zero T5a (CL-8147). Remaining @corbits/chat call sites in
apps/hub/src: index.ts's createHubChatPlatform/createChatRoutes mount and
mailbox-persist.ts's resolveWorkbenchIdForAgentFrame/ChatStore/
RoomMessageStore dual-write wiring — both hand off to T5c, since chat's
own workbench_settings/workbench_launch/room-message tables are still the
source of truth for "which workbench does this frame belong to" until
that slice deletes them.
@linear-code

linear-code Bot commented Sep 17, 2026

Copy link
Copy Markdown

CL-8147

@TheGreatAxios
TheGreatAxios merged commit 40a0a65 into main Sep 17, 2026
20 of 22 checks passed
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