import type { EvidenceWriteResult, ProjectStore } from '../project-store/types.js'; import type { Clock } from '../knowledge/types.js'; import type { IngestionState } from '../ingestion/types.js'; import type { IdentitySubject } from '../policy/types.js'; import type { PolicyAuthorizationEngine } from '../policy/types.js'; import type { QuarantineStore } from '../security/quarantine.js'; import type { MachineStore } from '../state-machine/types.js'; import type { TrustedConnectionRegistry } from './connection-registry.js'; import type { DurableStateAdapter } from '../durable/file-journal.js'; export type ConnectorProvider = 'granola' | 'gmail' | 'slack' | 'mobbin' | 'figma'; export interface ConnectorAcquireRequest { cursor?: string; } export interface ConnectorEvidenceItem { readonly externalId: string; /** Provider-supplied revision, or a deterministic content revision synthesized by the adapter. */ readonly providerRevision?: string; readonly fileName: string; readonly originalBytes: Uint8Array; readonly declaredMediaType: string; readonly transformedMediaType: string; readonly sourceUrl?: string; } export interface ConnectorAcquireBatch { readonly items: readonly ConnectorEvidenceItem[]; readonly nextCursor?: string; readonly attempts?: number; } export interface ConnectorAdapter { provider: ConnectorProvider; acquire(request: ConnectorAcquireRequest): Promise; ack?(cursor: string): Promise; } export declare function markdownEvidence(externalId: string, fileName: string, content: string, sourceUrl?: string, providerRevision?: string): ConnectorEvidenceItem; interface TrustedConnectorRunBase { subject: IdentitySubject; projectId: string; capability: string; connectionRef: string; connections: TrustedConnectionRegistry; policyEngine: PolicyAuthorizationEngine; store: ProjectStore; clock: Clock; cursor?: string; } export interface DurableTrustedConnectorRun extends TrustedConnectorRunBase { readonly persistence: 'durable'; readonly durableState: DurableStateAdapter; } export interface MemoryTestTrustedConnectorRun extends TrustedConnectorRunBase { readonly persistence: 'memory-test'; quarantineStore: QuarantineStore; lifecycleStore: MachineStore; auditSink: ConnectorAuditSink; } export type TrustedConnectorRun = DurableTrustedConnectorRun | MemoryTestTrustedConnectorRun; export interface ConnectorStoredItem { externalId: string; externalIdHash: string; lifecycleEntityId: string; status: EvidenceWriteResult['status'] | 'quarantined'; destinationRef?: string; } export interface ConnectorRunResult { status: 'applied' | 'denied' | 'retryable'; provider: ConnectorProvider; projectId: string; items: ConnectorStoredItem[]; reasonCodes: string[]; acquired: boolean; nextCursor?: string; acknowledged: boolean; } export interface ConnectorAuditEvent { eventId: string; provider: ConnectorProvider; projectId: string; connectionRef: string; outcome: 'denied' | 'stored' | 'quarantined' | 'duplicate' | 'conflict' | 'retryable'; reasonCodes: string[]; occurredAt: string; externalIdHash?: string; } export interface ConnectorAuditSink { append(event: ConnectorAuditEvent): Promise; } export {};