{"_id":"@archastro/intern-sdk","_rev":"3-4c7b495e7620b2896f24c48ddd8f9914","name":"@archastro/intern-sdk","dist-tags":{"latest":"0.2.1"},"versions":{"0.1.0":{"name":"@archastro/intern-sdk","version":"0.1.0","keywords":["archastro","intern","sdk","typescript"],"license":"MIT","_id":"@archastro/intern-sdk@0.1.0","maintainers":[{"name":"calvin.grunewald","email":"calvin@archastro.ai"},{"name":"vks-archastro","email":"vks@archastro.ai"},{"name":"tore-archastro","email":"tore@archastro.ai"}],"homepage":"https://tryintern.dev","bugs":{"url":"https://github.com/ArchAstro/intern-sdk/issues"},"dist":{"shasum":"d46b80f57445bed1fbb6560f81053836d6fb6b97","tarball":"https://registry.npmjs.org/@archastro/intern-sdk/-/intern-sdk-0.1.0.tgz","fileCount":59,"integrity":"sha512-JXgZarjFunwM0pBwVDFkxQTW5w9+iQ4Ml9AlMrsG79DvHJl8lO05c90Qs//lWtjumLffnvAKmsy+lDgIxkpjMg==","signatures":[{"sig":"MEUCIQCbU77+onQhgQvf4eMuVYLerEICIIOxL+sgQ1/IFnDkJQIgGjy2akHS0DT99TZIunefr2WWB/5kJDYqm9MN2FrzbNI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":37615},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=22"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./runtime":{"types":"./dist/runtime/index.d.ts","import":"./dist/runtime/index.js"},"./testing":{"types":"./dist/testing/index.d.ts","import":"./dist/testing/index.js"},"./package.json":"./package.json"},"gitHead":"e95100223331128fce2054bbab65ed3fb5d74884","scripts":{"test":"vitest run","build":"npm run clean && tsc -p tsconfig.build.json","check":"npm run format:check && npm run typecheck && npm run build && npm test && npm run test:package","clean":"rm -rf dist","format":"prettier --write .","prepack":"npm run build","prepare":"npm run build","typecheck":"tsc --noEmit -p tsconfig.json && tsc --noEmit -p tsconfig.types.json","format:check":"prettier --check .","test:package":"node scripts/package-smoke.mjs"},"_npmUser":{"name":"calvin.grunewald","email":"calvin@archastro.ai"},"repository":{"url":"git+https://github.com/ArchAstro/intern-sdk.git","type":"git"},"_npmVersion":"11.19.0","description":"Typed client and runtime plugin contract for Intern sites","directories":{},"sideEffects":false,"_nodeVersion":"26.7.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"4.1.9","prettier":"3.6.2","typescript":"5.9.3","@types/node":"22.18.6"},"_npmOperationalInternal":{"tmp":"tmp/intern-sdk_0.1.0_1787327100798_0.7544439951470394","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@archastro/intern-sdk","version":"0.2.0","keywords":["archastro","intern","sdk","typescript"],"license":"MIT","_id":"@archastro/intern-sdk@0.2.0","maintainers":[{"name":"calvin.grunewald","email":"calvin@archastro.ai"},{"name":"vks-archastro","email":"vks@archastro.ai"},{"name":"tore-archastro","email":"tore@archastro.ai"}],"homepage":"https://tryintern.dev","bugs":{"url":"https://github.com/ArchAstro/intern-sdk/issues"},"dist":{"shasum":"b40d19370c3868ede61ccf314bc589aed1a6f319","tarball":"https://registry.npmjs.org/@archastro/intern-sdk/-/intern-sdk-0.2.0.tgz","fileCount":87,"integrity":"sha512-PEPuR2y1QM7zGkkZyPxyqIo/vNw0o8V0x/ehnIBse7dO71rG40QB/wNxkEVPRGFBpM0TkBUQU+gywZASQDxXsg==","signatures":[{"sig":"MEUCIEG0O3H9SqFvOBCLyyGWgRAJ89yJdMbQ5y0MnqRdG7nsAiEAwDxBQRJ3fzdzCsrYCawn8Fp+OKj8BTXPgn/DPmpCYnA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@archastro%2fintern-sdk@0.2.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":86745},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=22"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./runtime":{"types":"./dist/runtime/index.d.ts","import":"./dist/runtime/index.js"},"./testing":{"types":"./dist/testing/index.d.ts","import":"./dist/testing/index.js"},"./package.json":"./package.json"},"gitHead":"ff30db8dbbf520566fbe657f0487e9a50b0d71b1","scripts":{"test":"vitest run","build":"npm run clean && tsc -p tsconfig.build.json","check":"npm run format:check && npm run typecheck && npm run build && npm test && npm run test:package","clean":"rm -rf dist","format":"prettier --write .","prepack":"npm run build","prepare":"npm run build","typecheck":"tsc --noEmit -p tsconfig.json && tsc --noEmit -p tsconfig.types.json","format:check":"prettier --check .","test:package":"node scripts/package-smoke.mjs"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:95130c61-41b0-4947-be57-824c5c868d6a"}},"repository":{"url":"git+https://github.com/ArchAstro/intern-sdk.git","type":"git"},"_npmVersion":"11.17.0","description":"Typed client and runtime plugin contract for Intern sites","directories":{},"sideEffects":false,"_nodeVersion":"24.19.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"4.1.9","prettier":"3.6.2","typescript":"5.9.3","@types/node":"22.18.6"},"_npmOperationalInternal":{"tmp":"tmp/intern-sdk_0.2.0_1787679754595_0.26417264703832277","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@archastro/intern-sdk","version":"0.2.1","description":"Typed client and runtime plugin contract for Intern sites","type":"module","sideEffects":false,"main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./runtime":{"types":"./dist/runtime/index.d.ts","import":"./dist/runtime/index.js"},"./testing":{"types":"./dist/testing/index.d.ts","import":"./dist/testing/index.js"},"./package.json":"./package.json"},"scripts":{"build":"npm run clean && tsc -p tsconfig.build.json","clean":"rm -rf dist","format":"prettier --write .","format:check":"prettier --check .","typecheck":"tsc --noEmit -p tsconfig.json && tsc --noEmit -p tsconfig.types.json","test":"vitest run","test:package":"node scripts/package-smoke.mjs","check":"npm run format:check && npm run typecheck && npm run build && npm test && npm run test:package","prepare":"npm run build","prepack":"npm run build"},"keywords":["archastro","intern","sdk","typescript"],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/ArchAstro/intern-sdk.git"},"homepage":"https://tryintern.dev","publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"engines":{"node":">=22"},"devDependencies":{"@types/node":"22.18.6","prettier":"3.6.2","typescript":"5.9.3","vitest":"4.1.9"},"gitHead":"e716994e4feebda8a7c4a23a77baa19892057961","_id":"@archastro/intern-sdk@0.2.1","bugs":{"url":"https://github.com/ArchAstro/intern-sdk/issues"},"_nodeVersion":"24.19.0","_npmVersion":"11.17.0","dist":{"integrity":"sha512-u2lWOIW8gFUc5nqMf9/YaIF5MuB8PUmpPHxCDt6BSmVjUfjHIo8tdH8GQNqj4ze5FVopc0vR1cB+CEx9IoXeuw==","shasum":"176499f9a8163a686040a1e34c89bcd58892c86f","tarball":"https://registry.npmjs.org/@archastro/intern-sdk/-/intern-sdk-0.2.1.tgz","fileCount":87,"unpackedSize":86972,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@archastro%2fintern-sdk@0.2.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIFCbENZpJjhj3xpUtcJqLlHT/FdGQlRFhIbDixEE2F6pAiEA2ssB8PqhYal8S6pR85dbUra+KypB6j//eR99nFIFEyo="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:95130c61-41b0-4947-be57-824c5c868d6a"}},"directories":{},"maintainers":[{"name":"calvin.grunewald","email":"calvin@archastro.ai"},{"name":"vks-archastro","email":"vks@archastro.ai"},{"name":"tore-archastro","email":"tore@archastro.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/intern-sdk_0.2.1_1787681402432_0.41412552967322025"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-21T15:45:00.593Z","modified":"2026-08-25T18:10:03.011Z","0.1.0":"2026-08-21T15:45:00.939Z","0.2.0":"2026-08-25T17:42:34.821Z","0.2.1":"2026-08-25T18:10:02.589Z"},"bugs":{"url":"https://github.com/ArchAstro/intern-sdk/issues"},"license":"MIT","homepage":"https://tryintern.dev","keywords":["archastro","intern","sdk","typescript"],"repository":{"type":"git","url":"git+https://github.com/ArchAstro/intern-sdk.git"},"description":"Typed client and runtime plugin contract for Intern sites","maintainers":[{"name":"calvin.grunewald","email":"calvin@archastro.ai"},{"name":"vks-archastro","email":"vks@archastro.ai"},{"name":"tore-archastro","email":"tore@archastro.ai"}],"readme":"# Intern SDK\n\n`@archastro/intern-sdk` is the typed application API for Intern sites. The\nclient is a thin wrapper around plugin implementations supplied by the active\nruntime.\n\n```ts\nimport Client from \"@archastro/intern-sdk\";\n\nconst client = new Client();\nconst current = await client.me.get();\n\nawait client.me.update({ name: \"Ada Lovelace\" });\n\nawait client.d1.exec(\n  \"CREATE TABLE IF NOT EXISTS visits (id INTEGER PRIMARY KEY)\",\n);\nconst visits = await client.d1.prepare(\"SELECT * FROM visits\").all();\n```\n\nThe site commits only this client code. Local MCP previews and production hosts\nserve the same bundle and inject their runtime resolver outside the checkout.\nInstall the SDK as a development dependency so the site build bundles it into\nthe committed browser output:\n\n```sh\nnpm install --save-dev @archastro/intern-sdk\n```\n\n## Runtime implementations\n\nThe host injects a stable runtime resolver as `globalThis.intern`. Browser\nhosts resolve one runtime; SSR hosts resolve request-scoped runtimes. The\napplication continues to use `new Client()` in both places.\n\n```ts\nimport {\n  createRuntimeHost,\n  INTERN_PROTOCOL_VERSION,\n  INTERN_TRANSPORT_VERSION,\n  type InternRuntime,\n} from \"@archastro/intern-sdk/runtime\";\n\nconst currentRuntime: InternRuntime = {\n  protocolVersion: INTERN_PROTOCOL_VERSION,\n  transport: {\n    version: INTERN_TRANSPORT_VERSION,\n    async invoke(binding, operation, input) {\n      return hostCall({ binding, operation, input });\n    },\n  },\n};\n\nglobalThis.intern = createRuntimeHost(() => currentRuntime);\n```\n\nTests and local tools can also supply a runtime explicitly:\n\n```ts\nimport Client from \"@archastro/intern-sdk\";\nimport { createMemorySandbox } from \"@archastro/intern-sdk/testing\";\n\nconst sandbox = createMemorySandbox({ me: seededUser, d1: true });\nconst client = new Client({ runtime: sandbox.runtime });\n```\n\nThe injected protocol is plugin-agnostic: hosts implement only\n`RuntimeTransport.invoke(binding, operation, input)`. Typed plugin wrappers map\ntheir public methods onto that transport, so adding a plugin does not add\nplugin-specific methods or dispatch branches to the injected host. Local tools\nmay still use implementation contracts and the in-memory dispatcher from\n`@archastro/intern-sdk/testing`.\n\nPlugins are opt-in. A host that does not provide `d1` leaves `client.d1`\nunavailable; it does not silently create or connect a database.\n\nApplication code imports only the client and public plugin types from the\npackage root.\n\nThe transport is an additive capability within the deployed protocol-v1 host\nenvelope. Hosts roll out `transport` first while retaining a generic legacy\nplugin facade for already-compiled sites; transport-aware SDKs can ship after\nthat. The transport has its own version, so future wire changes do not silently\nreinterpret calls made through the stable host envelope.\n\nUse `encodeRuntimeWireValue` and `decodeRuntimeWireValue` at JSON boundaries.\nThe codec preserves `Uint8Array` profile-picture bytes and rejects unsupported\nor cyclic values rather than relying on JSON's lossy typed-array encoding.\n\n## Releases\n\nThe initial `0.1.0` publication is a one-time authenticated seed because npm\nrequires the package to exist before a trusted publisher can be registered.\nAfter that seed, configure the package's GitHub Actions publisher:\n\n```sh\nnpm trust github @archastro/intern-sdk \\\n  --repo ArchAstro/intern-sdk \\\n  --file publish.yml \\\n  --env npm-release \\\n  --allow-publish\n```\n\nSubsequent releases use the manual `release` workflow on `main`. It runs the\nfull package gate, opens and rebase-merges a version-only PR, tags the exact\nmerged commit, and dispatches `publish.yml`. The publish job uses npm OIDC,\nverifies the tag and package version agree, refuses an existing version,\npublishes publicly with automatic provenance, and creates the GitHub Release.\n\nThe npm trusted publisher must match these values exactly:\n\n- Package: `@archastro/intern-sdk`\n- GitHub organization: `ArchAstro`\n- Repository: `intern-sdk`\n- Workflow: `publish.yml`\n- Environment: `npm-release`\n- Allowed action: `npm publish`\n","readmeFilename":"README.md"}