{"_id":"@cachetronaut/plugg","name":"@cachetronaut/plugg","dist-tags":{"latest":"0.0.0"},"versions":{"0.0.0":{"name":"@cachetronaut/plugg","version":"0.0.0","description":"Neutral authentication port for agent-fabric primitives: resolves opaque credentials into fabric principals without vendor identity leakage.","keywords":["plugg","agent-fabric","principal","authentication","identity","typescript","esm"],"type":"module","license":"MIT","repository":{"type":"git","url":"git+https://github.com/cachetronaut/plugg-ts.git"},"homepage":"https://github.com/cachetronaut/plugg-ts#readme","bugs":{"url":"https://github.com/cachetronaut/plugg-ts/issues"},"main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./package.json":"./package.json"},"publishConfig":{"access":"public"},"engines":{"node":">=24.0.0","pnpm":">=9.0.0"},"packageManager":"pnpm@9.12.0","scripts":{"build":"tsup","prepack":"pnpm build","prepublishOnly":"pnpm verify && pnpm build","check":"biome check .","check:fix":"biome check --write .","typecheck":"pnpm -r typecheck","test":"pnpm -r test","verify":"pnpm check && pnpm typecheck && pnpm test"},"pnpm":{"supportedArchitectures":{"os":["current","darwin"],"cpu":["current","arm64"]}},"devDependencies":{"@biomejs/biome":"2.0.6","@types/node":"^22.10.0","tsup":"^8.3.5","typescript":"^5.7.2","vitest":"^2.1.8"},"gitHead":"36072ef27622f5ce5d80034684aa0a57b70fc272","_id":"@cachetronaut/plugg@0.0.0","_nodeVersion":"24.16.0","_npmVersion":"11.13.0","dist":{"integrity":"sha512-rw15/GWci3qrHeiCRLMxdahMGgEl0Uw8SMcqWMmy8kSRfJoAuMbCnq9Jzpr5w6Qwme2ho9FBz7OssIxGGHTNfA==","shasum":"ed5ece67ce4fa36cda53727fc3a395b0bfaea0dc","tarball":"https://registry.npmjs.org/@cachetronaut/plugg/-/plugg-0.0.0.tgz","fileCount":4,"unpackedSize":5671,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEMCIFFTJ4xJ8YMAfQCOZPvNlIzZUKZRAPYyuojcfXtHAl/cAh9Jhs+DY+FcTvW1XkIFEQ87YFMUsW1LrXYlWl4Npc3Y"}]},"_npmUser":{"name":"cachetronaut","email":"abrahamacastro+code@gmail.com"},"directories":{},"maintainers":[{"name":"cachetronaut","email":"abrahamacastro+code@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/plugg_0.0.0_1780675795421_0.94264196247252"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-05T16:09:55.283Z","0.0.0":"2026-06-05T16:09:55.568Z","modified":"2026-06-05T16:09:55.733Z"},"maintainers":[{"name":"cachetronaut","email":"abrahamacastro+code@gmail.com"}],"description":"Neutral authentication port for agent-fabric primitives: resolves opaque credentials into fabric principals without vendor identity leakage.","homepage":"https://github.com/cachetronaut/plugg-ts#readme","keywords":["plugg","agent-fabric","principal","authentication","identity","typescript","esm"],"repository":{"type":"git","url":"git+https://github.com/cachetronaut/plugg-ts.git"},"bugs":{"url":"https://github.com/cachetronaut/plugg-ts/issues"},"license":"MIT","readme":"# Plugg TS\n\nPlugg is the TypeScript authentication port for agent-fabric primitives. It\nresolves opaque credentials into neutral fabric principals without binding the\nprimitive packages to an identity provider.\n\nThis repo publishes the npm package `@cachetronaut/plugg`.\n\n## Install\n\n```sh\npnpm add @cachetronaut/plugg\n```\n\n## API\n\nThe TypeScript and Python packages expose the same concepts:\n\n- `Principal`\n- `PrincipalKind`\n- `AuthAdapter`\n- `AuthError`\n- `AuthErrorCode`\n- `canonicalizePrincipal`\n- `principalToJson`\n- `isAuthError`\n\nTypeScript uses camelCase names. Python uses snake_case names for functions.\n\n## Usage\n\n```ts\nimport {\n  AuthError,\n  type AuthAdapter,\n  type Principal,\n  canonicalizePrincipal,\n  isAuthError,\n} from \"@cachetronaut/plugg\";\n\nconst adapter: AuthAdapter = {\n  async resolve(credential: string): Promise<Principal> {\n    if (credential !== \"opaque-dev-credential\") {\n      throw new AuthError(\"invalid_credential\", \"Unknown credential\");\n    }\n\n    return {\n      id: \"principal_user_01\",\n      kind: \"user\",\n      claims: { org: \"org_demo\", roles: [\"developer\", \"operator\"] },\n    };\n  },\n};\n\ntry {\n  const principal = await adapter.resolve(\"opaque-dev-credential\");\n  console.log(canonicalizePrincipal(principal));\n} catch (error) {\n  if (isAuthError(error)) {\n    console.error(error.code);\n  }\n}\n```\n\n## Mirror Contract\n\n`plugg-ts` and `plugg-py` must agree on the canonical principal JSON format.\nThe shared conformance fixture is:\n\n```text\npackages/core/tests/conformance/principal/basic/principal.json\n```\n\nFor the same principal, both languages must produce:\n\n```json\n{\"claims\":{\"org\":\"org_demo\",\"roles\":[\"developer\",\"operator\"]},\"id\":\"principal_user_01\",\"kind\":\"user\"}\n```\n\n## Development\n\n```sh\npnpm install --frozen-lockfile\npnpm verify\npnpm build\nnpm pack --dry-run\n```\n","readmeFilename":"README.md","_rev":"1-28e5b5db03d88f84ff5fad8df76dacac"}