{"_id":"@agent-action-ledger/sdk-ts","name":"@agent-action-ledger/sdk-ts","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@agent-action-ledger/sdk-ts","version":"0.1.0","description":"TypeScript SDK for the Agent Action Ledger API","license":"MIT","type":"module","repository":{"type":"git","url":"git+https://github.com/diegobkc/agent-action-ledger.git","directory":"packages/sdk-ts"},"homepage":"https://github.com/diegobkc/agent-action-ledger/tree/main/packages/sdk-ts#readme","bugs":{"url":"https://github.com/diegobkc/agent-action-ledger/issues"},"keywords":["ai","agent","audit","logging","observability","tool-use","mcp","anthropic","claude"],"publishConfig":{"access":"public"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./mcp":{"types":"./dist/mcp.d.ts","import":"./dist/mcp.js"},"./anthropic":{"types":"./dist/anthropic.d.ts","import":"./dist/anthropic.js"}},"main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc","lint":"eslint src/","test":"vitest run --passWithNoTests","prepublishOnly":"npm run lint && npm run test && npm run build"},"peerDependencies":{"@anthropic-ai/sdk":">=0.30.0","@modelcontextprotocol/sdk":">=1.0.0"},"peerDependenciesMeta":{"@modelcontextprotocol/sdk":{"optional":true},"@anthropic-ai/sdk":{"optional":true}},"devDependencies":{"@anthropic-ai/sdk":"0.78.0","@modelcontextprotocol/sdk":"1.26.0","@types/node":"22.13.4","typescript":"5.7.3","vitest":"3.0.5"},"engines":{"node":">=20.0.0"},"gitHead":"405909daa7352939c18cb08b3e8133dc64ae9feb","_id":"@agent-action-ledger/sdk-ts@0.1.0","_nodeVersion":"24.12.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-WQmD0+RwEov5pzNKAqdUeSKr1GBRJYP/ckRV3HvnD+mE+VVawPRgyJpj1iAtuh0GELIJa3H0FBONZ8EkxNICnA==","shasum":"984507e42abd46a2f9680f9aa2146f6ff0d54bec","tarball":"https://registry.npmjs.org/@agent-action-ledger/sdk-ts/-/sdk-ts-0.1.0.tgz","fileCount":34,"unpackedSize":38012,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQC3xltFuhyJbPgd/uIBmBFy4yXnEVDvm6BYr6csZHAAAAIhAJ6mzjRgdL0jE+7AQ9ozaTYc4WlCwvQyZ4LiCztZxhOp"}]},"_npmUser":{"name":"bjoneskc01","email":"brian.joneskc01@gmail.com"},"directories":{},"maintainers":[{"name":"bjoneskc01","email":"brian.joneskc01@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk-ts_0.1.0_1771682902184_0.6615371111384978"},"_hasShrinkwrap":false}},"time":{"created":"2026-02-21T14:08:22.108Z","0.1.0":"2026-02-21T14:08:22.410Z","modified":"2026-02-21T14:08:22.610Z"},"maintainers":[{"name":"bjoneskc01","email":"brian.joneskc01@gmail.com"}],"description":"TypeScript SDK for the Agent Action Ledger API","homepage":"https://github.com/diegobkc/agent-action-ledger/tree/main/packages/sdk-ts#readme","keywords":["ai","agent","audit","logging","observability","tool-use","mcp","anthropic","claude"],"repository":{"type":"git","url":"git+https://github.com/diegobkc/agent-action-ledger.git","directory":"packages/sdk-ts"},"bugs":{"url":"https://github.com/diegobkc/agent-action-ledger/issues"},"license":"MIT","readme":"# @agent-action-ledger/sdk-ts\n\nTypeScript SDK for the Agent Action Ledger API. Zero runtime dependencies.\n\n## Installation\n\n```bash\nnpm install @agent-action-ledger/sdk-ts\n```\n\n## Usage\n\n```typescript\nimport { AALClient } from \"@agent-action-ledger/sdk-ts\";\n\nconst aal = new AALClient({\n  apiUrl: \"http://localhost:3000\",\n  apiKey: \"aal_sk_...\",\n  flushInterval: 1000, // batch flush interval in ms (default: 1000)\n  batchSize: 100, // max events per batch (default: 100)\n});\n\n// Start a session (synchronous — no API call)\nconst session = aal.startSession({\n  agentId: \"my-agent\",\n  metadata: { model: \"claude-opus-4-6\" },\n});\n\n// Log actions (synchronous — queued and batched)\nsession.logAction({\n  actionType: \"TOOL_CALL\",\n  toolName: \"web_search\",\n  parameters: { query: \"weather\" },\n  response: { results: [] },\n  status: \"SUCCESS\",\n  latencyMs: 150,\n});\n\n// Query events\nconst events = await aal.getEvents({ sessionId: session.id });\n\n// Graceful shutdown (flushes remaining events)\nawait aal.shutdown();\n```\n\n## MCP Auto-Instrumentation\n\nAutomatically log MCP tool calls:\n\n```typescript\nimport { wrapMcpServer } from \"@agent-action-ledger/sdk-ts/mcp\";\n\nconst session = aal.startSession({ agentId: \"my-agent\" });\nwrapMcpServer(server, session);\n```\n\n## Anthropic Auto-Instrumentation\n\nAutomatically log tool_use blocks from Anthropic responses:\n\n```typescript\nimport { wrapAnthropicClient } from \"@agent-action-ledger/sdk-ts/anthropic\";\n\nconst session = aal.startSession({ agentId: \"my-agent\" });\nconst wrapped = wrapAnthropicClient(anthropic, session);\n\n// Non-streaming — tool_use blocks logged after response\nconst response = await wrapped.messages.create({ ... });\n\n// Streaming — tool_use blocks accumulated and logged after stream completes\nconst stream = await wrapped.messages.create({ ..., stream: true });\nfor await (const event of stream) {\n  // events pass through unmodified\n}\n```\n\n## Limitations\n\n- The high-level `messages.stream()` method is not instrumented (use `messages.create({ stream: true })` instead)\n- MCP wrapper uses internal `_registeredTools` API which may change\n- Failed batch flushes drop events (no retry queue)\n","readmeFilename":"README.md","_rev":"1-9704243f466ee33f574ff1cd56940ee8"}