@remixhq/core 0.1.18 → 0.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.d.ts +6 -1
- package/dist/api.js +1 -1
- package/dist/{chunk-RCNOSZP6.js → chunk-C2FOZ3O7.js} +8 -0
- package/dist/collab.d.ts +31 -3
- package/dist/collab.js +126 -51
- package/dist/{contracts-DnNP-K3V.d.ts → contracts-DiVLvPTG.d.ts} +5 -0
- package/dist/history.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CoreConfig } from './config.js';
|
|
2
2
|
import { T as TokenProvider } from './tokenProvider-BWTusyj4.js';
|
|
3
|
-
import { T as TurnUsage } from './contracts-
|
|
3
|
+
import { T as TurnUsage } from './contracts-DiVLvPTG.js';
|
|
4
4
|
import 'zod';
|
|
5
5
|
|
|
6
6
|
type HistoryImportProvider = "claude_code" | "cursor";
|
|
@@ -542,6 +542,11 @@ type ApiClient = {
|
|
|
542
542
|
workspaceMetadata?: Record<string, unknown>;
|
|
543
543
|
idempotencyKey?: string;
|
|
544
544
|
}): Promise<Json>;
|
|
545
|
+
listChangeSteps(appId: string, params?: {
|
|
546
|
+
limit?: number;
|
|
547
|
+
offset?: number;
|
|
548
|
+
idempotencyKey?: string;
|
|
549
|
+
}): Promise<Json>;
|
|
545
550
|
startChangeStepReplay(appId: string, payload: {
|
|
546
551
|
prompt: string;
|
|
547
552
|
assistantResponse?: string;
|
package/dist/api.js
CHANGED
|
@@ -196,6 +196,14 @@ function createApiClient(config, opts) {
|
|
|
196
196
|
method: "POST",
|
|
197
197
|
body: JSON.stringify(payload)
|
|
198
198
|
}),
|
|
199
|
+
listChangeSteps: (appId, params) => {
|
|
200
|
+
const qs = new URLSearchParams();
|
|
201
|
+
if (params?.limit !== void 0) qs.set("limit", String(params.limit));
|
|
202
|
+
if (params?.offset !== void 0) qs.set("offset", String(params.offset));
|
|
203
|
+
if (params?.idempotencyKey) qs.set("idempotencyKey", params.idempotencyKey);
|
|
204
|
+
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
205
|
+
return request(`/v1/apps/${encodeURIComponent(appId)}/change-steps${suffix}`, { method: "GET" });
|
|
206
|
+
},
|
|
199
207
|
createCollabTurn: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/collab-turns`, {
|
|
200
208
|
method: "POST",
|
|
201
209
|
body: JSON.stringify(payload)
|
package/dist/collab.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CollabApiClient, a as TurnUsagePayload, b as CollabFinalizeTurnResult, c as CollabRecordingPreflight, d as CollabApproveMode, e as CollabApproveResult, M as MergeRequestQueue, f as MergeRequest, I as InvitationScopeType, g as CollabMember, J as JsonObject, A as AppDeltaResponse, h as CollabStatus, i as MergeRequestReview } from './contracts-
|
|
2
|
-
export { j as AppHeadResponse, k as AppMember, l as AppMemberRole, m as AppReconcileResponse, n as CollabFinalizeTurnAutoSync, o as CollabFinalizeTurnMode, p as CollabPendingFinalizeState, q as CollabPendingFinalizeSummary, r as CollabRecordingPreflightStatus, s as CollabRepoStateKind, t as CollabStatusBlockedReason, u as CollabStatusRecommendedAction, v as CollabTurn, w as MembershipScopeType, x as MergeRequestStatus, y as ModelCall, O as OrganizationMember, z as OrganizationMemberRole, P as ProjectMember, B as ProjectMemberRole, R as ReconcilePreflightResponse, S as ServerToolUsage, D as SyncLocalResponse, E as SyncUpstreamResponse, T as TurnUsage, F as TurnUsageCaptureSource, G as TurnUsageConfidence, H as TurnUsagePreviousPatch } from './contracts-
|
|
1
|
+
import { C as CollabApiClient, a as TurnUsagePayload, b as CollabFinalizeTurnResult, c as CollabRecordingPreflight, d as CollabApproveMode, e as CollabApproveResult, M as MergeRequestQueue, f as MergeRequest, I as InvitationScopeType, g as CollabMember, J as JsonObject, A as AppDeltaResponse, h as CollabStatus, i as MergeRequestReview } from './contracts-DiVLvPTG.js';
|
|
2
|
+
export { j as AppHeadResponse, k as AppMember, l as AppMemberRole, m as AppReconcileResponse, n as CollabFinalizeTurnAutoSync, o as CollabFinalizeTurnMode, p as CollabPendingFinalizeState, q as CollabPendingFinalizeSummary, r as CollabRecordingPreflightStatus, s as CollabRepoStateKind, t as CollabStatusBlockedReason, u as CollabStatusRecommendedAction, v as CollabTurn, w as MembershipScopeType, x as MergeRequestStatus, y as ModelCall, O as OrganizationMember, z as OrganizationMemberRole, P as ProjectMember, B as ProjectMemberRole, R as ReconcilePreflightResponse, S as ServerToolUsage, D as SyncLocalResponse, E as SyncUpstreamResponse, T as TurnUsage, F as TurnUsageCaptureSource, G as TurnUsageConfidence, H as TurnUsagePreviousPatch } from './contracts-DiVLvPTG.js';
|
|
3
3
|
import { B as BranchBindingMode } from './binding-WiIRI2fl.js';
|
|
4
4
|
|
|
5
5
|
declare function collabFinalizeTurn(params: {
|
|
@@ -139,6 +139,7 @@ type CollabInitQueuedResult = {
|
|
|
139
139
|
upstreamAppId: string;
|
|
140
140
|
dashboardUrl: string;
|
|
141
141
|
bindingPath: string;
|
|
142
|
+
repoFingerprint: string;
|
|
142
143
|
bindingMode: BranchBindingMode;
|
|
143
144
|
createdCanonicalFamily: boolean;
|
|
144
145
|
remoteUrl: string | null;
|
|
@@ -162,6 +163,7 @@ declare function collabInit(params: {
|
|
|
162
163
|
upstreamAppId: string;
|
|
163
164
|
dashboardUrl: string;
|
|
164
165
|
bindingPath: string;
|
|
166
|
+
repoFingerprint: string;
|
|
165
167
|
bindingMode: string;
|
|
166
168
|
createdCanonicalFamily: boolean;
|
|
167
169
|
remoteUrl: string | null;
|
|
@@ -175,6 +177,7 @@ declare function collabInit(params: {
|
|
|
175
177
|
upstreamAppId: string;
|
|
176
178
|
bindingPath: string;
|
|
177
179
|
repoRoot: string;
|
|
180
|
+
repoFingerprint: string;
|
|
178
181
|
bindingMode: string;
|
|
179
182
|
createdCanonicalFamily: boolean;
|
|
180
183
|
baselineStatus: InitBaselineStatus;
|
|
@@ -187,6 +190,7 @@ declare function collabInit(params: {
|
|
|
187
190
|
upstreamAppId: string;
|
|
188
191
|
bindingPath: string;
|
|
189
192
|
repoRoot: string;
|
|
193
|
+
repoFingerprint: string;
|
|
190
194
|
bindingMode: "lane" | "explicit_root";
|
|
191
195
|
createdCanonicalFamily: boolean;
|
|
192
196
|
baselineStatus: InitBaselineStatus;
|
|
@@ -209,6 +213,7 @@ declare function collabInitSubmit(params: {
|
|
|
209
213
|
upstreamAppId: string;
|
|
210
214
|
dashboardUrl: string;
|
|
211
215
|
bindingPath: string;
|
|
216
|
+
repoFingerprint: string;
|
|
212
217
|
bindingMode: string;
|
|
213
218
|
createdCanonicalFamily: boolean;
|
|
214
219
|
remoteUrl: string | null;
|
|
@@ -222,6 +227,7 @@ declare function collabInitSubmit(params: {
|
|
|
222
227
|
upstreamAppId: string;
|
|
223
228
|
bindingPath: string;
|
|
224
229
|
repoRoot: string;
|
|
230
|
+
repoFingerprint: string;
|
|
225
231
|
bindingMode: string;
|
|
226
232
|
createdCanonicalFamily: boolean;
|
|
227
233
|
baselineStatus: InitBaselineStatus;
|
|
@@ -234,6 +240,7 @@ declare function collabInitSubmit(params: {
|
|
|
234
240
|
upstreamAppId: string;
|
|
235
241
|
bindingPath: string;
|
|
236
242
|
repoRoot: string;
|
|
243
|
+
repoFingerprint: string;
|
|
237
244
|
bindingMode: "lane" | "explicit_root";
|
|
238
245
|
createdCanonicalFamily: boolean;
|
|
239
246
|
baselineStatus: InitBaselineStatus;
|
|
@@ -447,6 +454,27 @@ declare function drainPendingFinalizeQueue(params: {
|
|
|
447
454
|
api: CollabApiClient;
|
|
448
455
|
}): Promise<CollabFinalizeTurnResult[]>;
|
|
449
456
|
|
|
457
|
+
type SnapshotFileMode = "file" | "executable" | "symlink";
|
|
458
|
+
type LocalSnapshotFile = {
|
|
459
|
+
path: string;
|
|
460
|
+
mode: SnapshotFileMode;
|
|
461
|
+
blobHash: string;
|
|
462
|
+
size: number;
|
|
463
|
+
};
|
|
464
|
+
type LocalSnapshotRecord = {
|
|
465
|
+
schemaVersion: 1;
|
|
466
|
+
id: string;
|
|
467
|
+
repoRoot: string;
|
|
468
|
+
repoFingerprint: string | null;
|
|
469
|
+
laneId: string | null;
|
|
470
|
+
branchName: string | null;
|
|
471
|
+
localCommitHash: string | null;
|
|
472
|
+
snapshotHash: string;
|
|
473
|
+
createdAt: string;
|
|
474
|
+
files: LocalSnapshotFile[];
|
|
475
|
+
};
|
|
476
|
+
declare function readLocalSnapshot(snapshotId: string | null | undefined): Promise<LocalSnapshotRecord | null>;
|
|
477
|
+
|
|
450
478
|
type ProcessOutcome = {
|
|
451
479
|
status: "completed";
|
|
452
480
|
jobId: string;
|
|
@@ -576,4 +604,4 @@ declare function drainerLogPath(): string;
|
|
|
576
604
|
declare function getDrainerLogPath(): string;
|
|
577
605
|
declare function getDrainerPidPath(): string;
|
|
578
606
|
|
|
579
|
-
export { AppDeltaResponse, type AsyncJob, type AsyncJobBase, type AsyncJobKind, type AsyncJobStatus, type AsyncJobSummary, type AwaitAsyncJobResult, CollabApiClient, CollabApproveMode, CollabApproveResult, CollabFinalizeTurnResult, type CollabInitQueuedResult, CollabMember, CollabRecordingPreflight, CollabStatus, type DrainerLogEvent, FINALIZE_JOB_LOCK_STALE_MS, FINALIZE_PREFLIGHT_FAILURE_CODES, type FinalizePreflightFailureCode, type InitJobPayload, InvitationScopeType, JsonObject, MergeRequest, MergeRequestQueue, MergeRequestReview, type PendingFinalizeJob, type ReAnchorJobPayload, TurnUsagePayload, awaitAsyncJob, cleanStaleFinalizeJobLocks, collabApprove, collabCheckout, collabFinalizeTurn, collabInit, collabInitProcess, collabInitSubmit, collabInvite, collabList, collabListMembers, collabListMergeRequests, collabReconcile, collabRecordingPreflight, collabReject, collabRemix, collabRequestMerge, collabStatus, collabSync, collabSyncUpstream, collabUpdateMemberRole, collabView, deleteAsyncJob, drainAsyncJobs, drainPendingFinalizeQueue, drainerLogPath, findFailedAsyncJob, findPendingAsyncJob, forgetPendingFinalizeJob, getDrainerLogPath, getDrainerPidPath, getMemberRolesForScope, isFinalizePreflightFailureCode, listAsyncJobs, listAsyncJobsForRepo, listPendingFinalizeJobs, processPendingFinalizeJob, pruneTerminalAsyncJobs, readAsyncJob, readPendingFinalizeJob, requeuePendingFinalizeJob, summarizeAsyncJobs, updatePendingFinalizeJob, validateMemberRole };
|
|
607
|
+
export { AppDeltaResponse, type AsyncJob, type AsyncJobBase, type AsyncJobKind, type AsyncJobStatus, type AsyncJobSummary, type AwaitAsyncJobResult, CollabApiClient, CollabApproveMode, CollabApproveResult, CollabFinalizeTurnResult, type CollabInitQueuedResult, CollabMember, CollabRecordingPreflight, CollabStatus, type DrainerLogEvent, FINALIZE_JOB_LOCK_STALE_MS, FINALIZE_PREFLIGHT_FAILURE_CODES, type FinalizePreflightFailureCode, type InitJobPayload, InvitationScopeType, JsonObject, type LocalSnapshotRecord, MergeRequest, MergeRequestQueue, MergeRequestReview, type PendingFinalizeJob, type ReAnchorJobPayload, TurnUsagePayload, awaitAsyncJob, cleanStaleFinalizeJobLocks, collabApprove, collabCheckout, collabFinalizeTurn, collabInit, collabInitProcess, collabInitSubmit, collabInvite, collabList, collabListMembers, collabListMergeRequests, collabReconcile, collabRecordingPreflight, collabReject, collabRemix, collabRequestMerge, collabStatus, collabSync, collabSyncUpstream, collabUpdateMemberRole, collabView, deleteAsyncJob, drainAsyncJobs, drainPendingFinalizeQueue, drainerLogPath, findFailedAsyncJob, findPendingAsyncJob, forgetPendingFinalizeJob, getDrainerLogPath, getDrainerPidPath, getMemberRolesForScope, isFinalizePreflightFailureCode, listAsyncJobs, listAsyncJobsForRepo, listPendingFinalizeJobs, processPendingFinalizeJob, pruneTerminalAsyncJobs, readAsyncJob, readLocalSnapshot, readPendingFinalizeJob, requeuePendingFinalizeJob, summarizeAsyncJobs, updatePendingFinalizeJob, validateMemberRole };
|
package/dist/collab.js
CHANGED
|
@@ -1467,6 +1467,15 @@ function shouldRequireRemoteLaneForCurrentBranch(params) {
|
|
|
1467
1467
|
if (params.currentBranch === defaultBranch) return false;
|
|
1468
1468
|
return !params.binding.laneId || params.binding.currentAppId === params.binding.upstreamAppId;
|
|
1469
1469
|
}
|
|
1470
|
+
function resolveLaneLookupProjectId(params) {
|
|
1471
|
+
const currentBranch = normalizeBranchName(params.currentBranch);
|
|
1472
|
+
const defaultBranch = normalizeBranchName(params.defaultBranch);
|
|
1473
|
+
const localProjectId = params.localBinding.projectId ?? null;
|
|
1474
|
+
if (currentBranch && currentBranch !== defaultBranch && localProjectId) {
|
|
1475
|
+
return localProjectId;
|
|
1476
|
+
}
|
|
1477
|
+
return params.explicitRootProjectId ?? (params.requireRemoteLane ? void 0 : localProjectId ?? params.fallbackProjectId ?? void 0);
|
|
1478
|
+
}
|
|
1470
1479
|
async function persistResolvedLane(repoRoot, binding) {
|
|
1471
1480
|
await writeCollabBinding(repoRoot, {
|
|
1472
1481
|
projectId: binding.projectId,
|
|
@@ -1545,7 +1554,14 @@ async function resolveActiveLaneBindingUncached(params, state) {
|
|
|
1545
1554
|
};
|
|
1546
1555
|
}
|
|
1547
1556
|
const laneResp2 = await params.api.resolveProjectLaneBinding({
|
|
1548
|
-
projectId:
|
|
1557
|
+
projectId: resolveLaneLookupProjectId({
|
|
1558
|
+
explicitRootProjectId: state.explicitRootBinding?.projectId,
|
|
1559
|
+
localBinding,
|
|
1560
|
+
currentBranch,
|
|
1561
|
+
defaultBranch: state.defaultBranch,
|
|
1562
|
+
requireRemoteLane,
|
|
1563
|
+
fallbackProjectId: state.projectId
|
|
1564
|
+
}),
|
|
1549
1565
|
repoFingerprint: state.repoFingerprint ?? void 0,
|
|
1550
1566
|
remoteUrl: state.remoteUrl ?? void 0,
|
|
1551
1567
|
defaultBranch: state.defaultBranch ?? void 0,
|
|
@@ -2403,6 +2419,59 @@ function buildWorkspaceMetadata(params) {
|
|
|
2403
2419
|
}
|
|
2404
2420
|
return metadata;
|
|
2405
2421
|
}
|
|
2422
|
+
async function findExistingChangeStepByIdempotency(params) {
|
|
2423
|
+
const idempotencyKey = params.idempotencyKey?.trim();
|
|
2424
|
+
if (!idempotencyKey) return null;
|
|
2425
|
+
const resp = await params.api.listChangeSteps(params.appId, { limit: 1, idempotencyKey });
|
|
2426
|
+
const responseObject = unwrapResponseObject(
|
|
2427
|
+
resp,
|
|
2428
|
+
"change step list"
|
|
2429
|
+
);
|
|
2430
|
+
const steps = Array.isArray(responseObject) ? responseObject : Array.isArray(responseObject.items) ? responseObject.items : [];
|
|
2431
|
+
return steps.find((step) => step.idempotencyKey === idempotencyKey) ?? null;
|
|
2432
|
+
}
|
|
2433
|
+
async function writeBaselineFromSucceededChangeStep(params) {
|
|
2434
|
+
const nextServerHeadHash = typeof params.changeStep.headCommitHash === "string" ? params.changeStep.headCommitHash.trim() : "";
|
|
2435
|
+
if (!nextServerHeadHash) {
|
|
2436
|
+
throw buildFinalizeCliError({
|
|
2437
|
+
message: "Backend returned a succeeded change step without a head commit hash.",
|
|
2438
|
+
exitCode: 1,
|
|
2439
|
+
hint: "This is a backend invariant violation; retry will not help. Run `remix collab status` before trying again.",
|
|
2440
|
+
disposition: "terminal",
|
|
2441
|
+
reason: "missing_head_commit_hash"
|
|
2442
|
+
});
|
|
2443
|
+
}
|
|
2444
|
+
let nextServerRevisionId = typeof params.changeStep.resultRevisionId === "string" ? params.changeStep.resultRevisionId.trim() : "";
|
|
2445
|
+
let nextServerTreeHash = null;
|
|
2446
|
+
if (!nextServerRevisionId) {
|
|
2447
|
+
const freshHeadResp = await params.api.getAppHead(params.job.currentAppId);
|
|
2448
|
+
const freshHead = unwrapResponseObject(freshHeadResp, "app head");
|
|
2449
|
+
if (freshHead.headCommitHash !== nextServerHeadHash || !freshHead.headRevisionId) {
|
|
2450
|
+
throw buildFinalizeCliError({
|
|
2451
|
+
message: "Backend returned a succeeded change step without a matching result revision.",
|
|
2452
|
+
exitCode: 1,
|
|
2453
|
+
hint: "The local baseline was not advanced because the post-step revision could not be verified. Restart the backend/CLI and retry after checking `remix collab status`.",
|
|
2454
|
+
disposition: "terminal",
|
|
2455
|
+
reason: "missing_result_revision_id"
|
|
2456
|
+
});
|
|
2457
|
+
}
|
|
2458
|
+
nextServerRevisionId = freshHead.headRevisionId;
|
|
2459
|
+
nextServerTreeHash = freshHead.treeHash ?? null;
|
|
2460
|
+
}
|
|
2461
|
+
await writeLocalBaseline({
|
|
2462
|
+
repoRoot: params.job.repoRoot,
|
|
2463
|
+
repoFingerprint: params.job.repoFingerprint,
|
|
2464
|
+
laneId: params.job.laneId,
|
|
2465
|
+
currentAppId: params.job.currentAppId,
|
|
2466
|
+
branchName: params.job.branchName,
|
|
2467
|
+
lastSnapshotId: params.snapshot.id,
|
|
2468
|
+
lastSnapshotHash: params.snapshot.snapshotHash,
|
|
2469
|
+
lastServerRevisionId: nextServerRevisionId,
|
|
2470
|
+
lastServerTreeHash: nextServerTreeHash,
|
|
2471
|
+
lastServerHeadHash: nextServerHeadHash,
|
|
2472
|
+
lastSeenLocalCommitHash: params.snapshot.localCommitHash
|
|
2473
|
+
});
|
|
2474
|
+
}
|
|
2406
2475
|
async function harvestPreTurnEvents(repoRoot, fromCommit, toCommit) {
|
|
2407
2476
|
if (!toCommit) return null;
|
|
2408
2477
|
try {
|
|
@@ -2588,6 +2657,34 @@ async function processClaimedPendingFinalizeJobInner(params) {
|
|
|
2588
2657
|
});
|
|
2589
2658
|
}
|
|
2590
2659
|
const replayNeeded = appHead.headCommitHash !== submissionBaseHeadHash || baselineDrifted;
|
|
2660
|
+
if (replayNeeded) {
|
|
2661
|
+
const existingChangeStep = await findExistingChangeStepByIdempotency({
|
|
2662
|
+
api: params.api,
|
|
2663
|
+
appId: job.currentAppId,
|
|
2664
|
+
idempotencyKey: job.idempotencyKey
|
|
2665
|
+
});
|
|
2666
|
+
if (existingChangeStep) {
|
|
2667
|
+
const changeStep2 = existingChangeStep.status === "succeeded" ? existingChangeStep : await pollChangeStep(params.api, job.currentAppId, existingChangeStep.id);
|
|
2668
|
+
invalidateAppHeadCache(job.currentAppId);
|
|
2669
|
+
invalidateAppDeltaCacheForApp(job.currentAppId);
|
|
2670
|
+
await writeBaselineFromSucceededChangeStep({ api: params.api, job, snapshot, changeStep: changeStep2 });
|
|
2671
|
+
await updatePendingFinalizeJob(job.id, {
|
|
2672
|
+
status: "completed",
|
|
2673
|
+
metadata: { changeStepId: String(changeStep2.id ?? "") }
|
|
2674
|
+
});
|
|
2675
|
+
return {
|
|
2676
|
+
mode: "changed_turn",
|
|
2677
|
+
idempotencyKey: job.idempotencyKey ?? "",
|
|
2678
|
+
queued: false,
|
|
2679
|
+
jobId: job.id,
|
|
2680
|
+
repoState,
|
|
2681
|
+
changeStep: changeStep2,
|
|
2682
|
+
collabTurn: null,
|
|
2683
|
+
autoSync: null,
|
|
2684
|
+
warnings: []
|
|
2685
|
+
};
|
|
2686
|
+
}
|
|
2687
|
+
}
|
|
2591
2688
|
if (replayNeeded) {
|
|
2592
2689
|
try {
|
|
2593
2690
|
const replayResp = await params.api.startChangeStepReplay(job.currentAppId, {
|
|
@@ -2685,46 +2782,7 @@ async function processClaimedPendingFinalizeJobInner(params) {
|
|
|
2685
2782
|
const changeStep = await pollChangeStep(params.api, job.currentAppId, String(createdStep.id));
|
|
2686
2783
|
invalidateAppHeadCache(job.currentAppId);
|
|
2687
2784
|
invalidateAppDeltaCacheForApp(job.currentAppId);
|
|
2688
|
-
|
|
2689
|
-
if (!nextServerHeadHash) {
|
|
2690
|
-
throw buildFinalizeCliError({
|
|
2691
|
-
message: "Backend returned a succeeded change step without a head commit hash.",
|
|
2692
|
-
exitCode: 1,
|
|
2693
|
-
hint: "This is a backend invariant violation; retry will not help. Run `remix collab status` before trying again.",
|
|
2694
|
-
disposition: "terminal",
|
|
2695
|
-
reason: "missing_head_commit_hash"
|
|
2696
|
-
});
|
|
2697
|
-
}
|
|
2698
|
-
let nextServerRevisionId = typeof changeStep.resultRevisionId === "string" ? changeStep.resultRevisionId.trim() : "";
|
|
2699
|
-
let nextServerTreeHash = null;
|
|
2700
|
-
if (!nextServerRevisionId) {
|
|
2701
|
-
const freshHeadResp = await params.api.getAppHead(job.currentAppId);
|
|
2702
|
-
const freshHead = unwrapResponseObject(freshHeadResp, "app head");
|
|
2703
|
-
if (freshHead.headCommitHash !== nextServerHeadHash || !freshHead.headRevisionId) {
|
|
2704
|
-
throw buildFinalizeCliError({
|
|
2705
|
-
message: "Backend returned a succeeded change step without a matching result revision.",
|
|
2706
|
-
exitCode: 1,
|
|
2707
|
-
hint: "The local baseline was not advanced because the post-step revision could not be verified. Restart the backend/CLI and retry after checking `remix collab status`.",
|
|
2708
|
-
disposition: "terminal",
|
|
2709
|
-
reason: "missing_result_revision_id"
|
|
2710
|
-
});
|
|
2711
|
-
}
|
|
2712
|
-
nextServerRevisionId = freshHead.headRevisionId;
|
|
2713
|
-
nextServerTreeHash = freshHead.treeHash ?? null;
|
|
2714
|
-
}
|
|
2715
|
-
await writeLocalBaseline({
|
|
2716
|
-
repoRoot: job.repoRoot,
|
|
2717
|
-
repoFingerprint: job.repoFingerprint,
|
|
2718
|
-
laneId: job.laneId,
|
|
2719
|
-
currentAppId: job.currentAppId,
|
|
2720
|
-
branchName: job.branchName,
|
|
2721
|
-
lastSnapshotId: snapshot.id,
|
|
2722
|
-
lastSnapshotHash: snapshot.snapshotHash,
|
|
2723
|
-
lastServerRevisionId: nextServerRevisionId,
|
|
2724
|
-
lastServerTreeHash: nextServerTreeHash,
|
|
2725
|
-
lastServerHeadHash: nextServerHeadHash,
|
|
2726
|
-
lastSeenLocalCommitHash: snapshot.localCommitHash
|
|
2727
|
-
});
|
|
2785
|
+
await writeBaselineFromSucceededChangeStep({ api: params.api, job, snapshot, changeStep });
|
|
2728
2786
|
await updatePendingFinalizeJob(job.id, {
|
|
2729
2787
|
status: "completed",
|
|
2730
2788
|
metadata: { changeStepId: String(changeStep.id ?? "") }
|
|
@@ -4207,27 +4265,21 @@ async function trySeedEquivalentBranchBaseline(params) {
|
|
|
4207
4265
|
branchName: params.branchName,
|
|
4208
4266
|
persistBlobs: false
|
|
4209
4267
|
});
|
|
4210
|
-
if (inspection.snapshotHash !== defaultBaseline.lastSnapshotHash) {
|
|
4268
|
+
if (inspection.snapshotHash !== defaultBaseline.lastSnapshotHash && inspection.localCommitHash !== defaultBaseline.lastSeenLocalCommitHash) {
|
|
4211
4269
|
return null;
|
|
4212
4270
|
}
|
|
4213
|
-
const snapshot = await captureLocalSnapshot({
|
|
4214
|
-
repoRoot: params.repoRoot,
|
|
4215
|
-
repoFingerprint: params.repoFingerprint,
|
|
4216
|
-
laneId: params.laneId,
|
|
4217
|
-
branchName: params.branchName
|
|
4218
|
-
});
|
|
4219
4271
|
await writeLocalBaseline({
|
|
4220
4272
|
repoRoot: params.repoRoot,
|
|
4221
4273
|
repoFingerprint: params.repoFingerprint,
|
|
4222
4274
|
laneId: params.laneId,
|
|
4223
4275
|
currentAppId: params.currentAppId,
|
|
4224
4276
|
branchName: params.branchName,
|
|
4225
|
-
lastSnapshotId:
|
|
4226
|
-
lastSnapshotHash:
|
|
4277
|
+
lastSnapshotId: defaultBaseline.lastSnapshotId,
|
|
4278
|
+
lastSnapshotHash: defaultBaseline.lastSnapshotHash,
|
|
4227
4279
|
lastServerRevisionId: params.appHeadRevisionId,
|
|
4228
4280
|
lastServerTreeHash: params.appTreeHash,
|
|
4229
4281
|
lastServerHeadHash: params.appHeadHash,
|
|
4230
|
-
lastSeenLocalCommitHash:
|
|
4282
|
+
lastSeenLocalCommitHash: inspection.localCommitHash
|
|
4231
4283
|
});
|
|
4232
4284
|
return "seeded";
|
|
4233
4285
|
}
|
|
@@ -4276,6 +4328,21 @@ async function resolveInitBaselineStatus(params) {
|
|
|
4276
4328
|
});
|
|
4277
4329
|
const delta = unwrapResponseObject(deltaResp, "app delta");
|
|
4278
4330
|
if (delta.status === "up_to_date" || delta.status === "delta_ready") {
|
|
4331
|
+
const equivalentBaseline = await trySeedEquivalentBranchBaseline({
|
|
4332
|
+
repoRoot: params.repoRoot,
|
|
4333
|
+
repoFingerprint: params.repoFingerprint,
|
|
4334
|
+
laneId: params.laneId,
|
|
4335
|
+
currentAppId: params.currentAppId,
|
|
4336
|
+
upstreamAppId: params.upstreamAppId ?? null,
|
|
4337
|
+
branchName: params.branchName,
|
|
4338
|
+
defaultBranch: params.defaultBranch,
|
|
4339
|
+
appHeadHash: appHead.headCommitHash,
|
|
4340
|
+
appHeadRevisionId: appHead.headRevisionId ?? null,
|
|
4341
|
+
appTreeHash: appHead.treeHash ?? null
|
|
4342
|
+
});
|
|
4343
|
+
if (equivalentBaseline) {
|
|
4344
|
+
return equivalentBaseline;
|
|
4345
|
+
}
|
|
4279
4346
|
return "requires_sync";
|
|
4280
4347
|
}
|
|
4281
4348
|
if (delta.status === "content_equivalent") {
|
|
@@ -4392,6 +4459,7 @@ async function collabInit(params) {
|
|
|
4392
4459
|
upstreamAppId: existingBinding.upstreamAppId ?? existingBinding.currentAppId,
|
|
4393
4460
|
dashboardUrl: buildDashboardAppUrl(existingBinding.currentAppId),
|
|
4394
4461
|
bindingPath: getCollabBindingPath(repoRoot),
|
|
4462
|
+
repoFingerprint: existingBinding.repoFingerprint ?? repoFingerprint,
|
|
4395
4463
|
bindingMode: existingBinding.bindingMode,
|
|
4396
4464
|
createdCanonicalFamily: false,
|
|
4397
4465
|
remoteUrl: existingBinding.remoteUrl ?? remoteUrl,
|
|
@@ -4408,6 +4476,7 @@ async function collabInit(params) {
|
|
|
4408
4476
|
upstreamAppId: "",
|
|
4409
4477
|
dashboardUrl: "",
|
|
4410
4478
|
bindingPath: getCollabBindingPath(repoRoot),
|
|
4479
|
+
repoFingerprint,
|
|
4411
4480
|
bindingMode: "lane",
|
|
4412
4481
|
createdCanonicalFamily: false,
|
|
4413
4482
|
remoteUrl,
|
|
@@ -4508,6 +4577,7 @@ async function collabInit(params) {
|
|
|
4508
4577
|
upstreamAppId: boundUpstreamAppId2,
|
|
4509
4578
|
bindingPath: path9.join(repoRoot, ".remix", "config.json"),
|
|
4510
4579
|
repoRoot,
|
|
4580
|
+
repoFingerprint,
|
|
4511
4581
|
bindingMode: defaultBranch && branchName !== defaultBranch ? "lane" : "explicit_root",
|
|
4512
4582
|
createdCanonicalFamily: false,
|
|
4513
4583
|
baselineStatus: await resolveInitBaselineStatus({
|
|
@@ -4620,6 +4690,7 @@ async function collabInit(params) {
|
|
|
4620
4690
|
upstreamAppId: boundUpstreamAppId2,
|
|
4621
4691
|
bindingPath: bindingPath2,
|
|
4622
4692
|
repoRoot,
|
|
4693
|
+
repoFingerprint,
|
|
4623
4694
|
bindingMode: "lane",
|
|
4624
4695
|
createdCanonicalFamily: false,
|
|
4625
4696
|
baselineStatus: await resolveInitBaselineStatus({
|
|
@@ -4750,6 +4821,7 @@ async function collabInit(params) {
|
|
|
4750
4821
|
upstreamAppId: boundUpstreamAppId2,
|
|
4751
4822
|
bindingPath: bindingPath2,
|
|
4752
4823
|
repoRoot,
|
|
4824
|
+
repoFingerprint,
|
|
4753
4825
|
bindingMode: "lane",
|
|
4754
4826
|
createdCanonicalFamily: false,
|
|
4755
4827
|
baselineStatus: await resolveInitBaselineStatus({
|
|
@@ -4970,6 +5042,7 @@ async function collabInit(params) {
|
|
|
4970
5042
|
upstreamAppId: boundUpstreamAppId2,
|
|
4971
5043
|
dashboardUrl: buildDashboardAppUrl(boundCurrentAppId2),
|
|
4972
5044
|
bindingPath: bindingPath2,
|
|
5045
|
+
repoFingerprint,
|
|
4973
5046
|
bindingMode: bindingMode2,
|
|
4974
5047
|
createdCanonicalFamily: Boolean(params.forceNew),
|
|
4975
5048
|
remoteUrl,
|
|
@@ -5152,6 +5225,7 @@ async function collabInit(params) {
|
|
|
5152
5225
|
upstreamAppId: boundUpstreamAppId,
|
|
5153
5226
|
bindingPath,
|
|
5154
5227
|
repoRoot,
|
|
5228
|
+
repoFingerprint,
|
|
5155
5229
|
bindingMode,
|
|
5156
5230
|
createdCanonicalFamily: Boolean(params.forceNew),
|
|
5157
5231
|
baselineStatus,
|
|
@@ -6566,6 +6640,7 @@ export {
|
|
|
6566
6640
|
processPendingFinalizeJob,
|
|
6567
6641
|
pruneTerminalAsyncJobs,
|
|
6568
6642
|
readAsyncJob,
|
|
6643
|
+
readLocalSnapshot,
|
|
6569
6644
|
readPendingFinalizeJob,
|
|
6570
6645
|
requeuePendingFinalizeJob,
|
|
6571
6646
|
summarizeAsyncJobs,
|
|
@@ -536,6 +536,11 @@ type CollabApiClient = {
|
|
|
536
536
|
workspaceMetadata?: Record<string, unknown>;
|
|
537
537
|
idempotencyKey?: string;
|
|
538
538
|
}): Promise<unknown>;
|
|
539
|
+
listChangeSteps(appId: string, params?: {
|
|
540
|
+
limit?: number;
|
|
541
|
+
offset?: number;
|
|
542
|
+
idempotencyKey?: string;
|
|
543
|
+
}): Promise<unknown>;
|
|
539
544
|
startChangeStepReplay(appId: string, payload: {
|
|
540
545
|
prompt: string;
|
|
541
546
|
assistantResponse?: string;
|
package/dist/history.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -4,4 +4,4 @@ export { S as SessionStore, a as StoredSession, c as createStoredSessionTokenPro
|
|
|
4
4
|
export { createLocalSessionStore, createSupabaseAuthHelpers } from './auth.js';
|
|
5
5
|
export { AgentMemoryItem, AgentMemoryKind, AgentMemorySearchItem, AgentMemorySearchResponse, AgentMemorySummary, AgentMemoryTimelineResponse, ApiClient, AppContext, AppContextAccessPath, AppReconcileResponse, Bundle, BundlePlatform, BundleStatus, ChangeStepDiffResponse, InitiateBundleRequest, InvitationRecord, MergeRequest, MergeRequestReview, MergeRequestStatus, ReconcilePreflightResponse, SyncLocalResponse, SyncUpstreamResponse, createApiClient } from './api.js';
|
|
6
6
|
import 'zod';
|
|
7
|
-
import './contracts-
|
|
7
|
+
import './contracts-DiVLvPTG.js';
|
package/dist/index.js
CHANGED