{"_id":"@akabot/agentic-sdk","name":"@akabot/agentic-sdk","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@akabot/agentic-sdk","version":"0.1.0","description":"TypeScript SDK for building integrations with the akabot 2.0 Agentic AI Platform, featuring flexible authentication, resource APIs, and developer-friendly abstractions for automation workflows.","type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"build":"tsup src/index.ts --format esm,cjs --dts --clean","changelog":"conventional-changelog -p angular -i CHANGELOG.md -s -r 0","dev":"tsup src/index.ts --watch","lint":"eslint . --ext .ts","lint:fix":"eslint . --ext .ts --fix","format":"prettier --write \"src/**/*.ts\" \"tests/**/*.ts\"","test":"vitest run --coverage","test:watch":"vitest","prepare":"husky install","release":"semantic-release"},"keywords":["agentic","sdk","typescript","ai","automation"],"author":{"name":"akaBot Team"},"license":"Apache-2.0","devDependencies":{"@semantic-release/changelog":"^6.0.3","@semantic-release/git":"^10.0.1","@semantic-release/gitlab":"^13.2.3","@types/mime-types":"^3.0.1","@types/node":"^22.9.0","@typescript-eslint/eslint-plugin":"^8.13.0","@typescript-eslint/parser":"^8.13.0","@vitest/coverage-v8":"^2.1.4","conventional-changelog-cli":"^5.0.0","eslint":"^9.14.0","eslint-config-prettier":"^9.1.0","eslint-plugin-prettier":"^5.2.1","husky":"^9.1.6","lint-staged":"^15.2.10","prettier":"^3.3.3","semantic-release":"^24.2.0","tsup":"^8.3.5","typescript":"^5.6.3","vitest":"^2.1.4"},"dependencies":{"axios":"^1.13.2","mime-types":"^3.0.1"},"lint-staged":{"*.ts":["eslint --fix","prettier --write"]},"_id":"@akabot/agentic-sdk@0.1.0","gitHead":"4058f4e16796de498a09ea8f4c033ed81d0980a3","_nodeVersion":"22.13.1","_npmVersion":"10.9.2","dist":{"integrity":"sha512-8MJTXX7R1wbkRgCqw1VrtWr/uzHVgvM/bs5bv+5zk68WAsv8NcGL4BosRTsZf+GtFLRc/y22z8oSXjQvGd7M9w==","shasum":"eb1f1f30da2d21f9bd67758bb656a91bfcac5eb9","tarball":"https://registry.npmjs.org/@akabot/agentic-sdk/-/agentic-sdk-0.1.0.tgz","fileCount":7,"unpackedSize":80471,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIGEQ68/yWrTTIXf0NJP5JsobkTqqkkg+TWQeO23o74ztAiB5p3H81oN4F6iQAGk6XFN3aZnhg7Ks2ognXGpuh6FdSA=="}]},"_npmUser":{"name":"sontx","email":"xuanson33bk@gmail.com"},"directories":{},"maintainers":[{"name":"sontx","email":"xuanson33bk@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/agentic-sdk_0.1.0_1762516419651_0.2763579461146972"},"_hasShrinkwrap":false}},"time":{"created":"2025-11-07T11:53:39.538Z","0.1.0":"2025-11-07T11:53:39.838Z","modified":"2025-11-07T11:53:40.142Z"},"maintainers":[{"name":"sontx","email":"xuanson33bk@gmail.com"}],"description":"TypeScript SDK for building integrations with the akabot 2.0 Agentic AI Platform, featuring flexible authentication, resource APIs, and developer-friendly abstractions for automation workflows.","keywords":["agentic","sdk","typescript","ai","automation"],"author":{"name":"akaBot Team"},"license":"Apache-2.0","readme":"# Agentic SDK\r\n\r\nTypeScript SDK for building integrations with the akaBot 2.0 Agentic AI Platform, featuring flexible authentication, resource APIs, and developer-friendly abstractions for automation workflows.\r\n\r\n[![License: Apache-2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\r\n[![TypeScript](https://img.shields.io/badge/TypeScript-5.6+-blue.svg)](https://www.typescriptlang.org/)\r\n[![Node.js](https://img.shields.io/badge/Node.js-18+-green.svg)](https://nodejs.org/)\r\n\r\n## Features\r\n\r\n- 🔐 **Flexible Authentication** - Multiple auth providers (API Key, Environment, File, Static)\r\n- 📦 **Resource Management** - Built-in support for Assets and Files\r\n- 🎯 **Type-Safe** - Full TypeScript support with comprehensive type definitions\r\n- 🔄 **Modern Architecture** - ESM and CJS support with tree-shaking\r\n- ⚡ **Performance** - Lazy initialization and efficient HTTP client\r\n- 🛡️ **Error Handling** - Comprehensive error types with detailed messages\r\n- 🧪 **Well-Tested** - Extensive test coverage with Vitest\r\n- 📝 **Developer-Friendly** - Intuitive API with JSDoc documentation\r\n\r\n## Installation\r\n\r\n```bash\r\nnpm install @akabot/agentic-sdk\r\n```\r\n\r\n```bash\r\nyarn add @akabot/agentic-sdk\r\n```\r\n\r\n```bash\r\npnpm add @akabot/agentic-sdk\r\n```\r\n\r\n## Quick Start\r\n\r\n### Basic Usage\r\n\r\n```typescript\r\nimport { AgenticClient } from '@akabot/agentic-sdk';\r\n\r\n// Create a client with default configuration\r\nconst client = new AgenticClient();\r\n\r\n// Use the client\r\nconst assets = await client.asset.findAll();\r\nconsole.log(assets);\r\n```\r\n\r\n### Using Environment Variables\r\n\r\n```typescript\r\nimport { AgenticClient, EnvironmentAuthProvider } from '@akabot/agentic-sdk';\r\n\r\n// Reads API key from environment variable\r\nconst client = new AgenticClient({\r\n  authProvider: new EnvironmentAuthProvider({\r\n    apiKeyEnvVar: 'MY_API_KEY',\r\n  }),\r\n});\r\n```\r\n\r\n### Using Default Authentication\r\n\r\n```typescript\r\nimport { AgenticClient } from '@akabot/agentic-sdk';\r\n\r\n// Uses DefaultAuthProvider with fallback chain:\r\n// 1. Environment variable (AGENTIC_API_KEY)\r\n// 2. Config file (.agentic/config.json)\r\n// 3. Throws error if not found\r\nconst client = new AgenticClient();\r\n```\r\n\r\n## Authentication\r\n\r\nThe SDK supports multiple authentication strategies through the `AuthProvider` interface.\r\n\r\n### Available Auth Providers\r\n\r\n#### 1. StaticAuthProvider\r\n\r\nUse a pre-configured `Auth` instance:\r\n\r\n```typescript\r\nimport { AgenticClient, ApiKeyAuth, StaticAuthProvider } from '@akabot/agentic-sdk';\r\n\r\nconst auth = new ApiKeyAuth('your-api-key');\r\nconst client = new AgenticClient({\r\n  authProvider: new StaticAuthProvider(auth),\r\n});\r\n```\r\n\r\n#### 2. EnvironmentAuthProvider\r\n\r\nLoad API key from environment variables:\r\n\r\n```typescript\r\nimport { EnvironmentAuthProvider } from '@akabot/agentic-sdk';\r\n\r\nconst provider = new EnvironmentAuthProvider({\r\n  apiKeyEnvVar: 'MY_API_KEY', // defaults to 'AGENTIC_API_KEY'\r\n});\r\n```\r\n\r\n#### 3. FileAuthProvider\r\n\r\nLoad credentials from a JSON file:\r\n\r\n```typescript\r\nimport { FileAuthProvider } from '@akabot/agentic-sdk';\r\n\r\nconst provider = new FileAuthProvider({\r\n  path: './config/credentials.json',\r\n});\r\n\r\n// credentials.json format:\r\n// {\r\n//   \"apiKey\": \"your-api-key\"\r\n// }\r\n```\r\n\r\n#### 4. DefaultAuthProvider\r\n\r\nTries multiple sources in order:\r\n\r\n```typescript\r\nimport { DefaultAuthProvider } from '@akabot/agentic-sdk';\r\n\r\nconst provider = new DefaultAuthProvider({\r\n  envVar: 'AGENTIC_API_KEY', // Optional: custom env var name\r\n  configPath: '.agentic/config.json', // Optional: custom config path\r\n});\r\n```\r\n\r\n## API Reference\r\n\r\n### AgenticClient\r\n\r\nThe main entry point for the SDK.\r\n\r\n```typescript\r\ninterface AgenticClientOptions {\r\n  baseURL?: string; // API base URL\r\n  authProvider?: AuthProvider; // Authentication provider\r\n  timeout?: number; // Request timeout in milliseconds\r\n}\r\n```\r\n\r\n### Resources\r\n\r\nThe SDK provides the following resource clients:\r\n\r\n#### Asset Resource\r\n\r\nManage assets with full CRUD operations:\r\n\r\n- `create()` - Create a new asset\r\n- `findAll()` - Find all assets with pagination\r\n- `search()` - Search assets by term\r\n- `filterAll()` - Filter assets by criteria\r\n- `findOne()` - Find a single asset by name\r\n- `update()` - Update an existing asset\r\n- `remove()` - Delete an asset\r\n\r\n**Example:**\r\n\r\n```typescript\r\nconst asset = await client.asset.create({\r\n  name: 'my-asset',\r\n  value: 'asset-value',\r\n  type: AssetType.TEXT,\r\n  scope: 'global',\r\n});\r\n\r\nconst pagedAssets = await client.asset.findAll({ page: 1, limit: 10 });\r\n```\r\n\r\n#### File Resource\r\n\r\nHandle file uploads and downloads with presigned URLs:\r\n\r\n- `create()` - Create and upload a file\r\n- `getFile()` - Get file metadata\r\n- `getDownloadLink()` - Get presigned download URL\r\n- `delete()` - Delete a file\r\n\r\n**Example:**\r\n\r\n```typescript\r\n// Node.js\r\nconst file = await client.file.create({\r\n  file: fileBuffer,\r\n  originalName: 'document.pdf',\r\n});\r\n\r\n// Browser\r\nconst file = await client.file.create({\r\n  file: inputFile.files[0],\r\n});\r\n\r\nconst downloadUrl = await client.file.getDownloadLink('file-id');\r\n```\r\n\r\n## Error Handling\r\n\r\nThe SDK provides comprehensive error types for different scenarios:\r\n\r\n```typescript\r\nimport { ResourceNotFoundError, UnauthorizedError } from '@akabot/agentic-sdk';\r\n\r\ntry {\r\n  const asset = await client.asset.findOne('non-existent');\r\n} catch (error) {\r\n  if (error instanceof ResourceNotFoundError) {\r\n    console.error('Asset not found');\r\n  } else if (error instanceof UnauthorizedError) {\r\n    console.error('Authentication failed');\r\n  }\r\n}\r\n```\r\n\r\nAvailable error types: `SdkError`, `ResourceNotFoundError`, `InvalidRequestError`, `UnauthorizedError`, `ForbiddenError`, `ConflictError`, `RateLimitError`, `ServerError`, `NetworkError`, `UnexpectedError`\r\n\r\n## Development\r\n\r\n```bash\r\n# Install dependencies\r\nnpm install\r\n\r\n# Run tests\r\nnpm test\r\n\r\n# Build the SDK\r\nnpm run build\r\n\r\n# Lint code\r\nnpm run lint\r\n```\r\n\r\n## License\r\n\r\nThis project is licensed under the Apache-2.0 License - see the [LICENSE](LICENSE) file for details.\r\n","readmeFilename":"README.md","_rev":"1-c944f378db9dddee8129a5fff1c34d43"}