Skip to content

api-reference: document the 8 AI SRE knowledge endpoints - #257

Merged
ysyneu merged 2 commits into
mainfrom
feat/knowledge-openapi
Aug 11, 2026
Merged

api-reference: document the 8 AI SRE knowledge endpoints#257
ysyneu merged 2 commits into
mainfrom
feat/knowledge-openapi

Conversation

@ysyneu

@ysyneu ysyneu commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

What

Adds OpenAPI documentation for the eight app_key-callable AI SRE knowledge APIs, under a new AI SRE/Knowledge tag (zh: AI SRE/知识):

Method Endpoint Operation
POST /safari/knowledge/pack/list List knowledge packs
POST /safari/knowledge/get Get account knowledge pack
POST /safari/knowledge/pack/ensure Ensure knowledge pack (idempotent create)
POST /safari/knowledge/pack/update Update knowledge pack (scope move)
POST /safari/knowledge/pack/delete Delete knowledge pack
POST /safari/knowledge/file/list List knowledge files
POST /safari/knowledge/file/get Get knowledge file (returns content_b64)
POST /safari/knowledge/file/put Upload knowledge file (base64 in JSON, not multipart)

The legacy /safari/knowledge/save-from-session route is not app_key-callable and is intentionally not documented.

Details

  • Request/response schemas are lifted from the backend handlers (KnowledgePackItem, KnowledgeFileItem, KnowledgeWarning + per-operation request/response schemas); epoch-millisecond fields are described as Unix timestamps in milliseconds so SDK generators map them correctly.
  • Each operation carries a Restrictions table (per-account rate limits from the gateway registry: reads 50/s + 1,000/min, writes 20/s + 300/min; write operations gated by the Knowledge Manage permission and audit-logged) plus Usage bullets for non-obvious behavior (lazy account-pack creation, scope-move conflict semantics, UTF-8-only content, base64 upload).
  • Response examples are real 200s captured from the dev API (list/get examples trimmed to 1–2 items; the temp file used for the file examples was deleted afterwards).
  • The 8 operations are merged into safari.openapi.{en,zh}.json (33 → 41 paths) and the consolidated openapi.{en,zh}.json (327 → 335 paths); EN/ZH files are structurally identical (same operationIds, schema keys, examples).
  • docs.json: new Knowledge/知识 subgroup (icon book) in the AI SRE group of both language navs with all 8 POST /safari/knowledge/... entries.
  • {en,zh}/openapi/api-catalog.mdx: new ### Knowledge/### 知识 table with 8 rows; AI SRE count 33 → 41, total 327 → 335.

Validation

  • python3 json.load on all four spec files + docs.json — OK.
  • Every spec path reachable from both the docs.json nav and both catalog pages (scripted check — no misses).
  • EN/ZH twin parity check (same path keys, operationIds, schema keys) — OK.
  • mint broken-links — no broken links found.

ysyneu added 2 commits August 11, 2026 07:43
Add OpenAPI operations for the app_key-callable knowledge pack and
knowledge file APIs under a new "AI SRE/Knowledge" tag:

- POST /safari/knowledge/pack/list, /get, /pack/ensure, /pack/update, /pack/delete
- POST /safari/knowledge/file/list, /file/get, /file/put

Each operation carries request/response schemas lifted from the
handlers, per-account rate limits from the gateway registry, a
Restrictions/Usage body, and real response examples captured from the
dev API. The 8 operations are merged into both safari.openapi.{en,zh}.json
and the consolidated openapi.{en,zh}.json (33 -> 41 AI SRE operations,
327 -> 335 total), the docs.json AI SRE nav gains a "Knowledge"/"知识"
subgroup, and both api-catalog pages get the matching table section.
Document POST /safari/knowledge/file/delete (knowledge-file-write-delete)
as the ninth knowledge operation, completing the app_key-callable
knowledge surface:

- FileDeleteRequest {pack_id, rel_path, force} -> FileDeleteResponse
  {warnings}, lifted from the handler.
- Restrictions: write-tier rate limits (20/s, 300/min per account),
  Knowledge Manage permission, audit-logged.
- Usage bullets cover idempotent deletes, the ReferenceExist/force
  behavior for still-referenced files, and the pack_id default.
- Response example is a real dev-API capture (temp file created via
  file/put, then deleted by the captured call).

docs.json gains the nav entry in both language subgroups; the catalogs
gain the table row and counts move to 42 AI SRE / 336 total.
@ysyneu
ysyneu merged commit 1a3b127 into main Aug 11, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant