@computesdk/vercel 1.5.7 → 1.5.8

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.js CHANGED
@@ -25,39 +25,6 @@ __export(index_exports, {
25
25
  module.exports = __toCommonJS(index_exports);
26
26
  var import_sandbox = require("@vercel/sandbox");
27
27
  var import_computesdk = require("computesdk");
28
- async function executeVercelCommand(sandbox, command, args = []) {
29
- const startTime = Date.now();
30
- try {
31
- const finishedCommand = await sandbox.runCommand(command, args);
32
- let stdout = "";
33
- let stderr = "";
34
- for await (const log of finishedCommand.logs()) {
35
- if (log.stream === "stdout") {
36
- stdout += log.data;
37
- } else if (log.stream === "stderr") {
38
- stderr += log.data;
39
- }
40
- }
41
- return {
42
- stdout,
43
- stderr,
44
- exitCode: finishedCommand.exitCode,
45
- executionTime: Date.now() - startTime,
46
- sandboxId: sandbox.sandboxId,
47
- provider: "vercel"
48
- };
49
- } catch (error) {
50
- return {
51
- stdout: "",
52
- stderr: error instanceof Error ? error.message : String(error),
53
- exitCode: 127,
54
- // Standard "command not found" exit code
55
- executionTime: Date.now() - startTime,
56
- sandboxId: sandbox.sandboxId,
57
- provider: "vercel"
58
- };
59
- }
60
- }
61
28
  var vercel = (0, import_computesdk.createProvider)({
62
29
  name: "vercel",
63
30
  methods: {
@@ -87,7 +54,6 @@ var vercel = (0, import_computesdk.createProvider)({
87
54
  );
88
55
  }
89
56
  }
90
- const runtime = options?.runtime || config.runtime || "node";
91
57
  const timeout = config.timeout || 3e5;
92
58
  try {
93
59
  let sandbox;
@@ -189,42 +155,59 @@ var vercel = (0, import_computesdk.createProvider)({
189
155
  // Instance operations (map to individual Sandbox methods)
190
156
  runCode: async (sandbox, code, runtime, config) => {
191
157
  const startTime = Date.now();
192
- try {
193
- const effectiveRuntime = runtime || config?.runtime || // Strong Python indicators
194
- (code.includes("print(") || code.includes("import ") || code.includes("def ") || code.includes("sys.") || code.includes("json.") || code.includes("__") || code.includes('f"') || code.includes("f'") || code.includes("raise ") ? "python" : "node");
195
- const encoded = Buffer.from(code).toString("base64");
196
- let commandString;
197
- if (effectiveRuntime === "python") {
198
- commandString = `echo "${encoded}" | base64 -d | python3`;
199
- } else {
200
- commandString = `echo "${encoded}" | base64 -d | node`;
158
+ const effectiveRuntime = runtime || config?.runtime || // Strong Python indicators
159
+ (code.includes("print(") || code.includes("import ") || code.includes("def ") || code.includes("sys.") || code.includes("json.") || code.includes("__") || code.includes('f"') || code.includes("f'") || code.includes("raise ") ? "python" : "node");
160
+ const encoded = Buffer.from(code).toString("base64");
161
+ const commandString = effectiveRuntime === "python" ? `echo "${encoded}" | base64 -d | python3` : `echo "${encoded}" | base64 -d | node`;
162
+ const result = await sandbox.runCommand("sh", ["-c", commandString]);
163
+ const stdout = await result.stdout();
164
+ const stderr = await result.stderr();
165
+ if (result.exitCode !== 0 && stderr) {
166
+ if (stderr.includes("SyntaxError") || stderr.includes("invalid syntax") || stderr.includes("Unexpected token") || stderr.includes("Unexpected identifier")) {
167
+ throw new Error(`Syntax error: ${stderr.trim()}`);
201
168
  }
202
- const result = await executeVercelCommand(sandbox, "sh", ["-c", commandString]);
203
- if (result.exitCode !== 0 && result.stderr) {
204
- if (result.stderr.includes("SyntaxError") || result.stderr.includes("invalid syntax") || result.stderr.includes("Unexpected token") || result.stderr.includes("Unexpected identifier")) {
205
- throw new Error(`Syntax error: ${result.stderr.trim()}`);
206
- }
207
- }
208
- return result;
209
- } catch (error) {
210
- if (error instanceof Error && error.message.includes("Syntax error")) {
211
- throw error;
212
- }
213
- throw new Error(
214
- `Vercel execution failed: ${error instanceof Error ? error.message : String(error)}`
215
- );
216
169
  }
217
- },
218
- runCommand: async (sandbox, command, args = [], options) => {
219
- const { command: finalCommand, args: finalArgs, isBackground } = (0, import_computesdk.createBackgroundCommand)(command, args, options);
220
- const result = await executeVercelCommand(sandbox, finalCommand, finalArgs);
221
170
  return {
222
- ...result,
223
- isBackground,
224
- // For background commands, we can't get a real PID, but we can indicate it's running
225
- ...isBackground && { pid: -1 }
171
+ stdout,
172
+ stderr,
173
+ exitCode: result.exitCode,
174
+ executionTime: Date.now() - startTime,
175
+ sandboxId: sandbox.sandboxId,
176
+ provider: "vercel"
226
177
  };
227
178
  },
179
+ runCommand: async (sandbox, command, args = []) => {
180
+ const startTime = Date.now();
181
+ try {
182
+ const quotedArgs = args.map((arg) => {
183
+ if (arg.includes(" ") || arg.includes('"') || arg.includes("'") || arg.includes("$") || arg.includes("`")) {
184
+ return `"${arg.replace(/"/g, '\\"')}"`;
185
+ }
186
+ return arg;
187
+ });
188
+ const fullCommand = quotedArgs.length > 0 ? `${command} ${quotedArgs.join(" ")}` : command;
189
+ const result = await sandbox.runCommand("sh", ["-c", fullCommand]);
190
+ const stdout = await result.stdout();
191
+ const stderr = await result.stderr();
192
+ return {
193
+ stdout,
194
+ stderr,
195
+ exitCode: result.exitCode,
196
+ executionTime: Date.now() - startTime,
197
+ sandboxId: sandbox.sandboxId,
198
+ provider: "vercel"
199
+ };
200
+ } catch (error) {
201
+ return {
202
+ stdout: "",
203
+ stderr: error instanceof Error ? error.message : String(error),
204
+ exitCode: 127,
205
+ executionTime: Date.now() - startTime,
206
+ sandboxId: sandbox.sandboxId,
207
+ provider: "vercel"
208
+ };
209
+ }
210
+ },
228
211
  getInfo: async (sandbox) => {
229
212
  return {
230
213
  id: "vercel-unknown",
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * Vercel Provider - Factory-based Implementation\n * \n * Demonstrates the new createProvider() factory pattern with ~50 lines\n * instead of the original ~350 lines of boilerplate.\n */\n\nimport { Sandbox as VercelSandbox } from '@vercel/sandbox';\nimport { createProvider, createBackgroundCommand } from 'computesdk';\nimport type { Runtime, ExecutionResult, SandboxInfo, CreateSandboxOptions, FileEntry, RunCommandOptions } from 'computesdk';\n\n/**\n * Vercel sandbox provider configuration\n */\nexport interface VercelConfig {\n /** Vercel API token */\n token?: string;\n /** Vercel team ID */\n teamId?: string;\n /** Vercel project ID */\n projectId?: string;\n /** Runtime environment for code execution */\n runtime?: Runtime;\n /** Execution timeout in milliseconds */\n timeout?: number;\n /** Ports to expose */\n ports?: number[];\n}\n\n\n\n/**\n * Shared command execution logic for Vercel provider\n * This eliminates duplication between runCode and runCommand\n */\nasync function executeVercelCommand(sandbox: VercelSandbox, command: string, args: string[] = []): Promise<ExecutionResult> {\n const startTime = Date.now();\n\n try {\n // Execute command directly (non-detached returns CommandFinished)\n const finishedCommand = await sandbox.runCommand(command, args);\n\n // Use single logs() iteration to avoid \"multiple consumers\" warning\n let stdout = '';\n let stderr = '';\n\n // Single iteration over logs - this is the most reliable approach\n for await (const log of finishedCommand.logs()) {\n if (log.stream === 'stdout') {\n stdout += log.data;\n } else if (log.stream === 'stderr') {\n stderr += log.data;\n }\n }\n\n return {\n stdout,\n stderr,\n exitCode: finishedCommand.exitCode,\n executionTime: Date.now() - startTime,\n sandboxId: sandbox.sandboxId,\n provider: 'vercel'\n };\n } catch (error) {\n // For command execution, return error result instead of throwing\n // This handles cases like \"command not found\" where Vercel API returns 400\n return {\n stdout: '',\n stderr: error instanceof Error ? error.message : String(error),\n exitCode: 127, // Standard \"command not found\" exit code\n executionTime: Date.now() - startTime,\n sandboxId: sandbox.sandboxId,\n provider: 'vercel'\n };\n }\n}\n\n/**\n * Create a Vercel provider instance using the factory pattern\n */\nexport const vercel = createProvider<VercelSandbox, VercelConfig>({\n name: 'vercel',\n methods: {\n sandbox: {\n // Collection operations (map to compute.sandbox.*)\n create: async (config: VercelConfig, options?: CreateSandboxOptions) => {\n // Check for OIDC token first (recommended method)\n const oidcToken = typeof process !== 'undefined' && process.env?.VERCEL_OIDC_TOKEN;\n\n // Fall back to traditional method (token + teamId + projectId)\n const token = config.token || (typeof process !== 'undefined' && process.env?.VERCEL_TOKEN) || '';\n const teamId = config.teamId || (typeof process !== 'undefined' && process.env?.VERCEL_TEAM_ID) || '';\n const projectId = config.projectId || (typeof process !== 'undefined' && process.env?.VERCEL_PROJECT_ID) || '';\n\n // Validate authentication - either OIDC token OR traditional method\n if (!oidcToken && (!token || !teamId || !projectId)) {\n if (!oidcToken && !token) {\n throw new Error(\n `Missing Vercel authentication. Either:\\n` +\n `1. Use OIDC token: Run 'vercel env pull' to get VERCEL_OIDC_TOKEN, or\\n` +\n `2. Use traditional method: Provide 'token' in config or set VERCEL_TOKEN environment variable. Get your token from https://vercel.com/account/tokens`\n );\n }\n if (!oidcToken && !teamId) {\n throw new Error(\n `Missing Vercel team ID. Provide 'teamId' in config or set VERCEL_TEAM_ID environment variable.`\n );\n }\n if (!oidcToken && !projectId) {\n throw new Error(\n `Missing Vercel project ID. Provide 'projectId' in config or set VERCEL_PROJECT_ID environment variable.`\n );\n }\n }\n\n const runtime = options?.runtime || config.runtime || 'node';\n const timeout = config.timeout || 300000;\n\n try {\n let sandbox: VercelSandbox;\n\n if (options?.sandboxId) {\n // Vercel doesn't support reconnecting to existing sandboxes\n // Each sandbox is ephemeral and must be created fresh\n throw new Error(\n `Vercel provider does not support reconnecting to existing sandboxes. Vercel sandboxes are ephemeral and must be created fresh each time.`\n );\n } else {\n // Create new Vercel sandbox\n if (oidcToken) {\n sandbox = await VercelSandbox.create(\n {\n ports: config.ports,\n timeout,\n }\n );\n } else {\n sandbox = await VercelSandbox.create({\n token,\n teamId,\n projectId,\n ports: config.ports,\n timeout,\n });\n }\n }\n\n return {\n sandbox,\n sandboxId: sandbox.sandboxId\n };\n } catch (error) {\n if (error instanceof Error) {\n if (error.message.includes('unauthorized') || error.message.includes('token')) {\n throw new Error(\n `Vercel authentication failed. Please check your VERCEL_TOKEN environment variable. Get your token from https://vercel.com/account/tokens`\n );\n }\n if (error.message.includes('team') || error.message.includes('project')) {\n throw new Error(\n `Vercel team/project configuration failed. Please check your VERCEL_TEAM_ID and VERCEL_PROJECT_ID environment variables.`\n );\n }\n }\n throw new Error(\n `Failed to create Vercel sandbox: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n },\n\n getById: async (config: VercelConfig, sandboxId: string) => {\n // Check for OIDC token first (recommended method)\n const oidcToken = typeof process !== 'undefined' && process.env?.VERCEL_OIDC_TOKEN;\n\n try {\n let sandbox: VercelSandbox;\n\n if (oidcToken) {\n // Use OIDC token method\n sandbox = await VercelSandbox.get({ sandboxId });\n } else {\n // Use traditional method\n const token = config.token || process.env.VERCEL_TOKEN!;\n const teamId = config.teamId || process.env.VERCEL_TEAM_ID!;\n const projectId = config.projectId || process.env.VERCEL_PROJECT_ID!;\n\n sandbox = await VercelSandbox.get({\n sandboxId,\n token,\n teamId,\n projectId,\n });\n }\n\n return {\n sandbox,\n sandboxId\n };\n } catch (error) {\n // Sandbox doesn't exist or can't be accessed\n return null;\n }\n },\n\n list: async (_config: VercelConfig) => {\n throw new Error(\n `Vercel provider does not support listing sandboxes. Vercel sandboxes are ephemeral and designed for single-use execution.`\n );\n },\n\n destroy: async (config: VercelConfig, sandboxId: string) => {\n // Check for OIDC token first (recommended method)\n const oidcToken = typeof process !== 'undefined' && process.env?.VERCEL_OIDC_TOKEN;\n\n try {\n let sandbox: VercelSandbox;\n\n if (oidcToken) {\n // Use OIDC token method\n sandbox = await VercelSandbox.get({ sandboxId });\n } else {\n // Use traditional method\n const token = config.token || process.env.VERCEL_TOKEN!;\n const teamId = config.teamId || process.env.VERCEL_TEAM_ID!;\n const projectId = config.projectId || process.env.VERCEL_PROJECT_ID!;\n\n sandbox = await VercelSandbox.get({\n sandboxId,\n token,\n teamId,\n projectId,\n });\n }\n\n await sandbox.stop();\n } catch (error) {\n // Sandbox might already be destroyed or doesn't exist\n // This is acceptable for destroy operations\n }\n },\n\n // Instance operations (map to individual Sandbox methods)\n runCode: async (sandbox: VercelSandbox, code: string, runtime?: Runtime, config?: VercelConfig): Promise<ExecutionResult> => {\n const startTime = Date.now();\n\n try {\n // Auto-detect runtime if not specified\n const effectiveRuntime = runtime || config?.runtime || (\n // Strong Python indicators\n code.includes('print(') ||\n code.includes('import ') ||\n code.includes('def ') ||\n code.includes('sys.') ||\n code.includes('json.') ||\n code.includes('__') ||\n code.includes('f\"') ||\n code.includes(\"f'\") ||\n code.includes('raise ')\n ? 'python'\n // Default to Node.js for all other cases (including ambiguous)\n : 'node'\n );\n\n // Use base64 encoding for both runtimes for reliability and consistency\n const encoded = Buffer.from(code).toString('base64');\n let commandString;\n\n if (effectiveRuntime === 'python') {\n // Execute Python code with base64 encoding\n commandString = `echo \"${encoded}\" | base64 -d | python3`;\n } else {\n // Execute Node.js code with base64 encoding\n commandString = `echo \"${encoded}\" | base64 -d | node`;\n }\n\n // Use shared command execution logic\n const result = await executeVercelCommand(sandbox, 'sh', ['-c', commandString]);\n\n // Check for syntax errors and throw them\n if (result.exitCode !== 0 && result.stderr) {\n // Check for common syntax error patterns\n if (result.stderr.includes('SyntaxError') ||\n result.stderr.includes('invalid syntax') ||\n result.stderr.includes('Unexpected token') ||\n result.stderr.includes('Unexpected identifier')) {\n throw new Error(`Syntax error: ${result.stderr.trim()}`);\n }\n }\n\n return result;\n } catch (error) {\n // Re-throw syntax errors\n if (error instanceof Error && error.message.includes('Syntax error')) {\n throw error;\n }\n throw new Error(\n `Vercel execution failed: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n },\n\n runCommand: async (sandbox: VercelSandbox, command: string, args: string[] = [], options?: RunCommandOptions): Promise<ExecutionResult> => {\n // Handle background command execution\n const { command: finalCommand, args: finalArgs, isBackground } = createBackgroundCommand(command, args, options);\n \n const result = await executeVercelCommand(sandbox, finalCommand, finalArgs);\n \n return {\n ...result,\n isBackground,\n // For background commands, we can't get a real PID, but we can indicate it's running\n ...(isBackground && { pid: -1 })\n };\n },\n\n getInfo: async (sandbox: VercelSandbox): Promise<SandboxInfo> => {\n return {\n id: 'vercel-unknown',\n provider: 'vercel',\n runtime: 'node', // Vercel default\n status: 'running',\n createdAt: new Date(),\n timeout: 300000,\n metadata: {\n vercelSandboxId: 'vercel-unknown'\n }\n };\n },\n\n getUrl: async (sandbox: VercelSandbox, options: { port: number; protocol?: string }): Promise<string> => {\n try {\n // Use Vercel's built-in domain method to get the real domain\n let url = sandbox.domain(options.port);\n \n // If a specific protocol is requested, replace the URL's protocol\n if (options.protocol) {\n const urlObj = new URL(url);\n urlObj.protocol = options.protocol + ':';\n url = urlObj.toString();\n }\n \n return url;\n } catch (error) {\n throw new Error(\n `Failed to get Vercel domain for port ${options.port}: ${error instanceof Error ? error.message : String(error)}. Ensure the port has an associated route.`\n );\n }\n },\n\n // Provider-specific typed getInstance method\n getInstance: (sandbox: VercelSandbox): VercelSandbox => {\n return sandbox;\n },\n\n }\n }\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,qBAAyC;AACzC,wBAAwD;AA2BxD,eAAe,qBAAqB,SAAwB,SAAiB,OAAiB,CAAC,GAA6B;AAC1H,QAAM,YAAY,KAAK,IAAI;AAE3B,MAAI;AAEF,UAAM,kBAAkB,MAAM,QAAQ,WAAW,SAAS,IAAI;AAG9D,QAAI,SAAS;AACb,QAAI,SAAS;AAGb,qBAAiB,OAAO,gBAAgB,KAAK,GAAG;AAC9C,UAAI,IAAI,WAAW,UAAU;AAC3B,kBAAU,IAAI;AAAA,MAChB,WAAW,IAAI,WAAW,UAAU;AAClC,kBAAU,IAAI;AAAA,MAChB;AAAA,IACF;AAEA,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,UAAU,gBAAgB;AAAA,MAC1B,eAAe,KAAK,IAAI,IAAI;AAAA,MAC5B,WAAW,QAAQ;AAAA,MACnB,UAAU;AAAA,IACZ;AAAA,EACF,SAAS,OAAO;AAGd,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,QAAQ,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAAA,MAC7D,UAAU;AAAA;AAAA,MACV,eAAe,KAAK,IAAI,IAAI;AAAA,MAC5B,WAAW,QAAQ;AAAA,MACnB,UAAU;AAAA,IACZ;AAAA,EACF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C;AAAA,UACjH;AAAA,QACF;AAAA,MACF;AAAA;AAAA,MAGA,aAAa,CAAC,YAA0C;AACtD,eAAO;AAAA,MACT;AAAA,IAEF;AAAA,EACF;AACF,CAAC;","names":["VercelSandbox"]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * Vercel Provider - Factory-based Implementation\n * \n * Demonstrates the new createProvider() factory pattern with ~50 lines\n * instead of the original ~350 lines of boilerplate.\n */\n\nimport { Sandbox as VercelSandbox } from '@vercel/sandbox';\nimport { createProvider } from 'computesdk';\nimport type { Runtime, ExecutionResult, SandboxInfo, CreateSandboxOptions } from 'computesdk';\n\n/**\n * Vercel sandbox provider configuration\n */\nexport interface VercelConfig {\n /** Vercel API token */\n token?: string;\n /** Vercel team ID */\n teamId?: string;\n /** Vercel project ID */\n projectId?: string;\n /** Runtime environment for code execution */\n runtime?: Runtime;\n /** Execution timeout in milliseconds */\n timeout?: number;\n /** Ports to expose */\n ports?: number[];\n}\n\n\n\n\n/**\n * Create a Vercel provider instance using the factory pattern\n */\nexport const vercel = createProvider<VercelSandbox, VercelConfig>({\n name: 'vercel',\n methods: {\n sandbox: {\n // Collection operations (map to compute.sandbox.*)\n create: async (config: VercelConfig, options?: CreateSandboxOptions) => {\n // Check for OIDC token first (recommended method)\n const oidcToken = typeof process !== 'undefined' && process.env?.VERCEL_OIDC_TOKEN;\n\n // Fall back to traditional method (token + teamId + projectId)\n const token = config.token || (typeof process !== 'undefined' && process.env?.VERCEL_TOKEN) || '';\n const teamId = config.teamId || (typeof process !== 'undefined' && process.env?.VERCEL_TEAM_ID) || '';\n const projectId = config.projectId || (typeof process !== 'undefined' && process.env?.VERCEL_PROJECT_ID) || '';\n\n // Validate authentication - either OIDC token OR traditional method\n if (!oidcToken && (!token || !teamId || !projectId)) {\n if (!oidcToken && !token) {\n throw new Error(\n `Missing Vercel authentication. Either:\\n` +\n `1. Use OIDC token: Run 'vercel env pull' to get VERCEL_OIDC_TOKEN, or\\n` +\n `2. Use traditional method: Provide 'token' in config or set VERCEL_TOKEN environment variable. Get your token from https://vercel.com/account/tokens`\n );\n }\n if (!oidcToken && !teamId) {\n throw new Error(\n `Missing Vercel team ID. Provide 'teamId' in config or set VERCEL_TEAM_ID environment variable.`\n );\n }\n if (!oidcToken && !projectId) {\n throw new Error(\n `Missing Vercel project ID. Provide 'projectId' in config or set VERCEL_PROJECT_ID environment variable.`\n );\n }\n }\n\n const timeout = config.timeout || 300000;\n\n try {\n let sandbox: VercelSandbox;\n\n if (options?.sandboxId) {\n // Vercel doesn't support reconnecting to existing sandboxes\n // Each sandbox is ephemeral and must be created fresh\n throw new Error(\n `Vercel provider does not support reconnecting to existing sandboxes. Vercel sandboxes are ephemeral and must be created fresh each time.`\n );\n } else {\n // Create new Vercel sandbox\n if (oidcToken) {\n sandbox = await VercelSandbox.create(\n {\n ports: config.ports,\n timeout,\n }\n );\n } else {\n sandbox = await VercelSandbox.create({\n token,\n teamId,\n projectId,\n ports: config.ports,\n timeout,\n });\n }\n }\n\n return {\n sandbox,\n sandboxId: sandbox.sandboxId\n };\n } catch (error) {\n if (error instanceof Error) {\n if (error.message.includes('unauthorized') || error.message.includes('token')) {\n throw new Error(\n `Vercel authentication failed. Please check your VERCEL_TOKEN environment variable. Get your token from https://vercel.com/account/tokens`\n );\n }\n if (error.message.includes('team') || error.message.includes('project')) {\n throw new Error(\n `Vercel team/project configuration failed. Please check your VERCEL_TEAM_ID and VERCEL_PROJECT_ID environment variables.`\n );\n }\n }\n throw new Error(\n `Failed to create Vercel sandbox: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n },\n\n getById: async (config: VercelConfig, sandboxId: string) => {\n // Check for OIDC token first (recommended method)\n const oidcToken = typeof process !== 'undefined' && process.env?.VERCEL_OIDC_TOKEN;\n\n try {\n let sandbox: VercelSandbox;\n\n if (oidcToken) {\n // Use OIDC token method\n sandbox = await VercelSandbox.get({ sandboxId });\n } else {\n // Use traditional method\n const token = config.token || process.env.VERCEL_TOKEN!;\n const teamId = config.teamId || process.env.VERCEL_TEAM_ID!;\n const projectId = config.projectId || process.env.VERCEL_PROJECT_ID!;\n\n sandbox = await VercelSandbox.get({\n sandboxId,\n token,\n teamId,\n projectId,\n });\n }\n\n return {\n sandbox,\n sandboxId\n };\n } catch (error) {\n // Sandbox doesn't exist or can't be accessed\n return null;\n }\n },\n\n list: async (_config: VercelConfig) => {\n throw new Error(\n `Vercel provider does not support listing sandboxes. Vercel sandboxes are ephemeral and designed for single-use execution.`\n );\n },\n\n destroy: async (config: VercelConfig, sandboxId: string) => {\n // Check for OIDC token first (recommended method)\n const oidcToken = typeof process !== 'undefined' && process.env?.VERCEL_OIDC_TOKEN;\n\n try {\n let sandbox: VercelSandbox;\n\n if (oidcToken) {\n // Use OIDC token method\n sandbox = await VercelSandbox.get({ sandboxId });\n } else {\n // Use traditional method\n const token = config.token || process.env.VERCEL_TOKEN!;\n const teamId = config.teamId || process.env.VERCEL_TEAM_ID!;\n const projectId = config.projectId || process.env.VERCEL_PROJECT_ID!;\n\n sandbox = await VercelSandbox.get({\n sandboxId,\n token,\n teamId,\n projectId,\n });\n }\n\n await sandbox.stop();\n } catch (error) {\n // Sandbox might already be destroyed or doesn't exist\n // This is acceptable for destroy operations\n }\n },\n\n // Instance operations (map to individual Sandbox methods)\n runCode: async (sandbox: VercelSandbox, code: string, runtime?: Runtime, config?: VercelConfig): Promise<ExecutionResult> => {\n const startTime = Date.now();\n\n // Auto-detect runtime if not specified\n const effectiveRuntime = runtime || config?.runtime || (\n // Strong Python indicators\n code.includes('print(') ||\n code.includes('import ') ||\n code.includes('def ') ||\n code.includes('sys.') ||\n code.includes('json.') ||\n code.includes('__') ||\n code.includes('f\"') ||\n code.includes(\"f'\") ||\n code.includes('raise ')\n ? 'python'\n // Default to Node.js for all other cases (including ambiguous)\n : 'node'\n );\n\n // Use base64 encoding for both runtimes for reliability and consistency\n const encoded = Buffer.from(code).toString('base64');\n const commandString = effectiveRuntime === 'python'\n ? `echo \"${encoded}\" | base64 -d | python3`\n : `echo \"${encoded}\" | base64 -d | node`;\n\n const result = await sandbox.runCommand('sh', ['-c', commandString]);\n // Call stdout/stderr sequentially to avoid \"Multiple consumers for logs\" warning\n const stdout = await result.stdout();\n const stderr = await result.stderr();\n\n // Check for syntax errors and throw them\n if (result.exitCode !== 0 && stderr) {\n if (stderr.includes('SyntaxError') ||\n stderr.includes('invalid syntax') ||\n stderr.includes('Unexpected token') ||\n stderr.includes('Unexpected identifier')) {\n throw new Error(`Syntax error: ${stderr.trim()}`);\n }\n }\n\n return {\n stdout,\n stderr,\n exitCode: result.exitCode,\n executionTime: Date.now() - startTime,\n sandboxId: sandbox.sandboxId,\n provider: 'vercel'\n };\n },\n\n runCommand: async (sandbox: VercelSandbox, command: string, args: string[] = []): Promise<ExecutionResult> => {\n const startTime = Date.now();\n\n try {\n // Construct full command with arguments, properly quoting each arg\n const quotedArgs = args.map((arg: string) => {\n if (arg.includes(' ') || arg.includes('\"') || arg.includes(\"'\") || arg.includes('$') || arg.includes('`')) {\n return `\"${arg.replace(/\"/g, '\\\\\"')}\"`;\n }\n return arg;\n });\n const fullCommand = quotedArgs.length > 0 ? `${command} ${quotedArgs.join(' ')}` : command;\n\n const result = await sandbox.runCommand('sh', ['-c', fullCommand]);\n // Call stdout/stderr sequentially to avoid \"Multiple consumers for logs\" warning\n const stdout = await result.stdout();\n const stderr = await result.stderr();\n\n return {\n stdout,\n stderr,\n exitCode: result.exitCode,\n executionTime: Date.now() - startTime,\n sandboxId: sandbox.sandboxId,\n provider: 'vercel'\n };\n } catch (error) {\n return {\n stdout: '',\n stderr: error instanceof Error ? error.message : String(error),\n exitCode: 127,\n executionTime: Date.now() - startTime,\n sandboxId: sandbox.sandboxId,\n provider: 'vercel'\n };\n }\n },\n\n getInfo: async (sandbox: VercelSandbox): Promise<SandboxInfo> => {\n return {\n id: 'vercel-unknown',\n provider: 'vercel',\n runtime: 'node', // Vercel default\n status: 'running',\n createdAt: new Date(),\n timeout: 300000,\n metadata: {\n vercelSandboxId: 'vercel-unknown'\n }\n };\n },\n\n getUrl: async (sandbox: VercelSandbox, options: { port: number; protocol?: string }): Promise<string> => {\n try {\n // Use Vercel's built-in domain method to get the real domain\n let url = sandbox.domain(options.port);\n \n // If a specific protocol is requested, replace the URL's protocol\n if (options.protocol) {\n const urlObj = new URL(url);\n urlObj.protocol = options.protocol + ':';\n url = urlObj.toString();\n }\n \n return url;\n } catch (error) {\n throw new Error(\n `Failed to get Vercel domain for port ${options.port}: ${error instanceof Error ? error.message : String(error)}. Ensure the port has an associated route.`\n );\n }\n },\n\n // Provider-specific typed getInstance method\n getInstance: (sandbox: VercelSandbox): VercelSandbox => {\n return sandbox;\n },\n\n }\n }\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,qBAAyC;AACzC,wBAA+B;AA2BxB,IAAM,aAAS,kCAA4C;AAAA,EAChE,MAAM;AAAA,EACN,SAAS;AAAA,IACP,SAAS;AAAA;AAAA,MAEP,QAAQ,OAAO,QAAsB,YAAmC;AAEtE,cAAM,YAAY,OAAO,YAAY,eAAe,QAAQ,KAAK;AAGjE,cAAM,QAAQ,OAAO,SAAU,OAAO,YAAY,eAAe,QAAQ,KAAK,gBAAiB;AAC/F,cAAM,SAAS,OAAO,UAAW,OAAO,YAAY,eAAe,QAAQ,KAAK,kBAAmB;AACnG,cAAM,YAAY,OAAO,aAAc,OAAO,YAAY,eAAe,QAAQ,KAAK,qBAAsB;AAG5G,YAAI,CAAC,cAAc,CAAC,SAAS,CAAC,UAAU,CAAC,YAAY;AACnD,cAAI,CAAC,aAAa,CAAC,OAAO;AACxB,kBAAM,IAAI;AAAA,cACR;AAAA;AAAA;AAAA,YAGF;AAAA,UACF;AACA,cAAI,CAAC,aAAa,CAAC,QAAQ;AACzB,kBAAM,IAAI;AAAA,cACR;AAAA,YACF;AAAA,UACF;AACA,cAAI,CAAC,aAAa,CAAC,WAAW;AAC5B,kBAAM,IAAI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ED
@@ -1,39 +1,6 @@
1
1
  // src/index.ts
2
2
  import { Sandbox as VercelSandbox } from "@vercel/sandbox";
3
- import { createProvider, createBackgroundCommand } from "computesdk";
4
- async function executeVercelCommand(sandbox, command, args = []) {
5
- const startTime = Date.now();
6
- try {
7
- const finishedCommand = await sandbox.runCommand(command, args);
8
- let stdout = "";
9
- let stderr = "";
10
- for await (const log of finishedCommand.logs()) {
11
- if (log.stream === "stdout") {
12
- stdout += log.data;
13
- } else if (log.stream === "stderr") {
14
- stderr += log.data;
15
- }
16
- }
17
- return {
18
- stdout,
19
- stderr,
20
- exitCode: finishedCommand.exitCode,
21
- executionTime: Date.now() - startTime,
22
- sandboxId: sandbox.sandboxId,
23
- provider: "vercel"
24
- };
25
- } catch (error) {
26
- return {
27
- stdout: "",
28
- stderr: error instanceof Error ? error.message : String(error),
29
- exitCode: 127,
30
- // Standard "command not found" exit code
31
- executionTime: Date.now() - startTime,
32
- sandboxId: sandbox.sandboxId,
33
- provider: "vercel"
34
- };
35
- }
36
- }
3
+ import { createProvider } from "computesdk";
37
4
  var vercel = createProvider({
38
5
  name: "vercel",
39
6
  methods: {
@@ -63,7 +30,6 @@ var vercel = createProvider({
63
30
  );
64
31
  }
65
32
  }
66
- const runtime = options?.runtime || config.runtime || "node";
67
33
  const timeout = config.timeout || 3e5;
68
34
  try {
69
35
  let sandbox;
@@ -165,42 +131,59 @@ var vercel = createProvider({
165
131
  // Instance operations (map to individual Sandbox methods)
166
132
  runCode: async (sandbox, code, runtime, config) => {
167
133
  const startTime = Date.now();
168
- try {
169
- const effectiveRuntime = runtime || config?.runtime || // Strong Python indicators
170
- (code.includes("print(") || code.includes("import ") || code.includes("def ") || code.includes("sys.") || code.includes("json.") || code.includes("__") || code.includes('f"') || code.includes("f'") || code.includes("raise ") ? "python" : "node");
171
- const encoded = Buffer.from(code).toString("base64");
172
- let commandString;
173
- if (effectiveRuntime === "python") {
174
- commandString = `echo "${encoded}" | base64 -d | python3`;
175
- } else {
176
- commandString = `echo "${encoded}" | base64 -d | node`;
134
+ const effectiveRuntime = runtime || config?.runtime || // Strong Python indicators
135
+ (code.includes("print(") || code.includes("import ") || code.includes("def ") || code.includes("sys.") || code.includes("json.") || code.includes("__") || code.includes('f"') || code.includes("f'") || code.includes("raise ") ? "python" : "node");
136
+ const encoded = Buffer.from(code).toString("base64");
137
+ const commandString = effectiveRuntime === "python" ? `echo "${encoded}" | base64 -d | python3` : `echo "${encoded}" | base64 -d | node`;
138
+ const result = await sandbox.runCommand("sh", ["-c", commandString]);
139
+ const stdout = await result.stdout();
140
+ const stderr = await result.stderr();
141
+ if (result.exitCode !== 0 && stderr) {
142
+ if (stderr.includes("SyntaxError") || stderr.includes("invalid syntax") || stderr.includes("Unexpected token") || stderr.includes("Unexpected identifier")) {
143
+ throw new Error(`Syntax error: ${stderr.trim()}`);
177
144
  }
178
- const result = await executeVercelCommand(sandbox, "sh", ["-c", commandString]);
179
- if (result.exitCode !== 0 && result.stderr) {
180
- if (result.stderr.includes("SyntaxError") || result.stderr.includes("invalid syntax") || result.stderr.includes("Unexpected token") || result.stderr.includes("Unexpected identifier")) {
181
- throw new Error(`Syntax error: ${result.stderr.trim()}`);
182
- }
183
- }
184
- return result;
185
- } catch (error) {
186
- if (error instanceof Error && error.message.includes("Syntax error")) {
187
- throw error;
188
- }
189
- throw new Error(
190
- `Vercel execution failed: ${error instanceof Error ? error.message : String(error)}`
191
- );
192
145
  }
193
- },
194
- runCommand: async (sandbox, command, args = [], options) => {
195
- const { command: finalCommand, args: finalArgs, isBackground } = createBackgroundCommand(command, args, options);
196
- const result = await executeVercelCommand(sandbox, finalCommand, finalArgs);
197
146
  return {
198
- ...result,
199
- isBackground,
200
- // For background commands, we can't get a real PID, but we can indicate it's running
201
- ...isBackground && { pid: -1 }
147
+ stdout,
148
+ stderr,
149
+ exitCode: result.exitCode,
150
+ executionTime: Date.now() - startTime,
151
+ sandboxId: sandbox.sandboxId,
152
+ provider: "vercel"
202
153
  };
203
154
  },
155
+ runCommand: async (sandbox, command, args = []) => {
156
+ const startTime = Date.now();
157
+ try {
158
+ const quotedArgs = args.map((arg) => {
159
+ if (arg.includes(" ") || arg.includes('"') || arg.includes("'") || arg.includes("$") || arg.includes("`")) {
160
+ return `"${arg.replace(/"/g, '\\"')}"`;
161
+ }
162
+ return arg;
163
+ });
164
+ const fullCommand = quotedArgs.length > 0 ? `${command} ${quotedArgs.join(" ")}` : command;
165
+ const result = await sandbox.runCommand("sh", ["-c", fullCommand]);
166
+ const stdout = await result.stdout();
167
+ const stderr = await result.stderr();
168
+ return {
169
+ stdout,
170
+ stderr,
171
+ exitCode: result.exitCode,
172
+ executionTime: Date.now() - startTime,
173
+ sandboxId: sandbox.sandboxId,
174
+ provider: "vercel"
175
+ };
176
+ } catch (error) {
177
+ return {
178
+ stdout: "",
179
+ stderr: error instanceof Error ? error.message : String(error),
180
+ exitCode: 127,
181
+ executionTime: Date.now() - startTime,
182
+ sandboxId: sandbox.sandboxId,
183
+ provider: "vercel"
184
+ };
185
+ }
186
+ },
204
187
  getInfo: async (sandbox) => {
205
188
  return {
206
189
  id: "vercel-unknown",
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * Vercel Provider - Factory-based Implementation\n * \n * Demonstrates the new createProvider() factory pattern with ~50 lines\n * instead of the original ~350 lines of boilerplate.\n */\n\nimport { Sandbox as VercelSandbox } from '@vercel/sandbox';\nimport { createProvider, createBackgroundCommand } from 'computesdk';\nimport type { Runtime, ExecutionResult, SandboxInfo, CreateSandboxOptions, FileEntry, RunCommandOptions } from 'computesdk';\n\n/**\n * Vercel sandbox provider configuration\n */\nexport interface VercelConfig {\n /** Vercel API token */\n token?: string;\n /** Vercel team ID */\n teamId?: string;\n /** Vercel project ID */\n projectId?: string;\n /** Runtime environment for code execution */\n runtime?: Runtime;\n /** Execution timeout in milliseconds */\n timeout?: number;\n /** Ports to expose */\n ports?: number[];\n}\n\n\n\n/**\n * Shared command execution logic for Vercel provider\n * This eliminates duplication between runCode and runCommand\n */\nasync function executeVercelCommand(sandbox: VercelSandbox, command: string, args: string[] = []): Promise<ExecutionResult> {\n const startTime = Date.now();\n\n try {\n // Execute command directly (non-detached returns CommandFinished)\n const finishedCommand = await sandbox.runCommand(command, args);\n\n // Use single logs() iteration to avoid \"multiple consumers\" warning\n let stdout = '';\n let stderr = '';\n\n // Single iteration over logs - this is the most reliable approach\n for await (const log of finishedCommand.logs()) {\n if (log.stream === 'stdout') {\n stdout += log.data;\n } else if (log.stream === 'stderr') {\n stderr += log.data;\n }\n }\n\n return {\n stdout,\n stderr,\n exitCode: finishedCommand.exitCode,\n executionTime: Date.now() - startTime,\n sandboxId: sandbox.sandboxId,\n provider: 'vercel'\n };\n } catch (error) {\n // For command execution, return error result instead of throwing\n // This handles cases like \"command not found\" where Vercel API returns 400\n return {\n stdout: '',\n stderr: error instanceof Error ? error.message : String(error),\n exitCode: 127, // Standard \"command not found\" exit code\n executionTime: Date.now() - startTime,\n sandboxId: sandbox.sandboxId,\n provider: 'vercel'\n };\n }\n}\n\n/**\n * Create a Vercel provider instance using the factory pattern\n */\nexport const vercel = createProvider<VercelSandbox, VercelConfig>({\n name: 'vercel',\n methods: {\n sandbox: {\n // Collection operations (map to compute.sandbox.*)\n create: async (config: VercelConfig, options?: CreateSandboxOptions) => {\n // Check for OIDC token first (recommended method)\n const oidcToken = typeof process !== 'undefined' && process.env?.VERCEL_OIDC_TOKEN;\n\n // Fall back to traditional method (token + teamId + projectId)\n const token = config.token || (typeof process !== 'undefined' && process.env?.VERCEL_TOKEN) || '';\n const teamId = config.teamId || (typeof process !== 'undefined' && process.env?.VERCEL_TEAM_ID) || '';\n const projectId = config.projectId || (typeof process !== 'undefined' && process.env?.VERCEL_PROJECT_ID) || '';\n\n // Validate authentication - either OIDC token OR traditional method\n if (!oidcToken && (!token || !teamId || !projectId)) {\n if (!oidcToken && !token) {\n throw new Error(\n `Missing Vercel authentication. Either:\\n` +\n `1. Use OIDC token: Run 'vercel env pull' to get VERCEL_OIDC_TOKEN, or\\n` +\n `2. Use traditional method: Provide 'token' in config or set VERCEL_TOKEN environment variable. Get your token from https://vercel.com/account/tokens`\n );\n }\n if (!oidcToken && !teamId) {\n throw new Error(\n `Missing Vercel team ID. Provide 'teamId' in config or set VERCEL_TEAM_ID environment variable.`\n );\n }\n if (!oidcToken && !projectId) {\n throw new Error(\n `Missing Vercel project ID. Provide 'projectId' in config or set VERCEL_PROJECT_ID environment variable.`\n );\n }\n }\n\n const runtime = options?.runtime || config.runtime || 'node';\n const timeout = config.timeout || 300000;\n\n try {\n let sandbox: VercelSandbox;\n\n if (options?.sandboxId) {\n // Vercel doesn't support reconnecting to existing sandboxes\n // Each sandbox is ephemeral and must be created fresh\n throw new Error(\n `Vercel provider does not support reconnecting to existing sandboxes. Vercel sandboxes are ephemeral and must be created fresh each time.`\n );\n } else {\n // Create new Vercel sandbox\n if (oidcToken) {\n sandbox = await VercelSandbox.create(\n {\n ports: config.ports,\n timeout,\n }\n );\n } else {\n sandbox = await VercelSandbox.create({\n token,\n teamId,\n projectId,\n ports: config.ports,\n timeout,\n });\n }\n }\n\n return {\n sandbox,\n sandboxId: sandbox.sandboxId\n };\n } catch (error) {\n if (error instanceof Error) {\n if (error.message.includes('unauthorized') || error.message.includes('token')) {\n throw new Error(\n `Vercel authentication failed. Please check your VERCEL_TOKEN environment variable. Get your token from https://vercel.com/account/tokens`\n );\n }\n if (error.message.includes('team') || error.message.includes('project')) {\n throw new Error(\n `Vercel team/project configuration failed. Please check your VERCEL_TEAM_ID and VERCEL_PROJECT_ID environment variables.`\n );\n }\n }\n throw new Error(\n `Failed to create Vercel sandbox: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n },\n\n getById: async (config: VercelConfig, sandboxId: string) => {\n // Check for OIDC token first (recommended method)\n const oidcToken = typeof process !== 'undefined' && process.env?.VERCEL_OIDC_TOKEN;\n\n try {\n let sandbox: VercelSandbox;\n\n if (oidcToken) {\n // Use OIDC token method\n sandbox = await VercelSandbox.get({ sandboxId });\n } else {\n // Use traditional method\n const token = config.token || process.env.VERCEL_TOKEN!;\n const teamId = config.teamId || process.env.VERCEL_TEAM_ID!;\n const projectId = config.projectId || process.env.VERCEL_PROJECT_ID!;\n\n sandbox = await VercelSandbox.get({\n sandboxId,\n token,\n teamId,\n projectId,\n });\n }\n\n return {\n sandbox,\n sandboxId\n };\n } catch (error) {\n // Sandbox doesn't exist or can't be accessed\n return null;\n }\n },\n\n list: async (_config: VercelConfig) => {\n throw new Error(\n `Vercel provider does not support listing sandboxes. Vercel sandboxes are ephemeral and designed for single-use execution.`\n );\n },\n\n destroy: async (config: VercelConfig, sandboxId: string) => {\n // Check for OIDC token first (recommended method)\n const oidcToken = typeof process !== 'undefined' && process.env?.VERCEL_OIDC_TOKEN;\n\n try {\n let sandbox: VercelSandbox;\n\n if (oidcToken) {\n // Use OIDC token method\n sandbox = await VercelSandbox.get({ sandboxId });\n } else {\n // Use traditional method\n const token = config.token || process.env.VERCEL_TOKEN!;\n const teamId = config.teamId || process.env.VERCEL_TEAM_ID!;\n const projectId = config.projectId || process.env.VERCEL_PROJECT_ID!;\n\n sandbox = await VercelSandbox.get({\n sandboxId,\n token,\n teamId,\n projectId,\n });\n }\n\n await sandbox.stop();\n } catch (error) {\n // Sandbox might already be destroyed or doesn't exist\n // This is acceptable for destroy operations\n }\n },\n\n // Instance operations (map to individual Sandbox methods)\n runCode: async (sandbox: VercelSandbox, code: string, runtime?: Runtime, config?: VercelConfig): Promise<ExecutionResult> => {\n const startTime = Date.now();\n\n try {\n // Auto-detect runtime if not specified\n const effectiveRuntime = runtime || config?.runtime || (\n // Strong Python indicators\n code.includes('print(') ||\n code.includes('import ') ||\n code.includes('def ') ||\n code.includes('sys.') ||\n code.includes('json.') ||\n code.includes('__') ||\n code.includes('f\"') ||\n code.includes(\"f'\") ||\n code.includes('raise ')\n ? 'python'\n // Default to Node.js for all other cases (including ambiguous)\n : 'node'\n );\n\n // Use base64 encoding for both runtimes for reliability and consistency\n const encoded = Buffer.from(code).toString('base64');\n let commandString;\n\n if (effectiveRuntime === 'python') {\n // Execute Python code with base64 encoding\n commandString = `echo \"${encoded}\" | base64 -d | python3`;\n } else {\n // Execute Node.js code with base64 encoding\n commandString = `echo \"${encoded}\" | base64 -d | node`;\n }\n\n // Use shared command execution logic\n const result = await executeVercelCommand(sandbox, 'sh', ['-c', commandString]);\n\n // Check for syntax errors and throw them\n if (result.exitCode !== 0 && result.stderr) {\n // Check for common syntax error patterns\n if (result.stderr.includes('SyntaxError') ||\n result.stderr.includes('invalid syntax') ||\n result.stderr.includes('Unexpected token') ||\n result.stderr.includes('Unexpected identifier')) {\n throw new Error(`Syntax error: ${result.stderr.trim()}`);\n }\n }\n\n return result;\n } catch (error) {\n // Re-throw syntax errors\n if (error instanceof Error && error.message.includes('Syntax error')) {\n throw error;\n }\n throw new Error(\n `Vercel execution failed: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n },\n\n runCommand: async (sandbox: VercelSandbox, command: string, args: string[] = [], options?: RunCommandOptions): Promise<ExecutionResult> => {\n // Handle background command execution\n const { command: finalCommand, args: finalArgs, isBackground } = createBackgroundCommand(command, args, options);\n \n const result = await executeVercelCommand(sandbox, finalCommand, finalArgs);\n \n return {\n ...result,\n isBackground,\n // For background commands, we can't get a real PID, but we can indicate it's running\n ...(isBackground && { pid: -1 })\n };\n },\n\n getInfo: async (sandbox: VercelSandbox): Promise<SandboxInfo> => {\n return {\n id: 'vercel-unknown',\n provider: 'vercel',\n runtime: 'node', // Vercel default\n status: 'running',\n createdAt: new Date(),\n timeout: 300000,\n metadata: {\n vercelSandboxId: 'vercel-unknown'\n }\n };\n },\n\n getUrl: async (sandbox: VercelSandbox, options: { port: number; protocol?: string }): Promise<string> => {\n try {\n // Use Vercel's built-in domain method to get the real domain\n let url = sandbox.domain(options.port);\n \n // If a specific protocol is requested, replace the URL's protocol\n if (options.protocol) {\n const urlObj = new URL(url);\n urlObj.protocol = options.protocol + ':';\n url = urlObj.toString();\n }\n \n return url;\n } catch (error) {\n throw new Error(\n `Failed to get Vercel domain for port ${options.port}: ${error instanceof Error ? error.message : String(error)}. Ensure the port has an associated route.`\n );\n }\n },\n\n // Provider-specific typed getInstance method\n getInstance: (sandbox: VercelSandbox): VercelSandbox => {\n return sandbox;\n },\n\n }\n }\n});\n"],"mappings":";AAOA,SAAS,WAAW,qBAAqB;AACzC,SAAS,gBAAgB,+BAA+B;AA2BxD,eAAe,qBAAqB,SAAwB,SAAiB,OAAiB,CAAC,GAA6B;AAC1H,QAAM,YAAY,KAAK,IAAI;AAE3B,MAAI;AAEF,UAAM,kBAAkB,MAAM,QAAQ,WAAW,SAAS,IAAI;AAG9D,QAAI,SAAS;AACb,QAAI,SAAS;AAGb,qBAAiB,OAAO,gBAAgB,KAAK,GAAG;AAC9C,UAAI,IAAI,WAAW,UAAU;AAC3B,kBAAU,IAAI;AAAA,MAChB,WAAW,IAAI,WAAW,UAAU;AAClC,kBAAU,IAAI;AAAA,MAChB;AAAA,IACF;AAEA,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,UAAU,gBAAgB;AAAA,MAC1B,eAAe,KAAK,IAAI,IAAI;AAAA,MAC5B,WAAW,QAAQ;AAAA,MACnB,UAAU;AAAA,IACZ;AAAA,EACF,SAAS,OAAO;AAGd,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,QAAQ,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAAA,MAC7D,UAAU;AAAA;AAAA,MACV,eAAe,KAAK,IAAI,IAAI;AAAA,MAC5B,WAAW,QAAQ;AAAA,MACnB,UAAU;AAAA,IACZ;AAAA,EACF;AACF;AAKO,IAAM,SAAS,eAA4C;AAAA,EAChE,MAAM;AAAA,EACN,SAAS;AAAA,IACP,SAAS;AAAA;AAAA,MAEP,QAAQ,OAAO,QAAsB,YAAmC;AAEtE,cAAM,YAAY,OAAO,YAAY,eAAe,QAAQ,KAAK;AAGjE,cAAM,QAAQ,OAAO,SAA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M,UAAU,OAAO,KAAK,CAAC;AAAA,UACpF;AAAA,QACF;AAAA,MACF;AAAA,MAEA,YAAY,OAAO,SAAwB,SAAiB,OAAiB,CAAC,GAAG,YAA0D;AAEzI,cAAM,EAAE,SAAS,cAAc,MAAM,WAAW,aAAa,IAAI,wBAAwB,SAAS,MAAM,OAAO;AAE/G,cAAM,SAAS,MAAM,qBAAqB,SAAS,cAAc,SAAS;AAE1E,eAAO;AAAA,UACL,GAAG;AAAA,UACH;AAAA;AAAA,UAEA,GAAI,gBAAgB,EAAE,KAAK,GAAG;AAAA,QAChC;AAAA,MACF;AAAA,MAEA,SAAS,OAAO,YAAiD;AAC/D,eAAO;AAAA,UACL,IAAI;AAAA,UACJ,UAAU;AAAA,UACV,SAAS;AAAA;AAAA,UACT,QAAQ;AAAA,UACR,WAAW,oBAAI,KAAK;AAAA,UACpB,SAAS;AAAA,UACT,UAAU;AAAA,YACR,iBAAiB;AAAA,UACnB;AAAA,QACF;AAAA,MACF;AAAA,MAEA,QAAQ,OAAO,SAAwB,YAAkE;AACvG,YAAI;AAEF,cAAI,MAAM,QAAQ,OAAO,QAAQ,IAAI;AAGrC,cAAI,QAAQ,UAAU;AACpB,kBAAM,SAAS,IAAI,IAAI,GAAG;AAC1B,mBAAO,WAAW,QAAQ,WAAW;AACrC,kBAAM,OAAO,SAAS;AAAA,UACxB;AAEA,iBAAO;AAAA,QACT,SAAS,OAAO;AACd,gBAAM,IAAI;AAAA,YACR,wCAAwC,QAAQ,IAAI,KAAK,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;AAAA,UACjH;AAAA,QACF;AAAA,MACF;AAAA;AAAA,MAGA,aAAa,CAAC,YAA0C;AACtD,eAAO;AAAA,MACT;AAAA,IAEF;AAAA,EACF;AACF,CAAC;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * Vercel Provider - Factory-based Implementation\n * \n * Demonstrates the new createProvider() factory pattern with ~50 lines\n * instead of the original ~350 lines of boilerplate.\n */\n\nimport { Sandbox as VercelSandbox } from '@vercel/sandbox';\nimport { createProvider } from 'computesdk';\nimport type { Runtime, ExecutionResult, SandboxInfo, CreateSandboxOptions } from 'computesdk';\n\n/**\n * Vercel sandbox provider configuration\n */\nexport interface VercelConfig {\n /** Vercel API token */\n token?: string;\n /** Vercel team ID */\n teamId?: string;\n /** Vercel project ID */\n projectId?: string;\n /** Runtime environment for code execution */\n runtime?: Runtime;\n /** Execution timeout in milliseconds */\n timeout?: number;\n /** Ports to expose */\n ports?: number[];\n}\n\n\n\n\n/**\n * Create a Vercel provider instance using the factory pattern\n */\nexport const vercel = createProvider<VercelSandbox, VercelConfig>({\n name: 'vercel',\n methods: {\n sandbox: {\n // Collection operations (map to compute.sandbox.*)\n create: async (config: VercelConfig, options?: CreateSandboxOptions) => {\n // Check for OIDC token first (recommended method)\n const oidcToken = typeof process !== 'undefined' && process.env?.VERCEL_OIDC_TOKEN;\n\n // Fall back to traditional method (token + teamId + projectId)\n const token = config.token || (typeof process !== 'undefined' && process.env?.VERCEL_TOKEN) || '';\n const teamId = config.teamId || (typeof process !== 'undefined' && process.env?.VERCEL_TEAM_ID) || '';\n const projectId = config.projectId || (typeof process !== 'undefined' && process.env?.VERCEL_PROJECT_ID) || '';\n\n // Validate authentication - either OIDC token OR traditional method\n if (!oidcToken && (!token || !teamId || !projectId)) {\n if (!oidcToken && !token) {\n throw new Error(\n `Missing Vercel authentication. Either:\\n` +\n `1. Use OIDC token: Run 'vercel env pull' to get VERCEL_OIDC_TOKEN, or\\n` +\n `2. Use traditional method: Provide 'token' in config or set VERCEL_TOKEN environment variable. Get your token from https://vercel.com/account/tokens`\n );\n }\n if (!oidcToken && !teamId) {\n throw new Error(\n `Missing Vercel team ID. Provide 'teamId' in config or set VERCEL_TEAM_ID environment variable.`\n );\n }\n if (!oidcToken && !projectId) {\n throw new Error(\n `Missing Vercel project ID. Provide 'projectId' in config or set VERCEL_PROJECT_ID environment variable.`\n );\n }\n }\n\n const timeout = config.timeout || 300000;\n\n try {\n let sandbox: VercelSandbox;\n\n if (options?.sandboxId) {\n // Vercel doesn't support reconnecting to existing sandboxes\n // Each sandbox is ephemeral and must be created fresh\n throw new Error(\n `Vercel provider does not support reconnecting to existing sandboxes. Vercel sandboxes are ephemeral and must be created fresh each time.`\n );\n } else {\n // Create new Vercel sandbox\n if (oidcToken) {\n sandbox = await VercelSandbox.create(\n {\n ports: config.ports,\n timeout,\n }\n );\n } else {\n sandbox = await VercelSandbox.create({\n token,\n teamId,\n projectId,\n ports: config.ports,\n timeout,\n });\n }\n }\n\n return {\n sandbox,\n sandboxId: sandbox.sandboxId\n };\n } catch (error) {\n if (error instanceof Error) {\n if (error.message.includes('unauthorized') || error.message.includes('token')) {\n throw new Error(\n `Vercel authentication failed. Please check your VERCEL_TOKEN environment variable. Get your token from https://vercel.com/account/tokens`\n );\n }\n if (error.message.includes('team') || error.message.includes('project')) {\n throw new Error(\n `Vercel team/project configuration failed. Please check your VERCEL_TEAM_ID and VERCEL_PROJECT_ID environment variables.`\n );\n }\n }\n throw new Error(\n `Failed to create Vercel sandbox: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n },\n\n getById: async (config: VercelConfig, sandboxId: string) => {\n // Check for OIDC token first (recommended method)\n const oidcToken = typeof process !== 'undefined' && process.env?.VERCEL_OIDC_TOKEN;\n\n try {\n let sandbox: VercelSandbox;\n\n if (oidcToken) {\n // Use OIDC token method\n sandbox = await VercelSandbox.get({ sandboxId });\n } else {\n // Use traditional method\n const token = config.token || process.env.VERCEL_TOKEN!;\n const teamId = config.teamId || process.env.VERCEL_TEAM_ID!;\n const projectId = config.projectId || process.env.VERCEL_PROJECT_ID!;\n\n sandbox = await VercelSandbox.get({\n sandboxId,\n token,\n teamId,\n projectId,\n });\n }\n\n return {\n sandbox,\n sandboxId\n };\n } catch (error) {\n // Sandbox doesn't exist or can't be accessed\n return null;\n }\n },\n\n list: async (_config: VercelConfig) => {\n throw new Error(\n `Vercel provider does not support listing sandboxes. Vercel sandboxes are ephemeral and designed for single-use execution.`\n );\n },\n\n destroy: async (config: VercelConfig, sandboxId: string) => {\n // Check for OIDC token first (recommended method)\n const oidcToken = typeof process !== 'undefined' && process.env?.VERCEL_OIDC_TOKEN;\n\n try {\n let sandbox: VercelSandbox;\n\n if (oidcToken) {\n // Use OIDC token method\n sandbox = await VercelSandbox.get({ sandboxId });\n } else {\n // Use traditional method\n const token = config.token || process.env.VERCEL_TOKEN!;\n const teamId = config.teamId || process.env.VERCEL_TEAM_ID!;\n const projectId = config.projectId || process.env.VERCEL_PROJECT_ID!;\n\n sandbox = await VercelSandbox.get({\n sandboxId,\n token,\n teamId,\n projectId,\n });\n }\n\n await sandbox.stop();\n } catch (error) {\n // Sandbox might already be destroyed or doesn't exist\n // This is acceptable for destroy operations\n }\n },\n\n // Instance operations (map to individual Sandbox methods)\n runCode: async (sandbox: VercelSandbox, code: string, runtime?: Runtime, config?: VercelConfig): Promise<ExecutionResult> => {\n const startTime = Date.now();\n\n // Auto-detect runtime if not specified\n const effectiveRuntime = runtime || config?.runtime || (\n // Strong Python indicators\n code.includes('print(') ||\n code.includes('import ') ||\n code.includes('def ') ||\n code.includes('sys.') ||\n code.includes('json.') ||\n code.includes('__') ||\n code.includes('f\"') ||\n code.includes(\"f'\") ||\n code.includes('raise ')\n ? 'python'\n // Default to Node.js for all other cases (including ambiguous)\n : 'node'\n );\n\n // Use base64 encoding for both runtimes for reliability and consistency\n const encoded = Buffer.from(code).toString('base64');\n const commandString = effectiveRuntime === 'python'\n ? `echo \"${encoded}\" | base64 -d | python3`\n : `echo \"${encoded}\" | base64 -d | node`;\n\n const result = await sandbox.runCommand('sh', ['-c', commandString]);\n // Call stdout/stderr sequentially to avoid \"Multiple consumers for logs\" warning\n const stdout = await result.stdout();\n const stderr = await result.stderr();\n\n // Check for syntax errors and throw them\n if (result.exitCode !== 0 && stderr) {\n if (stderr.includes('SyntaxError') ||\n stderr.includes('invalid syntax') ||\n stderr.includes('Unexpected token') ||\n stderr.includes('Unexpected identifier')) {\n throw new Error(`Syntax error: ${stderr.trim()}`);\n }\n }\n\n return {\n stdout,\n stderr,\n exitCode: result.exitCode,\n executionTime: Date.now() - startTime,\n sandboxId: sandbox.sandboxId,\n provider: 'vercel'\n };\n },\n\n runCommand: async (sandbox: VercelSandbox, command: string, args: string[] = []): Promise<ExecutionResult> => {\n const startTime = Date.now();\n\n try {\n // Construct full command with arguments, properly quoting each arg\n const quotedArgs = args.map((arg: string) => {\n if (arg.includes(' ') || arg.includes('\"') || arg.includes(\"'\") || arg.includes('$') || arg.includes('`')) {\n return `\"${arg.replace(/\"/g, '\\\\\"')}\"`;\n }\n return arg;\n });\n const fullCommand = quotedArgs.length > 0 ? `${command} ${quotedArgs.join(' ')}` : command;\n\n const result = await sandbox.runCommand('sh', ['-c', fullCommand]);\n // Call stdout/stderr sequentially to avoid \"Multiple consumers for logs\" warning\n const stdout = await result.stdout();\n const stderr = await result.stderr();\n\n return {\n stdout,\n stderr,\n exitCode: result.exitCode,\n executionTime: Date.now() - startTime,\n sandboxId: sandbox.sandboxId,\n provider: 'vercel'\n };\n } catch (error) {\n return {\n stdout: '',\n stderr: error instanceof Error ? error.message : String(error),\n exitCode: 127,\n executionTime: Date.now() - startTime,\n sandboxId: sandbox.sandboxId,\n provider: 'vercel'\n };\n }\n },\n\n getInfo: async (sandbox: VercelSandbox): Promise<SandboxInfo> => {\n return {\n id: 'vercel-unknown',\n provider: 'vercel',\n runtime: 'node', // Vercel default\n status: 'running',\n createdAt: new Date(),\n timeout: 300000,\n metadata: {\n vercelSandboxId: 'vercel-unknown'\n }\n };\n },\n\n getUrl: async (sandbox: VercelSandbox, options: { port: number; protocol?: string }): Promise<string> => {\n try {\n // Use Vercel's built-in domain method to get the real domain\n let url = sandbox.domain(options.port);\n \n // If a specific protocol is requested, replace the URL's protocol\n if (options.protocol) {\n const urlObj = new URL(url);\n urlObj.protocol = options.protocol + ':';\n url = urlObj.toString();\n }\n \n return url;\n } catch (error) {\n throw new Error(\n `Failed to get Vercel domain for port ${options.port}: ${error instanceof Error ? error.message : String(error)}. Ensure the port has an associated route.`\n );\n }\n },\n\n // Provider-specific typed getInstance method\n getInstance: (sandbox: VercelSandbox): VercelSandbox => {\n return sandbox;\n },\n\n }\n }\n});\n"],"mappings":";AAOA,SAAS,WAAW,qBAAqB;AACzC,SAAS,sBAAsB;AA2BxB,IAAM,SAAS,eAA4C;AAAA,EAChE,MAAM;AAAA,EACN,SAAS;AAAA,IACP,SAAS;AAAA;AAAA,MAEP,QAAQ,OAAO,QAAsB,YAAmC;AAEtE,cAAM,YAAY,OAAO,YAAY,eAAe,QAAQ,KAAK;AAGjE,cAAM,QAAQ,OAAO,SAAU,OAAO,YAAY,eAAe,QAAQ,KAAK,gBAAiB;AAC/F,cAAM,SAAS,OAAO,UAAW,OAAO,YAAY,eAAe,QAAQ,KAAK,kBAAmB;AACnG,cAAM,YAAY,OAAO,aAAc,OAAO,YAAY,eAAe,QAAQ,KAAK,qBAAsB;AAG5G,YAAI,CAAC,cAAc,CAAC,SAAS,CAAC,UAAU,CAAC,YAAY;AACnD,cAAI,CAAC,aAAa,CAAC,OAAO;AACxB,kBAAM,IAAI;AAAA,cACR;AAAA;AAAA;AAAA,YAGF;AAAA,UACF;AACA,cAAI,CAAC,aAAa,CAAC,QAAQ;AACzB,kBAAM,IAAI;AAAA,cACR;AAAA,YACF;AAAA,UACF;AACA,cAAI,CAAC,aAAa,CAAC,WAAW;AAC5B,kBAAM,IAAI;AAAA,cACR;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAEA,cAAM,UAAU,OAAO,WAAW;AAElC,YAAI;AACF,cAAI;AAEJ,cAAI,SAAS,WAAW;AAGtB,kBAAM,IAAI;AAAA,cACR;AAAA,YACF;AAAA,UACF,OAAO;AAEL,gBAAI,WAAW;AACb,wBAAU,MAAM,cAAc;AAAA,gBAC5B;AAAA,kBACE,OAAO,OAAO;AAAA,kBACd;AAAA,gBACF;AAAA,cACF;A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UAAU;AAAA,YACV,eAAe,KAAK,IAAI,IAAI;AAAA,YAC5B,WAAW,QAAQ;AAAA,YACnB,UAAU;AAAA,UACZ;AAAA,QACF;AAAA,MACF;AAAA,MAEA,SAAS,OAAO,YAAiD;AAC/D,eAAO;AAAA,UACL,IAAI;AAAA,UACJ,UAAU;AAAA,UACV,SAAS;AAAA;AAAA,UACT,QAAQ;AAAA,UACR,WAAW,oBAAI,KAAK;AAAA,UACpB,SAAS;AAAA,UACT,UAAU;AAAA,YACR,iBAAiB;AAAA,UACnB;AAAA,QACF;AAAA,MACF;AAAA,MAEA,QAAQ,OAAO,SAAwB,YAAkE;AACvG,YAAI;AAEF,cAAI,MAAM,QAAQ,OAAO,QAAQ,IAAI;AAGrC,cAAI,QAAQ,UAAU;AACpB,kBAAM,SAAS,IAAI,IAAI,GAAG;AAC1B,mBAAO,WAAW,QAAQ,WAAW;AACrC,kBAAM,OAAO,SAAS;AAAA,UACxB;AAEA,iBAAO;AAAA,QACT,SAAS,OAAO;AACd,gBAAM,IAAI;AAAA,YACR,wCAAwC,QAAQ,IAAI,KAAK,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;AAAA,UACjH;AAAA,QACF;AAAA,MACF;AAAA;AAAA,MAGA,aAAa,CAAC,YAA0C;AACtD,eAAO;AAAA,MACT;AAAA,IAEF;AAAA,EACF;AACF,CAAC;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@computesdk/vercel",
3
- "version": "1.5.7",
3
+ "version": "1.5.8",
4
4
  "description": "Vercel Sandbox provider for ComputeSDK",
5
5
  "author": "Garrison",
6
6
  "license": "MIT",
@@ -20,7 +20,7 @@
20
20
  "dependencies": {
21
21
  "@vercel/sandbox": "^0.0.13",
22
22
  "ms": "^2.1.3",
23
- "computesdk": "1.8.7"
23
+ "computesdk": "1.8.8"
24
24
  },
25
25
  "keywords": [
26
26
  "vercel",