@remixhq/core 0.1.8 → 0.1.9

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 CHANGED
@@ -207,6 +207,61 @@ type ReconcilePreflightResponse = {
207
207
  type OrganizationMemberRole = "owner" | "admin" | "member" | "viewer";
208
208
  type ProjectMemberRole = "owner" | "maintainer" | "editor" | "viewer";
209
209
  type AppMemberRole = "owner" | "maintainer" | "editor" | "viewer";
210
+ type AppContextAccessPath = "public" | "app_member" | "project_member" | "org_member";
211
+ type AppContext = {
212
+ appId: string;
213
+ projectId: string;
214
+ organizationId: string;
215
+ visibility: "public" | "private";
216
+ accessPath: AppContextAccessPath;
217
+ readableScopes: {
218
+ app: true;
219
+ project: boolean;
220
+ organization: boolean;
221
+ };
222
+ roles: {
223
+ organizationRole: OrganizationMemberRole | null;
224
+ projectRole: ProjectMemberRole | null;
225
+ appRole: AppMemberRole | null;
226
+ inheritedProjectRole: AppMemberRole | null;
227
+ effectiveAppRole: AppMemberRole | null;
228
+ };
229
+ capabilities: {
230
+ role: AppMemberRole | null;
231
+ appRole: AppMemberRole | null;
232
+ projectRole: ProjectMemberRole | null;
233
+ inheritedProjectRole: AppMemberRole | null;
234
+ isOwner: boolean;
235
+ canReadWorkflow: boolean;
236
+ canEdit: boolean;
237
+ canManage: boolean;
238
+ };
239
+ };
240
+ type InvitationRecord = {
241
+ id: string;
242
+ scopeType: "organization" | "project" | "app";
243
+ scopeId: string;
244
+ email: string;
245
+ role: string;
246
+ state: "pending" | "accepted" | "revoked" | "expired";
247
+ expiresAt: string;
248
+ acceptedAt: string | null;
249
+ acceptedByUserId: string | null;
250
+ acceptedByName?: string | null;
251
+ acceptedByEmail?: string | null;
252
+ revokedAt: string | null;
253
+ revokedBy: string | null;
254
+ revokedByName?: string | null;
255
+ revokedByEmail?: string | null;
256
+ invitedBy: string;
257
+ invitedByName?: string | null;
258
+ invitedByEmail?: string | null;
259
+ createdAt: string;
260
+ updatedAt: string;
261
+ lastSentAt: string | null;
262
+ deliveryStatus: string;
263
+ sendError: string | null;
264
+ };
210
265
  type AppReconcileResponse = {
211
266
  id: string;
212
267
  appId: string;
@@ -272,8 +327,21 @@ type ApiClient = {
272
327
  projectId?: string;
273
328
  organizationId?: string;
274
329
  forked?: "only" | "exclude" | "all";
330
+ limit?: number;
331
+ offset?: number;
275
332
  }): Promise<Json>;
276
333
  getApp(appId: string): Promise<Json>;
334
+ getAppContext(appId: string): Promise<Json>;
335
+ getAppOverview(appId: string): Promise<Json>;
336
+ listAppTimeline(appId: string, params?: {
337
+ limit?: number;
338
+ cursor?: string;
339
+ }): Promise<Json>;
340
+ getAppTimelineEvent(appId: string, eventId: string): Promise<Json>;
341
+ listAppEditQueue(appId: string, params?: {
342
+ limit?: number;
343
+ offset?: number;
344
+ }): Promise<Json>;
277
345
  getMergeRequest(mrId: string): Promise<Json>;
278
346
  presignImportUpload(payload: {
279
347
  file: {
@@ -288,6 +356,7 @@ type ApiClient = {
288
356
  appName?: string;
289
357
  threadId?: string;
290
358
  path?: string;
359
+ platform?: string;
291
360
  }): Promise<Json>;
292
361
  presignImportUploadFirstParty(payload: {
293
362
  file: {
@@ -416,6 +485,8 @@ type ApiClient = {
416
485
  targetAppId?: string;
417
486
  status?: string | string[];
418
487
  kind?: string;
488
+ limit?: number;
489
+ offset?: number;
419
490
  }): Promise<Json>;
420
491
  openMergeRequest(sourceAppId: string): Promise<Json>;
421
492
  getMergeRequestReview(mrId: string): Promise<Json>;
@@ -439,21 +510,39 @@ type ApiClient = {
439
510
  role?: string;
440
511
  ttlDays?: number;
441
512
  }): Promise<Json>;
442
- listOrganizationMembers(orgId: string): Promise<Json>;
513
+ listOrganizationMembers(orgId: string, params?: {
514
+ limit?: number;
515
+ offset?: number;
516
+ }): Promise<Json>;
443
517
  updateOrganizationMember(orgId: string, userId: string, payload: {
444
518
  role: OrganizationMemberRole;
445
519
  }): Promise<Json>;
446
- listProjectMembers(projectId: string): Promise<Json>;
520
+ listProjectMembers(projectId: string, params?: {
521
+ limit?: number;
522
+ offset?: number;
523
+ }): Promise<Json>;
447
524
  updateProjectMember(projectId: string, userId: string, payload: {
448
525
  role: ProjectMemberRole;
449
526
  }): Promise<Json>;
450
- listAppMembers(appId: string): Promise<Json>;
527
+ listAppMembers(appId: string, params?: {
528
+ limit?: number;
529
+ offset?: number;
530
+ }): Promise<Json>;
451
531
  updateAppMember(appId: string, userId: string, payload: {
452
532
  role: AppMemberRole;
453
533
  }): Promise<Json>;
454
- listOrganizationInvites(orgId: string): Promise<Json>;
455
- listProjectInvites(projectId: string): Promise<Json>;
456
- listAppInvites(appId: string): Promise<Json>;
534
+ listOrganizationInvites(orgId: string, params?: {
535
+ limit?: number;
536
+ offset?: number;
537
+ }): Promise<Json>;
538
+ listProjectInvites(projectId: string, params?: {
539
+ limit?: number;
540
+ offset?: number;
541
+ }): Promise<Json>;
542
+ listAppInvites(appId: string, params?: {
543
+ limit?: number;
544
+ offset?: number;
545
+ }): Promise<Json>;
457
546
  resendOrganizationInvite(orgId: string, inviteId: string, payload?: {
458
547
  ttlDays?: number;
459
548
  }): Promise<Json>;
@@ -466,6 +555,9 @@ type ApiClient = {
466
555
  revokeOrganizationInvite(orgId: string, inviteId: string): Promise<Json>;
467
556
  revokeProjectInvite(projectId: string, inviteId: string): Promise<Json>;
468
557
  revokeAppInvite(appId: string, inviteId: string): Promise<Json>;
558
+ acceptInvitation(payload: {
559
+ token: string;
560
+ }): Promise<Json>;
469
561
  syncUpstreamApp(appId: string): Promise<Json>;
470
562
  preflightAppReconcile(appId: string, payload: {
471
563
  localHeadCommitHash: string;
@@ -503,10 +595,26 @@ type ApiClient = {
503
595
  redirect?: boolean;
504
596
  kind?: string;
505
597
  }): Promise<Json>;
598
+ listAgentRuns(appId: string, params?: {
599
+ limit?: number;
600
+ offset?: number;
601
+ status?: string;
602
+ currentPhase?: string;
603
+ createdAfter?: string;
604
+ createdBefore?: string;
605
+ }): Promise<Json>;
606
+ getAgentRun(appId: string, runId: string): Promise<Json>;
607
+ listAgentRunEvents(appId: string, runId: string, params?: {
608
+ limit?: number;
609
+ offset?: number;
610
+ createdAfter?: string;
611
+ createdBefore?: string;
612
+ }): Promise<Json>;
613
+ getSandboxStatus(appId: string): Promise<Json>;
506
614
  };
507
615
  declare function createApiClient(config: CoreConfig, opts?: {
508
616
  apiKey?: string | null;
509
617
  tokenProvider?: TokenProvider;
510
618
  }): ApiClient;
511
619
 
512
- export { type AgentMemoryItem, type AgentMemoryKind, type AgentMemorySearchItem, type AgentMemorySearchResponse, type AgentMemorySummary, type AgentMemoryTimelineResponse, type ApiClient, type AppReconcileResponse, type Bundle, type BundlePlatform, type BundleStatus, type ChangeStepDiffResponse, type InitiateBundleRequest, type MergeRequest, type MergeRequestReview, type MergeRequestStatus, type ReconcilePreflightResponse, type SyncLocalResponse, type SyncUpstreamResponse, createApiClient };
620
+ 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 InitiateBundleRequest, type InvitationRecord, type MergeRequest, type MergeRequestReview, type MergeRequestStatus, type ReconcilePreflightResponse, type SyncLocalResponse, type SyncUpstreamResponse, createApiClient };
package/dist/api.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createApiClient
3
- } from "./chunk-4276ARDF.js";
3
+ } from "./chunk-XC2FV57P.js";
4
4
  import "./chunk-YZ34ICNN.js";
5
5
  export {
6
6
  createApiClient
package/dist/binding.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  getCollabBindingPath,
3
3
  readCollabBinding,
4
4
  writeCollabBinding
5
- } from "./chunk-FAZUMWBS.js";
5
+ } from "./chunk-GEHSFPCD.js";
6
6
  import "./chunk-YZ34ICNN.js";
7
7
  export {
8
8
  getCollabBindingPath,
@@ -0,0 +1,93 @@
1
+ import {
2
+ RemixError
3
+ } from "./chunk-YZ34ICNN.js";
4
+
5
+ // src/infrastructure/binding/collabBindingStore.ts
6
+ import fs2 from "fs/promises";
7
+ import path2 from "path";
8
+
9
+ // src/shared/fs.ts
10
+ import fs from "fs/promises";
11
+ import path from "path";
12
+ async function reserveDirectory(targetDir) {
13
+ try {
14
+ await fs.mkdir(targetDir);
15
+ return targetDir;
16
+ } catch (error) {
17
+ if (error?.code === "EEXIST") {
18
+ throw new RemixError("Output directory already exists.", {
19
+ exitCode: 2,
20
+ hint: `Choose an empty destination path: ${targetDir}`
21
+ });
22
+ }
23
+ throw error;
24
+ }
25
+ }
26
+ async function reserveAvailableDirPath(preferredDir) {
27
+ const parent = path.dirname(preferredDir);
28
+ const base = path.basename(preferredDir);
29
+ for (let i = 1; i <= 1e3; i += 1) {
30
+ const candidate = i === 1 ? preferredDir : path.join(parent, `${base}-${i}`);
31
+ try {
32
+ await fs.mkdir(candidate);
33
+ return candidate;
34
+ } catch (error) {
35
+ if (error?.code === "EEXIST") continue;
36
+ throw error;
37
+ }
38
+ }
39
+ throw new RemixError("No available output directory name.", {
40
+ exitCode: 2,
41
+ hint: `Tried ${base} through ${base}-1000 under ${parent}.`
42
+ });
43
+ }
44
+ async function writeJsonAtomic(filePath, value) {
45
+ const dir = path.dirname(filePath);
46
+ await fs.mkdir(dir, { recursive: true });
47
+ const tmp = `${filePath}.tmp-${Date.now()}`;
48
+ await fs.writeFile(tmp, `${JSON.stringify(value, null, 2)}
49
+ `, "utf8");
50
+ await fs.rename(tmp, filePath);
51
+ }
52
+
53
+ // src/infrastructure/binding/collabBindingStore.ts
54
+ function getCollabBindingPath(repoRoot) {
55
+ return path2.join(repoRoot, ".remix", "config.json");
56
+ }
57
+ async function readCollabBinding(repoRoot) {
58
+ try {
59
+ const raw = await fs2.readFile(getCollabBindingPath(repoRoot), "utf8");
60
+ const parsed = JSON.parse(raw);
61
+ if (parsed?.schemaVersion !== 1) return null;
62
+ if (!parsed.projectId || !parsed.currentAppId || !parsed.upstreamAppId) return null;
63
+ return {
64
+ schemaVersion: 1,
65
+ projectId: parsed.projectId,
66
+ currentAppId: parsed.currentAppId,
67
+ upstreamAppId: parsed.upstreamAppId,
68
+ threadId: parsed.threadId ?? null,
69
+ repoFingerprint: parsed.repoFingerprint ?? null,
70
+ remoteUrl: parsed.remoteUrl ?? null,
71
+ defaultBranch: parsed.defaultBranch ?? null,
72
+ preferredBranch: parsed.preferredBranch ?? parsed.defaultBranch ?? null
73
+ };
74
+ } catch {
75
+ return null;
76
+ }
77
+ }
78
+ async function writeCollabBinding(repoRoot, binding) {
79
+ const filePath = getCollabBindingPath(repoRoot);
80
+ await writeJsonAtomic(filePath, {
81
+ schemaVersion: 1,
82
+ ...binding
83
+ });
84
+ return filePath;
85
+ }
86
+
87
+ export {
88
+ reserveDirectory,
89
+ reserveAvailableDirPath,
90
+ getCollabBindingPath,
91
+ readCollabBinding,
92
+ writeCollabBinding
93
+ };