@remixhq/core 0.1.14 → 0.1.15

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.
Files changed (72) hide show
  1. package/dist/api.d.ts +1 -1
  2. package/dist/collab.d.ts +2 -2
  3. package/dist/collab.js +1 -1
  4. package/dist/{contracts-NbV3P_Rl.d.ts → contracts-CHmD-fMj.d.ts} +1 -1
  5. package/dist/history.d.ts +64 -0
  6. package/dist/history.js +529 -0
  7. package/dist/index.d.ts +1 -1
  8. package/package.json +6 -2
  9. package/dist/chunk-2WGZS7CD.js +0 -0
  10. package/dist/chunk-34WDQCPF.js +0 -242
  11. package/dist/chunk-4276ARDF.js +0 -303
  12. package/dist/chunk-4L3ZBZUQ.js +0 -281
  13. package/dist/chunk-54CBEP2W.js +0 -570
  14. package/dist/chunk-55K5GHAZ.js +0 -252
  15. package/dist/chunk-5H5CZKGN.js +0 -691
  16. package/dist/chunk-5NTOJXEZ.js +0 -223
  17. package/dist/chunk-7WUKH3ZD.js +0 -221
  18. package/dist/chunk-AE2HPMUZ.js +0 -80
  19. package/dist/chunk-AEAOYVIL.js +0 -200
  20. package/dist/chunk-B5S3PUIR.js +0 -388
  21. package/dist/chunk-BJFCN2C3.js +0 -46
  22. package/dist/chunk-BNKPTE2U.js +0 -401
  23. package/dist/chunk-C5NBNU32.js +0 -240
  24. package/dist/chunk-CJFGQE7D.js +0 -46
  25. package/dist/chunk-CUUXZSKW.js +0 -611
  26. package/dist/chunk-DCU3646I.js +0 -12
  27. package/dist/chunk-DEWAIK5X.js +0 -11
  28. package/dist/chunk-DRD6EVTT.js +0 -447
  29. package/dist/chunk-DXCL6I4Q.js +0 -399
  30. package/dist/chunk-E4KAGBU7.js +0 -134
  31. package/dist/chunk-E6AYE22H.js +0 -343
  32. package/dist/chunk-EF3677RE.js +0 -93
  33. package/dist/chunk-EVWDYCBL.js +0 -223
  34. package/dist/chunk-EW4PWFHB.js +0 -46
  35. package/dist/chunk-FAZUMWBS.js +0 -93
  36. package/dist/chunk-GEHSFPCD.js +0 -93
  37. package/dist/chunk-GFOBGYW4.js +0 -252
  38. package/dist/chunk-INDDXWAH.js +0 -92
  39. package/dist/chunk-IXWQWFYT.js +0 -342
  40. package/dist/chunk-J3J4PBQ7.js +0 -710
  41. package/dist/chunk-K54U353Z.js +0 -691
  42. package/dist/chunk-K57ZFDGC.js +0 -15
  43. package/dist/chunk-NDA7EJJA.js +0 -286
  44. package/dist/chunk-NK2DA4X6.js +0 -357
  45. package/dist/chunk-OBYR4JHZ.js +0 -374
  46. package/dist/chunk-OJMTW22J.js +0 -286
  47. package/dist/chunk-OMUDRPUI.js +0 -195
  48. package/dist/chunk-ONKKRS2C.js +0 -239
  49. package/dist/chunk-OWFBBWU7.js +0 -196
  50. package/dist/chunk-OZRXDDEL.js +0 -46
  51. package/dist/chunk-P7EM3N73.js +0 -46
  52. package/dist/chunk-POYB6MCQ.js +0 -373
  53. package/dist/chunk-PR5QKMHM.js +0 -46
  54. package/dist/chunk-R44EOUS4.js +0 -288
  55. package/dist/chunk-R7FVSCQW.js +0 -415
  56. package/dist/chunk-RIP2MIZL.js +0 -710
  57. package/dist/chunk-RKMMEML5.js +0 -46
  58. package/dist/chunk-RM2BGDBB.js +0 -400
  59. package/dist/chunk-RREREIGW.js +0 -710
  60. package/dist/chunk-TQHLFQY4.js +0 -448
  61. package/dist/chunk-TY3SSQQK.js +0 -688
  62. package/dist/chunk-UGKPOCN5.js +0 -710
  63. package/dist/chunk-UIGKSCTD.js +0 -406
  64. package/dist/chunk-UWIVJRTI.js +0 -343
  65. package/dist/chunk-VA6WXRWB.js +0 -636
  66. package/dist/chunk-XC2FV57P.js +0 -385
  67. package/dist/chunk-XOQIADCH.js +0 -223
  68. package/dist/chunk-ZAQZKEH4.js +0 -46
  69. package/dist/chunk-ZBMOGUSJ.js +0 -17
  70. package/dist/chunk-ZXP6ENQY.js +0 -244
  71. package/dist/index.cjs +0 -1269
  72. package/dist/index.d.cts +0 -482
