{"_id":"@agentxin-ai/plugin-dify","name":"@agentxin-ai/plugin-dify","dist-tags":{"latest":"0.0.4"},"versions":{"0.0.4":{"name":"@agentxin-ai/plugin-dify","version":"0.0.4","repository":{"type":"git","url":"git+https://github.com/agentxin-ai/agentxin-plugins.git"},"type":"module","main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{"./package.json":"./package.json",".":{"@agentxin-plugins-starter/source":"./src/index.ts","types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"dependencies":{"tslib":"^2.3.0"},"peerDependencies":{"zod":"^3.25.67","@agentxin-ai/plugin-sdk":"^3.6.0","@metad/contracts":"^3.6.0","@nestjs/common":"^11.1.6","chalk":"^4.1.2","@langchain/core":"^0.3.72","lodash-es":"^4.17.21"},"_id":"@agentxin-ai/plugin-dify@0.0.4","description":"`@agentxin-ai/plugin-dify` brings [Dify](https://dify.ai/) into the AgentXin plugin ecosystem. It registers a NestJS module that exposes connection helpers and ships both integration and knowledge strategies so that Dify datasets can be queried from Agent","bugs":{"url":"https://github.com/agentxin-ai/agentxin-plugins/issues"},"homepage":"https://github.com/agentxin-ai/agentxin-plugins#readme","_nodeVersion":"22.22.0","_npmVersion":"10.9.4","dist":{"integrity":"sha512-/ZaDYEpxilkM/m0HZgDGix9ernA6ysXokstRIAZH7jZ1sOlyybiWfUkh9yPAw+uFMXp/ir6kUfp0dK+BQzYWHQ==","shasum":"a30bcc10d73d8036e9ca6b99511753534dd3c02a","tarball":"https://registry.npmjs.org/@agentxin-ai/plugin-dify/-/plugin-dify-0.0.4.tgz","fileCount":2,"unpackedSize":3925,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQC8YwUP5MGHSQdwHS4Dj8N2b791mT12yRm5bSludLBR+gIhAK3QOGpgomaOxPCyJLJMGSNLg1IgO0luLxIVsLwURVkU"}]},"_npmUser":{"name":"agentxin-ai","email":"1304040880@qq.com"},"directories":{},"maintainers":[{"name":"agentxin-ai","email":"1304040880@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/plugin-dify_0.0.4_1773917111614_0.882398158619164"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-19T10:45:11.551Z","0.0.4":"2026-03-19T10:45:11.747Z","modified":"2026-03-19T10:45:12.005Z"},"maintainers":[{"name":"agentxin-ai","email":"1304040880@qq.com"}],"description":"`@agentxin-ai/plugin-dify` brings [Dify](https://dify.ai/) into the AgentXin plugin ecosystem. It registers a NestJS module that exposes connection helpers and ships both integration and knowledge strategies so that Dify datasets can be queried from Agent","homepage":"https://github.com/agentxin-ai/agentxin-plugins#readme","repository":{"type":"git","url":"git+https://github.com/agentxin-ai/agentxin-plugins.git"},"bugs":{"url":"https://github.com/agentxin-ai/agentxin-plugins/issues"},"readme":"# AgentXin Plugin: Dify\n\n## Overview\n\n`@agentxin-ai/plugin-dify` brings [Dify](https://dify.ai/) into the AgentXin plugin ecosystem. It registers a NestJS module that exposes connection helpers and ships both integration and knowledge strategies so that Dify datasets can be queried from AgentXin workflows.\n\n## Features\n\n- Provides the `IntegrationDifyPlugin` NestJS module, mounted under `/dify`, with lifecycle logging on bootstrap and shutdown.\n- Implements a Dify integration strategy that publishes metadata (labels, docs, config schema) for the AgentXin integration catalogue.\n- Implements a knowledge strategy that calls the Dify `/v1/datasets/{knowledgebaseId}/retrieve` endpoint and returns LangChain `Document` chunks with similarity scores.\n- Exposes a `POST /dify/test` controller action that validates connection details against the target Dify server.\n\n## Installation\n\n```bash\nnpm install @agentxin-ai/plugin-dify\n```\n\n> **Peer dependencies:** the host project must already provide `@agentxin-ai/plugin-sdk`, `@nestjs/common`, `@metad/contracts`, `@langchain/core`, `chalk`, `lodash-es`, and `zod` (see `package.json` for exact versions).\n\nWhen using an Nx workspace, ensure the package lives inside the workspace `packages` folder or add it to your preferred structure.\n\n## Usage\n\nAdd this plugin to the `PLUGINS` environment variable when starting the AgentXinAI system, and it will be loaded automatically:\n\n```ts\nPLUGINS=@agentxin-ai/plugin-dify\n```\n\nOnce registered, the plugin contributes:\n\n- a `Dify` integration provider with configurable `url` and `apiKey` fields; and\n- a knowledge strategy keyed as `dify` for retrieving dataset chunks.\n\n## Connection Test Endpoint\n\nThe plugin adds a controller under `/dify`. To confirm credentials before saving an integration, call the test endpoint:\n\n```bash\ncurl -X POST https://<your-host>/dify/test \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n    \"options\": {\n      \"url\": \"https://dify.your-company.com\",\n      \"apiKey\": \"dify_api_key\"\n    }\n  }'\n```\n\nThe service normalises the URL (removing trailing `/` or `/v1`) and performs a `GET` request against the Dify `/v1` root. A `400 Bad Request` is thrown if mandatory properties are missing or the call fails.\n\n## Knowledge Retrieval Strategy\n\nWhen the knowledge strategy runs, it expects the payload to include:\n\n| Field | Description |\n| --- | --- |\n| `query` | User query text. |\n| `k` | Number of documents to retrieve. |\n| `options.knowledgebaseId` | The target Dify dataset identifier. |\n\nThe strategy posts to Dify using semantic search and returns an array of `[Document, score]` tuples that downstream LangChain components can consume.\n\n## Development\n\nFrom the monorepo root (`agentxinai/`), you can use Nx helpers:\n\n```bash\nnpx nx build @agentxin-ai/plugin-dify\nnpx nx test @agentxin-ai/plugin-dify\n```\n\n`nx build` compiles the library to `dist/`, and `nx test` executes the Jest suite (configured with SWC for TypeScript).\n\n## License\n\nThis project follows the [AGPL-3.0 License](../../../LICENSE) in the repository root.\n","readmeFilename":"README.md","_rev":"1-416573bee469deccbb75a098ca9e0c82"}