Skip to content
Sarj Workspace Sync

execution/runtime

@sarj-ai/workspace-sync/execution/runtime ยท Source

import { z } from "zod";
import type { AccessGuardPlan } from "../access-guard/model.ts";
import type { LinearSuspensionParentContext } from "../access-guard/provider.ts";
import type { GitHubOrganizationWriteContext } from "../identity-provisioning/github-organization-connector.ts";
import { type IdentityWriteBudget } from "../identity-provisioning/identity-budget-contracts.ts";
import { GoogleGithubIdentitySeedService } from "../identity-sync/google-github-identity-seed-service.ts";
import { type ResourceLeaseRepository } from "../identity-sync/resource-lease.ts";
import { type JsonValue } from "../operations/schemas.ts";
import type { OrgChannelSyncRunReport, OrgChannelSyncService } from "../org-sync/channel-service.ts";
import { SarjIdentitySchemaService } from "../org-sync/google-identity-schema.ts";
import type { GoogleDirectoryUser } from "../org-sync/model.ts";
import type { ReviewedSlackLifecycleDurableParent, ReviewedSlackLifecycleRemoval } from "../org-sync/reviewed-lifecycle-removal.ts";
import type { OrgSyncRunReport } from "../org-sync/service.ts";
import type { TrycompReviewedPlan } from "../trycomp/model.ts";
import { type WorkspaceDirectoryPlan } from "./contracts.ts";
import type { GoogleGroupCleanupServiceContract } from "./google-group-cleanup-service.ts";
import type { PagerDutyTeamExecutionPort } from "./pager-duty-team-service.ts";
import type { PosthogMembershipExecutionPort } from "./posthog-membership-service.ts";
import type { WorkspaceSyncRuntimeBindings, WorkspaceNameServices } from "./provider-runtime-ports.ts";
import { type GoogleGroupCleanupParentContext } from "./reviewed-google-group-cleanup-adapter.ts";
import type { ReviewedNameAction } from "./reviewed-name-plan.ts";
import { type PagerDutyTeamParentContext } from "./reviewed-pager-duty-team-adapter.ts";
import type { PosthogMembershipAdapterDependencies } from "./reviewed-posthog-membership-adapter.ts";
import { type SentryWorkspaceParentContext } from "./reviewed-sentry-workspace-adapter.ts";
import { type WorkspaceNameParentContext } from "./reviewed-workspace-name-adapter.ts";
import type { WorkspaceRuntimeConfiguration as ValidatedEnv } from "./runtime-configuration.ts";
import type { WorkspaceDirectoryRuntime } from "./runtime-contract.ts";
import type { SentryWorkspaceExecutionPort } from "./sentry-workspace-service.ts";
export declare function slackChannelRunError(result: Pick<OrgChannelSyncRunReport, "errors" | "status">): string;
export interface WorkspaceDirectoryRuntimeOptions {
applyReviewedTrycomp?: (plan: TrycompReviewedPlan) => Promise<string>;
channelDatabase?: D1Database;
channelLeaseRepository?: ResourceLeaseRepository;
githubIdentityBudget?: IdentityWriteBudget;
githubParentContext?: (plan: WorkspaceDirectoryPlan) => GitHubOrganizationWriteContext;
googleGroupCleanupParentContext?: (plan: WorkspaceDirectoryPlan) => GoogleGroupCleanupParentContext;
googleGroupCleanupService?: GoogleGroupCleanupServiceContract;
googleIdentityBudget?: IdentityWriteBudget;
linearIdentityBudget?: IdentityWriteBudget;
linearSuspensionParentContext?: (plan: WorkspaceDirectoryPlan) => LinearSuspensionParentContext;
nameRepairParentContext?: (reviewed: ReviewedNameAction) => WorkspaceNameParentContext;
nameServices?: WorkspaceNameServices;
pagerDutyIdentityBudget?: IdentityWriteBudget;
pagerDutyTeamParentContext?: (plan: WorkspaceDirectoryPlan) => PagerDutyTeamParentContext;
pagerDutyTeamService?: PagerDutyTeamExecutionPort;
readVerifiedTrycompInvitation?: (plan: TrycompReviewedPlan) => Promise<null | string>;
reviewedSlackLifecycleParentContext?: (plan: WorkspaceDirectoryPlan) => ReviewedSlackLifecycleDurableParent;
scheduledLinearSuspensions?: boolean;
posthogIdentityBudget?: IdentityWriteBudget;
posthogParentContext?: NonNullable<PosthogMembershipAdapterDependencies["parentContext"]>;
posthogService?: PosthogMembershipExecutionPort;
sentryIdentityBudget?: IdentityWriteBudget;
sentryParentContext?: (plan: WorkspaceDirectoryPlan) => SentryWorkspaceParentContext;
sentryService?: SentryWorkspaceExecutionPort;
slackIdentityBudget?: IdentityWriteBudget;
}
interface IdentityProvisioningDependencies {
assertGoogleAuthority(plan: WorkspaceDirectoryPlan): Promise<GoogleDirectoryUser[]>;
identityBudget?: IdentityWriteBudget | undefined;
identitySchema: Pick<SarjIdentitySchemaService, "applyPlan">;
identitySeed: null | Pick<GoogleGithubIdentitySeedService, "applyPlan" | "captureSource">;
parentOwned?: boolean;
}
export declare function applyWorkspaceDirectoryIdentityProvisioning(plan: WorkspaceDirectoryPlan, dependencies: IdentityProvisioningDependencies): Promise<string>;
export declare function createWorkspaceDirectoryRuntime(bindings: WorkspaceSyncRuntimeBindings, env: ValidatedEnv, options?: WorkspaceDirectoryRuntimeOptions): WorkspaceDirectoryRuntime;
export declare function isExactContractorAdministratorRemoval(branch: WorkspaceDirectoryPlan["branches"][2]): boolean;
export declare function hasSelectedSlackMembershipRemoval(branch: WorkspaceDirectoryPlan["branches"][2]): boolean;
export declare function disabledSlackGroupsChannelsPlan(reason?: string): WorkspaceDirectoryPlan["branches"][2];
type SlackGroupsChannelsPlan = WorkspaceDirectoryPlan["branches"][2];
export declare function slackSelectedUserGroupsConverged(planned: SlackGroupsChannelsPlan, fresh: SlackGroupsChannelsPlan): boolean;
export declare function assertSlackMembershipIdentity(branch: SlackGroupsChannelsPlan, service: Pick<OrgChannelSyncService, "readMembershipIdentities">, users: readonly GoogleDirectoryUser[]): Promise<void>;
export declare function workspaceDirectoryContractIssuePaths(error: z.ZodError): string[];
export declare function captureWorkspaceDirectoryIdentitySchema(selected: boolean, identitySchema: Pick<SarjIdentitySchemaService, "plan">, parentOwned?: boolean): Promise<WorkspaceDirectoryPlan["branches"][5]["schemaPlan"]>;
interface WorkspaceDirectoryFanoutResult<A, B, C, D, E, F, G> {
access: E;
channels: C;
chart: B;
github: D;
identitySeed: G;
profiles: A;
schema: F;
}
export declare function captureWorkspaceDirectoryFanout<A, B, C, D, E, F, G>(captures: {
access: () => Promise<E>;
channels: () => Promise<C>;
chart: () => Promise<B>;
github: () => Promise<D>;
identitySeed: () => Promise<G>;
profiles: () => Promise<A>;
schema: () => Promise<F>;
}): Promise<WorkspaceDirectoryFanoutResult<A, B, C, D, E, F, G>>;
export declare function captureWorkspaceDirectoryComponent<T>(component: string, capture: () => Promise<T>): Promise<T>;
export declare function profileBranchFromAudit(profiles: Pick<OrgSyncRunReport, "blocked" | "errors" | "planHash" | "planned" | "selectedSlackUserId" | "status" | "warnings">, managed: boolean): {
branchId: "slack-profiles";
changes: {
after: import("../org-sync/model.ts").DesiredManagedFields;
before: import("../org-sync/model.ts").DesiredManagedFields;
changedFields: ("linkedin" | "manages" | "reportsTo" | "team" | "title")[];
googleUserId: string | null;
identity: string;
reason: "matched" | "not_org_participant" | "slack_orphan" | "suspended";
slackUserId: string;
}[];
diagnostics: ({
code: string;
message: string;
scope: {
actionId: "workspace-directory.slack-profiles";
kind: "action";
};
severity: "blocker";
} | {
code: string;
message: string;
severity: "warning";
} | {
code: string;
message: string;
scope: {
kind: "audit";
provider: "slack";
};
severity: "blocker";
})[];
execution: "managed";
killSwitchEngaged: false;
planHash: string;
} | {
branchId: "slack-profiles";
changes: {
after: import("../org-sync/model.ts").DesiredManagedFields;
before: import("../org-sync/model.ts").DesiredManagedFields;
changedFields: ("linkedin" | "manages" | "reportsTo" | "team" | "title")[];
googleUserId: string | null;
identity: string;
reason: "matched" | "not_org_participant" | "slack_orphan" | "suspended";
slackUserId: string;
}[];
diagnostics: ({
code: string;
message: string;
scope: {
actionId: "workspace-directory.slack-profiles";
kind: "action";
};
severity: "blocker";
} | {
code: string;
message: string;
severity: "warning";
} | {
code: string;
message: string;
scope: {
kind: "audit";
provider: "slack";
};
severity: "blocker";
})[];
execution: "audit-only";
killSwitchEngaged: true;
planHash: string;
};
export declare function projectProfilePlanDiagnostics(profiles: Pick<OrgSyncRunReport, "blocked" | "errors" | "warnings">, managed?: boolean): ({
code: string;
message: string;
scope: {
actionId: "workspace-directory.slack-profiles";
kind: "action";
};
severity: "blocker";
} | {
code: string;
message: string;
severity: "warning";
} | {
code: string;
message: string;
scope: {
kind: "audit";
provider: "slack";
};
severity: "blocker";
})[];
type SlackChannelTargetReader = Pick<OrgChannelSyncService, "readChannelIdentity" | "readChannelMemberIds">;
export declare function exactChannelRenameConverged(planned: WorkspaceDirectoryPlan["branches"][2], reader: SlackChannelTargetReader): Promise<boolean>;
export declare function exactChannelRemovalsConverged(planned: WorkspaceDirectoryPlan["branches"][2], fresh: WorkspaceDirectoryPlan["branches"][2], reader: SlackChannelTargetReader): Promise<boolean>;
type ChannelCapturePurpose = {
kind: "new-plan";
} | {
kind: "original-target-readback";
branch: SlackGroupsChannelsPlan;
};
interface ChannelCaptureRuntime {
allowRemovals: boolean;
service: Pick<OrgChannelSyncService, "readMembershipIdentities" | "readMembershipPlan" | "run">;
}
export declare function captureChannels(bindings: WorkspaceSyncRuntimeBindings, env: ValidatedEnv, googleUsers: readonly GoogleDirectoryUser[], database?: D1Database, existingRuntime?: ChannelCaptureRuntime, purpose?: ChannelCapturePurpose, reviewedLifecycleRemoval?: ReviewedSlackLifecycleRemoval): Promise<{
diagnostics: {
code: string;
context?: {
error_code: "linear_organization_id_mismatch" | "linear_organization_id_unpinned" | "linear_organization_url_key_mismatch";
kind: "linear_tenant";
observed_organization_id: string;
observed_url_key: string;
} | undefined;
message: string;
scope?: {
kind: "authority";
} | {
kind: "audit";
provider: "ashby" | "attio" | "github" | "linear" | "pagerduty" | "slack";
} | {
actionId: "workspace-directory.drive-org-chart" | "workspace-directory.fanout" | "workspace-directory.github-access" | "workspace-directory.google-group-cleanup" | "workspace-directory.linear-profiles" | "workspace-directory.linear-suspensions" | "workspace-directory.pagerduty-teams" | "workspace-directory.posthog-memberships" | "workspace-directory.sentry-memberships" | "workspace-directory.slack-groups-channels" | "workspace-directory.slack-names" | "workspace-directory.slack-profiles" | "workspace-directory.trycomp-people";
kind: "action";
} | undefined;
severity: "blocker" | "info" | "warning";
}[];
additions: {
channelId: string;
channelName: string;
identity: string;
isPrivate: boolean;
slackUserId: string;
}[];
branchId: "slack-groups-channels";
channelRenames: {
channelId: string;
currentName: string;
expectedName: string;
isPrivate: boolean;
}[];
lifecycle: {
googleTeamGroupsOutsideAssignmentAllowlist: string[];
nonstandardPublicChannels: string[];
privateChannelRenameCandidates: {
currentName: string;
expectedName: string;
}[];
slackTeamChannelCollisions: string[];
slackUsersWithoutTeamAssignment: {
identity: string | null;
slackUserId: string;
}[];
verticalRetirementCandidates: string[];
};
removals: {
channelId: string;
channelName: string;
identity: string;
isPrivate: boolean;
slackUserId: string;
removalAuthority?: "contractor_group_authoritative" | undefined;
}[];
userGroups: {
automationOwnership?: {
kind: "legacy_unmanaged";
} | {
allowedChannelIds: string[];
evidenceDigest: string;
excludedGoogleGroupIds: string[];
kind: "automation_bootstrap";
sourceGoogleGroupIds: string[];
} | {
allowedChannelIds: string[];
cutoverRevision: string;
evidenceDigest: string;
excludedGoogleGroupIds: string[];
kind: "automation_created" | "explicitly_adopted";
sourceGoogleGroupIds: string[];
} | undefined;
authority?: {
email: string;
excludedEmails?: string[] | undefined;
excludedIds?: string[] | undefined;
id: string;
kind: "google_group";
} | {
emails: string[];
excludedEmails: string[];
excludedIds: string[];
ids: string[];
kind: "google_group_union";
} | undefined;
currentHandle?: string | null | undefined;
currentName?: string | null | undefined;
channelAdditionIds?: string[] | undefined;
channelRemovalIds?: string[] | undefined;
desiredChannelIds: string[];
desiredName?: string | undefined;
desiredUserIds: string[];
handle: string;
memberAdditions?: {
identity: string;
slackUserId: string;
}[] | undefined;
memberAdditionUserIds?: string[] | undefined;
memberRemovals?: {
identity: string;
slackUserId: string;
}[] | undefined;
memberRemovalUserIds?: string[] | undefined;
removalCount: number;
requiredChannelIds?: string[] | undefined;
slackUserGroupId?: string | null | undefined;
status: "create" | "in_sync" | "update";
}[];
execution: "managed";
killSwitchEngaged: false;
planHash: string;
selectedChannelAdditions: {
channelId: string;
channelName: string;
identity: string;
isPrivate: boolean;
slackUserId: string;
}[];
selectedChannelRename: {
channelId: string;
currentName: string;
expectedName: string;
isPrivate: boolean;
} | null;
selectedProvenanceChannelRemovals: {
channelId: string;
channelName: string;
identity: string;
isPrivate: boolean;
slackUserId: string;
}[];
selectedRemovalCount: number;
selectedUserGroupHandles: string[];
selectedUserGroups: {
automationOwnership: {
kind: "legacy_unmanaged";
} | {
allowedChannelIds: string[];
evidenceDigest: string;
excludedGoogleGroupIds: string[];
kind: "automation_bootstrap";
sourceGoogleGroupIds: string[];
} | {
allowedChannelIds: string[];
cutoverRevision: string;
evidenceDigest: string;
excludedGoogleGroupIds: string[];
kind: "automation_created" | "explicitly_adopted";
sourceGoogleGroupIds: string[];
};
authority: {
email: string;
excludedEmails?: string[] | undefined;
excludedIds?: string[] | undefined;
id: string;
kind: "google_group";
} | {
emails: string[];
excludedEmails: string[];
excludedIds: string[];
ids: string[];
kind: "google_group_union";
};
channelAdditions: {
id: string;
isArchived: boolean;
isPrivate: boolean;
name: string;
}[];
channelAdditionIds: string[];
channelRemovals: {
id: string;
isArchived: boolean;
isPrivate: boolean;
name: string;
}[];
channelRemovalIds: string[];
currentHandle: string | null;
currentName: string | null;
desiredName: string;
effectiveAccessAdditions: {
channelId: string;
channelName: string;
identity: string;
isPrivate: boolean;
slackUserId: string;
}[];
expectedSlackUserGroupId: string | null;
handle: string;
memberAdditions: {
identity: string;
slackUserId: string;
}[];
memberRemovalAuthority: "contractor_group_authoritative" | "explicit_google_lifecycle" | "google_group_authoritative";
memberRemovals: {
identity: string;
slackUserId: string;
}[];
requiredChannelIds: string[];
slackUserGroupId: string | null;
}[];
selectedIdentity?: {
googleUserId: string & z.$brand<"GoogleUserId">;
slackUserId: string;
} | undefined;
reviewedLifecycleRemoval?: {
googleUserId: string & z.$brand<"GoogleUserId">;
slackUserGroupId: string;
slackUserId: string;
} | undefined;
} | {
diagnostics: {
code: string;
context?: {
error_code: "linear_organization_id_mismatch" | "linear_organization_id_unpinned" | "linear_organization_url_key_mismatch";
kind: "linear_tenant";
observed_organization_id: string;
observed_url_key: string;
} | undefined;
message: string;
scope?: {
kind: "authority";
} | {
kind: "audit";
provider: "ashby" | "attio" | "github" | "linear" | "pagerduty" | "slack";
} | {
actionId: "workspace-directory.drive-org-chart" | "workspace-directory.fanout" | "workspace-directory.github-access" | "workspace-directory.google-group-cleanup" | "workspace-directory.linear-profiles" | "workspace-directory.linear-suspensions" | "workspace-directory.pagerduty-teams" | "workspace-directory.posthog-memberships" | "workspace-directory.sentry-memberships" | "workspace-directory.slack-groups-channels" | "workspace-directory.slack-names" | "workspace-directory.slack-profiles" | "workspace-directory.trycomp-people";
kind: "action";
} | undefined;
severity: "blocker" | "info" | "warning";
}[];
additions: {
channelId: string;
channelName: string;
identity: string;
isPrivate: boolean;
slackUserId: string;
}[];
branchId: "slack-groups-channels";
channelRenames: {
channelId: string;
currentName: string;
expectedName: string;
isPrivate: boolean;
}[];
lifecycle: {
googleTeamGroupsOutsideAssignmentAllowlist: string[];
nonstandardPublicChannels: string[];
privateChannelRenameCandidates: {
currentName: string;
expectedName: string;
}[];
slackTeamChannelCollisions: string[];
slackUsersWithoutTeamAssignment: {
identity: string | null;
slackUserId: string;
}[];
verticalRetirementCandidates: string[];
};
removals: {
channelId: string;
channelName: string;
identity: string;
isPrivate: boolean;
slackUserId: string;
removalAuthority?: "contractor_group_authoritative" | undefined;
}[];
userGroups: {
automationOwnership?: {
kind: "legacy_unmanaged";
} | {
allowedChannelIds: string[];
evidenceDigest: string;
excludedGoogleGroupIds: string[];
kind: "automation_bootstrap";
sourceGoogleGroupIds: string[];
} | {
allowedChannelIds: string[];
cutoverRevision: string;
evidenceDigest: string;
excludedGoogleGroupIds: string[];
kind: "automation_created" | "explicitly_adopted";
sourceGoogleGroupIds: string[];
} | undefined;
authority?: {
email: string;
excludedEmails?: string[] | undefined;
excludedIds?: string[] | undefined;
id: string;
kind: "google_group";
} | {
emails: string[];
excludedEmails: string[];
excludedIds: string[];
ids: string[];
kind: "google_group_union";
} | undefined;
currentHandle?: string | null | undefined;
currentName?: string | null | undefined;
channelAdditionIds?: string[] | undefined;
channelRemovalIds?: string[] | undefined;
desiredChannelIds: string[];
desiredName?: string | undefined;
desiredUserIds: string[];
handle: string;
memberAdditions?: {
identity: string;
slackUserId: string;
}[] | undefined;
memberAdditionUserIds?: string[] | undefined;
memberRemovals?: {
identity: string;
slackUserId: string;
}[] | undefined;
memberRemovalUserIds?: string[] | undefined;
removalCount: number;
requiredChannelIds?: string[] | undefined;
slackUserGroupId?: string | null | undefined;
status: "create" | "in_sync" | "update";
}[];
execution: "audit-only";
killSwitchEngaged: true;
planHash: string;
selectedChannelAdditions: [];
selectedChannelRename: null;
selectedProvenanceChannelRemovals: [];
selectedRemovalCount: 0;
selectedUserGroupHandles: [];
selectedUserGroups: [];
} | {
diagnostics: {
code: string;
context?: {
error_code: "linear_organization_id_mismatch" | "linear_organization_id_unpinned" | "linear_organization_url_key_mismatch";
kind: "linear_tenant";
observed_organization_id: string;
observed_url_key: string;
} | undefined;
message: string;
scope?: {
kind: "authority";
} | {
kind: "audit";
provider: "ashby" | "attio" | "github" | "linear" | "pagerduty" | "slack";
} | {
actionId: "workspace-directory.drive-org-chart" | "workspace-directory.fanout" | "workspace-directory.github-access" | "workspace-directory.google-group-cleanup" | "workspace-directory.linear-profiles" | "workspace-directory.linear-suspensions" | "workspace-directory.pagerduty-teams" | "workspace-directory.posthog-memberships" | "workspace-directory.sentry-memberships" | "workspace-directory.slack-groups-channels" | "workspace-directory.slack-names" | "workspace-directory.slack-profiles" | "workspace-directory.trycomp-people";
kind: "action";
} | undefined;
severity: "blocker" | "info" | "warning";
}[];
additions: {
channelId: string;
channelName: string;
identity: string;
isPrivate: boolean;
slackUserId: string;
}[];
branchId: "slack-groups-channels";
channelRenames: {
channelId: string;
currentName: string;
expectedName: string;
isPrivate: boolean;
}[];
lifecycle: {
googleTeamGroupsOutsideAssignmentAllowlist: string[];
nonstandardPublicChannels: string[];
privateChannelRenameCandidates: {
currentName: string;
expectedName: string;
}[];
slackTeamChannelCollisions: string[];
slackUsersWithoutTeamAssignment: {
identity: string | null;
slackUserId: string;
}[];
verticalRetirementCandidates: string[];
};
removals: {
channelId: string;
channelName: string;
identity: string;
isPrivate: boolean;
slackUserId: string;
removalAuthority?: "contractor_group_authoritative" | undefined;
}[];
userGroups: {
automationOwnership?: {
kind: "legacy_unmanaged";
} | {
allowedChannelIds: string[];
evidenceDigest: string;
excludedGoogleGroupIds: string[];
kind: "automation_bootstrap";
sourceGoogleGroupIds: string[];
} | {
allowedChannelIds: string[];
cutoverRevision: string;
evidenceDigest: string;
excludedGoogleGroupIds: string[];
kind: "automation_created" | "explicitly_adopted";
sourceGoogleGroupIds: string[];
} | undefined;
authority?: {
email: string;
excludedEmails?: string[] | undefined;
excludedIds?: string[] | undefined;
id: string;
kind: "google_group";
} | {
emails: string[];
excludedEmails: string[];
excludedIds: string[];
ids: string[];
kind: "google_group_union";
} | undefined;
currentHandle?: string | null | undefined;
currentName?: string | null | undefined;
channelAdditionIds?: string[] | undefined;
channelRemovalIds?: string[] | undefined;
desiredChannelIds: string[];
desiredName?: string | undefined;
desiredUserIds: string[];
handle: string;
memberAdditions?: {
identity: string;
slackUserId: string;
}[] | undefined;
memberAdditionUserIds?: string[] | undefined;
memberRemovals?: {
identity: string;
slackUserId: string;
}[] | undefined;
memberRemovalUserIds?: string[] | undefined;
removalCount: number;
requiredChannelIds?: string[] | undefined;
slackUserGroupId?: string | null | undefined;
status: "create" | "in_sync" | "update";
}[];
execution: "disabled";
killSwitchEngaged: true;
planHash: null;
selectedChannelAdditions: [];
selectedChannelRename: null;
selectedProvenanceChannelRemovals: [];
selectedRemovalCount: 0;
selectedUserGroupHandles: [];
selectedUserGroups: [];
}>;
export declare function captureGithubWriterReadiness(bindings: WorkspaceSyncRuntimeBindings, env: ValidatedEnv): Promise<{
mutationDisabled: boolean;
writesAttempted: 0;
credentialsSeparated: boolean;
sourceComplete: boolean;
globalBlockerCount: number;
tenantPinVerified: boolean;
observedIdentityVerified: boolean;
permissionEvidence: "read-verified-write-unproven" | "unavailable";
providerBlockerCounts: Partial<Record<"direct-repository-grants" | "identity-mismatch" | "inherited-team-membership" | "outside-collaborator" | "owner-protected" | "pending-invitation" | "pending-team-membership" | "privileged-invitation" | "protected-google-identity" | "repository-inventory-incomplete" | "saml-unlinked" | "team-maintainer", number>>;
diagnostics: ("credential_missing" | "credential_not_separated" | "provider_evidence_unavailable" | "provider_http_401" | "provider_http_403" | "provider_http_404" | "provider_http_429" | "provider_request_headers_invalid" | "provider_request_transport_failed" | "provider_target_ineligible" | "provider_transport_illegal_invocation" | "provider_transport_network_failure" | "provider_transport_request_context_inactive" | "provider_transport_type_error" | "provider_writer_response_invalid" | "source_account_planning_unavailable" | "source_authority_fingerprint_unavailable" | "source_authority_projection_unavailable" | "source_blocked" | "source_employee_authority_unavailable" | "source_github_inventory_unavailable" | "source_google_authority_unavailable" | "source_snapshot_port_unavailable" | "source_team_fingerprint_unavailable" | "source_unavailable" | "target_unavailable" | "write_permission_unproven")[];
}>;
export declare function projectAccessGuardDiagnostics(plan: AccessGuardPlan): ({
code: "ambiguous_github_identity" | "ambiguous_google_email" | "ambiguous_provider_email" | "conflicting_github_identity" | "invalid_google_github_identity" | "invalid_google_org_shape" | "pending_provider_invitation" | "protected_linear_account" | "provider_error" | "provider_readiness" | "unmatched_provider_account";
context?: {
error_code: "linear_organization_id_mismatch" | "linear_organization_id_unpinned" | "linear_organization_url_key_mismatch";
kind: "linear_tenant";
observed_organization_id: string;
observed_url_key: string;
};
message: string;
scope: {
readonly kind: "authority";
readonly actionId?: never;
readonly provider?: never;
} | {
readonly actionId: "workspace-directory.linear-suspensions";
readonly kind: "action";
readonly provider?: never;
} | {
readonly actionId?: never;
readonly kind: "audit";
readonly provider: "ashby" | "attio" | "github" | "pagerduty" | "slack";
};
severity: "blocker" | "warning";
} | {
code: string;
message: string;
severity: "info";
})[];
export declare function fingerprintGoogleAuthority(users: readonly GoogleDirectoryUser[]): Promise<string>;
export declare function workspaceDirectoryAuthorityRevision(googleUserId: string, authorityFingerprint: string): string;
export declare function readOriginalSlackMembershipObservation(env: ValidatedEnv, users: readonly GoogleDirectoryUser[], planned: SlackGroupsChannelsPlan, channelRuntime: {
service: Pick<OrgChannelSyncService, "readOriginalMembershipObservation">;
}): Promise<JsonValue>;
export {};