39 lines
1.6 KiB
TypeScript
Raw Normal View History

/** Exact same-origin backend contracts required by the HUX-03 frontend. */
export const API_VERSION = "hux.v1";
export const ACCEPT = "application/vnd.hermes.hux+json; version=1";
export const RESPONSE_SCHEMAS = Object.freeze({
projects: "hux.projects.page.v1",
conversations: "hux.conversations.page.v1",
search: "hux.conversations.search.v1",
projectMutation: "hux.project.response.v1",
conversationMutation: "hux.conversation.response.v1",
});
/**
* GET /hux/v1/projects?cursor=&limit=
* GET /hux/v1/projects/{prj_id}/conversations?cursor=&limit=
* GET /hux/v1/conversations/search?q=&project_id=&tag=&pinned=&cursor=&limit=
* PATCH /hux/v1/projects/{prj_id}
* PATCH /hux/v1/conversations/{conv_id}
*
* Every response is JSON with api_version="hux.v1", its operation-specific
* schema, and identity={tenant_ref,user_ref,surface}. Page responses contain
* items, next_cursor (opaque or null), and total (non-negative integer or
* null). Mutation responses contain item. PATCH bodies use only name/title,
* project_id, tags, pinned, and required expected_updated_at for optimistic
* concurrency. Identity is derived from the authenticated server session and
* MUST NOT be accepted from a query, path, body, or browser storage. Moves MUST
* preserve conversation id, branch, and artifact_ids atomically. A 409 means
* stale expected_updated_at; 404 is not converted into an unscoped lookup.
*/
export const BACKEND_ENDPOINTS = Object.freeze({
projects: "/projects",
projectConversations: "/projects/{prj_id}/conversations",
search: "/conversations/search",
project: "/projects/{prj_id}",
conversation: "/conversations/{conv_id}",
});