update
This commit is contained in:
1 parent
806200b3d1
commit
5547c29491
216 files changed
+5043
-3352
No files matched your search
@@ -13,8 +13,8 @@ export type PiOAuthProviderId =
|
||||
| "anthropic"
|
||||
| "openai-codex"
|
||||
| "github-copilot"
|
||||
| "gemini-cli"
|
||||
| "antigravity";
|
||||
| "google-gemini-cli"
|
||||
| "google-antigravity";
|
||||
|
||||
export type ConnectorAuthKind = "oauth" | "api_key" | "aws" | "azure" | "gcp_adc";
|
||||
|
||||
@@ -78,7 +78,7 @@ const OAUTH_ENTRIES: ConnectorCatalogEntry[] = [
|
||||
label: "Google Gemini CLI",
|
||||
description: "Google Gemini models via Cloud Code Assist OAuth. Free tier works with any Google account.",
|
||||
defaultModel: "gemini-2.5-pro",
|
||||
auth: { type: "oauth", oauthId: "gemini-cli" },
|
||||
auth: { type: "oauth", oauthId: "google-gemini-cli" },
|
||||
notes: "For paid Cloud Code Assist, set GOOGLE_CLOUD_PROJECT.",
|
||||
},
|
||||
{
|
||||
@@ -87,7 +87,7 @@ const OAUTH_ENTRIES: ConnectorCatalogEntry[] = [
|
||||
label: "Google Antigravity",
|
||||
description: "Google Antigravity sandbox with Gemini 3, Claude, and GPT-OSS models.",
|
||||
defaultModel: "claude-sonnet-4-5",
|
||||
auth: { type: "oauth", oauthId: "antigravity" },
|
||||
auth: { type: "oauth", oauthId: "google-antigravity" },
|
||||
notes: "Free with any Google account.",
|
||||
},
|
||||
];
|
||||
|
||||
@@ -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>;
|
||||
+35
-67
@@ -1,3 +1,5 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export type SectionId =
|
||||
| "overview"
|
||||
| "inbox"
|
||||
@@ -29,37 +31,12 @@ export type SectionId =
|
||||
* Pure pi-mono connector catalog ids. Five OAuth, eighteen API-key, three
|
||||
* cloud — see `src/main/connector-definitions.ts`. The id is what the UI, the
|
||||
* database `connectors` table, and the worker resolver all key on.
|
||||
*
|
||||
* Single source of truth: derived from the `connectorIdEnum` zod enum in
|
||||
* `contracts/schemas-company.ts`. Adding a connector requires editing the zod
|
||||
* enum only; the TS union updates automatically.
|
||||
*/
|
||||
export type ConnectorId =
|
||||
// OAuth (5)
|
||||
| "claude-pro"
|
||||
| "openai-codex"
|
||||
| "github-copilot"
|
||||
| "gemini-cli"
|
||||
| "antigravity"
|
||||
// API key (18)
|
||||
| "anthropic"
|
||||
| "openai"
|
||||
| "google"
|
||||
| "mistral"
|
||||
| "groq"
|
||||
| "cerebras"
|
||||
| "xai"
|
||||
| "openrouter"
|
||||
| "vercel-ai-gateway"
|
||||
| "zai"
|
||||
| "opencode"
|
||||
| "opencode-go"
|
||||
| "huggingface"
|
||||
| "kimi-coding"
|
||||
| "minimax"
|
||||
| "minimax-cn"
|
||||
| "fireworks"
|
||||
| "fireworks-firepass"
|
||||
// Cloud (3)
|
||||
| "amazon-bedrock"
|
||||
| "azure-openai"
|
||||
| "google-vertex";
|
||||
export type { ConnectorId } from "../contracts/schemas-company";
|
||||
|
||||
export type ConnectorStatus =
|
||||
| "not_installed"
|
||||
@@ -107,26 +84,29 @@ export type GoalStatus = "planned" | "active" | "achieved" | "cancelled";
|
||||
export type ProjectStatus = "backlog" | "planned" | "in_progress" | "completed" | "cancelled";
|
||||
export type TaskStatus = "backlog" | "todo" | "in_progress" | "in_review" | "done" | "blocked" | "cancelled";
|
||||
export type ApprovalState = "pending" | "approved" | "rejected" | "revision_requested";
|
||||
export type ApprovalType =
|
||||
| "hire_agent"
|
||||
| "approve_ceo_strategy"
|
||||
| "dangerous_command"
|
||||
| "secret_access"
|
||||
| "budget_request"
|
||||
| "promotion"
|
||||
| "termination"
|
||||
| "vendor_approval"
|
||||
| "document_review"
|
||||
| "production_deploy"
|
||||
| "incident_escalation"
|
||||
| "social_post"
|
||||
| "deliverable_review"
|
||||
| "budget_override"
|
||||
| "plan_review"
|
||||
| "scope_review"
|
||||
| "draft_review"
|
||||
| "strategy_review"
|
||||
| "exception_review";
|
||||
export const approvalTypeEnum = z.enum([
|
||||
"hire_agent",
|
||||
"approve_ceo_strategy",
|
||||
"dangerous_command",
|
||||
"secret_access",
|
||||
"budget_request",
|
||||
"promotion",
|
||||
"termination",
|
||||
"vendor_approval",
|
||||
"document_review",
|
||||
"production_deploy",
|
||||
"incident_escalation",
|
||||
"social_post",
|
||||
"deliverable_review",
|
||||
"budget_override",
|
||||
"plan_review",
|
||||
"scope_review",
|
||||
"draft_review",
|
||||
"strategy_review",
|
||||
"exception_review",
|
||||
]);
|
||||
|
||||
export type ApprovalType = z.infer<typeof approvalTypeEnum>;
|
||||
export type RunStatus =
|
||||
| "queued"
|
||||
| "running"
|
||||
@@ -229,23 +209,11 @@ export type KnowledgeCategory =
|
||||
|
||||
export type SprintStatus = "planning" | "active" | "review" | "completed" | "cancelled";
|
||||
|
||||
export type AutomationTrigger =
|
||||
| "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";
|
||||
/**
|
||||
* Single source of truth: `automationTriggerEnum` in `contracts/helpers.ts`.
|
||||
* Shared by `automationRuleInputSchema` and `workflowInputSchema`.
|
||||
*/
|
||||
export type { AutomationTrigger } from "../contracts/helpers";
|
||||
|
||||
export type AutomationAction =
|
||||
| "assign_task"
|
||||
|
||||
@@ -98,7 +98,7 @@ export interface RecoveryNeededEvent {
|
||||
type: "recovery-needed";
|
||||
interruptedRuns: Array<{
|
||||
runId: string; taskId: string; taskTitle: string; agentId: string;
|
||||
agentName: string; connectorId: string; interruptedAt: string;
|
||||
agentName: string; companyId: string; connectorId: string; interruptedAt: string;
|
||||
}>;
|
||||
}
|
||||
|
||||
|
||||
@@ -74,8 +74,14 @@ export interface AgentRecord {
|
||||
name: string;
|
||||
role: string;
|
||||
title: string;
|
||||
/** Seniority enum used for leadership detection; free-text `role` remains UI-editable. */
|
||||
roleLevel: AgentRoleLevel;
|
||||
/**
|
||||
* Seniority enum used for leadership detection; free-text `role` remains
|
||||
* UI-editable. Optional on the read model because the DB column has a
|
||||
* `DEFAULT 'ic'` and no write path (agent-form / saveAgent / hireRequest)
|
||||
* currently accepts it. Consumers use `agentIsLeader()` which handles the
|
||||
* null/undefined case via keyword fallback.
|
||||
*/
|
||||
roleLevel?: AgentRoleLevel | null;
|
||||
department: DepartmentId | null;
|
||||
status: AgentStatus;
|
||||
reportsTo: string | null;
|
||||
@@ -136,6 +142,7 @@ export interface TaskRecord {
|
||||
costUsd: number;
|
||||
taskType: string | null;
|
||||
requiresUserReview: boolean;
|
||||
isHeartbeat: boolean;
|
||||
startedAt: string | null;
|
||||
completedAt: string | null;
|
||||
cancelledAt: string | null;
|
||||
|
||||
Reference in new issue
Block a user