mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-14 01:50:39 +09:00
[codex] Add local Cloud Upstream sync (#6548)
## Thinking Path > - Paperclip is the control plane for AI-agent companies. > - Operators need a path to move local company state toward Paperclip Cloud without losing local-first control. > - The Cloud Upstream flow needs API, persistence, CLI, and board UI surfaces that agree on the same manifest/run model. > - The existing branch had the feature work plus UX and error-handling follow-ups. > - This pull request packages the remaining Cloud Upstream sync work into one standalone branch. > - The benefit is an inspectable local-to-cloud sync workflow with preview, conflicts, activation, and captured UX review states. ## What Changed - Added Cloud Upstream shared types, server routes/services, and persisted run schema/migration. - Added Paperclip Cloud CLI sync helpers and local connection storage. - Added the Cloud Upstream board UI, settings entry points, query keys, and UX lab page. - Added preview/activation checklist behavior, redirect handling, manifest-only preview support, friendly errors, in-flight hints, and entity count summaries. ## Verification - `pnpm --filter @paperclipai/plugin-sdk build` - `NODE_ENV=test pnpm exec vitest run cli/src/__tests__/cloud.test.ts server/src/__tests__/instance-settings-routes.test.ts server/src/__tests__/instance-settings-service.test.ts ui/src/pages/CloudUpstream.test.tsx ui/src/components/CompanySettingsSidebar.test.tsx` - `NODE_ENV=test pnpm exec vitest run server/src/__tests__/cloud-upstreams.test.ts` Worktree setup note: the isolated worktree install skipped native sqlite build scripts, so I copied the already-built local sqlite binding from the main checkout before running `server/src/__tests__/cloud-upstreams.test.ts`. The test then passed. ## Risks - Medium: this adds a database migration and a broad feature path across CLI/server/UI. - Merge order: this is the only PR in this split with a DB migration; merge it before any future Cloud Upstream migration follow-up. - Mitigation: the PR is based directly on current `origin/master`, has targeted route/service/UI tests, and keeps the feature behind existing experimental Cloud Sync settings. > For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and discuss it in `#dev` before opening the PR. Feature PRs that overlap with planned core work may need to be redirected — check the roadmap first. See `CONTRIBUTING.md`. ## Model Used - OpenAI GPT-5 Codex via `codex_local`, tool-enabled coding session; exact context window not exposed by this runtime. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] If this change affects the UI, screenshot artifacts are intentionally omitted per reviewer request - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] I will address all Greptile and reviewer comments before requesting merge
This commit is contained in:
parent
a1835cfa5e
commit
e43b392a79
36 changed files with 5592 additions and 7 deletions
|
|
@ -688,6 +688,22 @@ export {
|
|||
MAX_ISSUE_GRAPH_LIVENESS_AUTO_RECOVERY_LOOKBACK_HOURS,
|
||||
} from "./types/instance.js";
|
||||
|
||||
export type {
|
||||
CloudUpstreamConnectStartResponse,
|
||||
CloudUpstreamActivationDecision,
|
||||
CloudUpstreamActivationEntityType,
|
||||
CloudUpstreamConnection,
|
||||
CloudUpstreamConflict,
|
||||
CloudUpstreamPreview,
|
||||
CloudUpstreamRun,
|
||||
CloudUpstreamRunEvent,
|
||||
CloudUpstreamsState,
|
||||
CloudUpstreamStep,
|
||||
CloudUpstreamSummaryCount,
|
||||
CloudUpstreamTarget,
|
||||
CloudUpstreamWarning,
|
||||
} from "./types/cloud-upstream.js";
|
||||
|
||||
export {
|
||||
getClosedIsolatedExecutionWorkspaceMessage,
|
||||
isClosedIsolatedExecutionWorkspace,
|
||||
|
|
|
|||
110
packages/shared/src/types/cloud-upstream.ts
Normal file
110
packages/shared/src/types/cloud-upstream.ts
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
export type CloudUpstreamStep = "connect" | "scan" | "preview" | "push" | "verify" | "activate";
|
||||
|
||||
export type CloudUpstreamRunStatus = "previewed" | "running" | "succeeded" | "failed" | "cancelled";
|
||||
|
||||
export type CloudUpstreamActivationEntityType = "agents" | "routines" | "monitors";
|
||||
|
||||
export interface CloudUpstreamActivationDecision {
|
||||
entityType: CloudUpstreamActivationEntityType;
|
||||
count: number;
|
||||
status: "paused" | "activated";
|
||||
activatedAt: string | null;
|
||||
}
|
||||
|
||||
export interface CloudUpstreamTarget {
|
||||
stackId: string;
|
||||
stackSlug: string | null;
|
||||
stackDisplayName: string | null;
|
||||
companyId: string;
|
||||
primaryHost: string;
|
||||
origin: string;
|
||||
product: string;
|
||||
schemaMajor: number;
|
||||
maxChunkBytes: number;
|
||||
}
|
||||
|
||||
export interface CloudUpstreamConnection {
|
||||
id: string;
|
||||
companyId: string;
|
||||
remoteUrl: string;
|
||||
target: CloudUpstreamTarget;
|
||||
tokenStatus: "pending" | "connected" | "expired" | "revoked";
|
||||
scopes: string[];
|
||||
authorizedGlobalUserId: string | null;
|
||||
expiresAt: string | null;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
lastRunId: string | null;
|
||||
}
|
||||
|
||||
export interface CloudUpstreamSummaryCount {
|
||||
key: string;
|
||||
label: string;
|
||||
count: number;
|
||||
}
|
||||
|
||||
export interface CloudUpstreamWarning {
|
||||
code: string;
|
||||
severity: "warning" | "blocker";
|
||||
title: string;
|
||||
detail: string;
|
||||
}
|
||||
|
||||
export interface CloudUpstreamConflict {
|
||||
id: string;
|
||||
entityType: string;
|
||||
sourceLabel: string;
|
||||
targetLabel: string;
|
||||
plannedAction: "create" | "update" | "skip" | "blocked";
|
||||
reason: string;
|
||||
}
|
||||
|
||||
export interface CloudUpstreamPreview {
|
||||
connectionId: string;
|
||||
sourceCompanyId: string;
|
||||
target: CloudUpstreamTarget;
|
||||
schemaCompatible: boolean;
|
||||
summary: CloudUpstreamSummaryCount[];
|
||||
warnings: CloudUpstreamWarning[];
|
||||
conflicts: CloudUpstreamConflict[];
|
||||
generatedAt: string;
|
||||
}
|
||||
|
||||
export interface CloudUpstreamRunEvent {
|
||||
id: string;
|
||||
at: string;
|
||||
phase: CloudUpstreamStep;
|
||||
type: "created" | "updated" | "skipped" | "conflict" | "retrying" | "failed" | "completed";
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface CloudUpstreamRun {
|
||||
id: string;
|
||||
connectionId: string;
|
||||
companyId: string;
|
||||
status: CloudUpstreamRunStatus;
|
||||
activeStep: CloudUpstreamStep;
|
||||
progressPercent: number;
|
||||
dryRun: boolean;
|
||||
summary: CloudUpstreamSummaryCount[];
|
||||
warnings: CloudUpstreamWarning[];
|
||||
conflicts: CloudUpstreamConflict[];
|
||||
events: CloudUpstreamRunEvent[];
|
||||
targetUrl: string | null;
|
||||
report: Record<string, unknown>;
|
||||
retryOfRunId: string | null;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
completedAt: string | null;
|
||||
}
|
||||
|
||||
export interface CloudUpstreamsState {
|
||||
connections: CloudUpstreamConnection[];
|
||||
runs: CloudUpstreamRun[];
|
||||
}
|
||||
|
||||
export interface CloudUpstreamConnectStartResponse {
|
||||
pendingConnectionId: string;
|
||||
authorizationUrl: string;
|
||||
connection: CloudUpstreamConnection;
|
||||
}
|
||||
|
|
@ -29,6 +29,7 @@ export interface InstanceGeneralSettings {
|
|||
export interface InstanceExperimentalSettings {
|
||||
enableEnvironments: boolean;
|
||||
enableIsolatedWorkspaces: boolean;
|
||||
enableCloudSync: boolean;
|
||||
autoRestartDevServerWhenIdle: boolean;
|
||||
enableIssueGraphLivenessAutoRecovery: boolean;
|
||||
issueGraphLivenessAutoRecoveryLookbackHours: number;
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ export const patchInstanceGeneralSettingsSchema = instanceGeneralSettingsSchema.
|
|||
export const instanceExperimentalSettingsSchema = z.object({
|
||||
enableEnvironments: z.boolean().default(false),
|
||||
enableIsolatedWorkspaces: z.boolean().default(false),
|
||||
enableCloudSync: z.boolean().default(false),
|
||||
autoRestartDevServerWhenIdle: z.boolean().default(false),
|
||||
enableIssueGraphLivenessAutoRecovery: z.boolean().default(false),
|
||||
issueGraphLivenessAutoRecoveryLookbackHours: z
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue