mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-15 10:30:37 +09:00
Merge public-gh/master into PAP-881-document-revisions-bulid-it
This commit is contained in:
commit
41f261eaf5
194 changed files with 29520 additions and 2185 deletions
|
|
@ -119,6 +119,16 @@ export const ISSUE_STATUSES = [
|
|||
] as const;
|
||||
export type IssueStatus = (typeof ISSUE_STATUSES)[number];
|
||||
|
||||
export const INBOX_MINE_ISSUE_STATUSES = [
|
||||
"backlog",
|
||||
"todo",
|
||||
"in_progress",
|
||||
"in_review",
|
||||
"blocked",
|
||||
"done",
|
||||
] as const;
|
||||
export const INBOX_MINE_ISSUE_STATUS_FILTER = INBOX_MINE_ISSUE_STATUSES.join(",");
|
||||
|
||||
export const ISSUE_PRIORITIES = ["critical", "high", "medium", "low"] as const;
|
||||
export type IssuePriority = (typeof ISSUE_PRIORITIES)[number];
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ export {
|
|||
AGENT_ROLE_LABELS,
|
||||
AGENT_ICON_NAMES,
|
||||
ISSUE_STATUSES,
|
||||
INBOX_MINE_ISSUE_STATUSES,
|
||||
INBOX_MINE_ISSUE_STATUS_FILTER,
|
||||
ISSUE_PRIORITIES,
|
||||
ISSUE_ORIGIN_KINDS,
|
||||
GOAL_LEVELS,
|
||||
|
|
@ -186,10 +188,19 @@ export type {
|
|||
ProjectGoalRef,
|
||||
ProjectWorkspace,
|
||||
ExecutionWorkspace,
|
||||
ExecutionWorkspaceConfig,
|
||||
ExecutionWorkspaceCloseAction,
|
||||
ExecutionWorkspaceCloseActionKind,
|
||||
ExecutionWorkspaceCloseGitReadiness,
|
||||
ExecutionWorkspaceCloseLinkedIssue,
|
||||
ExecutionWorkspaceCloseReadiness,
|
||||
ExecutionWorkspaceCloseReadinessState,
|
||||
ProjectWorkspaceRuntimeConfig,
|
||||
WorkspaceRuntimeService,
|
||||
WorkspaceOperation,
|
||||
WorkspaceOperationPhase,
|
||||
WorkspaceOperationStatus,
|
||||
WorkspaceRuntimeDesiredState,
|
||||
ExecutionWorkspaceStrategyType,
|
||||
ExecutionWorkspaceMode,
|
||||
ExecutionWorkspaceProviderType,
|
||||
|
|
@ -344,6 +355,7 @@ export {
|
|||
upsertAgentInstructionsFileSchema,
|
||||
updateAgentInstructionsPathSchema,
|
||||
createAgentKeySchema,
|
||||
agentMineInboxQuerySchema,
|
||||
wakeAgentSchema,
|
||||
resetAgentSessionSchema,
|
||||
testAdapterEnvironmentSchema,
|
||||
|
|
@ -356,6 +368,7 @@ export {
|
|||
type UpsertAgentInstructionsFile,
|
||||
type UpdateAgentInstructionsPath,
|
||||
type CreateAgentKey,
|
||||
type AgentMineInboxQuery,
|
||||
type WakeAgent,
|
||||
type ResetAgentSession,
|
||||
type TestAdapterEnvironment,
|
||||
|
|
@ -384,6 +397,12 @@ export {
|
|||
issueWorkProductReviewStateSchema,
|
||||
updateExecutionWorkspaceSchema,
|
||||
executionWorkspaceStatusSchema,
|
||||
executionWorkspaceCloseActionKindSchema,
|
||||
executionWorkspaceCloseActionSchema,
|
||||
executionWorkspaceCloseGitReadinessSchema,
|
||||
executionWorkspaceCloseLinkedIssueSchema,
|
||||
executionWorkspaceCloseReadinessSchema,
|
||||
executionWorkspaceCloseReadinessStateSchema,
|
||||
issueDocumentFormatSchema,
|
||||
issueDocumentKeySchema,
|
||||
upsertIssueDocumentSchema,
|
||||
|
|
|
|||
|
|
@ -50,7 +50,16 @@ export type { AssetImage } from "./asset.js";
|
|||
export type { Project, ProjectCodebase, ProjectCodebaseOrigin, ProjectGoalRef, ProjectWorkspace } from "./project.js";
|
||||
export type {
|
||||
ExecutionWorkspace,
|
||||
ExecutionWorkspaceConfig,
|
||||
ExecutionWorkspaceCloseAction,
|
||||
ExecutionWorkspaceCloseActionKind,
|
||||
ExecutionWorkspaceCloseGitReadiness,
|
||||
ExecutionWorkspaceCloseLinkedIssue,
|
||||
ExecutionWorkspaceCloseReadiness,
|
||||
ExecutionWorkspaceCloseReadinessState,
|
||||
ProjectWorkspaceRuntimeConfig,
|
||||
WorkspaceRuntimeService,
|
||||
WorkspaceRuntimeDesiredState,
|
||||
ExecutionWorkspaceStrategyType,
|
||||
ExecutionWorkspaceMode,
|
||||
ExecutionWorkspaceProviderType,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
import type { PauseReason, ProjectStatus } from "../constants.js";
|
||||
import type { ProjectExecutionWorkspacePolicy, WorkspaceRuntimeService } from "./workspace-runtime.js";
|
||||
import type {
|
||||
ProjectExecutionWorkspacePolicy,
|
||||
ProjectWorkspaceRuntimeConfig,
|
||||
WorkspaceRuntimeService,
|
||||
} from "./workspace-runtime.js";
|
||||
|
||||
export type ProjectWorkspaceSourceType = "local_path" | "git_repo" | "remote_managed" | "non_git_path";
|
||||
export type ProjectWorkspaceVisibility = "default" | "advanced";
|
||||
|
|
@ -26,6 +30,7 @@ export interface ProjectWorkspace {
|
|||
remoteWorkspaceRef: string | null;
|
||||
sharedWorkspaceKey: string | null;
|
||||
metadata: Record<string, unknown> | null;
|
||||
runtimeConfig: ProjectWorkspaceRuntimeConfig | null;
|
||||
isPrimary: boolean;
|
||||
runtimeServices?: WorkspaceRuntimeService[];
|
||||
createdAt: Date;
|
||||
|
|
|
|||
|
|
@ -31,6 +31,22 @@ export type ExecutionWorkspaceStatus =
|
|||
| "archived"
|
||||
| "cleanup_failed";
|
||||
|
||||
export type ExecutionWorkspaceCloseReadinessState =
|
||||
| "ready"
|
||||
| "ready_with_warnings"
|
||||
| "blocked";
|
||||
|
||||
export type ExecutionWorkspaceCloseActionKind =
|
||||
| "archive_record"
|
||||
| "stop_runtime_services"
|
||||
| "cleanup_command"
|
||||
| "teardown_command"
|
||||
| "git_worktree_remove"
|
||||
| "git_branch_delete"
|
||||
| "remove_local_directory";
|
||||
|
||||
export type WorkspaceRuntimeDesiredState = "running" | "stopped";
|
||||
|
||||
export interface ExecutionWorkspaceStrategy {
|
||||
type: ExecutionWorkspaceStrategyType;
|
||||
baseRef?: string | null;
|
||||
|
|
@ -40,6 +56,63 @@ export interface ExecutionWorkspaceStrategy {
|
|||
teardownCommand?: string | null;
|
||||
}
|
||||
|
||||
export interface ExecutionWorkspaceConfig {
|
||||
provisionCommand: string | null;
|
||||
teardownCommand: string | null;
|
||||
cleanupCommand: string | null;
|
||||
workspaceRuntime: Record<string, unknown> | null;
|
||||
desiredState: WorkspaceRuntimeDesiredState | null;
|
||||
}
|
||||
|
||||
export interface ProjectWorkspaceRuntimeConfig {
|
||||
workspaceRuntime: Record<string, unknown> | null;
|
||||
desiredState: WorkspaceRuntimeDesiredState | null;
|
||||
}
|
||||
|
||||
export interface ExecutionWorkspaceCloseAction {
|
||||
kind: ExecutionWorkspaceCloseActionKind;
|
||||
label: string;
|
||||
description: string;
|
||||
command: string | null;
|
||||
}
|
||||
|
||||
export interface ExecutionWorkspaceCloseLinkedIssue {
|
||||
id: string;
|
||||
identifier: string | null;
|
||||
title: string;
|
||||
status: string;
|
||||
isTerminal: boolean;
|
||||
}
|
||||
|
||||
export interface ExecutionWorkspaceCloseGitReadiness {
|
||||
repoRoot: string | null;
|
||||
workspacePath: string | null;
|
||||
branchName: string | null;
|
||||
baseRef: string | null;
|
||||
hasDirtyTrackedFiles: boolean;
|
||||
hasUntrackedFiles: boolean;
|
||||
dirtyEntryCount: number;
|
||||
untrackedEntryCount: number;
|
||||
aheadCount: number | null;
|
||||
behindCount: number | null;
|
||||
isMergedIntoBase: boolean | null;
|
||||
createdByRuntime: boolean;
|
||||
}
|
||||
|
||||
export interface ExecutionWorkspaceCloseReadiness {
|
||||
workspaceId: string;
|
||||
state: ExecutionWorkspaceCloseReadinessState;
|
||||
blockingReasons: string[];
|
||||
warnings: string[];
|
||||
linkedIssues: ExecutionWorkspaceCloseLinkedIssue[];
|
||||
plannedActions: ExecutionWorkspaceCloseAction[];
|
||||
isDestructiveCloseAllowed: boolean;
|
||||
isSharedWorkspace: boolean;
|
||||
isProjectPrimaryWorkspace: boolean;
|
||||
git: ExecutionWorkspaceCloseGitReadiness | null;
|
||||
runtimeServices: WorkspaceRuntimeService[];
|
||||
}
|
||||
|
||||
export interface ProjectExecutionWorkspacePolicy {
|
||||
enabled: boolean;
|
||||
defaultMode?: ProjectExecutionWorkspaceDefaultMode;
|
||||
|
|
@ -81,7 +154,9 @@ export interface ExecutionWorkspace {
|
|||
closedAt: Date | null;
|
||||
cleanupEligibleAt: Date | null;
|
||||
cleanupReason: string | null;
|
||||
config: ExecutionWorkspaceConfig | null;
|
||||
metadata: Record<string, unknown> | null;
|
||||
runtimeServices?: WorkspaceRuntimeService[];
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import {
|
|||
AGENT_ICON_NAMES,
|
||||
AGENT_ROLES,
|
||||
AGENT_STATUSES,
|
||||
INBOX_MINE_ISSUE_STATUS_FILTER,
|
||||
} from "../constants.js";
|
||||
import { envConfigSchema } from "./secret.js";
|
||||
|
||||
|
|
@ -93,6 +94,13 @@ export const createAgentKeySchema = z.object({
|
|||
|
||||
export type CreateAgentKey = z.infer<typeof createAgentKeySchema>;
|
||||
|
||||
export const agentMineInboxQuerySchema = z.object({
|
||||
userId: z.string().trim().min(1),
|
||||
status: z.string().trim().min(1).optional().default(INBOX_MINE_ISSUE_STATUS_FILTER),
|
||||
});
|
||||
|
||||
export type AgentMineInboxQuery = z.infer<typeof agentMineInboxQuerySchema>;
|
||||
|
||||
export const wakeAgentSchema = z.object({
|
||||
source: z.enum(["timer", "assignment", "on_demand", "automation"]).optional().default("on_demand"),
|
||||
triggerDetail: z.enum(["manual", "ping", "callback", "system"]).optional(),
|
||||
|
|
|
|||
|
|
@ -8,10 +8,115 @@ export const executionWorkspaceStatusSchema = z.enum([
|
|||
"cleanup_failed",
|
||||
]);
|
||||
|
||||
export const executionWorkspaceConfigSchema = z.object({
|
||||
provisionCommand: z.string().optional().nullable(),
|
||||
teardownCommand: z.string().optional().nullable(),
|
||||
cleanupCommand: z.string().optional().nullable(),
|
||||
workspaceRuntime: z.record(z.unknown()).optional().nullable(),
|
||||
desiredState: z.enum(["running", "stopped"]).optional().nullable(),
|
||||
}).strict();
|
||||
|
||||
export const executionWorkspaceCloseReadinessStateSchema = z.enum([
|
||||
"ready",
|
||||
"ready_with_warnings",
|
||||
"blocked",
|
||||
]);
|
||||
|
||||
export const executionWorkspaceCloseActionKindSchema = z.enum([
|
||||
"archive_record",
|
||||
"stop_runtime_services",
|
||||
"cleanup_command",
|
||||
"teardown_command",
|
||||
"git_worktree_remove",
|
||||
"git_branch_delete",
|
||||
"remove_local_directory",
|
||||
]);
|
||||
|
||||
export const executionWorkspaceCloseActionSchema = z.object({
|
||||
kind: executionWorkspaceCloseActionKindSchema,
|
||||
label: z.string(),
|
||||
description: z.string(),
|
||||
command: z.string().nullable(),
|
||||
}).strict();
|
||||
|
||||
export const executionWorkspaceCloseLinkedIssueSchema = z.object({
|
||||
id: z.string().uuid(),
|
||||
identifier: z.string().nullable(),
|
||||
title: z.string(),
|
||||
status: z.string(),
|
||||
isTerminal: z.boolean(),
|
||||
}).strict();
|
||||
|
||||
export const executionWorkspaceCloseGitReadinessSchema = z.object({
|
||||
repoRoot: z.string().nullable(),
|
||||
workspacePath: z.string().nullable(),
|
||||
branchName: z.string().nullable(),
|
||||
baseRef: z.string().nullable(),
|
||||
hasDirtyTrackedFiles: z.boolean(),
|
||||
hasUntrackedFiles: z.boolean(),
|
||||
dirtyEntryCount: z.number().int().nonnegative(),
|
||||
untrackedEntryCount: z.number().int().nonnegative(),
|
||||
aheadCount: z.number().int().nonnegative().nullable(),
|
||||
behindCount: z.number().int().nonnegative().nullable(),
|
||||
isMergedIntoBase: z.boolean().nullable(),
|
||||
createdByRuntime: z.boolean(),
|
||||
}).strict();
|
||||
|
||||
export const workspaceRuntimeServiceSchema = z.object({
|
||||
id: z.string(),
|
||||
companyId: z.string().uuid(),
|
||||
projectId: z.string().uuid().nullable(),
|
||||
projectWorkspaceId: z.string().uuid().nullable(),
|
||||
executionWorkspaceId: z.string().uuid().nullable(),
|
||||
issueId: z.string().uuid().nullable(),
|
||||
scopeType: z.enum(["project_workspace", "execution_workspace", "run", "agent"]),
|
||||
scopeId: z.string().nullable(),
|
||||
serviceName: z.string(),
|
||||
status: z.enum(["starting", "running", "stopped", "failed"]),
|
||||
lifecycle: z.enum(["shared", "ephemeral"]),
|
||||
reuseKey: z.string().nullable(),
|
||||
command: z.string().nullable(),
|
||||
cwd: z.string().nullable(),
|
||||
port: z.number().int().nullable(),
|
||||
url: z.string().nullable(),
|
||||
provider: z.enum(["local_process", "adapter_managed"]),
|
||||
providerRef: z.string().nullable(),
|
||||
ownerAgentId: z.string().uuid().nullable(),
|
||||
startedByRunId: z.string().uuid().nullable(),
|
||||
lastUsedAt: z.coerce.date(),
|
||||
startedAt: z.coerce.date(),
|
||||
stoppedAt: z.coerce.date().nullable(),
|
||||
stopPolicy: z.record(z.unknown()).nullable(),
|
||||
healthStatus: z.enum(["unknown", "healthy", "unhealthy"]),
|
||||
createdAt: z.coerce.date(),
|
||||
updatedAt: z.coerce.date(),
|
||||
}).strict();
|
||||
|
||||
export const executionWorkspaceCloseReadinessSchema = z.object({
|
||||
workspaceId: z.string().uuid(),
|
||||
state: executionWorkspaceCloseReadinessStateSchema,
|
||||
blockingReasons: z.array(z.string()),
|
||||
warnings: z.array(z.string()),
|
||||
linkedIssues: z.array(executionWorkspaceCloseLinkedIssueSchema),
|
||||
plannedActions: z.array(executionWorkspaceCloseActionSchema),
|
||||
isDestructiveCloseAllowed: z.boolean(),
|
||||
isSharedWorkspace: z.boolean(),
|
||||
isProjectPrimaryWorkspace: z.boolean(),
|
||||
git: executionWorkspaceCloseGitReadinessSchema.nullable(),
|
||||
runtimeServices: z.array(workspaceRuntimeServiceSchema),
|
||||
}).strict();
|
||||
|
||||
export const updateExecutionWorkspaceSchema = z.object({
|
||||
name: z.string().min(1).optional(),
|
||||
cwd: z.string().optional().nullable(),
|
||||
repoUrl: z.string().optional().nullable(),
|
||||
baseRef: z.string().optional().nullable(),
|
||||
branchName: z.string().optional().nullable(),
|
||||
providerRef: z.string().optional().nullable(),
|
||||
status: executionWorkspaceStatusSchema.optional(),
|
||||
cleanupEligibleAt: z.string().datetime().optional().nullable(),
|
||||
cleanupReason: z.string().optional().nullable(),
|
||||
config: executionWorkspaceConfigSchema.optional().nullable(),
|
||||
metadata: z.record(z.unknown()).optional().nullable(),
|
||||
}).strict();
|
||||
|
||||
|
|
|
|||
|
|
@ -85,6 +85,7 @@ export {
|
|||
upsertAgentInstructionsFileSchema,
|
||||
updateAgentInstructionsPathSchema,
|
||||
createAgentKeySchema,
|
||||
agentMineInboxQuerySchema,
|
||||
wakeAgentSchema,
|
||||
resetAgentSessionSchema,
|
||||
testAdapterEnvironmentSchema,
|
||||
|
|
@ -97,6 +98,7 @@ export {
|
|||
type UpsertAgentInstructionsFile,
|
||||
type UpdateAgentInstructionsPath,
|
||||
type CreateAgentKey,
|
||||
type AgentMineInboxQuery,
|
||||
type WakeAgent,
|
||||
type ResetAgentSession,
|
||||
type TestAdapterEnvironment,
|
||||
|
|
@ -109,6 +111,7 @@ export {
|
|||
createProjectWorkspaceSchema,
|
||||
updateProjectWorkspaceSchema,
|
||||
projectExecutionWorkspacePolicySchema,
|
||||
projectWorkspaceRuntimeConfigSchema,
|
||||
type CreateProject,
|
||||
type UpdateProject,
|
||||
type CreateProjectWorkspace,
|
||||
|
|
@ -153,8 +156,15 @@ export {
|
|||
} from "./work-product.js";
|
||||
|
||||
export {
|
||||
executionWorkspaceConfigSchema,
|
||||
updateExecutionWorkspaceSchema,
|
||||
executionWorkspaceStatusSchema,
|
||||
executionWorkspaceCloseActionKindSchema,
|
||||
executionWorkspaceCloseActionSchema,
|
||||
executionWorkspaceCloseGitReadinessSchema,
|
||||
executionWorkspaceCloseLinkedIssueSchema,
|
||||
executionWorkspaceCloseReadinessSchema,
|
||||
executionWorkspaceCloseReadinessStateSchema,
|
||||
type UpdateExecutionWorkspace,
|
||||
} from "./execution-workspace.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ export const createIssueSchema = z.object({
|
|||
projectWorkspaceId: z.string().uuid().optional().nullable(),
|
||||
goalId: z.string().uuid().optional().nullable(),
|
||||
parentId: z.string().uuid().optional().nullable(),
|
||||
inheritExecutionWorkspaceFromIssueId: z.string().uuid().optional().nullable(),
|
||||
title: z.string().min(1),
|
||||
description: z.string().optional().nullable(),
|
||||
status: z.enum(ISSUE_STATUSES).optional().default("backlog"),
|
||||
|
|
@ -66,6 +67,7 @@ export type CreateIssueLabel = z.infer<typeof createIssueLabelSchema>;
|
|||
export const updateIssueSchema = createIssueSchema.partial().extend({
|
||||
comment: z.string().min(1).optional(),
|
||||
reopen: z.boolean().optional(),
|
||||
interrupt: z.boolean().optional(),
|
||||
hiddenAt: z.string().datetime().nullable().optional(),
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,11 @@ export const projectExecutionWorkspacePolicySchema = z
|
|||
})
|
||||
.strict();
|
||||
|
||||
export const projectWorkspaceRuntimeConfigSchema = z.object({
|
||||
workspaceRuntime: z.record(z.unknown()).optional().nullable(),
|
||||
desiredState: z.enum(["running", "stopped"]).optional().nullable(),
|
||||
}).strict();
|
||||
|
||||
const projectWorkspaceSourceTypeSchema = z.enum(["local_path", "git_repo", "remote_managed", "non_git_path"]);
|
||||
const projectWorkspaceVisibilitySchema = z.enum(["default", "advanced"]);
|
||||
|
||||
|
|
@ -44,6 +49,7 @@ const projectWorkspaceFields = {
|
|||
remoteWorkspaceRef: z.string().optional().nullable(),
|
||||
sharedWorkspaceKey: z.string().optional().nullable(),
|
||||
metadata: z.record(z.unknown()).optional().nullable(),
|
||||
runtimeConfig: projectWorkspaceRuntimeConfigSchema.optional().nullable(),
|
||||
};
|
||||
|
||||
function validateProjectWorkspace(value: Record<string, unknown>, ctx: z.RefinementCtx) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue