freestyle-sandboxes 0.0.36 → 0.0.38
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/ai/index.cjs +1 -1
- package/dist/ai/index.d.cts +12 -2
- package/dist/ai/index.d.mts +12 -2
- package/dist/ai/index.mjs +1 -1
- package/dist/index-CGc0kRd_.cjs +3257 -0
- package/dist/{index-BQHqnjZK.mjs → index-D1ulQeJR.mjs} +17 -1
- package/dist/{index-CEEa9WHp.cjs → index-H7UNEAjs.cjs} +17 -1
- package/dist/index-jh-93svX.mjs +3250 -0
- package/dist/langgraph/index.cjs +1 -1
- package/dist/langgraph/index.mjs +1 -1
- package/dist/mastra/index.cjs +1 -1
- package/dist/mastra/index.mjs +1 -1
- package/dist/{types.gen-DLYohMJT.d.ts → types.gen-CfrGF-JI.d.ts} +1 -1
- package/dist/utils/index.cjs +4 -2
- package/dist/utils/index.mjs +4 -2
- package/package.json +1 -1
- package/src/ai/index.ts +33 -3
- package/src/utils/index.ts +2 -0
- package/dist/types.gen-1sd31qLV.d.ts +0 -172
- package/dist/types.gen-BCdfx7yt.d.ts +0 -760
- package/dist/types.gen-BaMKzqxQ.d.ts +0 -233
- package/dist/types.gen-BtK6PMQy.d.ts +0 -195
- package/dist/types.gen-C03gaIPq.d.ts +0 -297
- package/dist/types.gen-CMuCas4r.d.ts +0 -183
- package/dist/types.gen-CnEkmbco.d.ts +0 -314
- package/dist/types.gen-DHmdEOOa.d.ts +0 -172
- package/dist/types.gen-DbTb_SrD.d.ts +0 -156
- package/dist/types.gen-DyY7Deri.d.ts +0 -138
- package/dist/types.gen-MBZCvIhE.d.ts +0 -311
- package/dist/types.gen-YhJAHBw8.d.ts +0 -233
- package/dist/types.gen-cCnnhnB6.d.ts +0 -182
- package/dist/types.gen-uDTr6v-7.d.ts +0 -731
package/dist/langgraph/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var index$1 = require('../index.cjs');
|
|
4
4
|
var zod = require('zod');
|
|
5
|
-
var index = require('../index-
|
|
5
|
+
var index = require('../index-H7UNEAjs.cjs');
|
|
6
6
|
require('@hey-api/client-fetch');
|
|
7
7
|
|
|
8
8
|
var REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
|
package/dist/langgraph/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FreestyleSandboxes } from '../index.mjs';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { g as getDefaultExportFromCjs, z as zodToJsonSchema, a as executeCodeSchema, e as executeCodeDescription } from '../index-
|
|
3
|
+
import { g as getDefaultExportFromCjs, z as zodToJsonSchema, a as executeCodeSchema, e as executeCodeDescription } from '../index-D1ulQeJR.mjs';
|
|
4
4
|
import '@hey-api/client-fetch';
|
|
5
5
|
|
|
6
6
|
var REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
|
package/dist/mastra/index.cjs
CHANGED
package/dist/mastra/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { e as executeCodeDescription, a as executeCodeSchema } from '../index-
|
|
2
|
+
import { e as executeCodeDescription, a as executeCodeSchema } from '../index-D1ulQeJR.mjs';
|
|
3
3
|
import { FreestyleSandboxes } from '../index.mjs';
|
|
4
4
|
import '@hey-api/client-fetch';
|
|
5
5
|
|
|
@@ -379,4 +379,4 @@ type HandleGetWebDeployDetailsData = {
|
|
|
379
379
|
};
|
|
380
380
|
};
|
|
381
381
|
|
|
382
|
-
export type {
|
|
382
|
+
export type { HandleListExecuteRunsError as $, action as A, Behavior as B, CreateRepositoryRequest as C, DeploymentLogEntry as D, ExecuteLogEntry as E, FreestyleExecuteScriptParamsConfiguration as F, FreestyleVerifyDomainRequest as G, HandleBackupCloudstateResponse as H, HandleDeployCloudstateData as I, HandleDeployCloudstateResponse as J, HandleDeployCloudstateError as K, HandleBackupCloudstateData as L, HandleBackupCloudstateError as M, NetworkPermissionData as N, HandleVerifyWildcardResponse as O, HandleVerifyWildcardError as P, HandleListDomainsError as Q, RepositoryInfo as R, HandleListDomainVerificationRequestsError as S, HandleVerifyDomainData as T, HandleVerifyDomainError as U, HandleCreateDomainVerificationData as V, HandleCreateDomainVerificationError as W, HandleDeleteDomainVerificationData as X, HandleDeleteDomainVerificationError as Y, HandleListExecuteRunsData as Z, HandleListExecuteRunsResponse as _, FreestyleExecuteScriptResultSuccess as a, HandleGetExecuteRunData as a0, HandleGetExecuteRunResponse as a1, HandleGetExecuteRunError as a2, HandleExecuteScriptData as a3, HandleExecuteScriptResponse as a4, HandleExecuteScriptError as a5, ListRepositoriesHandlerData as a6, ListRepositoriesHandlerResponse as a7, ListRepositoriesHandlerError as a8, CreateRepoHandlerData as a9, CreateRepoHandlerResponse as aa, CreateRepoHandlerError as ab, DeleteRepoHandlerData as ac, DeleteRepoHandlerResponse as ad, DeleteRepoHandlerError as ae, HandleGetLogsData as af, HandleGetLogsError as ag, HandleDeployWebData as ah, HandleDeployWebResponse as ai, HandleDeployWebError as aj, HandleListWebDeploysData as ak, HandleListWebDeploysResponse as al, HandleListWebDeploysError as am, HandleGetWebDeployDetailsData as an, FreestyleDeployWebConfiguration as b, FreestyleDeployWebSuccessResponse as c, FreestyleCloudstateDeployRequest as d, FreestyleCloudstateDeploySuccessResponse as e, HandleGetLogsResponse as f, HandleCreateDomainVerificationResponse as g, HandleVerifyDomainResponse as h, HandleListDomainsResponse as i, HandleListDomainVerificationRequestsResponse as j, HandleDeleteDomainVerificationResponse as k, DeploymentState as l, ExecuteRunInfo as m, ExecuteRunState as n, FreestyleCloudstateDeployConfiguration as o, FreestyleCloudstateDeployErrorResponse as p, FreestyleDeleteDomainVerificationRequest as q, FreestyleDeployWebErrorResponse as r, FreestyleDeployWebPayload as s, FreestyleDomainVerificationRequest as t, FreestyleExecuteScriptParams as u, FreestyleFile as v, FreestyleGetLogsResponse as w, FreestyleJavaScriptLog as x, FreestyleLogResponseObject as y, FreestyleNetworkPermission as z };
|
package/dist/utils/index.cjs
CHANGED
|
@@ -33,7 +33,8 @@ const prepareDirForDeployment = async (directory) => {
|
|
|
33
33
|
nodir: true,
|
|
34
34
|
ignore: ["**/node_modules/**"],
|
|
35
35
|
absolute: false,
|
|
36
|
-
dot: true
|
|
36
|
+
dot: true,
|
|
37
|
+
posix: true
|
|
37
38
|
});
|
|
38
39
|
for (const relativePath of patterns) {
|
|
39
40
|
try {
|
|
@@ -59,7 +60,8 @@ const prepareDirForDeploymentSync = (directory) => {
|
|
|
59
60
|
nodir: true,
|
|
60
61
|
ignore: ["**/node_modules/**"],
|
|
61
62
|
absolute: false,
|
|
62
|
-
dot: true
|
|
63
|
+
dot: true,
|
|
64
|
+
posix: true
|
|
63
65
|
});
|
|
64
66
|
for (const relativePath of patterns) {
|
|
65
67
|
try {
|
package/dist/utils/index.mjs
CHANGED
|
@@ -10,7 +10,8 @@ const prepareDirForDeployment = async (directory) => {
|
|
|
10
10
|
nodir: true,
|
|
11
11
|
ignore: ["**/node_modules/**"],
|
|
12
12
|
absolute: false,
|
|
13
|
-
dot: true
|
|
13
|
+
dot: true,
|
|
14
|
+
posix: true
|
|
14
15
|
});
|
|
15
16
|
for (const relativePath of patterns) {
|
|
16
17
|
try {
|
|
@@ -36,7 +37,8 @@ const prepareDirForDeploymentSync = (directory) => {
|
|
|
36
37
|
nodir: true,
|
|
37
38
|
ignore: ["**/node_modules/**"],
|
|
38
39
|
absolute: false,
|
|
39
|
-
dot: true
|
|
40
|
+
dot: true,
|
|
41
|
+
posix: true
|
|
40
42
|
});
|
|
41
43
|
for (const relativePath of patterns) {
|
|
42
44
|
try {
|
package/package.json
CHANGED
package/src/ai/index.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
FreestyleExecuteScriptParamsConfiguration,
|
|
3
|
+
FreestyleExecuteScriptResultSuccess,
|
|
4
|
+
HandleExecuteScriptError,
|
|
5
|
+
} from "../../openapi";
|
|
2
6
|
import { FreestyleSandboxes } from "..";
|
|
3
7
|
import { tool } from "ai";
|
|
4
8
|
import { z } from "zod";
|
|
@@ -40,11 +44,21 @@ export const executeCodeDescription = (envVars: string, nodeModules: string) =>
|
|
|
40
44
|
*
|
|
41
45
|
* @param config - Configuration for the tool
|
|
42
46
|
* @param config.apiKey - The API key to use
|
|
43
|
-
*
|
|
47
|
+
* @param {Function} [config.onResult] - Optional callback function to handle the result.
|
|
48
|
+
* @param {boolean} [config.truncateOutput=false] - Whether to truncate the result to 1000 characters and truncate individual logs to the first 250 characters; useful to prevent long outputs from filling the context window.
|
|
44
49
|
*/
|
|
45
50
|
export const executeTool = (
|
|
46
51
|
config: FreestyleExecuteScriptParamsConfiguration & {
|
|
47
52
|
apiKey: string;
|
|
53
|
+
onResult?: (_v: {
|
|
54
|
+
toolCallId: string;
|
|
55
|
+
input: {
|
|
56
|
+
script: string;
|
|
57
|
+
[key: string]: unknown;
|
|
58
|
+
};
|
|
59
|
+
result: FreestyleExecuteScriptResultSuccess | HandleExecuteScriptError;
|
|
60
|
+
}) => void | Promise<void>;
|
|
61
|
+
truncateOutput?: boolean;
|
|
48
62
|
}
|
|
49
63
|
) => {
|
|
50
64
|
const api = new FreestyleSandboxes({
|
|
@@ -56,9 +70,25 @@ export const executeTool = (
|
|
|
56
70
|
return tool({
|
|
57
71
|
description: executeCodeDescription(envVars, nodeModules),
|
|
58
72
|
parameters: executeCodeSchema,
|
|
59
|
-
execute: async ({ script }) => {
|
|
73
|
+
execute: async ({ script, ...otherParams }, { toolCallId }) => {
|
|
60
74
|
try {
|
|
61
75
|
const res = await api.executeScript(script, config);
|
|
76
|
+
if (config.onResult) {
|
|
77
|
+
await config.onResult({
|
|
78
|
+
toolCallId,
|
|
79
|
+
result: res,
|
|
80
|
+
input: {
|
|
81
|
+
script,
|
|
82
|
+
...otherParams,
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
if (config.truncateOutput) {
|
|
87
|
+
if ("output" in res) {
|
|
88
|
+
res.result = JSON.stringify(res.result).slice(0, 1000);
|
|
89
|
+
res.logs = res.logs.slice(0, 1000);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
62
92
|
return res;
|
|
63
93
|
} catch (e) {
|
|
64
94
|
console.log("ERROR: ", e.message);
|
package/src/utils/index.ts
CHANGED
|
@@ -15,6 +15,7 @@ export const prepareDirForDeployment = async (
|
|
|
15
15
|
ignore: ["**/node_modules/**"],
|
|
16
16
|
absolute: false,
|
|
17
17
|
dot: true,
|
|
18
|
+
posix: true,
|
|
18
19
|
});
|
|
19
20
|
|
|
20
21
|
for (const relativePath of patterns) {
|
|
@@ -47,6 +48,7 @@ export const prepareDirForDeploymentSync = (
|
|
|
47
48
|
ignore: ["**/node_modules/**"],
|
|
48
49
|
absolute: false,
|
|
49
50
|
dot: true,
|
|
51
|
+
posix: true,
|
|
50
52
|
});
|
|
51
53
|
|
|
52
54
|
for (const relativePath of patterns) {
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
type FreestyleCloudstateDeployConfiguration = {
|
|
2
|
-
/**
|
|
3
|
-
* ID of the project to deploy, if not provided will create a new project
|
|
4
|
-
*/
|
|
5
|
-
projectId?: (string) | null;
|
|
6
|
-
/**
|
|
7
|
-
* The environment variables that the cloudstate deploy can access
|
|
8
|
-
*/
|
|
9
|
-
envVars?: {
|
|
10
|
-
[key: string]: (string);
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
type FreestyleCloudstateDeployErrorResponse = {
|
|
14
|
-
message: string;
|
|
15
|
-
};
|
|
16
|
-
type FreestyleCloudstateDeployRequest = {
|
|
17
|
-
classes: string;
|
|
18
|
-
config?: FreestyleCloudstateDeployConfiguration;
|
|
19
|
-
};
|
|
20
|
-
type FreestyleCloudstateDeploySuccessResponse = {
|
|
21
|
-
/**
|
|
22
|
-
* The id of the project deployed to
|
|
23
|
-
*/
|
|
24
|
-
projectId: string;
|
|
25
|
-
};
|
|
26
|
-
type FreestyleDeployWebConfiguration = {
|
|
27
|
-
/**
|
|
28
|
-
* The entrypoint file for the website
|
|
29
|
-
*/
|
|
30
|
-
entrypoint?: (string) | null;
|
|
31
|
-
/**
|
|
32
|
-
* The custom domains for the website, eg. [\"subdomain.yourwebsite.com\"]. You may not include *.style.dev domains here, those are reserved for projectIds
|
|
33
|
-
*/
|
|
34
|
-
domains?: Array<(string)> | null;
|
|
35
|
-
/**
|
|
36
|
-
* The project id to deploy to, if not provided will create a new project, may be used to provision a new project with a specific id if that id is available
|
|
37
|
-
*/
|
|
38
|
-
projectId?: (string) | null;
|
|
39
|
-
/**
|
|
40
|
-
* Node Modules to install for the website, a map of package names to versions, e.g. { \"express\": \"4.17.1\" }. If this and a package-lock.json are provided, the package-lock.json, bun.lockb, pnpm-lock.yaml, or yarn.lock is also provided, the versions here will override the versions in those lock files.
|
|
41
|
-
*/
|
|
42
|
-
nodeModules?: {
|
|
43
|
-
[key: string]: (string);
|
|
44
|
-
} | null;
|
|
45
|
-
/**
|
|
46
|
-
* The environment variables that the website can access
|
|
47
|
-
* e.g. { \"RESEND_API_KEY\": \"re_123456789\" }
|
|
48
|
-
*/
|
|
49
|
-
envVars?: {
|
|
50
|
-
[key: string]: (string);
|
|
51
|
-
} | null;
|
|
52
|
-
};
|
|
53
|
-
type FreestyleDeployWebErrorResponse = {
|
|
54
|
-
message: string;
|
|
55
|
-
};
|
|
56
|
-
type FreestyleDeployWebPayload = {
|
|
57
|
-
/**
|
|
58
|
-
* The files to deploy, a map of file paths to file contents, e.g. { \"index.js\": {\"content\": \"your main\", \"encoding\": \"utf-8\"}, \"file2.js\": {\"content\": \"your helper\" } }
|
|
59
|
-
*
|
|
60
|
-
* **Do not include node modules in this bundle, they will not work**. Instead, includes a package-lock.json, bun.lockb, pnpm-lock.yaml, or yarn.lock, the node modules for the project will be installed from that lock file, or use the node_modules field in the configuration to specify the node modules to install.
|
|
61
|
-
*/
|
|
62
|
-
files: {
|
|
63
|
-
[key: string]: FreestyleFile;
|
|
64
|
-
};
|
|
65
|
-
config?: FreestyleDeployWebConfiguration;
|
|
66
|
-
};
|
|
67
|
-
type FreestyleDeployWebSuccessResponse = {
|
|
68
|
-
projectId: string;
|
|
69
|
-
};
|
|
70
|
-
type FreestyleDomainVerificationRequest = {
|
|
71
|
-
/**
|
|
72
|
-
* The domain to create a verification code for
|
|
73
|
-
*/
|
|
74
|
-
domain: string;
|
|
75
|
-
};
|
|
76
|
-
type FreestyleExecureScriptResultError = {
|
|
77
|
-
error: string;
|
|
78
|
-
};
|
|
79
|
-
type FreestyleExecureScriptResultSuccess = {
|
|
80
|
-
result: unknown;
|
|
81
|
-
};
|
|
82
|
-
type FreestyleExecuteScriptParams = {
|
|
83
|
-
/**
|
|
84
|
-
* The JavaScript or TypeScript script to execute
|
|
85
|
-
*/
|
|
86
|
-
script: string;
|
|
87
|
-
config?: FreestyleExecuteScriptParamsConfiguration;
|
|
88
|
-
};
|
|
89
|
-
type FreestyleExecuteScriptParamsConfiguration = {
|
|
90
|
-
/**
|
|
91
|
-
* The environment variables to set for the script
|
|
92
|
-
*/
|
|
93
|
-
envVars?: {
|
|
94
|
-
[key: string]: (string);
|
|
95
|
-
};
|
|
96
|
-
/**
|
|
97
|
-
* The node modules to install for the script
|
|
98
|
-
*/
|
|
99
|
-
nodeModules?: {
|
|
100
|
-
[key: string]: (string);
|
|
101
|
-
};
|
|
102
|
-
/**
|
|
103
|
-
* Tags for you to organize your scripts, useful for tracking what you're running
|
|
104
|
-
*/
|
|
105
|
-
tags?: Array<(string)>;
|
|
106
|
-
/**
|
|
107
|
-
* The script timeout
|
|
108
|
-
*/
|
|
109
|
-
timeout?: (string) | null;
|
|
110
|
-
};
|
|
111
|
-
type FreestyleFile = {
|
|
112
|
-
/**
|
|
113
|
-
* The content of the file
|
|
114
|
-
*/
|
|
115
|
-
content: string;
|
|
116
|
-
/**
|
|
117
|
-
* The encoding of the file. Either **utf-8** or **base64**
|
|
118
|
-
*/
|
|
119
|
-
encoding?: string;
|
|
120
|
-
};
|
|
121
|
-
type FreestyleLogResponseObject = {
|
|
122
|
-
message: string;
|
|
123
|
-
};
|
|
124
|
-
type FreestyleVerifyDomainRequest = {
|
|
125
|
-
domain: string;
|
|
126
|
-
};
|
|
127
|
-
type HandleDeployCloudstateData = {
|
|
128
|
-
body: FreestyleCloudstateDeployRequest;
|
|
129
|
-
};
|
|
130
|
-
type HandleDeployCloudstateResponse = (FreestyleCloudstateDeploySuccessResponse);
|
|
131
|
-
type HandleDeployCloudstateError = (FreestyleCloudstateDeployErrorResponse);
|
|
132
|
-
type HandleBackupCloudstateResponse = (Array<(number)>);
|
|
133
|
-
type HandleBackupCloudstateError = (unknown);
|
|
134
|
-
type HandleListDomainsResponse = ({
|
|
135
|
-
domains: Array<(string)>;
|
|
136
|
-
});
|
|
137
|
-
type HandleListDomainsError = ({
|
|
138
|
-
message: string;
|
|
139
|
-
});
|
|
140
|
-
type HandleVerifyDomainData = {
|
|
141
|
-
body: FreestyleVerifyDomainRequest;
|
|
142
|
-
};
|
|
143
|
-
type HandleVerifyDomainResponse = ({
|
|
144
|
-
domain: string;
|
|
145
|
-
});
|
|
146
|
-
type HandleVerifyDomainError = ({
|
|
147
|
-
message: string;
|
|
148
|
-
});
|
|
149
|
-
type HandleCreateDomainVerificationData = {
|
|
150
|
-
body: FreestyleDomainVerificationRequest;
|
|
151
|
-
};
|
|
152
|
-
type HandleCreateDomainVerificationResponse = ({
|
|
153
|
-
verification_code: string;
|
|
154
|
-
domain: string;
|
|
155
|
-
});
|
|
156
|
-
type HandleCreateDomainVerificationError = ({
|
|
157
|
-
message: string;
|
|
158
|
-
});
|
|
159
|
-
type HandleExecuteScriptData = {
|
|
160
|
-
body: FreestyleExecuteScriptParams;
|
|
161
|
-
};
|
|
162
|
-
type HandleExecuteScriptResponse = (FreestyleExecureScriptResultSuccess);
|
|
163
|
-
type HandleExecuteScriptError = (FreestyleExecureScriptResultError);
|
|
164
|
-
type HandleDeployWebData = {
|
|
165
|
-
body: FreestyleDeployWebPayload;
|
|
166
|
-
};
|
|
167
|
-
type HandleDeployWebResponse = (FreestyleDeployWebSuccessResponse);
|
|
168
|
-
type HandleDeployWebError = (FreestyleDeployWebErrorResponse);
|
|
169
|
-
type HandleGetLogsResponse = (Array<FreestyleLogResponseObject>);
|
|
170
|
-
type HandleGetLogsError = unknown;
|
|
171
|
-
|
|
172
|
-
export type { HandleCreateDomainVerificationData as A, HandleCreateDomainVerificationError as B, HandleExecuteScriptData as C, HandleExecuteScriptResponse as D, HandleExecuteScriptError as E, FreestyleExecuteScriptParamsConfiguration as F, HandleDeployWebData as G, HandleBackupCloudstateResponse as H, HandleDeployWebResponse as I, HandleDeployWebError as J, HandleGetLogsError as K, FreestyleExecureScriptResultSuccess as a, FreestyleDeployWebConfiguration as b, FreestyleDeployWebSuccessResponse as c, FreestyleCloudstateDeployRequest as d, FreestyleCloudstateDeploySuccessResponse as e, HandleGetLogsResponse as f, HandleCreateDomainVerificationResponse as g, HandleVerifyDomainResponse as h, HandleListDomainsResponse as i, FreestyleCloudstateDeployConfiguration as j, FreestyleCloudstateDeployErrorResponse as k, FreestyleDeployWebErrorResponse as l, FreestyleDeployWebPayload as m, FreestyleDomainVerificationRequest as n, FreestyleExecureScriptResultError as o, FreestyleExecuteScriptParams as p, FreestyleFile as q, FreestyleLogResponseObject as r, FreestyleVerifyDomainRequest as s, HandleDeployCloudstateData as t, HandleDeployCloudstateResponse as u, HandleDeployCloudstateError as v, HandleBackupCloudstateError as w, HandleListDomainsError as x, HandleVerifyDomainData as y, HandleVerifyDomainError as z };
|