{"_id":"@arkpad/extension-ai","_rev":"2-ba052e5238c3604839c7b64ee4617932","name":"@arkpad/extension-ai","dist-tags":{"latest":"1.0.3"},"versions":{"1.0.1":{"name":"@arkpad/extension-ai","version":"1.0.1","_id":"@arkpad/extension-ai@1.0.1","maintainers":[{"name":"vartik","email":"mailvartik@gmail.com"}],"dist":{"shasum":"8a3740489f1b1625cde8ca9990ecd2d61054e87b","tarball":"https://registry.npmjs.org/@arkpad/extension-ai/-/extension-ai-1.0.1.tgz","fileCount":5,"integrity":"sha512-7vM4zhEshEUqRMeFM1STglS9uCK2djZ6SADljj6u8VrocGhzyxSr2fTyWR0LkJrihAL1BjYM224u4iTUBhH/4w==","signatures":[{"sig":"MEUCIBaYIXamBk0bCQgoNQYdrKjBwHAfDJqDD6mPUYaGN0vMAiEAuxIKmzIgj7To57hsYXXychj9beRrb9axOc18R8PUgbg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":5280},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"gitHead":"8da55cf4a1a0dce25f8ed0564a8b76e6744a95b6","scripts":{"test":"vitest run","build":"tsc -p tsconfig.json","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"vartik","email":"mailvartik@gmail.com"},"_npmVersion":"11.11.0","directories":{},"_nodeVersion":"24.14.1","_hasShrinkwrap":false,"devDependencies":{"jsdom":"^29.1.1","vitest":"^4.1.6","prosemirror-model":"*"},"peerDependencies":{"@arkpad/core":"*"},"_npmOperationalInternal":{"tmp":"tmp/extension-ai_1.0.1_1779242982170_0.6539339936156601","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@arkpad/extension-ai","version":"1.0.3","type":"module","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"main":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"build":"tsc -p tsconfig.json","typecheck":"tsc -p tsconfig.json --noEmit","test":"vitest run"},"peerDependencies":{"@arkpad/core":"*"},"devDependencies":{"vitest":"^4.1.6","jsdom":"^29.1.1","prosemirror-model":"*"},"module":"./dist/index.js","repository":{"type":"git","url":"git+https://github.com/arkcabin/arkpad.git","directory":"packages/extension-ai"},"publishConfig":{"access":"public","provenance":true},"bugs":{"url":"https://github.com/arkcabin/arkpad/issues"},"homepage":"https://github.com/arkcabin/arkpad/tree/main/packages/extension-ai#readme","gitHead":"cb6e50df44dca6b9c7a8c1a5ddc7ad18a39c9ea9","_id":"@arkpad/extension-ai@1.0.3","description":"An AI assistance and autocomplete extension for the Arkpad editor. It provides native commands for context-aware autocompletion and text summarization using custom AI request handlers.","_nodeVersion":"20.20.2","_npmVersion":"11.14.1","dist":{"integrity":"sha512-45x5DDWz1D3zAmkRjqfz6ankqffJ2QXiqo10OJgu6SetT9QNozydrUMzpyQY802I4+TAn/XNyEL/wUmw3mZ9tQ==","shasum":"191ac6bd32bbc27c57b71b5c0ee2497ce56771aa","tarball":"https://registry.npmjs.org/@arkpad/extension-ai/-/extension-ai-1.0.3.tgz","fileCount":6,"unpackedSize":8016,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@arkpad%2fextension-ai@1.0.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBT7WTkEfm6nOcnM+aEy43KuFz8nf6jLK7av7nbSIdfuAiEA6RakM69BcIoR4g/t7lWV+O3hGBZ5da7xV3aJBwpM4gk="}]},"_npmUser":{"name":"vartik","email":"mailvartik@gmail.com"},"directories":{},"maintainers":[{"name":"vartik","email":"mailvartik@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/extension-ai_1.0.3_1779245283818_0.6040099541634638"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-20T02:09:42.041Z","modified":"2026-05-20T02:48:04.240Z","1.0.1":"2026-05-20T02:09:42.322Z","1.0.3":"2026-05-20T02:48:03.961Z"},"maintainers":[{"name":"vartik","email":"mailvartik@gmail.com"}],"readme":"# `@arkpad/extension-ai`\n\nAn AI assistance and autocomplete extension for the Arkpad editor. It provides native commands for context-aware autocompletion and text summarization using custom AI request handlers.\n\n## Installation\n\n```bash\nnpm install @arkpad/extension-ai\n```\n\n## Features\n\n- **Autocomplete (`aiComplete`)**: Automatically generates and inserts completions based on the preceding 500 characters of text.\n- **Summarize (`aiSummarize`)**: Summarizes the currently selected text and replaces or appends the summary in the document.\n- **Agentic Interceptor**: A hooks layer allowing validation or real-time assistance (e.g., smart correction, tone checking) on document updates.\n- **Reactive Storage**: Tracks AI operation states such as `isGenerating` and `lastError`.\n\n## Usage\n\n```typescript\nimport { ArkpadEditor } from \"@arkpad/core\";\nimport { AI } from \"@arkpad/extension-ai\";\n\nconst editor = new ArkpadEditor({\n  extensions: [\n    AI.configure({\n      enableInterceptor: true,\n      onAIRequest: async ({ command, text, context }) => {\n        if (command === \"complete\") {\n          // Call your LLM provider (e.g., OpenAI, Anthropic, Gemini)\n          const response = await fetch(\"/api/ai/complete\", {\n            method: \"POST\",\n            body: JSON.stringify({ prompt: text }),\n          });\n          const data = await response.json();\n          return data.completion;\n        }\n        \n        if (command === \"summarize\") {\n          const response = await fetch(\"/api/ai/summarize\", {\n            method: \"POST\",\n            body: JSON.stringify({ text }),\n          });\n          const data = await response.json();\n          return data.summary;\n        }\n\n        return \"\";\n      },\n    }),\n  ],\n});\n\n// Run commands\neditor.runCommand(\"aiComplete\");\neditor.runCommand(\"aiSummarize\");\n```\n\n## Storage API\n\nYou can subscribe to or query the extension's reactive state:\n\n```typescript\nconst isGenerating = editor.storage.ai.isGenerating; // boolean\nconst error = editor.storage.ai.lastError; // string | null\n```\n\n## API Exports\n\nThe main entry point (`src/index.ts`) exports the following:\n\n* **`AI`** (Default & Named export): The Arkpad extension initializer.\n* **`AIOptions`**: Configuration options interface:\n  * `onAIRequest`: Callback function invoked for `aiComplete` and `aiSummarize` commands.\n  * `enableInterceptor`: Boolean flag to enable or disable real-time document-change interception.\n\n","readmeFilename":"README.md","description":"An AI assistance and autocomplete extension for the Arkpad editor. It provides native commands for context-aware autocompletion and text summarization using custom AI request handlers.","homepage":"https://github.com/arkcabin/arkpad/tree/main/packages/extension-ai#readme","repository":{"type":"git","url":"git+https://github.com/arkcabin/arkpad.git","directory":"packages/extension-ai"},"bugs":{"url":"https://github.com/arkcabin/arkpad/issues"}}