{"_id":"@autotune-ai/hook","_rev":"10-4bd8de6282d58882e803e71042db18c3","name":"@autotune-ai/hook","dist-tags":{"latest":"0.8.0"},"versions":{"0.2.0":{"name":"@autotune-ai/hook","version":"0.2.0","keywords":["autotune","llm","observability","instrumentation","openrouter","openai","anthropic","prompt-optimization"],"author":{"name":"Autotune"},"license":"SEE LICENSE IN LICENSE","_id":"@autotune-ai/hook@0.2.0","maintainers":[{"name":"poppro","email":"poppro21@gmail.com"}],"homepage":"https://github.com/shellzbt/sota-autotune/tree/main/packages/hook#readme","bugs":{"url":"https://github.com/shellzbt/sota-autotune/issues"},"bin":{"autotune-hook":"bin/autotune-hook.mjs"},"dist":{"shasum":"8720df4e2ee2d55072ccaa954292d0c8b5ef429f","tarball":"https://registry.npmjs.org/@autotune-ai/hook/-/hook-0.2.0.tgz","fileCount":8,"integrity":"sha512-TFtFYJmVdg2dZcVKYDx0JlyWPbDz3O9vvcVAEyIYlNKIDqoxvrtnpMdMrCYKX7SkZSu9yEPK2M8MJ5tPtIMRPA==","signatures":[{"sig":"MEUCIFFJr/5dv6tpVJQES17wtOFnOgIIy2fVpyVvs1xMuuX8AiEAmrXX1Qd63KJYfaO8FD5kY7ItdDROwlnamJ1WyaXMhEI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":37377},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20.6"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./register":{"types":"./dist/register.d.ts","default":"./dist/register.js"},"./package.json":"./package.json"},"gitHead":"857cd15fcdd6af22e24d8294ff6f500d110ff20d","scripts":{"test":"tsc -p tsconfig.json && tsx test/hook-smoke.ts && tsx test/cli-smoke.ts","build":"rm -rf dist && tsc -p tsconfig.build.json","prepack":"npm run build","typecheck":"tsc -p tsconfig.json"},"_npmUser":{"name":"poppro","email":"poppro21@gmail.com"},"repository":{"url":"git+https://github.com/shellzbt/sota-autotune.git","type":"git","directory":"packages/hook"},"_npmVersion":"10.9.2","description":"Auto Tune instrumentation for Node apps: intercept or decorate provider fetch calls, attribute sessions, and honor cloud workflow policy.","directories":{},"_nodeVersion":"23.11.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","typescript":"^5.7.2","@types/node":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/hook_0.2.0_1783640607084_0.08711526118457624","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@autotune-ai/hook","version":"0.3.0","keywords":["autotune","llm","observability","instrumentation","openrouter","openai","anthropic","prompt-optimization"],"author":{"name":"Autotune"},"license":"SEE LICENSE IN LICENSE","_id":"@autotune-ai/hook@0.3.0","maintainers":[{"name":"poppro","email":"poppro21@gmail.com"}],"homepage":"https://github.com/shellzbt/sota-autotune/tree/main/packages/hook#readme","bugs":{"url":"https://github.com/shellzbt/sota-autotune/issues"},"bin":{"autotune-hook":"bin/autotune-hook.mjs"},"dist":{"shasum":"9fb139754b16c10d96392aefb9779bd979a57fd2","tarball":"https://registry.npmjs.org/@autotune-ai/hook/-/hook-0.3.0.tgz","fileCount":8,"integrity":"sha512-B5l7NnIx6EE0BDKkd/IvGJu1iJnzAhi83bdmAjM/RllKNehANlf5aZlS7YC1SiUZWlmxrvRxZVDrgCaQWgMUfA==","signatures":[{"sig":"MEUCICLlrPR8K0YtosWtWuzz5kTai69toIlhidakoxY9IQkwAiEAydwltHCgYdGPVI4hBkqgsLVJ3cJsTW6n4YDVk3ZnWcg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":41725},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20.6"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./register":{"types":"./dist/register.d.ts","default":"./dist/register.js"},"./package.json":"./package.json"},"gitHead":"93f683494cc4cd6563de9288ebc8e1585a207a8a","scripts":{"test":"tsc -p tsconfig.json && tsx test/hook-smoke.ts && tsx test/cli-smoke.ts","build":"rm -rf dist && tsc -p tsconfig.build.json","prepack":"npm run build","typecheck":"tsc -p tsconfig.json"},"_npmUser":{"name":"poppro","email":"poppro21@gmail.com"},"repository":{"url":"git+https://github.com/shellzbt/sota-autotune.git","type":"git","directory":"packages/hook"},"_npmVersion":"10.9.2","description":"Auto Tune instrumentation for Node apps: intercept or decorate provider fetch calls, attribute sessions, and honor cloud workflow policy.","directories":{},"_nodeVersion":"23.11.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","typescript":"^5.7.2","@types/node":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/hook_0.3.0_1783642466197_0.3500527301762737","host":"s3://npm-registry-packages-npm-production"}},"0.3.1":{"name":"@autotune-ai/hook","version":"0.3.1","keywords":["autotune","llm","observability","instrumentation","openrouter","openai","anthropic","prompt-optimization"],"author":{"name":"Autotune"},"license":"SEE LICENSE IN LICENSE","_id":"@autotune-ai/hook@0.3.1","maintainers":[{"name":"poppro","email":"poppro21@gmail.com"}],"homepage":"https://github.com/shellzbt/sota-autotune/tree/main/packages/hook#readme","bugs":{"url":"https://github.com/shellzbt/sota-autotune/issues"},"bin":{"autotune-hook":"bin/autotune-hook.mjs"},"dist":{"shasum":"782fac40685235f759a31edc27ad0eb12d41752d","tarball":"https://registry.npmjs.org/@autotune-ai/hook/-/hook-0.3.1.tgz","fileCount":8,"integrity":"sha512-k/GrVbIc08NHiK9ebJ/zJeY9lfEuLi+QKKKi8sCb0/HYbeMF9Hf7538jMbp0vR/sVQySVAAde6yZWt97bV9pSA==","signatures":[{"sig":"MEUCIQCWK3ky/tyn2OxnNlDGFDrm2wOIxh9oHgLhxxQ1VFSswwIgWoo5KFO7ASu1Qjgkj3e/4VWHQluk44OAoy7NUNUerFs=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":42224},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20.6"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./register":{"types":"./dist/register.d.ts","default":"./dist/register.js"},"./package.json":"./package.json"},"gitHead":"93f683494cc4cd6563de9288ebc8e1585a207a8a","scripts":{"test":"tsc -p tsconfig.json && tsx test/hook-smoke.ts && tsx test/cli-smoke.ts","build":"rm -rf dist && tsc -p tsconfig.build.json","prepack":"npm run build","typecheck":"tsc -p tsconfig.json"},"_npmUser":{"name":"poppro","email":"poppro21@gmail.com"},"repository":{"url":"git+https://github.com/shellzbt/sota-autotune.git","type":"git","directory":"packages/hook"},"_npmVersion":"10.9.2","description":"Auto Tune instrumentation for Node apps: intercept or decorate provider fetch calls, attribute sessions, and honor cloud workflow policy.","directories":{},"_nodeVersion":"23.11.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","typescript":"^5.7.2","@types/node":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/hook_0.3.1_1783643772990_0.42873723252244433","host":"s3://npm-registry-packages-npm-production"}},"0.3.2":{"name":"@autotune-ai/hook","version":"0.3.2","keywords":["autotune","llm","observability","instrumentation","openrouter","openai","anthropic","prompt-optimization"],"author":{"name":"Autotune"},"license":"SEE LICENSE IN LICENSE","_id":"@autotune-ai/hook@0.3.2","maintainers":[{"name":"poppro","email":"poppro21@gmail.com"}],"homepage":"https://github.com/shellzbt/sota-autotune/tree/main/packages/hook#readme","bugs":{"url":"https://github.com/shellzbt/sota-autotune/issues"},"bin":{"autotune-hook":"bin/autotune-hook.mjs"},"dist":{"shasum":"1db2d2a0c19f5512a44217bdc55d2495cba0c418","tarball":"https://registry.npmjs.org/@autotune-ai/hook/-/hook-0.3.2.tgz","fileCount":8,"integrity":"sha512-1mWP4pyy8GcP2Q3lqC0aAAw3YrvxZxn99brTBzCSGgpTtlFbRwXOROv8N56rE3tmaOX1JIg7UMG+z8kphI/EmQ==","signatures":[{"sig":"MEQCIAUYpHcNCVRVPe/SVS01iZUcjIdJgEiIJl+m7DwQbf1lAiAvXk7pjLdZNlph4Driny48s8UqCq/Va5SCMmfmZl8H9Q==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":44867},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20.6"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./register":{"types":"./dist/register.d.ts","default":"./dist/register.js"},"./package.json":"./package.json"},"gitHead":"93f683494cc4cd6563de9288ebc8e1585a207a8a","scripts":{"test":"tsc -p tsconfig.json && tsx test/hook-smoke.ts && tsx test/cli-smoke.ts","build":"rm -rf dist && tsc -p tsconfig.build.json","prepack":"npm run build","typecheck":"tsc -p tsconfig.json"},"_npmUser":{"name":"poppro","email":"poppro21@gmail.com"},"repository":{"url":"git+https://github.com/shellzbt/sota-autotune.git","type":"git","directory":"packages/hook"},"_npmVersion":"10.9.2","description":"Auto Tune instrumentation for Node apps: intercept or decorate provider fetch calls, attribute sessions, and honor cloud workflow policy.","directories":{},"_nodeVersion":"23.11.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","typescript":"^5.7.2","@types/node":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/hook_0.3.2_1783644233262_0.37601835689038365","host":"s3://npm-registry-packages-npm-production"}},"0.4.0":{"name":"@autotune-ai/hook","version":"0.4.0","keywords":["autotune","llm","observability","instrumentation","openrouter","openai","anthropic","prompt-optimization"],"author":{"name":"Autotune"},"license":"SEE LICENSE IN LICENSE","_id":"@autotune-ai/hook@0.4.0","maintainers":[{"name":"poppro","email":"poppro21@gmail.com"}],"homepage":"https://github.com/shellzbt/sota-autotune/tree/main/packages/hook#readme","bugs":{"url":"https://github.com/shellzbt/sota-autotune/issues"},"bin":{"autotune-hook":"bin/autotune-hook.mjs"},"dist":{"shasum":"ce7bcab9f83db90a036469606a24b7e2703a6bd3","tarball":"https://registry.npmjs.org/@autotune-ai/hook/-/hook-0.4.0.tgz","fileCount":8,"integrity":"sha512-DMfek6wwsc5jF2St7ttHdr/Un77Hfk8+FLyt8T4ynpHdGFO52VSzYtBlYWuZ/hFtdexskySRUGhmNbqMTZ5ebw==","signatures":[{"sig":"MEUCIQCeDMkfToRHsLu186z7nmUzgLn8DOjVvm3cTPTB0GT1kQIgaJ2FqNHuF+r0ZNPwUeRKxoielSIP9JGarC1l/xGBtDU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":46599},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20.6"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./register":{"types":"./dist/register.d.ts","default":"./dist/register.js"},"./package.json":"./package.json"},"gitHead":"93f683494cc4cd6563de9288ebc8e1585a207a8a","scripts":{"test":"tsc -p tsconfig.json && tsx test/hook-smoke.ts && tsx test/cli-smoke.ts","build":"rm -rf dist && tsc -p tsconfig.build.json","prepack":"npm run build","typecheck":"tsc -p tsconfig.json"},"_npmUser":{"name":"poppro","email":"poppro21@gmail.com"},"repository":{"url":"git+https://github.com/shellzbt/sota-autotune.git","type":"git","directory":"packages/hook"},"_npmVersion":"10.9.2","description":"Auto Tune instrumentation for Node apps: intercept or decorate provider fetch calls, attribute sessions, and honor cloud workflow policy.","directories":{},"_nodeVersion":"23.11.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","typescript":"^5.7.2","@types/node":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/hook_0.4.0_1783644628171_0.3102084212973646","host":"s3://npm-registry-packages-npm-production"}},"0.5.0":{"name":"@autotune-ai/hook","version":"0.5.0","keywords":["autotune","llm","observability","instrumentation","openrouter","openai","anthropic","prompt-optimization"],"author":{"name":"Autotune"},"license":"SEE LICENSE IN LICENSE","_id":"@autotune-ai/hook@0.5.0","maintainers":[{"name":"poppro","email":"poppro21@gmail.com"}],"homepage":"https://github.com/shellzbt/sota-autotune/tree/main/packages/hook#readme","bugs":{"url":"https://github.com/shellzbt/sota-autotune/issues"},"bin":{"autotune-hook":"bin/autotune-hook.mjs"},"dist":{"shasum":"619556bb949b80dddd776d243f3b32f9016304f9","tarball":"https://registry.npmjs.org/@autotune-ai/hook/-/hook-0.5.0.tgz","fileCount":8,"integrity":"sha512-NRJLqnrzVahdQzCBAgeASUK+OS3AEZHxs5jxaNWk6cGk0sW3n2y/DYNd/8gSvIbZacdw+d2kuhIcsQhpQdfEFA==","signatures":[{"sig":"MEUCIQCnVGHntt2vfwT99QIbwzOoqTFuU4YMIOCi7QfV3L99YAIgIFsFXeRBVXQbS5gGVEb2fx+PothAJ3iNszewQKKG/8M=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":50203},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20.6"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./register":{"types":"./dist/register.d.ts","default":"./dist/register.js"},"./package.json":"./package.json"},"gitHead":"8a3cd07cb28e15db9d4b63615d84dcb84893efbd","scripts":{"test":"tsc -p tsconfig.json && tsx test/hook-smoke.ts && tsx test/cli-smoke.ts","build":"rm -rf dist && tsc -p tsconfig.build.json","prepack":"npm run build","typecheck":"tsc -p tsconfig.json"},"_npmUser":{"name":"poppro","email":"poppro21@gmail.com"},"repository":{"url":"git+https://github.com/shellzbt/sota-autotune.git","type":"git","directory":"packages/hook"},"_npmVersion":"10.9.2","description":"Auto Tune instrumentation for Node apps: intercept or decorate provider fetch calls, attribute sessions, and honor cloud workflow policy.","directories":{},"_nodeVersion":"23.11.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","typescript":"^5.7.2","@types/node":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/hook_0.5.0_1783645471228_0.2593064875990061","host":"s3://npm-registry-packages-npm-production"}},"0.6.0":{"name":"@autotune-ai/hook","version":"0.6.0","keywords":["autotune","llm","observability","instrumentation","openrouter","openai","anthropic","prompt-optimization"],"author":{"name":"Autotune"},"license":"SEE LICENSE IN LICENSE","_id":"@autotune-ai/hook@0.6.0","maintainers":[{"name":"poppro","email":"poppro21@gmail.com"}],"homepage":"https://github.com/shellzbt/sota-autotune/tree/main/packages/hook#readme","bugs":{"url":"https://github.com/shellzbt/sota-autotune/issues"},"bin":{"autotune-hook":"bin/autotune-hook.mjs"},"dist":{"shasum":"642a9ead57a59c2bd3f1d053848f88862ffd1bc0","tarball":"https://registry.npmjs.org/@autotune-ai/hook/-/hook-0.6.0.tgz","fileCount":8,"integrity":"sha512-kAt0bLbuiXdMwoScUDfBrUiZUc/IIUaQ6hP2xmpQ4R9Fjp7VQETQGj283yHEkQwZdsgq6grIzp7QXCdZbBnOTQ==","signatures":[{"sig":"MEYCIQCUee+r2mlGtQ1YRlUuQrXDij05JMTPGlIOypa+wemLygIhAPStbDznfw+91wY2Apt2MX3zFNBDDJAhPQ3zVgiai3ud","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":51688},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20.6"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./register":{"types":"./dist/register.d.ts","default":"./dist/register.js"},"./package.json":"./package.json"},"gitHead":"3eb9593503312806760f7cd57a84c5d49b871a9a","scripts":{"test":"tsc -p tsconfig.json && tsx test/hook-smoke.ts && tsx test/cli-smoke.ts","build":"rm -rf dist && tsc -p tsconfig.build.json","prepack":"npm run build","typecheck":"tsc -p tsconfig.json"},"_npmUser":{"name":"poppro","email":"poppro21@gmail.com"},"repository":{"url":"git+https://github.com/shellzbt/sota-autotune.git","type":"git","directory":"packages/hook"},"_npmVersion":"10.9.2","description":"Auto Tune instrumentation for Node apps: intercept or decorate provider fetch calls, attribute sessions, and honor cloud workflow policy.","directories":{},"_nodeVersion":"23.11.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","typescript":"^5.7.2","@types/node":"^24.0.0"},"_npmOperationalInternal":{"tmp":"tmp/hook_0.6.0_1783647093181_0.9624051329484284","host":"s3://npm-registry-packages-npm-production"}},"0.7.0":{"name":"@autotune-ai/hook","version":"0.7.0","keywords":["autotune","llm","observability","instrumentation","openrouter","openai","anthropic","prompt-optimization"],"author":{"name":"Autotune"},"license":"SEE LICENSE IN LICENSE","_id":"@autotune-ai/hook@0.7.0","maintainers":[{"name":"poppro","email":"poppro21@gmail.com"}],"homepage":"https://github.com/shellzbt/sota-autotune/tree/main/packages/hook#readme","bugs":{"url":"https://github.com/shellzbt/sota-autotune/issues"},"bin":{"autotune-hook":"bin/autotune-hook.mjs"},"dist":{"shasum":"8db2f29b129cdbe54fb7c93cb27b3f37c35b0776","tarball":"https://registry.npmjs.org/@autotune-ai/hook/-/hook-0.7.0.tgz","fileCount":44,"integrity":"sha512-dKK3yfiH2Ba3yUsywXlbQmVclvRApl3E7yJpEjPPMDJAV5oo4VZSJjn5EyHRZQFlCUeePvVtFiYhJXn49OgWFg==","signatures":[{"sig":"MEUCIQCH2d54AWBWVuyOO5Q1KTNB45YMlNi4jvY+/f086Ox5mgIgQRgo1QnB9ZLmXaYb1s5UPgewPe78MXH8/T/9PFEa5gg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":87245},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20.6"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./register":{"types":"./dist/register.d.ts","default":"./dist/register.js"},"./package.json":"./package.json"},"gitHead":"292b1b45c9a73c057ebd853e7a29505c49376750","scripts":{"test":"npm run typecheck && npm run test:unit && npm run test:integration","build":"rm -rf dist && tsc -p tsconfig.build.json","prepack":"npm run build","test:unit":"tsx test/sdk-unit.ts && tsx test/ai-sdk-smoke.ts && tsx test/cli-smoke.ts","typecheck":"tsc -p tsconfig.json","test:integration":"tsx ../../apps/server/tests/run-with-postgres.ts test/hook-smoke.ts"},"_npmUser":{"name":"poppro","email":"poppro21@gmail.com"},"repository":{"url":"git+https://github.com/shellzbt/sota-autotune.git","type":"git","directory":"packages/hook"},"_npmVersion":"10.9.2","description":"Auto Tune instrumentation for Node apps: intercept or decorate provider fetch calls, attribute sessions, and honor cloud workflow policy.","directories":{},"_nodeVersion":"23.11.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"ai":"^7.0.52","tsx":"^4.19.2","typescript":"^5.7.2","@types/node":"^24.0.0","@openrouter/ai-sdk-provider":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/hook_0.7.0_1785896149574_0.591269003278071","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Cut mid-stream: ships a proxy-mode door timeout bug and lacks the Anthropic/completions capture surfaces. Use 0.8.0."},"0.8.0":{"name":"@autotune-ai/hook","version":"0.8.0","keywords":["autotune","llm","observability","instrumentation","openrouter","openai","anthropic","prompt-optimization"],"author":{"name":"Autotune"},"license":"SEE LICENSE IN LICENSE","_id":"@autotune-ai/hook@0.8.0","maintainers":[{"name":"poppro","email":"poppro21@gmail.com"}],"homepage":"https://github.com/shellzbt/sota-autotune/tree/main/packages/hook#readme","bugs":{"url":"https://github.com/shellzbt/sota-autotune/issues"},"bin":{"autotune-hook":"bin/autotune-hook.mjs"},"dist":{"shasum":"f48008ccb67cb4107e4bee06467a1fd88e49b308","tarball":"https://registry.npmjs.org/@autotune-ai/hook/-/hook-0.8.0.tgz","fileCount":54,"integrity":"sha512-WAlOR1xpbh1e3iY5cl0jcu7LuM0MMJ02XwCSe6ZK9Uu+6252reyRYgHW6vEfHC+TdYObRvh3W2/EtwmDUq6I0A==","signatures":[{"sig":"MEQCIEZQC/31b+63gN4SXYMfAI21LQr3MMzhczqhGu+zMTChAiBk+Ts6luM2gIUbPBGw8SXKqPoxXZOtKmdzlEDV3VwIig==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":129286},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20.6"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./register":{"types":"./dist/register.d.ts","default":"./dist/register.js"},"./package.json":"./package.json"},"gitHead":"2c35991489b2d2be1a3b7a1ef577a9526eda0ba9","scripts":{"test":"npm run typecheck && npm run test:unit && npm run test:integration","build":"rm -rf dist && tsc -p tsconfig.build.json","prepack":"npm run build","test:live":"tsx test/live-ai-sdk.ts","test:unit":"tsx test/sdk-unit.ts && tsx test/ai-sdk-smoke.ts && tsx test/cli-smoke.ts","typecheck":"tsc -p tsconfig.json","test:integration":"tsx ../../apps/server/tests/run-with-postgres.ts test/hook-smoke.ts"},"_npmUser":{"name":"poppro","email":"poppro21@gmail.com"},"repository":{"url":"git+https://github.com/shellzbt/sota-autotune.git","type":"git","directory":"packages/hook"},"_npmVersion":"11.16.0","description":"Auto Tune instrumentation for Node apps: intercept or decorate provider fetch calls, attribute sessions, and honor cloud workflow policy.","directories":{},"_nodeVersion":"24.18.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"ai":"^7.0.52","tsx":"^4.19.2","typescript":"^5.7.2","@types/node":"^24.0.0","@ai-sdk/anthropic":"^4.0.30","@openrouter/ai-sdk-provider":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/hook_0.8.0_1785901228743_0.12965555722901567","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2026-07-09T23:43:26.945Z","modified":"2026-08-05T03:41:23.972Z","0.2.0":"2026-07-09T23:43:27.238Z","0.3.0":"2026-07-10T00:14:26.380Z","0.3.1":"2026-07-10T00:36:13.137Z","0.3.2":"2026-07-10T00:43:53.414Z","0.4.0":"2026-07-10T00:50:28.310Z","0.5.0":"2026-07-10T01:04:31.357Z","0.6.0":"2026-07-10T01:31:33.328Z","0.7.0":"2026-08-05T02:15:49.734Z","0.8.0":"2026-08-05T03:40:28.964Z"},"bugs":{"url":"https://github.com/shellzbt/sota-autotune/issues"},"author":{"name":"Autotune"},"license":"SEE LICENSE IN LICENSE","homepage":"https://github.com/shellzbt/sota-autotune/tree/main/packages/hook#readme","keywords":["autotune","llm","observability","instrumentation","openrouter","openai","anthropic","prompt-optimization"],"repository":{"url":"git+https://github.com/shellzbt/sota-autotune.git","type":"git","directory":"packages/hook"},"description":"Auto Tune instrumentation for Node apps: intercept or decorate provider fetch calls, attribute sessions, and honor cloud workflow policy.","maintainers":[{"name":"poppro","email":"poppro21@gmail.com"}],"readme":"# Autotune Hook\n\nNode and Bun instrumentation for reporting LLM calls to Auto Tune. One line\nin your entrypoint (or one run-script flag) makes the process's OpenRouter\nchat completions and Anthropic SDK messages visible to Auto Tune, with no\nchanges to call sites. By default the hook is a passive tee (observe mode):\nprovider calls run exactly as the app wrote them — Anthropic calls are\ntranslated client-side into the canonical chat-completion shape — and their\noutcomes report in the background. Setting `AUTOTUNE_HOOK_MODE=proxy` hands\nexecution to cloud workflow policy (shadow or proxy per workflow) and\nroutes Anthropic SDK messages through Auto Tune's Anthropic-wire door,\nwhich executes the provider call and records the run.\n\n## Install\n\n```bash\nnpm install @autotune-ai/hook\n```\n\nOr let the installer write your `.env`, gitignore it, and add the\ndependency in one step:\n\n```bash\nnpx @autotune-ai/hook init --endpoint https://autotune.yourco.com --api-key at_...\n```\n\n## Activate\n\nOne-time setup per service. This preload, plus one `withSession()` wrapper\nper workflow (next section), is the preferred setup for onboarding\nworkflows onto Auto Tune.\n\nOne of:\n\n```ts\n// a) First import of your entrypoint (recommended; works with Node and Bun):\nimport \"@autotune-ai/hook/register\";\n```\n\n```jsonc\n// b) Node run script only, no code changes (package.json):\n{ \"start\": \"NODE_OPTIONS=\\\"--import @autotune-ai/hook/register\\\" node dist/index.js\" }\n```\n\n```jsonc\n// c) Bun run script only, no code changes (package.json):\n{ \"start\": \"bun --preload @autotune-ai/hook/register src/index.ts\" }\n```\n\nBun's `--preload` flag imports the register module before the application\nentrypoint. The first-import option remains the most portable choice when the\nsame service runs under multiple runtimes or bundlers.\n\nThe register entry loads `AUTOTUNE_*` keys from `.env` / `.env.local`\n(never overriding real environment variables), then patches\n`globalThis.fetch` when `AUTOTUNE_ENDPOINT` is set. If the endpoint is\nunset, the hook stays fully out of the way.\n\n## Onboard a workflow (preferred)\n\nWith the preload active, onboarding a workflow is one wrapper at its\nboundary. No client construction changes, no per-call plumbing, no provider\nswitches: every provider call inside (including nested async work) is\nrecorded under the workflow name.\n\n```ts\nimport { withSession } from \"@autotune-ai/hook\";\n\nexport async function triageEmail(input: Email) {\n  return withSession(\n    { project: \"billing\", workflow: \"email-triage\", sessionId: input.threadId, userId: input.userId },\n    () => triageEmailInner(input),\n  );\n}\n```\n\nThis is what production integrations should look like: one preload line per\nservice, one `withSession()` per workflow. The decoration API below is an\nescape hatch for processes that must keep global interception off.\n\nBy default only onboarded calls are captured: calls inside a\n`withSession()` context, through a client decorated with attribution\noptions, or carrying `x-autotune-*` headers. Everything else goes straight\nto the provider, unobserved, so activating the preload changes nothing\nuntil a workflow is wrapped. Set `AUTOTUNE_CAPTURE_ALL=1` to widen capture\nto every supported provider call in the process (calls without any other\nattribution then get workflow names inferred from their call site).\n\n## Explicit decoration (escape hatch)\n\nFor teams that keep global interception off: `autotuneFetch()` returns an\nobserving fetch to hand to one SDK client. Nothing else in the process is\ntouched. Prefer the preload + `withSession()` setup above when you can.\n\n```ts\nimport { autotuneFetch } from \"@autotune-ai/hook\";\n\nconst openrouter = new OpenAI({\n  apiKey,\n  baseURL: \"https://openrouter.ai/api/v1\",\n  fetch: autotuneFetch({ workflow: \"email-triage\" }),\n});\n```\n\nRuntime control over the global patch: `enableInterception()`,\n`disableInterception()`, `isInterceptionEnabled()`.\n\n## Anthropic SDK\n\n`@anthropic-ai/sdk` works unchanged: with interception active **and proxy\nmode set** (`AUTOTUNE_HOOK_MODE=proxy`), every `messages.create` call to\napi.anthropic.com re-targets to the Auto Tune endpoint's `/v1/messages`\ndoor. Provider credentials never reach the wire; the Auto Tune API key\ntakes their place, and attribution rides `x-autotune-*` headers populated\nfrom `withSession()`. If Auto Tune is unreachable or answers with a\ndoor-level failure (its own auth error, a missing route, a 5xx), the app's\nown direct Anthropic call runs instead with its original credentials, and\nthe door rests for 30s before the next attempt.\n\nThe door executes calls through Auto Tune, so it only engages in proxy\nmode. Under the default observe mode, Anthropic calls pass through to the\nprovider completely untouched — original credentials, original wire format,\nstreaming included — while the hook tees the outcome, translates it\nclient-side into the canonical chat-completion shape (tool_use blocks\nbecome tool_calls, cache usage folds into prompt_tokens), and reports it in\nthe background. Runs carry a `wire_format: \"anthropic\"` metadata tag.\n\nThe preferred setup is exactly the onboarding pattern above, with a plain\nclient:\n\n```ts\nconst anthropic = new Anthropic();\n\nconst message = await withSession({ project: \"billing\", workflow: \"email-triage\" }, () =>\n  anthropic.messages.create({ model, max_tokens, messages }),\n);\n```\n\nTo observe a single client rather than the whole process (escape hatch),\ndecorate its fetch and narrow `targets`:\n\n```ts\nconst anthropic = new Anthropic({\n  fetch: autotuneFetch({ targets: [\"anthropic\"] }),\n});\n```\n\n## Vercel AI SDK\n\nThe AI SDK works unchanged on the OpenRouter surface, streaming included.\nWith the preload active, a provider pointed at OpenRouter needs no wiring\nat all — its internal fetch is the patched global:\n\n```ts\nimport { generateText, streamText } from \"ai\";\nimport { createOpenRouter } from \"@openrouter/ai-sdk-provider\";\nimport { withSession } from \"@autotune-ai/hook\";\n\nconst openrouter = createOpenRouter({ apiKey });\n\nconst { text } = await withSession(\n  { project: \"support\", workflow: \"email-triage\", sessionId: threadId },\n  () => generateText({ model: openrouter.chat(\"openai/gpt-5\"), prompt }),\n);\n```\n\n`streamText` is fully supported: the SSE stream reaches the app\nbyte-for-byte (no preflight ever sits in front of the first token) while\nthe hook tees the bytes, assembles the completed stream into a chat\ncompletion — concatenated deltas, merged tool-call fragments, final usage —\nand reports it in the background.\n\nTo observe one client instead of the whole process, hand the decorated\nfetch to the provider (every AI SDK provider accepts `fetch`):\n\n```ts\nconst openrouter = createOpenRouter({\n  apiKey,\n  fetch: autotuneFetch({ workflow: \"email-triage\" }),\n});\n```\n\n`createOpenAI({ baseURL: \"https://openrouter.ai/api/v1\", ... })` and\n`@ai-sdk/openai-compatible` pointed at OpenRouter hit the same intercepted\nendpoint and work identically. `@ai-sdk/anthropic` is captured on both\npaths: observed passively (translated client-side, streaming included) in\nthe default mode, executed and recorded by the Auto Tune door in proxy\nmode. Per-call attribution can also ride the AI SDK's `headers` option\n(`headers: { \"x-autotune-workflow\": ... }`).\n\n## Sessions\n\n`withSession()` attributes every intercepted or decorated call inside it\n(including nested async work) without threading ids through application\ncode:\n\n```ts\nimport { withSession } from \"@autotune-ai/hook\";\n\nawait withSession({ project: \"support\", workflow: \"slack-agent\", sessionId: threadId, userId }, async () => {\n  const completion = await client.chat.completions.create(...);\n});\n```\n\nThe effective session must define both `project` and `workflow`; anything\nless is under-specified and the hook warns at call time. Sessions nest\n(inner values win) and the two can stack: name the project once at the\nservice edge and the workflow at each boundary.\n\n```ts\nawait withSession({ project: \"support\" }, () =>         // service edge\n  withSession({ workflow: \"slack-agent\" }, () =>        // workflow boundary\n    handleThread(threadId)));\n```\n\n`sessionId` auto-generates (one random UUID per outermost session) when not\nsupplied; pass one to group calls under an external id, like a thread or\nTemporal run. `userId` is optional; not every workflow has an end user.\nContexts also carry `environment`.\n\nSessions can also carry custom `metadata` tags recording who or what a call\nran on behalf of. Tags merge per key across nesting, land on every run in\nthe session, and render as chips on the run in the dashboard:\n\n```ts\nawait withSession(\n  { metadata: { entity_id: entity.id, entity_type: entity.type } },\n  () => materializeProfile(entity),\n);\n```\n\nPer-call overrides can also ride request headers wherever the SDK lets you\nadd them (openai-node `headers` option): `x-autotune-workflow`,\n`x-autotune-project`, `x-autotune-environment`, `x-autotune-session-id`,\n`x-autotune-user-id`. Headers beat the session context and are stripped\nbefore the provider sees the request.\n\nWhen no workflow is attributed any other way, the hook names one from the\ncalling function (the first application frame on the stack), so the same\nfunction called repeatedly is one workflow and the identity survives prompt\nchanges. Disable with `inferWorkflow: false` or `AUTOTUNE_INFER_WORKFLOW=0`.\n\n## Execution modes\n\nTwo modes, matching the Python hook (`mode` option, or\n`AUTOTUNE_HOOK_MODE`):\n\n- **`observe`** (default). A pure tee: no preflight, no execution mode, no\n  request mutation beyond stripping `x-autotune-*` plumbing headers. The\n  app's provider behavior is untouched; every observed call (including\n  failed ones) reports in the background. This is passive collection with\n  zero blocking round trips anywhere in the request path.\n- **`proxy`** (`AUTOTUNE_HOOK_MODE=proxy`). The hook does not choose\n  execution mode. Mode is workflow policy owned by Auto Tune cloud,\n  answered by a preflight route as an explicit envelope:\n  `{\"mode\":\"shadow\",\"ttl_seconds\":N}` (execute the call locally, report\n  the outcome in the background) or `{\"mode\":\"proxy\",\"response\":{...}}`\n  (return the Auto Tune-executed response). Shadow decisions are cached\n  per workflow for the TTL, so steady-state shadow capture costs one\n  background report per call, not a blocking round trip. Anything without\n  the envelope, such as an intermediary's bare 200 or an older server,\n  falls back to the app's own provider call, so Auto Tune being\n  unreachable never blocks a model call.\n\nScope: OpenRouter chat completions (`/api/v1/chat/completions`) get the\nmode treatment above. Streaming requests (`stream: true` — the Vercel AI\nSDK's `streamText`, SDK-native streaming) are never preflighted in either\nmode: a blocking round trip would sit in front of the first token. Instead\nthey tee — the SSE bytes pass through untouched and the completed stream\nis assembled (deltas concatenated, tool-call fragments merged, final usage\nkept) into a run report in the background. Anthropic `/v1/messages` calls\n(streaming included) are captured in both modes: observe mode passes them\nthrough untouched and reports a client-side translation into the canonical\nchat-completion shape (runs carry a `wire_format: \"anthropic\"` tag); proxy\nmode executes and records them through the Auto Tune door. OpenRouter text\ncompletions (`/api/v1/completions`, streaming included) follow the same\nconvert-report contract (`wire_format: \"completions\"`); in proxy mode a\nproxied response is rendered back into the text-completion wire shape, and\nrequests using completions-only execution knobs (`suffix`, `echo`,\n`best_of`, `logprobs`, `n` > 1) are observed but never proxied, since\ntheir semantics do not survive a chat round-trip. OpenAI-host calls pass\nthrough; use the drop-in proxy base URL for those.\n\n## Fault tolerance\n\nThe hook is a sidecar: it must never fail or slow the app's own provider\ntraffic. The guarantees, on every surface:\n\n- **The hook never throws into the application.** Any failure inside hook\n  plumbing (routing, attribution, preflight, reporting) degrades to the\n  app's own unmodified provider call. The only errors a caller can see are\n  its own provider call's (which shadow observation records and re-raises\n  untouched) and its own aborts.\n- **Auto Tune-bound plumbing is hard-bounded in time.** Proxy-mode\n  preflights and shadow reports carry a timeout (default 2s,\n  `AUTOTUNE_HOOK_TIMEOUT`); a hanging Auto Tune is cut off, the provider\n  call runs, and failures are negative-cached for 30s (per workflow for\n  preflights, endpoint-wide for the door). The door itself carries the\n  app's real provider call, so its hang protection is generous by design\n  (default 600s, `AUTOTUNE_HOOK_DOOR_TIMEOUT`) — never the plumbing\n  timeout, which would abort legitimate long inference. Observe mode (the\n  default) has no blocking plumbing at all.\n- **Reports ride a bounded background queue.** Shadow reports are queued\n  (256 deep) and drained one at a time off the request path; a full queue\n  drops reports with a counted warning instead of growing memory or\n  competing with production traffic for sockets. `flushReports(timeoutMs)`\n  is the best-effort drain for worker shutdown; a `beforeExit` hook gives\n  queued reports a window to leave the process on its own.\n- **Reports are size-bounded.** Inline `data:` URLs over 256 chars are\n  replaced with a sha256 placeholder (`AUTOTUNE_HOOK_REDACT_DATA_URLS=0`\n  to disable) and reports over 4MB are dropped\n  (`AUTOTUNE_HOOK_MAX_REPORT_BYTES`). Stream tees stop buffering at the\n  same cap, and concurrent tees are bounded, so capture memory can never\n  outgrow the app's own traffic. The provider always receives the full,\n  unredacted payload.\n- **The Anthropic door fails open.** In proxy mode, if the door is\n  unreachable or answers with a door-level failure (its own auth 401/403,\n  a missing route 404, a 5xx), the app's direct provider call runs with\n  its original credentials and the door rests for 30s. Provider-level\n  passthrough statuses (400, 413, 429, ...) are the app's own outcome and\n  return untouched. In observe mode the door never engages: Anthropic\n  calls run directly against the provider and are captured passively.\n- **One logical call is observed once.** A decorated fetch stacked over\n  global interception suppresses the inner observer.\n\n## Configuration\n\nSet `AUTOTUNE_ENDPOINT` and, when required, `AUTOTUNE_API_KEY` in the\nenvironment (or `.env`, loaded by the register entry).\n\n- `AUTOTUNE_ENVIRONMENT`: deployment-static environment name.\n- `AUTOTUNE_CAPTURE_ALL=1`: capture every supported provider call, not just\n  onboarded ones (the default scope is `withSession()` contexts, decorated\n  clients with attribution options, and calls with `x-autotune-*` headers).\n- `AUTOTUNE_INTERCEPT=0`: kill switch for the register entry.\n- `AUTOTUNE_INFER_WORKFLOW=0`: disable call-site workflow inference.\n- `AUTOTUNE_HOOK_MODE=proxy`: hand execution to cloud workflow policy and\n  enable the Anthropic door (see Execution modes). Default `observe`,\n  pure-tee passive collection; `full` is accepted as a deprecated alias for\n  `proxy` (shared with older Python hook deployments).\n- `AUTOTUNE_HOOK_TIMEOUT`: hook-plumbing timeout in seconds (preflights and\n  shadow reports; never the app's own provider call). Default `2`.\n- `AUTOTUNE_HOOK_DOOR_TIMEOUT`: hang protection in seconds for the Anthropic\n  door, which carries the app's real provider call — generous by design,\n  matching provider SDK request timeouts. Default `600`.\n- `AUTOTUNE_HOOK_MODE_TTL`: shadow-decision cache TTL in seconds when the\n  preflight envelope names none. Default `60`.\n- `AUTOTUNE_HOOK_REDACT_DATA_URLS=0`: keep full inline `data:` URLs in\n  shadow reports. Default on (redacted).\n- `AUTOTUNE_HOOK_MAX_REPORT_BYTES`: drop shadow reports over this many\n  serialized bytes. Default `4000000`.\n\nDynamic attribution belongs in code, not static process env. Pass workflow,\nsession, user, and project values through `withSession(...)`, hook options,\nor per-call headers so each request is attributed to the right run.\n\nRequires Node >= 20.6 (for `--import`).\n","readmeFilename":"README.md"}