/** Exact supported configurations. Catalogue membership is not model qualification. */ interface EmbeddingProfile { readonly profileId: string; readonly modelId: string; readonly dimensions: number; readonly normalization: string; readonly chunking: string; readonly indexName: string; } interface SourceReference { sourceId: string; sourceEventId: string; sourceRevision: number; } /** Backend-owned external projection contract. No graph credentials or query language. */ interface GraphProjectionScope { tenantId: string; memorySpaceId: string; tenantEpoch: number; memorySpaceEpoch: number; } interface GraphProjectionFact { factId: string; revision: number; text: string; entities: { name: string; type: string; }[]; relations: { subject: string; predicate: string; object: string; }[]; } /** Revision is a monotone backend projection sequence, not provider time or a lease. */ interface GraphProjectionPayloadV1 { version: 1; scope: GraphProjectionScope; source: SourceReference & { contentHash: string; ownerPrincipalId: string; }; revision: number; operation: "replace" | "tombstone"; profile: EmbeddingProfile; facts: GraphProjectionFact[]; } interface GraphProjectionLeaseV1 { tenantId: string; memorySpaceId: string; connectorId: string; jobId: string; workerId: string; leaseVersion: number; } interface GraphProjectionWorkV1 extends GraphProjectionLeaseV1 { version: 1; leaseExpiresAt: number; payload: GraphProjectionPayloadV1; payloadHash: string; } /** Trusted connector receipt; never accepted at a public user endpoint. */ interface GraphProjectionReceiptV1 { version: 1; connectorId: string; jobId: string; payloadHash: string; tenantId: string; memorySpaceId: string; sourceId: string; tenantEpoch: number; memorySpaceEpoch: number; revision: number; state: "applied" | "duplicate" | "stale"; currentRevision: number; } interface GraphExpansionWorkV1 extends GraphProjectionLeaseV1 { version: 1; leaseExpiresAt: number; scope: GraphProjectionScope; sourceId: string; profileId: string; revision: number; limit: number; } interface GraphExpansionResultV1 { version: 1; scope: GraphProjectionScope; sourceId: string; profileId: string; revision: number; factIds: string[]; } interface CypherProjectionConnectorConfig { engine: "neo4j" | "memgraph"; uri: string; username: string; password: string; database?: string; tenantId: string; memorySpaceId: string; connectorId: string; /** Bounds a remote transaction; the backend separately owns lease/retry policy. */ timeoutMs?: number; } interface GraphFenceDiagnostics { tenantEpoch: number; memorySpaceEpoch: number; revision: number; leaseVersion: number; payloadHash: string; tombstoned: boolean; profileId: string; } declare class GraphConnectorError extends Error { readonly code: string; constructor(code: string); } declare class CypherProjectionConnector { private readonly config; private driver?; private ready; private opening?; private readonly timeoutMs; private readonly scopeKey; constructor(config: Readonly); /** Authenticates before readiness. Safe point for a test-owned network proxy to be armed. */ connect(): Promise; private open; private sessionConfig; close(): Promise; private requireDriver; private cleanup; /** Client-side silence must not hold the host worker forever before the server sees a RUN. */ private watch; private scope; private payload; /** No automatic transport retry. An ambiguous commit is reconciled by the durable backend job. */ apply(work: GraphProjectionWorkV1): Promise; private receipt; private storeReceipt; private replace; /** Only IDs leave the graph. The backend rehydrates with current reader/source authority. */ expand(args: { scope: GraphProjectionScope; sourceId: string; profileId: string; revision: number; limit: number; }): Promise; inspectSource(sourceId: string): Promise; } interface GraphWorkerIdentity { tenantId: string; memorySpaceId: string; connectorId: string; workerId: string; } interface GraphWorkerTransport { claim(args: GraphWorkerIdentity & { leaseMs?: number; }): Promise; current(args: GraphProjectionLeaseV1): Promise; complete(args: GraphProjectionLeaseV1 & { receipt: GraphProjectionReceiptV1; }): Promise; fail(args: GraphProjectionLeaseV1 & { outcome: "failed" | "unknown"; }): Promise; claimExpansion(args: GraphWorkerIdentity): Promise; currentExpansion(args: GraphProjectionLeaseV1): Promise<{ version: 1; current: true; }>; completeExpansion(args: GraphProjectionLeaseV1 & { result: GraphExpansionResultV1; }): Promise; failExpansion(args: GraphProjectionLeaseV1): Promise; } interface GraphWorkerConnector { connect(): Promise; apply(work: GraphProjectionWorkV1): Promise; expand(work: Pick): Promise; close(): Promise; } interface ConvexGraphWorkerTransportOptions { deploymentUrl: string; /** Return a current service JWT. Convex verifies it and the connector's pinned current service grant. */ fetchToken: (signal: AbortSignal) => Promise; timeoutMs?: number; } /** Official HTTP contract, with fresh JWT per call and bounded requests. No deployment administrator key. */ declare class ConvexGraphWorkerTransport implements GraphWorkerTransport { private readonly options; private readonly timeoutMs; constructor(options: ConvexGraphWorkerTransportOptions); private call; claim(args: GraphWorkerIdentity & { leaseMs?: number; }): Promise; current(args: GraphProjectionLeaseV1): Promise; complete(args: GraphProjectionLeaseV1 & { receipt: GraphProjectionReceiptV1; }): Promise; fail(args: GraphProjectionLeaseV1 & { outcome: "failed" | "unknown"; }): Promise; claimExpansion(args: GraphWorkerIdentity): Promise; currentExpansion(args: GraphProjectionLeaseV1): Promise<{ version: 1; current: true; }>; completeExpansion(args: GraphProjectionLeaseV1 & { result: GraphExpansionResultV1; }): Promise; failExpansion(args: GraphProjectionLeaseV1): Promise; } type GraphWorkerStepResult = { kind: "idle"; } | { kind: "projection" | "expansion"; jobId: string; state: "complete" | "failed" | "unknown"; backendAcknowledged: boolean; }; interface CortexGraphWorkerOptions extends GraphWorkerIdentity { transport: GraphWorkerTransport; connector: GraphWorkerConnector; leaseMs?: number; pollMs?: number; } /** Run in a host service process independent of application observation. One remote attempt per step. */ declare class CortexGraphWorker { private readonly identity; private readonly options; private closed; private active?; private loop?; private readonly stopSignal; constructor(options: CortexGraphWorkerOptions); private currentIdentity; step(): Promise; private execute; /** Core persists work while the service is stopped. This loop adds no in-process retry or memory writer. */ run(signal?: AbortSignal): Promise; close(): Promise; } export { ConvexGraphWorkerTransport, type ConvexGraphWorkerTransportOptions, CortexGraphWorker, type CortexGraphWorkerOptions, CypherProjectionConnector, type CypherProjectionConnectorConfig, GraphConnectorError, type GraphExpansionResultV1, type GraphExpansionWorkV1, type GraphFenceDiagnostics, type GraphProjectionLeaseV1, type GraphProjectionPayloadV1, type GraphProjectionReceiptV1, type GraphProjectionScope, type GraphProjectionWorkV1, type GraphWorkerConnector, type GraphWorkerIdentity, type GraphWorkerStepResult, type GraphWorkerTransport };