{"_id":"@tensorlakeai/tensorlake","_rev":"5-95eb1d5fe2ffc84427c83b6699cde346","name":"@tensorlakeai/tensorlake","dist-tags":{"placeholder":"0.0.0-bootstrap.0","latest":"0.5.145"},"versions":{"0.0.0-stage":{"name":"@tensorlakeai/tensorlake","version":"0.0.0-stage","_id":"@tensorlakeai/tensorlake@0.0.0-stage","stub":true,"maintainers":[{"name":"calavera","email":"david.calavera@gmail.com"}],"dist":{"shasum":"94a96e2efed6ccb6eb505f8e05a72fc4d7c49fd8","tarball":"https://registry.npmjs.org/@tensorlakeai/tensorlake/-/tensorlake-0.0.0-stage.tgz","fileCount":2,"integrity":"sha512-5vM/EaYBkZK1+sY6kkX5qF5D2pSDBWFMekgflW3HLgZB3A7hZiDKVGsnfSv526Nn5NKwUFQW/VDUm1hlnPrI/A==","signatures":[{"sig":"MEQCIBYOB5x7SE4Z1O5geYL05QmgrnrpMAHIiPjuBuC+8HH7AiBYHFgBgk1fHFhUwhlE2zoWMIVeg7rJxepn0gzW9raO8Q==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":439},"_npmUser":{"name":"calavera","email":"david.calavera@gmail.com"},"description":"Temporary package placeholder for staged publishing","directories":{}},"0.0.0-bootstrap.0":{"name":"@tensorlakeai/tensorlake","version":"0.0.0-bootstrap.0","license":"Apache-2.0","_id":"@tensorlakeai/tensorlake@0.0.0-bootstrap.0","maintainers":[{"name":"diptanuc","email":"diptanuc@gmail.com"},{"name":"calavera","email":"david.calavera@gmail.com"}],"homepage":"https://github.com/tensorlakeai/tensorlake#readme","bugs":{"url":"https://github.com/tensorlakeai/tensorlake/issues"},"dist":{"shasum":"6d1e6ca7e1f5d1df63f1d790d3f681c604b8b5dd","tarball":"https://registry.npmjs.org/@tensorlakeai/tensorlake/-/tensorlake-0.0.0-bootstrap.0.tgz","fileCount":2,"integrity":"sha512-GW9yS2pLEt/5HrICVwFJhRDbrFxCxK3pReJcygyJ8hGL1vlYpdg5nV7/OhfcKL9LMTO1v2pvriK/LS2YEUgyQQ==","signatures":[{"sig":"MEUCICOBd3n0P1GI/nd8zGZctdXmvfVDrMJGPzJT9VgwFGGtAiEArhrPn8EcURusR5wyZyMYhCQkxLh3zQnboju3Ii8Vimo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEYCIQD4kb4x6I1tiIGPqNPxeIue9QFHFGr4Be9HrfKFtvXLdgIhAMScWOF7OQ/Eho40CPXYlOIn5H8255HfB1o2zTt63Vj+","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":434},"_npmUser":{"name":"calavera","email":"david.calavera@gmail.com"},"deprecated":"Placeholder release; install a real version.","repository":{"url":"git+https://github.com/tensorlakeai/tensorlake.git","type":"git"},"_npmVersion":"11.12.1","description":"Name reserved by Tensorlake. Real releases are published from github.com/tensorlakeai/tensorlake.","directories":{},"_nodeVersion":"25.9.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/tensorlake_0.0.0-bootstrap.0_1791485036095_0.6434093497746933","host":"s3://npm-registry-packages-npm-production"}},"0.5.145":{"_id":"@tensorlakeai/tensorlake@0.5.145","bin":{"function-executor":"bin/function-executor.js","tensorlake-deploy":"bin/tensorlake-deploy.cjs","tensorlake-create-sandbox-image":"bin/tensorlake-create-sandbox-image.js","tensorlake-import-sandbox-image":"bin/tensorlake-import-sandbox-image.js","tensorlake-typescript-function-runner":"bin/tensorlake-typescript-function-runner.js"},"bugs":{"url":"https://github.com/tensorlakeai/tensorlake/issues"},"dist":{"shasum":"442bc41ef57e2ae74fbaa1ba15b8d688452cc317","tarball":"https://registry.npmjs.org/@tensorlakeai/tensorlake/-/tensorlake-0.5.145.tgz","integrity":"sha512-/cIPtgw2Vz0aVxqjcbqHq0upNO3YSI1/T1O4DsX+ojoHBHLKBeO3vxj82QxQvfV9pHfwkKs5N/fzS/YLxhwycw==","fileCount":69,"unpackedSize":6837129,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@tensorlakeai%2ftensorlake@0.5.145","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCoVSMPbES7pFqqdITor3xQt4pRVeZzp4Q6Sz1q5efJkwIgJQqs6l6o2ordbJn0WtHIRho3uvHh3d2fp1DSelde8Ck="}]},"main":"./dist/index.cjs","name":"@tensorlakeai/tensorlake","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=22.0.0"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}},"./applications":{"import":{"types":"./dist/applications/index.d.ts","default":"./dist/applications/index.js"},"require":{"types":"./dist/applications/index.d.cts","default":"./dist/applications/index.cjs"}},"./internal/native-worker":"./dist/native-worker.cjs"},"gitHead":"340cd674294c3b26e585f04e8f28fc754e60c438","license":"Apache-2.0","scripts":{"lint":"eslint src/ tests/","test":"vitest run --exclude tests/integration.test.ts","build":"npm run build:sdk && npm run build:native && npm run build:runtime","prepack":"npm run build","build:sdk":"tsup","typecheck":"tsc --noEmit","test:watch":"vitest","check:proto":"node ./scripts/check-function-executor-proto.mjs","build:native":"node ./scripts/build-native.mjs","build:runtime":"node ./scripts/build-function-executor-capsule.mjs && node ./scripts/build-typescript-function-runner-capsule.mjs && node ./scripts/check-package-compatibility.mjs","test:integration":"vitest run tests/integration.test.ts","test:native-cloud":"node ./scripts/test-native-cloud.mjs","test:function-agent":"vitest run tests/function-agent.test.ts","test:native-sandbox":"node ./scripts/test-native-sandbox.mjs","check:install-scripts":"node ./scripts/check-no-install-scripts.mjs","test:function-executor":"vitest run tests/function-executor.test.ts tests/function-executor-protocol.test.ts"},"version":"0.5.145","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"a6f3809c-41da-47f5-b8d8-c18d58a7d18a"},"approver":{"name":"calavera","email":"david.calavera@gmail.com"}},"homepage":"https://github.com/tensorlakeai/tensorlake#readme","keywords":["tensorlake","sandbox","cloud","sdk","applications"],"repository":{"url":"git+https://github.com/tensorlakeai/tensorlake.git","type":"git","directory":"typescript"},"_npmVersion":"11.15.0","description":"TensorLake SDK for applications, sandboxes, and cloud services","directories":{},"maintainers":[{"name":"diptanuc","email":"diptanuc@gmail.com"},{"name":"calavera","email":"david.calavera@gmail.com"}],"_nodeVersion":"24.21.0","dependencies":{"ws":"^8.20.0","ajv":"^8.17.1","fflate":"^0.8.2","nanoid":"^3.3.18","@grpc/grpc-js":"^1.13.0","@grpc/proto-loader":"^0.8.0","google-proto-files":"^5.0.2"},"devDependencies":{"tsup":"^8.0.0","eslint":"^9.0.0","vitest":"^2.0.0","@types/ws":"^8.18.1","@eslint/js":"^9.39.4","typescript":"^5.8.0","@types/node":"^24.0.0","typescript-eslint":"^8.65.0"},"optionalDependencies":{"@tensorlakeai/native-win32-x64":"0.5.145","@tensorlakeai/native-darwin-arm64":"0.5.145","@tensorlakeai/native-linux-x64-gnu":"0.5.145","@tensorlakeai/native-linux-x64-musl":"0.5.145","@tensorlakeai/native-linux-arm64-gnu":"0.5.145","@tensorlakeai/native-linux-arm64-musl":"0.5.145"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/tensorlake_0.5.145_1791490848244_0.16127866882307362"},"_hasShrinkwrap":false}},"time":{"created":"2026-10-08T18:42:39.397Z","modified":"2026-10-08T20:20:48.709Z","0.0.0-stage":"2026-10-08T18:42:39.397Z","0.0.0-bootstrap.0":"2026-10-08T18:43:56.185Z","0.5.145":"2026-10-08T20:20:48.415Z"},"bugs":{"url":"https://github.com/tensorlakeai/tensorlake/issues"},"license":"Apache-2.0","homepage":"https://github.com/tensorlakeai/tensorlake#readme","repository":{"url":"git+https://github.com/tensorlakeai/tensorlake.git","type":"git","directory":"typescript"},"description":"TensorLake SDK for applications, sandboxes, and cloud services","maintainers":[{"name":"diptanuc","email":"diptanuc@gmail.com"},{"name":"calavera","email":"david.calavera@gmail.com"}],"readme":"# Tensorlake TypeScript SDK\n\nThe TypeScript SDK supports Tensorlake sandboxes on Node.js 22 or newer. Deploying and running durable TypeScript applications requires Node.js 24 or newer. Application handlers are async-only and values crossing a function boundary must be JSON values or a direct `File`. Application entrypoints can also receive an exact raw request body with `HttpBody`.\n\nSandbox, repository and filesystem handles retain configuration on the calling thread.\nThe first native operation starts a persistent Node worker that loads the addon and\nowns the native clients. Concurrent calls use the same worker; sandbox proxies share\ntheir lifecycle client's connection pool. Addon loading and TLS initialization keep\nthe application's event loop responsive, including on the first call. Initialization\nfailures reject the operation. A later operation can retry transport initialization;\ncreating a new client picks up changes to the system's trusted certificates.\n\nStreaming consumers acknowledge each event before Rust reads the next one. Breaking\niteration, aborting its signal, or closing the sandbox connection cancels the native\nHTTP stream. Closing one handle leaves sibling handles usable. Garbage collection\nalso releases native handles, and an idle worker does not keep Node running. If a\nworker fails, outstanding calls reject without automatic replay; subsequent calls\ncan start a fresh worker. Byte arguments are copied across the worker boundary;\ncaller-owned buffers are never detached. File-path upload APIs avoid that copy.\n\nBoth ESM and CommonJS packages include the worker entrypoint. Applications using a\nbundler should keep `@tensorlakeai/tensorlake` external so its worker and optional native packages\nremain available at runtime. Tensorlake's function runtime capsules carry the worker\nfor deployed application bundles. Image-building and Function Agent runtime bindings\nhave their own native entrypoints and are outside this sandbox worker boundary.\n\nOn Linux, native binding selection reads the Node executable's ELF interpreter\nwithout generating diagnostic reports. For a nonstandard or statically linked Node\nexecutable, set `TENSORLAKE_NODE_LIBC=gnu` or `TENSORLAKE_NODE_LIBC=musl` before using\nthe SDK.\n\n```ts\nimport { registerApplication, registerFunction } from \"@tensorlakeai/tensorlake/applications\";\n\nconst square = registerFunction(\n  \"square\",\n  async (value: number) => value * value,\n);\n\nexport const squares = registerApplication(\n  \"squares\",\n  async (values: number[]) => square.map(values),\n);\n```\n\nThis concise form infers the TypeScript call signature and uses permissive JSON\nschemas. JavaScript default parameters are inferred as optional, and the\nexplicit name is stable across bundling. Use the schema-rich form when you need\nruntime validation, API metadata, optional parameters without a JavaScript\ndefault, rest parameters, `File` inputs and outputs, or an `HttpBody` input:\n\n```ts\nimport { registerApplication, schema } from \"@tensorlakeai/tensorlake/applications\";\n\nexport const validatedSquare = registerApplication(\n  async (value: number) => value * value,\n  {\n    name: \"validated_square\",\n    parameters: [schema.parameter(\"value\", schema.number())] as const,\n    returns: schema.number(),\n  },\n);\n```\n\nRun locally or deploy the same file:\n\n```ts\nimport { runLocal } from \"@tensorlakeai/tensorlake/applications\";\n\nconst request = await runLocal(squares, [1, 2, 3]);\nconsole.log(await request.output());\n```\n\nUse `runRemote` for a deployed application. Plain client options remain the\nlast argument when every application argument is supplied. Wrap options with\n`remoteOptions` when omitting JavaScript default arguments so an object input\ncan never be mistaken for client configuration:\n\n```ts\nimport { registerApplication, remoteOptions, runRemote } from \"@tensorlakeai/tensorlake/applications\";\n\nconst greeting = registerApplication(\n  \"greeting\",\n  async (name = \"world\") => `Hello, ${name}!`,\n);\n\nconst request = await runRemote(\n  greeting,\n  remoteOptions({ apiKey: process.env.TENSORLAKE_API_KEY }),\n);\nconsole.log(await request.output());\n```\n\n```bash\nnpm install @tensorlakeai/tensorlake\ntl deploy app.ts\n```\n\n`tl` recognizes ESM `.ts`, `.mts`, `.js`, and `.mjs` entrypoints. The Rust CLI bundles the application for Node 24 with Rolldown, initializes the resulting ESM bundle once with Node to discover its registered functions, builds the function images, and uploads the deployment. CommonJS application modules and bundler configuration files are not supported.\n\nThe SDK build also produces a hashed executor capsule containing the Node 24 ESM executor, its protobufs, and an npm shrinkwrap derived from the checked-in SDK lockfile. During deployment, `tl` uses the capsule from the exact SDK package Rolldown resolved and adds it directly to the image-build context. This supports local dependencies such as `\"@tensorlakeai/tensorlake\": \"file:../tensorlake/typescript\"`; build that SDK checkout with `npm run build:sdk` before deploying. The local Tensorlake package does not need to be published.\n\nFunctions expose `future`, `map`, `reduce`, and `tailCall`. `map` and `reduce`\naccept either an iterable or a Promise/Future that produces one, and their\niterables may contain Promise/Future values. A reduce initial value is optional;\nwithout one, the first item becomes the accumulator and an empty collection is\nan error. Awaiting a registered function inside a running application creates a\ndurable remote function call. `RequestContext.get()` provides async request\nstate, metrics, progress, and an abort signal. Local requests expose `cancel()`,\nwhich aborts that signal and rejects `output()`.\n\nTypeScript and Python definitions cannot be mixed in one deployed application bundle. Class-based function semantics are not supported in the TypeScript runtime.\n\nFor a raw request body, declare a direct application parameter with\n`schema.httpBody()`. `HttpBody.content` contains the unchanged bytes,\n`contentType` preserves the request MIME type, and `text()` / `json()` provide\nexplicit decoding helpers. `RequestContext.get().headers` exposes sanitized,\ncase-insensitive invocation headers and preserves duplicate values through\n`getAll()`. `HttpBody` is not supported in nested schemas, durable function\nparameters, or return values. See the\n[raw webhook example](examples/http-body/README.md).\n\nApplications that accept public HTTP requests can set\n`allow: [\"unauthenticated_requests\"]` in their registration options. The\ncapability is emitted in the deployment manifest, and deployments preserve the\napplication's stable public endpoint identifier across updates.\n\n## Function executor correctness\n\nRun the executor transport and protocol-state regression suites with:\n\n```bash\nnpm run test:function-executor\n```\n\nThese tests use bounded fake-server event sequences to cover terminal-result cardinality, retry exhaustion, deterministic concurrent fan-out and strict replay, function-call reduce chains, malformed user input, non-advancing event pages, tail calls, cross-bundle request errors, state reconciliation, and ranged BLOB transport. `npm run build:sdk` additionally builds the exact executor capsule used during deployment.\n\n## Live server verification\n\nThe [server-verification example](examples/server-verification/README.md) uses the normal `tl deploy <PATH>` workflow to deploy eight reference applications and verify durable calls, retries and retry exhaustion, concurrent fan-out, server-orchestrated reduce, nested calls, request context, tail calls, files, and request errors against an already-running server.\n\n## Native transport and application preloads\n\nCloud, sandbox, repository, and filesystem HTTP operations use the Rust SDK\nthrough an internal worker. Keep the platform-specific optional native package\ninstalled. Importing Tensorlake does not replace the application's HTTP dispatcher.\n\nThe worker starts with an empty `execArgv` and a copied environment with\n`NODE_OPTIONS` cleared, so application `--require`, `--import`, and loader hooks\ndo not run inside it. Other environment variables are copied when it starts.\nThe application's own startup flags and environment remain intact. Native HTTPS\nuses the Rust SDK's bundled Mozilla certificate roots.\n\n`CloudClient.close()` cancels its active requests and streams and prevents further\nrequests. Buffered cloud requests have a 300-second deadline covering retries and\nbody reads. Progress and build-log streams have a connection deadline and can\nremain open until completion or cancellation. `maxRetries` and `retryBackoffMs`\ncontrol transient retries for safe reads; mutations are replayed only when the\nRust retry policy establishes that they were not delivered, within its 30-second\nreplay budget. A lost response after delivery does not replay an application invocation.\nMutation redirects are returned as errors instead of being followed, because a\nfailure fetching the redirected result cannot prove that the mutation was not\ndelivered. Safe reads still follow redirects and retry failed response transfers.\nCloud requests advertise gzip support and decode gzip responses, including live SSE.\n\nAfter building the SDK and native addon, run `npm run test:native-cloud` to check\nthe cloud transport against a local HTTP server.\n","readmeFilename":"README.md","keywords":["tensorlake","sandbox","cloud","sdk","applications"]}