freestyle-sandboxes 0.0.96 → 0.1.0

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 (69) hide show
  1. package/README.md +39 -48
  2. package/index.cjs +4362 -0
  3. package/index.d.cts +9401 -0
  4. package/index.d.mts +9401 -0
  5. package/index.mjs +4348 -0
  6. package/package.json +16 -109
  7. package/dist/ai/inde.d.cts +0 -75
  8. package/dist/ai/inde.d.mts +0 -75
  9. package/dist/ai/index.cjs +0 -13
  10. package/dist/ai/index.d.cts +0 -75
  11. package/dist/ai/index.d.mts +0 -75
  12. package/dist/ai/index.mjs +0 -4
  13. package/dist/expo/inde.d.cts +0 -6
  14. package/dist/expo/inde.d.mts +0 -6
  15. package/dist/expo/index.cjs +0 -319
  16. package/dist/expo/index.d.cts +0 -6
  17. package/dist/expo/index.d.mts +0 -6
  18. package/dist/expo/index.mjs +0 -297
  19. package/dist/inde.d.cts +0 -373
  20. package/dist/inde.d.mts +0 -373
  21. package/dist/index-BKAG8L-o.mjs +0 -3061
  22. package/dist/index-DuOpIaWc.cjs +0 -3068
  23. package/dist/index.cjs +0 -1329
  24. package/dist/index.d-9H_wnIbz.d.ts +0 -4223
  25. package/dist/index.d.cts +0 -373
  26. package/dist/index.d.mts +0 -373
  27. package/dist/index.mjs +0 -1327
  28. package/dist/langgraph/inde.d.cts +0 -4180
  29. package/dist/langgraph/inde.d.mts +0 -4180
  30. package/dist/langgraph/index.cjs +0 -17155
  31. package/dist/langgraph/index.d.cts +0 -4180
  32. package/dist/langgraph/index.d.mts +0 -4180
  33. package/dist/langgraph/index.mjs +0 -17153
  34. package/dist/mastra/inde.d.cts +0 -2623
  35. package/dist/mastra/inde.d.mts +0 -2623
  36. package/dist/mastra/index.cjs +0 -55
  37. package/dist/mastra/index.d.cts +0 -2623
  38. package/dist/mastra/index.d.mts +0 -2623
  39. package/dist/mastra/index.mjs +0 -53
  40. package/dist/react/dev-server/index..d.cts +0 -33
  41. package/dist/react/dev-server/index..d.mts +0 -33
  42. package/dist/react/dev-server/index.cjs +0 -148
  43. package/dist/react/dev-server/index.d.cts +0 -33
  44. package/dist/react/dev-server/index.d.mts +0 -33
  45. package/dist/react/dev-server/index.mjs +0 -145
  46. package/dist/types.gen-CJa21P0C.d.ts +0 -1902
  47. package/dist/types.gen-DKjMRuu5.d.ts +0 -1898
  48. package/dist/utils/inde.d.cts +0 -10
  49. package/dist/utils/inde.d.mts +0 -10
  50. package/dist/utils/index.cjs +0 -100
  51. package/dist/utils/index.d.cts +0 -10
  52. package/dist/utils/index.d.mts +0 -10
  53. package/dist/utils/index.mjs +0 -75
  54. package/openapi/index.ts +0 -3
  55. package/openapi/sdk.gen.ts +0 -929
  56. package/openapi/types.gen.ts +0 -2234
  57. package/openapi-ts.config.ts +0 -7
  58. package/openapi.json +0 -1
  59. package/src/ai/index.ts +0 -164
  60. package/src/dev-server.ts +0 -95
  61. package/src/expo/_expo_internals.ts +0 -389
  62. package/src/expo/index.ts +0 -26
  63. package/src/index.ts +0 -1459
  64. package/src/langgraph/index.ts +0 -33
  65. package/src/mastra/index.ts +0 -38
  66. package/src/react/dev-server/index.tsx +0 -195
  67. package/src/react/dev-server/types.ts +0 -5
  68. package/src/utils/index.ts +0 -97
  69. package/tsconfig.json +0 -8
package/README.md CHANGED
@@ -1,62 +1,53 @@
1
- # Freestyle Sandboxes SDK
1
+ # Freestyle SDK
2
2
 
3
- SDK for [Freestyle Sandboxes API](https://api.freestyle.sh)
3
+ Learn more at [docs.freestyle.sh](https://docs.freestyle.sh)
4
4
 
5
- ## Installation
5
+ ```ts
6
+ import { freestyle } from "freestyle-sandboxes";
6
7
 
7
- ```bash
8
- npm install freestyle-sandboxes
9
- ```
10
-
11
- ## Usage
12
-
13
- ```javascript
14
- import { FreestyleSandboxes } from "freestyle-sandboxes";
15
-
16
- const sandboxes = new FreestyleSandboxes({
17
- apiKey: "your-api-key",
8
+ // Create and store code with git.
9
+ const { repoId } = await freestyle.git.repos.create({
10
+ source: {
11
+ url: "https://github.com/freestyle-sh/freestyle-base-nextjs-shadcn",
12
+ },
18
13
  });
19
14
 
20
- sandboxes.executeScript(
21
- `export default () => {
22
- let set1 = [1, 2, 3, 4, 5];
23
- let set2 = [4, 5, 6, 7, 8];
24
-
25
- // find the sum of every value of each set multiplied by every value of the other set
26
-
27
- let sum = 0;
28
- for (let i = 0; i < set1.length; i++) {
29
- for (let j = 0; j < set2.length; j++) {
30
- sum += set1[i] * set2[j];
31
- }
32
- }
33
-
34
- return sum;
35
- };`
36
- );
37
- ```
15
+ // Develop code with VMs.
16
+ const { vm } = await freestyle.vms.create({
17
+ gitRepos: [{ repo: repoId, path: "/repo" }],
18
+ });
38
19
 
39
- ## AI SDK
20
+ await vm.fs.writeTextFile("/repo/api/hello.js", "...");
40
21
 
41
- The freestyle-sandboxes/ai package provides utilities to add Freestyle Sandboxes to your AI.
22
+ // Deploy your code to the internet.
23
+ const { deploymentId } = await freestyle.edge.deployments.create({
24
+ repo: repoId,
25
+ });
42
26
 
43
- ### Usage
27
+ // Verify a custom domain and point it at your deployment.
28
+ const { record } = await freestyle.domains.verifications.create({
29
+ domain: "example.com",
30
+ });
44
31
 
45
- ```javascript
46
- import { executeTool } from "freestyle-sandboxes/ai";
47
- import { generateText } from "ai";
32
+ console.log(record);
48
33
 
49
- const codeExecutor = executeTool({
50
- apiKey: "your-api-key",
34
+ await freestyle.domains.verifications.complete({
35
+ domain: "example.com",
51
36
  });
52
37
 
53
- const { text, steps } = await generateText({
54
- model: yourModel,
55
- tools: {
56
- codeExecutor,
57
- },
58
- maxSteps: 2, // allow up to 5 steps
59
- prompt:
60
- "What is the sum of every number between 1 and 12 multiplied by itself?",
38
+ await freestyle.domains.mappings.create({
39
+ domain: "example.com",
40
+ deploymentId: deploymentId,
61
41
  });
42
+
43
+ // test your app with lightweight JS workers
44
+ for (let i = 0; i < 10; i++) {
45
+ freestyle.edge.runs.create({
46
+ code: `export default () => {
47
+ fetch("https://example.com/api/hello")
48
+ .then(res => res.json())
49
+ })
50
+ `,
51
+ });
52
+ }
62
53
  ```