{"_id":"@admissible-ai/anthropic","name":"@admissible-ai/anthropic","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@admissible-ai/anthropic","version":"0.1.0","description":"Admissible AI client-side Claude tool-use integration.","license":"MIT","type":"module","sideEffects":false,"main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"scripts":{"build":"tsc -p tsconfig.build.json","prepack":"npm run build","test":"node --import tsx --test src/*.test.ts"},"publishConfig":{"access":"public"},"engines":{"node":">=18"},"keywords":["admissible","anthropic","claude","tools","authority"],"dependencies":{"@admissible-ai/sdk":"^0.1.0","@admissible-ai/types":"^0.1.0"},"_id":"@admissible-ai/anthropic@0.1.0","gitHead":"dc8406de0a86891b83d87a9f8533aea48e01de82","_nodeVersion":"20.20.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-9RN2gEYjZpTM+8b1gYxTl0aWIBdOPBQxAihXEqSK8DFr/kz+eRLiHtlJvYuzBYOUu5Y6tHxAZ4y2wOAb7zMRdA==","shasum":"caf9e552e6e0295f1565b41eb57343248aa8d452","tarball":"https://registry.npmjs.org/@admissible-ai/anthropic/-/anthropic-0.1.0.tgz","fileCount":5,"unpackedSize":45340,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQChNJqis31nYx5n6tT5V1kmYH+eM7rPvivLVVBaQZqnRQIhAPbkBbOwbMsoGoh/cufQHYIo9hT2o1kZHVqHyIZk3Vhz"}]},"_npmUser":{"name":"tysonjeffreys","email":"tjeffreys@baselinelabs.io"},"directories":{},"maintainers":[{"name":"tysonjeffreys","email":"tjeffreys@baselinelabs.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/anthropic_0.1.0_1783364789870_0.5489235746961147"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-06T19:06:29.708Z","0.1.0":"2026-07-06T19:06:30.000Z","modified":"2026-07-06T19:06:30.265Z"},"maintainers":[{"name":"tysonjeffreys","email":"tjeffreys@baselinelabs.io"}],"description":"Admissible AI client-side Claude tool-use integration.","keywords":["admissible","anthropic","claude","tools","authority"],"license":"MIT","readme":"# `@admissible-ai/anthropic`\n\nNative Admissible AI integration for client-side Claude tool use.\n\nThis package governs local Claude tool execution by routing proposed `tool_use` blocks through Admissible before application code runs. It returns Claude-compatible `tool_result` blocks for allowed, denied, deferred, modified, and failed tool calls.\n\n## What It Does\n\n- Exposes Claude-ready client tool definitions.\n- Handles Claude `tool_use` blocks in application code.\n- Provides a native `messages.create` helper that runs the Claude tool loop.\n- Calls Admissible `execute()` before local tool execution.\n- Supports explicit durable-tool `commit()` metadata.\n- Converts Admissible decisions into Claude-compatible `tool_result` blocks.\n\n## What It Does Not Do\n\nThis package does not govern all Anthropic tools.\n\n`@admissible-ai/anthropic` governs client-side Claude tool execution. Anthropic server-executed tools run on Anthropic infrastructure and are outside this package's direct execution authority. For server tools or MCP-routed tools, use an Admissible-controlled client/tool gateway where the application owns the execution boundary.\n\nThis package does not implement MCP, publish packages, or change runtime API behavior.\n\n## Install\n\n```bash\nnpm install @admissible-ai/anthropic @admissible-ai/sdk\n```\n\nIf you want to run a live Claude example, install Anthropic's SDK in your application:\n\n```bash\nnpm install @anthropic-ai/sdk\n```\n\n## Minimal Usage\n\n```ts\nimport Anthropic from \"@anthropic-ai/sdk\";\nimport { AdmissibleClient } from \"@admissible-ai/sdk\";\nimport { createAdmissibleAnthropic } from \"@admissible-ai/anthropic\";\n\nconst anthropic = new Anthropic({\n  apiKey: process.env.ANTHROPIC_API_KEY,\n});\n\nconst admissible = new AdmissibleClient({\n  baseUrl: process.env.ADMISSIBLE_API_URL!,\n  apiKey: process.env.ADMISSIBLE_API_KEY!,\n});\n\nconst client = createAdmissibleAnthropic({\n  anthropic,\n  admissible,\n  agentId: \"claude-tool-agent\",\n  sessionId: \"session-123\",\n  environmentName: \"staging\",\n  tools: [\n    {\n      name: \"read_status\",\n      description: \"Read deployment status.\",\n      input_schema: {\n        type: \"object\",\n        properties: {\n          service: { type: \"string\" },\n        },\n        required: [\"service\"],\n      },\n      async run(input) {\n        return { status: \"ok\", input };\n      },\n    },\n  ],\n});\n\nconst response = await client.messages.create({\n  model: \"claude-sonnet-4-5\",\n  max_tokens: 1024,\n  messages: [\n    {\n      role: \"user\",\n      content: \"Check deployment status.\",\n    },\n  ],\n  admissible: {\n    context: {\n      conversationId: \"conversation-123\",\n      userId: \"operator-123\",\n      env: \"staging\",\n    },\n  },\n});\n\nconsole.log(response.content);\nconsole.log(response.admissible.toolExecutions);\n```\n\n`createAdmissibleAnthropic` forwards tool definitions to Claude, extracts `tool_use` blocks from Claude responses, runs each local tool through Admissible, sends immediate `tool_result` blocks back to Claude, and repeats until Claude returns a final non-tool response or the configured round-trip limit is reached.\n\n## Decision Mapping\n\n| Admissible decision | Local tool execution | Claude `tool_result` |\n| --- | --- | --- |\n| `allow` | Executes the local tool | Tool output |\n| `deny` | Does not execute | `is_error: true`, blocked message |\n| `defer` | Does not execute | `is_error: true`, approval/evidence message |\n| `modify` | Executes the modified tool/action when registered | Modified tool output |\n| unsupported `modify` | Does not execute original tool | `is_error: true`, fail-closed message |\n\nTool execution errors are converted into safe `tool_result` blocks without leaking stack details.\n\n## Low-Level Tool Handling\n\nIf your application already owns the Claude message loop, use `createAdmissibleAnthropicTools`:\n\n```ts\nimport { createAdmissibleAnthropicTools } from \"@admissible-ai/anthropic\";\n\nconst managed = createAdmissibleAnthropicTools(tools, {\n  admissible,\n  agentId: \"claude-tool-agent\",\n  sessionId: \"session-123\",\n  environmentName: \"staging\",\n});\n\nconst executions = await managed.handleToolUses(toolUses, {\n  conversationId: \"conversation-123\",\n  userId: \"operator-123\",\n  env: \"staging\",\n});\n```\n\nSend `executions.map((execution) => execution.toolResult)` back to Claude as the immediate next user message after the assistant `tool_use` response.\n\n## Durable Tools\n\nDurable side effects must be explicit:\n\n```ts\n{\n  name: \"send_email\",\n  description: \"Send an external email.\",\n  input_schema: {\n    type: \"object\",\n    properties: {\n      to: { type: \"string\" },\n      body: { type: \"string\" },\n    },\n    required: [\"to\", \"body\"],\n  },\n  commit: {\n    type: \"external\",\n    system: \"email\",\n    payload: (input) => input,\n  },\n  async run(input) {\n    return sendEmail(input);\n  },\n}\n```\n\nIf no `commit` metadata is provided, the tool is treated as execute-only.\n\n## Common Mistakes\n\n- Use a full `ADMISSIBLE_API_URL`, including `https://`.\n- Do not expect Anthropic server-executed tools to be governed by this package. Only client-side tools executed by your application cross this local Admissible boundary.\n- Do not skip the `tool_result` continuation. Claude needs the tool results immediately after the assistant message that contained `tool_use` blocks.\n- Do not assume denied or deferred tool calls executed. They return `is_error: true` and the local `run` function is not called.\n- Add `commit` metadata for durable local or external side effects. Without it, the tool is treated as execute-only.\n- Keep untrusted external data inside tool results, not in system prompts or unrelated user text.\n\n## Optional Live Smoke\n\nUnit tests are mocked and do not require external API keys.\n\nFor a live local smoke, set:\n\n```bash\nANTHROPIC_API_KEY=...\nADMISSIBLE_API_URL=https://api.admissible.io\nADMISSIBLE_API_KEY=...\n```\n\nCompatibility fallbacks are supported after `ADMISSIBLE_API_URL`: `ADMISSIBLE_BASE_URL`, then legacy `BASELINE_BASE_URL`.\n\nThen run:\n\n```bash\nnpm run smoke:anthropic\n```\n\nThe smoke uses `@anthropic-ai/sdk` as an application dependency. If it is not installed locally, run:\n\n```bash\nnpm install --no-save --package-lock=false @anthropic-ai/sdk\n```\n\nSee `examples/anthropic-tool-use-basic`.\n","readmeFilename":"README.md","_rev":"1-e7f001e4f7b292f16f1395382d121e88"}