Skip to content
Sarj Workspace Sync

trycomp/service

@sarj-ai/workspace-sync/trycomp/service ยท Source

import type { ActiveResourceLease } from "../identity-sync/resource-lease.ts";
import type { GoogleGroupSnapshot } from "../org-sync/channel-model.ts";
import type { GoogleDirectoryUser } from "../org-sync/model.ts";
import type { ITrycompPeopleClient } from "./client.ts";
import { type TrycompReviewedPlan, type TrycompReviewedSlice, type TrycompRunReport } from "./model.ts";
import type { TrycompDeploymentEvidence, TrycompMutationStore, TrycompSafetyStore } from "./safety.ts";
export interface TrycompPeopleSyncConfig {
activationDeniedEmails?: readonly string[];
allowDeactivations: boolean;
approvedPlanHash: string;
excludedGoogleUserIds: readonly string[];
expectedContractorGroupId: string;
managedDomain: string;
maxAutomaticActivations: number;
maxAutomaticContractorDeactivations?: number;
maxAutomaticDeactivations?: number;
maxAutomaticInactiveGoogleDeactivations?: number;
minimumGoogleUsers: number;
mode: "audit" | "live";
offboardingOnly?: boolean;
protectedEmails?: readonly string[];
protectedGoogleUserIds?: readonly string[];
writeProtectedEmails?: readonly string[];
writeProtectedGoogleUserIds?: readonly string[];
}
export interface TrycompAuthorityInput {
activeGoogleUserCount?: number;
contractorGroup: GoogleGroupSnapshot;
googleUsers: readonly GoogleDirectoryUser[];
}
/** Authority required for one already-reviewed scheduled application. */
export interface TrycompReviewedApplyInput extends TrycompAuthorityInput {
assertWriteAuthority: () => Promise<void>;
deployment: TrycompDeploymentEvidence;
lease: ActiveResourceLease;
mutationJournal: TrycompMutationStore;
preannounce: (plan: Pick<TrycompRunReport, "planHash" | "planned" | "runId">, renew: () => Promise<void>) => Promise<{
intentKey: string;
slackTimestamp: string;
}>;
refreshAuthority: () => Promise<TrycompAuthorityInput>;
reviewedPlan: TrycompReviewedPlan;
safetyReader: TrycompSafetyStore;
}
export interface ITrycompPeopleSyncService {
applyReviewed(input: TrycompReviewedApplyInput): Promise<TrycompRunReport>;
captureReviewedPlan(authority: TrycompAuthorityInput): Promise<TrycompReviewedPlan>;
/** Pinned plans require fresh authority and original invitation evidence; legacy plans retain provider-only readback. */
readReviewedSlice(reviewedPlan: TrycompReviewedPlan, evidence?: TrycompReviewedReadEvidence): Promise<TrycompReviewedSlice>;
}
export interface TrycompReviewedReadEvidence {
authority: TrycompAuthorityInput;
verifiedInvitationMemberId?: (() => Promise<null | string>) | undefined;
}
export declare class TrycompPeopleSyncService implements ITrycompPeopleSyncService {
#private;
constructor(client: ITrycompPeopleClient, config: TrycompPeopleSyncConfig);
captureReviewedPlan(authority: TrycompAuthorityInput): Promise<TrycompReviewedPlan>;
readReviewedSlice(rawPlan: TrycompReviewedPlan, evidence?: TrycompReviewedReadEvidence): Promise<TrycompReviewedSlice>;
applyReviewed(input: TrycompReviewedApplyInput): Promise<TrycompRunReport>;
}
export declare function reviewedAuthorityFingerprint(authority: TrycompAuthorityInput): Promise<string>;