/** * `JiraIntegration` — the self-contained Jira Cloud integration. * * Implements the system-wide `FactoryIntegration` contract * (`../base.ts`): the deploy entry reads the `JIRA_*` env vars ONCE, * constructs an instance with explicit credentials, and passes it to * `MastraFactory`. Everything Jira-flavored the system does — project/issue * reads for Intake and the agent's issue tools — flows through this * instance. No other module reads `JIRA_*` env vars. * * Unlike Linear, credentials are **deployment-global** (Basic auth with * `email:apiToken` from the environment): there is no OAuth flow, no state * signer, and no per-org connection storage. The `IntegrationConnection` * arguments required by the `Intake` contract are accepted but not consulted * — the instance's own credentials authenticate every call. */ import type { RequestContext } from '@mastra/core/request-context'; import type { ApiRoute } from '@mastra/core/server'; import type { MastraWorker } from '@mastra/core/worker'; import type { IntegrationConnection } from '../../capabilities/connection.js'; import type { Intake, IntakeIssue } from '../../capabilities/intake.js'; import type { RouteAuth } from '../../routes/route.js'; import type { FactoryProjectsStorage } from '../../storage/domains/projects/base.js'; import type { FactoryIntegration, IntegrationContext, IntegrationTools } from '../base.js'; import { JiraApiClient } from './api.js'; import type { JiraEventRules, JiraRuleOverrides } from './default-rules.js'; /** Deployment-global Jira Cloud credentials. All credential fields are required. */ export interface JiraIntegrationConfig { /** Site base URL, e.g. `https://acme.atlassian.net`. */ baseUrl: string; /** Atlassian account email the API token belongs to. */ email: string; /** API token from id.atlassian.com → Security → API tokens. */ apiToken: string; /** Per-event replacements; omitted events retain defaults, null disables. */ rules?: JiraRuleOverrides; } /** * The `Intake` contract requires a connection argument, but Jira credentials * live on the integration instance — this inert placeholder is accepted and * ignored everywhere, and keeps the real API token out of resolved dispatches * and agent-tool calls. */ export declare const DEPLOYMENT_CONNECTION: IntegrationConnection; export declare class JiraIntegration implements FactoryIntegration { #private; /** Stable integration identifier (see `../base.ts`). */ readonly id = "jira"; /** Typed REST client bound to the deployment credentials. */ readonly api: JiraApiClient; get rules(): JiraEventRules; constructor(config: JiraIntegrationConfig); /** * Bind the projects domain and the host auth seam. Jira has no per-org * connection rows, so the generic storage handle is unused — credentials * are deployment-global constructor config. */ initialize({ projects, auth }: { projects: FactoryProjectsStorage; auth: RouteAuth; }): void; /** Factory projects domain — maps a session's resourceId to its owning org. */ get projects(): FactoryProjectsStorage; /** * Whether the host runs with web auth enabled. Intake selections are * org-owned, so every Jira surface is inert without a tenant auth seam. */ get authEnabled(): boolean; /** * Map a session's resourceId (the factory project id) to its owning org. * Same caching semantics as the Linear integration: definitive misses are * cached, transient database failures are not. */ resolveOrgId(resourceId: string): Promise; /** Test hook: clear the org cache between specs. */ clearCaches(): void; /** Normalized site base URL (no trailing slash) — `/browse/` links hang off this. */ get baseUrl(): string; readonly intake: Intake; /** * One page of active issues (status category not Done), most recently * updated first, optionally filtered to projects and labels. The * capability cursor is Jira's opaque `nextPageToken` passed through. */ listActiveIssues(cursor?: string, projectIds?: string[], labels?: string[]): Promise<{ issues: Array; nextCursor: string | null; }>; /** * The integration's HTTP surface: `/web/jira/*` Mastra `apiRoutes` (status, * projects + issues for Intake). No OAuth routes — credentials are * deployment-global. Handlers operate on this instance. */ routes(ctx: IntegrationContext): ApiRoute[]; /** * Background reconciliation, matching the Platform integration: keeps filed * Jira cards' metadata fresh and replays close events through the rules * ingress. Registered only when reconciliation is enabled. */ workers(ctx: IntegrationContext): MastraWorker[]; /** * Org-scoped agent tools: the read-only issue-detail tool for sessions whose * resource is a factory project (Jira credentials are deployment-global, * so no per-org connection gates apply). v1 exposes no mutating Jira tools. */ agentTools(args: { requestContext: RequestContext; }): Promise; /** Non-secret config snapshot for system diagnostics/startup logs. */ diagnostics(): Record; } //# sourceMappingURL=integration.d.ts.map