Add provider policy usage controls

This commit is contained in:
ZacharyZhang-NY committed 2026-05-23 17:48:46 -04:00
1 parent 1ee877e630
commit 276929b855
18 files changed
+434 -59

No files matched your search

+12
View File
@@ -3,6 +3,8 @@ import type {
ComplianceExportType,
ComplianceSubjectType,
LegalHoldEntityType,
ProviderDataPolicy,
ProviderExecutionMode,
RetentionFreezeScopeType,
RiskLevel,
SearchEntityType,
@@ -127,11 +129,21 @@ export interface CheckProviderHealthInput {
providerId: string;
}
export interface UpdateProviderPolicyInput {
orgId: string;
providerId: string;
dataPolicy: ProviderDataPolicy;
backgroundEnabled: boolean;
monthlyRequestLimit: number;
workspaceScope: "organization" | "workspace";
}
export interface CreateProviderResponseInput {
orgId: string;
providerId: string;
prompt: string;
instructions: string | null;
executionMode?: ProviderExecutionMode;
}
export interface ImportSkillDirectoryInput {
@@ -33,6 +33,7 @@ import type {
SetLegalHoldStateInput,
SetRetentionFreezeStateInput,
SetScheduledPostStateInput,
UpdateProviderPolicyInput,
UpdateTaskStatusInput,
} from "./commands";
@@ -57,6 +58,7 @@ export interface DesktopApi {
saveProviderCredential(input: SaveProviderCredentialInput): Promise<DesktopResult<AppSnapshot>>;
launchProviderSignIn(input: LaunchProviderSignInInput): Promise<DesktopResult<null>>;
checkProviderHealth(input: CheckProviderHealthInput): Promise<DesktopResult<AppSnapshot>>;
updateProviderPolicy(input: UpdateProviderPolicyInput): Promise<DesktopResult<AppSnapshot>>;
openExternalUrl(url: string): Promise<DesktopResult<null>>;
createProviderResponse(input: CreateProviderResponseInput): Promise<DesktopResult<AppSnapshot>>;
importSkillDirectory(input: ImportSkillDirectoryInput): Promise<DesktopResult<AppSnapshot>>;
+18 -49
View File
@@ -1,57 +1,18 @@
import type { BoardInterventionRecord as BoardInterventionRecordModel, ChatThreadBoardState as ChatThreadBoardStateModel } from "./board-domain";
import type { ComplianceExportRecord, LegalHoldRecord, RetentionFreezeRecord } from "./compliance-domain";
import type { ProviderDataPolicy, ProviderExecutionMode } from "./provider-policy-domain";
export { BOARD_INTERVENTION_ACTION, BOARD_INTERVENTION_MODE, CHAT_THREAD_BOARD_STATE, type BoardInterventionAction, type BoardInterventionMode, type BoardInterventionRecord, type ChatThreadBoardState } from "./board-domain";
export { COMPLIANCE_EXPORT_STATE, COMPLIANCE_EXPORT_TYPE, type ComplianceExportRecord, type ComplianceExportState, type ComplianceExportType, type ComplianceSubjectType, type LegalHoldEntityType, type LegalHoldRecord, type RetentionFreezeRecord, type RetentionFreezeScopeType } from "./compliance-domain";
export { PROVIDER_DATA_POLICY, PROVIDER_EXECUTION_MODE, type ProviderDataPolicy, type ProviderExecutionMode } from "./provider-policy-domain";
export { SEARCH_ENTITY_TYPES, type SearchEntityType, type SearchResultRecord } from "./search-domain";
export const TASK_STATUS = {
BACKLOG: "backlog",
IN_PROGRESS: "in_progress",
REVIEW: "review",
DONE: "done",
} as const;
export const APPROVAL_STATE = {
PENDING: "pending",
APPROVED: "approved",
DECLINED: "declined",
} as const;
export const RISK_LEVEL = {
LOW: "low",
MEDIUM: "medium",
HIGH: "high",
} as const;
export const TASK_PRIORITY = {
LOW: "low",
NORMAL: "normal",
HIGH: "high",
} as const;
export const PROVIDER_AUTH_TYPE = {
API_KEY: "api_key",
OAUTH_PKCE: "oauth_pkce",
ACCOUNT_SUBSCRIPTION: "account_subscription",
CLOUD: "cloud",
} as const;
export const SOCIAL_PLATFORM = {
X: "x",
LINKEDIN: "linkedin",
YOUTUBE: "youtube",
INSTAGRAM: "instagram",
} as const;
export const PROVIDER_REQUEST_STATE = {
PENDING: "pending",
SUCCEEDED: "succeeded",
FAILED: "failed",
} as const;
export const FILE_SCAN_STATE = {
APPROVED: "approved",
BLOCKED: "blocked",
} as const;
export const TASK_STATUS = { BACKLOG: "backlog", IN_PROGRESS: "in_progress", REVIEW: "review", DONE: "done" } as const;
export const APPROVAL_STATE = { PENDING: "pending", APPROVED: "approved", DECLINED: "declined" } as const;
export const RISK_LEVEL = { LOW: "low", MEDIUM: "medium", HIGH: "high" } as const;
export const TASK_PRIORITY = { LOW: "low", NORMAL: "normal", HIGH: "high" } as const;
export const PROVIDER_AUTH_TYPE = { API_KEY: "api_key", OAUTH_PKCE: "oauth_pkce", ACCOUNT_SUBSCRIPTION: "account_subscription", CLOUD: "cloud" } as const;
export const SOCIAL_PLATFORM = { X: "x", LINKEDIN: "linkedin", YOUTUBE: "youtube", INSTAGRAM: "instagram" } as const;
export const PROVIDER_REQUEST_STATE = { PENDING: "pending", SUCCEEDED: "succeeded", FAILED: "failed" } as const;
export const FILE_SCAN_STATE = { APPROVED: "approved", BLOCKED: "blocked" } as const;
export type ValueOf<T> = T[keyof T];
export type TaskStatus = ValueOf<typeof TASK_STATUS>;
@@ -323,6 +284,10 @@ export interface ProviderRecord {
healthState: string;
lastCheckedAt: string | null;
lastError: string | null;
dataPolicy: ProviderDataPolicy;
backgroundEnabled: boolean;
monthlyRequestLimit: number;
workspaceScope: string;
createdAt: string;
}
@@ -353,6 +318,10 @@ export interface ProviderRequestRecord {
rawResponseJson: string | null;
state: ProviderRequestState;
errorMessage: string | null;
inputCharCount: number;
outputCharCount: number;
executionMode: ProviderExecutionMode;
policyDecision: string;
createdAt: string;
completedAt: string | null;
}
+1
View File
@@ -15,6 +15,7 @@ export const IPC_CHANNELS = {
saveProviderCredential: "agentcompany:save-provider-credential",
launchProviderSignIn: "agentcompany:launch-provider-sign-in",
checkProviderHealth: "agentcompany:check-provider-health",
updateProviderPolicy: "agentcompany:update-provider-policy",
openExternalUrl: "agentcompany:open-external-url",
createProviderResponse: "agentcompany:create-provider-response",
importSkillDirectory: "agentcompany:import-skill-directory",
@@ -0,0 +1,14 @@
type ValueOf<T> = T[keyof T];
export const PROVIDER_DATA_POLICY = {
STANDARD: "standard",
ZERO_DATA_RETENTION: "zero_data_retention",
} as const;
export const PROVIDER_EXECUTION_MODE = {
FOREGROUND: "foreground",
BACKGROUND: "background",
} as const;
export type ProviderDataPolicy = ValueOf<typeof PROVIDER_DATA_POLICY>;
export type ProviderExecutionMode = ValueOf<typeof PROVIDER_EXECUTION_MODE>;