update
This commit is contained in:
1 parent
806200b3d1
commit
5547c29491
216 files changed
+5043
-3352
No files matched your search
@@ -98,15 +98,8 @@ export const IPC_CHANNELS = {
|
||||
recoveryRetry: "recovery:retry",
|
||||
recoveryDismiss: "recovery:dismiss",
|
||||
recoveryFail: "recovery:fail",
|
||||
// Agent config revisions
|
||||
listConfigRevisions: "agent-company:list-config-revisions",
|
||||
getConfigRevision: "agent-company:get-config-revision",
|
||||
rollbackConfigRevision: "agent-company:rollback-config-revision",
|
||||
// Run events
|
||||
listRunEvents: "agent-company:list-run-events",
|
||||
// Agent permissions
|
||||
getAgentPermissions: "agent-company:get-agent-permissions",
|
||||
setAgentPermission: "agent-company:set-agent-permission",
|
||||
// Heartbeat policy
|
||||
getHeartbeatPolicy: "agent-company:get-heartbeat-policy",
|
||||
setHeartbeatPolicy: "agent-company:set-heartbeat-policy",
|
||||
|
||||
@@ -18,8 +18,6 @@ import type { WindowApi } from "./desktop-api/window";
|
||||
export type {
|
||||
DesktopResult,
|
||||
SaveTaskResult,
|
||||
ConfigRevisionSummary,
|
||||
ConfigRevisionDetail,
|
||||
RunEventRecord,
|
||||
HeartbeatPolicy,
|
||||
} from "./desktop-api/common";
|
||||
|
||||
@@ -13,13 +13,8 @@ export type AgentsApi = {
|
||||
getAgentMetrics: (input: z.infer<typeof metricsQuerySchema>) => Promise<DesktopResult<AgentMetrics>>;
|
||||
setHeartbeat: (input: z.infer<typeof heartbeatSettingsSchema>) => Promise<DesktopResult<boolean>>;
|
||||
triggerHeartbeat: (input: z.infer<typeof triggerHeartbeatSchema>) => Promise<DesktopResult<string>>;
|
||||
getAgentPermissions: (agentId: string) => Promise<DesktopResult<Record<string, boolean>>>;
|
||||
setAgentPermission: (companyId: string, agentId: string, permissionKey: string, enabled: boolean) => Promise<DesktopResult<boolean>>;
|
||||
getHeartbeatPolicy: (agentId: string, companyId: string) => Promise<DesktopResult<HeartbeatPolicy>>;
|
||||
setHeartbeatPolicy: (companyId: string, agentId: string, policy: Record<string, unknown>) => Promise<DesktopResult<boolean>>;
|
||||
setHeartbeatPolicy: (companyId: string, agentId: string, policy: Partial<HeartbeatPolicy>) => Promise<DesktopResult<boolean>>;
|
||||
getRuntimeState: (agentId: string, companyId: string) => Promise<DesktopResult<Record<string, unknown>>>;
|
||||
setRuntimeState: (companyId: string, agentId: string, state: Record<string, unknown>) => Promise<DesktopResult<boolean>>;
|
||||
listConfigRevisions: (companyId: string, agentId: string) => Promise<DesktopResult<import("./common").ConfigRevisionSummary[]>>;
|
||||
getConfigRevision: (companyId: string, revisionId: string) => Promise<DesktopResult<import("./common").ConfigRevisionDetail>>;
|
||||
rollbackConfigRevision: (companyId: string, agentId: string, revisionId: string) => Promise<DesktopResult<{ revisionId: string }>>;
|
||||
};
|
||||
@@ -7,23 +7,6 @@ export interface SaveTaskResult {
|
||||
capabilityWarning?: string;
|
||||
}
|
||||
|
||||
export interface ConfigRevisionSummary {
|
||||
id: string;
|
||||
agentId: string;
|
||||
revisionNumber: number;
|
||||
changedKeys: string[];
|
||||
source: string;
|
||||
rolledBackFromRevisionId: string | null;
|
||||
createdByAgentId: string | null;
|
||||
createdByUserId: string | null;
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
export interface ConfigRevisionDetail extends ConfigRevisionSummary {
|
||||
configBefore: Record<string, unknown>;
|
||||
configAfter: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface RunEventRecord {
|
||||
id: number;
|
||||
runId: string;
|
||||
|
||||
@@ -12,6 +12,6 @@ export type RunsApi = {
|
||||
getRun: (input: z.infer<typeof entityGetterSchema>) => Promise<DesktopResult<RunRecord>>;
|
||||
listRunEvents: (companyId: string, runId: string, opts?: { offset?: number; limit?: number }) => Promise<DesktopResult<RunEventRecord[]>>;
|
||||
recoveryRetry: (taskId: string, agentId: string, companyId: string) => Promise<DesktopResult<null>>;
|
||||
recoveryDismiss: (taskId: string) => Promise<DesktopResult<null>>;
|
||||
recoveryFail: (taskId: string) => Promise<DesktopResult<null>>;
|
||||
recoveryDismiss: (taskId: string, companyId: string) => Promise<DesktopResult<null>>;
|
||||
recoveryFail: (taskId: string, companyId: string) => Promise<DesktopResult<null>>;
|
||||
};
|
||||
@@ -15,3 +15,17 @@ export const DEPARTMENT_IDS = z.enum([
|
||||
export const MESSAGE_CHANNELS = z.enum([
|
||||
"direct", "department", "company", "project", "incident",
|
||||
]);
|
||||
|
||||
/**
|
||||
* Canonical automation trigger enum shared by `automationRuleInputSchema` and
|
||||
* `workflowInputSchema`. Single source of truth: the TS `AutomationTrigger`
|
||||
* alias in `types/enums.ts` derives from this enum.
|
||||
*/
|
||||
export const automationTriggerEnum = z.enum([
|
||||
"task_status_changed", "task_created", "task_blocked", "task_reassigned",
|
||||
"run_completed", "run_failed", "approval_created", "approval_resolved",
|
||||
"budget_threshold", "agent_idle", "comment_posted", "document_created",
|
||||
"schedule", "hire_approved", "sprint_started", "sprint_ended",
|
||||
]);
|
||||
|
||||
export type AutomationTrigger = z.infer<typeof automationTriggerEnum>;
|
||||
@@ -1,12 +0,0 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export const getAgentPermissionsSchema = z.object({
|
||||
agentId: z.string().min(1),
|
||||
});
|
||||
|
||||
export const setAgentPermissionSchema = z.object({
|
||||
companyId: z.string().min(1),
|
||||
agentId: z.string().min(1),
|
||||
permissionKey: z.string().min(1),
|
||||
enabled: z.boolean(),
|
||||
});
|
||||
@@ -1,17 +1,12 @@
|
||||
import { z } from "zod";
|
||||
import { DEPARTMENT_IDS } from "./helpers";
|
||||
import { DEPARTMENT_IDS, automationTriggerEnum } from "./helpers";
|
||||
|
||||
export const automationRuleInputSchema = z.object({
|
||||
id: z.preprocess((v) => (v === "" ? null : v), z.string().uuid().nullable().optional()),
|
||||
companyId: z.string().uuid(),
|
||||
name: z.string().min(2).max(120),
|
||||
description: z.string().max(500).default(""),
|
||||
trigger: z.enum([
|
||||
"task_status_changed", "task_created", "task_blocked", "task_reassigned",
|
||||
"run_completed", "run_failed", "approval_created", "approval_resolved",
|
||||
"budget_threshold", "agent_idle", "comment_posted", "document_created",
|
||||
"schedule", "hire_approved", "sprint_started", "sprint_ended",
|
||||
]),
|
||||
trigger: automationTriggerEnum,
|
||||
conditionsJson: z.string().default("{}"),
|
||||
action: z.enum([
|
||||
"assign_task", "create_task", "notify_agent", "send_message",
|
||||
|
||||
@@ -11,6 +11,12 @@ export const companyInputSchema = z.object({
|
||||
executionMode: z.enum(["ai_ceo", "ai_cofounder"]).default("ai_ceo"),
|
||||
});
|
||||
|
||||
/**
|
||||
* Pure pi-mono connector catalog ids. Single source of truth: this zod enum.
|
||||
* The TS `ConnectorId` alias (`shared/types/enums.ts`) and the catalog
|
||||
* (`shared/connector-catalog.ts`) both derive from it. Adding a connector
|
||||
* requires editing this list only.
|
||||
*/
|
||||
export const connectorIdEnum = z.enum([
|
||||
// OAuth (5)
|
||||
"claude-pro",
|
||||
@@ -43,6 +49,8 @@ export const connectorIdEnum = z.enum([
|
||||
"google-vertex",
|
||||
]);
|
||||
|
||||
export type ConnectorId = z.infer<typeof connectorIdEnum>;
|
||||
|
||||
export const connectorInputSchema = z.object({
|
||||
id: connectorIdEnum,
|
||||
command: z.string().min(1),
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export const listConfigRevisionsSchema = z.object({
|
||||
companyId: z.string().uuid(),
|
||||
agentId: z.string().uuid(),
|
||||
});
|
||||
|
||||
export const getConfigRevisionSchema = z.object({
|
||||
companyId: z.string().uuid(),
|
||||
revisionId: z.string().uuid(),
|
||||
});
|
||||
|
||||
export const rollbackConfigRevisionSchema = z.object({
|
||||
companyId: z.string().uuid(),
|
||||
agentId: z.string().uuid(),
|
||||
revisionId: z.string().uuid(),
|
||||
});
|
||||
@@ -1,4 +1,5 @@
|
||||
import { z } from "zod";
|
||||
import { automationTriggerEnum } from "./helpers";
|
||||
|
||||
export const startRunSchema = z.object({
|
||||
companyId: z.string().uuid(),
|
||||
@@ -45,12 +46,7 @@ export const workflowInputSchema = z.object({
|
||||
name: z.string().min(2).max(120),
|
||||
description: z.string().max(500).default(""),
|
||||
stepsJson: z.string().default("[]"),
|
||||
triggerType: z.enum([
|
||||
"task_status_changed", "task_created", "task_blocked", "task_reassigned",
|
||||
"run_completed", "run_failed", "approval_created", "approval_resolved",
|
||||
"budget_threshold", "agent_idle", "comment_posted", "document_created",
|
||||
"schedule", "hire_approved", "sprint_started", "sprint_ended",
|
||||
]),
|
||||
triggerType: automationTriggerEnum,
|
||||
triggerConfigJson: z.string().default("{}"),
|
||||
status: z.enum(["draft", "active", "paused", "completed", "failed"]).default("draft"),
|
||||
});
|
||||
|
||||
@@ -4,9 +4,7 @@ export * from "./schemas-badges";
|
||||
export * from "./schemas-automation";
|
||||
export * from "./schemas-budget";
|
||||
export * from "./schemas-wakeup";
|
||||
export * from "./schemas-config-revisions";
|
||||
export * from "./schemas-run-events";
|
||||
export * from "./schemas-agent-permissions";
|
||||
export * from "./schemas-heartbeat";
|
||||
export * from "./schemas-runtime-state";
|
||||
export * from "./schemas-threads";
|
||||
|
||||
@@ -20,41 +20,12 @@ export const oauthManualCodeResponseSchema = z.object({
|
||||
code: z.string().min(1),
|
||||
});
|
||||
|
||||
export const oauthAuthInfoSchema = z.object({
|
||||
connectorId: z.string(),
|
||||
url: z.string().url(),
|
||||
instructions: z.string().optional(),
|
||||
});
|
||||
|
||||
export const oauthProgressSchema = z.object({
|
||||
connectorId: z.string(),
|
||||
message: z.string(),
|
||||
});
|
||||
|
||||
export const oauthStatusSchema = z.object({
|
||||
connectorId: z.string(),
|
||||
status: z.enum(["active", "cancelled", "error", "in_progress"]),
|
||||
errorMessage: z.string().optional(),
|
||||
});
|
||||
|
||||
export const oauthPromptRequestSchema = z.object({
|
||||
connectorId: z.string(),
|
||||
requestId: z.string(),
|
||||
message: z.string(),
|
||||
placeholder: z.string().optional(),
|
||||
allowEmpty: z.boolean().optional(),
|
||||
});
|
||||
|
||||
export const oauthManualCodeRequestSchema = z.object({
|
||||
connectorId: z.string(),
|
||||
requestId: z.string(),
|
||||
});
|
||||
// Event shapes (OAuthStatusEvent, OAuthAuthUrlEvent, OAuthProgressEvent,
|
||||
// OAuthPromptRequestEvent, OAuthManualCodeRequestEvent) live in
|
||||
// `shared/types/events.ts` — that's the runtime shape emitted by
|
||||
// `oauth-login-service` and consumed by the renderer via `DesktopEvent`.
|
||||
// This module only owns the renderer→main request schemas.
|
||||
|
||||
export type OAuthStartInput = z.infer<typeof oauthStartInputSchema>;
|
||||
export type OAuthAuthInfoEvent = z.infer<typeof oauthAuthInfoSchema>;
|
||||
export type OAuthProgressEvent = z.infer<typeof oauthProgressSchema>;
|
||||
export type OAuthStatusEvent = z.infer<typeof oauthStatusSchema>;
|
||||
export type OAuthPromptRequestEvent = z.infer<typeof oauthPromptRequestSchema>;
|
||||
export type OAuthManualCodeRequestEvent = z.infer<typeof oauthManualCodeRequestSchema>;
|
||||
export type OAuthPromptResponseInput = z.infer<typeof oauthPromptResponseSchema>;
|
||||
export type OAuthManualCodeResponseInput = z.infer<typeof oauthManualCodeResponseSchema>;
|
||||
Reference in new issue
Block a user