import type { Database } from "bun:sqlite"; import type { EventSource, JsonObject, WorkspaceKind } from "../types/workspace.js"; import type { ProjectStore } from "../store/project-store.js"; export declare const PROJECT_REGISTRATION_ROUTE = "projects.full-registration.v1"; export declare const PROJECT_REGISTRATION_GOALS_FILENAME = "GOALS.md"; export declare const PROJECT_REGISTRATION_WORKLOG_FILENAME = "WORKLOG.md"; export declare const PROJECT_REGISTRATION_MAX_RECEIPTS = 32; export declare const PROJECT_REGISTRATION_DEPENDENCY_TASKS: { readonly todos: "317026ea-dc10-422e-af51-206a4ec885f9"; readonly mementos: "7e6a213c-ae3d-420c-a512-94abd1164df8"; readonly conversations: "983c734e-6602-4286-98c5-9c2e6f6d741a"; }; /** * These are retirement predicates, not naming templates. New registration * derives its name from the project slug; it never manufactures either prefix. */ export declare const RETIRED_PROJECT_REGISTRATION_PREFIXES: readonly ["internal-iproj-", "iproj-"]; export type ProjectRegistrationAuthorityName = keyof typeof PROJECT_REGISTRATION_DEPENDENCY_TASKS; export type ProjectRegistrationAuthorityTransport = "local" | "api"; export type ProjectRegistrationResourceKind = "project" | "task_list" | "channel"; export type ProjectRegistrationDirection = "forward" | "inverse"; export type ProjectRegistrationOutcome = "accepted" | "duplicate_of_accepted" | "terminal_nonacceptance"; export interface ProjectRegistrationBounds { response_byte_limit: number; time_budget_ms: number; } export interface ProjectRegistrationResponseControl extends ProjectRegistrationBounds { response_bytes: number; elapsed_ms: number; complete: boolean; truncated: boolean; } /** * A path-bearing registration request stays inside this package-owned handle. * It is never serialized into a manifest, receipt, result, argv, or env field. */ export declare class ProjectRegistrationPathHandle { #private; private constructor(); static fromPath(path: string): ProjectRegistrationPathHandle; get digest(): string; withOwnedPath(consumer: (absolutePath: string) => T): T; } export interface ProjectRegistrationAuthorityCapability { authority: ProjectRegistrationAuthorityName; route: string; package_version: string; authority_id: string; tenant_id: string; corpus_id: string; supported_resources: ProjectRegistrationResourceKind[]; conditional_create: boolean; immutable_receipts: boolean; exact_terminal_lookup: boolean; exact_readback: boolean; conditional_inverse: boolean; ambiguous_outcome_reconciliation: boolean; guarded_update?: boolean; guarded_update_route?: string; expected_revision_compare_and_swap?: boolean; caller_idempotency?: boolean; exact_inverse_rollback?: boolean; } export interface ProjectRegistrationAuthorityReceipt { receipt_id: string; authority: ProjectRegistrationAuthorityName; route: string; package_version: string; authority_id: string; tenant_id: string; corpus_id: string; operation_id: string; step_id: string; resource_kind: ProjectRegistrationResourceKind; direction: ProjectRegistrationDirection; idempotency_key: string; request_digest: string; precondition_digest: string; outcome: ProjectRegistrationOutcome; reason: string | null; target_id: string | null; result_revision: string | null; result_digest: string | null; duplicate_of_receipt_id: string | null; accepted_receipt_id: string | null; created_by_operation: boolean; prior_state?: JsonObject | null; created_at: string; } export interface ProjectRegistrationAuthorityRecord { target_id: string; revision: string; digest: string; } export interface ProjectRegistrationAuthorityRequest extends ProjectRegistrationBounds { operation_id: string; step_id: string; resource_kind: ProjectRegistrationResourceKind; direction: ProjectRegistrationDirection; authority_route: string; package_version: string; authority_id: string; tenant_id: string; corpus_id: string; target_selector: string; idempotency_key: string; request_digest: string; precondition_digest: string; project_id: string; project_slug: string; project_name: string; desired: JsonObject; operation_intent?: "create" | "bind_existing" | "adopt_existing"; adopt_existing?: JsonObject; target: ProjectRegistrationPathHandle; accepted_receipt?: ProjectRegistrationAuthorityReceipt; } export interface ProjectRegistrationAuthorityLookupRequest extends ProjectRegistrationBounds { operation_id: string; step_id: string; resource_kind: ProjectRegistrationResourceKind; direction: ProjectRegistrationDirection; authority: ProjectRegistrationAuthorityName; authority_route: string; package_version: string; authority_id: string; tenant_id: string; corpus_id: string; target_selector: string; idempotency_key: string; request_digest: string; precondition_digest: string; target_id?: string; max_items: 1; } export interface ProjectRegistrationAuthorityLookupResult { receipt: ProjectRegistrationAuthorityReceipt; response_control: ProjectRegistrationResponseControl; } export interface ProjectRegistrationAuthorityInverseVerification { target_id: string; accepted_receipt_id: string; absent: true; digest: string; } export interface ProjectRegistrationAuthorityPathRepairReceipt { receipt_id: string; authority: "mementos"; route: string; package_version: string; authority_id: string; tenant_id: string; corpus_id: string; operation_id: string; step_id: string; direction: "forward" | "rollback"; idempotency_key: string; request_digest: string; outcome: "accepted"; target_id: string; expected_revision: string; result_revision: string; result_digest: string; accepted_receipt_id: string | null; created_at: string; } export interface ProjectRegistrationGuardedProjectUpdateRequest extends ProjectRegistrationBounds { authority: "mementos"; authority_route: string; package_version: string; operation_id: string; step_id: string; authority_id: string; tenant_id: string; corpus_id: string; idempotency_key: string; expected_revision: string; updates: { path: ProjectRegistrationPathHandle; }; } export interface ProjectRegistrationGuardedProjectRollbackRequest extends ProjectRegistrationBounds { authority: "mementos"; authority_route: string; package_version: string; operation_id: string; step_id: string; authority_id: string; tenant_id: string; corpus_id: string; idempotency_key: string; expected_revision: string; accepted_receipt: ProjectRegistrationAuthorityPathRepairReceipt; } export interface ProjectRegistrationGuardedProjectReceiptLookupRequest extends ProjectRegistrationBounds { authority: "mementos"; authority_route: string; package_version: string; authority_id: string; tenant_id: string; corpus_id: string; } export interface ProjectRegistrationGuardedProjectUpdateResult { dry_run: false; applied: true; record: ProjectRegistrationAuthorityRecord; receipt: ProjectRegistrationAuthorityPathRepairReceipt; response_control: ProjectRegistrationResponseControl; } export interface ProjectRegistrationGuardedProjectReceiptLookupResult { receipt: ProjectRegistrationAuthorityPathRepairReceipt; response_control: ProjectRegistrationResponseControl; } export interface ProjectRegistrationAuthorityAdapter { readonly authority: ProjectRegistrationAuthorityName; readonly transport?: ProjectRegistrationAuthorityTransport; capability(): Promise; create(request: ProjectRegistrationAuthorityRequest): Promise; readExact(request: { resource_kind: ProjectRegistrationResourceKind; target_id: string; target: ProjectRegistrationPathHandle; response_byte_limit: number; time_budget_ms: number; }): Promise; lookupReceipt(request: ProjectRegistrationAuthorityLookupRequest): Promise; validateExistingAdoption?(request: ProjectRegistrationAuthorityRequest, receipt: ProjectRegistrationAuthorityReceipt): Promise; validatePriorRegistrationAdoption?(sourceRequest: ProjectRegistrationAuthorityRequest, sourceReceipt: ProjectRegistrationAuthorityReceipt, currentRecord: ProjectRegistrationAuthorityRecord): Promise; compensate(request: ProjectRegistrationAuthorityRequest): Promise; verifyInverse(request: ProjectRegistrationAuthorityRequest): Promise; guardedUpdateProject?(targetId: string, request: ProjectRegistrationGuardedProjectUpdateRequest): Promise; getGuardedProjectUpdateReceipt?(targetId: string, receiptId: string, request: ProjectRegistrationGuardedProjectReceiptLookupRequest): Promise; rollbackGuardedProjectUpdate?(targetId: string, request: ProjectRegistrationGuardedProjectRollbackRequest): Promise; } export interface ProjectRegistrationAuthorities { todos: ProjectRegistrationAuthorityAdapter; mementos: ProjectRegistrationAuthorityAdapter; conversations: ProjectRegistrationAuthorityAdapter; } export interface ProjectRegistrationCapabilityBlocker { authority: ProjectRegistrationAuthorityName; dependency_task_id: string; route: string; package_version: string; missing: string[]; } export interface ProjectRegistrationCapabilityReport { ok: boolean; capabilities: ProjectRegistrationAuthorityCapability[]; blockers: ProjectRegistrationCapabilityBlocker[]; } export interface FullProjectRegistrationProjectInput { id?: string; name: string; slug?: string; description?: string; kind?: WorkspaceKind; root_id?: string; recipe_id?: string; git_remote?: string; s3_bucket?: string; s3_prefix?: string; tags?: string[]; metadata?: JsonObject; agent_id?: string; source?: EventSource; prompt?: string; command?: string; } export interface ProjectRegistrationHistoricalAuthorityIdentity { route: string; package_version: string; authority_id: string; corpus_id: string; } export interface ProjectRegistrationExistingConversationsChannelReconciliation { source_operation_id: string; source_authority_identity?: ProjectRegistrationHistoricalAuthorityIdentity; target_id: string; } export interface ProjectRegistrationPreboundConversationsChannelReconciliation { target_id: string; expected_project_id: string; expected_revision: string; expected_digest: string; expected_message_ownership: JsonObject; } export interface ProjectRegistrationExistingAuthorityReconciliation { source_operation_id: string; source_authority_identity?: ProjectRegistrationHistoricalAuthorityIdentity; target_id: string; } export interface ProjectRegistrationExistingMementosProjectReconciliation extends ProjectRegistrationExistingAuthorityReconciliation { source_target: ProjectRegistrationPathHandle; } export interface FullProjectRegistrationReconciliationInput { conversations_channel?: ProjectRegistrationExistingConversationsChannelReconciliation | ProjectRegistrationPreboundConversationsChannelReconciliation; todos_project?: ProjectRegistrationExistingAuthorityReconciliation; todos_task_list?: ProjectRegistrationExistingAuthorityReconciliation; mementos_project?: ProjectRegistrationExistingMementosProjectReconciliation; } export interface FullProjectRegistrationInput extends ProjectRegistrationBounds { operation_id: string; mode?: "create" | "retrofit"; expected_project_revision?: string; reconcile_existing?: FullProjectRegistrationReconciliationInput; project: FullProjectRegistrationProjectInput; target: ProjectRegistrationPathHandle; goals_markdown: string; worklog_markdown: string; } export interface ProjectRegistrationArtifact { kind: string; authority: string; target_id: string; revision?: string; digest?: string; authority_receipt_id?: string; source_target_path_digest?: string; requested_target_path_digest?: string; } export interface ProjectRegistrationReceipt { receipt_id: string; operation_id: string; sequence: number; step_id: string; authority: string; resource_kind: string; direction: ProjectRegistrationDirection; idempotency_key: string; target_id: string | null; request_digest: string; precondition_digest: string; outcome: ProjectRegistrationOutcome; reason: string | null; result_revision: string | null; result_digest: string | null; duplicate_of_receipt_id: string | null; authority_receipt: ProjectRegistrationAuthorityReceipt | ProjectRegistrationAuthorityPathRepairReceipt | null; artifacts: JsonObject[]; preconditions: JsonObject[]; rollback: JsonObject[]; created_at: string; } export interface ProjectRegistrationReceiptLookupInput extends ProjectRegistrationBounds { operation_id: string; step_id: string; direction: ProjectRegistrationDirection; idempotency_key: string; max_items: 1; } export interface ProjectRegistrationReceiptLookupResult { receipt: ProjectRegistrationReceipt; response_control: ProjectRegistrationResponseControl; } export interface FullProjectRegistrationResult { ok: boolean; outcome: "no_go" | "accepted" | "duplicate_of_accepted" | "rolled_back" | "split_state"; operation_id: string; project_id: string; project_slug: string; failed_step: string | null; reason_code: string | null; dependencies: ProjectRegistrationCapabilityBlocker[]; artifacts: ProjectRegistrationArtifact[]; receipts: ProjectRegistrationReceipt[]; rollback: JsonObject[]; response_control: ProjectRegistrationResponseControl; } export declare function deriveProjectRegistrationIdempotencyKey(input: { operation_id: string; step_id: string; direction: ProjectRegistrationDirection; target_selector: string; request_digest: string; precondition_digest: string; }): string; export declare function lookupProjectRegistrationReceipt(input: ProjectRegistrationReceiptLookupInput, db?: Database): ProjectRegistrationReceiptLookupResult; export declare function listProjectRegistrationReceipts(operationId: string, db?: Database): ProjectRegistrationReceipt[]; export declare function assertCurrentProjectRegistrationSlug(slug: string): void; export declare function preflightProjectRegistrationAuthorities(authorities: ProjectRegistrationAuthorities): Promise; export declare function unavailableProjectRegistrationAuthorities(): ProjectRegistrationAuthorities; export declare function registerFullProject(input: FullProjectRegistrationInput, options?: { db?: Database; authorities?: ProjectRegistrationAuthorities; projectStore?: ProjectStore; }): Promise; //# sourceMappingURL=project-registration.d.ts.map