⭐️ Shopify 網站開發服務(給品牌)
https://job.turn.tw/shopify-services
⭐️ 小網站開發服務(功能明確、規模不大的需求)
https://job.turn.tw/small-website-services
⭐️ 台灣 Shopify 商家交流 LINE 群(非官方)
https://line.me/ti/g2/PZ_1LILWVWWuzZQ50HNpYA-A3k6QXWF6znqoBQ
⭐️ 台灣 Shopify 開發者 LINE 群(非官方)
https://line.me/ti/g2/YUasX5K3CJ4QdIx76zppjHlh3-q8w-xkSyK1LA
非常神奇
網站的 ui for agent 是這樣製作的
Implement Hermes Agent Submission API
Add a small authenticated API for an external Hermes AI agent to discover the API contract, inspect existing records, and submit new events and registrations for human review.
The existing website already supports normal user submissions and admin review. Reuse the existing domain models, validation rules, enums/constants, image handling, and review workflow wherever possible. Do not create a parallel submission system unless necessary.
Before implementing, inspect the existing:
events/event_datesregistrationsKeep the implementation simple.
Goal
Hermes should be able to:
Authentication
Create a simple Bearer-token authentication mechanism suitable for one trusted internal agent.
Use environment/configuration rather than storing the token in source code.
For example:
Expose it through the appropriate config file.
All
/api/agent/*endpoints must require this authentication.Return standard JSON
401responses for invalid authentication.Do not introduce OAuth, Sanctum, API client management, or other unnecessary infrastructure unless the project already uses it and reuse is clearly simpler.
API endpoints
Implement:
Also make sure the existing OpenAPI/API documentation exposes these endpoints and their schemas in machine-readable form.
If the project already exposes something like:
reuse it.
Otherwise expose the generated OpenAPI JSON in the simplest way consistent with the project's existing API documentation tooling.
GET existing records
These endpoints exist primarily so Hermes can detect previously submitted content before creating another submission.
Return only fields useful for duplicate detection. Do not return the complete models.
Registration should return the equivalent relevant fields.
Include both published records and records currently waiting for review so Hermes does not repeatedly submit something that is already pending.
Past records do not need to be returned if the existing application intentionally hides/removes them from active data.
For the current MVP, returning all relevant records is acceptable. Do not implement pagination, vector search, fuzzy search, embeddings, or a dedicated duplicate-check endpoint yet.
Duplicate protection
Hermes will perform semantic duplicate detection itself by inspecting the GET responses.
The server should additionally implement a cheap deterministic safety check.
At minimum, if the normalized
source_urlalready belongs to an existing or pending record of the same domain type, reject the submission with:Example response:
Normalize URLs reasonably before comparison where appropriate, for example obvious trailing-slash differences.
Do NOT build sophisticated fuzzy duplicate detection.
POST event
Implement:
The request schema should mirror the existing event submission/domain model.
Do not blindly use this example as the authoritative schema.
Inspect the existing Event model, user submission form, migrations, constants/enums, and validation rules first, then make the API consistent with the real application.
The OpenAPI schema must explicitly document:
typevaluessportsvaluesregionvaluesadmission_typevaluesHermes should be able to construct a valid request from OpenAPI alone.
POST registration
Implement:
Follow the same principles.
Inspect the existing Registration model/schema and reuse its actual fields and validation.
Do not force Event-specific fields into Registration if they do not belong there.
Image ingestion
Do NOT expose Imgur or any storage-provider credentials to Hermes.
Do NOT require Hermes to upload the image separately.
The POST endpoints should accept:
This is the public URL of the original image discovered by Hermes.
The backend should:
If the project currently uses Imgur, keep Imgur behind this backend abstraction.
Hermes should never need to know whether images are stored on Imgur, S3, R2, local storage, etc.
Reuse existing image upload/storage services if available.
Add reasonable safeguards against bad remote image input:
http/httpsAlso protect the remote fetch against obvious SSRF risks: do not allow localhost, loopback, private/internal network addresses, link-local addresses, or other non-public destinations.
Avoid building a large generic media subsystem.
Review workflow
This is important:
Hermes must never be able to publish an Event or Registration.
Agent-created records must enter the same pending/draft state used by normal submissions and appear in the existing admin review interface.
The API must NOT accept fields such as:
from Hermes.
Status must be determined server-side.
Reuse the existing submission/review workflow rather than creating an agent-specific review UI.
Agent attribution
If the existing submission architecture has an appropriate place to identify the submitter/source, record that the submission came from Hermes.
Prefer the smallest clean change consistent with the current architecture.
For example conceptually:
Do not add these exact columns blindly if the current schema has a better mechanism.
The admin should ideally be able to tell that a pending submission came from Hermes.
我看 agent 提交的 就讓 user_id null 即可吧
Validation responses
Make validation errors useful to an AI client.
Use standard
422JSON responses and expose allowed enum values where practical.Example:
Do not maintain a second hard-coded list solely for the API. Reuse the application's authoritative constants/enums.
OpenAPI
The OpenAPI document is the authoritative machine-readable contract for Hermes.
Make sure it accurately documents:
including Bearer authentication.
A fresh agent reading the OpenAPI document should be able to determine:
409)Avoid maintaining a separate manually duplicated Hermes schema if the existing OpenAPI tooling can derive it from application validation/schema definitions.
Tests
Add focused feature tests covering at least:
Mock external HTTP/image requests in tests.
Keep the architecture small
This is an MVP for one trusted Hermes agent.
Do NOT add:
Prefer existing application abstractions and conventions.
After implementation: