{"_id":"@aichatkit/apollo-adapter","_rev":"7-8a18e8d31f0016fcb6eb49829ec167b4","name":"@aichatkit/apollo-adapter","dist-tags":{"latest":"0.0.0-alpha.6"},"versions":{"0.0.0-alpha.0":{"name":"@aichatkit/apollo-adapter","version":"0.0.0-alpha.0","keywords":["chat","network","apollo","graphql","adapter","hypermode"],"author":{"name":"Hypermode"},"license":"MIT","_id":"@aichatkit/apollo-adapter@0.0.0-alpha.0","maintainers":[{"name":"danstarns","email":"danielstarns@hotmail.com"}],"homepage":"https://github.com/hypermodeinc/chatkit/tree/main/packages/apollo-adapter#readme","dist":{"shasum":"05101e605ea264173e96e149e3a8417da0610d04","tarball":"https://registry.npmjs.org/@aichatkit/apollo-adapter/-/apollo-adapter-0.0.0-alpha.0.tgz","fileCount":7,"integrity":"sha512-9dhyI7CVVhwBEyCJG7ZfZT6uhSBCrFj5M5XQXjsfLDd2qR8n3ngdhGa9hyx0QVx1hJfHLJeN6mEd3E36F5hCbg==","signatures":[{"sig":"MEUCIQDQTtuaspdJBRpatAVvIrIu43meXg6i+7qcq4QxTdmgQwIgBwd6Hd7xZe5RDNQFH2z056jkrOwFNSjxidan52yO+RM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":18951},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","gitHead":"ff46453f845c886e2819a16bfcee93f01706eabf","scripts":{"dev":"tsup src/index.ts --format cjs,esm --dts --watch","build":"tsup src/index.ts --format cjs,esm --dts"},"_npmUser":{"name":"danstarns","email":"danielstarns@hotmail.com"},"_npmVersion":"10.9.2","description":"Apollo GraphQL adapter for Hypermode ChatKit","directories":{},"_nodeVersion":"22.14.0","dependencies":{"@aichatkit/types":"workspace:^","@aichatkit/network-adapter":"workspace:^"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","typescript":"^5.0.0"},"peerDependencies":{"react":"^18.0.0 || ^19.0.0","graphql":"^16.8.0","@apollo/client":"^3.8.0"},"_npmOperationalInternal":{"tmp":"tmp/apollo-adapter_0.0.0-alpha.0_1748541624615_0.1075107485621829","host":"s3://npm-registry-packages-npm-production"}},"0.0.0-alpha.1":{"name":"@aichatkit/apollo-adapter","version":"0.0.0-alpha.1","keywords":["chat","network","apollo","graphql","adapter","hypermode"],"author":{"name":"Hypermode"},"license":"MIT","_id":"@aichatkit/apollo-adapter@0.0.0-alpha.1","maintainers":[{"name":"danstarns","email":"danielstarns@hotmail.com"}],"homepage":"https://github.com/hypermodeinc/chatkit/tree/main/packages/apollo-adapter#readme","dist":{"shasum":"69696e546b09296463230e9158a15edcafdd5324","tarball":"https://registry.npmjs.org/@aichatkit/apollo-adapter/-/apollo-adapter-0.0.0-alpha.1.tgz","fileCount":4,"integrity":"sha512-BXNGpRUbcrEvlSgNDNjkrFYW1oKuUC+c2Q/JYSbZp9PyBOmL7/R8qcvQCiTbik2PHWsN3ccHVdkSapv8ABqruQ==","signatures":[{"sig":"MEUCIGUPLWGzrQC3+22pXZpVm+2q8p0Gsvm92QBAy7kmrvQuAiEA6Ma7Jrxr3Hl6XXBQDPDPn21NKFW7MfmvsikX6FktxTU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":8574},"main":"dist/index.js","_from":"file:aichatkit-apollo-adapter-0.0.0-alpha.1.tgz","types":"dist/index.d.ts","module":"dist/index.mjs","scripts":{"dev":"tsup src/index.ts --format cjs,esm --dts --watch","build":"tsup src/index.ts --format cjs,esm --dts"},"_npmUser":{"name":"danstarns","email":"danielstarns@hotmail.com"},"_resolved":"/tmp/b47eb149f073b861a00661220567f797/aichatkit-apollo-adapter-0.0.0-alpha.1.tgz","_integrity":"sha512-BXNGpRUbcrEvlSgNDNjkrFYW1oKuUC+c2Q/JYSbZp9PyBOmL7/R8qcvQCiTbik2PHWsN3ccHVdkSapv8ABqruQ==","_npmVersion":"10.9.2","description":"Apollo GraphQL adapter for Hypermode ChatKit","directories":{},"_nodeVersion":"22.13.0","dependencies":{"@aichatkit/types":"0.0.0-alpha.1","@aichatkit/network-adapter":"0.0.0-alpha.1"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","typescript":"^5.0.0"},"peerDependencies":{"react":"^18.0.0 || ^19.0.0","graphql":"^16.8.0","@apollo/client":"^3.8.0"},"_npmOperationalInternal":{"tmp":"tmp/apollo-adapter_0.0.0-alpha.1_1748543213144_0.5640236451182319","host":"s3://npm-registry-packages-npm-production"}},"0.0.0-alpha.2":{"name":"@aichatkit/apollo-adapter","version":"0.0.0-alpha.2","keywords":["chat","network","apollo","graphql","adapter","hypermode"],"author":{"name":"Hypermode"},"license":"MIT","_id":"@aichatkit/apollo-adapter@0.0.0-alpha.2","maintainers":[{"name":"danstarns","email":"danielstarns@hotmail.com"}],"homepage":"https://github.com/hypermodeinc/chatkit/tree/main/packages/apollo-adapter#readme","dist":{"shasum":"7d2ff7100ac9cfbed2c288c852d4ad8cd9488070","tarball":"https://registry.npmjs.org/@aichatkit/apollo-adapter/-/apollo-adapter-0.0.0-alpha.2.tgz","fileCount":8,"integrity":"sha512-SadacmgxQOZtXx0mmssUQ05uTFuf66L+ezB4AZYi6HZ44n+n3CcjK3XKtQ6FZE+5Gn5PTg/mNkwd4qcRpFBL6Q==","signatures":[{"sig":"MEYCIQC/eso3Y/ogdTrSMsGNqREZ3vMG+DZfMdjPVKiNLzjyjAIhAO55vIaPvt1Xq72HKGCfp5LCuTLf7iD99Qz9gQobIIYR","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":20020},"main":"dist/index.js","_from":"file:aichatkit-apollo-adapter-0.0.0-alpha.2.tgz","types":"dist/index.d.ts","module":"dist/index.mjs","scripts":{"dev":"tsup src/index.ts --format cjs,esm --dts --watch","build":"tsup src/index.ts --format cjs,esm --dts"},"_npmUser":{"name":"danstarns","email":"danielstarns@hotmail.com"},"_resolved":"/tmp/899f619b7cffd43eadb13dc99b94d5f8/aichatkit-apollo-adapter-0.0.0-alpha.2.tgz","_integrity":"sha512-SadacmgxQOZtXx0mmssUQ05uTFuf66L+ezB4AZYi6HZ44n+n3CcjK3XKtQ6FZE+5Gn5PTg/mNkwd4qcRpFBL6Q==","_npmVersion":"10.9.2","description":"Apollo GraphQL adapter for Hypermode ChatKit","directories":{},"_nodeVersion":"22.13.0","dependencies":{"@aichatkit/types":"0.0.0-alpha.2","@aichatkit/network-adapter":"0.0.0-alpha.2"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","typescript":"^5.0.0"},"peerDependencies":{"react":"^18.0.0 || ^19.0.0","graphql":"^16.8.0","@apollo/client":"^3.8.0"},"_npmOperationalInternal":{"tmp":"tmp/apollo-adapter_0.0.0-alpha.2_1748544022194_0.3911563662907316","host":"s3://npm-registry-packages-npm-production"}},"0.0.0-alpha.3":{"name":"@aichatkit/apollo-adapter","version":"0.0.0-alpha.3","keywords":["chat","network","apollo","graphql","adapter","hypermode"],"author":{"name":"Hypermode"},"license":"MIT","_id":"@aichatkit/apollo-adapter@0.0.0-alpha.3","maintainers":[{"name":"danstarns","email":"danielstarns@hotmail.com"}],"homepage":"https://github.com/hypermodeinc/chatkit/tree/main/packages/apollo-adapter#readme","dist":{"shasum":"6bfe12292a7327c6a1c1def474a2575716d69cfc","tarball":"https://registry.npmjs.org/@aichatkit/apollo-adapter/-/apollo-adapter-0.0.0-alpha.3.tgz","fileCount":8,"integrity":"sha512-Hi1IMQhpyFzACeLxpO2zlAP5luyYa8O4K9mXjgLF8Xhc8YA+bxOiouLnOYg/9axKlBBxrxqt5dILo78tyiHK0g==","signatures":[{"sig":"MEQCIGbLCwDVMuuOO67d1DscsiQRWFbwOnixVJs8Rbvn3eHAAiBa+aTkORSdhLPBU6H+QcBRFBJvwfsW+jlLB8Rz1c5gPQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":20020},"main":"dist/index.js","_from":"file:aichatkit-apollo-adapter-0.0.0-alpha.3.tgz","types":"dist/index.d.ts","module":"dist/index.mjs","scripts":{"dev":"tsup src/index.ts --format cjs,esm --dts --watch","build":"tsup src/index.ts --format cjs,esm --dts"},"_npmUser":{"name":"danstarns","email":"danielstarns@hotmail.com"},"_resolved":"/tmp/72e4ae326aa89eb4ada31428f092571e/aichatkit-apollo-adapter-0.0.0-alpha.3.tgz","_integrity":"sha512-Hi1IMQhpyFzACeLxpO2zlAP5luyYa8O4K9mXjgLF8Xhc8YA+bxOiouLnOYg/9axKlBBxrxqt5dILo78tyiHK0g==","_npmVersion":"10.9.2","description":"Apollo GraphQL adapter for Hypermode ChatKit","directories":{},"_nodeVersion":"22.13.0","dependencies":{"@aichatkit/types":"0.0.0-alpha.3","@aichatkit/network-adapter":"0.0.0-alpha.3"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","typescript":"^5.0.0"},"peerDependencies":{"react":"^18.0.0 || ^19.0.0","graphql":"^16.8.0","@apollo/client":"^3.8.0"},"_npmOperationalInternal":{"tmp":"tmp/apollo-adapter_0.0.0-alpha.3_1748544376448_0.3215921467853393","host":"s3://npm-registry-packages-npm-production"}},"0.0.0-alpha.4":{"name":"@aichatkit/apollo-adapter","version":"0.0.0-alpha.4","keywords":["chat","network","apollo","graphql","adapter","hypermode"],"author":{"name":"Hypermode"},"license":"MIT","_id":"@aichatkit/apollo-adapter@0.0.0-alpha.4","maintainers":[{"name":"danstarns","email":"danielstarns@hotmail.com"}],"homepage":"https://github.com/hypermodeinc/chatkit/tree/main/packages/apollo-adapter#readme","dist":{"shasum":"c016b3fc670237eb2ec099bb2d00f19a906d5fd8","tarball":"https://registry.npmjs.org/@aichatkit/apollo-adapter/-/apollo-adapter-0.0.0-alpha.4.tgz","fileCount":8,"integrity":"sha512-Hmy3cAONwfIG2qu3m09WJtk1kiJNswwG68CgNMOm4/B+t9hMgkaWw0ULHi3N0jzi7eAGgBp6S24CPL0QfbjbQA==","signatures":[{"sig":"MEQCIFigZd4t6Y51mCTN9txcXrc8Y8se6FupjKXZvjHmjzEFAiBufwlhREa0Kc0EFu5pjYm/PRl8YlprRkxnW9KPX6MwXw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":21017},"main":"dist/index.js","_from":"file:aichatkit-apollo-adapter-0.0.0-alpha.4.tgz","types":"dist/index.d.ts","module":"dist/index.mjs","scripts":{"dev":"tsup src/index.ts --format cjs,esm --dts --watch","build":"tsup src/index.ts --format cjs,esm --dts"},"_npmUser":{"name":"danstarns","email":"danielstarns@hotmail.com"},"_resolved":"/tmp/d9660a355d4cb580b47adb2c4d038ff1/aichatkit-apollo-adapter-0.0.0-alpha.4.tgz","_integrity":"sha512-Hmy3cAONwfIG2qu3m09WJtk1kiJNswwG68CgNMOm4/B+t9hMgkaWw0ULHi3N0jzi7eAGgBp6S24CPL0QfbjbQA==","_npmVersion":"10.9.2","description":"Apollo GraphQL adapter for Hypermode ChatKit","directories":{},"_nodeVersion":"22.13.0","dependencies":{"@aichatkit/types":"0.0.0-alpha.4","@aichatkit/network-adapter":"0.0.0-alpha.4"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","typescript":"^5.0.0"},"peerDependencies":{"react":"^18.0.0 || ^19.0.0","graphql":"^16.8.0","@apollo/client":"^3.8.0"},"_npmOperationalInternal":{"tmp":"tmp/apollo-adapter_0.0.0-alpha.4_1748599499887_0.047772071385970394","host":"s3://npm-registry-packages-npm-production"}},"0.0.0-alpha.5":{"name":"@aichatkit/apollo-adapter","version":"0.0.0-alpha.5","keywords":["chat","network","apollo","graphql","adapter","hypermode"],"author":{"name":"Hypermode"},"license":"MIT","_id":"@aichatkit/apollo-adapter@0.0.0-alpha.5","maintainers":[{"name":"danstarns","email":"danielstarns@hotmail.com"}],"homepage":"https://github.com/hypermodeinc/chatkit/tree/main/packages/apollo-adapter#readme","dist":{"shasum":"f572763c30a9acdba5dd2dec9f12d619d43821ac","tarball":"https://registry.npmjs.org/@aichatkit/apollo-adapter/-/apollo-adapter-0.0.0-alpha.5.tgz","fileCount":8,"integrity":"sha512-cGKj1sZXEV2LscQI3/GI3hGkgvHqvOEF0a2u877TK142UnCiDpmmWqKkY/T7OVK6lLFLwAfcQ/wT5inYmg8eSw==","signatures":[{"sig":"MEUCIADXoFQCHD5nGirMo1Eve87M+uYW/12U+7F//l11yGyvAiEAhM2JPGZk+2NvAEit1516v7VY5uzNaVprLYRWNXAeIJc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":24814},"main":"dist/index.js","_from":"file:aichatkit-apollo-adapter-0.0.0-alpha.5.tgz","types":"dist/index.d.ts","module":"dist/index.mjs","scripts":{"dev":"tsup src/index.ts --format cjs,esm --dts --watch","build":"tsup src/index.ts --format cjs,esm --dts"},"_npmUser":{"name":"danstarns","actor":{"name":"danstarns","type":"user","email":"danielstarns@hotmail.com"},"email":"danielstarns@hotmail.com"},"_resolved":"/tmp/6caa4182174d54a01991b41b1f4c00f1/aichatkit-apollo-adapter-0.0.0-alpha.5.tgz","_integrity":"sha512-cGKj1sZXEV2LscQI3/GI3hGkgvHqvOEF0a2u877TK142UnCiDpmmWqKkY/T7OVK6lLFLwAfcQ/wT5inYmg8eSw==","_npmVersion":"10.9.2","description":"Apollo GraphQL adapter for Hypermode ChatKit","directories":{},"_nodeVersion":"22.13.0","dependencies":{"@aichatkit/types":"0.0.0-alpha.5","@aichatkit/network-adapter":"0.0.0-alpha.5"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","typescript":"^5.0.0"},"peerDependencies":{"react":"^18.0.0 || ^19.0.0","graphql":"^16.8.0","@apollo/client":"^3.8.0"},"_npmOperationalInternal":{"tmp":"tmp/apollo-adapter_0.0.0-alpha.5_1750312723159_0.36802842514129397","host":"s3://npm-registry-packages-npm-production"}},"0.0.0-alpha.6":{"name":"@aichatkit/apollo-adapter","version":"0.0.0-alpha.6","description":"Apollo GraphQL adapter for Hypermode ChatKit","main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","keywords":["chat","network","apollo","graphql","adapter","hypermode"],"author":{"name":"Hypermode"},"license":"MIT","homepage":"https://github.com/hypermodeinc/chatkit/tree/main/packages/apollo-adapter#readme","dependencies":{"@aichatkit/network-adapter":"0.0.0-alpha.6","@aichatkit/types":"0.0.0-alpha.6"},"peerDependencies":{"react":"^18.0.0 || ^19.0.0","@apollo/client":"^3.8.0","graphql":"^16.8.0"},"devDependencies":{"typescript":"^5.0.0","tsup":"^8.0.0"},"scripts":{"build":"tsup src/index.ts --format cjs,esm --dts","dev":"tsup src/index.ts --format cjs,esm --dts --watch"},"_id":"@aichatkit/apollo-adapter@0.0.0-alpha.6","_integrity":"sha512-S3X561bl7TAePxzWzFnEJ0Lbkc0mxZl21n9zAWxi9l03i09EmU6xlnWWQ8kC9IN+LOqsGyNi5tfjQbA3Tig+WQ==","_resolved":"/tmp/7cede1f6a09e94a682c3529371fb2b4a/aichatkit-apollo-adapter-0.0.0-alpha.6.tgz","_from":"file:aichatkit-apollo-adapter-0.0.0-alpha.6.tgz","_nodeVersion":"22.13.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-S3X561bl7TAePxzWzFnEJ0Lbkc0mxZl21n9zAWxi9l03i09EmU6xlnWWQ8kC9IN+LOqsGyNi5tfjQbA3Tig+WQ==","shasum":"6d9ecfac880c7a8ab87f67044a86082981db6721","tarball":"https://registry.npmjs.org/@aichatkit/apollo-adapter/-/apollo-adapter-0.0.0-alpha.6.tgz","fileCount":8,"unpackedSize":25462,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIECUj+dX3p0TIekI/0VZHzuqyT+bfKfY3Z2gI8E1juI8AiBlHEr/E59keolx22qCZZyTsFp4Vzbi/eO+S+VUkQ8JfA=="}]},"_npmUser":{"name":"danstarns","email":"danielstarns@hotmail.com","actor":{"name":"danstarns","email":"danielstarns@hotmail.com","type":"user"}},"directories":{},"maintainers":[{"name":"danstarns","email":"danielstarns@hotmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/apollo-adapter_0.0.0-alpha.6_1751223236313_0.9346906003893047"},"_hasShrinkwrap":false}},"time":{"created":"2025-05-29T18:00:24.502Z","modified":"2025-06-29T18:53:56.664Z","0.0.0-alpha.0":"2025-05-29T18:00:24.806Z","0.0.0-alpha.1":"2025-05-29T18:26:53.357Z","0.0.0-alpha.2":"2025-05-29T18:40:22.402Z","0.0.0-alpha.3":"2025-05-29T18:46:16.635Z","0.0.0-alpha.4":"2025-05-30T10:05:00.068Z","0.0.0-alpha.5":"2025-06-19T05:58:43.327Z","0.0.0-alpha.6":"2025-06-29T18:53:56.471Z"},"author":{"name":"Hypermode"},"license":"MIT","homepage":"https://github.com/hypermodeinc/chatkit/tree/main/packages/apollo-adapter#readme","keywords":["chat","network","apollo","graphql","adapter","hypermode"],"description":"Apollo GraphQL adapter for Hypermode ChatKit","maintainers":[{"name":"danstarns","email":"danielstarns@hotmail.com"}],"readme":"# @aichatkit/apollo-adapter\n\nApollo GraphQL implementation of the network adapter for Hypermode ChatKit with support for stateful\nchat agents and rich response items.\n\n## Installation\n\n```bash\nnpm install @aichatkit/apollo-adapter @apollo/client graphql\n```\n\n## Usage\n\n```typescript\nimport { ApolloAdapter } from \"@aichatkit/apollo-adapter\";\nimport { ChatInterface } from \"@aichatkit/ui\";\nimport { ApolloClient, InMemoryCache } from \"@apollo/client\";\n\n// Option 1: Create with configuration options\nconst networkAdapter = new ApolloAdapter({\n  apiUrl: \"http://localhost:8686/graphql\",\n  apiToken: \"your-auth-token\",\n  maxRetries: 3,\n});\n\n// Option 2: Create with existing Apollo Client\nconst client = new ApolloClient({\n  uri: \"http://localhost:8686/graphql\",\n  cache: new InMemoryCache(),\n});\n\nconst networkAdapter = new ApolloAdapter({\n  apolloClient: client,\n});\n\n// Use with ChatInterface\nfunction ChatApp() {\n  return (\n    <ChatInterface\n      networkAdapter={networkAdapter}\n      // other props...\n    />\n  );\n}\n```\n\n## Configuration Options\n\nThe `ApolloAdapter` constructor accepts an optional configuration object with the following\nproperties:\n\n- `apiUrl`: The GraphQL API URL (default: 'http://localhost:8686/graphql')\n- `apiToken`: Authentication token for the API\n- `maxRetries`: Maximum number of retry attempts for failed requests (default: 3)\n- `apolloClient`: Custom Apollo Client instance (if provided, other options will be ignored)\n\n## API Methods\n\nThe `ApolloAdapter` implements all methods from the base `NetworkAdapter`:\n\n### startChatAgent(): Promise<string>\n\nCreates a new chat agent and returns the agent ID.\n\n```typescript\nconst agentId = await adapter.startChatAgent()\n```\n\n### sendMessage(agentId: string, message: string): Promise<ChatResponse>\n\nSends a message to a chat agent and returns the response with rich content items.\n\n```typescript\nconst response = await adapter.sendMessage(agentId, \"Hello, world!\")\n// response contains an array of items: messages, tool calls, cards, etc.\n```\n\n### getConversationItems(agentId: string): Promise<ChatResponseItem[]>\n\nRetrieves all conversation items (messages, tool calls, cards) from the backend agent.\n\n```typescript\nconst items = await adapter.getConversationItems(agentId)\n// Returns array of mixed item types: messages, tool calls, cards\n```\n\n### getConversationHistory(agentId: string): Promise<Message[]>\n\nRetrieves only the message history from the backend agent.\n\n```typescript\nconst messages = await adapter.getConversationHistory(agentId)\n// Returns only message items, filtered from all response items\n```\n\n### clearConversationHistory(agentId: string): Promise<void>\n\nClears the conversation history on the backend agent.\n\n```typescript\nawait adapter.clearConversationHistory(agentId)\n```\n\n### stopChatAgent(agentId: string): Promise<void>\n\nStops/terminates a chat agent.\n\n```typescript\nawait adapter.stopChatAgent(agentId)\n```\n\n### getClient(): ApolloClient<NormalizedCacheObject>\n\nReturns the underlying Apollo Client instance for advanced usage.\n\n```typescript\nconst client = adapter.getClient()\n```\n\n## Response Items\n\nThe adapter supports rich response items including:\n\n### Message Items\n\nStandard chat messages from user or assistant.\n\n```typescript\n{\n  id: \"msg_123\",\n  type: \"message\",\n  content: \"Hello there!\",\n  role: \"assistant\",\n  timestamp: \"2024-01-01T00:00:00Z\"\n}\n```\n\n### Tool Call Items\n\nDisplays tool executions with arguments, status, and results.\n\n```typescript\n{\n  id: \"tool_123\",\n  type: \"tool_call\",\n  toolCall: {\n    id: \"call_123\",\n    name: \"get_weather\",\n    arguments: { location: \"New York\" },\n    status: \"completed\",\n    result: { temperature: \"22°C\", condition: \"Sunny\" }\n  }\n}\n```\n\n### Card Items\n\nRich content cards with structured data and actions.\n\n```typescript\n{\n  id: \"card_123\",\n  type: \"card\",\n  card: {\n    id: \"weather_card\",\n    type: \"weather\",\n    title: \"Weather Information\",\n    content: { location: \"New York\", temperature: \"22°C\" },\n    actions: [\n      {\n        id: \"view_forecast\",\n        label: \"View Forecast\",\n        type: \"button\",\n        action: \"show_forecast\"\n      }\n    ]\n  }\n}\n```\n\n## GraphQL Schema\n\nThe adapter expects the following GraphQL schema from your backend:\n\n```graphql\ntype Query {\n  # Start a new chat agent\n  createConversation: String!\n\n  # Send a message to an agent and get rich response items\n  continueChat(id: String!, query: String!): ChatResponse!\n\n  # Get all conversation items from an agent\n  chatHistory(id: String!): HistoryResponse!\n}\n\ntype Mutation {\n  # Clear conversation history for an agent\n  deleteConversationHistory(id: String!): Boolean!\n\n  # Stop/delete a chat agent\n  deleteAgent(id: String!): String!\n}\n\ntype ChatResponse {\n  items: String! # JSON string of ChatResponseItem array\n  conversationId: String!\n}\n\ntype HistoryResponse {\n  items: String! # JSON string of ChatResponseItem array\n  count: Int!\n}\n```\n\n## Agent-Based Architecture\n\nThis adapter is designed to work with Hypermode's stateful chat agents:\n\n1. **Agent Creation**: Each conversation starts by creating a new agent via `startChatAgent()`\n2. **Stateful Conversations**: Agents maintain conversation state including all response items\n3. **Rich Responses**: Agents can return messages, tool calls, cards, and other content types\n4. **Message Handling**: Messages are sent directly to specific agents\n5. **History Sync**: Full conversation state including all item types is stored on the agent\n6. **Agent Lifecycle**: Agents can be stopped/cleaned up when conversations are deleted\n\n## Example with Complete Setup\n\n```typescript\nimport { ApolloAdapter } from \"@aichatkit/apollo-adapter\";\nimport { LocalStorageAdapter } from \"@aichatkit/localstorage-adapter\";\nimport { ChatInterface } from \"@aichatkit/ui\";\nimport { ApolloClient, InMemoryCache, createHttpLink } from \"@apollo/client\";\nimport { setContext } from \"@apollo/client/link/context\";\n\n// Create Apollo Client with authentication\nconst httpLink = createHttpLink({\n  uri: \"http://localhost:8686/graphql\",\n});\n\nconst authLink = setContext((_, { headers }) => {\n  return {\n    headers: {\n      ...headers,\n      authorization: \"Bearer your-token-here\",\n    },\n  };\n});\n\nconst client = new ApolloClient({\n  link: authLink.concat(httpLink),\n  cache: new InMemoryCache(),\n});\n\n// Initialize adapters\nconst networkAdapter = new ApolloAdapter({ apolloClient: client });\nconst storageAdapter = new LocalStorageAdapter();\n\n// Connect storage with network for syncing\nawait storageAdapter.initialize();\nstorageAdapter.setNetworkCallbacks({\n  getConversationItems: (agentId) =>\n    networkAdapter.getConversationItems(agentId),\n  clearConversationHistory: (agentId) =>\n    networkAdapter.clearConversationHistory(agentId),\n});\n\n// Use in your app\nfunction App() {\n  return (\n    <ChatInterface\n      networkAdapter={networkAdapter}\n      storageAdapter={storageAdapter}\n      hypermodeStyle={true}\n      onCardAction={(action) => {\n        // Handle card button clicks\n        console.log(\"Card action:\", action);\n      }}\n    />\n  );\n}\n```\n\n## Error Handling\n\nThe adapter includes built-in error handling and retry logic:\n\n```typescript\n// Automatic retries for failed requests\nconst adapter = new ApolloAdapter({\n  maxRetries: 3,\n})\n\n// Handle errors in your application\ntry {\n  const response = await adapter.sendMessage(agentId, message)\n} catch (error) {\n  console.error(\"Failed to send message:\", error)\n  // Handle error appropriately\n}\n```\n\n## Compatibility\n\n- **Apollo Client**: 3.8.0+\n- **GraphQL**: 16.8.0+\n- **React**: 18.0.0+ or 19.0.0+\n\n## License\n\n[MIT](../../LICENSE) © Hypermode\n","readmeFilename":"README.md"}