{"_id":"@clawbureau/clawsig-adapters","name":"@clawbureau/clawsig-adapters","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@clawbureau/clawsig-adapters","version":"0.1.0","description":"External harness adapters for Proof-of-Harness — wrapper scripts and runtime for Claude Code, Codex, Pi, Opencode, and Factory Droid","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","bin":{"clawsig-wrap":"bin/clawsig-wrap.sh"},"scripts":{"build":"tsc","typecheck":"tsc --noEmit","test":"vitest run"},"devDependencies":{"@types/node":"^25.2.1","typescript":"^5.7.0","vitest":"^2.1.0"},"repository":{"type":"git","url":"git+https://github.com/clawbureau/monorepo.git","directory":"packages/clawsig-adapters"},"keywords":["clawsig","proof-of-harness","agent-verification","eip-8004","clawproxy"],"license":"MIT","gitHead":"24129ca32f3d8917c81d5ab495480b04ac22085f","_id":"@clawbureau/clawsig-adapters@0.1.0","bugs":{"url":"https://github.com/clawbureau/monorepo/issues"},"homepage":"https://github.com/clawbureau/monorepo#readme","_nodeVersion":"24.13.0","_npmVersion":"11.8.0","dist":{"integrity":"sha512-v9euBqjh1GiWI9fsc508chMUxZ2Kj+niQ4p4Wg/WAXdjzypvN/BatFl448Y+PatNFMqn2YgYSoW0Ci14CwahAg==","shasum":"313b697caffb104903a6f2862438fcfdd3390fed","tarball":"https://registry.npmjs.org/@clawbureau/clawsig-adapters/-/clawsig-adapters-0.1.0.tgz","fileCount":64,"unpackedSize":204803,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDI6xQvpudFGEDHr/nuowqO7+H14t6oPyEuCOlLT+4LwwIgWwA51bxWf7WTzYEM3i+k/Zf3ROsz0TfwIGez7BMsZeQ="}]},"_npmUser":{"name":"gwelinder","email":"npm@clawbureau.com"},"directories":{},"maintainers":[{"name":"gwelinder","email":"npm@clawbureau.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/clawsig-adapters_0.1.0_1771273950116_0.8991195979434501"},"_hasShrinkwrap":false}},"time":{"created":"2026-02-16T20:32:30.051Z","0.1.0":"2026-02-16T20:32:30.283Z","modified":"2026-02-16T20:32:30.482Z"},"maintainers":[{"name":"gwelinder","email":"npm@clawbureau.com"}],"description":"External harness adapters for Proof-of-Harness — wrapper scripts and runtime for Claude Code, Codex, Pi, Opencode, and Factory Droid","homepage":"https://github.com/clawbureau/monorepo#readme","keywords":["clawsig","proof-of-harness","agent-verification","eip-8004","clawproxy"],"repository":{"type":"git","url":"git+https://github.com/clawbureau/monorepo.git","directory":"packages/clawsig-adapters"},"bugs":{"url":"https://github.com/clawbureau/monorepo/issues"},"license":"MIT","readme":"# @clawbureau/clawsig-adapters\n\nExternal harness adapters for Proof-of-Harness (PoH). Wrapper scripts and a shared runtime that route LLM calls through clawproxy and produce verifiable proof bundles from external agent harnesses.\n\n## Supported Harnesses\n\n| Harness | ID | Proxy Env Var |\n|---------|-----|---------------|\n| Claude Code | `claude-code` | `ANTHROPIC_BASE_URL` |\n| Codex | `codex` | `OPENAI_BASE_URL` |\n| Pi | `pi` | `ANTHROPIC_BASE_URL`, `OPENAI_BASE_URL` |\n| Opencode | `opencode` | `ANTHROPIC_BASE_URL`, `OPENAI_BASE_URL` |\n| Factory Droid | `factory-droid` | `ANTHROPIC_BASE_URL`, `OPENAI_BASE_URL` |\n\n## Quick Start\n\n### 1. Set up environment\n\n```bash\nexport CLAWSIG_PROXY_URL=https://proxy.clawbureau.com\nexport CLAWSIG_PROXY_TOKEN=your-token  # optional\n```\n\n### 2. Run with wrapper\n\n```bash\n# Generic wrapper (specify harness ID)\nclawsig-wrap claude-code -- claude \"fix the bug in auth.ts\"\n\n# Or use the convenience scripts\nclawsig-claude-code -- claude \"fix the bug in auth.ts\"\nclawsig-codex -- codex \"implement the feature\"\nclawsig-pi -- pi \"run the tests\"\nclawsig-opencode -- opencode \"refactor the module\"\nclawsig-factory-droid -- factory-droid run --task \"build feature\"\n```\n\n### 3. Proof artifacts\n\nAfter the run completes, proof artifacts are written to `artifacts/poh/<branch>/` (repo-relative) by default:\n\n```\nartifacts/poh/<branch>/\n  run_<uuid>-bundle.json        # Signed proof bundle (SignedEnvelope<ProofBundlePayload>)\n  run_<uuid>-urm.json           # Universal Run Manifest\n  run_<uuid>-trust-pulse.json   # Trust Pulse summary (stable JSON)\n  run_<uuid>-verify.json        # (optional) Offline verifier output (CLAWSIG_VERIFY=1)\n```\n\n## How It Works\n\n1. **Shim routing**: The wrapper starts a local shim HTTP server and sets provider base URL env vars (`ANTHROPIC_BASE_URL`, `OPENAI_BASE_URL`) to point to it. The harness CLI talks to the shim using normal OpenAI/Anthropic SDK requests.\n\n2. **Gateway forwarding + PoH binding**: The shim forwards each request to `clawproxy`. For non-streaming calls it uses the shared session runtime (`session.proxyLLMCall()`); for streaming/SSE calls it forwards the response body without buffering. In both cases it injects PoH binding headers (`X-Run-Id`, `X-Event-Hash`, `X-Idempotency-Key`).\n\n3. **Receipt collection**: `clawproxy` issues canonical signed `_receipt_envelope` objects. For JSON responses these are returned as fields; for streaming/SSE responses they are delivered as SSE comment trailers (which the shim strips from the harness-facing stream while recording the receipts for the proof bundle).\n\n4. **Event chain**: The adapter records `run_start`/`tool_call`/`run_end` plus one `llm_call` event per model request into a hash-linked event chain (SHA-256, deterministic key order per PoH Adapter Spec §4.2).\n\n5. **Proof bundle**: On completion, the adapter assembles a `SignedEnvelope<ProofBundlePayload>` containing the event chain, receipts, URM reference, and harness metadata — signed with the agent's Ed25519 DID key.\n\n## Environment Variables\n\n| Variable | Required | Default | Description |\n|----------|----------|---------|-------------|\n| `CLAWSIG_PROXY_URL` | Yes | — | clawproxy base URL |\n| `CLAWSIG_PROXY_TOKEN` | No | — | CST token for proxy auth |\n| `CLAWBOUNTIES_BASE_URL` | No | — | clawbounties base URL (enables job CST auto-fetch when other vars are set) |\n| `CLAWBOUNTIES_BOUNTY_ID` | No | — | bounty id (bty_...) for job CST issuance |\n| `CLAWBOUNTIES_WORKER_TOKEN` | No | — | clawbounties worker auth token (Authorization: Bearer ...) |\n| `CLAWSIG_KEY_FILE` | No | `<repo>/.clawsig-key.json` | Path to Ed25519 JWK key file |\n| `CLAWSIG_OUTPUT_DIR` | No | `<repo>/artifacts/poh/<branch>/` | Directory for proof artifacts |\n| `CLAWSIG_VERIFY` | No | `0` | If set to 1, run offline verification and write `run_<uuid>-verify.json` |\n| `CLAWSIG_VERIFY_CONFIG` | No | `packages/schema/fixtures/clawverify.config.clawbureau.v1.json` (if present) | Offline verifier config (allowlists) |\n| `CLAWSIG_VERIFY_STRICT` | No | `0` | If set to 1, fail the wrapper when verification FAILs |\n\n## Key Management\n\nOn first run, the adapter generates an Ed25519 key pair and saves it as a JWK file (default: `<repo>/.clawsig-key.json`). The agent DID is derived from the public key: `did:key:z<base58btc(0xed01 + pubkey)>`.\n\nTo use an existing key, set `CLAWSIG_KEY_FILE` to the path of a JWK file containing `{ publicKey, privateKey }`.\n\n## Programmatic Usage\n\n```typescript\nimport { createSession, getAdapter, generateKeyPair } from '@clawbureau/clawsig-adapters';\n\nconst keyPair = await generateKeyPair();\nconst adapter = getAdapter('claude-code')!;\n\nconst session = await createSession({\n  proxyBaseUrl: 'https://proxy.clawbureau.com',\n  keyPair,\n  harness: adapter.HARNESS,\n});\n\n// Record events\nawait session.recordEvent({ eventType: 'run_start', payload: { task: 'fix bug' } });\n\n// Proxy an LLM call (routes through clawproxy, collects receipt)\nconst result = await session.proxyLLMCall({\n  provider: 'anthropic',\n  model: 'claude-sonnet-4-5-20250929',\n  body: { messages: [{ role: 'user', content: 'Hello' }], max_tokens: 100 },\n});\n\nawait session.recordEvent({ eventType: 'run_end', payload: { status: 'ok' } });\n\n// Finalize — produces signed proof bundle + URM\nconst proof = await session.finalize({\n  inputs: [{ type: 'task', hashB64u: '...' }],\n  outputs: [{ type: 'patch', hashB64u: '...' }],\n});\n\nconsole.log(JSON.stringify(proof.envelope, null, 2));\n```\n\n## Architecture\n\n```\npackages/clawsig-adapters/\n├── bin/                           # Shell wrapper scripts\n│   ├── clawsig-wrap.sh          # Generic wrapper (harness-id -- command)\n│   ├── clawsig-claude-code.sh   # Claude Code convenience wrapper\n│   ├── clawsig-codex.sh         # Codex convenience wrapper\n│   ├── clawsig-pi.sh            # Pi convenience wrapper\n│   ├── clawsig-opencode.sh      # Opencode convenience wrapper\n│   └── clawsig-factory-droid.sh # Factory Droid convenience wrapper\n├── src/\n│   ├── index.ts                   # Package entry point + exports\n│   ├── types.ts                   # All type definitions\n│   ├── crypto.ts                  # Ed25519, SHA-256, DID, JWK utilities\n│   ├── session.ts                 # Core adapter session runtime\n│   ├── shim.ts                    # Local shim HTTP server for base URL overrides\n│   ├── cli.ts                     # CLI runner (orchestrates lifecycle)\n│   └── adapters/\n│       ├── index.ts               # Adapter registry\n│       ├── claude-code.ts         # Claude Code adapter\n│       ├── codex.ts               # Codex adapter\n│       ├── pi.ts                  # Pi adapter\n│       ├── opencode.ts            # Opencode adapter\n│       └── factory-droid.ts       # Factory Droid adapter\n└── package.json\n```\n\n## Relationship to Other Packages\n\n- **@openclaw/provider-clawproxy**: The reference OpenClaw plugin (POH-US-005/006). This adapter package provides the same proof bundle capabilities for non-OpenClaw harnesses.\n- **packages/schema/poh/**: JSON schemas for proof bundles, event chains, URMs. The adapter output conforms to these schemas.\n- **services/clawverify**: Verifies proof bundles produced by these adapters.\n- **services/clawproxy**: The proxy that receipts LLM calls.\n","readmeFilename":"README.md","_rev":"1-0f05d7a35e8c17e3704f2a5cda9746c9"}