feat: phase 4 integrations — connectors, rybbit analytics, webhooks

- core.integrations (migration 00005) with AES-256-GCM-encrypted
  credentials (PRIMORA_ENCRYPTION_KEY, hex/base64, dev fallback);
  has_credentials serialization only — secrets never leave the server
- /projects/:id/integrations list/create/delete/test; health check hits
  the stored base URL with a 5s timeout and records status
- Rybbit connector: GET …/integrations/:id/analytics proxies
  /api/organizations + /api/sites/* server-side into a normalized shape
- core.webhooks + core.webhook_deliveries; CRUD, deliveries, test, and
  POST …/deploy-markers. Events: issue.created (new fingerprint on
  ingest), deploy.marker, webhook.test. X-Primora-Signature HMAC-SHA256
  over the raw body; in-process dispatcher, 3 attempts, quadratic
  backoff, 10s timeout, pending-scan on boot
- HTTPS enforced for public targets; HTTP allowed for loopback/private/
  self-hosted sinks
- Integrations page (connectors + webhooks tabs, inline analytics,
  delivery log, secret-shown-once), demo-mode stubs
- 12 new primora_* MCP tools
- workspace 0.4.0

Authored By: TDvorak <[email protected]>
This commit is contained in:
Tomas Dvorak committed 2026-09-16 18:47:31 +02:00
1 parent 8cfddf9184
commit e25eb92339
82 files changed
+5710 -61

No files matched your search

@@ -0,0 +1,21 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $CreateDeployMarkerRequest = {
properties: {
version: {
type: 'string',
},
ref: {
type: 'string',
description: `Git SHA, tag or branch being deployed.`,
},
environment: {
type: 'string',
},
note: {
type: 'string',
},
},
} as const;
@@ -0,0 +1,28 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $CreateIntegrationRequest = {
properties: {
name: {
type: 'string',
isRequired: true,
},
type: {
type: 'Enum',
isRequired: true,
},
base_url: {
type: 'string',
description: `Root URL of the self-hosted instance, e.g. https://analytics.example.com`,
isRequired: true,
},
api_key: {
type: 'string',
description: `Credential stored encrypted at rest; never returned by any endpoint.`,
},
site_id: {
type: 'string',
},
},
} as const;
@@ -0,0 +1,26 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $CreateWebhookRequest = {
properties: {
url: {
type: 'string',
isRequired: true,
format: 'uri',
},
secret: {
type: 'string',
description: `HMAC key for X-Primora-Signature. Generated when omitted.`,
},
events: {
type: 'array',
contains: {
type: 'Enum',
},
},
enabled: {
type: 'boolean',
},
},
} as const;
@@ -0,0 +1,25 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $DeployMarker = {
properties: {
version: {
type: 'string',
},
ref: {
type: 'string',
},
environment: {
type: 'string',
},
note: {
type: 'string',
},
recorded_at: {
type: 'string',
isRequired: true,
format: 'date-time',
},
},
} as const;
@@ -0,0 +1,51 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $Integration = {
properties: {
id: {
type: 'string',
isRequired: true,
format: 'uuid',
},
project_id: {
type: 'string',
isRequired: true,
format: 'uuid',
},
type: {
type: 'Enum',
isRequired: true,
},
name: {
type: 'string',
isRequired: true,
},
base_url: {
type: 'string',
isRequired: true,
},
site_id: {
type: 'string',
description: `Connector-specific target (Rybbit site id). Optional.`,
},
status: {
type: 'Enum',
isRequired: true,
},
last_health_at: {
type: 'string',
isNullable: true,
format: 'date-time',
},
has_credentials: {
type: 'boolean',
isRequired: true,
},
created_at: {
type: 'string',
format: 'date-time',
},
},
} as const;
@@ -0,0 +1,82 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $IntegrationAnalytics = {
properties: {
integration_id: {
type: 'string',
isRequired: true,
format: 'uuid',
},
site: {
type: 'RybbitSite',
},
sites: {
type: 'array',
contains: {
type: 'RybbitSite',
},
},
overview: {
properties: {
sessions: {
type: 'number',
},
pageviews: {
type: 'number',
},
users: {
type: 'number',
},
pages_per_session: {
type: 'number',
},
bounce_rate: {
type: 'number',
},
session_duration: {
type: 'number',
},
},
},
series: {
type: 'array',
contains: {
properties: {
time: {
type: 'string',
},
sessions: {
type: 'number',
},
pageviews: {
type: 'number',
},
users: {
type: 'number',
},
bounce_rate: {
type: 'number',
},
},
},
},
top_pages: {
type: 'array',
contains: {
type: 'RybbitMetricItem',
},
},
top_referrers: {
type: 'array',
contains: {
type: 'RybbitMetricItem',
},
},
window_days: {
type: 'number',
isRequired: true,
},
},
} as const;
@@ -0,0 +1,8 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $IntegrationID = {
type: 'string',
format: 'uuid',
} as const;
@@ -0,0 +1,15 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $IntegrationListResponse = {
properties: {
items: {
type: 'array',
contains: {
type: 'Integration',
},
isRequired: true,
},
},
} as const;
@@ -0,0 +1,18 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $IntegrationTestResult = {
properties: {
ok: {
type: 'boolean',
isRequired: true,
},
status_code: {
type: 'number',
},
error: {
type: 'string',
},
},
} as const;
@@ -0,0 +1,19 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $RybbitMetricItem = {
properties: {
value: {
type: 'string',
isRequired: true,
},
count: {
type: 'number',
isRequired: true,
},
percentage: {
type: 'number',
},
},
} as const;
@@ -0,0 +1,19 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $RybbitSite = {
properties: {
site_id: {
type: 'string',
isRequired: true,
},
name: {
type: 'string',
isRequired: true,
},
domain: {
type: 'string',
},
},
} as const;
@@ -0,0 +1,25 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $UpdateWebhookRequest = {
properties: {
url: {
type: 'string',
format: 'uri',
},
secret: {
type: 'string',
description: `Replace the signing secret. Omit to keep the current one.`,
},
events: {
type: 'array',
contains: {
type: 'Enum',
},
},
enabled: {
type: 'boolean',
},
},
} as const;
@@ -0,0 +1,41 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $Webhook = {
properties: {
id: {
type: 'string',
isRequired: true,
format: 'uuid',
},
project_id: {
type: 'string',
isRequired: true,
format: 'uuid',
},
url: {
type: 'string',
isRequired: true,
},
events: {
type: 'array',
contains: {
type: 'string',
},
isRequired: true,
},
enabled: {
type: 'boolean',
isRequired: true,
},
has_secret: {
type: 'boolean',
isRequired: true,
},
created_at: {
type: 'string',
format: 'date-time',
},
},
} as const;
@@ -0,0 +1,17 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $WebhookCreateResponse = {
type: 'all-of',
contains: [{
type: 'Webhook',
}, {
properties: {
secret: {
type: 'string',
description: `Plaintext secret — present only when Primora generated it. Store it; it cannot be recovered.`,
},
},
}],
} as const;
@@ -0,0 +1,58 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $WebhookDelivery = {
properties: {
id: {
type: 'string',
isRequired: true,
format: 'uuid',
},
webhook_id: {
type: 'string',
isRequired: true,
format: 'uuid',
},
event_type: {
type: 'string',
isRequired: true,
},
payload: {
type: 'dictionary',
contains: {
properties: {
},
},
},
status: {
type: 'Enum',
isRequired: true,
},
attempts: {
type: 'number',
isRequired: true,
},
last_status_code: {
type: 'number',
isNullable: true,
},
last_error: {
type: 'string',
},
delivered_at: {
type: 'string',
isNullable: true,
format: 'date-time',
},
next_retry_at: {
type: 'string',
isNullable: true,
format: 'date-time',
},
created_at: {
type: 'string',
format: 'date-time',
},
},
} as const;
@@ -0,0 +1,15 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $WebhookDeliveryListResponse = {
properties: {
items: {
type: 'array',
contains: {
type: 'WebhookDelivery',
},
isRequired: true,
},
},
} as const;
@@ -0,0 +1,8 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $WebhookID = {
type: 'string',
format: 'uuid',
} as const;
@@ -0,0 +1,15 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $WebhookListResponse = {
properties: {
items: {
type: 'array',
contains: {
type: 'Webhook',
},
isRequired: true,
},
},
} as const;