{"_id":"@agent-provider/context","_rev":"6-50020e77683238cd9ac6a8e0b4a7aa02","name":"@agent-provider/context","dist-tags":{"latest":"0.1.5"},"versions":{"0.1.0":{"name":"@agent-provider/context","version":"0.1.0","keywords":["browser","llm","context","agent-provider"],"license":"CC0-1.0 OR Unlicense","_id":"@agent-provider/context@0.1.0","maintainers":[{"name":"xertrov","email":"m@xk.io"}],"dist":{"shasum":"b44aff1d3f69d686af1e2fd4f949aee894d654f6","tarball":"https://registry.npmjs.org/@agent-provider/context/-/context-0.1.0.tgz","fileCount":13,"integrity":"sha512-9a1ac8j+/PxR8r5aZgei5pjrjRFFR36FVsMD/ITI5D+t7+wiICUFnfpkecIqxEFh7xlJ4XXzVqAH9Jw5EzI1YQ==","signatures":[{"sig":"MEUCIALCG4vycQ5niEJzHjevCkPo72xxlP34VO9/RJS9yCRGAiEAuH0RYPsGjG61E99LJFxqNQyTdfpQjjQFKF7DWtW0gWc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":88574},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=22"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"13bee9a89750e14cf880d4c751c1bac52d900216","scripts":{"test":"vitest run","build":"tsup src/index.ts --format esm --sourcemap --clean && tsc -p tsconfig.build.json --emitDeclarationOnly","clean":"rm -rf dist","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"xertrov","email":"m@xk.io"},"_npmVersion":"12.0.1","description":"Bounded, revisioned, application-controlled page context extraction.","directories":{},"sideEffects":false,"_nodeVersion":"22.23.1","publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","jsdom":"^27.4.0","vitest":"^4.1.10","typescript":"^7.0.2"},"_npmOperationalInternal":{"tmp":"tmp/context_0.1.0_1784764764362_0.18817572851401754","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@agent-provider/context","version":"0.1.1","keywords":["browser","llm","context","agent-provider"],"license":"CC0-1.0 OR Unlicense","_id":"@agent-provider/context@0.1.1","maintainers":[{"name":"xertrov","email":"m@xk.io"}],"homepage":"https://github.com/clankercode/agent-provider#readme","bugs":{"url":"https://github.com/clankercode/agent-provider/issues"},"dist":{"shasum":"c063c6d988f8fec36182a4324dcaeeb6f258f5ee","tarball":"https://registry.npmjs.org/@agent-provider/context/-/context-0.1.1.tgz","fileCount":13,"integrity":"sha512-my8E59EXDgGQ3rwKO73JZTwgg+7oCWKNy8qmKzHMiaahpuLaw7ZAEmHhlrfpREJZJhuDEM5ua0U73dKFW060IQ==","signatures":[{"sig":"MEYCIQDwab+wy3SViT5suhIOl2yiUioiImAoo0Xv238Xrqb02AIhAKcPYzG9FCAQslgl9T4W0w1TL57EPzbu9btmRsQC+lp6","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@agent-provider%2fcontext@0.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":92004},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=22"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"2dd5039a143844c33be718ae76b6191608da76ef","scripts":{"test":"vitest run","build":"tsup src/index.ts --format esm --sourcemap --clean && tsc -p tsconfig.build.json --emitDeclarationOnly","clean":"rm -rf dist","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:e8172a88-5e78-48b8-a20d-0a1395e389fd"}},"repository":{"url":"git+https://github.com/clankercode/agent-provider.git","type":"git","directory":"packages/context"},"_npmVersion":"11.5.1","description":"Bounded, revisioned, application-controlled page context extraction.","directories":{},"sideEffects":false,"_nodeVersion":"22.23.1","publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","jsdom":"^27.4.0","vitest":"^4.1.10","typescript":"^7.0.2"},"_npmOperationalInternal":{"tmp":"tmp/context_0.1.1_1784766013496_0.21414800623096975","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@agent-provider/context","version":"0.1.2","keywords":["browser","llm","context","agent-provider"],"license":"CC0-1.0 OR Unlicense","_id":"@agent-provider/context@0.1.2","maintainers":[{"name":"xertrov","email":"m@xk.io"}],"homepage":"https://github.com/clankercode/agent-provider#readme","bugs":{"url":"https://github.com/clankercode/agent-provider/issues"},"dist":{"shasum":"a4c1a480930313533fd86edccc7be49ec1c5de1c","tarball":"https://registry.npmjs.org/@agent-provider/context/-/context-0.1.2.tgz","fileCount":13,"integrity":"sha512-4g4eug80jId3GIpVGovR0cKjV/+0crkZJz+uJG5PKLkz6UGNYLL+8dEnBphmm8wej/3wUaZTxqc/gLUJkLM0AQ==","signatures":[{"sig":"MEUCIA59xKajVIqdUPqU08hd8gJH4Zyzj0ml6tUWALD4yZUXAiEA0+94SsruVenjOKz5AQtPy8Gb6NvDs1/LmMU+t5nvxrg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@agent-provider%2fcontext@0.1.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":92004},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=22"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"707770d8444dfababcdc11d677dbd93deff516ee","scripts":{"test":"vitest run","build":"tsup src/index.ts --format esm --sourcemap --clean && tsc -p tsconfig.build.json --emitDeclarationOnly","clean":"rm -rf dist","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:e8172a88-5e78-48b8-a20d-0a1395e389fd"}},"repository":{"url":"git+https://github.com/clankercode/agent-provider.git","type":"git","directory":"packages/context"},"_npmVersion":"11.5.1","description":"Bounded, revisioned, application-controlled page context extraction.","directories":{},"sideEffects":false,"_nodeVersion":"22.23.1","publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","jsdom":"^27.4.0","vitest":"^4.1.10","typescript":"^7.0.2"},"_npmOperationalInternal":{"tmp":"tmp/context_0.1.2_1784778824660_0.08409480790960333","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@agent-provider/context","version":"0.1.3","keywords":["browser","llm","context","agent-provider"],"license":"CC0-1.0 OR Unlicense","_id":"@agent-provider/context@0.1.3","maintainers":[{"name":"xertrov","email":"m@xk.io"}],"homepage":"https://github.com/clankercode/agent-provider#readme","bugs":{"url":"https://github.com/clankercode/agent-provider/issues"},"dist":{"shasum":"374d7991aa937ed19d82f807d5e054cd9de3eef4","tarball":"https://registry.npmjs.org/@agent-provider/context/-/context-0.1.3.tgz","fileCount":13,"integrity":"sha512-Kk8b+uVmPUV+BZZ8PPH/+2tzrp4S1lnuisL4D8J9PXCcgDnGFTEbQtedEdVpTbd8OOyIixN74o2u+k5pHjvfMA==","signatures":[{"sig":"MEQCIHFMiSh+sxof5psPUghnNpsGRk4kAJa/8HmovLJIkGSlAiA9nj62zCTM7tZo5T7yisWDSZKMtSdK5Kzt0DLh5654JQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@agent-provider%2fcontext@0.1.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":92004},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=22"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"fb7c39c103b925ce01ef87cd7bf3c7bbb3c4a94f","scripts":{"test":"vitest run","build":"tsup src/index.ts --format esm --sourcemap --clean && tsc -p tsconfig.build.json --emitDeclarationOnly","clean":"rm -rf dist","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:e8172a88-5e78-48b8-a20d-0a1395e389fd"}},"repository":{"url":"git+https://github.com/clankercode/agent-provider.git","type":"git","directory":"packages/context"},"_npmVersion":"11.5.1","description":"Bounded, revisioned, application-controlled page context extraction.","directories":{},"sideEffects":false,"_nodeVersion":"22.23.1","publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","jsdom":"^27.4.0","vitest":"^4.1.10","typescript":"^7.0.2"},"_npmOperationalInternal":{"tmp":"tmp/context_0.1.3_1784893385187_0.5842113285029835","host":"s3://npm-registry-packages-npm-production"}},"0.1.4":{"name":"@agent-provider/context","version":"0.1.4","keywords":["browser","llm","context","agent-provider"],"license":"CC0-1.0 OR Unlicense","_id":"@agent-provider/context@0.1.4","maintainers":[{"name":"xertrov","email":"m@xk.io"}],"homepage":"https://github.com/clankercode/agent-provider#readme","bugs":{"url":"https://github.com/clankercode/agent-provider/issues"},"dist":{"shasum":"32bea6d1d82f2dbacb1f8dbc2f13654c4576cf2a","tarball":"https://registry.npmjs.org/@agent-provider/context/-/context-0.1.4.tgz","fileCount":13,"integrity":"sha512-GFhHZkU2OpaIPx60WeQzyW8cdgKH8JfvG7Gc3inxVa5euGgN6S3YVyOnxDDfzfHqTKk1xlclyurBt0GC/5YdHA==","signatures":[{"sig":"MEUCIA5KPf9w1AmTpzN2iE63hDs2usm3ajA2eeLIMQXc7YsZAiEAliwrCeS8IiYK3H+7t/WYBGQudWOJ3uYbIJzMNK8OyYo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@agent-provider%2fcontext@0.1.4","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":92004},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=22"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"f00aa305d5fe6486ad9ded8a89b6069c0c5249f0","scripts":{"test":"vitest run","build":"tsup src/index.ts --format esm --sourcemap --clean && tsc -p tsconfig.build.json --emitDeclarationOnly","clean":"rm -rf dist","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:e8172a88-5e78-48b8-a20d-0a1395e389fd"}},"repository":{"url":"git+https://github.com/clankercode/agent-provider.git","type":"git","directory":"packages/context"},"_npmVersion":"11.5.1","description":"Bounded, revisioned, application-controlled page context extraction.","directories":{},"sideEffects":false,"_nodeVersion":"22.23.1","publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","jsdom":"^27.4.0","vitest":"^4.1.10","typescript":"^7.0.2"},"_npmOperationalInternal":{"tmp":"tmp/context_0.1.4_1785432136315_0.21431956267266905","host":"s3://npm-registry-packages-npm-production"}},"0.1.5":{"name":"@agent-provider/context","version":"0.1.5","description":"Bounded, revisioned, application-controlled page context extraction.","license":"CC0-1.0 OR Unlicense","repository":{"type":"git","url":"git+https://github.com/clankercode/agent-provider.git","directory":"packages/context"},"keywords":["browser","llm","context","agent-provider"],"engines":{"node":">=22"},"publishConfig":{"access":"public","provenance":true},"type":"module","sideEffects":false,"main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"build":"tsup src/index.ts --format esm --sourcemap --clean && tsc -p tsconfig.build.json --emitDeclarationOnly","typecheck":"tsc -p tsconfig.json --noEmit","test":"vitest run","clean":"rm -rf dist"},"devDependencies":{"jsdom":"^27.4.0","tsup":"^8.5.1","typescript":"^7.0.2","vitest":"^4.1.10"},"_id":"@agent-provider/context@0.1.5","gitHead":"6e48a8d1a19595339cfc67606241ef9280edf3a4","bugs":{"url":"https://github.com/clankercode/agent-provider/issues"},"homepage":"https://github.com/clankercode/agent-provider#readme","_nodeVersion":"22.23.1","_npmVersion":"11.5.1","dist":{"integrity":"sha512-1UFgc1r74EDPOVF7jq4AvatCIQvPZSp5ttRAGbgiIwjpgMVskgvYqpz57BvLjPYUfUjH/5jKbfTpt+eOd6SvBg==","shasum":"62d4876f5f4995237d47fc972699701079ef1447","tarball":"https://registry.npmjs.org/@agent-provider/context/-/context-0.1.5.tgz","fileCount":13,"unpackedSize":92004,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@agent-provider%2fcontext@0.1.5","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCpUi90YKuYEhxSN4WayHe7WBFDiPGz3WwPUvBgSwf+MQIhANk4c9hc3b8tRumVZS/BYnp/WTuMpAg4Zsuq2lxPImuF"}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:e8172a88-5e78-48b8-a20d-0a1395e389fd"}},"directories":{},"maintainers":[{"name":"xertrov","email":"m@xk.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/context_0.1.5_1785437735843_0.10652433838953401"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-22T23:59:24.218Z","modified":"2026-07-30T18:55:36.316Z","0.1.0":"2026-07-22T23:59:24.506Z","0.1.1":"2026-07-23T00:20:13.619Z","0.1.2":"2026-07-23T03:53:44.842Z","0.1.3":"2026-07-24T11:43:05.323Z","0.1.4":"2026-07-30T17:22:16.456Z","0.1.5":"2026-07-30T18:55:35.992Z"},"bugs":{"url":"https://github.com/clankercode/agent-provider/issues"},"license":"CC0-1.0 OR Unlicense","homepage":"https://github.com/clankercode/agent-provider#readme","keywords":["browser","llm","context","agent-provider"],"repository":{"type":"git","url":"git+https://github.com/clankercode/agent-provider.git","directory":"packages/context"},"description":"Bounded, revisioned, application-controlled page context extraction.","maintainers":[{"name":"xertrov","email":"m@xk.io"}],"readme":"# @agent-provider/context\n\nBounded, revisioned, application-controlled page context for Agent Provider.\n\n```bash\nnpm install @agent-provider/context\n```\n\nApplications explicitly select context regions; the package does not crawl an\nentire page by default. It is ESM-only and requires a DOM-capable environment.\n\n## What it does\n\nAgent Provider lets a trusted web application hand structured page context to a\nuser-controlled agent. This package is the extraction half of that contract:\nthe application names the DOM roots that may be observed, and\n`createPageContext` turns them into immutable, revisioned frames containing\nnormalized text content, named regions, redaction records, and truncation\nmetadata — never live DOM nodes.\n\nExtraction is conservative by default:\n\n- Only elements under the declared roots are read.\n- `script`, `style`, `template`, `noscript`, `svg`, and `canvas` content is\n  omitted, as is anything under a `hidden` or `aria-hidden=\"true\"` subtree.\n- Password, file, and hidden inputs, and form controls whose name, label,\n  or autocomplete suggests a token, one-time code, or payment detail, are\n  redacted automatically and reported in the frame's `redactions`.\n- Elements carrying `data-agent-provider-redact`, or matching an application\n  `redact` predicate, are excluded entirely.\n- Output is bounded in UTF-8 bytes, nesting depth, region count, and form-value\n  size; every limit breach is recorded in `truncation`.\n\n## Quick start\n\n```ts\nimport { createPageContext } from \"@agent-provider/context\";\n\nconst context = createPageContext({\n  roots: () => document.querySelector(\"main\"),\n  regions: {\n    summary: () => document.querySelector(\"#summary\"),\n  },\n});\n\nconst frame = context.capture(); // revisioned, deeply frozen\nconsole.log(frame.content); // normalized text\nconsole.log(context.getRegion(\"summary\", frame)?.content);\nconsole.log(frame.redactions, frame.truncation);\n\nconst delta = context.diff(frame, context.capture());\nconsole.log(delta.contentChanged, delta.changedRegions);\n```\n\nRoots and region resolvers run at every capture, so frames track DOM changes\nwithout retaining references. Regions can also be declared in markup with\n`data-agent-provider-region=\"name\"`; configured regions take precedence over\nattributes with the same name. `full()` is an alias of `capture()` intended\nfor lazy context-tool integrations. Custom `extractors` can replace the\ndefault rendering of selected elements with application-controlled text.\n\n## Notes\n\n- ESM-only; Node.js 22 or newer. No side effects.\n- Requires a DOM: the browser, or a DOM shim such as jsdom for tests.\n- Default limits (`DEFAULT_CONTEXT_LIMITS`): 32 KiB total, depth 32,\n  128 regions, 4 KiB per form value. Override via the `limits` option with\n  positive integers; truncation is UTF-8-aware and never splits a code point.\n- A capture only consumes a revision when it succeeds. Redaction paths are\n  structural (`root[0]/div[2]/input[0]`) and omit identifiers and field names.\n\n## Links\n\n- Repository: https://github.com/clankercode/agent-provider\n- Sibling packages:\n  [`@agent-provider/runtime`](https://www.npmjs.com/package/@agent-provider/runtime),\n  [`@agent-provider/react`](https://www.npmjs.com/package/@agent-provider/react),\n  [`@agent-provider/ai-sdk`](https://www.npmjs.com/package/@agent-provider/ai-sdk),\n  [`@agent-provider/webmcp`](https://www.npmjs.com/package/@agent-provider/webmcp)\n- Example application:\n  [`examples/operations-dashboard`](https://github.com/clankercode/agent-provider/tree/master/examples/operations-dashboard)\n\n## License\n\nCC0-1.0 OR Unlicense.\n","readmeFilename":"README.md"}