freestyle-sandboxes 0.0.68 → 0.0.69

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/index.cjs CHANGED
@@ -57,6 +57,42 @@ const handleEphemeralDevServer = (options) => {
57
57
  url: "/ephemeral/v1/dev-servers"
58
58
  });
59
59
  };
60
+ const handleExecOnEphemeralDevServer = (options) => {
61
+ return (options?.client ?? client).post({
62
+ ...options,
63
+ url: "/ephemeral/v1/dev-servers/exec"
64
+ });
65
+ };
66
+ const handleWriteFileFromEphemeralDevServer = (options) => {
67
+ return (options?.client ?? client).put({
68
+ ...options,
69
+ url: "/ephemeral/v1/dev-servers/files/{*filepath}"
70
+ });
71
+ };
72
+ const handleReadFileFromEphemeralDevServer = (options) => {
73
+ return (options?.client ?? client).post({
74
+ ...options,
75
+ url: "/ephemeral/v1/dev-servers/files/{*filepath}"
76
+ });
77
+ };
78
+ const handleGitCommitPush = (options) => {
79
+ return (options?.client ?? client).post({
80
+ ...options,
81
+ url: "/ephemeral/v1/dev-servers/git/commit-push"
82
+ });
83
+ };
84
+ const handleShutdownDevServer = (options) => {
85
+ return (options?.client ?? client).post({
86
+ ...options,
87
+ url: "/ephemeral/v1/dev-servers/shutdown"
88
+ });
89
+ };
90
+ const handleDevServerStatus = (options) => {
91
+ return (options?.client ?? client).get({
92
+ ...options,
93
+ url: "/ephemeral/v1/dev-servers/status"
94
+ });
95
+ };
60
96
  const handleListExecuteRuns = (options) => {
61
97
  return (options?.client ?? client).get({
62
98
  ...options,
@@ -192,7 +228,17 @@ const handleListWebDeploys = (options) => {
192
228
 
193
229
  class FreestyleSandboxes {
194
230
  client;
231
+ options;
195
232
  constructor(options) {
233
+ this.options = options ?? {};
234
+ if (!options?.apiKey) {
235
+ this.options.apiKey = process.env.FREESTYLE_API_KEY;
236
+ }
237
+ if (!this.options.apiKey) {
238
+ throw new Error(
239
+ "No API key provided. Please set the FREESTYLE_API_KEY environment variable or configure apiKey when constructing FreestyleSandboxes."
240
+ );
241
+ }
196
242
  if (typeof Deno !== "undefined") {
197
243
  class FreestyleRequest extends Request {
198
244
  constructor(input, init) {
@@ -206,10 +252,10 @@ class FreestyleSandboxes {
206
252
  Request = FreestyleRequest;
207
253
  }
208
254
  this.client = clientFetch.createClient({
209
- baseUrl: options.baseUrl ?? "https://api.freestyle.sh",
255
+ baseUrl: this.options?.baseUrl ?? "https://api.freestyle.sh",
210
256
  headers: {
211
- Authorization: `Bearer ${options.apiKey}`,
212
- ...options.headers
257
+ Authorization: `Bearer ${this.options.apiKey}`,
258
+ ...this.options?.headers
213
259
  }
214
260
  });
215
261
  }
@@ -797,7 +843,7 @@ ${response.error.message}`);
797
843
  );
798
844
  }
799
845
  if (response.data.isNew) {
800
- const rId = options.repoId || options.repoUrl.split("/").at(-1);
846
+ const rId = options.repoId || options.repoUrl?.split("/").at(-1);
801
847
  await this.createGitTrigger({
802
848
  repoId: rId,
803
849
  action: {
@@ -815,17 +861,208 @@ ${response.error.message}`);
815
861
  if (!response.data) {
816
862
  throw new Error(`Failed to request dev server: ${response.error}`);
817
863
  }
864
+ const data = response.data;
865
+ const devServerInstance = {
866
+ repoId: options.repoId || options.repo || "",
867
+ kind: "repo"
868
+ };
869
+ const client = this.client;
870
+ const that = this;
818
871
  return {
819
- ...response.data,
820
- // @ts-ignore
821
- mcpEphemeralUrl: response.data.mcpEphemeralUrl || response.data.url + "/mcp",
822
- ephemeralUrl: response.data.ephemeralUrl ?? response.data.url,
823
- codeServerUrl: (
824
- // @ts-ignore
825
- response.data.codeServerUrl ?? response.data.ephemeralUrl + "/__freestyle_code_server/?folder=/template"
826
- )
872
+ isNew: data.isNew,
873
+ ephemeralUrl: data.ephemeralUrl ?? data.url,
874
+ mcpEphemeralUrl: data.mcpEphemeralUrl ?? data.url + "/mcp",
875
+ codeServerUrl: data.codeServerUrl ?? (data.ephemeralUrl ?? data.url) + "/__freestyle_code_server/?folder=/template",
876
+ async status() {
877
+ const response2 = await handleDevServerStatus({
878
+ client,
879
+ body: {
880
+ devServer: devServerInstance
881
+ }
882
+ });
883
+ if (response2.error) {
884
+ throw new Error(`Failed to get status: ${response2.error}`);
885
+ }
886
+ return {
887
+ installing: response2.data.installing,
888
+ devRunning: response2.data.devRunning
889
+ };
890
+ },
891
+ async commitAndPush(message) {
892
+ const response2 = await handleGitCommitPush({
893
+ client,
894
+ body: {
895
+ devServer: devServerInstance,
896
+ message
897
+ }
898
+ });
899
+ if (response2.error) {
900
+ throw new Error(`Failed to commit and push: ${response2.error}`);
901
+ }
902
+ },
903
+ async shutdown() {
904
+ const response2 = await handleShutdownDevServer({
905
+ client,
906
+ body: {
907
+ devServer: devServerInstance
908
+ }
909
+ });
910
+ if (response2.error) {
911
+ throw new Error(`Failed to shutdown dev server: ${response2.error}`);
912
+ }
913
+ return {
914
+ success: response2.data.success,
915
+ message: response2.data.message
916
+ };
917
+ },
918
+ fs: {
919
+ async ls(path = "") {
920
+ const response2 = await handleReadFileFromEphemeralDevServer({
921
+ client,
922
+ path: {
923
+ filepath: path
924
+ },
925
+ body: {
926
+ devServer: devServerInstance,
927
+ encoding: "utf-8"
928
+ }
929
+ });
930
+ if (response2.error) {
931
+ throw new Error(`Failed to list directory: ${response2.error}`);
932
+ }
933
+ if (!response2.data?.content) {
934
+ return [];
935
+ }
936
+ if (response2.data.content.kind === "directory") {
937
+ return response2.data.content.files;
938
+ }
939
+ return [];
940
+ },
941
+ async *watch() {
942
+ const response2 = await that.fetch(
943
+ "/ephemeral/v1/dev-servers/watch-files",
944
+ {
945
+ method: "POST",
946
+ body: JSON.stringify({
947
+ devServer: {
948
+ repoId: devServerInstance.repoId,
949
+ kind: devServerInstance.kind
950
+ }
951
+ })
952
+ }
953
+ );
954
+ if (!response2.ok) {
955
+ throw new Error(
956
+ `Failed to fetch stream: ${response2.status} ${response2.statusText}`
957
+ );
958
+ }
959
+ if (!response2.body) {
960
+ throw new Error("Failed to fetch stream: No response body");
961
+ }
962
+ const reader = response2.body.getReader();
963
+ const decoder = new TextDecoder("utf-8");
964
+ let buffer = "";
965
+ while (true) {
966
+ const { done, value } = await reader.read();
967
+ if (done) break;
968
+ buffer += decoder.decode(value, { stream: true });
969
+ let newlineIndex;
970
+ while ((newlineIndex = buffer.indexOf("\n")) >= 0) {
971
+ const line = buffer.slice(0, newlineIndex).trim();
972
+ buffer = buffer.slice(newlineIndex + 1);
973
+ if (line) {
974
+ yield JSON.parse(line);
975
+ }
976
+ }
977
+ }
978
+ if (buffer.trim()) {
979
+ yield JSON.parse(buffer.trim());
980
+ }
981
+ },
982
+ async readFile(path, encoding = "utf-8") {
983
+ const response2 = await handleReadFileFromEphemeralDevServer({
984
+ client,
985
+ path: {
986
+ filepath: path
987
+ },
988
+ body: {
989
+ devServer: devServerInstance,
990
+ encoding
991
+ }
992
+ });
993
+ if (response2.error) {
994
+ throw new Error(`Failed to read file: ${response2.error}`);
995
+ }
996
+ if (!response2.data?.content || response2.data.content.kind !== "file") {
997
+ throw new Error(`Not a file or file not found: ${path}`);
998
+ }
999
+ return response2.data.content.content;
1000
+ },
1001
+ async writeFile(path, content, encoding = "utf-8") {
1002
+ const contentStr = typeof content === "string" ? content : new TextDecoder(encoding).decode(content);
1003
+ const response2 = await handleWriteFileFromEphemeralDevServer({
1004
+ client,
1005
+ path: {
1006
+ filepath: path
1007
+ },
1008
+ body: {
1009
+ devServer: devServerInstance,
1010
+ content: contentStr,
1011
+ encoding
1012
+ }
1013
+ });
1014
+ if (response2.error) {
1015
+ throw new Error(`Failed to write file: ${response2.error}`);
1016
+ }
1017
+ }
1018
+ },
1019
+ process: {
1020
+ async exec(cmd, background = false) {
1021
+ const response2 = await handleExecOnEphemeralDevServer(
1022
+ {
1023
+ client,
1024
+ body: {
1025
+ devServer: devServerInstance,
1026
+ command: cmd,
1027
+ background
1028
+ }
1029
+ }
1030
+ );
1031
+ if (response2.error) {
1032
+ throw new Error(`Failed to execute command: ${response2.error}`);
1033
+ }
1034
+ return {
1035
+ id: response2.data.id,
1036
+ isNew: response2.data.isNew,
1037
+ stdout: response2.data.stdout,
1038
+ stderr: response2.data.stderr
1039
+ };
1040
+ }
1041
+ }
827
1042
  };
828
1043
  }
1044
+ fetch(path, init) {
1045
+ const headers = new Headers(init?.headers);
1046
+ for (const [key, value] of Object.entries(this.options.headers ?? {})) {
1047
+ if (!headers.has(key)) {
1048
+ headers.append(key, value);
1049
+ }
1050
+ }
1051
+ if (!headers.has("Authorization")) {
1052
+ headers.append("Authorization", `Bearer ${this.options.apiKey}`);
1053
+ }
1054
+ if (!headers.has("Content-Type")) {
1055
+ headers.append("Content-Type", "application/json");
1056
+ }
1057
+ const url = new URL(
1058
+ path,
1059
+ this.options.baseUrl ?? "https://api.freestyle.sh"
1060
+ );
1061
+ return fetch(url, {
1062
+ ...init ?? {},
1063
+ headers
1064
+ });
1065
+ }
829
1066
  }
830
1067
 
831
1068
  exports.FreestyleSandboxes = FreestyleSandboxes;
package/dist/index.d.cts CHANGED
@@ -1,22 +1,100 @@
1
- import { F as FreestyleExecuteScriptParamsConfiguration, a as FreestyleExecuteScriptResultSuccess, D as DeploymentSource, b as FreestyleDeployWebConfiguration, c as FreestyleDeployWebSuccessResponseV2, d as FreestyleCloudstateDeployRequest, e as FreestyleCloudstateDeploySuccessResponse, H as HandleBackupCloudstateResponse, f as HandleGetLogsResponse, g as HandleCreateDomainVerificationResponse, h as HandleVerifyDomainResponse, i as HandleVerifyDomainError, j as HandleListDomainsResponse, k as HandleListDomainVerificationRequestsResponse, l as HandleDeleteDomainVerificationResponse, m as HandleListWebDeploysResponse, n as HandleListExecuteRunsResponse, o as HandleGetExecuteRunResponse, p as HandleVerifyWildcardResponse, C as CreateRepositoryResponseSuccess, q as HandleListRepositoriesResponse, r as HandleDeleteRepoResponse, G as GitIdentity, s as HandleDeleteIdentityResponse, A as AccessLevel, t as HandleGrantPermissionResponse, L as ListPermissionResponseSuccess, u as DescribePermissionResponseSuccess, v as CreatedToken, w as ListGitTokensResponseSuccess, x as HandleListGitTriggersResponse, y as GitTrigger, z as GitTriggerAction, B as HandleCreateGitTriggerResponse } from './types.gen-BbekD8Sd.js';
2
- export { J as AccessTokenInfo, I as AccessibleRepository, K as Behavior, M as BlobEncoding, N as BlobObject, O as CommitObject, P as CommitParent, Q as CommitTree, R as CreateDomainMappingRequest, S as CreateRecordParams, T as CreateRepoRequest, V as CreateRepoSource, U as CreateRepositoryRequest, X as CustomBuildOptions, E as DeploymentBuildOptions, Y as DeploymentLogEntry, _ as DeploymentState, $ as DevServer, a1 as DevServerRequest, a2 as DevServerStatusRequest, a3 as DnsRecord, a4 as DnsRecordData, a5 as DnsRecordKind, a6 as DomainVerificationRequest, a7 as ExecRequest, a8 as ExecuteLogEntry, a9 as ExecuteRunInfo, aa as ExecuteRunState, ab as FileReadContent, ad as FreestyleCloudstateDeployConfiguration, ae as FreestyleCloudstateDeployErrorResponse, af as FreestyleDeleteDomainVerificationRequest, ag as FreestyleDeployWebErrorResponse, ah as FreestyleDeployWebPayload, ai as FreestyleDeployWebPayloadV2, aj as FreestyleDomainVerificationRequest, ak as FreestyleExecuteScriptParams, al as FreestyleFile, am as FreestyleGetLogsResponse, an as FreestyleJavaScriptLog, ao as FreestyleLogResponseObject, ap as FreestyleNetworkPermission, ar as FreestyleVerifyDomainRequest, as as GitCommitPushRequest, at as GitRepositoryTrigger, aw as GrantPermissionRequest, aP as HandleBackupCloudstateData, aQ as HandleBackupCloudstateError, b9 as HandleCreateDomainVerificationData, ba as HandleCreateDomainVerificationError, b_ as HandleCreateGitTokenData, c0 as HandleCreateGitTokenError, b$ as HandleCreateGitTokenResponse, cp as HandleCreateGitTriggerData, cq as HandleCreateGitTriggerError, bG as HandleCreateIdentityError, bF as HandleCreateIdentityResponse, aU as HandleCreateRecordData, aW as HandleCreateRecordError, aV as HandleCreateRecordResponse, c6 as HandleCreateRepoData, c8 as HandleCreateRepoError, c7 as HandleCreateRepoResponse, b4 as HandleDeleteDomainMappingData, b6 as HandleDeleteDomainMappingError, b5 as HandleDeleteDomainMappingResponse, bb as HandleDeleteDomainVerificationData, bc as HandleDeleteDomainVerificationError, cr as HandleDeleteGitTriggerData, ct as HandleDeleteGitTriggerError, cs as HandleDeleteGitTriggerResponse, bH as HandleDeleteIdentityData, bI as HandleDeleteIdentityError, aX as HandleDeleteRecordData, aZ as HandleDeleteRecordError, aY as HandleDeleteRecordResponse, cl as HandleDeleteRepoData, cm as HandleDeleteRepoError, aM as HandleDeployCloudstateData, aO as HandleDeployCloudstateError, aN as HandleDeployCloudstateResponse, cw as HandleDeployWebData, cy as HandleDeployWebError, cx as HandleDeployWebResponse, cz as HandleDeployWebV2Data, cB as HandleDeployWebV2Error, cA as HandleDeployWebV2Response, bM as HandleDescribePermissionData, bO as HandleDescribePermissionError, bN as HandleDescribePermissionResponse, bs as HandleDevServerStatusData, bu as HandleDevServerStatusError, bt as HandleDevServerStatusResponse, bd as HandleEphemeralDevServerData, bf as HandleEphemeralDevServerError, be as HandleEphemeralDevServerResponse, bg as HandleExecOnEphemeralDevServerData, bi as HandleExecOnEphemeralDevServerError, bh as HandleExecOnEphemeralDevServerResponse, bz as HandleExecuteScriptData, bB as HandleExecuteScriptError, bA as HandleExecuteScriptResponse, c9 as HandleGetBlobData, cb as HandleGetBlobError, ca as HandleGetBlobResponse, cc as HandleGetCommitData, ce as HandleGetCommitError, cd as HandleGetCommitResponse, bx as HandleGetExecuteRunData, by as HandleGetExecuteRunError, cu as HandleGetLogsData, cv as HandleGetLogsError, cf as HandleGetTagData, ch as HandleGetTagError, cg as HandleGetTagResponse, ci as HandleGetTreeData, ck as HandleGetTreeError, cj as HandleGetTreeResponse, cE as HandleGetWebDeployDetailsData, bp as HandleGitCommitPushData, br as HandleGitCommitPushError, bq as HandleGitCommitPushResponse, bP as HandleGrantPermissionData, bQ as HandleGrantPermissionError, b1 as HandleInsertDomainMappingData, b3 as HandleInsertDomainMappingError, b2 as HandleInsertDomainMappingResponse, b7 as HandleListDomainVerificationRequestsError, b0 as HandleListDomainsError, bv as HandleListExecuteRunsData, bw as HandleListExecuteRunsError, bX as HandleListGitTokensData, bZ as HandleListGitTokensError, bY as HandleListGitTokensResponse, cn as HandleListGitTriggersData, co as HandleListGitTriggersError, bC as HandleListIdentitiesData, bE as HandleListIdentitiesError, bD as HandleListIdentitiesResponse, bJ as HandleListPermissionsData, bL as HandleListPermissionsError, bK as HandleListPermissionsResponse, aR as HandleListRecordsData, aT as HandleListRecordsError, aS as HandleListRecordsResponse, c4 as HandleListRepositoriesData, c5 as HandleListRepositoriesError, cC as HandleListWebDeploysData, cD as HandleListWebDeploysError, bm as HandleReadFileFromEphemeralDevServerData, bo as HandleReadFileFromEphemeralDevServerError, bn as HandleReadFileFromEphemeralDevServerResponse, c1 as HandleRevokeGitTokenData, c3 as HandleRevokeGitTokenError, c2 as HandleRevokeGitTokenResponse, bR as HandleRevokePermissionData, bT as HandleRevokePermissionError, bS as HandleRevokePermissionResponse, bU as HandleUpdatePermissionData, bW as HandleUpdatePermissionError, bV as HandleUpdatePermissionResponse, b8 as HandleVerifyDomainData, a_ as HandleVerifyWildcardData, a$ as HandleVerifyWildcardError, bj as HandleWriteFileFromEphemeralDevServerData, bl as HandleWriteFileFromEphemeralDevServerError, bk as HandleWriteFileFromEphemeralDevServerResponse, ax as InternalServerError, ay as ListRecordsResponse, az as NetworkPermissionData, aA as ReadFileRequest, aB as RepositoryInfo, aC as RevokeGitTokenRequest, aD as Signature, aE as TagObject, aF as TagTarget, aG as TreeEntry, aI as TreeObject, aJ as UpdatePermissionRequest, aK as Visibility, aL as WriteFileRequest, aq as action, av as action2, au as event, Z as kind, a0 as kind2, ac as kind3, W as type, aH as type2 } from './types.gen-BbekD8Sd.js';
1
+ import { F as FreestyleExecuteScriptParamsConfiguration, a as FreestyleExecuteScriptResultSuccess, D as DeploymentSource, b as FreestyleDeployWebConfiguration, c as FreestyleDeployWebSuccessResponseV2, d as FreestyleCloudstateDeployRequest, e as FreestyleCloudstateDeploySuccessResponse, H as HandleBackupCloudstateResponse, f as HandleGetLogsResponse, g as HandleCreateDomainVerificationResponse, h as HandleVerifyDomainResponse, i as HandleVerifyDomainError, j as HandleListDomainsResponse, k as HandleListDomainVerificationRequestsResponse, l as HandleDeleteDomainVerificationResponse, m as HandleListWebDeploysResponse, n as HandleListExecuteRunsResponse, o as HandleGetExecuteRunResponse, p as HandleVerifyWildcardResponse, C as CreateRepositoryResponseSuccess, q as HandleListRepositoriesResponse, r as HandleDeleteRepoResponse, G as GitIdentity, s as HandleDeleteIdentityResponse, A as AccessLevel, t as HandleGrantPermissionResponse, L as ListPermissionResponseSuccess, u as DescribePermissionResponseSuccess, v as CreatedToken, w as ListGitTokensResponseSuccess, x as HandleListGitTriggersResponse, y as GitTrigger, z as GitTriggerAction, B as HandleCreateGitTriggerResponse } from './types.gen-wmZuN8DG.js';
2
+ export { J as AccessTokenInfo, I as AccessibleRepository, K as Behavior, M as BlobEncoding, N as BlobObject, O as CommitObject, P as CommitParent, Q as CommitTree, R as CreateDomainMappingRequest, S as CreateRecordParams, T as CreateRepoRequest, V as CreateRepoSource, U as CreateRepositoryRequest, X as CustomBuildOptions, E as DeploymentBuildOptions, Y as DeploymentLogEntry, _ as DeploymentState, $ as DevServer, a1 as DevServerRequest, a2 as DevServerStatusRequest, a3 as DnsRecord, a4 as DnsRecordData, a5 as DnsRecordKind, a6 as DomainVerificationRequest, a7 as ExecRequest, a8 as ExecuteLogEntry, a9 as ExecuteRunInfo, aa as ExecuteRunState, ab as FileReadContent, ad as FreestyleCloudstateDeployConfiguration, ae as FreestyleCloudstateDeployErrorResponse, af as FreestyleDeleteDomainVerificationRequest, ag as FreestyleDeployWebErrorResponse, ah as FreestyleDeployWebPayload, ai as FreestyleDeployWebPayloadV2, aj as FreestyleDomainVerificationRequest, ak as FreestyleExecuteScriptParams, al as FreestyleFile, am as FreestyleGetLogsResponse, an as FreestyleJavaScriptLog, ao as FreestyleLogResponseObject, ap as FreestyleNetworkPermission, ar as FreestyleVerifyDomainRequest, as as GitCommitPushRequest, at as GitReference, au as GitRepositoryTrigger, ax as GrantPermissionRequest, aR as HandleBackupCloudstateData, aS as HandleBackupCloudstateError, bb as HandleCreateDomainVerificationData, bc as HandleCreateDomainVerificationError, c3 as HandleCreateGitTokenData, c5 as HandleCreateGitTokenError, c4 as HandleCreateGitTokenResponse, cx as HandleCreateGitTriggerData, cy as HandleCreateGitTriggerError, bL as HandleCreateIdentityError, bK as HandleCreateIdentityResponse, aW as HandleCreateRecordData, aY as HandleCreateRecordError, aX as HandleCreateRecordResponse, cb as HandleCreateRepoData, cd as HandleCreateRepoError, cc as HandleCreateRepoResponse, b6 as HandleDeleteDomainMappingData, b8 as HandleDeleteDomainMappingError, b7 as HandleDeleteDomainMappingResponse, bd as HandleDeleteDomainVerificationData, be as HandleDeleteDomainVerificationError, cz as HandleDeleteGitTriggerData, cB as HandleDeleteGitTriggerError, cA as HandleDeleteGitTriggerResponse, bM as HandleDeleteIdentityData, bN as HandleDeleteIdentityError, aZ as HandleDeleteRecordData, a$ as HandleDeleteRecordError, a_ as HandleDeleteRecordResponse, ce as HandleDeleteRepoData, cf as HandleDeleteRepoError, aO as HandleDeployCloudstateData, aQ as HandleDeployCloudstateError, aP as HandleDeployCloudstateResponse, cH as HandleDeployWebData, cJ as HandleDeployWebError, cI as HandleDeployWebResponse, cK as HandleDeployWebV2Data, cM as HandleDeployWebV2Error, cL as HandleDeployWebV2Response, bR as HandleDescribePermissionData, bT as HandleDescribePermissionError, bS as HandleDescribePermissionResponse, bx as HandleDevServerStatusData, bz as HandleDevServerStatusError, by as HandleDevServerStatusResponse, bf as HandleEphemeralDevServerData, bh as HandleEphemeralDevServerError, bg as HandleEphemeralDevServerResponse, bi as HandleExecOnEphemeralDevServerData, bk as HandleExecOnEphemeralDevServerError, bj as HandleExecOnEphemeralDevServerResponse, bE as HandleExecuteScriptData, bG as HandleExecuteScriptError, bF as HandleExecuteScriptResponse, cg as HandleGetBlobData, ci as HandleGetBlobError, ch as HandleGetBlobResponse, cj as HandleGetCommitData, cl as HandleGetCommitError, ck as HandleGetCommitResponse, bC as HandleGetExecuteRunData, bD as HandleGetExecuteRunError, cC as HandleGetLogsData, cD as HandleGetLogsError, cm as HandleGetRefBranchData, co as HandleGetRefBranchError, cn as HandleGetRefBranchResponse, cE as HandleGetRefTagData, cG as HandleGetRefTagError, cF as HandleGetRefTagResponse, cp as HandleGetTagData, cr as HandleGetTagError, cq as HandleGetTagResponse, cs as HandleGetTreeData, cu as HandleGetTreeError, ct as HandleGetTreeResponse, cP as HandleGetWebDeployDetailsData, br as HandleGitCommitPushData, bt as HandleGitCommitPushError, bs as HandleGitCommitPushResponse, bU as HandleGrantPermissionData, bV as HandleGrantPermissionError, b3 as HandleInsertDomainMappingData, b5 as HandleInsertDomainMappingError, b4 as HandleInsertDomainMappingResponse, b9 as HandleListDomainVerificationRequestsError, b2 as HandleListDomainsError, bA as HandleListExecuteRunsData, bB as HandleListExecuteRunsError, c0 as HandleListGitTokensData, c2 as HandleListGitTokensError, c1 as HandleListGitTokensResponse, cv as HandleListGitTriggersData, cw as HandleListGitTriggersError, bH as HandleListIdentitiesData, bJ as HandleListIdentitiesError, bI as HandleListIdentitiesResponse, bO as HandleListPermissionsData, bQ as HandleListPermissionsError, bP as HandleListPermissionsResponse, aT as HandleListRecordsData, aV as HandleListRecordsError, aU as HandleListRecordsResponse, c9 as HandleListRepositoriesData, ca as HandleListRepositoriesError, cN as HandleListWebDeploysData, cO as HandleListWebDeploysError, bo as HandleReadFileFromEphemeralDevServerData, bq as HandleReadFileFromEphemeralDevServerError, bp as HandleReadFileFromEphemeralDevServerResponse, c6 as HandleRevokeGitTokenData, c8 as HandleRevokeGitTokenError, c7 as HandleRevokeGitTokenResponse, bW as HandleRevokePermissionData, bY as HandleRevokePermissionError, bX as HandleRevokePermissionResponse, bu as HandleShutdownDevServerData, bw as HandleShutdownDevServerError, bv as HandleShutdownDevServerResponse, bZ as HandleUpdatePermissionData, b$ as HandleUpdatePermissionError, b_ as HandleUpdatePermissionResponse, ba as HandleVerifyDomainData, b0 as HandleVerifyWildcardData, b1 as HandleVerifyWildcardError, bl as HandleWriteFileFromEphemeralDevServerData, bn as HandleWriteFileFromEphemeralDevServerError, bm as HandleWriteFileFromEphemeralDevServerResponse, ay as InternalServerError, az as ListRecordsResponse, aA as NetworkPermissionData, aB as ReadFileRequest, aC as RepositoryInfo, aD as RevokeGitTokenRequest, aE as ShutdownDevServerRequest, aF as Signature, aG as TagObject, aH as TagTarget, aI as TreeEntry, aK as TreeObject, aL as UpdatePermissionRequest, aM as Visibility, aN as WriteFileRequest, aq as action, aw as action2, av as event, Z as kind, a0 as kind2, ac as kind3, W as type, aJ as type2 } from './types.gen-wmZuN8DG.js';
3
3
 
4
+ interface FreestyleDevServer {
5
+ /**
6
+ * The URL for the dev server's HTTP API.
7
+ */
8
+ ephemeralUrl: string;
9
+ /**
10
+ * The URL to the MCP endpoint for the dev server.
11
+ */
12
+ mcpEphemeralUrl: string;
13
+ /**
14
+ * The URL for the VSCode server running in the dev server.
15
+ */
16
+ codeServerUrl: string;
17
+ /**
18
+ * Whether the dev server was just created.
19
+ */
20
+ isNew: boolean;
21
+ fs: FreestyleDevServerFilesystem;
22
+ process: FreestyleDevServerProcess;
23
+ /**
24
+ * Get the status of the dev server
25
+ */
26
+ status(): Promise<{
27
+ installing: boolean;
28
+ devRunning: boolean;
29
+ }>;
30
+ /**
31
+ * Commit and push changes to the dev server repository
32
+ * @param message The commit message
33
+ */
34
+ commitAndPush(message: string): Promise<void>;
35
+ /**
36
+ * Shutdown the dev server
37
+ */
38
+ shutdown(): Promise<{
39
+ success: boolean;
40
+ message: string;
41
+ }>;
42
+ }
43
+ interface FreestyleDevServerFilesystem {
44
+ /**
45
+ * List files in the dev server directory
46
+ */
47
+ ls(path?: string): Promise<Array<string>>;
48
+ /**
49
+ * Read a file from the dev server
50
+ * @param path The path to the file
51
+ * @param encoding The encoding to use (defaults to utf-8)
52
+ */
53
+ readFile(path: string, encoding?: string): Promise<string>;
54
+ /**
55
+ * Write a file to the dev server
56
+ * @param path The path to write to
57
+ * @param content The content to write
58
+ * @param encoding The encoding to use (defaults to utf-8)
59
+ */
60
+ writeFile(path: string, content: string | ArrayBufferLike, encoding?: string): Promise<void>;
61
+ watch(): AsyncGenerator<{
62
+ eventType: string;
63
+ filename: string;
64
+ }>;
65
+ }
66
+ interface FreestyleDevServerProcess {
67
+ /**
68
+ * Execute a command on the dev server
69
+ * @param cmd The command to execute
70
+ * @param background Whether to run the command in the background
71
+ */
72
+ exec(cmd: string, background?: boolean): Promise<{
73
+ id: string;
74
+ isNew: boolean;
75
+ stdout?: string[];
76
+ stderr?: string[];
77
+ }>;
78
+ }
79
+
80
+ type Options = {
81
+ /**
82
+ * The base URL for the API.
83
+ */
84
+ baseUrl?: string;
85
+ /**
86
+ * The API key to use for requests.
87
+ */
88
+ apiKey?: string;
89
+ /**
90
+ * Custom Headers to be sent with each request.
91
+ */
92
+ headers?: Record<string, string>;
93
+ };
4
94
  declare class FreestyleSandboxes {
5
95
  private client;
6
- constructor(options: {
7
- /**
8
- * The base URL for the API.
9
- */
10
- baseUrl?: string;
11
- /**
12
- * The API key to use for requests.
13
- */
14
- apiKey: string;
15
- /**
16
- * Custom Headers to be sent with each request.
17
- */
18
- headers?: Record<string, string>;
19
- });
96
+ options: Options;
97
+ constructor(options?: Options);
20
98
  /**
21
99
  * Execute a script in a sandbox.
22
100
  */
@@ -186,18 +264,18 @@ declare class FreestyleSandboxes {
186
264
  */
187
265
  repoUrl?: string;
188
266
  repoId?: string;
267
+ /**
268
+ * @deprecated
269
+ */
189
270
  repo?: string;
190
271
  baseId?: string;
191
272
  devCommand?: string;
192
- }): Promise<{
193
- mcpEphemeralUrl: any;
194
- ephemeralUrl: string;
195
- codeServerUrl: any;
196
- url: string;
197
- isNew: boolean;
198
- devCommandRunning: boolean;
199
- installCommandRunning: boolean;
200
- }>;
273
+ preDevCommandOnce?: string;
274
+ envVars?: Record<string, string>;
275
+ computeClass?: string;
276
+ timeout?: number;
277
+ }): Promise<FreestyleDevServer>;
278
+ fetch(path: string, init?: RequestInit): Promise<Response>;
201
279
  }
202
280
 
203
281
  export { AccessLevel, CreateRepositoryResponseSuccess, CreatedToken, DeploymentSource, DescribePermissionResponseSuccess, FreestyleCloudstateDeployRequest, FreestyleCloudstateDeploySuccessResponse, FreestyleDeployWebConfiguration, FreestyleDeployWebSuccessResponseV2, FreestyleExecuteScriptParamsConfiguration, FreestyleExecuteScriptResultSuccess, FreestyleSandboxes, GitIdentity, GitTrigger, GitTriggerAction, HandleBackupCloudstateResponse, HandleCreateDomainVerificationResponse, HandleCreateGitTriggerResponse, HandleDeleteDomainVerificationResponse, HandleDeleteIdentityResponse, HandleDeleteRepoResponse, HandleGetExecuteRunResponse, HandleGetLogsResponse, HandleGrantPermissionResponse, HandleListDomainVerificationRequestsResponse, HandleListDomainsResponse, HandleListExecuteRunsResponse, HandleListGitTriggersResponse, HandleListRepositoriesResponse, HandleListWebDeploysResponse, HandleVerifyDomainError, HandleVerifyDomainResponse, HandleVerifyWildcardResponse, ListGitTokensResponseSuccess, ListPermissionResponseSuccess };
package/dist/index.d.mts CHANGED
@@ -1,22 +1,100 @@
1
- import { F as FreestyleExecuteScriptParamsConfiguration, a as FreestyleExecuteScriptResultSuccess, D as DeploymentSource, b as FreestyleDeployWebConfiguration, c as FreestyleDeployWebSuccessResponseV2, d as FreestyleCloudstateDeployRequest, e as FreestyleCloudstateDeploySuccessResponse, H as HandleBackupCloudstateResponse, f as HandleGetLogsResponse, g as HandleCreateDomainVerificationResponse, h as HandleVerifyDomainResponse, i as HandleVerifyDomainError, j as HandleListDomainsResponse, k as HandleListDomainVerificationRequestsResponse, l as HandleDeleteDomainVerificationResponse, m as HandleListWebDeploysResponse, n as HandleListExecuteRunsResponse, o as HandleGetExecuteRunResponse, p as HandleVerifyWildcardResponse, C as CreateRepositoryResponseSuccess, q as HandleListRepositoriesResponse, r as HandleDeleteRepoResponse, G as GitIdentity, s as HandleDeleteIdentityResponse, A as AccessLevel, t as HandleGrantPermissionResponse, L as ListPermissionResponseSuccess, u as DescribePermissionResponseSuccess, v as CreatedToken, w as ListGitTokensResponseSuccess, x as HandleListGitTriggersResponse, y as GitTrigger, z as GitTriggerAction, B as HandleCreateGitTriggerResponse } from './types.gen-BbekD8Sd.js';
2
- export { J as AccessTokenInfo, I as AccessibleRepository, K as Behavior, M as BlobEncoding, N as BlobObject, O as CommitObject, P as CommitParent, Q as CommitTree, R as CreateDomainMappingRequest, S as CreateRecordParams, T as CreateRepoRequest, V as CreateRepoSource, U as CreateRepositoryRequest, X as CustomBuildOptions, E as DeploymentBuildOptions, Y as DeploymentLogEntry, _ as DeploymentState, $ as DevServer, a1 as DevServerRequest, a2 as DevServerStatusRequest, a3 as DnsRecord, a4 as DnsRecordData, a5 as DnsRecordKind, a6 as DomainVerificationRequest, a7 as ExecRequest, a8 as ExecuteLogEntry, a9 as ExecuteRunInfo, aa as ExecuteRunState, ab as FileReadContent, ad as FreestyleCloudstateDeployConfiguration, ae as FreestyleCloudstateDeployErrorResponse, af as FreestyleDeleteDomainVerificationRequest, ag as FreestyleDeployWebErrorResponse, ah as FreestyleDeployWebPayload, ai as FreestyleDeployWebPayloadV2, aj as FreestyleDomainVerificationRequest, ak as FreestyleExecuteScriptParams, al as FreestyleFile, am as FreestyleGetLogsResponse, an as FreestyleJavaScriptLog, ao as FreestyleLogResponseObject, ap as FreestyleNetworkPermission, ar as FreestyleVerifyDomainRequest, as as GitCommitPushRequest, at as GitRepositoryTrigger, aw as GrantPermissionRequest, aP as HandleBackupCloudstateData, aQ as HandleBackupCloudstateError, b9 as HandleCreateDomainVerificationData, ba as HandleCreateDomainVerificationError, b_ as HandleCreateGitTokenData, c0 as HandleCreateGitTokenError, b$ as HandleCreateGitTokenResponse, cp as HandleCreateGitTriggerData, cq as HandleCreateGitTriggerError, bG as HandleCreateIdentityError, bF as HandleCreateIdentityResponse, aU as HandleCreateRecordData, aW as HandleCreateRecordError, aV as HandleCreateRecordResponse, c6 as HandleCreateRepoData, c8 as HandleCreateRepoError, c7 as HandleCreateRepoResponse, b4 as HandleDeleteDomainMappingData, b6 as HandleDeleteDomainMappingError, b5 as HandleDeleteDomainMappingResponse, bb as HandleDeleteDomainVerificationData, bc as HandleDeleteDomainVerificationError, cr as HandleDeleteGitTriggerData, ct as HandleDeleteGitTriggerError, cs as HandleDeleteGitTriggerResponse, bH as HandleDeleteIdentityData, bI as HandleDeleteIdentityError, aX as HandleDeleteRecordData, aZ as HandleDeleteRecordError, aY as HandleDeleteRecordResponse, cl as HandleDeleteRepoData, cm as HandleDeleteRepoError, aM as HandleDeployCloudstateData, aO as HandleDeployCloudstateError, aN as HandleDeployCloudstateResponse, cw as HandleDeployWebData, cy as HandleDeployWebError, cx as HandleDeployWebResponse, cz as HandleDeployWebV2Data, cB as HandleDeployWebV2Error, cA as HandleDeployWebV2Response, bM as HandleDescribePermissionData, bO as HandleDescribePermissionError, bN as HandleDescribePermissionResponse, bs as HandleDevServerStatusData, bu as HandleDevServerStatusError, bt as HandleDevServerStatusResponse, bd as HandleEphemeralDevServerData, bf as HandleEphemeralDevServerError, be as HandleEphemeralDevServerResponse, bg as HandleExecOnEphemeralDevServerData, bi as HandleExecOnEphemeralDevServerError, bh as HandleExecOnEphemeralDevServerResponse, bz as HandleExecuteScriptData, bB as HandleExecuteScriptError, bA as HandleExecuteScriptResponse, c9 as HandleGetBlobData, cb as HandleGetBlobError, ca as HandleGetBlobResponse, cc as HandleGetCommitData, ce as HandleGetCommitError, cd as HandleGetCommitResponse, bx as HandleGetExecuteRunData, by as HandleGetExecuteRunError, cu as HandleGetLogsData, cv as HandleGetLogsError, cf as HandleGetTagData, ch as HandleGetTagError, cg as HandleGetTagResponse, ci as HandleGetTreeData, ck as HandleGetTreeError, cj as HandleGetTreeResponse, cE as HandleGetWebDeployDetailsData, bp as HandleGitCommitPushData, br as HandleGitCommitPushError, bq as HandleGitCommitPushResponse, bP as HandleGrantPermissionData, bQ as HandleGrantPermissionError, b1 as HandleInsertDomainMappingData, b3 as HandleInsertDomainMappingError, b2 as HandleInsertDomainMappingResponse, b7 as HandleListDomainVerificationRequestsError, b0 as HandleListDomainsError, bv as HandleListExecuteRunsData, bw as HandleListExecuteRunsError, bX as HandleListGitTokensData, bZ as HandleListGitTokensError, bY as HandleListGitTokensResponse, cn as HandleListGitTriggersData, co as HandleListGitTriggersError, bC as HandleListIdentitiesData, bE as HandleListIdentitiesError, bD as HandleListIdentitiesResponse, bJ as HandleListPermissionsData, bL as HandleListPermissionsError, bK as HandleListPermissionsResponse, aR as HandleListRecordsData, aT as HandleListRecordsError, aS as HandleListRecordsResponse, c4 as HandleListRepositoriesData, c5 as HandleListRepositoriesError, cC as HandleListWebDeploysData, cD as HandleListWebDeploysError, bm as HandleReadFileFromEphemeralDevServerData, bo as HandleReadFileFromEphemeralDevServerError, bn as HandleReadFileFromEphemeralDevServerResponse, c1 as HandleRevokeGitTokenData, c3 as HandleRevokeGitTokenError, c2 as HandleRevokeGitTokenResponse, bR as HandleRevokePermissionData, bT as HandleRevokePermissionError, bS as HandleRevokePermissionResponse, bU as HandleUpdatePermissionData, bW as HandleUpdatePermissionError, bV as HandleUpdatePermissionResponse, b8 as HandleVerifyDomainData, a_ as HandleVerifyWildcardData, a$ as HandleVerifyWildcardError, bj as HandleWriteFileFromEphemeralDevServerData, bl as HandleWriteFileFromEphemeralDevServerError, bk as HandleWriteFileFromEphemeralDevServerResponse, ax as InternalServerError, ay as ListRecordsResponse, az as NetworkPermissionData, aA as ReadFileRequest, aB as RepositoryInfo, aC as RevokeGitTokenRequest, aD as Signature, aE as TagObject, aF as TagTarget, aG as TreeEntry, aI as TreeObject, aJ as UpdatePermissionRequest, aK as Visibility, aL as WriteFileRequest, aq as action, av as action2, au as event, Z as kind, a0 as kind2, ac as kind3, W as type, aH as type2 } from './types.gen-BbekD8Sd.js';
1
+ import { F as FreestyleExecuteScriptParamsConfiguration, a as FreestyleExecuteScriptResultSuccess, D as DeploymentSource, b as FreestyleDeployWebConfiguration, c as FreestyleDeployWebSuccessResponseV2, d as FreestyleCloudstateDeployRequest, e as FreestyleCloudstateDeploySuccessResponse, H as HandleBackupCloudstateResponse, f as HandleGetLogsResponse, g as HandleCreateDomainVerificationResponse, h as HandleVerifyDomainResponse, i as HandleVerifyDomainError, j as HandleListDomainsResponse, k as HandleListDomainVerificationRequestsResponse, l as HandleDeleteDomainVerificationResponse, m as HandleListWebDeploysResponse, n as HandleListExecuteRunsResponse, o as HandleGetExecuteRunResponse, p as HandleVerifyWildcardResponse, C as CreateRepositoryResponseSuccess, q as HandleListRepositoriesResponse, r as HandleDeleteRepoResponse, G as GitIdentity, s as HandleDeleteIdentityResponse, A as AccessLevel, t as HandleGrantPermissionResponse, L as ListPermissionResponseSuccess, u as DescribePermissionResponseSuccess, v as CreatedToken, w as ListGitTokensResponseSuccess, x as HandleListGitTriggersResponse, y as GitTrigger, z as GitTriggerAction, B as HandleCreateGitTriggerResponse } from './types.gen-wmZuN8DG.js';
2
+ export { J as AccessTokenInfo, I as AccessibleRepository, K as Behavior, M as BlobEncoding, N as BlobObject, O as CommitObject, P as CommitParent, Q as CommitTree, R as CreateDomainMappingRequest, S as CreateRecordParams, T as CreateRepoRequest, V as CreateRepoSource, U as CreateRepositoryRequest, X as CustomBuildOptions, E as DeploymentBuildOptions, Y as DeploymentLogEntry, _ as DeploymentState, $ as DevServer, a1 as DevServerRequest, a2 as DevServerStatusRequest, a3 as DnsRecord, a4 as DnsRecordData, a5 as DnsRecordKind, a6 as DomainVerificationRequest, a7 as ExecRequest, a8 as ExecuteLogEntry, a9 as ExecuteRunInfo, aa as ExecuteRunState, ab as FileReadContent, ad as FreestyleCloudstateDeployConfiguration, ae as FreestyleCloudstateDeployErrorResponse, af as FreestyleDeleteDomainVerificationRequest, ag as FreestyleDeployWebErrorResponse, ah as FreestyleDeployWebPayload, ai as FreestyleDeployWebPayloadV2, aj as FreestyleDomainVerificationRequest, ak as FreestyleExecuteScriptParams, al as FreestyleFile, am as FreestyleGetLogsResponse, an as FreestyleJavaScriptLog, ao as FreestyleLogResponseObject, ap as FreestyleNetworkPermission, ar as FreestyleVerifyDomainRequest, as as GitCommitPushRequest, at as GitReference, au as GitRepositoryTrigger, ax as GrantPermissionRequest, aR as HandleBackupCloudstateData, aS as HandleBackupCloudstateError, bb as HandleCreateDomainVerificationData, bc as HandleCreateDomainVerificationError, c3 as HandleCreateGitTokenData, c5 as HandleCreateGitTokenError, c4 as HandleCreateGitTokenResponse, cx as HandleCreateGitTriggerData, cy as HandleCreateGitTriggerError, bL as HandleCreateIdentityError, bK as HandleCreateIdentityResponse, aW as HandleCreateRecordData, aY as HandleCreateRecordError, aX as HandleCreateRecordResponse, cb as HandleCreateRepoData, cd as HandleCreateRepoError, cc as HandleCreateRepoResponse, b6 as HandleDeleteDomainMappingData, b8 as HandleDeleteDomainMappingError, b7 as HandleDeleteDomainMappingResponse, bd as HandleDeleteDomainVerificationData, be as HandleDeleteDomainVerificationError, cz as HandleDeleteGitTriggerData, cB as HandleDeleteGitTriggerError, cA as HandleDeleteGitTriggerResponse, bM as HandleDeleteIdentityData, bN as HandleDeleteIdentityError, aZ as HandleDeleteRecordData, a$ as HandleDeleteRecordError, a_ as HandleDeleteRecordResponse, ce as HandleDeleteRepoData, cf as HandleDeleteRepoError, aO as HandleDeployCloudstateData, aQ as HandleDeployCloudstateError, aP as HandleDeployCloudstateResponse, cH as HandleDeployWebData, cJ as HandleDeployWebError, cI as HandleDeployWebResponse, cK as HandleDeployWebV2Data, cM as HandleDeployWebV2Error, cL as HandleDeployWebV2Response, bR as HandleDescribePermissionData, bT as HandleDescribePermissionError, bS as HandleDescribePermissionResponse, bx as HandleDevServerStatusData, bz as HandleDevServerStatusError, by as HandleDevServerStatusResponse, bf as HandleEphemeralDevServerData, bh as HandleEphemeralDevServerError, bg as HandleEphemeralDevServerResponse, bi as HandleExecOnEphemeralDevServerData, bk as HandleExecOnEphemeralDevServerError, bj as HandleExecOnEphemeralDevServerResponse, bE as HandleExecuteScriptData, bG as HandleExecuteScriptError, bF as HandleExecuteScriptResponse, cg as HandleGetBlobData, ci as HandleGetBlobError, ch as HandleGetBlobResponse, cj as HandleGetCommitData, cl as HandleGetCommitError, ck as HandleGetCommitResponse, bC as HandleGetExecuteRunData, bD as HandleGetExecuteRunError, cC as HandleGetLogsData, cD as HandleGetLogsError, cm as HandleGetRefBranchData, co as HandleGetRefBranchError, cn as HandleGetRefBranchResponse, cE as HandleGetRefTagData, cG as HandleGetRefTagError, cF as HandleGetRefTagResponse, cp as HandleGetTagData, cr as HandleGetTagError, cq as HandleGetTagResponse, cs as HandleGetTreeData, cu as HandleGetTreeError, ct as HandleGetTreeResponse, cP as HandleGetWebDeployDetailsData, br as HandleGitCommitPushData, bt as HandleGitCommitPushError, bs as HandleGitCommitPushResponse, bU as HandleGrantPermissionData, bV as HandleGrantPermissionError, b3 as HandleInsertDomainMappingData, b5 as HandleInsertDomainMappingError, b4 as HandleInsertDomainMappingResponse, b9 as HandleListDomainVerificationRequestsError, b2 as HandleListDomainsError, bA as HandleListExecuteRunsData, bB as HandleListExecuteRunsError, c0 as HandleListGitTokensData, c2 as HandleListGitTokensError, c1 as HandleListGitTokensResponse, cv as HandleListGitTriggersData, cw as HandleListGitTriggersError, bH as HandleListIdentitiesData, bJ as HandleListIdentitiesError, bI as HandleListIdentitiesResponse, bO as HandleListPermissionsData, bQ as HandleListPermissionsError, bP as HandleListPermissionsResponse, aT as HandleListRecordsData, aV as HandleListRecordsError, aU as HandleListRecordsResponse, c9 as HandleListRepositoriesData, ca as HandleListRepositoriesError, cN as HandleListWebDeploysData, cO as HandleListWebDeploysError, bo as HandleReadFileFromEphemeralDevServerData, bq as HandleReadFileFromEphemeralDevServerError, bp as HandleReadFileFromEphemeralDevServerResponse, c6 as HandleRevokeGitTokenData, c8 as HandleRevokeGitTokenError, c7 as HandleRevokeGitTokenResponse, bW as HandleRevokePermissionData, bY as HandleRevokePermissionError, bX as HandleRevokePermissionResponse, bu as HandleShutdownDevServerData, bw as HandleShutdownDevServerError, bv as HandleShutdownDevServerResponse, bZ as HandleUpdatePermissionData, b$ as HandleUpdatePermissionError, b_ as HandleUpdatePermissionResponse, ba as HandleVerifyDomainData, b0 as HandleVerifyWildcardData, b1 as HandleVerifyWildcardError, bl as HandleWriteFileFromEphemeralDevServerData, bn as HandleWriteFileFromEphemeralDevServerError, bm as HandleWriteFileFromEphemeralDevServerResponse, ay as InternalServerError, az as ListRecordsResponse, aA as NetworkPermissionData, aB as ReadFileRequest, aC as RepositoryInfo, aD as RevokeGitTokenRequest, aE as ShutdownDevServerRequest, aF as Signature, aG as TagObject, aH as TagTarget, aI as TreeEntry, aK as TreeObject, aL as UpdatePermissionRequest, aM as Visibility, aN as WriteFileRequest, aq as action, aw as action2, av as event, Z as kind, a0 as kind2, ac as kind3, W as type, aJ as type2 } from './types.gen-wmZuN8DG.js';
3
3
 
4
+ interface FreestyleDevServer {
5
+ /**
6
+ * The URL for the dev server's HTTP API.
7
+ */
8
+ ephemeralUrl: string;
9
+ /**
10
+ * The URL to the MCP endpoint for the dev server.
11
+ */
12
+ mcpEphemeralUrl: string;
13
+ /**
14
+ * The URL for the VSCode server running in the dev server.
15
+ */
16
+ codeServerUrl: string;
17
+ /**
18
+ * Whether the dev server was just created.
19
+ */
20
+ isNew: boolean;
21
+ fs: FreestyleDevServerFilesystem;
22
+ process: FreestyleDevServerProcess;
23
+ /**
24
+ * Get the status of the dev server
25
+ */
26
+ status(): Promise<{
27
+ installing: boolean;
28
+ devRunning: boolean;
29
+ }>;
30
+ /**
31
+ * Commit and push changes to the dev server repository
32
+ * @param message The commit message
33
+ */
34
+ commitAndPush(message: string): Promise<void>;
35
+ /**
36
+ * Shutdown the dev server
37
+ */
38
+ shutdown(): Promise<{
39
+ success: boolean;
40
+ message: string;
41
+ }>;
42
+ }
43
+ interface FreestyleDevServerFilesystem {
44
+ /**
45
+ * List files in the dev server directory
46
+ */
47
+ ls(path?: string): Promise<Array<string>>;
48
+ /**
49
+ * Read a file from the dev server
50
+ * @param path The path to the file
51
+ * @param encoding The encoding to use (defaults to utf-8)
52
+ */
53
+ readFile(path: string, encoding?: string): Promise<string>;
54
+ /**
55
+ * Write a file to the dev server
56
+ * @param path The path to write to
57
+ * @param content The content to write
58
+ * @param encoding The encoding to use (defaults to utf-8)
59
+ */
60
+ writeFile(path: string, content: string | ArrayBufferLike, encoding?: string): Promise<void>;
61
+ watch(): AsyncGenerator<{
62
+ eventType: string;
63
+ filename: string;
64
+ }>;
65
+ }
66
+ interface FreestyleDevServerProcess {
67
+ /**
68
+ * Execute a command on the dev server
69
+ * @param cmd The command to execute
70
+ * @param background Whether to run the command in the background
71
+ */
72
+ exec(cmd: string, background?: boolean): Promise<{
73
+ id: string;
74
+ isNew: boolean;
75
+ stdout?: string[];
76
+ stderr?: string[];
77
+ }>;
78
+ }
79
+
80
+ type Options = {
81
+ /**
82
+ * The base URL for the API.
83
+ */
84
+ baseUrl?: string;
85
+ /**
86
+ * The API key to use for requests.
87
+ */
88
+ apiKey?: string;
89
+ /**
90
+ * Custom Headers to be sent with each request.
91
+ */
92
+ headers?: Record<string, string>;
93
+ };
4
94
  declare class FreestyleSandboxes {
5
95
  private client;
6
- constructor(options: {
7
- /**
8
- * The base URL for the API.
9
- */
10
- baseUrl?: string;
11
- /**
12
- * The API key to use for requests.
13
- */
14
- apiKey: string;
15
- /**
16
- * Custom Headers to be sent with each request.
17
- */
18
- headers?: Record<string, string>;
19
- });
96
+ options: Options;
97
+ constructor(options?: Options);
20
98
  /**
21
99
  * Execute a script in a sandbox.
22
100
  */
@@ -186,18 +264,18 @@ declare class FreestyleSandboxes {
186
264
  */
187
265
  repoUrl?: string;
188
266
  repoId?: string;
267
+ /**
268
+ * @deprecated
269
+ */
189
270
  repo?: string;
190
271
  baseId?: string;
191
272
  devCommand?: string;
192
- }): Promise<{
193
- mcpEphemeralUrl: any;
194
- ephemeralUrl: string;
195
- codeServerUrl: any;
196
- url: string;
197
- isNew: boolean;
198
- devCommandRunning: boolean;
199
- installCommandRunning: boolean;
200
- }>;
273
+ preDevCommandOnce?: string;
274
+ envVars?: Record<string, string>;
275
+ computeClass?: string;
276
+ timeout?: number;
277
+ }): Promise<FreestyleDevServer>;
278
+ fetch(path: string, init?: RequestInit): Promise<Response>;
201
279
  }
202
280
 
203
281
  export { AccessLevel, CreateRepositoryResponseSuccess, CreatedToken, DeploymentSource, DescribePermissionResponseSuccess, FreestyleCloudstateDeployRequest, FreestyleCloudstateDeploySuccessResponse, FreestyleDeployWebConfiguration, FreestyleDeployWebSuccessResponseV2, FreestyleExecuteScriptParamsConfiguration, FreestyleExecuteScriptResultSuccess, FreestyleSandboxes, GitIdentity, GitTrigger, GitTriggerAction, HandleBackupCloudstateResponse, HandleCreateDomainVerificationResponse, HandleCreateGitTriggerResponse, HandleDeleteDomainVerificationResponse, HandleDeleteIdentityResponse, HandleDeleteRepoResponse, HandleGetExecuteRunResponse, HandleGetLogsResponse, HandleGrantPermissionResponse, HandleListDomainVerificationRequestsResponse, HandleListDomainsResponse, HandleListExecuteRunsResponse, HandleListGitTriggersResponse, HandleListRepositoriesResponse, HandleListWebDeploysResponse, HandleVerifyDomainError, HandleVerifyDomainResponse, HandleVerifyWildcardResponse, ListGitTokensResponseSuccess, ListPermissionResponseSuccess };