{"_id":"@a3s-lab/sentry","_rev":"3-a17cd53db2b83f68b0d9ecc83b964808","name":"@a3s-lab/sentry","dist-tags":{"latest":"0.3.0"},"versions":{"0.1.0":{"name":"@a3s-lab/sentry","version":"0.1.0","license":"MIT","_id":"@a3s-lab/sentry@0.1.0","maintainers":[{"name":"linzhixiao","email":"18770221825@163.com"}],"homepage":"https://github.com/A3S-Lab/Sentry#readme","bugs":{"url":"https://github.com/A3S-Lab/Sentry/issues"},"dist":{"shasum":"8c947a97c5b5bbba903945ed4db487e81a068124","tarball":"https://registry.npmjs.org/@a3s-lab/sentry/-/sentry-0.1.0.tgz","fileCount":7,"integrity":"sha512-eKrPGuzbRpoY8JD/cm95JasBwCCRJocU1prKzQ79UNsPoj6kgdufq6IbGp6hK2VRjLpfAAQvvSmxZ94F3rzteg==","signatures":[{"sig":"MEUCIQCuDYDvKCgFr494PeIbH4Y3QXIokfTGy2E69PWWpFF6kAIgamH1riTCsg4buzqN38s0lk92V8PuFDiEhVYTTR7WgiY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":13736479},"main":"index.js","napi":{"name":"a3s-sentry","triples":{"defaults":false,"additional":["x86_64-unknown-linux-gnu","aarch64-apple-darwin","x86_64-pc-windows-msvc"]}},"types":"index.d.ts","engines":{"node":">=12"},"gitHead":"b766847383445baebdff89a520a4b53a22ed3f1d","scripts":{"soak":"node --expose-gc soak.mjs","test":"node --test test/sdk.test.mjs","build":"napi build --platform --release","coverage":"bash coverage.sh","build:debug":"napi build --platform"},"_npmUser":{"name":"linzhixiao","email":"18770221825@163.com"},"repository":{"url":"git+https://github.com/A3S-Lab/Sentry.git","type":"git"},"_npmVersion":"10.8.2","description":"Native (in-process) SDK for a3s-sentry — judge observer events through the embedded L1/L2/L3 pipeline.","directories":{},"_nodeVersion":"20.20.2","_hasShrinkwrap":false,"devDependencies":{"@napi-rs/cli":"^2"},"_npmOperationalInternal":{"tmp":"tmp/sentry_0.1.0_1782381128698_0.3600649510423859","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@a3s-lab/sentry","version":"0.2.0","license":"MIT","_id":"@a3s-lab/sentry@0.2.0","maintainers":[{"name":"linzhixiao","email":"18770221825@163.com"}],"homepage":"https://github.com/A3S-Lab/Sentry#readme","bugs":{"url":"https://github.com/A3S-Lab/Sentry/issues"},"dist":{"shasum":"793a5b770b70dc143854db048af623bc933e667a","tarball":"https://registry.npmjs.org/@a3s-lab/sentry/-/sentry-0.2.0.tgz","fileCount":7,"integrity":"sha512-+rzJKnmRPB9HIldLPIaUYhoo8snzaLayRKVuAoiXw1GMxyqF2ncM5vqwL37HkdnlvgDADwmbII1Z9mnnXhC4ig==","signatures":[{"sig":"MEYCIQCO1OssI+C3GWtXlGgTvsBWMZW1tkzseVbW49rBM2XcFAIhAMym+Qd21mMRSkqdmg6BEJPFn8yKONRBfAVnPadjOW/4","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":14109419},"main":"index.js","napi":{"name":"a3s-sentry","triples":{"defaults":false,"additional":["x86_64-unknown-linux-gnu","aarch64-apple-darwin","x86_64-pc-windows-msvc"]}},"types":"index.d.ts","engines":{"node":">=12"},"gitHead":"c1b45120662224fe1f3065d6888da0d291b4ff07","scripts":{"soak":"node --expose-gc soak.mjs","test":"node --test test/sdk.test.mjs","build":"napi build --platform --release","coverage":"bash coverage.sh","build:debug":"napi build --platform"},"_npmUser":{"name":"linzhixiao","email":"18770221825@163.com"},"repository":{"url":"git+https://github.com/A3S-Lab/Sentry.git","type":"git"},"_npmVersion":"10.8.2","description":"Native (in-process) SDK for a3s-sentry — judge observer events through the embedded L1/L2/L3 pipeline.","directories":{},"_nodeVersion":"20.20.2","_hasShrinkwrap":false,"devDependencies":{"@napi-rs/cli":"^2"},"_npmOperationalInternal":{"tmp":"tmp/sentry_0.2.0_1784606263684_0.03362325007140887","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@a3s-lab/sentry","version":"0.3.0","description":"Native (in-process) SDK for a3s-sentry — judge observer events through the embedded L1/L2/L3 pipeline.","license":"MIT","repository":{"type":"git","url":"git+https://github.com/A3S-Lab/Sentry.git"},"main":"index.js","types":"index.d.ts","napi":{"name":"a3s-sentry","triples":{"defaults":false,"additional":["x86_64-unknown-linux-gnu","aarch64-apple-darwin","x86_64-pc-windows-msvc"]}},"engines":{"node":">=12"},"scripts":{"build":"napi build --platform --release","build:debug":"napi build --platform","test":"node --test test/sdk.test.mjs","soak":"node --expose-gc soak.mjs","coverage":"bash coverage.sh"},"devDependencies":{"@napi-rs/cli":"^2"},"_id":"@a3s-lab/sentry@0.3.0","gitHead":"5f6ba19d4396d757b90c03cc92d1917264a2f968","bugs":{"url":"https://github.com/A3S-Lab/Sentry/issues"},"homepage":"https://github.com/A3S-Lab/Sentry#readme","_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-R++fkHdtW6coTsYqUugsy3hF10pOzpklFZ65NExOFRwnoeiqxEtguVBHVaUiXWugkvV3JOqSPoNs1uVUYJU5pg==","shasum":"63ea071bc8549cc1ae8ef2af3a91ca44b58bf1c6","tarball":"https://registry.npmjs.org/@a3s-lab/sentry/-/sentry-0.3.0.tgz","fileCount":7,"unpackedSize":14122774,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIA/LmsEVwyGowCaQeu0jbjrzVZka9wwb9Lg6QVzaWRsVAiAfTevi25mTF2soouW/BrjUopjm9C+RD8J7AOl3Y4Ns6g=="}]},"_npmUser":{"name":"linzhixiao","email":"18770221825@163.com"},"directories":{},"maintainers":[{"name":"linzhixiao","email":"18770221825@163.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sentry_0.3.0_1785814107883_0.356935473067834"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-25T09:52:08.497Z","modified":"2026-08-04T03:28:28.334Z","0.1.0":"2026-06-25T09:52:08.976Z","0.2.0":"2026-07-21T03:57:43.965Z","0.3.0":"2026-08-04T03:28:28.128Z"},"bugs":{"url":"https://github.com/A3S-Lab/Sentry/issues"},"license":"MIT","homepage":"https://github.com/A3S-Lab/Sentry#readme","repository":{"type":"git","url":"git+https://github.com/A3S-Lab/Sentry.git"},"description":"Native (in-process) SDK for a3s-sentry — judge observer events through the embedded L1/L2/L3 pipeline.","maintainers":[{"name":"linzhixiao","email":"18770221825@163.com"}],"readme":"# @a3s-lab/sentry — TypeScript SDK\n\nA **native, in-process** SDK for [a3s-sentry](../../) — the Rust L1/L2/L3 judge embedded via\n[napi-rs](https://napi.rs), the same model as [`@a3s-lab/code`](https://github.com/A3S-Lab/Code). You\nbuild the judge from one ACL config and evaluate observer events in-process — no daemon, no\nsubprocess (beyond what L3 itself spawns).\n\n```bash\nnpm install @a3s-lab/sentry\n```\n\n## Configure (one ACL file) + judge\n\n```ts\nimport { Sentry, egress, toolExec } from \"@a3s-lab/sentry\";\n\n// `create` takes an ACL config file path or ACL content.\nconst sentry = Sentry.create(\"sentry.acl\");\n\nconst d = sentry.evaluate(egress(1, \"169.254.169.254\", 80)); // cloud-metadata SSRF\nif (d?.verdict === \"block\") {\n  console.log(d.reason, d.action); // -> \"...\", { kind: \"DenyEgress\", target: \"169.254.169.254\" }\n}\n\n// judge AND write the deny-file the kernel guards read:\nconst r = sentry.evaluateAndEnforce(toolExec(2, [\"/usr/bin/ncat\", \"host\", \"4444\"]));\nconsole.log(r?.decision.verdict, r?.enforced); // \"block\", \"/path/exec.txt\"\n\n// Stop after L1. Escalation remains explicit and no L2/L3 backend is contacted.\nconst l1 = sentry.evaluateL1(fileAccess(3, \"/home/u/.aws/credentials\", false));\nif (l1?.nextTierEligible) {\n  console.log(l1.l1Decision, l1.stageStatus, l1.stopReason);\n}\n\n// Stop after L2 and preserve an unresolved escalation for a durable external L3 worker. This runs\n// on the napi worker pool, so a slow L2 request does not block Node's event loop.\nconst fast = await sentry.evaluateThroughL2(toolExec(4, [\"bash\", \"-c\", \"base64 -d | sh\"]));\nif (fast?.nextTierEligible) {\n  console.log(fast.escalationCause, fast.effectiveDecision);\n}\n```\n\nA `sentry.acl` carries everything (see [`config.rs`](../../src/config.rs) for the schema):\n\n```hcl\nfail_closed = false\nspeculate   = \"high\"\nllm   { url = \"http://llm:18051/v1\", model = \"glm\", timeout_s = 30 }   # L2 (optional)\nagent { bin = \"a3s-code\", skills = \"./skills\" }                        # L3 (optional)\ndeny  { egress = \"egress.txt\", exec = \"exec.txt\" }                     # sinks (optional)\nrules = [\n  { name = \"no-netcat\", on = \"ToolExec\", match = \"(?i)\\\\bnetcat\\\\b\",\n    verdict = \"block\", severity = \"medium\", reason = \"netcat\", action = \"deny-exec\" },\n]\n```\n\nEvent builders: `toolExec`, `egress`, `fileAccess`, `dns`, `sslContent`, `securityAction` — each\nreturns the observer event JSON `evaluate` takes. `evaluate` returns `null` for an unparseable event,\nand a `Decision` (`{ verdict, tier, severity, reason, action? }`) otherwise — including `allow`.\n\n`evaluateL1` returns `l1Decision`, `stageStatus`, `nextTierEligible`, and `stopReason`. It never\ninvokes L2/L3 and never resolves escalation through `fail_closed`.\n\n`evaluateThroughL2` returns a promise containing `l1Decision`, optional `l2Decision`,\n`effectiveDecision`, `stageStatus`, optional `escalationCause`, `nextTierEligible`, and\n`stopReason`. It never invokes L3, never resolves an outstanding escalation through `fail_closed`,\nand ignores speculative L3 settings.\n\n## Build / test (from source)\n\n```bash\nnpm install\nnpm run build:debug     # napi build → index.js + index.d.ts + a3s-sentry.<platform>.node\nnpm test\n```\n\nRequires a Rust toolchain (it compiles the embedded judge). The published package ships the prebuilt\nnative binary per platform, so consumers need only `npm install`.\n","readmeFilename":"README.md"}