# Product Connector Upstream Baselines

This document records the exact upstream source revisions used to design and
qualify AIP product connectors. The repositories are independent clean-room
reference checkouts adjacent to the AIP repository. They are not vendored,
linked into Cargo builds, or copied into AIP crates.

| Product | Official repository | Reference revision | Reference checkout |
| --- | --- | --- | --- |
| Chatwoot | [chatwoot/chatwoot](https://github.com/chatwoot/chatwoot) | `8818d276b954ac4f84cffd8915c99f40e43804ed` | `<workspace>/chatwoot` |
| Dify | [langgenius/dify](https://github.com/langgenius/dify) | `f8d47616c15d0959f604f6a5e2e1d32d3108991b` | `<workspace>/dify` |
| CrewAI | [crewAIInc/crewAI](https://github.com/crewAIInc/crewAI) | `bfa652a7be8637562cc9b0833f75d927a64552d1` | `<workspace>/crewai` |
| Hermes Agent | [nousresearch/hermes-agent](https://github.com/nousresearch/hermes-agent) | `7426c09beee73bdff94d916015bac71384f6bc92` | `<workspace>/hermes-agent` |
| Cal.diy | [calcom/cal.diy](https://github.com/calcom/cal.diy) | `f00434927386c9ecdcbd7e6c5f82d22044a245bc` | `<workspace>/cal.diy` |

The checkout paths describe the workspace layout used during the audit; they
are not repository inputs. CI qualification must clone the official remotes and
verify the exact revision before running isolated-product tests.

## Verified Contract Sources

### Chatwoot

- `lib/webhooks/trigger.rb` is authoritative for outbound webhook headers and
  HMAC construction. Chatwoot signs the exact raw body as `timestamp.body` and
  emits `X-Chatwoot-Signature: sha256=<hex>`.
- `config/routes.rb` and account conversation controllers are authoritative for
  message creation, status transitions, and assignments.

The connector must never verify a re-serialized JSON value. It accepts the raw
request body, enforces timestamp skew, compares the HMAC in constant time, and
rejects replayed delivery ids.

### Dify

- `api/controllers/service_api/app/completion.py` owns completion and chat
  message invocation and cancellation routes.
- `api/controllers/service_api/app/workflow.py` owns workflow invocation and
  cancellation routes.
- `api/core/app/entities/task_entities.py` owns streaming event names including
  `human_input_required` and `workflow_paused`.

The connector treats workflow, completion, and chat-family applications as
different API families. Human-input pauses map to native AIP human lifecycle
state rather than a successful terminal result.

### CrewAI

- `lib/crewai/src/crewai/crew.py` owns `kickoff_async` behavior.
- `lib/crewai/src/crewai/types/streaming.py` owns ordered streaming output and
  `aclose` cancellation semantics.
- `lib/crewai/src/crewai/crews/crew_output.py` owns terminal output fields.

The Rust connector communicates with the repository-owned Python sidecar under
`crates/aip-connector-crewai/sidecar`. The sidecar loads deployment-owned Crew
factories, invokes the real CrewAI APIs, and maps ordered chunks, cancellation,
and terminal output to a stable HTTP/SSE contract.

The exact-upstream qualification uses the recorded local checkout, a
network-free deterministic `BaseLLM`, and real `Agent`, `Task`, `Crew`,
`kickoff_async`, stream-event, and `CrewOutput` implementations. The persistent
ignored Rust test invokes that sidecar across HTTP rather than importing
CrewAI into the Rust process.

### Hermes Agent

- `gateway/platforms/api_server.py` owns health, discovery, OpenAI-compatible
  chat/responses, structured run, and persisted-session routes.
- `POST /v1/runs` creates an asynchronous run and returns `run_id`; the route
  does not provide durable provider idempotency.
- `GET /v1/runs/{run_id}/events` owns structured SSE events but has no replay
  cursor. `GET /v1/runs/{run_id}` is the authoritative reconnect and restart
  recovery path.
- `POST /v1/runs/{run_id}/approval` owns the `once`, `session`, `always`, and
  `deny` decision contract. Approval queues are isolated by run id.
- `POST /v1/runs/{run_id}/stop` requests interruption; pollable run status is
  authoritative for the terminal cancellation outcome.
- `tools/mcp_tool.py` and `website/docs/reference/mcp-config-reference.md` own
  Hermes Streamable HTTP MCP configuration and tool filtering behavior.

Every route published by `aip-connector-hermes-agent` was checked against that
router at the recorded revision. Governed operator behavior, durable run
correlation, and connector-owned delegation routing are documented in
[hermes-agent.md](hermes-agent.md). Hermes DTOs remain connector-owned and are
not introduced into `aip-core`.

### Cal.diy

- `apps/api/v2/src/platform/*/controllers` and
  `apps/api/v2/src/modules/*/controllers` own the versioned API v2 routes.
- `packages/platform/types` owns scheduling request and response DTOs.
- `packages/features/webhooks/lib/sendPayload.ts` owns the exact raw-body
  HMAC-SHA256 webhook signature and delivery headers.
- `packages/prisma/schema.prisma` owns the authoritative webhook trigger enum.

The connector pins API versions independently for bookings, slots, event
types, schedules, and the unversioned private-link controller (whose bootstrap
default is `2024-04-15`). It does not copy Cal.diy DTOs into `aip-core`, expose raw
webhook secrets in AIP actions, or claim removed Cal.com enterprise features.
The published connector contract, supported operation families, daemon
configuration, and intentional exclusions are summarized in the
[Cal.diy Connector](cal-diy.md) documentation. The implementation-owned crate
contract lives at `crates/aip-connector-cal-diy/README.md`.
The exact revision also passed the complete frozen connector kit and retained
isolated-live qualification documented in
[`docs/testing/cal-diy-isolated-live.md`](../testing/cal-diy-isolated-live.md).

The pinned provider has no authoritative idempotency key for scheduling
mutations and no signed delivery id or timestamp header for webhooks. AIP
therefore claims its durable dispatch ledger before mutation, never blindly
retries an uncertain write, separates reclaimable pre-dispatch claims from
outcome-unknown dispatches, derives deterministic webhook event ids from the
verified raw delivery, and treats the runtime event log as the final duplicate
boundary. AIP-managed subscriptions force the standard payload and webhook
version `2021-10-20`; custom payload templates are not accepted. Subscription
targets must bind exactly to a deployment-owned HTTPS ingress prefix plus the
configured secret selector.

## Update Procedure

1. Fetch the official repository without modifying the AIP worktree.
2. Record the new full commit hash in this file.
3. Diff the authoritative route, request, response, event, authentication, and
   cancellation sources listed above.
4. Update connector mappings and deterministic provider fixtures.
5. Run unit, frozen connector conformance, and isolated-product suites.
6. Retain the exact upstream revisions, container image digests, and redacted
   conformance artifacts in release evidence.

An upstream revision change is a connector compatibility change even when the
AIP wire model is unchanged.
