@remixhq/core 0.1.8 → 0.1.10
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 +118 -7
- package/dist/api.js +1 -1
- package/dist/binding.js +1 -1
- package/dist/chunk-B5S3PUIR.js +388 -0
- package/dist/chunk-GEHSFPCD.js +93 -0
- package/dist/chunk-J3J4PBQ7.js +710 -0
- package/dist/chunk-OBYR4JHZ.js +374 -0
- package/dist/chunk-POYB6MCQ.js +373 -0
- package/dist/chunk-XC2FV57P.js +385 -0
- package/dist/collab.d.ts +95 -7
- package/dist/collab.js +162 -8
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/repo.js +1 -1
- package/package.json +1 -1
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;
|
|
@@ -271,9 +326,25 @@ type ApiClient = {
|
|
|
271
326
|
listApps(params?: {
|
|
272
327
|
projectId?: string;
|
|
273
328
|
organizationId?: string;
|
|
329
|
+
ownership?: "mine" | "shared" | "all";
|
|
330
|
+
accessScope?: "all_readable" | "explicit_member";
|
|
331
|
+
createdBy?: "me" | string;
|
|
274
332
|
forked?: "only" | "exclude" | "all";
|
|
333
|
+
limit?: number;
|
|
334
|
+
offset?: number;
|
|
275
335
|
}): Promise<Json>;
|
|
276
336
|
getApp(appId: string): Promise<Json>;
|
|
337
|
+
getAppContext(appId: string): Promise<Json>;
|
|
338
|
+
getAppOverview(appId: string): Promise<Json>;
|
|
339
|
+
listAppTimeline(appId: string, params?: {
|
|
340
|
+
limit?: number;
|
|
341
|
+
cursor?: string;
|
|
342
|
+
}): Promise<Json>;
|
|
343
|
+
getAppTimelineEvent(appId: string, eventId: string): Promise<Json>;
|
|
344
|
+
listAppEditQueue(appId: string, params?: {
|
|
345
|
+
limit?: number;
|
|
346
|
+
offset?: number;
|
|
347
|
+
}): Promise<Json>;
|
|
277
348
|
getMergeRequest(mrId: string): Promise<Json>;
|
|
278
349
|
presignImportUpload(payload: {
|
|
279
350
|
file: {
|
|
@@ -288,6 +359,7 @@ type ApiClient = {
|
|
|
288
359
|
appName?: string;
|
|
289
360
|
threadId?: string;
|
|
290
361
|
path?: string;
|
|
362
|
+
platform?: string;
|
|
291
363
|
}): Promise<Json>;
|
|
292
364
|
presignImportUploadFirstParty(payload: {
|
|
293
365
|
file: {
|
|
@@ -416,6 +488,8 @@ type ApiClient = {
|
|
|
416
488
|
targetAppId?: string;
|
|
417
489
|
status?: string | string[];
|
|
418
490
|
kind?: string;
|
|
491
|
+
limit?: number;
|
|
492
|
+
offset?: number;
|
|
419
493
|
}): Promise<Json>;
|
|
420
494
|
openMergeRequest(sourceAppId: string): Promise<Json>;
|
|
421
495
|
getMergeRequestReview(mrId: string): Promise<Json>;
|
|
@@ -439,21 +513,39 @@ type ApiClient = {
|
|
|
439
513
|
role?: string;
|
|
440
514
|
ttlDays?: number;
|
|
441
515
|
}): Promise<Json>;
|
|
442
|
-
listOrganizationMembers(orgId: string
|
|
516
|
+
listOrganizationMembers(orgId: string, params?: {
|
|
517
|
+
limit?: number;
|
|
518
|
+
offset?: number;
|
|
519
|
+
}): Promise<Json>;
|
|
443
520
|
updateOrganizationMember(orgId: string, userId: string, payload: {
|
|
444
521
|
role: OrganizationMemberRole;
|
|
445
522
|
}): Promise<Json>;
|
|
446
|
-
listProjectMembers(projectId: string
|
|
523
|
+
listProjectMembers(projectId: string, params?: {
|
|
524
|
+
limit?: number;
|
|
525
|
+
offset?: number;
|
|
526
|
+
}): Promise<Json>;
|
|
447
527
|
updateProjectMember(projectId: string, userId: string, payload: {
|
|
448
528
|
role: ProjectMemberRole;
|
|
449
529
|
}): Promise<Json>;
|
|
450
|
-
listAppMembers(appId: string
|
|
530
|
+
listAppMembers(appId: string, params?: {
|
|
531
|
+
limit?: number;
|
|
532
|
+
offset?: number;
|
|
533
|
+
}): Promise<Json>;
|
|
451
534
|
updateAppMember(appId: string, userId: string, payload: {
|
|
452
535
|
role: AppMemberRole;
|
|
453
536
|
}): Promise<Json>;
|
|
454
|
-
listOrganizationInvites(orgId: string
|
|
455
|
-
|
|
456
|
-
|
|
537
|
+
listOrganizationInvites(orgId: string, params?: {
|
|
538
|
+
limit?: number;
|
|
539
|
+
offset?: number;
|
|
540
|
+
}): Promise<Json>;
|
|
541
|
+
listProjectInvites(projectId: string, params?: {
|
|
542
|
+
limit?: number;
|
|
543
|
+
offset?: number;
|
|
544
|
+
}): Promise<Json>;
|
|
545
|
+
listAppInvites(appId: string, params?: {
|
|
546
|
+
limit?: number;
|
|
547
|
+
offset?: number;
|
|
548
|
+
}): Promise<Json>;
|
|
457
549
|
resendOrganizationInvite(orgId: string, inviteId: string, payload?: {
|
|
458
550
|
ttlDays?: number;
|
|
459
551
|
}): Promise<Json>;
|
|
@@ -466,6 +558,9 @@ type ApiClient = {
|
|
|
466
558
|
revokeOrganizationInvite(orgId: string, inviteId: string): Promise<Json>;
|
|
467
559
|
revokeProjectInvite(projectId: string, inviteId: string): Promise<Json>;
|
|
468
560
|
revokeAppInvite(appId: string, inviteId: string): Promise<Json>;
|
|
561
|
+
acceptInvitation(payload: {
|
|
562
|
+
token: string;
|
|
563
|
+
}): Promise<Json>;
|
|
469
564
|
syncUpstreamApp(appId: string): Promise<Json>;
|
|
470
565
|
preflightAppReconcile(appId: string, payload: {
|
|
471
566
|
localHeadCommitHash: string;
|
|
@@ -503,10 +598,26 @@ type ApiClient = {
|
|
|
503
598
|
redirect?: boolean;
|
|
504
599
|
kind?: string;
|
|
505
600
|
}): Promise<Json>;
|
|
601
|
+
listAgentRuns(appId: string, params?: {
|
|
602
|
+
limit?: number;
|
|
603
|
+
offset?: number;
|
|
604
|
+
status?: string;
|
|
605
|
+
currentPhase?: string;
|
|
606
|
+
createdAfter?: string;
|
|
607
|
+
createdBefore?: string;
|
|
608
|
+
}): Promise<Json>;
|
|
609
|
+
getAgentRun(appId: string, runId: string): Promise<Json>;
|
|
610
|
+
listAgentRunEvents(appId: string, runId: string, params?: {
|
|
611
|
+
limit?: number;
|
|
612
|
+
offset?: number;
|
|
613
|
+
createdAfter?: string;
|
|
614
|
+
createdBefore?: string;
|
|
615
|
+
}): Promise<Json>;
|
|
616
|
+
getSandboxStatus(appId: string): Promise<Json>;
|
|
506
617
|
};
|
|
507
618
|
declare function createApiClient(config: CoreConfig, opts?: {
|
|
508
619
|
apiKey?: string | null;
|
|
509
620
|
tokenProvider?: TokenProvider;
|
|
510
621
|
}): ApiClient;
|
|
511
622
|
|
|
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 };
|
|
623
|
+
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
package/dist/binding.js
CHANGED
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
import {
|
|
2
|
+
RemixError
|
|
3
|
+
} from "./chunk-YZ34ICNN.js";
|
|
4
|
+
|
|
5
|
+
// src/api/client.ts
|
|
6
|
+
async function readJsonSafe(res) {
|
|
7
|
+
const ct = res.headers.get("content-type") ?? "";
|
|
8
|
+
if (!ct.toLowerCase().includes("application/json")) return null;
|
|
9
|
+
try {
|
|
10
|
+
return await res.json();
|
|
11
|
+
} catch {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function createApiClient(config, opts) {
|
|
16
|
+
const apiKey = (opts?.apiKey ?? "").trim();
|
|
17
|
+
const tokenProvider = opts?.tokenProvider;
|
|
18
|
+
const CLIENT_KEY_HEADER = "x-comerge-api-key";
|
|
19
|
+
async function request(path, init) {
|
|
20
|
+
if (!tokenProvider) {
|
|
21
|
+
throw new RemixError("API client is missing a token provider.", {
|
|
22
|
+
exitCode: 1,
|
|
23
|
+
hint: "Configure auth before creating the Remix API client."
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
const auth = await tokenProvider();
|
|
27
|
+
const url = new URL(path, config.apiUrl).toString();
|
|
28
|
+
const doFetch = async (bearer) => fetch(url, {
|
|
29
|
+
...init,
|
|
30
|
+
headers: {
|
|
31
|
+
Accept: "application/json",
|
|
32
|
+
"Content-Type": "application/json",
|
|
33
|
+
...init?.headers ?? {},
|
|
34
|
+
Authorization: `Bearer ${bearer}`,
|
|
35
|
+
...apiKey ? { [CLIENT_KEY_HEADER]: apiKey } : {}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
let res = await doFetch(auth.token);
|
|
39
|
+
if (res.status === 401 && !auth.fromEnv && auth.session?.refresh_token) {
|
|
40
|
+
const refreshed = await tokenProvider({ forceRefresh: true });
|
|
41
|
+
res = await doFetch(refreshed.token);
|
|
42
|
+
}
|
|
43
|
+
if (!res.ok) {
|
|
44
|
+
const body = await readJsonSafe(res);
|
|
45
|
+
const msg = (body && typeof body === "object" && body && "message" in body && typeof body.message === "string" ? body.message : null) ?? `Request failed (status ${res.status})`;
|
|
46
|
+
throw new RemixError(msg, { exitCode: 1, hint: body ? JSON.stringify(body, null, 2) : null });
|
|
47
|
+
}
|
|
48
|
+
const json = await readJsonSafe(res);
|
|
49
|
+
return json ?? null;
|
|
50
|
+
}
|
|
51
|
+
async function requestBinary(path, init) {
|
|
52
|
+
if (!tokenProvider) {
|
|
53
|
+
throw new RemixError("API client is missing a token provider.", {
|
|
54
|
+
exitCode: 1,
|
|
55
|
+
hint: "Configure auth before creating the Remix API client."
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
const auth = await tokenProvider();
|
|
59
|
+
const url = new URL(path, config.apiUrl).toString();
|
|
60
|
+
const doFetch = async (bearer) => fetch(url, {
|
|
61
|
+
...init,
|
|
62
|
+
headers: {
|
|
63
|
+
Accept: "*/*",
|
|
64
|
+
...init?.headers ?? {},
|
|
65
|
+
Authorization: `Bearer ${bearer}`,
|
|
66
|
+
...apiKey ? { [CLIENT_KEY_HEADER]: apiKey } : {}
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
let res = await doFetch(auth.token);
|
|
70
|
+
if (res.status === 401 && !auth.fromEnv && auth.session?.refresh_token) {
|
|
71
|
+
const refreshed = await tokenProvider({ forceRefresh: true });
|
|
72
|
+
res = await doFetch(refreshed.token);
|
|
73
|
+
}
|
|
74
|
+
if (!res.ok) {
|
|
75
|
+
const body = await readJsonSafe(res);
|
|
76
|
+
const msg = (body && typeof body === "object" && body && "message" in body && typeof body.message === "string" ? body.message : null) ?? `Request failed (status ${res.status})`;
|
|
77
|
+
throw new RemixError(msg, { exitCode: 1, hint: body ? JSON.stringify(body, null, 2) : null });
|
|
78
|
+
}
|
|
79
|
+
const contentDisposition = res.headers.get("content-disposition") ?? "";
|
|
80
|
+
const fileNameMatch = contentDisposition.match(/filename=\"([^\"]+)\"/i);
|
|
81
|
+
return {
|
|
82
|
+
data: Buffer.from(await res.arrayBuffer()),
|
|
83
|
+
fileName: fileNameMatch?.[1] ?? null,
|
|
84
|
+
contentType: res.headers.get("content-type")
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
getMe: () => request("/v1/me", { method: "GET" }),
|
|
89
|
+
listOrganizations: () => request("/v1/organizations", { method: "GET" }),
|
|
90
|
+
getOrganization: (orgId) => request(`/v1/organizations/${encodeURIComponent(orgId)}`, { method: "GET" }),
|
|
91
|
+
listProjects: (params) => {
|
|
92
|
+
const qs = new URLSearchParams();
|
|
93
|
+
if (params?.organizationId) qs.set("organizationId", params.organizationId);
|
|
94
|
+
if (params?.clientAppId) qs.set("clientAppId", params.clientAppId);
|
|
95
|
+
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
96
|
+
return request(`/v1/projects${suffix}`, { method: "GET" });
|
|
97
|
+
},
|
|
98
|
+
getProject: (projectId) => request(`/v1/projects/${encodeURIComponent(projectId)}`, { method: "GET" }),
|
|
99
|
+
resolveProjectBinding: (params) => {
|
|
100
|
+
const qs = new URLSearchParams();
|
|
101
|
+
if (params.repoFingerprint) qs.set("repoFingerprint", params.repoFingerprint);
|
|
102
|
+
if (params.remoteUrl) qs.set("remoteUrl", params.remoteUrl);
|
|
103
|
+
return request(`/v1/projects/bindings/resolve?${qs.toString()}`, { method: "GET" });
|
|
104
|
+
},
|
|
105
|
+
autoEnableDeveloper: () => request("/v1/developer/auto-enable", { method: "POST" }),
|
|
106
|
+
listClientApps: (params) => {
|
|
107
|
+
const qs = params?.orgId ? `?orgId=${encodeURIComponent(params.orgId)}` : "";
|
|
108
|
+
return request(`/v1/developer/client-apps${qs}`, { method: "GET" });
|
|
109
|
+
},
|
|
110
|
+
createClientApp: (payload) => request("/v1/developer/client-apps", { method: "POST", body: JSON.stringify(payload) }),
|
|
111
|
+
createClientAppKey: (clientAppId, payload) => request(`/v1/developer/client-apps/${encodeURIComponent(clientAppId)}/keys`, {
|
|
112
|
+
method: "POST",
|
|
113
|
+
body: JSON.stringify(payload ?? {})
|
|
114
|
+
}),
|
|
115
|
+
listApps: (params) => {
|
|
116
|
+
const qs = new URLSearchParams();
|
|
117
|
+
if (params?.projectId) qs.set("projectId", params.projectId);
|
|
118
|
+
if (params?.organizationId) qs.set("organizationId", params.organizationId);
|
|
119
|
+
if (params?.ownership) qs.set("ownership", params.ownership);
|
|
120
|
+
if (params?.accessScope) qs.set("accessScope", params.accessScope);
|
|
121
|
+
if (params?.createdBy) qs.set("createdBy", params.createdBy);
|
|
122
|
+
if (params?.forked) qs.set("forked", params.forked);
|
|
123
|
+
if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
|
|
124
|
+
if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
|
|
125
|
+
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
126
|
+
return request(`/v1/apps${suffix}`, { method: "GET" });
|
|
127
|
+
},
|
|
128
|
+
getApp: (appId) => request(`/v1/apps/${encodeURIComponent(appId)}`, { method: "GET" }),
|
|
129
|
+
getAppContext: (appId) => request(`/v1/apps/${encodeURIComponent(appId)}/context`, { method: "GET" }),
|
|
130
|
+
getAppOverview: (appId) => request(`/v1/apps/${encodeURIComponent(appId)}/overview`, { method: "GET" }),
|
|
131
|
+
listAppTimeline: (appId, params) => {
|
|
132
|
+
const qs = new URLSearchParams();
|
|
133
|
+
if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
|
|
134
|
+
if (params?.cursor) qs.set("cursor", params.cursor);
|
|
135
|
+
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
136
|
+
return request(`/v1/apps/${encodeURIComponent(appId)}/timeline${suffix}`, { method: "GET" });
|
|
137
|
+
},
|
|
138
|
+
getAppTimelineEvent: (appId, eventId) => request(`/v1/apps/${encodeURIComponent(appId)}/timeline/${encodeURIComponent(eventId)}`, { method: "GET" }),
|
|
139
|
+
listAppEditQueue: (appId, params) => {
|
|
140
|
+
const qs = new URLSearchParams();
|
|
141
|
+
if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
|
|
142
|
+
if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
|
|
143
|
+
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
144
|
+
return request(`/v1/apps/${encodeURIComponent(appId)}/edit-queue${suffix}`, { method: "GET" });
|
|
145
|
+
},
|
|
146
|
+
getMergeRequest: (mrId) => request(`/v1/merge-requests/${encodeURIComponent(mrId)}`, { method: "GET" }),
|
|
147
|
+
presignImportUpload: (payload) => request("/v1/apps/import/upload/presign", { method: "POST", body: JSON.stringify(payload) }),
|
|
148
|
+
importFromUpload: (payload) => request("/v1/apps/import/upload", { method: "POST", body: JSON.stringify(payload) }),
|
|
149
|
+
presignImportUploadFirstParty: (payload) => request("/v1/apps/import/upload/presign/first-party", { method: "POST", body: JSON.stringify(payload) }),
|
|
150
|
+
importFromUploadFirstParty: (payload) => request("/v1/apps/import/upload/first-party", { method: "POST", body: JSON.stringify(payload) }),
|
|
151
|
+
importFromGithubFirstParty: (payload) => request("/v1/apps/import/github/first-party", { method: "POST", body: JSON.stringify(payload) }),
|
|
152
|
+
forkApp: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/fork`, { method: "POST", body: JSON.stringify(payload ?? {}) }),
|
|
153
|
+
downloadAppBundle: (appId) => requestBinary(`/v1/apps/${encodeURIComponent(appId)}/download.bundle`, { method: "GET" }),
|
|
154
|
+
createChangeStep: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/change-steps`, {
|
|
155
|
+
method: "POST",
|
|
156
|
+
body: JSON.stringify(payload)
|
|
157
|
+
}),
|
|
158
|
+
createCollabTurn: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/collab-turns`, {
|
|
159
|
+
method: "POST",
|
|
160
|
+
body: JSON.stringify(payload)
|
|
161
|
+
}),
|
|
162
|
+
listCollabTurns: (appId, params) => {
|
|
163
|
+
const qs = new URLSearchParams();
|
|
164
|
+
if (params?.limit !== void 0) qs.set("limit", String(params.limit));
|
|
165
|
+
if (params?.offset !== void 0) qs.set("offset", String(params.offset));
|
|
166
|
+
if (params?.changeStepId) qs.set("changeStepId", params.changeStepId);
|
|
167
|
+
if (params?.threadId) qs.set("threadId", params.threadId);
|
|
168
|
+
if (params?.createdAfter) qs.set("createdAfter", params.createdAfter);
|
|
169
|
+
if (params?.createdBefore) qs.set("createdBefore", params.createdBefore);
|
|
170
|
+
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
171
|
+
return request(`/v1/apps/${encodeURIComponent(appId)}/collab-turns${suffix}`, { method: "GET" });
|
|
172
|
+
},
|
|
173
|
+
getCollabTurn: (appId, collabTurnId) => request(`/v1/apps/${encodeURIComponent(appId)}/collab-turns/${encodeURIComponent(collabTurnId)}`, {
|
|
174
|
+
method: "GET"
|
|
175
|
+
}),
|
|
176
|
+
getAgentMemorySummary: (appId) => request(`/v1/apps/${encodeURIComponent(appId)}/agent-memory/summary`, { method: "GET" }),
|
|
177
|
+
listAgentMemoryTimeline: (appId, params) => {
|
|
178
|
+
const qs = new URLSearchParams();
|
|
179
|
+
if (params?.limit !== void 0) qs.set("limit", String(params.limit));
|
|
180
|
+
if (params?.offset !== void 0) qs.set("offset", String(params.offset));
|
|
181
|
+
if (params?.createdAfter) qs.set("createdAfter", params.createdAfter);
|
|
182
|
+
if (params?.createdBefore) qs.set("createdBefore", params.createdBefore);
|
|
183
|
+
if (params?.kinds?.length) {
|
|
184
|
+
for (const kind of params.kinds) qs.append("kinds", kind);
|
|
185
|
+
}
|
|
186
|
+
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
187
|
+
return request(`/v1/apps/${encodeURIComponent(appId)}/agent-memory/timeline${suffix}`, { method: "GET" });
|
|
188
|
+
},
|
|
189
|
+
searchAgentMemory: (appId, params) => {
|
|
190
|
+
const qs = new URLSearchParams();
|
|
191
|
+
qs.set("q", params.q);
|
|
192
|
+
if (params.limit !== void 0) qs.set("limit", String(params.limit));
|
|
193
|
+
if (params.offset !== void 0) qs.set("offset", String(params.offset));
|
|
194
|
+
if (params.createdAfter) qs.set("createdAfter", params.createdAfter);
|
|
195
|
+
if (params.createdBefore) qs.set("createdBefore", params.createdBefore);
|
|
196
|
+
if (params.kinds?.length) {
|
|
197
|
+
for (const kind of params.kinds) qs.append("kinds", kind);
|
|
198
|
+
}
|
|
199
|
+
return request(`/v1/apps/${encodeURIComponent(appId)}/agent-memory/search?${qs.toString()}`, { method: "GET" });
|
|
200
|
+
},
|
|
201
|
+
getChangeStep: (appId, changeStepId) => request(`/v1/apps/${encodeURIComponent(appId)}/change-steps/${encodeURIComponent(changeStepId)}`, { method: "GET" }),
|
|
202
|
+
getChangeStepDiff: (appId, changeStepId) => request(`/v1/apps/${encodeURIComponent(appId)}/change-steps/${encodeURIComponent(changeStepId)}/diff`, {
|
|
203
|
+
method: "GET"
|
|
204
|
+
}),
|
|
205
|
+
startChangeStepReplay: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/change-steps/replays`, {
|
|
206
|
+
method: "POST",
|
|
207
|
+
body: JSON.stringify(payload)
|
|
208
|
+
}),
|
|
209
|
+
getChangeStepReplay: (appId, replayId) => request(`/v1/apps/${encodeURIComponent(appId)}/change-steps/replays/${encodeURIComponent(replayId)}`, {
|
|
210
|
+
method: "GET"
|
|
211
|
+
}),
|
|
212
|
+
getChangeStepReplayDiff: (appId, replayId) => request(`/v1/apps/${encodeURIComponent(appId)}/change-steps/replays/${encodeURIComponent(replayId)}/diff`, {
|
|
213
|
+
method: "GET"
|
|
214
|
+
}),
|
|
215
|
+
listMergeRequests: (params) => {
|
|
216
|
+
const qs = new URLSearchParams();
|
|
217
|
+
if (params?.queue) qs.set("queue", params.queue);
|
|
218
|
+
if (params?.appId) qs.set("appId", params.appId);
|
|
219
|
+
if (params?.sourceAppId) qs.set("sourceAppId", params.sourceAppId);
|
|
220
|
+
if (params?.targetAppId) qs.set("targetAppId", params.targetAppId);
|
|
221
|
+
if (Array.isArray(params?.status)) {
|
|
222
|
+
for (const status of params.status) qs.append("status", status);
|
|
223
|
+
} else if (typeof params?.status === "string") {
|
|
224
|
+
qs.set("status", params.status);
|
|
225
|
+
}
|
|
226
|
+
if (params?.kind) qs.set("kind", params.kind);
|
|
227
|
+
if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
|
|
228
|
+
if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
|
|
229
|
+
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
230
|
+
return request(`/v1/merge-requests${suffix}`, { method: "GET" });
|
|
231
|
+
},
|
|
232
|
+
openMergeRequest: (sourceAppId) => request("/v1/merge-requests", { method: "POST", body: JSON.stringify({ sourceAppId }) }),
|
|
233
|
+
getMergeRequestReview: (mrId) => request(`/v1/merge-requests/${encodeURIComponent(mrId)}/review`, { method: "GET" }),
|
|
234
|
+
updateMergeRequest: (mrId, payload) => request(`/v1/merge-requests/${encodeURIComponent(mrId)}`, { method: "PATCH", body: JSON.stringify(payload) }),
|
|
235
|
+
createOrganizationInvite: (orgId, payload) => request(`/v1/organizations/${encodeURIComponent(orgId)}/invitations`, {
|
|
236
|
+
method: "POST",
|
|
237
|
+
body: JSON.stringify(payload)
|
|
238
|
+
}),
|
|
239
|
+
createProjectInvite: (projectId, payload) => request(`/v1/projects/${encodeURIComponent(projectId)}/invitations`, {
|
|
240
|
+
method: "POST",
|
|
241
|
+
body: JSON.stringify(payload)
|
|
242
|
+
}),
|
|
243
|
+
createAppInvite: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/invitations`, {
|
|
244
|
+
method: "POST",
|
|
245
|
+
body: JSON.stringify(payload)
|
|
246
|
+
}),
|
|
247
|
+
listOrganizationMembers: (orgId, params) => {
|
|
248
|
+
const qs = new URLSearchParams();
|
|
249
|
+
if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
|
|
250
|
+
if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
|
|
251
|
+
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
252
|
+
return request(`/v1/organizations/${encodeURIComponent(orgId)}/members${suffix}`, { method: "GET" });
|
|
253
|
+
},
|
|
254
|
+
updateOrganizationMember: (orgId, userId, payload) => request(`/v1/organizations/${encodeURIComponent(orgId)}/members/${encodeURIComponent(userId)}`, {
|
|
255
|
+
method: "PATCH",
|
|
256
|
+
body: JSON.stringify(payload)
|
|
257
|
+
}),
|
|
258
|
+
listProjectMembers: (projectId, params) => {
|
|
259
|
+
const qs = new URLSearchParams();
|
|
260
|
+
if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
|
|
261
|
+
if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
|
|
262
|
+
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
263
|
+
return request(`/v1/projects/${encodeURIComponent(projectId)}/members${suffix}`, { method: "GET" });
|
|
264
|
+
},
|
|
265
|
+
updateProjectMember: (projectId, userId, payload) => request(`/v1/projects/${encodeURIComponent(projectId)}/members/${encodeURIComponent(userId)}`, {
|
|
266
|
+
method: "PATCH",
|
|
267
|
+
body: JSON.stringify(payload)
|
|
268
|
+
}),
|
|
269
|
+
listAppMembers: (appId, params) => {
|
|
270
|
+
const qs = new URLSearchParams();
|
|
271
|
+
if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
|
|
272
|
+
if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
|
|
273
|
+
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
274
|
+
return request(`/v1/apps/${encodeURIComponent(appId)}/members${suffix}`, { method: "GET" });
|
|
275
|
+
},
|
|
276
|
+
updateAppMember: (appId, userId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/members/${encodeURIComponent(userId)}`, {
|
|
277
|
+
method: "PATCH",
|
|
278
|
+
body: JSON.stringify(payload)
|
|
279
|
+
}),
|
|
280
|
+
listOrganizationInvites: (orgId, params) => {
|
|
281
|
+
const qs = new URLSearchParams();
|
|
282
|
+
if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
|
|
283
|
+
if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
|
|
284
|
+
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
285
|
+
return request(`/v1/organizations/${encodeURIComponent(orgId)}/invitations${suffix}`, { method: "GET" });
|
|
286
|
+
},
|
|
287
|
+
listProjectInvites: (projectId, params) => {
|
|
288
|
+
const qs = new URLSearchParams();
|
|
289
|
+
if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
|
|
290
|
+
if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
|
|
291
|
+
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
292
|
+
return request(`/v1/projects/${encodeURIComponent(projectId)}/invitations${suffix}`, { method: "GET" });
|
|
293
|
+
},
|
|
294
|
+
listAppInvites: (appId, params) => {
|
|
295
|
+
const qs = new URLSearchParams();
|
|
296
|
+
if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
|
|
297
|
+
if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
|
|
298
|
+
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
299
|
+
return request(`/v1/apps/${encodeURIComponent(appId)}/invitations${suffix}`, { method: "GET" });
|
|
300
|
+
},
|
|
301
|
+
resendOrganizationInvite: (orgId, inviteId, payload) => request(`/v1/organizations/${encodeURIComponent(orgId)}/invitations/${encodeURIComponent(inviteId)}/resend`, {
|
|
302
|
+
method: "POST",
|
|
303
|
+
body: JSON.stringify(payload ?? {})
|
|
304
|
+
}),
|
|
305
|
+
resendProjectInvite: (projectId, inviteId, payload) => request(`/v1/projects/${encodeURIComponent(projectId)}/invitations/${encodeURIComponent(inviteId)}/resend`, {
|
|
306
|
+
method: "POST",
|
|
307
|
+
body: JSON.stringify(payload ?? {})
|
|
308
|
+
}),
|
|
309
|
+
resendAppInvite: (appId, inviteId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/invitations/${encodeURIComponent(inviteId)}/resend`, {
|
|
310
|
+
method: "POST",
|
|
311
|
+
body: JSON.stringify(payload ?? {})
|
|
312
|
+
}),
|
|
313
|
+
revokeOrganizationInvite: (orgId, inviteId) => request(`/v1/organizations/${encodeURIComponent(orgId)}/invitations/${encodeURIComponent(inviteId)}`, {
|
|
314
|
+
method: "DELETE"
|
|
315
|
+
}),
|
|
316
|
+
revokeProjectInvite: (projectId, inviteId) => request(`/v1/projects/${encodeURIComponent(projectId)}/invitations/${encodeURIComponent(inviteId)}`, {
|
|
317
|
+
method: "DELETE"
|
|
318
|
+
}),
|
|
319
|
+
revokeAppInvite: (appId, inviteId) => request(`/v1/apps/${encodeURIComponent(appId)}/invitations/${encodeURIComponent(inviteId)}`, {
|
|
320
|
+
method: "DELETE"
|
|
321
|
+
}),
|
|
322
|
+
acceptInvitation: (payload) => request("/v1/invitations/accept", { method: "POST", body: JSON.stringify(payload) }),
|
|
323
|
+
syncUpstreamApp: (appId) => request(`/v1/apps/${encodeURIComponent(appId)}/sync-upstream`, {
|
|
324
|
+
method: "POST",
|
|
325
|
+
body: JSON.stringify({})
|
|
326
|
+
}),
|
|
327
|
+
preflightAppReconcile: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/reconcile/preflight`, {
|
|
328
|
+
method: "POST",
|
|
329
|
+
body: JSON.stringify(payload)
|
|
330
|
+
}),
|
|
331
|
+
startAppReconcile: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/reconcile/start`, {
|
|
332
|
+
method: "POST",
|
|
333
|
+
body: JSON.stringify(payload)
|
|
334
|
+
}),
|
|
335
|
+
getAppReconcile: (appId, reconcileId) => request(`/v1/apps/${encodeURIComponent(appId)}/reconcile/${encodeURIComponent(reconcileId)}`, { method: "GET" }),
|
|
336
|
+
downloadAppReconcileBundle: (appId, reconcileId) => requestBinary(`/v1/apps/${encodeURIComponent(appId)}/reconcile/${encodeURIComponent(reconcileId)}/download.bundle`, {
|
|
337
|
+
method: "GET"
|
|
338
|
+
}),
|
|
339
|
+
syncLocalApp: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/sync-local`, {
|
|
340
|
+
method: "POST",
|
|
341
|
+
body: JSON.stringify(payload)
|
|
342
|
+
}),
|
|
343
|
+
initiateBundle: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/bundles`, { method: "POST", body: JSON.stringify(payload) }),
|
|
344
|
+
getBundle: (appId, bundleId) => request(`/v1/apps/${encodeURIComponent(appId)}/bundles/${encodeURIComponent(bundleId)}`, { method: "GET" }),
|
|
345
|
+
getBundleDownloadUrl: (appId, bundleId, options) => request(
|
|
346
|
+
`/v1/apps/${encodeURIComponent(appId)}/bundles/${encodeURIComponent(bundleId)}/download?redirect=${options?.redirect ?? false}`,
|
|
347
|
+
{ method: "GET" }
|
|
348
|
+
),
|
|
349
|
+
getBundleAssetsDownloadUrl: (appId, bundleId, options) => {
|
|
350
|
+
const qs = new URLSearchParams({
|
|
351
|
+
redirect: String(options?.redirect ?? false),
|
|
352
|
+
kind: options?.kind ?? "metro-assets"
|
|
353
|
+
});
|
|
354
|
+
return request(
|
|
355
|
+
`/v1/apps/${encodeURIComponent(appId)}/bundles/${encodeURIComponent(bundleId)}/assets/download?${qs.toString()}`,
|
|
356
|
+
{ method: "GET" }
|
|
357
|
+
);
|
|
358
|
+
},
|
|
359
|
+
listAgentRuns: (appId, params) => {
|
|
360
|
+
const qs = new URLSearchParams();
|
|
361
|
+
if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
|
|
362
|
+
if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
|
|
363
|
+
if (params?.status) qs.set("status", params.status);
|
|
364
|
+
if (params?.currentPhase) qs.set("currentPhase", params.currentPhase);
|
|
365
|
+
if (params?.createdAfter) qs.set("createdAfter", params.createdAfter);
|
|
366
|
+
if (params?.createdBefore) qs.set("createdBefore", params.createdBefore);
|
|
367
|
+
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
368
|
+
return request(`/v1/apps/${encodeURIComponent(appId)}/agent-runs${suffix}`, { method: "GET" });
|
|
369
|
+
},
|
|
370
|
+
getAgentRun: (appId, runId) => request(`/v1/apps/${encodeURIComponent(appId)}/agent-runs/${encodeURIComponent(runId)}`, { method: "GET" }),
|
|
371
|
+
listAgentRunEvents: (appId, runId, params) => {
|
|
372
|
+
const qs = new URLSearchParams();
|
|
373
|
+
if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
|
|
374
|
+
if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
|
|
375
|
+
if (params?.createdAfter) qs.set("createdAfter", params.createdAfter);
|
|
376
|
+
if (params?.createdBefore) qs.set("createdBefore", params.createdBefore);
|
|
377
|
+
const suffix = qs.toString() ? `?${qs.toString()}` : "";
|
|
378
|
+
return request(`/v1/apps/${encodeURIComponent(appId)}/agent-runs/${encodeURIComponent(runId)}/events${suffix}`, {
|
|
379
|
+
method: "GET"
|
|
380
|
+
});
|
|
381
|
+
},
|
|
382
|
+
getSandboxStatus: (appId) => request(`/v1/apps/${encodeURIComponent(appId)}/sandbox/status`, { method: "GET" })
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
export {
|
|
387
|
+
createApiClient
|
|
388
|
+
};
|