@finalai/sandbox-router-final 0.0.0-stage → 0.2.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 (67) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +4 -0
  3. package/README.md +38 -2
  4. package/dist/modules/frames.d.mts +18 -0
  5. package/dist/modules/frames.mjs +98 -0
  6. package/dist/modules/frames.mjs.map +7 -0
  7. package/dist/modules/images.d.mts +15 -0
  8. package/dist/modules/images.mjs +116 -0
  9. package/dist/modules/images.mjs.map +7 -0
  10. package/dist/modules/index.d.mts +4 -0
  11. package/dist/modules/index.mjs +16 -0
  12. package/dist/modules/index.mjs.map +7 -0
  13. package/dist/modules/limits.d.mts +6 -0
  14. package/dist/modules/limits.mjs +37 -0
  15. package/dist/modules/limits.mjs.map +7 -0
  16. package/dist/modules/options.d.mts +24 -0
  17. package/dist/modules/options.mjs +19 -0
  18. package/dist/modules/options.mjs.map +7 -0
  19. package/dist/modules/provider.d.mts +5 -0
  20. package/dist/modules/provider.mjs +647 -0
  21. package/dist/modules/provider.mjs.map +7 -0
  22. package/dist/modules/vm/api.d.mts +28 -0
  23. package/dist/modules/vm/api.mjs +94 -0
  24. package/dist/modules/vm/api.mjs.map +7 -0
  25. package/dist/modules/vm/client.d.mts +104 -0
  26. package/dist/modules/vm/client.mjs +186 -0
  27. package/dist/modules/vm/client.mjs.map +7 -0
  28. package/dist/modules/vm/clock.d.mts +5 -0
  29. package/dist/modules/vm/clock.mjs +11 -0
  30. package/dist/modules/vm/clock.mjs.map +7 -0
  31. package/dist/modules/vm/errors.d.mts +23 -0
  32. package/dist/modules/vm/errors.mjs +30 -0
  33. package/dist/modules/vm/errors.mjs.map +7 -0
  34. package/dist/modules/vm/exec.d.mts +47 -0
  35. package/dist/modules/vm/exec.mjs +292 -0
  36. package/dist/modules/vm/exec.mjs.map +7 -0
  37. package/dist/modules/vm/files.d.mts +18 -0
  38. package/dist/modules/vm/files.mjs +160 -0
  39. package/dist/modules/vm/files.mjs.map +7 -0
  40. package/dist/modules/vm/grants.d.mts +35 -0
  41. package/dist/modules/vm/grants.mjs +106 -0
  42. package/dist/modules/vm/grants.mjs.map +7 -0
  43. package/dist/modules/vm/ids.d.mts +3 -0
  44. package/dist/modules/vm/ids.mjs +35 -0
  45. package/dist/modules/vm/ids.mjs.map +7 -0
  46. package/dist/modules/vm/ingress.d.mts +99 -0
  47. package/dist/modules/vm/ingress.mjs +263 -0
  48. package/dist/modules/vm/ingress.mjs.map +7 -0
  49. package/dist/modules/vm/machines.d.mts +79 -0
  50. package/dist/modules/vm/machines.mjs +60 -0
  51. package/dist/modules/vm/machines.mjs.map +7 -0
  52. package/dist/modules/vm/network.d.mts +17 -0
  53. package/dist/modules/vm/network.mjs +44 -0
  54. package/dist/modules/vm/network.mjs.map +7 -0
  55. package/dist/modules/vm/sandbox.d.mts +75 -0
  56. package/dist/modules/vm/sandbox.mjs +175 -0
  57. package/dist/modules/vm/sandbox.mjs.map +7 -0
  58. package/dist/modules/vm/schemas.d.mts +1209 -0
  59. package/dist/modules/vm/schemas.mjs +289 -0
  60. package/dist/modules/vm/schemas.mjs.map +7 -0
  61. package/dist/modules/vm/wire.d.mts +3 -0
  62. package/dist/modules/vm/wire.mjs +9 -0
  63. package/dist/modules/vm/wire.mjs.map +7 -0
  64. package/dist/modules/vm/workload.d.mts +14 -0
  65. package/dist/modules/vm/workload.mjs +11 -0
  66. package/dist/modules/vm/workload.mjs.map +7 -0
  67. package/package.json +38 -4
