@computesdk/workbench 23.0.0 → 24.0.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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/helpers.ts"],"sourcesContent":["/**\n * Workbench helpers for use in TypeScript files\n * \n * Import these in your .ts files for full TypeScript autocomplete!\n * \n * @example\n * ```typescript\n * import { createWorkbenchSession } from '@computesdk/workbench/helpers';\n * \n * const session = await createWorkbenchSession('e2b');\n * \n * // Now you get full TypeScript autocomplete!\n * await session.npm.install('express');\n * await session.git.clone('https://github.com/user/repo');\n * ```\n */\n\nimport * as cmd from '@computesdk/cmd';\nimport { createCompute } from '@computesdk/provider';\nimport { compute as gatewayCompute, type SandboxInterface } from 'computesdk';\nimport type { Provider, ProviderSandbox } from '@computesdk/provider';\n\n/**\n * Represents any valid sandbox instance in the workbench context\n * Can be either a gateway sandbox or a direct provider sandbox\n */\nexport type WorkbenchSandboxInstance = SandboxInterface | ProviderSandbox;\n\nexport interface WorkbenchSession {\n sandbox: WorkbenchSandboxInstance;\n // Re-export all cmd functions with the sandbox bound\n npm: typeof cmd.npm;\n pnpm: typeof cmd.pnpm;\n yarn: typeof cmd.yarn;\n bun: typeof cmd.bun;\n pip: typeof cmd.pip;\n git: typeof cmd.git;\n mkdir: typeof cmd.mkdir;\n ls: typeof cmd.ls;\n pwd: typeof cmd.pwd;\n cat: typeof cmd.cat;\n node: typeof cmd.node;\n python: typeof cmd.python;\n // ... add more as needed\n}\n\n/**\n * Create a workbench session for use in TypeScript files\n * This gives you full TypeScript autocomplete!\n */\nexport async function createWorkbenchSession(provider?: Provider): Promise<WorkbenchSession> {\n const compute = provider ? createCompute({ defaultProvider: provider }) : gatewayCompute;\n const sandbox = await compute.sandbox.create();\n \n return {\n sandbox,\n npm: cmd.npm,\n pnpm: cmd.pnpm,\n yarn: cmd.yarn,\n bun: cmd.bun,\n pip: cmd.pip,\n git: cmd.git,\n mkdir: cmd.mkdir,\n ls: cmd.ls,\n pwd: cmd.pwd,\n cat: cmd.cat,\n node: cmd.node,\n python: cmd.python,\n };\n}\n"],"mappings":";AAiBA,YAAY,SAAS;AACrB,SAAS,qBAAqB;AAC9B,SAAS,WAAW,sBAA6C;AA+BjE,eAAsB,uBAAuB,UAAgD;AAC3F,QAAM,UAAU,WAAW,cAAc,EAAE,iBAAiB,SAAS,CAAC,IAAI;AAC1E,QAAM,UAAU,MAAM,QAAQ,QAAQ,OAAO;AAE7C,SAAO;AAAA,IACL;AAAA,IACA,KAAS;AAAA,IACT,MAAU;AAAA,IACV,MAAU;AAAA,IACV,KAAS;AAAA,IACT,KAAS;AAAA,IACT,KAAS;AAAA,IACT,OAAW;AAAA,IACX,IAAQ;AAAA,IACR,KAAS;AAAA,IACT,KAAS;AAAA,IACT,MAAU;AAAA,IACV,QAAY;AAAA,EACd;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/helpers.ts"],"sourcesContent":["/**\n * Workbench helpers for use in TypeScript files\n * \n * Import these in your .ts files for full TypeScript autocomplete!\n * \n * @example\n * ```typescript\n * import { createWorkbenchSession } from '@computesdk/workbench/helpers';\n * \n * const session = await createWorkbenchSession('e2b');\n * \n * // Now you get full TypeScript autocomplete!\n * await session.npm.install('express');\n * await session.git.clone('https://github.com/user/repo');\n * ```\n */\n\nimport * as cmd from '@computesdk/cmd';\nimport { createCompute } from '@computesdk/provider';\nimport { compute as defaultCompute, type SandboxInterface } from 'computesdk';\nimport type { Provider, ProviderSandbox } from '@computesdk/provider';\n\nexport type WorkbenchSandboxInstance = SandboxInterface | ProviderSandbox;\n\nexport interface WorkbenchSession {\n sandbox: WorkbenchSandboxInstance;\n // Re-export all cmd functions with the sandbox bound\n npm: typeof cmd.npm;\n pnpm: typeof cmd.pnpm;\n yarn: typeof cmd.yarn;\n bun: typeof cmd.bun;\n pip: typeof cmd.pip;\n git: typeof cmd.git;\n mkdir: typeof cmd.mkdir;\n ls: typeof cmd.ls;\n pwd: typeof cmd.pwd;\n cat: typeof cmd.cat;\n node: typeof cmd.node;\n python: typeof cmd.python;\n // ... add more as needed\n}\n\n/**\n * Create a workbench session for use in TypeScript files\n * This gives you full TypeScript autocomplete!\n */\nexport async function createWorkbenchSession(provider?: Provider): Promise<WorkbenchSession> {\n const compute = provider ? createCompute({ defaultProvider: provider }) : defaultCompute;\n const sandbox = await compute.sandbox.create();\n \n return {\n sandbox,\n npm: cmd.npm,\n pnpm: cmd.pnpm,\n yarn: cmd.yarn,\n bun: cmd.bun,\n pip: cmd.pip,\n git: cmd.git,\n mkdir: cmd.mkdir,\n ls: cmd.ls,\n pwd: cmd.pwd,\n cat: cmd.cat,\n node: cmd.node,\n python: cmd.python,\n };\n}\n"],"mappings":";AAiBA,YAAY,SAAS;AACrB,SAAS,qBAAqB;AAC9B,SAAS,WAAW,sBAA6C;AA2BjE,eAAsB,uBAAuB,UAAgD;AAC3F,QAAM,UAAU,WAAW,cAAc,EAAE,iBAAiB,SAAS,CAAC,IAAI;AAC1E,QAAM,UAAU,MAAM,QAAQ,QAAQ,OAAO;AAE7C,SAAO;AAAA,IACL;AAAA,IACA,KAAS;AAAA,IACT,MAAU;AAAA,IACV,MAAU;AAAA,IACV,KAAS;AAAA,IACT,KAAS;AAAA,IACT,KAAS;AAAA,IACT,OAAW;AAAA,IACX,IAAQ;AAAA,IACR,KAAS;AAAA,IACT,KAAS;AAAA,IACT,MAAU;AAAA,IACV,QAAY;AAAA,EACd;AACF;","names":[]}