Download the PHP package koh/sylius-agent-contracts without Composer
On this page you can find all versions of the php package koh/sylius-agent-contracts. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download koh/sylius-agent-contracts
More information about koh/sylius-agent-contracts
Files in koh/sylius-agent-contracts
Package sylius-agent-contracts
Short Description Shared contracts for the koh Sylius agent-readiness bundles: provider interfaces, DI tags, the channel-aware AgentContext and the single response-header listener.
License MIT
Homepage https://github.com/ohartwig/sylius-agent-contracts
Informations about the package sylius-agent-contracts
koh/sylius-agent-contracts
Shared contracts for the koh Sylius agent-readiness bundles.
This package serves no endpoint. It exists so that the granular
one-package-per-protocol split stays composable: /.well-known/api-catalog,
/.well-known/agent-skills/index.json, the A2A agent card, llms.txt, auth.md
and the Link: response headers all need to know what the other, independently
installable bundles offer — and none of them may depend on each other to find out.
Install
Configure
What you get
AgentContext
Resolved once per request, passed through every provider. Sylius has N channels where a CMS has one site, so every discovery document is channel- and locale-dependent.
AgentContext::cacheKey() is the only sanctioned way to build a cache key in
this package family. Skipping it is the classic multi-channel bug: one channel
warms the cache and every other channel is served its documents.
Depend on AgentContextFactoryInterface, not the concrete class — the
implementation reaches into Sylius' channel and locale contexts, which a unit
test of your listener has no business booting.
The factory resolves the channel in three stages — Sylius' channel context,
then a hostname lookup, then the first enabled channel. The fallback matters:
ChannelContextInterface throws when no channel matches the host, which is
exactly what a bot arriving over the bare IP, a preview hostname or a
misconfigured proxy produces. Unhandled, that turns every /.well-known/*
request into a 500 — the most common reason an agent-readiness scan fails on a
multi-channel shop.
Provider interfaces
Implement one (or several) and it is picked up automatically —
registerForAutoconfiguration() is registered container-wide, so this works for
services in your own App\ namespace with no wiring at all.
| Interface | DI tag | Consumed by |
|---|---|---|
AgentEndpointProviderInterface |
koh_agent.endpoint |
llms.txt, api-catalog |
ApiCatalogEntryProviderInterface |
koh_agent.api_catalog_entry |
api-catalog, Link: headers |
AgentSkillProviderInterface |
koh_agent.skill |
A2A card, agent-skills index, MCP |
LlmsTxtSectionProviderInterface |
koh_agent.llms_txt_section |
llms.txt, llms-full.txt |
MarkdownRepresentationProviderInterface |
koh_agent.markdown |
Accept: text/markdown |
AuthMethodDescriptorInterface |
koh_agent.auth_method |
auth.md, agent_auth metadata |
PayableOperationProviderInterface |
koh_agent.payable_operation |
MPP x-payment-info, x402 |
ResponseHeaderContributorInterface |
koh_agent.response_header |
the shared response listener |
PaymentBypassVoterInterface |
koh_agent.payment_bypass |
x402 |
Example — adding your own section to llms.txt:
AgentJsonResponder
One consistent response shape for every discovery document: public, max-age=3600, stale-while-revalidate=86400, an ETag (returning crawlers send
If-None-Match, and a 304 is far cheaper than a rebuild),
X-Content-Type-Options: nosniff and Access-Control-Allow-Origin: * — in-browser
agents read these cross-origin.
AgentResponseHeaderListener
The single kernel.response listener for the whole family. Link,
Content-Signal, Vary and CORS all land on the same response; with one
listener per bundle they overwrite each other depending on registration order.
The merge rules are enforced here:
Linkis appended, never replaced — Sylius and API Platform set their own (rel="preload", HydraapiDocumentation) and clobbering them breaks the app.Varyis merged, never replaced.
Deployment note
.well-known paths fall inside Sylius' shop firewall, which is stateful
(context: shop, remember_me). Without an exemption every bot hit starts a
session and the responses become uncacheable. Add a dedicated entry above
the Sylius firewalls — access_control is not enough, it is evaluated only
after the firewall has already matched:
Decommission
Removing the package is safe once no sibling bundle is installed: drop the
composer require, the entry in config/bundles.php, config/packages/koh_agent.yaml
and the koh_agent_public firewall. It owns no database table, no route and no
cache pool of its own.
Security
Report vulnerabilities privately — see SECURITY.md. Advisories are published as CSAF 2.0 at https://ole-hartwig.eu/.well-known/csaf/.
The family threat model, covering this package, is at https://github.com/ohartwig/sylius-agent-ready/blob/main/docs/threat-model.md.
Licence
MIT — see LICENSE.
All versions of sylius-agent-contracts with dependencies
sylius/sylius Version ^2.2.9 || ^2.3.0
symfony/config Version ^7.4 || ^8.0
symfony/console Version ^7.4 || ^8.0
symfony/dependency-injection Version ^7.4 || ^8.0
symfony/event-dispatcher Version ^7.4 || ^8.0
symfony/http-foundation Version ^7.4 || ^8.0
symfony/http-kernel Version ^7.4 || ^8.0
symfony/routing Version ^7.4 || ^8.0