mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-23 09:07:46 +02:00
Align cloud upstream source metadata
This commit is contained in:
1 parent
ea11acdec8
commit
beebfbc723
4 files changed
+37
-19
No files matched your search
@@ -8,6 +8,10 @@ import type {
|
||||
CompanyPortabilityFileEntry,
|
||||
InstanceExperimentalSettings,
|
||||
} from "@paperclipai/shared";
|
||||
import {
|
||||
CLOUD_UPSTREAM_EXPORTER_VERSION,
|
||||
CLOUD_UPSTREAM_SOURCE_SCHEMA_VERSION,
|
||||
} from "@paperclipai/shared";
|
||||
import { openUrl } from "../../client/board-auth.js";
|
||||
import { resolvePaperclipInstanceId } from "../../config/home.js";
|
||||
import {
|
||||
@@ -286,8 +290,8 @@ export async function buildBundleFromLocalCompany(input: {
|
||||
sourceInstanceId: input.connection.sourceInstanceId,
|
||||
sourceCompanyId: input.localCompanyId,
|
||||
sourceInstanceKeyFingerprint: input.connection.sourceInstanceFingerprint,
|
||||
exporterVersion: "paperclipai-cli-cloud-v1",
|
||||
sourceSchemaVersion: "paperclip-local-portability-v1",
|
||||
exporterVersion: CLOUD_UPSTREAM_EXPORTER_VERSION,
|
||||
sourceSchemaVersion: CLOUD_UPSTREAM_SOURCE_SCHEMA_VERSION,
|
||||
};
|
||||
const target: UpstreamTransferManifestTarget = {
|
||||
targetStackId: input.discovery.stack.id,
|
||||
|
||||
@@ -682,20 +682,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,
|
||||
export {
|
||||
CLOUD_UPSTREAM_EXPORTER_VERSION,
|
||||
CLOUD_UPSTREAM_SOURCE_SCHEMA_VERSION,
|
||||
type CloudUpstreamConnectStartResponse,
|
||||
type CloudUpstreamActivationDecision,
|
||||
type CloudUpstreamActivationEntityType,
|
||||
type CloudUpstreamConnection,
|
||||
type CloudUpstreamConflict,
|
||||
type CloudUpstreamPreview,
|
||||
type CloudUpstreamRun,
|
||||
type CloudUpstreamRunEvent,
|
||||
type CloudUpstreamsState,
|
||||
type CloudUpstreamStep,
|
||||
type CloudUpstreamSummaryCount,
|
||||
type CloudUpstreamTarget,
|
||||
type CloudUpstreamWarning,
|
||||
} from "./types/cloud-upstream.js";
|
||||
|
||||
export {
|
||||
|
||||
@@ -4,6 +4,9 @@ export type CloudUpstreamRunStatus = "previewed" | "running" | "succeeded" | "fa
|
||||
|
||||
export type CloudUpstreamActivationEntityType = "agents" | "routines" | "monitors";
|
||||
|
||||
export const CLOUD_UPSTREAM_EXPORTER_VERSION = "paperclipai-cli-cloud-v1";
|
||||
export const CLOUD_UPSTREAM_SOURCE_SCHEMA_VERSION = "paperclip-local-portability-v1";
|
||||
|
||||
export interface CloudUpstreamActivationDecision {
|
||||
entityType: CloudUpstreamActivationEntityType;
|
||||
count: number;
|
||||
|
||||
@@ -9,6 +9,7 @@ import type {
|
||||
CloudUpstreamPreview,
|
||||
CloudUpstreamRun,
|
||||
CloudUpstreamRunEvent,
|
||||
CloudUpstreamStep,
|
||||
CloudUpstreamsState,
|
||||
CloudUpstreamSummaryCount,
|
||||
CloudUpstreamTarget,
|
||||
@@ -16,6 +17,10 @@ import type {
|
||||
CompanyPortabilityExportResult,
|
||||
CompanyPortabilityFileEntry,
|
||||
} from "@paperclipai/shared";
|
||||
import {
|
||||
CLOUD_UPSTREAM_EXPORTER_VERSION,
|
||||
CLOUD_UPSTREAM_SOURCE_SCHEMA_VERSION,
|
||||
} from "@paperclipai/shared";
|
||||
import type { Db } from "@paperclipai/db";
|
||||
import {
|
||||
agents,
|
||||
@@ -432,11 +437,13 @@ export function cloudUpstreamService(db: Db, options: { instanceId?: string } =
|
||||
}): Promise<void> {
|
||||
let preview: CloudUpstreamPreview | null = null;
|
||||
let bundle: LocalUpstreamExportBundle | null = null;
|
||||
let currentStep: CloudUpstreamStep = "scan";
|
||||
try {
|
||||
preview = await localPreview(input.connection);
|
||||
if (!preview.schemaCompatible) {
|
||||
throw badRequest("Cloud stack schema is not compatible with this local Paperclip version");
|
||||
}
|
||||
currentStep = "preview";
|
||||
await updateRun(input.runId, {
|
||||
activeStep: "preview",
|
||||
progressPercent: 25,
|
||||
@@ -451,6 +458,7 @@ export function cloudUpstreamService(db: Db, options: { instanceId?: string } =
|
||||
});
|
||||
|
||||
bundle = await buildBundle(input.connection, "apply");
|
||||
currentStep = "push";
|
||||
await updateRun(input.runId, {
|
||||
activeStep: "push",
|
||||
progressPercent: 45,
|
||||
@@ -484,6 +492,7 @@ export function cloudUpstreamService(db: Db, options: { instanceId?: string } =
|
||||
for (const chunk of bundle.chunks) {
|
||||
await remotePost(input.connection, `/api/upstream-import-runs/${encodeURIComponent(remoteRunId)}/chunks`, chunk);
|
||||
}
|
||||
currentStep = "verify";
|
||||
await updateRun(input.runId, {
|
||||
activeStep: "verify",
|
||||
progressPercent: 82,
|
||||
@@ -536,7 +545,7 @@ export function cloudUpstreamService(db: Db, options: { instanceId?: string } =
|
||||
const failure = cloudUpstreamRemoteFailureReport(error);
|
||||
await updateRun(input.runId, {
|
||||
status: "failed",
|
||||
activeStep: "push",
|
||||
activeStep: currentStep,
|
||||
progressPercent: 100,
|
||||
...(preview ? {
|
||||
summary: preview.summary,
|
||||
@@ -652,8 +661,8 @@ export function cloudUpstreamService(db: Db, options: { instanceId?: string } =
|
||||
sourceInstanceId: connection.sourceInstanceId,
|
||||
sourceCompanyId: connection.companyId,
|
||||
sourceInstanceKeyFingerprint: connection.sourceInstanceFingerprint,
|
||||
exporterVersion: "paperclip-local-cloud-ui-v1",
|
||||
sourceSchemaVersion: TRANSFER_SCHEMA.version,
|
||||
exporterVersion: CLOUD_UPSTREAM_EXPORTER_VERSION,
|
||||
sourceSchemaVersion: CLOUD_UPSTREAM_SOURCE_SCHEMA_VERSION,
|
||||
};
|
||||
const target = {
|
||||
targetStackId: connection.targetStackId,
|
||||
|
||||
Reference in new issue
Block a user