Skip to content

PostHog and Cal.com bots, and alert hooks for platform agents - #1154

Merged
hrsvrn merged 4 commits into
mainfrom
integrations-posthog-cal
Oct 9, 2026
Merged

hrsvrn merged 4 commits into
mainfrom
integrations-posthog-cal

Conversation

@replicas-connector

@replicas-connector replicas-connector Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Arjun Maheswaran, https://rowboat.spaces.x.rowboatlabs.com/s/01M0HWBJR0KSG04PWM4411N29X/m/01M40DPZC97A93XQP79CKB9BBZ

What

@PostHog and @Cal are new agent types. They work like those services' Slack apps: someone mentions a command, Harbor calls the service's API with the org's key, and the result is posted as the reply. No LLM is involved. Any platform agent can also send alerts into a space.

Commands (@X help lists them):

  • PostHog: count <event> [days], top [days], query <HogQL>, insights [search], flags [search].
  • Cal.com: today, tomorrow, upcoming, links, slots <type> [date], book <type> <YYYY-MM-DDTHH:MM> <email> [name], cancel <id> [reason]. Times use the key owner's Cal.com time zone.

Alerts:

  • On the agent's page in the app, the owner picks a space and gets a secret webhook address. It is shown once and only its hash is stored.
  • That address goes into the service's webhook settings. Alerts are posted into the space by the agent itself.
  • Cal.com: booking events and the "Ping test" button. PostHog: any webhook destination, with a {"text": "…"} body posted as written.

Bots, not agents, in the app: they run commands rather than work things out, so the app calls them bots, as Slack does.

  • The Agents dialog ("Agents and bots") lists them in their own section and adds them under Add bot. Add agent offers Hermes, Replicas and Custom.
  • They're labelled "PostHog bot" and "Cal.com bot" in the roster, mention autocomplete and their page.
  • Harbor still treats them as agent members, so nothing changes on the wire (SPEC §8 Integrations says why).

How

  • Harbor:
    • connectors/commands.ts is a shared command connector: it reads the command, calls the API, replies, and handles keys the service rejects. connectors/posthog/ and connectors/cal/ each hold only their client, commands and alert wording, so another service is one module.
    • New posthog/cal pairs in AGENT_PAIRS.
    • Hook routes PUT/DELETE /v1/agents/:id/hook (owner, or an admin to turn off).
    • Pre-auth POST /v1/hooks/:agentId/:token. A wrong token and an unknown agent both return 404, so the address reveals nothing.
    • Migration 032 (agent_hooks), policy rules, and SPEC §8 "Integrations" and "Alerts", plus a CONTRACT bullet.
  • App: PostHog and Cal.com options under Add bot (key prompt, how-to steps), an Alerts section on the agent's page, and the IPC and client calls behind it.

Not in this PR

  • Clickable buttons, previews of private PostHog/Cal.com links, OAuth (pasted keys only), and plain-language requests.
  • Official logos: the generic mark is used until they are added with a SOURCE.md.

Testing

  • test/integrations.test.ts runs a real Harbor against fake PostHog and Cal.com APIs, built from their docs (checked 2026-10-03). It covers the commands, a rejected key, the region lookup, and the full hook lifecycle.
  • Harbor: 542 tests pass and typecheck is clean.
  • App renderer: 1126 tests pass and npm run typecheck is clean.
  • Not tried against the real PostHog or Cal.com APIs. The field names in PostHog's insight-alert payload were not documented: a destination's default body is shown as the alert's name and properties, and an unknown shape is posted as raw JSON.

Deploy: additive change, so no server/app coupling. Needs HARBOR_INTEGRATION_KEY, as Replicas agents already do.

🤖 Generated with Claude Code


Created by Arjun Maheswaran with Replicas

Replicas Workspace

replicas-connector Bot and others added 2 commits October 3, 2026 09:22
@PostHog and @cal answer commands from their services' APIs on the org's
key, as their Slack apps do, with no model in the loop. A shared command
connector (connectors/commands.ts) holds everything but each service's
client, commands and alert wording, so another service is one module.

A platform agent's owner can point its alerts at a space: Harbor mints a
secret address (shown once, stored as a hash) for the service's webhook
settings, and the agent posts what each alert says into that space.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: arkml <6592213+arkml@users.noreply.github.com>
Co-Authored-By: replicas-connector[bot] <replicas-connector[bot]@users.noreply.github.com>
They run a service's commands, as Slack bots do, rather than work things
out, so the Agents dialog lists them apart, adds them under Add bot, and
labels them "PostHog bot" and "Cal.com bot" wherever an agent's kind
shows. Harbor keeps them agent members.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: arkml <6592213+arkml@users.noreply.github.com>
Co-Authored-By: replicas-connector[bot] <replicas-connector[bot]@users.noreply.github.com>
@replicas-connector replicas-connector Bot changed the title PostHog and Cal.com agents, and alert hooks for platform agents PostHog and Cal.com bots, and alert hooks for platform agents Oct 3, 2026
replicas-connector Bot and others added 2 commits October 9, 2026 08:23
Main added Agent37, Conductor and Jev. The bots join them in AGENT_PAIRS,
HARBOR_RUN_CONNECTIONS and the connector registry; the alert-hook
migration moves to 036, after main's 032-035; the Agents dialog keeps
main's instance picker and space ticks with the Add bot split.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: arkml <6592213+arkml@users.noreply.github.com>
Co-Authored-By: replicas-connector[bot] <replicas-connector[bot]@users.noreply.github.com>
Main moved the Harbor client into @x/spaces-client (#1175); the alert-hook
calls move with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: arkml <6592213+arkml@users.noreply.github.com>
Co-Authored-By: replicas-connector[bot] <replicas-connector[bot]@users.noreply.github.com>
@hrsvrn
hrsvrn merged commit ab5ed46 into main Oct 9, 2026
3 checks passed
ramnique added a commit that referenced this pull request Oct 9, 2026
The desktop's main process (spaces/ipc.ts) and rowboat-server
(spaces-deps.ts) each carried the same 42 pass-through handlers, and main
14 more (with #1154's agent hooks), verbatim. They are now one table in @x/spaces-client
(harborChannelHandlers), built from a host's getClient, getLive, its
SpaceSubscriptions and where frames go. Each host keeps only the channels
that need it: sign-in, the org registry, uploads by path, save dialogs,
link previews, the local agent, scheduled sends, Agent37.

SpaceSubscriptions moves from core into the package with its tests. It
was already host-neutral, and the web app's in-tab host will need it.

No behavior change: rowboat-server's router still serves only the
channels main forwards, and main still serves the rest in-process.
channels.test.ts runs the table against a real Harbor.

Co-Authored-By: Claude Opus 5.5 (1M context) <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