Download the PHP package tmonier/sylius-b2b-sales-copilot-plugin without Composer
On this page you can find all versions of the php package tmonier/sylius-b2b-sales-copilot-plugin. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tmonier/sylius-b2b-sales-copilot-plugin
More information about tmonier/sylius-b2b-sales-copilot-plugin
Files in tmonier/sylius-b2b-sales-copilot-plugin
Package sylius-b2b-sales-copilot-plugin
Short Description AI-powered B2B purchasing assistant for Sylius 2: the buyer formulates their purchase request in natural language from their account, the copilot prepares the cart from past orders and quotes
License MIT
Informations about the package sylius-b2b-sales-copilot-plugin
Sylius B2B Sales Copilot Plugin
English | Français
Conversational purchasing assistant skeleton for Sylius 2 B2B: a widget in the customer account sends requests to a copilot model behind a port (CopilotModelInterface). This version ships the replay adapter only: answers come from pre-recorded cassettes, with no call to an LLM API.
Demo: https://sylius-b2b.thibaut-monier.fr
Author: Thibaut Monier
Features
- Conversational widget in the customer account dashboard (Stimulus, keyboard accessible, answers announced by a live region)
- Replay mode: recorded requests return their recorded answer; any other request returns « scénario non enregistré en démo »
- Access guard: the chat endpoint refuses anonymous visitors (401) and channels outside
enabled_channels(403); the widget is only rendered on enabled channels - Functional guardrails:
- Tool whitelist: only approved tools can be called
- Scope-based authorization: read tools require
b2b:readscope, modification tools requireb2b:cartscope - Rate limiting: maximum requests per member per day (configurable, default 50)
- Audit logging: all tool executions are logged to a dedicated channel
- Automatic refusal: checkout and payment operations are refused by design (security)
Natural-language actions on the store (reorder, quick add, quotes) through MCP tools are planned for a later version.
Requirements
- PHP
^8.2 - Sylius
^2.2.9 || ^2.3 - Symfony
^7.4 || ^8.0
Installation
Enable the bundle in config/bundles.php:
Import the routes in config/routes/tmonier_sylius_b2b_sales_copilot.yaml:
Register the widget controller in your shop assets entrypoint:
Configuration
List the channels where the copilot is available (B2B channels):
Recorded answers live in config/cassettes.jsonl (JSONL, one recorded request per line).
Audit logs are written to var/log/copilot_audit.log.
LLM integration (optional)
The plugin can call a real LLM via Symfony AI Platform. When the LLM is unavailable, the plugin falls back to replay mode transparently.
Set your API key via environment variable as documented by Symfony AI.
When ai.enabled is false (default), only the replay adapter is used — no LLM dependency is needed.
Supported Symfony AI version and path to 1.0
The plugin is tested against symfony/ai-platform ^0.15 (a single minor at a time: Symfony AI is pre-1.0 and every minor may break its API, so the constraint is never a range mixing incompatible APIs).
All Symfony AI code lives in one file, src/Infrastructure/SymfonyAi/SymfonyAiCopilotAdapter.php; the rest of the plugin only knows the CopilotModelInterface port. An architecture test (tests/Unit/Architecture/SymfonyAiConfinementTest.php) fails if a Symfony\AI\* class is referenced anywhere else. To move to 1.0, bump the constraint and adapt that adapter: tests/Unit/Infrastructure/SymfonyAi/SymfonyAiCopilotAdapterContractTest.php tells exactly what breaks.
Example cassette
Usage
A signed-in customer on an enabled channel sees the copilot widget on the account dashboard and can send a request. A recorded request (for example « état de mon panier ») returns its recorded answer.
The widget is hooked into sylius_shop.account.dashboard.index.content.main.section. A theme that replaces the dashboard can include it directly: {% include '@TmonierSyliusB2bSalesCopilotPlugin/account/copilot_widget.html.twig' %} (it renders nothing outside the enabled channels).
Screenshots
Development
Running tests
Code quality
License
MIT. See LICENSE file.
Author
Thibaut Monier
LinkedIn: https://www.linkedin.com/in/thibautmonier/
Contributing
Contributions are welcome. Please open an issue or pull request on GitHub.
All versions of sylius-b2b-sales-copilot-plugin with dependencies
sylius/sylius Version ^2.2.9 || ^2.3
symfony/clock Version ^6.4 || ^7.4 || ^8.0