@remixhq/core 0.1.20 → 0.1.22
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 +267 -2
- package/dist/api.js +1 -1
- package/dist/auth.js +1 -1
- package/dist/binding.js +1 -1
- package/dist/{chunk-C2FOZ3O7.js → chunk-DZRFUAOL.js} +152 -0
- package/dist/{chunk-XCZRNB35.js → chunk-LGOQVGBB.js} +8 -8
- package/dist/{chunk-XETDXVGM.js → chunk-MAM4CGDF.js} +2 -1
- package/dist/{chunk-DBVN42RF.js → chunk-P4XIICU3.js} +9 -2
- package/dist/collab.d.ts +3 -2
- package/dist/collab.js +68 -24
- package/dist/config.js +1 -1
- package/dist/{contracts-DiVLvPTG.d.ts → contracts-CuTwLa6w.d.ts} +8 -0
- package/dist/history.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/package.json +4 -2
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-CuTwLa6w.js';
|
|
4
4
|
import 'zod';
|
|
5
5
|
|
|
6
6
|
type HistoryImportProvider = "claude_code" | "cursor";
|
|
@@ -278,10 +278,227 @@ type ReconcilePreflightResponse = {
|
|
|
278
278
|
type OrganizationMemberRole = "owner" | "admin" | "member" | "viewer";
|
|
279
279
|
type ProjectMemberRole = "owner" | "maintainer" | "editor" | "viewer";
|
|
280
280
|
type AppMemberRole = "owner" | "maintainer" | "editor" | "viewer";
|
|
281
|
+
type ProjectRuntimeEnvScope = {
|
|
282
|
+
repoFingerprint: string;
|
|
283
|
+
environment?: string;
|
|
284
|
+
target?: string;
|
|
285
|
+
};
|
|
286
|
+
type ProjectRuntimeEnvMetadata = {
|
|
287
|
+
id: string;
|
|
288
|
+
projectId: string;
|
|
289
|
+
repoFingerprint: string;
|
|
290
|
+
environment: string;
|
|
291
|
+
target: string;
|
|
292
|
+
name: string;
|
|
293
|
+
inheritancePolicy: string;
|
|
294
|
+
createdBy: string;
|
|
295
|
+
updatedBy: string | null;
|
|
296
|
+
createdAt: string;
|
|
297
|
+
updatedAt: string;
|
|
298
|
+
version: number;
|
|
299
|
+
};
|
|
300
|
+
type SetProjectRuntimeEnvPayload = ProjectRuntimeEnvScope & {
|
|
301
|
+
value: string;
|
|
302
|
+
inheritancePolicy?: "project_family" | "none";
|
|
303
|
+
};
|
|
304
|
+
type ImportProjectRuntimeEnvPayload = ProjectRuntimeEnvScope & {
|
|
305
|
+
content?: string;
|
|
306
|
+
entries?: Record<string, string>;
|
|
307
|
+
inheritancePolicy?: "project_family" | "none";
|
|
308
|
+
};
|
|
309
|
+
type ResolveProjectRuntimeEnvForLocalPullResponse = {
|
|
310
|
+
content: string;
|
|
311
|
+
names: string[];
|
|
312
|
+
};
|
|
313
|
+
type RuntimeTargetKind = "web" | "cli" | "mobile" | "test" | "worker";
|
|
314
|
+
type RuntimeCommandKind = "install" | "dev" | "build" | "preview" | "test" | "custom";
|
|
315
|
+
type ProjectRuntimeTargetScope = {
|
|
316
|
+
repoFingerprint: string;
|
|
317
|
+
environment?: string;
|
|
318
|
+
};
|
|
319
|
+
type ProjectRuntimeTargetMetadata = ProjectRuntimeTargetScope & {
|
|
320
|
+
id?: string;
|
|
321
|
+
projectId?: string;
|
|
322
|
+
targetId: string;
|
|
323
|
+
targetKind: RuntimeTargetKind;
|
|
324
|
+
commandKind: RuntimeCommandKind;
|
|
325
|
+
command: string;
|
|
326
|
+
cwd: string;
|
|
327
|
+
port: number | null;
|
|
328
|
+
readiness: Record<string, unknown>;
|
|
329
|
+
inheritancePolicy?: "project_family" | "none";
|
|
330
|
+
enabled: boolean;
|
|
331
|
+
version?: number;
|
|
332
|
+
};
|
|
333
|
+
type SetProjectRuntimeTargetPayload = ProjectRuntimeTargetScope & {
|
|
334
|
+
targetKind: RuntimeTargetKind;
|
|
335
|
+
commandKind: RuntimeCommandKind;
|
|
336
|
+
command: string;
|
|
337
|
+
cwd?: string;
|
|
338
|
+
port?: number | null;
|
|
339
|
+
readiness?: Record<string, unknown>;
|
|
340
|
+
inheritancePolicy?: "project_family" | "none";
|
|
341
|
+
enabled?: boolean;
|
|
342
|
+
};
|
|
343
|
+
type DetectProjectRuntimeTargetsPayload = Partial<ProjectRuntimeTargetScope> & {
|
|
344
|
+
appId?: string;
|
|
345
|
+
files?: Record<string, string | null>;
|
|
346
|
+
apply?: boolean;
|
|
347
|
+
};
|
|
348
|
+
type RunAppRuntimeTargetPayload = {
|
|
349
|
+
forceInstall?: boolean;
|
|
350
|
+
forceRestart?: boolean;
|
|
351
|
+
environment?: string;
|
|
352
|
+
};
|
|
353
|
+
type RunAppSandboxCommandPayload = {
|
|
354
|
+
command: string;
|
|
355
|
+
cwd?: string;
|
|
356
|
+
timeoutMs?: number;
|
|
357
|
+
environment?: string;
|
|
358
|
+
};
|
|
359
|
+
type AppSandboxCommandRun = {
|
|
360
|
+
id: string;
|
|
361
|
+
appId: string;
|
|
362
|
+
actorUserId: string | null;
|
|
363
|
+
sandboxExternalId: string;
|
|
364
|
+
command: string;
|
|
365
|
+
cwd: string;
|
|
366
|
+
environment: string;
|
|
367
|
+
status: "succeeded" | "failed" | "timed_out";
|
|
368
|
+
exitCode: number | null;
|
|
369
|
+
stdout: string;
|
|
370
|
+
stderr: string;
|
|
371
|
+
startedAt: string;
|
|
372
|
+
finishedAt: string;
|
|
373
|
+
durationMs: number;
|
|
374
|
+
metadata: Record<string, unknown> | null;
|
|
375
|
+
};
|
|
376
|
+
type TriggerIntegrationStatus = "available" | "planned";
|
|
377
|
+
type TriggerEventMetadata = {
|
|
378
|
+
eventType: string;
|
|
379
|
+
label: string;
|
|
380
|
+
category: string;
|
|
381
|
+
description: string;
|
|
382
|
+
integrationStatus: TriggerIntegrationStatus;
|
|
383
|
+
};
|
|
384
|
+
type TriggerMode = "blocking" | "async";
|
|
385
|
+
type TriggerStepType = "shell" | "runtime_target";
|
|
386
|
+
type TriggerEventSource = "backend" | "cli" | "cursor_plugin" | "claude_plugin" | "dashboard" | "mcp";
|
|
387
|
+
type ProjectTriggerScope = {
|
|
388
|
+
repoFingerprint: string;
|
|
389
|
+
environment?: string;
|
|
390
|
+
eventType?: string;
|
|
391
|
+
};
|
|
392
|
+
type ProjectTriggerStepPayload = {
|
|
393
|
+
name?: string | null;
|
|
394
|
+
type: TriggerStepType;
|
|
395
|
+
command?: string | null;
|
|
396
|
+
runtimeTargetId?: string | null;
|
|
397
|
+
cwd?: string | null;
|
|
398
|
+
timeoutMs?: number | null;
|
|
399
|
+
continueOnFailure?: boolean;
|
|
400
|
+
env?: Record<string, string>;
|
|
401
|
+
metadata?: Record<string, unknown>;
|
|
402
|
+
};
|
|
403
|
+
type ProjectTriggerPayload = ProjectTriggerScope & {
|
|
404
|
+
eventType: string;
|
|
405
|
+
name: string;
|
|
406
|
+
description?: string | null;
|
|
407
|
+
enabled?: boolean;
|
|
408
|
+
mode?: TriggerMode;
|
|
409
|
+
priority?: number;
|
|
410
|
+
steps?: ProjectTriggerStepPayload[];
|
|
411
|
+
};
|
|
412
|
+
type UpdateProjectTriggerPayload = Partial<ProjectTriggerPayload>;
|
|
413
|
+
type RunAppTriggerPayload = {
|
|
414
|
+
eventSource?: TriggerEventSource;
|
|
415
|
+
eventContext?: Record<string, unknown>;
|
|
416
|
+
correlationId?: string | null;
|
|
417
|
+
};
|
|
418
|
+
type RunAppTriggerEventPayload = RunAppTriggerPayload & {
|
|
419
|
+
eventType: string;
|
|
420
|
+
environment?: string;
|
|
421
|
+
};
|
|
422
|
+
type ProjectTriggerStep = {
|
|
423
|
+
id: string;
|
|
424
|
+
triggerId: string;
|
|
425
|
+
position: number;
|
|
426
|
+
name: string | null;
|
|
427
|
+
type: string;
|
|
428
|
+
command: string | null;
|
|
429
|
+
runtimeTargetId: string | null;
|
|
430
|
+
cwd: string | null;
|
|
431
|
+
timeoutMs: number | null;
|
|
432
|
+
continueOnFailure: boolean;
|
|
433
|
+
env: Json;
|
|
434
|
+
metadata: Json;
|
|
435
|
+
createdAt: string;
|
|
436
|
+
updatedAt: string;
|
|
437
|
+
};
|
|
438
|
+
type ProjectTrigger = {
|
|
439
|
+
id: string;
|
|
440
|
+
projectId: string;
|
|
441
|
+
repoFingerprint: string;
|
|
442
|
+
environment: string;
|
|
443
|
+
eventType: string;
|
|
444
|
+
name: string;
|
|
445
|
+
description: string | null;
|
|
446
|
+
enabled: boolean;
|
|
447
|
+
mode: string;
|
|
448
|
+
priority: number;
|
|
449
|
+
createdBy: string | null;
|
|
450
|
+
createdAt: string;
|
|
451
|
+
updatedAt: string;
|
|
452
|
+
steps: ProjectTriggerStep[];
|
|
453
|
+
};
|
|
454
|
+
type TriggerStepRun = {
|
|
455
|
+
id: string;
|
|
456
|
+
triggerRunId: string;
|
|
457
|
+
triggerStepId: string | null;
|
|
458
|
+
position: number;
|
|
459
|
+
status: string;
|
|
460
|
+
startedAt: string | null;
|
|
461
|
+
finishedAt: string | null;
|
|
462
|
+
durationMs: number | null;
|
|
463
|
+
typeSnapshot: string;
|
|
464
|
+
commandSnapshot: string | null;
|
|
465
|
+
runtimeTargetIdSnapshot: string | null;
|
|
466
|
+
cwdSnapshot: string | null;
|
|
467
|
+
timeoutMsSnapshot: number | null;
|
|
468
|
+
executorType: string;
|
|
469
|
+
executorId: string | null;
|
|
470
|
+
appId: string | null;
|
|
471
|
+
sandboxExternalId: string | null;
|
|
472
|
+
localRepoRoot: string | null;
|
|
473
|
+
exitCode: number | null;
|
|
474
|
+
stdout: string;
|
|
475
|
+
stderr: string;
|
|
476
|
+
linkedSandboxCommandRunId: string | null;
|
|
477
|
+
metadata: Json;
|
|
478
|
+
createdAt: string;
|
|
479
|
+
};
|
|
480
|
+
type TriggerRun = {
|
|
481
|
+
id: string;
|
|
482
|
+
triggerId: string | null;
|
|
483
|
+
projectId: string;
|
|
484
|
+
appId: string | null;
|
|
485
|
+
eventType: string;
|
|
486
|
+
eventSource: string;
|
|
487
|
+
eventContext: Json;
|
|
488
|
+
mode: string;
|
|
489
|
+
status: string;
|
|
490
|
+
correlationId: string | null;
|
|
491
|
+
createdBy: string | null;
|
|
492
|
+
startedAt: string | null;
|
|
493
|
+
finishedAt: string | null;
|
|
494
|
+
createdAt: string;
|
|
495
|
+
stepRuns: TriggerStepRun[];
|
|
496
|
+
};
|
|
281
497
|
type AppContextAccessPath = "public" | "app_member" | "project_member" | "org_member";
|
|
282
498
|
type AppContext = {
|
|
283
499
|
appId: string;
|
|
284
500
|
projectId: string;
|
|
501
|
+
repoFingerprint: string | null;
|
|
285
502
|
organizationId: string;
|
|
286
503
|
visibility: "public" | "private";
|
|
287
504
|
accessPath: AppContextAccessPath;
|
|
@@ -370,6 +587,46 @@ type ApiClient = {
|
|
|
370
587
|
clientAppId?: string;
|
|
371
588
|
}): Promise<Json>;
|
|
372
589
|
getProject(projectId: string): Promise<Json>;
|
|
590
|
+
listProjectRuntimeEnv(projectId: string, params: ProjectRuntimeEnvScope): Promise<Json>;
|
|
591
|
+
setProjectRuntimeEnv(projectId: string, name: string, payload: SetProjectRuntimeEnvPayload): Promise<Json>;
|
|
592
|
+
importProjectRuntimeEnv(projectId: string, payload: ImportProjectRuntimeEnvPayload): Promise<Json>;
|
|
593
|
+
deleteProjectRuntimeEnv(projectId: string, name: string, params: ProjectRuntimeEnvScope): Promise<Json>;
|
|
594
|
+
resolveProjectRuntimeEnvForLocalPull(projectId: string, payload: ProjectRuntimeEnvScope): Promise<ResolveProjectRuntimeEnvForLocalPullResponse | Json>;
|
|
595
|
+
listProjectRuntimeTargets(projectId: string, params: ProjectRuntimeTargetScope): Promise<Json>;
|
|
596
|
+
detectProjectRuntimeTargets(projectId: string, payload: DetectProjectRuntimeTargetsPayload): Promise<Json>;
|
|
597
|
+
setProjectRuntimeTarget(projectId: string, targetId: string, payload: SetProjectRuntimeTargetPayload): Promise<Json>;
|
|
598
|
+
deleteProjectRuntimeTarget(projectId: string, targetId: string, params: ProjectRuntimeTargetScope): Promise<Json>;
|
|
599
|
+
runAppRuntimeTarget(appId: string, targetId: string, payload?: RunAppRuntimeTargetPayload): Promise<Json>;
|
|
600
|
+
getAppRuntimeTargetStatus(appId: string, targetId: string, params?: {
|
|
601
|
+
environment?: string;
|
|
602
|
+
}): Promise<Json>;
|
|
603
|
+
getAppRuntimeTargetLogs(appId: string, targetId: string, params?: {
|
|
604
|
+
environment?: string;
|
|
605
|
+
limit?: number;
|
|
606
|
+
}): Promise<Json>;
|
|
607
|
+
stopAppRuntimeTarget(appId: string, targetId: string, payload?: {
|
|
608
|
+
environment?: string;
|
|
609
|
+
}): Promise<Json>;
|
|
610
|
+
runAppSandboxCommand(appId: string, payload: RunAppSandboxCommandPayload): Promise<Json>;
|
|
611
|
+
listAppSandboxCommandHistory(appId: string, params?: {
|
|
612
|
+
limit?: number;
|
|
613
|
+
}): Promise<Json>;
|
|
614
|
+
listProjectTriggerEvents(projectId: string): Promise<Json>;
|
|
615
|
+
listProjectTriggers(projectId: string, params?: Partial<ProjectTriggerScope>): Promise<Json>;
|
|
616
|
+
createProjectTrigger(projectId: string, payload: ProjectTriggerPayload): Promise<Json>;
|
|
617
|
+
updateProjectTrigger(projectId: string, triggerId: string, payload: UpdateProjectTriggerPayload): Promise<Json>;
|
|
618
|
+
deleteProjectTrigger(projectId: string, triggerId: string): Promise<Json>;
|
|
619
|
+
resolveProjectTriggers(projectId: string, params: ProjectTriggerScope & {
|
|
620
|
+
eventType: string;
|
|
621
|
+
}): Promise<Json>;
|
|
622
|
+
runAppTrigger(appId: string, triggerId: string, payload?: RunAppTriggerPayload): Promise<Json>;
|
|
623
|
+
runAppTriggerEvent(appId: string, payload: RunAppTriggerEventPayload): Promise<Json>;
|
|
624
|
+
listProjectTriggerRuns(projectId: string, params?: {
|
|
625
|
+
limit?: number;
|
|
626
|
+
eventType?: string;
|
|
627
|
+
appId?: string;
|
|
628
|
+
}): Promise<Json>;
|
|
629
|
+
getProjectTriggerRun(projectId: string, runId: string): Promise<Json>;
|
|
373
630
|
resolveProjectBinding(params: {
|
|
374
631
|
repoFingerprint?: string;
|
|
375
632
|
remoteUrl?: string;
|
|
@@ -623,6 +880,14 @@ type ApiClient = {
|
|
|
623
880
|
limit?: number;
|
|
624
881
|
offset?: number;
|
|
625
882
|
}): Promise<Json>;
|
|
883
|
+
listMergeRequestInbox(params?: {
|
|
884
|
+
status?: string | string[];
|
|
885
|
+
kind?: string;
|
|
886
|
+
limit?: number;
|
|
887
|
+
offset?: number;
|
|
888
|
+
includeReview?: boolean;
|
|
889
|
+
includeDiffs?: boolean;
|
|
890
|
+
}): Promise<Json>;
|
|
626
891
|
openMergeRequest(sourceAppId: string): Promise<Json>;
|
|
627
892
|
getMergeRequestReview(mrId: string): Promise<Json>;
|
|
628
893
|
updateMergeRequest(mrId: string, payload: {
|
|
@@ -774,4 +1039,4 @@ declare function createApiClient(config: CoreConfig, opts?: {
|
|
|
774
1039
|
defaultRequestTimeoutMs?: number;
|
|
775
1040
|
}): ApiClient;
|
|
776
1041
|
|
|
777
|
-
export { type AgentMemoryItem, type AgentMemoryKind, type AgentMemorySearchItem, type AgentMemorySearchResponse, type AgentMemorySummary, type AgentMemoryTimelineResponse, type ApiClient, type AppContext, type AppContextAccessPath, type AppReconcileResponse, type Bundle, type BundlePlatform, type BundleStatus, type ChangeStepDiffResponse, type HistoricalTurnRecord, type HistoryImportCaptureSource, type HistoryImportProvider, type HistoryImportRecordMetadata, type HistoryImportWorkspaceMetadata, type ImportHistoryRecordOutcome, type ImportHistoryRequest, type ImportHistoryResponse, type InitiateBundleRequest, type InvitationRecord, type MergeRequest, type MergeRequestReview, type MergeRequestStatus, type ReconcilePreflightResponse, type SyncLocalResponse, type SyncUpstreamResponse, createApiClient };
|
|
1042
|
+
export { type AgentMemoryItem, type AgentMemoryKind, type AgentMemorySearchItem, type AgentMemorySearchResponse, type AgentMemorySummary, type AgentMemoryTimelineResponse, type ApiClient, type AppContext, type AppContextAccessPath, type AppReconcileResponse, type AppSandboxCommandRun, type Bundle, type BundlePlatform, type BundleStatus, type ChangeStepDiffResponse, type DetectProjectRuntimeTargetsPayload, type HistoricalTurnRecord, type HistoryImportCaptureSource, type HistoryImportProvider, type HistoryImportRecordMetadata, type HistoryImportWorkspaceMetadata, type ImportHistoryRecordOutcome, type ImportHistoryRequest, type ImportHistoryResponse, type ImportProjectRuntimeEnvPayload, type InitiateBundleRequest, type InvitationRecord, type MergeRequest, type MergeRequestReview, type MergeRequestStatus, type ProjectRuntimeEnvMetadata, type ProjectRuntimeEnvScope, type ProjectRuntimeTargetMetadata, type ProjectRuntimeTargetScope, type ProjectTrigger, type ProjectTriggerPayload, type ProjectTriggerScope, type ProjectTriggerStep, type ProjectTriggerStepPayload, type ReconcilePreflightResponse, type ResolveProjectRuntimeEnvForLocalPullResponse, type RunAppRuntimeTargetPayload, type RunAppSandboxCommandPayload, type RunAppTriggerEventPayload, type RunAppTriggerPayload, type RuntimeCommandKind, type RuntimeTargetKind, type SetProjectRuntimeEnvPayload, type SetProjectRuntimeTargetPayload, type SyncLocalResponse, type SyncUpstreamResponse, type TriggerEventMetadata, type TriggerEventSource, type TriggerIntegrationStatus, type TriggerMode, type TriggerRun, type TriggerStepRun, type TriggerStepType, type UpdateProjectTriggerPayload, createApiClient };
|
package/dist/api.js
CHANGED
package/dist/auth.js
CHANGED
package/dist/binding.js
CHANGED
|
@@ -58,6 +58,29 @@ function createApiClient(config, opts) {
|
|
|
58
58
|
const json = await readJsonSafe(res);
|
|
59
59
|
return json ?? null;
|
|
60
60
|
}
|
|
61
|
+
function runtimeEnvQuery(params) {
|
|
62
|
+
const qs = new URLSearchParams();
|
|
63
|
+
if (params?.repoFingerprint) qs.set("repoFingerprint", params.repoFingerprint);
|
|
64
|
+
if (params?.environment) qs.set("environment", params.environment);
|
|
65
|
+
if (params?.target) qs.set("target", params.target);
|
|
66
|
+
return qs.toString();
|
|
67
|
+
}
|
|
68
|
+
function runtimeTargetQuery(params) {
|
|
69
|
+
const qs = new URLSearchParams();
|
|
70
|
+
if (params?.repoFingerprint) qs.set("repoFingerprint", params.repoFingerprint);
|
|
71
|
+
if (params?.environment) qs.set("environment", params.environment);
|
|
72
|
+
if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
|
|
73
|
+
return qs.toString();
|
|
74
|
+
}
|
|
75
|
+
function triggerQuery(params) {
|
|
76
|
+
const qs = new URLSearchParams();
|
|
77
|
+
if (params?.repoFingerprint) qs.set("repoFingerprint", params.repoFingerprint);
|
|
78
|
+
if (params?.environment) qs.set("environment", params.environment);
|
|
79
|
+
if (params?.eventType) qs.set("eventType", params.eventType);
|
|
80
|
+
if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
|
|
81
|
+
if (params?.appId) qs.set("appId", params.appId);
|
|
82
|
+
return qs.toString();
|
|
83
|
+
}
|
|
61
84
|
async function requestBinary(path, init, opts2) {
|
|
62
85
|
if (!tokenProvider) {
|
|
63
86
|
throw new RemixError("API client is missing a token provider.", {
|
|
@@ -111,6 +134,120 @@ function createApiClient(config, opts) {
|
|
|
111
134
|
return request(`/v1/projects${suffix}`, { method: "GET" });
|
|
112
135
|
},
|
|
113
136
|
getProject: (projectId) => request(`/v1/projects/${encodeURIComponent(projectId)}`, { method: "GET" }),
|
|
137
|
+
listProjectRuntimeEnv: (projectId, params) => {
|
|
138
|
+
const qs = runtimeEnvQuery(params);
|
|
139
|
+
const suffix = qs ? `?${qs}` : "";
|
|
140
|
+
return request(`/v1/projects/${encodeURIComponent(projectId)}/repo-env${suffix}`, { method: "GET" });
|
|
141
|
+
},
|
|
142
|
+
setProjectRuntimeEnv: (projectId, name, payload) => request(`/v1/projects/${encodeURIComponent(projectId)}/repo-env/${encodeURIComponent(name)}`, {
|
|
143
|
+
method: "PUT",
|
|
144
|
+
body: JSON.stringify(payload)
|
|
145
|
+
}),
|
|
146
|
+
importProjectRuntimeEnv: (projectId, payload) => request(`/v1/projects/${encodeURIComponent(projectId)}/repo-env/import`, {
|
|
147
|
+
method: "POST",
|
|
148
|
+
body: JSON.stringify(payload)
|
|
149
|
+
}),
|
|
150
|
+
deleteProjectRuntimeEnv: (projectId, name, params) => {
|
|
151
|
+
const qs = runtimeEnvQuery(params);
|
|
152
|
+
const suffix = qs ? `?${qs}` : "";
|
|
153
|
+
return request(`/v1/projects/${encodeURIComponent(projectId)}/repo-env/${encodeURIComponent(name)}${suffix}`, {
|
|
154
|
+
method: "DELETE"
|
|
155
|
+
});
|
|
156
|
+
},
|
|
157
|
+
resolveProjectRuntimeEnvForLocalPull: (projectId, payload) => request(`/v1/projects/${encodeURIComponent(projectId)}/repo-env/resolve-local`, {
|
|
158
|
+
method: "POST",
|
|
159
|
+
body: JSON.stringify(payload)
|
|
160
|
+
}),
|
|
161
|
+
listProjectRuntimeTargets: (projectId, params) => {
|
|
162
|
+
const qs = runtimeTargetQuery(params);
|
|
163
|
+
const suffix = qs ? `?${qs}` : "";
|
|
164
|
+
return request(`/v1/projects/${encodeURIComponent(projectId)}/runtime-targets${suffix}`, { method: "GET" });
|
|
165
|
+
},
|
|
166
|
+
detectProjectRuntimeTargets: (projectId, payload) => request(`/v1/projects/${encodeURIComponent(projectId)}/runtime-targets/detect`, {
|
|
167
|
+
method: "POST",
|
|
168
|
+
body: JSON.stringify(payload)
|
|
169
|
+
}),
|
|
170
|
+
setProjectRuntimeTarget: (projectId, targetId, payload) => request(`/v1/projects/${encodeURIComponent(projectId)}/runtime-targets/${encodeURIComponent(targetId)}`, {
|
|
171
|
+
method: "PUT",
|
|
172
|
+
body: JSON.stringify(payload)
|
|
173
|
+
}),
|
|
174
|
+
deleteProjectRuntimeTarget: (projectId, targetId, params) => {
|
|
175
|
+
const qs = runtimeTargetQuery(params);
|
|
176
|
+
const suffix = qs ? `?${qs}` : "";
|
|
177
|
+
return request(`/v1/projects/${encodeURIComponent(projectId)}/runtime-targets/${encodeURIComponent(targetId)}${suffix}`, {
|
|
178
|
+
method: "DELETE"
|
|
179
|
+
});
|
|
180
|
+
},
|
|
181
|
+
runAppRuntimeTarget: (appId, targetId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/runtime-targets/${encodeURIComponent(targetId)}/run`, {
|
|
182
|
+
method: "POST",
|
|
183
|
+
body: JSON.stringify(payload ?? {})
|
|
184
|
+
}),
|
|
185
|
+
getAppRuntimeTargetStatus: (appId, targetId, params) => {
|
|
186
|
+
const qs = runtimeTargetQuery(params);
|
|
187
|
+
const suffix = qs ? `?${qs}` : "";
|
|
188
|
+
return request(`/v1/apps/${encodeURIComponent(appId)}/runtime-targets/${encodeURIComponent(targetId)}/status${suffix}`, {
|
|
189
|
+
method: "GET"
|
|
190
|
+
});
|
|
191
|
+
},
|
|
192
|
+
getAppRuntimeTargetLogs: (appId, targetId, params) => {
|
|
193
|
+
const qs = runtimeTargetQuery(params);
|
|
194
|
+
const suffix = qs ? `?${qs}` : "";
|
|
195
|
+
return request(`/v1/apps/${encodeURIComponent(appId)}/runtime-targets/${encodeURIComponent(targetId)}/logs${suffix}`, {
|
|
196
|
+
method: "GET"
|
|
197
|
+
});
|
|
198
|
+
},
|
|
199
|
+
stopAppRuntimeTarget: (appId, targetId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/runtime-targets/${encodeURIComponent(targetId)}/stop`, {
|
|
200
|
+
method: "POST",
|
|
201
|
+
body: JSON.stringify(payload ?? {})
|
|
202
|
+
}),
|
|
203
|
+
runAppSandboxCommand: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/sandbox/commands/run`, {
|
|
204
|
+
method: "POST",
|
|
205
|
+
body: JSON.stringify(payload)
|
|
206
|
+
}),
|
|
207
|
+
listAppSandboxCommandHistory: (appId, params) => {
|
|
208
|
+
const qs = new URLSearchParams();
|
|
209
|
+
if (params?.limit !== void 0) qs.set("limit", String(params.limit));
|
|
210
|
+
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
211
|
+
return request(`/v1/apps/${encodeURIComponent(appId)}/sandbox/commands/history${suffix}`, { method: "GET" });
|
|
212
|
+
},
|
|
213
|
+
listProjectTriggerEvents: (projectId) => request(`/v1/projects/${encodeURIComponent(projectId)}/triggers/events`, { method: "GET" }),
|
|
214
|
+
listProjectTriggers: (projectId, params) => {
|
|
215
|
+
const qs = triggerQuery(params);
|
|
216
|
+
const suffix = qs ? `?${qs}` : "";
|
|
217
|
+
return request(`/v1/projects/${encodeURIComponent(projectId)}/triggers${suffix}`, { method: "GET" });
|
|
218
|
+
},
|
|
219
|
+
createProjectTrigger: (projectId, payload) => request(`/v1/projects/${encodeURIComponent(projectId)}/triggers`, {
|
|
220
|
+
method: "POST",
|
|
221
|
+
body: JSON.stringify(payload)
|
|
222
|
+
}),
|
|
223
|
+
updateProjectTrigger: (projectId, triggerId, payload) => request(`/v1/projects/${encodeURIComponent(projectId)}/triggers/${encodeURIComponent(triggerId)}`, {
|
|
224
|
+
method: "PATCH",
|
|
225
|
+
body: JSON.stringify(payload)
|
|
226
|
+
}),
|
|
227
|
+
deleteProjectTrigger: (projectId, triggerId) => request(`/v1/projects/${encodeURIComponent(projectId)}/triggers/${encodeURIComponent(triggerId)}`, {
|
|
228
|
+
method: "DELETE"
|
|
229
|
+
}),
|
|
230
|
+
resolveProjectTriggers: (projectId, params) => {
|
|
231
|
+
const qs = triggerQuery(params);
|
|
232
|
+
const suffix = qs ? `?${qs}` : "";
|
|
233
|
+
return request(`/v1/projects/${encodeURIComponent(projectId)}/triggers/resolve${suffix}`, { method: "GET" });
|
|
234
|
+
},
|
|
235
|
+
runAppTrigger: (appId, triggerId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/triggers/${encodeURIComponent(triggerId)}/run`, {
|
|
236
|
+
method: "POST",
|
|
237
|
+
body: JSON.stringify(payload ?? {})
|
|
238
|
+
}),
|
|
239
|
+
runAppTriggerEvent: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/triggers/run-event`, {
|
|
240
|
+
method: "POST",
|
|
241
|
+
body: JSON.stringify(payload)
|
|
242
|
+
}),
|
|
243
|
+
listProjectTriggerRuns: (projectId, params) => {
|
|
244
|
+
const qs = triggerQuery(params);
|
|
245
|
+
const suffix = qs ? `?${qs}` : "";
|
|
246
|
+
return request(`/v1/projects/${encodeURIComponent(projectId)}/triggers/runs${suffix}`, { method: "GET" });
|
|
247
|
+
},
|
|
248
|
+
getProjectTriggerRun: (projectId, runId) => request(`/v1/projects/${encodeURIComponent(projectId)}/triggers/runs/${encodeURIComponent(runId)}`, {
|
|
249
|
+
method: "GET"
|
|
250
|
+
}),
|
|
114
251
|
resolveProjectBinding: (params) => {
|
|
115
252
|
const qs = new URLSearchParams();
|
|
116
253
|
if (params.repoFingerprint) qs.set("repoFingerprint", params.repoFingerprint);
|
|
@@ -283,6 +420,21 @@ function createApiClient(config, opts) {
|
|
|
283
420
|
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
284
421
|
return request(`/v1/merge-requests${suffix}`, { method: "GET" });
|
|
285
422
|
},
|
|
423
|
+
listMergeRequestInbox: (params) => {
|
|
424
|
+
const qs = new URLSearchParams();
|
|
425
|
+
if (Array.isArray(params?.status)) {
|
|
426
|
+
for (const status of params.status) qs.append("status", status);
|
|
427
|
+
} else if (typeof params?.status === "string") {
|
|
428
|
+
qs.set("status", params.status);
|
|
429
|
+
}
|
|
430
|
+
if (params?.kind) qs.set("kind", params.kind);
|
|
431
|
+
if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
|
|
432
|
+
if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
|
|
433
|
+
if (typeof params?.includeReview === "boolean") qs.set("includeReview", String(params.includeReview));
|
|
434
|
+
if (typeof params?.includeDiffs === "boolean") qs.set("includeDiffs", String(params.includeDiffs));
|
|
435
|
+
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
436
|
+
return request(`/v1/merge-requests/inbox${suffix}`, { method: "GET" });
|
|
437
|
+
},
|
|
286
438
|
openMergeRequest: (sourceAppId) => request("/v1/merge-requests", { method: "POST", body: JSON.stringify({ sourceAppId }) }),
|
|
287
439
|
getMergeRequestReview: (mrId) => request(`/v1/merge-requests/${encodeURIComponent(mrId)}/review`, { method: "GET" }),
|
|
288
440
|
updateMergeRequest: (mrId, payload) => request(`/v1/merge-requests/${encodeURIComponent(mrId)}`, { method: "PATCH", body: JSON.stringify(payload) }),
|
|
@@ -5,8 +5,13 @@ import {
|
|
|
5
5
|
// src/config/model.ts
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
var DEFAULT_API_URL = "https://api.remix.one";
|
|
8
|
-
var DEFAULT_SUPABASE_URL = "https://
|
|
9
|
-
var DEFAULT_SUPABASE_ANON_KEY = "
|
|
8
|
+
var DEFAULT_SUPABASE_URL = "https://iheivdccexqigeoiekvc.supabase.co";
|
|
9
|
+
var DEFAULT_SUPABASE_ANON_KEY = "sb_publishable_YipyrVON-lwzW3ugjE3T1g_cE2do_JW";
|
|
10
|
+
var defaultConfigRaw = {
|
|
11
|
+
apiUrl: DEFAULT_API_URL,
|
|
12
|
+
supabaseUrl: DEFAULT_SUPABASE_URL,
|
|
13
|
+
supabaseAnonKey: DEFAULT_SUPABASE_ANON_KEY
|
|
14
|
+
};
|
|
10
15
|
function isValidUrl(value) {
|
|
11
16
|
try {
|
|
12
17
|
new URL(value);
|
|
@@ -24,12 +29,7 @@ var configSchema = z.object({
|
|
|
24
29
|
var cachedConfig = null;
|
|
25
30
|
async function resolveConfig(_opts) {
|
|
26
31
|
if (cachedConfig) return cachedConfig;
|
|
27
|
-
const
|
|
28
|
-
apiUrl: DEFAULT_API_URL,
|
|
29
|
-
supabaseUrl: DEFAULT_SUPABASE_URL,
|
|
30
|
-
supabaseAnonKey: DEFAULT_SUPABASE_ANON_KEY
|
|
31
|
-
};
|
|
32
|
-
const parsedCfg = configSchema.safeParse(cfgRaw);
|
|
32
|
+
const parsedCfg = configSchema.safeParse(defaultConfigRaw);
|
|
33
33
|
if (!parsedCfg.success) {
|
|
34
34
|
throw new RemixError("Invalid core configuration.", {
|
|
35
35
|
exitCode: 1,
|
|
@@ -19,6 +19,7 @@ var storedSessionSchema = z.object({
|
|
|
19
19
|
import fs from "fs/promises";
|
|
20
20
|
import os from "os";
|
|
21
21
|
import path from "path";
|
|
22
|
+
var loadKeytarModule = () => new Function("return import('keytar')")();
|
|
22
23
|
function xdgConfigHome() {
|
|
23
24
|
const value = process.env.XDG_CONFIG_HOME;
|
|
24
25
|
if (typeof value === "string" && value.trim()) return value;
|
|
@@ -26,7 +27,7 @@ function xdgConfigHome() {
|
|
|
26
27
|
}
|
|
27
28
|
async function maybeLoadKeytar() {
|
|
28
29
|
try {
|
|
29
|
-
const mod = await
|
|
30
|
+
const mod = await loadKeytarModule();
|
|
30
31
|
const candidates = [mod, mod?.default].filter(Boolean);
|
|
31
32
|
for (const candidate of candidates) {
|
|
32
33
|
const value = candidate;
|
|
@@ -75,6 +75,13 @@ function normalizeProjectId(value) {
|
|
|
75
75
|
const normalized = String(value ?? "").trim();
|
|
76
76
|
return normalized || null;
|
|
77
77
|
}
|
|
78
|
+
async function readCurrentBranchOrNull(repoRoot) {
|
|
79
|
+
try {
|
|
80
|
+
return normalizeBranchName(await getCurrentBranch(repoRoot));
|
|
81
|
+
} catch {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
78
85
|
function normalizeBranchBinding(value) {
|
|
79
86
|
if (!value?.currentAppId || !value?.upstreamAppId) return null;
|
|
80
87
|
return {
|
|
@@ -121,7 +128,7 @@ async function readCollabBindingState(repoRoot, options) {
|
|
|
121
128
|
const raw = await fs2.readFile(filePath, "utf8");
|
|
122
129
|
const parsed = JSON.parse(raw);
|
|
123
130
|
if (!parsed || typeof parsed !== "object") return null;
|
|
124
|
-
const currentBranch =
|
|
131
|
+
const currentBranch = await readCurrentBranchOrNull(repoRoot);
|
|
125
132
|
if (parsed.schemaVersion === 1) {
|
|
126
133
|
if (!parsed.currentAppId || !parsed.upstreamAppId) return null;
|
|
127
134
|
const projectId = normalizeProjectId(parsed.projectId);
|
|
@@ -281,7 +288,7 @@ async function readCollabBinding(repoRoot) {
|
|
|
281
288
|
}
|
|
282
289
|
async function writeCollabBinding(repoRoot, binding) {
|
|
283
290
|
const filePath = getCollabBindingPath(repoRoot);
|
|
284
|
-
const currentBranch =
|
|
291
|
+
const currentBranch = await readCurrentBranchOrNull(repoRoot);
|
|
285
292
|
const branchName = normalizeBranchName(binding.branchName) ?? currentBranch ?? binding.defaultBranch ?? "main";
|
|
286
293
|
const existing = await readCollabBindingState(repoRoot, { persist: true });
|
|
287
294
|
const branchBindings = { ...existing?.branchBindings ?? {} };
|
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-CuTwLa6w.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-CuTwLa6w.js';
|
|
3
3
|
import { B as BranchBindingMode } from './binding-WiIRI2fl.js';
|
|
4
4
|
|
|
5
5
|
declare function collabFinalizeTurn(params: {
|
|
@@ -43,6 +43,7 @@ declare function collabFinalizeTurn(params: {
|
|
|
43
43
|
* When unset/null/0, behavior is unchanged: `nextRetryAt: null`, drain-immediately.
|
|
44
44
|
*/
|
|
45
45
|
awaitingUsageDeadlineMs?: number | null;
|
|
46
|
+
initPostAwaitTimeoutMs?: number | null;
|
|
46
47
|
}): Promise<CollabFinalizeTurnResult>;
|
|
47
48
|
|
|
48
49
|
declare const FINALIZE_PREFLIGHT_FAILURE_CODES: readonly ["not_bound", "branch_binding_missing", "family_ambiguous", "metadata_conflict", "branch_mismatch", "missing_head", "remote_error", "pull_required", "reconcile_required", "baseline_missing"];
|
package/dist/collab.js
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
writeCollabBinding,
|
|
9
9
|
writeCollabBindingSnapshot,
|
|
10
10
|
writeJsonAtomic
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-P4XIICU3.js";
|
|
12
12
|
import {
|
|
13
13
|
applyUnifiedDiffToWorktree,
|
|
14
14
|
assertRepoSnapshotUnchanged,
|
|
@@ -438,7 +438,7 @@ async function summarizeAsyncJobs(params) {
|
|
|
438
438
|
summary.newestCreatedAt = active[active.length - 1]?.createdAt ?? null;
|
|
439
439
|
if (summary.processingJobCount > 0) summary.state = "processing";
|
|
440
440
|
else if (summary.queuedJobCount > 0) summary.state = "queued";
|
|
441
|
-
else
|
|
441
|
+
else summary.state = "failed";
|
|
442
442
|
return summary;
|
|
443
443
|
}
|
|
444
444
|
async function pruneTerminalAsyncJobs() {
|
|
@@ -634,7 +634,9 @@ async function inspectLocalSnapshot(params) {
|
|
|
634
634
|
repoRoot,
|
|
635
635
|
repoFingerprint: params.repoFingerprint ?? null,
|
|
636
636
|
laneId: params.laneId ?? null,
|
|
637
|
+
/* v8 ignore next -- branch fallback only applies when git branch lookup races/fails. */
|
|
637
638
|
branchName: params.branchName ?? await getCurrentBranch(repoRoot).catch(() => null),
|
|
639
|
+
/* v8 ignore next -- commit fallback only applies when git HEAD lookup races/fails. */
|
|
638
640
|
localCommitHash: await getHeadCommitHash(repoRoot).catch(() => null),
|
|
639
641
|
snapshotHash: buildSnapshotHash(normalizedManifest),
|
|
640
642
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -1027,7 +1029,7 @@ async function summarizePendingFinalizeJobs(scope) {
|
|
|
1027
1029
|
summary.state = "retry_scheduled";
|
|
1028
1030
|
} else if (summary.awaitingUsageJobCount > 0) {
|
|
1029
1031
|
summary.state = "awaiting_usage";
|
|
1030
|
-
} else
|
|
1032
|
+
} else {
|
|
1031
1033
|
summary.state = "failed";
|
|
1032
1034
|
}
|
|
1033
1035
|
return summary;
|
|
@@ -1685,9 +1687,11 @@ async function ensureActiveLaneBinding(params) {
|
|
|
1685
1687
|
return persistResolvedLane(params.repoRoot, resolved.binding);
|
|
1686
1688
|
}
|
|
1687
1689
|
if (resolved.status === "binding_conflict") {
|
|
1690
|
+
const serverAppId = resolved.resolvedLane.currentAppId ?? "(unknown)";
|
|
1691
|
+
const operation = params.operation ?? "this command";
|
|
1688
1692
|
throw new RemixError("Current branch binding conflicts with the server-resolved Remix lane.", {
|
|
1689
1693
|
exitCode: 2,
|
|
1690
|
-
hint: `Local app ${resolved.binding.currentAppId}; server app ${
|
|
1694
|
+
hint: `Local app ${resolved.binding.currentAppId}; server app ${serverAppId}. Repair the branch binding before running ${operation}.`
|
|
1691
1695
|
});
|
|
1692
1696
|
}
|
|
1693
1697
|
if (resolved.status === "ambiguous_family_selection") {
|
|
@@ -1799,12 +1803,15 @@ async function collabDetectRepoState(params) {
|
|
|
1799
1803
|
return detected;
|
|
1800
1804
|
}
|
|
1801
1805
|
if (bindingResolution.status === "binding_conflict") {
|
|
1806
|
+
const conflictBranch = bindingResolution.currentBranch ?? "(detached)";
|
|
1807
|
+
const conflictLaneId = bindingResolution.resolvedLane.laneId ?? "(unknown)";
|
|
1808
|
+
const conflictAppId = bindingResolution.resolvedLane.currentAppId ?? "(unknown)";
|
|
1802
1809
|
detected.status = "metadata_conflict";
|
|
1803
1810
|
detected.repoState = "metadata_conflict";
|
|
1804
1811
|
detected.binding = bindingResolution.binding;
|
|
1805
1812
|
detected.currentBranch = bindingResolution.currentBranch;
|
|
1806
1813
|
detected.branchName = bindingResolution.binding.branchName;
|
|
1807
|
-
detected.hint = `Local binding for ${
|
|
1814
|
+
detected.hint = `Local binding for ${conflictBranch} points to app ${bindingResolution.binding.currentAppId}, but the server resolved lane ${conflictLaneId} / app ${conflictAppId}.`;
|
|
1808
1815
|
return detected;
|
|
1809
1816
|
}
|
|
1810
1817
|
const binding = bindingResolution.binding;
|
|
@@ -1831,6 +1838,7 @@ async function collabDetectRepoState(params) {
|
|
|
1831
1838
|
return detected;
|
|
1832
1839
|
}
|
|
1833
1840
|
if (!params.api) {
|
|
1841
|
+
const asyncSummaryBranchName = binding.branchName ?? null;
|
|
1834
1842
|
const [inspection, pendingFinalize, pendingAsyncJobs] = await Promise.all([
|
|
1835
1843
|
inspectLocalSnapshot({
|
|
1836
1844
|
repoRoot,
|
|
@@ -1845,7 +1853,7 @@ async function collabDetectRepoState(params) {
|
|
|
1845
1853
|
currentAppId: binding.currentAppId,
|
|
1846
1854
|
laneId: binding.laneId
|
|
1847
1855
|
}),
|
|
1848
|
-
summarizeAsyncJobs({ repoRoot, branchName:
|
|
1856
|
+
summarizeAsyncJobs({ repoRoot, branchName: asyncSummaryBranchName })
|
|
1849
1857
|
]);
|
|
1850
1858
|
detected.currentSnapshotHash = inspection.snapshotHash;
|
|
1851
1859
|
detected.pendingFinalize = pendingFinalize;
|
|
@@ -1866,6 +1874,7 @@ async function collabDetectRepoState(params) {
|
|
|
1866
1874
|
remoteUrl: binding.remoteUrl ?? void 0,
|
|
1867
1875
|
defaultBranch: binding.defaultBranch ?? void 0
|
|
1868
1876
|
}) : Promise.resolve(null);
|
|
1877
|
+
const asyncSummaryBranchName = binding.branchName ?? null;
|
|
1869
1878
|
const [headResp, inspection, parallelMetadataResp, pendingFinalize, pendingAsyncJobs] = await Promise.all([
|
|
1870
1879
|
getAppHeadCached(params.api, binding.currentAppId),
|
|
1871
1880
|
inspectLocalSnapshot({
|
|
@@ -1882,7 +1891,7 @@ async function collabDetectRepoState(params) {
|
|
|
1882
1891
|
currentAppId: binding.currentAppId,
|
|
1883
1892
|
laneId: binding.laneId
|
|
1884
1893
|
}),
|
|
1885
|
-
summarizeAsyncJobs({ repoRoot, branchName:
|
|
1894
|
+
summarizeAsyncJobs({ repoRoot, branchName: asyncSummaryBranchName })
|
|
1886
1895
|
]);
|
|
1887
1896
|
const appHead = unwrapResponseObject(headResp, "app head");
|
|
1888
1897
|
detected.currentServerRevisionId = appHead.headRevisionId ?? null;
|
|
@@ -2670,7 +2679,9 @@ async function processClaimedPendingFinalizeJobInner(params) {
|
|
|
2670
2679
|
await writeBaselineFromSucceededChangeStep({ api: params.api, job, snapshot, changeStep: changeStep2 });
|
|
2671
2680
|
await updatePendingFinalizeJob(job.id, {
|
|
2672
2681
|
status: "completed",
|
|
2673
|
-
metadata: {
|
|
2682
|
+
metadata: {
|
|
2683
|
+
changeStepId: String(changeStep2.id ?? "")
|
|
2684
|
+
}
|
|
2674
2685
|
});
|
|
2675
2686
|
return {
|
|
2676
2687
|
mode: "changed_turn",
|
|
@@ -2785,7 +2796,9 @@ async function processClaimedPendingFinalizeJobInner(params) {
|
|
|
2785
2796
|
await writeBaselineFromSucceededChangeStep({ api: params.api, job, snapshot, changeStep });
|
|
2786
2797
|
await updatePendingFinalizeJob(job.id, {
|
|
2787
2798
|
status: "completed",
|
|
2788
|
-
metadata: {
|
|
2799
|
+
metadata: {
|
|
2800
|
+
changeStepId: String(changeStep.id ?? "")
|
|
2801
|
+
}
|
|
2789
2802
|
});
|
|
2790
2803
|
return {
|
|
2791
2804
|
mode: "changed_turn",
|
|
@@ -2901,30 +2914,44 @@ async function collabFinalizeTurn(params) {
|
|
|
2901
2914
|
hint: `Init job ${pendingInit.id} is still in the background queue. Run \`remix collab status\` to check progress.`
|
|
2902
2915
|
});
|
|
2903
2916
|
}
|
|
2917
|
+
const failedInitPost = await findFailedAsyncJob({
|
|
2918
|
+
repoRoot,
|
|
2919
|
+
branchName: binding.branchName ?? null,
|
|
2920
|
+
kind: "init_post"
|
|
2921
|
+
});
|
|
2922
|
+
if (failedInitPost) {
|
|
2923
|
+
throw new RemixError("The initial Remix import failed; this turn cannot be recorded.", {
|
|
2924
|
+
exitCode: 2,
|
|
2925
|
+
hint: (failedInitPost.error ? `Last error: ${failedInitPost.error}
|
|
2926
|
+
|
|
2927
|
+
` : "") + "Run `remix collab init` again to retry \u2014 the post-init drainer cleared the local binding so this is safe."
|
|
2928
|
+
});
|
|
2929
|
+
}
|
|
2904
2930
|
const pendingInitPost = await findPendingAsyncJob({
|
|
2905
2931
|
repoRoot,
|
|
2906
2932
|
branchName: binding.branchName ?? null,
|
|
2907
2933
|
kind: "init_post"
|
|
2908
2934
|
});
|
|
2909
2935
|
if (pendingInitPost) {
|
|
2936
|
+
const initPostTimeoutMs = params.initPostAwaitTimeoutMs ?? FINALIZE_AWAIT_INIT_POST_TIMEOUT_MS;
|
|
2910
2937
|
const result = await awaitAsyncJob({
|
|
2911
2938
|
jobId: pendingInitPost.id,
|
|
2912
|
-
timeoutMs:
|
|
2939
|
+
timeoutMs: initPostTimeoutMs,
|
|
2913
2940
|
pollIntervalMs: 500
|
|
2914
2941
|
});
|
|
2915
|
-
if (result.status
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2942
|
+
if (result.status !== "completed") {
|
|
2943
|
+
if (result.status === "failed") {
|
|
2944
|
+
throw new RemixError("The initial Remix import failed; this turn cannot be recorded.", {
|
|
2945
|
+
exitCode: 2,
|
|
2946
|
+
hint: (result.job?.error ? `Last error: ${result.job.error}
|
|
2919
2947
|
|
|
2920
2948
|
` : "") + "Run `remix collab init` again to retry \u2014 the post-init drainer cleared the local binding so this is safe."
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
if (result.status === "timeout") {
|
|
2949
|
+
});
|
|
2950
|
+
}
|
|
2924
2951
|
throw new RemixError("Timed out waiting for the initial Remix import to finish provisioning.", {
|
|
2925
2952
|
exitCode: 2,
|
|
2926
2953
|
hint: `Init post job ${pendingInitPost.id} did not complete within ${Math.round(
|
|
2927
|
-
|
|
2954
|
+
initPostTimeoutMs / 1e3
|
|
2928
2955
|
)}s. Run \`remix collab status\` to check progress, then retry once it reports ready.`
|
|
2929
2956
|
});
|
|
2930
2957
|
}
|
|
@@ -2941,7 +2968,14 @@ async function collabFinalizeTurn(params) {
|
|
|
2941
2968
|
hint: detected.hint
|
|
2942
2969
|
});
|
|
2943
2970
|
}
|
|
2944
|
-
if (detected.status === "branch_binding_missing"
|
|
2971
|
+
if (detected.status === "branch_binding_missing") {
|
|
2972
|
+
throw new RemixError(detected.hint || "Current branch is not ready for Remix recording.", {
|
|
2973
|
+
code: detected.status,
|
|
2974
|
+
exitCode: 2,
|
|
2975
|
+
hint: detected.hint
|
|
2976
|
+
});
|
|
2977
|
+
}
|
|
2978
|
+
if (detected.status === "family_ambiguous") {
|
|
2945
2979
|
throw new RemixError(detected.hint || "Current branch is not ready for Remix recording.", {
|
|
2946
2980
|
code: detected.status,
|
|
2947
2981
|
exitCode: 2,
|
|
@@ -2956,7 +2990,8 @@ async function collabFinalizeTurn(params) {
|
|
|
2956
2990
|
});
|
|
2957
2991
|
}
|
|
2958
2992
|
if (detected.status === "missing_head" || detected.status === "remote_error") {
|
|
2959
|
-
|
|
2993
|
+
const message = detected.hint || "Failed to determine the current repo state.";
|
|
2994
|
+
throw new RemixError(message, {
|
|
2960
2995
|
code: detected.status,
|
|
2961
2996
|
exitCode: 1,
|
|
2962
2997
|
hint: detected.hint
|
|
@@ -2970,10 +3005,11 @@ async function collabFinalizeTurn(params) {
|
|
|
2970
3005
|
});
|
|
2971
3006
|
}
|
|
2972
3007
|
if (detected.repoState === "both_changed") {
|
|
3008
|
+
const hint = detected.hint || "Run `remix collab reconcile --dry-run` to inspect recovery options before retrying.";
|
|
2973
3009
|
throw new RemixError("Local and server changes must be reconciled before finalizing this turn.", {
|
|
2974
3010
|
code: "reconcile_required",
|
|
2975
3011
|
exitCode: 2,
|
|
2976
|
-
hint
|
|
3012
|
+
hint
|
|
2977
3013
|
});
|
|
2978
3014
|
}
|
|
2979
3015
|
if (detected.repoState === "external_local_base_changed") {
|
|
@@ -3237,6 +3273,7 @@ async function tryAcquireLock(lockDir, ownerPath, owner) {
|
|
|
3237
3273
|
}
|
|
3238
3274
|
function formatLockHint(params) {
|
|
3239
3275
|
const lines = [
|
|
3276
|
+
/* v8 ignore next -- observed-held diagnostic only appears after a timed wait. */
|
|
3240
3277
|
params.observedHeldLock ? `Observed lock state: ${REMIX_ERROR_CODES.REPO_LOCK_HELD}.` : null,
|
|
3241
3278
|
params.owner ? `Active operation: ${params.owner.operation}` : "Active operation: unknown",
|
|
3242
3279
|
params.owner ? `Repo root: ${params.owner.repoRoot}` : null,
|
|
@@ -4176,9 +4213,10 @@ function resolveProjectBindingResult(response) {
|
|
|
4176
4213
|
function throwAmbiguousFamilyError(params) {
|
|
4177
4214
|
const familyCount = params.candidateCount || params.projectIds.length;
|
|
4178
4215
|
const projectHint = params.projectIds.length > 0 ? ` Matching project ids: ${params.projectIds.join(", ")}.` : "";
|
|
4216
|
+
const remoteHint = params.remoteUrl ? ` (${params.remoteUrl})` : "";
|
|
4179
4217
|
throw new RemixError("Multiple canonical Remix families already match this repository.", {
|
|
4180
4218
|
exitCode: 2,
|
|
4181
|
-
hint: `Plain \`remix collab init\` cannot safely choose among ${familyCount} matching canonical families for repo fingerprint ${params.repoFingerprint}${
|
|
4219
|
+
hint: `Plain \`remix collab init\` cannot safely choose among ${familyCount} matching canonical families for repo fingerprint ${params.repoFingerprint}${remoteHint}.${projectHint} Run \`remix collab init --force-new\` to create a new canonical family, or continue from a checkout already bound to the intended family.`
|
|
4182
4220
|
});
|
|
4183
4221
|
}
|
|
4184
4222
|
async function resolveOrEnsureLaneBinding(params) {
|
|
@@ -6212,7 +6250,10 @@ async function processInitJob(job, api) {
|
|
|
6212
6250
|
headCommitHash: job.payload.headCommitHash
|
|
6213
6251
|
});
|
|
6214
6252
|
const imported = unwrapResponseObject(importResp, "import");
|
|
6215
|
-
await logDrainerEvent(job.id, "server_accepted", {
|
|
6253
|
+
await logDrainerEvent(job.id, "server_accepted", {
|
|
6254
|
+
kind: "init",
|
|
6255
|
+
appId: String(imported.appId ?? "")
|
|
6256
|
+
});
|
|
6216
6257
|
const app = await pollAppReady(api, String(imported.appId));
|
|
6217
6258
|
let boundProjectId = String(app.projectId);
|
|
6218
6259
|
let boundCurrentAppId = String(app.id);
|
|
@@ -6577,7 +6618,10 @@ async function drainAsyncJobs(opts) {
|
|
|
6577
6618
|
if (opts.respectPidLock !== false && !lockHandle) return [];
|
|
6578
6619
|
const outcomes = [];
|
|
6579
6620
|
try {
|
|
6580
|
-
|
|
6621
|
+
try {
|
|
6622
|
+
await pruneTerminalAsyncJobs();
|
|
6623
|
+
} catch {
|
|
6624
|
+
}
|
|
6581
6625
|
const jobs = await listAsyncJobs();
|
|
6582
6626
|
const drainable = jobs.filter(
|
|
6583
6627
|
(job) => job.status !== "completed" && job.status !== "failed"
|
package/dist/config.js
CHANGED
|
@@ -592,6 +592,14 @@ type CollabApiClient = {
|
|
|
592
592
|
limit?: number;
|
|
593
593
|
offset?: number;
|
|
594
594
|
}): Promise<unknown>;
|
|
595
|
+
listMergeRequestInbox(params?: {
|
|
596
|
+
status?: string | string[];
|
|
597
|
+
kind?: string;
|
|
598
|
+
limit?: number;
|
|
599
|
+
offset?: number;
|
|
600
|
+
includeReview?: boolean;
|
|
601
|
+
includeDiffs?: boolean;
|
|
602
|
+
}): Promise<unknown>;
|
|
595
603
|
listCollabTurns(appId: string, params?: {
|
|
596
604
|
limit?: number;
|
|
597
605
|
offset?: number;
|
package/dist/history.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ export { CliError, REMIX_ERROR_CODES, CliError as RemixError, RemixErrorCode } f
|
|
|
2
2
|
export { CoreConfig, ResolveConfigOptions, configSchema, resolveConfig } from './config.js';
|
|
3
3
|
export { S as SessionStore, a as StoredSession, c as createStoredSessionTokenProvider, s as shouldRefreshSoon, b as storedSessionSchema } from './tokenProvider-BWTusyj4.js';
|
|
4
4
|
export { createLocalSessionStore, createSupabaseAuthHelpers } from './auth.js';
|
|
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';
|
|
5
|
+
export { AgentMemoryItem, AgentMemoryKind, AgentMemorySearchItem, AgentMemorySearchResponse, AgentMemorySummary, AgentMemoryTimelineResponse, ApiClient, AppContext, AppContextAccessPath, AppReconcileResponse, AppSandboxCommandRun, Bundle, BundlePlatform, BundleStatus, ChangeStepDiffResponse, DetectProjectRuntimeTargetsPayload, ImportProjectRuntimeEnvPayload, InitiateBundleRequest, InvitationRecord, MergeRequest, MergeRequestReview, MergeRequestStatus, ProjectRuntimeEnvMetadata, ProjectRuntimeEnvScope, ProjectRuntimeTargetMetadata, ProjectRuntimeTargetScope, ProjectTrigger, ProjectTriggerPayload, ProjectTriggerScope, ProjectTriggerStep, ProjectTriggerStepPayload, ReconcilePreflightResponse, ResolveProjectRuntimeEnvForLocalPullResponse, RunAppRuntimeTargetPayload, RunAppSandboxCommandPayload, RunAppTriggerEventPayload, RunAppTriggerPayload, RuntimeCommandKind, RuntimeTargetKind, SetProjectRuntimeEnvPayload, SetProjectRuntimeTargetPayload, SyncLocalResponse, SyncUpstreamResponse, TriggerEventMetadata, TriggerEventSource, TriggerIntegrationStatus, TriggerMode, TriggerRun, TriggerStepRun, TriggerStepType, UpdateProjectTriggerPayload, createApiClient } from './api.js';
|
|
6
6
|
import 'zod';
|
|
7
|
-
import './contracts-
|
|
7
|
+
import './contracts-CuTwLa6w.js';
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createApiClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DZRFUAOL.js";
|
|
4
4
|
import {
|
|
5
5
|
createLocalSessionStore,
|
|
6
6
|
createStoredSessionTokenProvider,
|
|
7
7
|
createSupabaseAuthHelpers,
|
|
8
8
|
shouldRefreshSoon,
|
|
9
9
|
storedSessionSchema
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-MAM4CGDF.js";
|
|
11
11
|
import {
|
|
12
12
|
configSchema,
|
|
13
13
|
resolveConfig
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-LGOQVGBB.js";
|
|
15
15
|
import "./chunk-4OCNZHHR.js";
|
|
16
16
|
import {
|
|
17
17
|
REMIX_ERROR_CODES
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remixhq/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.22",
|
|
4
4
|
"description": "Remix core library",
|
|
5
5
|
"homepage": "https://github.com/RemixDotOne/remix-core",
|
|
6
6
|
"license": "MIT",
|
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
"build": "tsup src/index.ts src/api.ts src/auth.ts src/binding.ts src/collab.ts src/config.ts src/errors.ts src/history.ts src/repo.ts --dts --format esm --clean",
|
|
63
63
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
64
64
|
"test": "vitest run",
|
|
65
|
+
"test:coverage": "vitest run --coverage",
|
|
65
66
|
"prepack": "npm run build"
|
|
66
67
|
},
|
|
67
68
|
"dependencies": {
|
|
@@ -71,8 +72,9 @@
|
|
|
71
72
|
},
|
|
72
73
|
"devDependencies": {
|
|
73
74
|
"@types/node": "^24.3.0",
|
|
75
|
+
"@vitest/coverage-v8": "^4.1.5",
|
|
74
76
|
"tsup": "^8.5.0",
|
|
75
77
|
"typescript": "^5.9.2",
|
|
76
|
-
"vitest": "^
|
|
78
|
+
"vitest": "^4.1.5"
|
|
77
79
|
}
|
|
78
80
|
}
|