@@ -0,0 +1,24 @@
1
+ import { MachineSort } from "./vm/machines.mjs";
2
+ import * as z from 'zod';
3
+ export interface FinalCredentialsIface {
4
+ apiKey: string;
5
+ apiUrl?: string;
6
+ }
7
+ export interface FinalProviderOptionsIface {
8
+ fetch?: typeof fetch;
9
+ previewDomain?: string;
10
+ }
11
+ export interface FinalOptionsIface {
12
+ projectId?: string;
13
+ cpuLimit?: number;
14
+ memoryLimitMib?: number;
15
+ machine?: {
16
+ types?: string[];
17
+ cpuFamilies?: string[];
18
+ sort?: MachineSort;
19
+ maxPricePerHour?: string;
20
+ };
21
+ publicPorts?: number[];
22
+ tools?: string[];
23
+ }
24
+ export declare const finalOptionsSchema: z.ZodType<FinalOptionsIface>;
@@ -0,0 +1,19 @@
1
+ import { MachineSort } from "./vm/machines.mjs";
2
+ import * as z from "zod";
3
+ const finalOptionsSchema = z.object({
4
+ projectId: z.string().min(1).optional(),
5
+ cpuLimit: z.number().positive().max(32).optional(),
6
+ memoryLimitMib: z.number().int().min(256).max(65536).optional(),
7
+ machine: z.object({
8
+ types: z.array(z.string().min(1)).optional(),
9
+ cpuFamilies: z.array(z.string().min(1)).optional(),
10
+ sort: z.nativeEnum(MachineSort).optional(),
11
+ maxPricePerHour: z.string().regex(/^\d+(?:\.\d{1,9})?$/).optional()
12
+ }).strict().optional(),
13
+ publicPorts: z.array(z.number().int().min(1).max(65535)).max(32).optional(),
14
+ tools: z.array(z.string().min(1)).optional()
15
+ }).strict();
16
+ export {
17
+ finalOptionsSchema
18
+ };
19
+ //# sourceMappingURL=options.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/options.ts"],
4
+ "sourcesContent": ["import { MachineSort } from \"./vm/machines.mjs\";\nimport * as z from 'zod';\n\nexport interface FinalCredentialsIface {\n // A Final API key with edit access to the project sandboxes are created in.\n apiKey: string;\n // The API's base URL; the public API by default.\n apiUrl?: string;\n}\n\nexport interface FinalProviderOptionsIface {\n fetch?: typeof fetch;\n // The domain port URLs are served under, for an API other than the public one.\n previewDomain?: string;\n}\n\n// This provider's entry of `providerOptions`.\nexport interface FinalOptionsIface {\n // The project (`prj_\u2026`) to create in; the API key's own project by default.\n projectId?: string;\n // Burst limits above the spec's size (the spec's `cpu` and `memoryMib` stay the guaranteed\n // request). Without them the size is fixed.\n cpuLimit?: number;\n memoryLimitMib?: number;\n // The machines the sandbox may run on, kept for every wake and move.\n machine?: {\n types?: string[];\n cpuFamilies?: string[];\n sort?: MachineSort;\n maxPricePerHour?: string;\n };\n // Ports published at create: reachable by anyone with the URL.\n publicPorts?: number[];\n // Platform tools to run in the sandbox (`docker`).\n tools?: string[];\n}\n\nexport const finalOptionsSchema: z.ZodType<FinalOptionsIface> = z\n .object({\n projectId: z.string().min(1).optional(),\n cpuLimit: z.number().positive().max(32).optional(),\n memoryLimitMib: z.number().int().min(256).max(65_536).optional(),\n machine: z\n .object({\n types: z.array(z.string().min(1)).optional(),\n cpuFamilies: z.array(z.string().min(1)).optional(),\n sort: z.nativeEnum(MachineSort).optional(),\n maxPricePerHour: z\n .string()\n .regex(/^\\d+(?:\\.\\d{1,9})?$/)\n .optional(),\n })\n .strict()\n .optional(),\n publicPorts: z.array(z.number().int().min(1).max(65_535)).max(32).optional(),\n tools: z.array(z.string().min(1)).optional(),\n })\n .strict();\n"],
5
+ "mappings": "AAAA,SAAS,mBAAmB;AAC5B,YAAY,OAAO;AAoCZ,MAAM,qBAAmD,EAC7D,OAAO;AAAA,EACN,WAAW,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS;AAAA,EACtC,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,SAAS;AAAA,EACjD,gBAAgB,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,EAAE,IAAI,KAAM,EAAE,SAAS;AAAA,EAC/D,SAAS,EACN,OAAO;AAAA,IACN,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,EAAE,SAAS;AAAA,IAC3C,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,EAAE,SAAS;AAAA,IACjD,MAAM,EAAE,WAAW,WAAW,EAAE,SAAS;AAAA,IACzC,iBAAiB,EACd,OAAO,EACP,MAAM,qBAAqB,EAC3B,SAAS;AAAA,EACd,CAAC,EACA,OAAO,EACP,SAAS;AAAA,EACZ,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,IAAI,KAAM,CAAC,EAAE,IAAI,EAAE,EAAE,SAAS;AAAA,EAC3E,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,EAAE,SAAS;AAC7C,CAAC,EACA,OAAO;",
6
+ "names": []
7
+ }
@@ -0,0 +1,5 @@
1
+ import { SandboxState, type ProviderIface } from '@finalai/sandbox-router/provider';
2
+ import { type FinalCredentialsIface, type FinalOptionsIface, type FinalProviderOptionsIface } from "./options.mjs";
3
+ export declare const sandboxStateOf: (native: string) => SandboxState;
4
+ export type FinalProviderIface = ProviderIface<FinalOptionsIface>;
5
+ export declare const final: (credentials: FinalCredentialsIface, options?: FinalProviderOptionsIface) => FinalProviderIface;