{"_id":"@bluepages/sdk","name":"@bluepages/sdk","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@bluepages/sdk","version":"0.1.0","description":"TypeScript SDK for the BluePages AI agent skills marketplace","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/index.js","types":"./dist/index.d.ts"}},"scripts":{"build":"tsc","clean":"rm -rf dist","prepublishOnly":"npm run build"},"keywords":["bluepages","ai","agent","skills","marketplace","x402","usdc"],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/dbhurley/bluepages.git","directory":"packages/sdk"},"engines":{"node":">=18.0.0"},"devDependencies":{"typescript":"^5.4.0"},"gitHead":"beacdc75df3b0430d74a45fc1ef89797e3a98f93","_id":"@bluepages/sdk@0.1.0","bugs":{"url":"https://github.com/dbhurley/bluepages/issues"},"homepage":"https://github.com/dbhurley/bluepages#readme","_nodeVersion":"25.4.0","_npmVersion":"11.7.0","dist":{"integrity":"sha512-w3RNwzm4te67phJ0WeX7sFVtH0o4MokdAwj9VxOSV8RJEGzPietTlPKwEOlGmt4p6dOufwusbotzrqQ20LSLvg==","shasum":"0911699c3ad2f9b4b6974f748cfb8c7141be3c33","tarball":"https://registry.npmjs.org/@bluepages/sdk/-/sdk-0.1.0.tgz","fileCount":18,"unpackedSize":37549,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCICMIb3onRvPJ5JUMGDexETX6pNDaqzWadenh0GZ9CC46AiEAw8xVe5QYlk/+W9s+/FeG/SP6+n3dPC36LAwXj2EEn8k="}]},"_npmUser":{"name":"dbhurley","email":"dbhurley@me.com"},"directories":{},"maintainers":[{"name":"dbhurley","email":"dbhurley@me.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_0.1.0_1776339995166_0.8071155498651803"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-16T11:46:35.070Z","0.1.0":"2026-04-16T11:46:35.318Z","modified":"2026-04-16T11:46:35.513Z"},"maintainers":[{"name":"dbhurley","email":"dbhurley@me.com"}],"description":"TypeScript SDK for the BluePages AI agent skills marketplace","homepage":"https://github.com/dbhurley/bluepages#readme","keywords":["bluepages","ai","agent","skills","marketplace","x402","usdc"],"repository":{"type":"git","url":"git+https://github.com/dbhurley/bluepages.git","directory":"packages/sdk"},"bugs":{"url":"https://github.com/dbhurley/bluepages/issues"},"license":"MIT","readme":"# @bluepages/sdk\n\nTypeScript SDK for the [BluePages](https://bluepages.ai) AI agent skills marketplace.\n\n## Installation\n\n```bash\nnpm install @bluepages/sdk\n```\n\n## Quick start\n\n```typescript\nimport { BluePagesClient, isPaymentRequired } from '@bluepages/sdk';\n\nconst bp = new BluePagesClient({\n  walletAddress: '0xYourWallet',\n});\n\n// Search for skills\nconst { skills } = await bp.search('weather', { category: 'data', limit: 5 });\nconsole.log(skills);\n\n// Get a specific skill\nconst skill = await bp.getSkill('weather-forecast');\nconsole.log(skill.pricePerCall); // 0 for free, >0 for paid\n\n// Invoke a free skill\nconst result = await bp.invoke('weather-forecast', { location: 'San Francisco' });\nif (result.success) {\n  console.log(result.data);\n}\n```\n\n## Paid skills (x402)\n\nPaid skills return HTTP 402 with payment details. The SDK does **not** pay\nautomatically -- you handle payment out-of-band and retry with the proof.\n\n```typescript\nconst result = await bp.invoke('premium-analysis', { text: 'Hello world' });\n\nif (isPaymentRequired(result)) {\n  console.log(result.paymentRequired);\n  // {\n  //   amount: '0.050000',\n  //   currency: 'USDC',\n  //   network: 'base',\n  //   recipient: '0xPublisherWallet',\n  //   description: 'Invoke skill: Premium Analysis',\n  //   resourceId: 'skill-id-here',\n  // }\n\n  // ... send USDC on Base using your preferred web3 library ...\n  const txHash = '0xabc123...';\n\n  // Retry with payment proof\n  const paid = await bp.invoke(\n    'premium-analysis',\n    { text: 'Hello world' },\n    { paymentProof: txHash },\n  );\n  console.log(paid.data);\n}\n```\n\n## Listing a skill\n\n```typescript\nconst listing = await bp.listSkill(\n  {\n    name: 'My Cool Skill',\n    description: 'Does something useful',\n    endpoint: 'https://api.example.com/skill',\n    protocol: 'rest',\n    category: 'data',\n    pricePerCall: 0.01,\n    publisherWallet: '0xYourWallet',\n    inputSchema: { type: 'object', properties: { query: { type: 'string' } } },\n    tags: ['example'],\n  },\n  {\n    txHash: '0xListingPaymentTx',\n    amount: '5', // 5 USDC for basic tier\n  },\n);\n\nconsole.log(listing.skill.invokeUrl);\n```\n\n## API reference\n\n| Method | Description |\n|---|---|\n| `search(query?, filters?)` | Search for skills. Returns paginated results. |\n| `getSkill(slug)` | Get detailed info about a skill by slug or ID. |\n| `invoke(slug, input, options?)` | Invoke a skill. Returns data or payment info. |\n| `listSkill(skill, paymentHeaders?)` | Register a new skill listing. |\n| `bulkList(skills, paymentHeaders?)` | Batch-register multiple skills. |\n\n### Configuration\n\n```typescript\nnew BluePagesClient({\n  baseUrl: 'https://bluepages.ai',   // default\n  walletAddress: '0x...',             // sent as X-Wallet-Address\n  apiKey: 'bp_...',                   // sent as X-Api-Key\n});\n```\n\n### Helpers\n\n| Function | Description |\n|---|---|\n| `isPaymentRequired(result)` | Type-guard for 402 results. |\n| `parsePaymentRequired(response)` | Parse x402 headers from a raw `Response`. |\n| `parsePaymentRequiredFromBody(body)` | Parse payment info from the JSON body. |\n\n### Error handling\n\nAll non-2xx responses (except 402 on invoke) throw `BluePagesError`:\n\n```typescript\nimport { BluePagesError } from '@bluepages/sdk';\n\ntry {\n  await bp.getSkill('nonexistent');\n} catch (err) {\n  if (err instanceof BluePagesError) {\n    console.log(err.statusCode); // 404\n    console.log(err.code);       // 'HTTP_ERROR'\n  }\n}\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-29168293ffd21291f53b6aaf75223136"}