import type { ParticipationPolicy, ParticipationStyle } from "@canonmsg/backend-contracts"; export { buildParticipationHistorySnapshot, evaluateParticipationPolicy, getDefaultParticipationPolicy, resolveAgentBehaviorPolicy, DEFAULT_GROUP_MAX_CONSECUTIVE_AGENT_TURNS, PARTICIPATION_HISTORY_FETCH_LIMIT as DEFAULT_PARTICIPATION_HISTORY_FETCH_LIMIT, } from "@canonmsg/backend-contracts"; export type { ParticipationStyle, PolicyConversationType, ParticipationPolicy, ParticipationDecision, ParticipationDecisionInput, ParticipationHistoryMessage, ParticipationHistorySnapshot, AgentBehaviorSettingsInput as AgentBehaviorSettings, ResolvedAgentBehaviorPolicyRecord as ResolvedAgentBehaviorPolicy, } from "@canonmsg/backend-contracts"; export type PolicyRole = "owner" | "conversation_member" | "group_admin" | "external_requester" | "agent_self"; export type RepresentationMode = "self" | "delegate"; export type PermissionLevel = "deny" | "allow" | "require_approval"; export type ConversationScope = "global" | "relationship" | "conversation" | "work_session" | "message"; export interface Participant { id: string; type: "human" | "ai_agent"; ownerId?: string | null; relationshipIds?: string[]; } export interface Relationship { id: string; participantIds: [string, string]; profileId?: string | null; notes?: string | null; } export interface ContextOverlay { scope: ConversationScope; scopeId: string; instructions?: string | null; notes?: string | null; } export interface BehaviorProfile { id: string; label: string; participationStyle: ParticipationStyle; defaultRepresentation: RepresentationMode; allowAgentToAgent: boolean; allowLongRunningCollaboration: boolean; requireMentionForGroupReplies: boolean; maxConsecutiveAgentTurns?: number | null; } export interface AdmissionPolicy { canDiscover: PermissionLevel; canStartDirectConversation: PermissionLevel; canAddToGroup: PermissionLevel; canSendContactRequest: PermissionLevel; } export interface RuntimeControlPolicy { canInterrupt: PermissionLevel; canChangeModel: PermissionLevel; canChangeWorkspace: PermissionLevel; canChangeSessionConfig: PermissionLevel; } export interface ActionApprovalPolicy { canInitiateExternalFirstContact: PermissionLevel; canShareIdentity: PermissionLevel; canIntroduceParticipant: PermissionLevel; canSpeakAsDelegate: PermissionLevel; } export interface ResolvedPolicy { admission: AdmissionPolicy; runtime: RuntimeControlPolicy; actionApproval: ActionApprovalPolicy; participation: ParticipationPolicy; representation: { defaultMode: RepresentationMode; }; overlays: ContextOverlay[]; resolvedFrom: { globalDefault?: string; agentDefault?: string; relationship?: string; messageDirective?: string; }; } export interface ResolvedTurnEligibility { mayAutoReply: boolean; mayInterrupt: boolean; mayQueueWhileRunning: boolean; mayInterruptRunningTurn: boolean; mayInterleaveWhileRunning: boolean; mayReactToNonFinalAgentMessages: boolean; mayChangeModel: boolean; mayChangeWorkspace: boolean; maySpeakAsDelegate: boolean; mayInitiateExternalFirstContact: boolean; reasonCodes: string[]; }