/** * Mastra `apiRoutes` for the incident.io intake feature. * * Registered alongside the other `/web/*` routes, behind the host auth gate. * Mirrors the Jira module: no connect/callback flow here — credentials are * either deployment-global constructor config (direct) or Platform-managed * connections discovered at runtime. Every route re-resolves the * authenticated user from the request and scopes intake selections by the * caller's org. * * When the feature is disabled (no auth, or no intake storage), * `buildIncidentioRoutes` returns only `GET /web/incidentio/status`, which * reports `enabled:false` so the SPA can cleanly hide all incident.io UI. */ import type { ApiRoute } from '@mastra/core/server'; import type { Intake } from '../../capabilities/intake.js'; import type { RouteAuth } from '../../routes/route.js'; import type { IntakeStorage } from '../../storage/domains/intake/base.js'; import type { IncidentioRulesIngress } from './rules.js'; /** * Non-secret diagnostic snapshot of every incident.io feature gate, mirroring * the Jira diagnostics shape. Only booleans — never values. */ export interface IncidentioFeatureDiagnostics { incidentioConfigured: boolean; factoryAuthEnabled: boolean; } export interface MountIncidentioRoutesOptions { /** * The integration's intake capability providing incident.io access. Required * for everything beyond the disabled `status` route. */ incidentio?: { intake: Intake; id: string; }; /** * Credential mode reported on the status route so the SPA can tell a * deployment-configured API key apart from Platform-managed connections. */ mode?: 'api-key' | 'platform'; /** Host auth seam. Intake selections are org-owned, so the feature is inert without it. */ auth: RouteAuth; /** * Cross-integration intake selection domain. Required for the issues route's * project filter; when absent, only the disabled `status` route is served. */ intake?: IntakeStorage; /** * Factory rules ingress for observed follow-ups. When present, a * board-scoped listing also materializes new cards through the incident.io * event rules — the same automatic intake Linear and Jira have. */ ingestFactoryIssues?: (input: IncidentioRulesIngress) => Promise; } /** * Narrow the caller's selected incident.io sources to the ones that feed this * Factory project. Routing is explicit: a source feeds this Factory only when * its binding names both the Factory project and a board. Mirrors the Jira * routes' scoping semantics — the generic binding storage is provider-neutral. * Shared with the agent tools, which enforce the same source-level * authorization before fetching item details. */ export declare function scopeSourceIdsToProject({ intake, orgId, factoryProjectId, selectedIds, }: { intake: IntakeStorage; orgId: string; factoryProjectId: string; selectedIds: string[]; }): Promise>; /** * Build the incident.io routes as Mastra `apiRoutes`. When the feature is * disabled, returns only the `status` route so the SPA can detect the * disabled state. */ export declare function buildIncidentioRoutes(options: MountIncidentioRoutesOptions): ApiRoute[]; //# sourceMappingURL=routes.d.ts.map