import type { RequestContext } from '@mastra/core/request-context'; import type { ApiRoute } from '@mastra/core/server'; import type { MastraWorker } from '@mastra/core/worker'; import type { Intake } 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 type { LinearEventRules, LinearRuleOverrides } from '../../linear/default-rules.js'; import type { LinearConnectionCheck, LinearIssueDetail as LinearRouteIssueDetail } from '../../linear/integration.js'; import type { LinearConnectionRow, LinearStorageHandle } from '../../linear/storage.js'; type LinearWorkspace = { linearWorkspaceId: string; linearWorkspaceName: string; urlKey: string | null; connected: boolean; }; type LinearProject = { id: string; name: string; state: string; teams: Array<{ id: string; key: string; name: string; }>; }; type LinearTeam = { id: string; key: string; name: string; }; export declare class PlatformLinearIntegration implements FactoryIntegration { #private; readonly id = "linear"; readonly intake: Intake; get rules(): LinearEventRules; constructor({ rules }?: { rules?: LinearRuleOverrides; }); get storage(): LinearStorageHandle; get projects(): FactoryProjectsStorage; initialize({ projects, auth }: { projects: FactoryProjectsStorage; auth?: RouteAuth; }): void; get authEnabled(): boolean; resolveOrgId(resourceId: string): Promise; loadConnection(orgId: string): Promise; getFreshAccessToken(_connection: LinearConnectionRow): Promise; canPostComments(connection: LinearConnectionRow): boolean; checkConnection(orgId: string): Promise; workers(ctx: IntegrationContext): MastraWorker[]; routes(ctx: IntegrationContext): ApiRoute[]; agentTools({ requestContext }: { requestContext: RequestContext; }): Promise; diagnostics(): Record; listProjects(): Promise>; listTeams(_accessToken: string): Promise>; fetchIssueDetail(_accessToken: string, idOrIdentifier: string, sourceIds?: string[], routedSourceIds?: string[]): Promise; sourceMatchesIssue(sourceId: string, issue: Pick): boolean; listWorkspaces(): Promise; } export declare function encodeSourceId(workspaceId: string, projectId: string): string; export declare function encodeTeamSourceId(workspaceId: string, teamId: string): string; export declare function decodeTeamSourceId(sourceId: string): { workspaceId: string; teamId: string; }; /** * A decoded intake source: either a Linear project or a whole Linear team. * Downstream code discriminates on `kind` to build the right issue-listing * filter and to apply most-specific-wins routing (project beats team). */ export type DecodedSource = { kind: 'project'; workspaceId: string; projectId: string; } | { kind: 'team'; workspaceId: string; teamId: string; }; /** Discriminate any Linear source id by its prefix and decode it. */ export declare function parseSourceId(sourceId: string): DecodedSource; export {}; //# sourceMappingURL=integration.d.ts.map