@@ -1,46 +0,0 @@
1
- import {
2
- RemixError
3
- } from "./chunk-YZ34ICNN.js";
4
-
5
- // src/config/model.ts
6
- import { z } from "zod";
7
- var DEFAULT_API_URL = "http://192.168.8.251:8000";
8
- var DEFAULT_SUPABASE_URL = "https://xtfxwbckjpfmqubnsusu.supabase.co";
9
- var DEFAULT_SUPABASE_ANON_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Inh0Znh3YmNranBmbXF1Ym5zdXN1Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjA2MDEyMzAsImV4cCI6MjA3NjE3NzIzMH0.dzWGAWrK4CvrmHVHzf8w7JlUZohdap0ZPnLZnABMV8s";
10
- function isValidUrl(value) {
11
- try {
12
- new URL(value);
13
- return true;
14
- } catch {
15
- return false;
16
- }
17
- }
18
- var urlSchema = z.string().min(1).transform((s) => s.trim()).refine((s) => isValidUrl(s), "Invalid URL.").transform((s) => s.replace(/\/+$/, ""));
19
- var configSchema = z.object({
20
- apiUrl: urlSchema,
21
- supabaseUrl: urlSchema,
22
- supabaseAnonKey: z.string().min(1)
23
- });
24
- var cachedConfig = null;
25
- async function resolveConfig(_opts) {
26
- if (cachedConfig) return cachedConfig;
27
- const cfgRaw = {
28
- apiUrl: DEFAULT_API_URL,
29
- supabaseUrl: DEFAULT_SUPABASE_URL,
30
- supabaseAnonKey: DEFAULT_SUPABASE_ANON_KEY
31
- };
32
- const parsedCfg = configSchema.safeParse(cfgRaw);
33
- if (!parsedCfg.success) {
34
- throw new RemixError("Invalid core configuration.", {
35
- exitCode: 1,
36
- hint: parsedCfg.error.issues.map((i) => `${i.path.join(".") || "config"}: ${i.message}`).join("; ")
37
- });
38
- }
39
- cachedConfig = parsedCfg.data;
40
- return parsedCfg.data;
41
- }
42
-
43
- export {
44
- configSchema,
45
- resolveConfig
46
- };
@@ -1,46 +0,0 @@
1
- import {
2
- ComergeError
3
- } from "./chunk-K57ZFDGC.js";
4
-
5
- // src/config/model.ts
6
- import { z } from "zod";
7
- var DEFAULT_API_URL = "http://192.168.8.242:8080";
8
- var DEFAULT_SUPABASE_URL = "https://xtfxwbckjpfmqubnsusu.supabase.co";
9
- var DEFAULT_SUPABASE_ANON_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Inh0Znh3YmNranBmbXF1Ym5zdXN1Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjA2MDEyMzAsImV4cCI6MjA3NjE3NzIzMH0.dzWGAWrK4CvrmHVHzf8w7JlUZohdap0ZPnLZnABMV8s";
10
- function isValidUrl(value) {
11
- try {
12
- new URL(value);
13
- return true;
14
- } catch {
15
- return false;
16
- }
17
- }
18
- var urlSchema = z.string().min(1).transform((s) => s.trim()).refine((s) => isValidUrl(s), "Invalid URL.").transform((s) => s.replace(/\/+$/, ""));
19
- var configSchema = z.object({
20
- apiUrl: urlSchema,
21
- supabaseUrl: urlSchema,
22
- supabaseAnonKey: z.string().min(1)
23
- });
24
- var cachedConfig = null;
25
- async function resolveConfig(_opts) {
26
- if (cachedConfig) return cachedConfig;
27
- const cfgRaw = {
28
- apiUrl: DEFAULT_API_URL,
29
- supabaseUrl: DEFAULT_SUPABASE_URL,
30
- supabaseAnonKey: DEFAULT_SUPABASE_ANON_KEY
31
- };
32
- const parsedCfg = configSchema.safeParse(cfgRaw);
33
- if (!parsedCfg.success) {
34
- throw new ComergeError("Invalid core configuration.", {
35
- exitCode: 1,
36
- hint: parsedCfg.error.issues.map((i) => `${i.path.join(".") || "config"}: ${i.message}`).join("; ")
37
- });
38
- }
39
- cachedConfig = parsedCfg.data;
40
- return parsedCfg.data;
41
- }
42
-
43
- export {
44
- configSchema,
45
- resolveConfig
46
- };
@@ -1,373 +0,0 @@
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?.forked) qs.set("forked", params.forked);
120
- if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
121
- if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
122
- const suffix = qs.toString() ? `?${qs.toString()}` : "";
123
- return request(`/v1/apps${suffix}`, { method: "GET" });
124
- },
125
- getApp: (appId) => request(`/v1/apps/${encodeURIComponent(appId)}`, { method: "GET" }),
126
- getAppOverview: (appId) => request(`/v1/apps/${encodeURIComponent(appId)}/overview`, { method: "GET" }),
127
- listAppTimeline: (appId, params) => {
128
- const qs = new URLSearchParams();
129
- if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
130
- if (params?.cursor) qs.set("cursor", params.cursor);
131
- const suffix = qs.toString() ? `?${qs.toString()}` : "";
132
- return request(`/v1/apps/${encodeURIComponent(appId)}/timeline${suffix}`, { method: "GET" });
133
- },
134
- getAppTimelineEvent: (appId, eventId) => request(`/v1/apps/${encodeURIComponent(appId)}/timeline/${encodeURIComponent(eventId)}`, { method: "GET" }),
135
- listAppEditQueue: (appId, params) => {
136
- const qs = new URLSearchParams();
137
- if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
138
- if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
139
- const suffix = qs.toString() ? `?${qs.toString()}` : "";
140
- return request(`/v1/apps/${encodeURIComponent(appId)}/edit-queue${suffix}`, { method: "GET" });
141
- },
142
- getMergeRequest: (mrId) => request(`/v1/merge-requests/${encodeURIComponent(mrId)}`, { method: "GET" }),
143
- presignImportUpload: (payload) => request("/v1/apps/import/upload/presign", { method: "POST", body: JSON.stringify(payload) }),
144
- importFromUpload: (payload) => request("/v1/apps/import/upload", { method: "POST", body: JSON.stringify(payload) }),
145
- presignImportUploadFirstParty: (payload) => request("/v1/apps/import/upload/presign/first-party", { method: "POST", body: JSON.stringify(payload) }),
146
- importFromUploadFirstParty: (payload) => request("/v1/apps/import/upload/first-party", { method: "POST", body: JSON.stringify(payload) }),
147
- importFromGithubFirstParty: (payload) => request("/v1/apps/import/github/first-party", { method: "POST", body: JSON.stringify(payload) }),
148
- forkApp: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/fork`, { method: "POST", body: JSON.stringify(payload ?? {}) }),
149
- downloadAppBundle: (appId) => requestBinary(`/v1/apps/${encodeURIComponent(appId)}/download.bundle`, { method: "GET" }),
150
- createChangeStep: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/change-steps`, {
151
- method: "POST",
152
- body: JSON.stringify(payload)
153
- }),
154
- createCollabTurn: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/collab-turns`, {
155
- method: "POST",
156
- body: JSON.stringify(payload)
157
- }),
158
- listCollabTurns: (appId, params) => {
159
- const qs = new URLSearchParams();
160
- if (params?.limit !== void 0) qs.set("limit", String(params.limit));
161
- if (params?.offset !== void 0) qs.set("offset", String(params.offset));
162
- if (params?.changeStepId) qs.set("changeStepId", params.changeStepId);
163
- if (params?.threadId) qs.set("threadId", params.threadId);
164
- if (params?.createdAfter) qs.set("createdAfter", params.createdAfter);
165
- if (params?.createdBefore) qs.set("createdBefore", params.createdBefore);
166
- const suffix = qs.toString() ? `?${qs.toString()}` : "";
167
- return request(`/v1/apps/${encodeURIComponent(appId)}/collab-turns${suffix}`, { method: "GET" });
168
- },
169
- getCollabTurn: (appId, collabTurnId) => request(`/v1/apps/${encodeURIComponent(appId)}/collab-turns/${encodeURIComponent(collabTurnId)}`, {
170
- method: "GET"
171
- }),
172
- getAgentMemorySummary: (appId) => request(`/v1/apps/${encodeURIComponent(appId)}/agent-memory/summary`, { method: "GET" }),
173
- listAgentMemoryTimeline: (appId, params) => {
174
- const qs = new URLSearchParams();
175
- if (params?.limit !== void 0) qs.set("limit", String(params.limit));
176
- if (params?.offset !== void 0) qs.set("offset", String(params.offset));
177
- if (params?.createdAfter) qs.set("createdAfter", params.createdAfter);
178
- if (params?.createdBefore) qs.set("createdBefore", params.createdBefore);
179
- if (params?.kinds?.length) {
180
- for (const kind of params.kinds) qs.append("kinds", kind);
181
- }
182
- const suffix = qs.toString() ? `?${qs.toString()}` : "";
183
- return request(`/v1/apps/${encodeURIComponent(appId)}/agent-memory/timeline${suffix}`, { method: "GET" });
184
- },
185
- searchAgentMemory: (appId, params) => {
186
- const qs = new URLSearchParams();
187
- qs.set("q", params.q);
188
- if (params.limit !== void 0) qs.set("limit", String(params.limit));
189
- if (params.offset !== void 0) qs.set("offset", String(params.offset));
190
- if (params.createdAfter) qs.set("createdAfter", params.createdAfter);
191
- if (params.createdBefore) qs.set("createdBefore", params.createdBefore);
192
- if (params.kinds?.length) {
193
- for (const kind of params.kinds) qs.append("kinds", kind);
194
- }
195
- return request(`/v1/apps/${encodeURIComponent(appId)}/agent-memory/search?${qs.toString()}`, { method: "GET" });
196
- },
197
- getChangeStep: (appId, changeStepId) => request(`/v1/apps/${encodeURIComponent(appId)}/change-steps/${encodeURIComponent(changeStepId)}`, { method: "GET" }),
198
- getChangeStepDiff: (appId, changeStepId) => request(`/v1/apps/${encodeURIComponent(appId)}/change-steps/${encodeURIComponent(changeStepId)}/diff`, {
199
- method: "GET"
200
- }),
201
- startChangeStepReplay: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/change-steps/replays`, {
202
- method: "POST",
203
- body: JSON.stringify(payload)
204
- }),
205
- getChangeStepReplay: (appId, replayId) => request(`/v1/apps/${encodeURIComponent(appId)}/change-steps/replays/${encodeURIComponent(replayId)}`, {
206
- method: "GET"
207
- }),
208
- getChangeStepReplayDiff: (appId, replayId) => request(`/v1/apps/${encodeURIComponent(appId)}/change-steps/replays/${encodeURIComponent(replayId)}/diff`, {
209
- method: "GET"
210
- }),
211
- listMergeRequests: (params) => {
212
- const qs = new URLSearchParams();
213
- if (params?.queue) qs.set("queue", params.queue);
214
- if (params?.appId) qs.set("appId", params.appId);
215
- if (params?.sourceAppId) qs.set("sourceAppId", params.sourceAppId);
216
- if (params?.targetAppId) qs.set("targetAppId", params.targetAppId);
217
- if (Array.isArray(params?.status)) {
218
- for (const status of params.status) qs.append("status", status);
219
- } else if (typeof params?.status === "string") {
220
- qs.set("status", params.status);
221
- }
222
- if (params?.kind) qs.set("kind", params.kind);
223
- if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
224
- if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
225
- const suffix = qs.toString() ? `?${qs.toString()}` : "";
226
- return request(`/v1/merge-requests${suffix}`, { method: "GET" });
227
- },
228
- openMergeRequest: (sourceAppId) => request("/v1/merge-requests", { method: "POST", body: JSON.stringify({ sourceAppId }) }),
229
- getMergeRequestReview: (mrId) => request(`/v1/merge-requests/${encodeURIComponent(mrId)}/review`, { method: "GET" }),
230
- updateMergeRequest: (mrId, payload) => request(`/v1/merge-requests/${encodeURIComponent(mrId)}`, { method: "PATCH", body: JSON.stringify(payload) }),
231
- createOrganizationInvite: (orgId, payload) => request(`/v1/organizations/${encodeURIComponent(orgId)}/invitations`, {
232
- method: "POST",
233
- body: JSON.stringify(payload)
234
- }),
235
- createProjectInvite: (projectId, payload) => request(`/v1/projects/${encodeURIComponent(projectId)}/invitations`, {
236
- method: "POST",
237
- body: JSON.stringify(payload)
238
- }),
239
- createAppInvite: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/invitations`, {
240
- method: "POST",
241
- body: JSON.stringify(payload)
242
- }),
243
- listOrganizationMembers: (orgId, params) => {
244
- const qs = new URLSearchParams();
245
- if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
246
- if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
247
- const suffix = qs.toString() ? `?${qs.toString()}` : "";
248
- return request(`/v1/organizations/${encodeURIComponent(orgId)}/members${suffix}`, { method: "GET" });
249
- },
250
- updateOrganizationMember: (orgId, userId, payload) => request(`/v1/organizations/${encodeURIComponent(orgId)}/members/${encodeURIComponent(userId)}`, {
251
- method: "PATCH",
252
- body: JSON.stringify(payload)
253
- }),
254
- listProjectMembers: (projectId, params) => {
255
- const qs = new URLSearchParams();
256
- if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
257
- if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
258
- const suffix = qs.toString() ? `?${qs.toString()}` : "";
259
- return request(`/v1/projects/${encodeURIComponent(projectId)}/members${suffix}`, { method: "GET" });
260
- },
261
- updateProjectMember: (projectId, userId, payload) => request(`/v1/projects/${encodeURIComponent(projectId)}/members/${encodeURIComponent(userId)}`, {
262
- method: "PATCH",
263
- body: JSON.stringify(payload)
264
- }),
265
- listAppMembers: (appId, params) => {
266
- const qs = new URLSearchParams();
267
- if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
268
- if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
269
- const suffix = qs.toString() ? `?${qs.toString()}` : "";
270
- return request(`/v1/apps/${encodeURIComponent(appId)}/members${suffix}`, { method: "GET" });
271
- },
272
- updateAppMember: (appId, userId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/members/${encodeURIComponent(userId)}`, {
273
- method: "PATCH",
274
- body: JSON.stringify(payload)
275
- }),
276
- listOrganizationInvites: (orgId, params) => {
277
- const qs = new URLSearchParams();
278
- if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
279
- if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
280
- const suffix = qs.toString() ? `?${qs.toString()}` : "";
281
- return request(`/v1/organizations/${encodeURIComponent(orgId)}/invitations${suffix}`, { method: "GET" });
282
- },
283
- listProjectInvites: (projectId, params) => {
284
- const qs = new URLSearchParams();
285
- if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
286
- if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
287
- const suffix = qs.toString() ? `?${qs.toString()}` : "";
288
- return request(`/v1/projects/${encodeURIComponent(projectId)}/invitations${suffix}`, { method: "GET" });
289
- },
290
- listAppInvites: (appId, params) => {
291
- const qs = new URLSearchParams();
292
- if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
293
- if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
294
- const suffix = qs.toString() ? `?${qs.toString()}` : "";
295
- return request(`/v1/apps/${encodeURIComponent(appId)}/invitations${suffix}`, { method: "GET" });
296
- },
297
- resendOrganizationInvite: (orgId, inviteId, payload) => request(`/v1/organizations/${encodeURIComponent(orgId)}/invitations/${encodeURIComponent(inviteId)}/resend`, {
298
- method: "POST",
299
- body: JSON.stringify(payload ?? {})
300
- }),
301
- resendProjectInvite: (projectId, inviteId, payload) => request(`/v1/projects/${encodeURIComponent(projectId)}/invitations/${encodeURIComponent(inviteId)}/resend`, {
302
- method: "POST",
303
- body: JSON.stringify(payload ?? {})
304
- }),
305
- resendAppInvite: (appId, inviteId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/invitations/${encodeURIComponent(inviteId)}/resend`, {
306
- method: "POST",
307
- body: JSON.stringify(payload ?? {})
308
- }),
309
- revokeOrganizationInvite: (orgId, inviteId) => request(`/v1/organizations/${encodeURIComponent(orgId)}/invitations/${encodeURIComponent(inviteId)}`, {
310
- method: "DELETE"
311
- }),
312
- revokeProjectInvite: (projectId, inviteId) => request(`/v1/projects/${encodeURIComponent(projectId)}/invitations/${encodeURIComponent(inviteId)}`, {
313
- method: "DELETE"
314
- }),
315
- revokeAppInvite: (appId, inviteId) => request(`/v1/apps/${encodeURIComponent(appId)}/invitations/${encodeURIComponent(inviteId)}`, {
316
- method: "DELETE"
317
- }),
318
- acceptInvitation: (payload) => request("/v1/invitations/accept", { method: "POST", body: JSON.stringify(payload) }),
319
- syncUpstreamApp: (appId) => request(`/v1/apps/${encodeURIComponent(appId)}/sync-upstream`, {
320
- method: "POST",
321
- body: JSON.stringify({})
322
- }),
323
- preflightAppReconcile: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/reconcile/preflight`, {
324
- method: "POST",
325
- body: JSON.stringify(payload)
326
- }),
327
- startAppReconcile: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/reconcile/start`, {
328
- method: "POST",
329
- body: JSON.stringify(payload)
330
- }),
331
- getAppReconcile: (appId, reconcileId) => request(`/v1/apps/${encodeURIComponent(appId)}/reconcile/${encodeURIComponent(reconcileId)}`, { method: "GET" }),
332
- downloadAppReconcileBundle: (appId, reconcileId) => requestBinary(`/v1/apps/${encodeURIComponent(appId)}/reconcile/${encodeURIComponent(reconcileId)}/download.bundle`, {
333
- method: "GET"
334
- }),
335
- syncLocalApp: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/sync-local`, {
336
- method: "POST",
337
- body: JSON.stringify(payload)
338
- }),
339
- initiateBundle: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/bundles`, { method: "POST", body: JSON.stringify(payload) }),
340
- getBundle: (appId, bundleId) => request(`/v1/apps/${encodeURIComponent(appId)}/bundles/${encodeURIComponent(bundleId)}`, { method: "GET" }),
341
- getBundleDownloadUrl: (appId, bundleId, options) => request(
342
- `/v1/apps/${encodeURIComponent(appId)}/bundles/${encodeURIComponent(bundleId)}/download?redirect=${options?.redirect ?? false}`,
343
- { method: "GET" }
344
- ),
345
- getBundleAssetsDownloadUrl: (appId, bundleId, options) => {
346
- const qs = new URLSearchParams({
347
- redirect: String(options?.redirect ?? false),
348
- kind: options?.kind ?? "metro-assets"
349
- });
350
- return request(
351
- `/v1/apps/${encodeURIComponent(appId)}/bundles/${encodeURIComponent(bundleId)}/assets/download?${qs.toString()}`,
352
- { method: "GET" }
353
- );
354
- },
355
- getAgentRun: (appId, runId) => request(`/v1/apps/${encodeURIComponent(appId)}/agent-runs/${encodeURIComponent(runId)}`, { method: "GET" }),
356
- listAgentRunEvents: (appId, runId, params) => {
357
- const qs = new URLSearchParams();
358
- if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
359
- if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
360
- if (params?.createdAfter) qs.set("createdAfter", params.createdAfter);
361
- if (params?.createdBefore) qs.set("createdBefore", params.createdBefore);
362
- const suffix = qs.toString() ? `?${qs.toString()}` : "";
363
- return request(`/v1/apps/${encodeURIComponent(appId)}/agent-runs/${encodeURIComponent(runId)}/events${suffix}`, {
364
- method: "GET"
365
- });
366
- },
367
- getSandboxStatus: (appId) => request(`/v1/apps/${encodeURIComponent(appId)}/sandbox/status`, { method: "GET" })
368
- };
369
- }
370
-
371
- export {
372
- createApiClient
373
- };
@@ -1,46 +0,0 @@
1
- import {
2
- ComergeError
3
- } from "./chunk-ZBMOGUSJ.js";
4
-
5
- // src/config/model.ts
6
- import { z } from "zod";
7
- var DEFAULT_API_URL = "http://192.168.8.242:8080";
8
- var DEFAULT_SUPABASE_URL = "https://xtfxwbckjpfmqubnsusu.supabase.co";
9
- var DEFAULT_SUPABASE_ANON_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Inh0Znh3YmNranBmbXF1Ym5zdXN1Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjA2MDEyMzAsImV4cCI6MjA3NjE3NzIzMH0.dzWGAWrK4CvrmHVHzf8w7JlUZohdap0ZPnLZnABMV8s";
10
- function isValidUrl(value) {
11
- try {
12
- new URL(value);
13
- return true;
14
- } catch {
15
- return false;
16
- }
17
- }
18
- var urlSchema = z.string().min(1).transform((s) => s.trim()).refine((s) => isValidUrl(s), "Invalid URL.").transform((s) => s.replace(/\/+$/, ""));
19
- var configSchema = z.object({
20
- apiUrl: urlSchema,
21
- supabaseUrl: urlSchema,
22
- supabaseAnonKey: z.string().min(1)
23
- });
24
- var cachedConfig = null;
25
- async function resolveConfig(_opts) {
26
- if (cachedConfig) return cachedConfig;
27
- const cfgRaw = {
28
- apiUrl: DEFAULT_API_URL,
29
- supabaseUrl: DEFAULT_SUPABASE_URL,
30
- supabaseAnonKey: DEFAULT_SUPABASE_ANON_KEY
31
- };
32
- const parsedCfg = configSchema.safeParse(cfgRaw);
33
- if (!parsedCfg.success) {
34
- throw new ComergeError("Invalid core configuration.", {
35
- exitCode: 1,
36
- hint: parsedCfg.error.issues.map((i) => `${i.path.join(".") || "config"}: ${i.message}`).join("; ")
37
- });
38
- }
39
- cachedConfig = parsedCfg.data;
40
- return parsedCfg.data;
41
- }
42
-
43
- export {
44
- configSchema,
45
- resolveConfig
46
- };