Skip to content
Sarj Workspace Sync

execution/trycomp-apply

@sarj-ai/workspace-sync/execution/trycomp-apply ยท Source

import type { D1Database } from "@cloudflare/workers-types";
import type { IdentityWriteBudget } from "../identity-provisioning/identity-budget-contracts.ts";
import { type ResourceLeaseRepository } from "../identity-sync/resource-lease.ts";
import type { TrycompReviewedPlan } from "../trycomp/model.ts";
import { type TrycompDeploymentEvidence, type TrycompMutationStore, type TrycompSafetyStore } from "../trycomp/safety.ts";
import type { ITrycompPeopleSyncService, TrycompAuthorityInput } from "../trycomp/service.ts";
import type { IWorkspaceDirectoryChangeLedger, WorkspaceDirectoryChangeLedgerHandle } from "./change-ledger.ts";
import type { WorkspaceDirectoryWorkflowParams } from "./contracts.ts";
import type { TrycompPeopleSyncRuntime } from "./provider-runtime-ports.ts";
import type { WorkspaceRuntimeConfiguration as ValidatedEnv } from "./runtime-configuration.ts";
import { type WorkspaceTrycompReceipt } from "./workspace-receipt.ts";
export interface WorkspaceTrycompApplyPorts {
nonRetryableError(message: string): Error;
captureAuthority(): Promise<TrycompAuthorityInput>;
createJournal(receipt: WorkspaceTrycompReceipt): TrycompMutationStore;
deployment: TrycompDeploymentEvidence;
leaseRepository: ResourceLeaseRepository;
now(): number;
readVerifiedInvitationMemberId?: (receipt: WorkspaceTrycompReceipt) => Promise<null | string>;
recoverReceipt(): Promise<null | WorkspaceDirectoryChangeLedgerHandle>;
safetyReader: TrycompSafetyStore;
service: ITrycompPeopleSyncService;
}
export interface WorkspaceTrycompApplyInput {
enabled: boolean;
expectedHandle: WorkspaceDirectoryChangeLedgerHandle;
parentPlanHash: string;
planGeneratedAt: string;
requestedBy: string;
reviewedPlan: TrycompReviewedPlan;
}
export declare function applyWorkspaceReviewedTrycomp(input: WorkspaceTrycompApplyInput, ports: WorkspaceTrycompApplyPorts): Promise<string>;
export declare function createWorkspaceReviewedTrycompApply(input: {
runtime(): TrycompPeopleSyncRuntime;
nonRetryableError(message: string): Error;
database: D1Database;
deployment: TrycompDeploymentEvidence;
env: ValidatedEnv;
identityBudget?: IdentityWriteBudget | undefined;
handles: readonly {
handle: WorkspaceDirectoryChangeLedgerHandle;
}[];
ledger: IWorkspaceDirectoryChangeLedger;
params: WorkspaceDirectoryWorkflowParams;
}): (reviewedPlan: TrycompReviewedPlan) => Promise<string>;
export declare function createWorkspaceReviewedTrycompInvitationReader(input: {
database: D1Database;
handles: readonly {
handle: WorkspaceDirectoryChangeLedgerHandle;
}[];
params: WorkspaceDirectoryWorkflowParams;
}): (reviewed: TrycompReviewedPlan) => Promise<null | string>;