Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

3500 řádky
92KB

  1. {
  2. "openapi": "3.0.3",
  3. "info": {
  4. "title": "Agent Memory API",
  5. "version": "1.0.0-phase3",
  6. "description": "Universal AI Agent Memory platform, phases 1-3: memories with revisions and verification, sessions with checkpoints, Markdown/text document ingestion with chunk locators, lexical search and recall, health. Authenticate with `Authorization: Bearer <api key>`; the tenant is derived from the key. Anything the caller cannot see is reported as 404. Phase 3: POST /context assembles a budgeted task briefing. Retrieval is hybrid (lexical + embeddings via a local Ollama model and a Qdrant index) and degrades to lexical with a warning. Relevance scores are ranking signals: negated bm25 when lexical, reciprocal-rank-fusion values when hybrid. Learning loop: experiences (POST /sessions/{id}/events), candidates proposed with POST /learn and reviewed by another principal (POST /candidates/{id}/review), evidence (GET /memories/{id}/sources) and feedback on retrieval results (POST /feedback, using the query_id of recall/search/context)."
  7. },
  8. "servers": [
  9. {
  10. "url": "/api/v1"
  11. }
  12. ],
  13. "components": {
  14. "securitySchemes": {
  15. "bearerAuth": {
  16. "type": "http",
  17. "scheme": "bearer"
  18. }
  19. },
  20. "schemas": {
  21. "Error": {
  22. "type": "object",
  23. "properties": {
  24. "error": {
  25. "type": "object",
  26. "properties": {
  27. "code": {
  28. "type": "string"
  29. },
  30. "message": {
  31. "type": "string"
  32. },
  33. "details": {
  34. "type": "array",
  35. "items": {
  36. "type": "string"
  37. }
  38. },
  39. "request_id": {
  40. "type": "string"
  41. }
  42. }
  43. }
  44. }
  45. },
  46. "RememberRequest": {
  47. "type": "object",
  48. "required": [
  49. "namespace_id",
  50. "type",
  51. "title",
  52. "content"
  53. ],
  54. "properties": {
  55. "namespace_id": {
  56. "type": "string",
  57. "format": "uuid"
  58. },
  59. "type": {
  60. "type": "string",
  61. "enum": [
  62. "working",
  63. "episodic",
  64. "semantic",
  65. "procedural",
  66. "preference",
  67. "decision",
  68. "constraint",
  69. "lesson",
  70. "hypothesis",
  71. "goal",
  72. "solution"
  73. ]
  74. },
  75. "title": {
  76. "type": "string",
  77. "maxLength": 200
  78. },
  79. "content": {
  80. "type": "string",
  81. "maxLength": 100000
  82. },
  83. "summary": {
  84. "type": "string",
  85. "maxLength": 2000,
  86. "nullable": true
  87. },
  88. "tags": {
  89. "type": "array",
  90. "items": {
  91. "type": "string",
  92. "maxLength": 64
  93. },
  94. "maxItems": 32
  95. },
  96. "attributes": {
  97. "type": "object",
  98. "description": "Free-form JSON object, max 16 KB"
  99. },
  100. "confidence": {
  101. "type": "number",
  102. "minimum": 0,
  103. "maximum": 1
  104. },
  105. "importance": {
  106. "type": "number",
  107. "minimum": 0,
  108. "maximum": 1
  109. }
  110. }
  111. },
  112. "RememberResponse": {
  113. "type": "object",
  114. "properties": {
  115. "id": {
  116. "type": "string",
  117. "format": "uuid"
  118. },
  119. "revision": {
  120. "type": "integer"
  121. },
  122. "status": {
  123. "type": "string"
  124. },
  125. "verification_status": {
  126. "type": "string"
  127. },
  128. "indexing_status": {
  129. "type": "string",
  130. "example": "not_indexed"
  131. },
  132. "duplicate": {
  133. "type": "boolean",
  134. "description": "true when an identical active memory already existed (HTTP 200)"
  135. }
  136. }
  137. },
  138. "Memory": {
  139. "type": "object",
  140. "properties": {
  141. "id": {
  142. "type": "string"
  143. },
  144. "namespace_id": {
  145. "type": "string"
  146. },
  147. "type": {
  148. "type": "string"
  149. },
  150. "status": {
  151. "type": "string",
  152. "enum": [
  153. "active",
  154. "retired",
  155. "superseded"
  156. ]
  157. },
  158. "current_revision": {
  159. "type": "integer"
  160. },
  161. "revision": {
  162. "type": "integer"
  163. },
  164. "verification_status": {
  165. "type": "string",
  166. "enum": [
  167. "unverified",
  168. "verified",
  169. "disputed",
  170. "rejected"
  171. ]
  172. },
  173. "title": {
  174. "type": "string"
  175. },
  176. "summary": {
  177. "type": "string",
  178. "nullable": true
  179. },
  180. "content": {
  181. "type": "string"
  182. },
  183. "attributes": {
  184. "type": "object",
  185. "nullable": true
  186. },
  187. "tags": {
  188. "type": "array",
  189. "items": {
  190. "type": "string"
  191. }
  192. },
  193. "confidence": {
  194. "type": "number",
  195. "nullable": true
  196. },
  197. "importance": {
  198. "type": "number",
  199. "nullable": true
  200. },
  201. "change_reason": {
  202. "type": "string",
  203. "nullable": true
  204. },
  205. "created_by": {
  206. "type": "string"
  207. },
  208. "created_at": {
  209. "type": "string"
  210. },
  211. "updated_at": {
  212. "type": "string"
  213. }
  214. }
  215. },
  216. "IngestRequest": {
  217. "type": "object",
  218. "required": [
  219. "namespace_id",
  220. "title",
  221. "content"
  222. ],
  223. "properties": {
  224. "namespace_id": {
  225. "type": "string",
  226. "format": "uuid"
  227. },
  228. "title": {
  229. "type": "string",
  230. "maxLength": 200
  231. },
  232. "content": {
  233. "type": "string",
  234. "maxLength": 262144
  235. },
  236. "format": {
  237. "type": "string",
  238. "enum": [
  239. "markdown",
  240. "text"
  241. ],
  242. "default": "markdown"
  243. },
  244. "source_uri": {
  245. "type": "string",
  246. "maxLength": 500,
  247. "description": "Identifier only; never fetched. The same source_uri in a namespace is one document."
  248. }
  249. }
  250. },
  251. "IngestResponse": {
  252. "type": "object",
  253. "properties": {
  254. "job": {
  255. "type": "object",
  256. "properties": {
  257. "id": {
  258. "type": "string"
  259. },
  260. "type": {
  261. "type": "string"
  262. },
  263. "state": {
  264. "type": "string"
  265. }
  266. }
  267. },
  268. "document_id": {
  269. "type": "string"
  270. },
  271. "revision": {
  272. "type": "integer"
  273. },
  274. "chunk_count": {
  275. "type": "integer"
  276. },
  277. "unchanged": {
  278. "type": "boolean",
  279. "description": "true when identical text was already the current revision (no new chunks)"
  280. },
  281. "indexing_status": {
  282. "type": "string",
  283. "example": "lexical_indexed"
  284. }
  285. }
  286. },
  287. "SearchRequest": {
  288. "type": "object",
  289. "required": [
  290. "query"
  291. ],
  292. "properties": {
  293. "query": {
  294. "type": "string",
  295. "maxLength": 1000
  296. },
  297. "namespace_ids": {
  298. "type": "array",
  299. "items": {
  300. "type": "string",
  301. "format": "uuid"
  302. }
  303. },
  304. "max_results": {
  305. "type": "integer",
  306. "minimum": 1,
  307. "maximum": 50
  308. },
  309. "detail_level": {
  310. "type": "string",
  311. "enum": [
  312. "full",
  313. "snippet"
  314. ]
  315. }
  316. }
  317. },
  318. "RecallRequest": {
  319. "type": "object",
  320. "required": [
  321. "query"
  322. ],
  323. "properties": {
  324. "query": {
  325. "type": "string",
  326. "maxLength": 1000
  327. },
  328. "namespace_ids": {
  329. "type": "array",
  330. "items": {
  331. "type": "string",
  332. "format": "uuid"
  333. }
  334. },
  335. "types": {
  336. "type": "array",
  337. "items": {
  338. "type": "string"
  339. }
  340. },
  341. "tags": {
  342. "type": "array",
  343. "items": {
  344. "type": "string"
  345. }
  346. },
  347. "max_results": {
  348. "type": "integer"
  349. },
  350. "detail_level": {
  351. "type": "string",
  352. "enum": [
  353. "full",
  354. "summary"
  355. ]
  356. },
  357. "verification_filter": {
  358. "type": "string",
  359. "enum": [
  360. "verified_only",
  361. "include_unverified"
  362. ],
  363. "default": "verified_only"
  364. }
  365. }
  366. },
  367. "VerifyRequest": {
  368. "type": "object",
  369. "required": [
  370. "result",
  371. "method",
  372. "revision"
  373. ],
  374. "properties": {
  375. "result": {
  376. "type": "string",
  377. "enum": [
  378. "verified",
  379. "disputed",
  380. "rejected"
  381. ]
  382. },
  383. "method": {
  384. "type": "string",
  385. "maxLength": 200
  386. },
  387. "notes": {
  388. "type": "string",
  389. "maxLength": 2000
  390. },
  391. "revision": {
  392. "type": "integer",
  393. "description": "Must be the current revision"
  394. }
  395. }
  396. },
  397. "SaveStateRequest": {
  398. "type": "object",
  399. "required": [
  400. "state"
  401. ],
  402. "properties": {
  403. "state": {
  404. "type": "object",
  405. "description": "Structured working state, max 64 KB"
  406. },
  407. "expected_revision": {
  408. "type": "integer"
  409. }
  410. }
  411. },
  412. "ContextRequest": {
  413. "type": "object",
  414. "required": [
  415. "task"
  416. ],
  417. "properties": {
  418. "task": {
  419. "type": "string",
  420. "maxLength": 2000,
  421. "description": "What the agent is about to do; used as the lexical query for decisions, lessons, knowledge and references."
  422. },
  423. "namespace_ids": {
  424. "type": "array",
  425. "items": {
  426. "type": "string"
  427. },
  428. "description": "Restrict to these namespaces (intersected with what the caller can read)."
  429. },
  430. "session_id": {
  431. "type": "string",
  432. "description": "Include the session's latest checkpoint as working_state. 404 when the session is not visible."
  433. },
  434. "include": {
  435. "type": "array",
  436. "items": {
  437. "type": "string",
  438. "enum": [
  439. "constraints",
  440. "preferences",
  441. "decisions",
  442. "lessons",
  443. "knowledge",
  444. "references",
  445. "working_state"
  446. ]
  447. },
  448. "description": "Sections to assemble (default all). Constraints and conflicts are always included."
  449. },
  450. "verification_filter": {
  451. "type": "string",
  452. "enum": [
  453. "verified_only",
  454. "include_unverified"
  455. ],
  456. "default": "verified_only"
  457. },
  458. "detail_level": {
  459. "type": "string",
  460. "enum": [
  461. "full",
  462. "summary"
  463. ],
  464. "default": "full",
  465. "description": "summary returns the stored summary (or first 240 characters); constraints are always full."
  466. },
  467. "max_context_tokens": {
  468. "type": "integer",
  469. "minimum": 100,
  470. "maximum": 32000,
  471. "default": 4000
  472. },
  473. "max_items": {
  474. "type": "integer",
  475. "minimum": 1,
  476. "maximum": 50,
  477. "default": 10,
  478. "description": "Per-section cap for conflicts, decisions, lessons, knowledge and unverified (preferences: 50)."
  479. },
  480. "max_references": {
  481. "type": "integer",
  482. "minimum": 0,
  483. "maximum": 20,
  484. "default": 5
  485. },
  486. "format": {
  487. "type": "string",
  488. "enum": [
  489. "structured"
  490. ],
  491. "default": "structured"
  492. }
  493. },
  494. "example": {
  495. "task": "Implement a customer repository",
  496. "session_id": "<session id>",
  497. "include": [
  498. "constraints",
  499. "decisions",
  500. "preferences",
  501. "lessons",
  502. "references",
  503. "working_state"
  504. ],
  505. "max_context_tokens": 4000
  506. }
  507. },
  508. "ContextResponse": {
  509. "type": "object",
  510. "description": "Sections in budget priority order: constraints (required), working_state, preferences, conflicts, decisions, lessons, knowledge, references, unverified. Memory items carry id, revision, type, namespace_id, title, content|summary, verification_status, content_trust (verified_memory|unverified_memory|disputed_memory), authority (policy for verified constraints), tags, confidence, importance, relevance_score (lexical matches), valid_until, provenance {created_by, updated_at} and token_estimate. References carry chunk/document ids, locator, content and content_trust untrusted_reference.",
  511. "properties": {
  512. "context_id": {
  513. "type": "string"
  514. },
  515. "task": {
  516. "type": "string"
  517. },
  518. "strategy": {
  519. "type": "string",
  520. "enum": [
  521. "hybrid",
  522. "lexical"
  523. ],
  524. "description": "hybrid when semantic retrieval ran for every section; lexical (with a warning) when it is not configured or unavailable"
  525. },
  526. "budget": {
  527. "type": "object",
  528. "properties": {
  529. "max_context_tokens": {
  530. "type": "integer"
  531. },
  532. "used_tokens": {
  533. "type": "integer"
  534. },
  535. "counting_method": {
  536. "type": "string",
  537. "example": "estimate_chars_div_4"
  538. },
  539. "complete": {
  540. "type": "boolean",
  541. "description": "False when not every applicable constraint/preference could be considered; do not treat the briefing as complete."
  542. },
  543. "truncated": {
  544. "type": "boolean",
  545. "description": "True when items were left out to fit the budget."
  546. }
  547. }
  548. },
  549. "omitted": {
  550. "type": "object",
  551. "properties": {
  552. "over_budget": {
  553. "type": "integer"
  554. },
  555. "over_limit": {
  556. "type": "integer"
  557. },
  558. "duplicates": {
  559. "type": "integer"
  560. },
  561. "unverified_excluded": {
  562. "type": "integer"
  563. }
  564. }
  565. },
  566. "constraints": {
  567. "type": "array",
  568. "items": {
  569. "type": "object"
  570. }
  571. },
  572. "working_state": {
  573. "type": "object",
  574. "nullable": true
  575. },
  576. "preferences": {
  577. "type": "array",
  578. "items": {
  579. "type": "object"
  580. }
  581. },
  582. "conflicts": {
  583. "type": "array",
  584. "items": {
  585. "type": "object"
  586. }
  587. },
  588. "decisions": {
  589. "type": "array",
  590. "items": {
  591. "type": "object"
  592. }
  593. },
  594. "lessons": {
  595. "type": "array",
  596. "items": {
  597. "type": "object"
  598. }
  599. },
  600. "knowledge": {
  601. "type": "array",
  602. "items": {
  603. "type": "object"
  604. }
  605. },
  606. "references": {
  607. "type": "array",
  608. "items": {
  609. "type": "object"
  610. }
  611. },
  612. "unverified": {
  613. "type": "array",
  614. "items": {
  615. "type": "object"
  616. },
  617. "description": "Only with verification_filter include_unverified."
  618. },
  619. "warnings": {
  620. "type": "array",
  621. "items": {
  622. "type": "string"
  623. }
  624. },
  625. "query_id": {
  626. "type": "string",
  627. "description": "Pass to POST /feedback to rate an included memory or reference"
  628. }
  629. }
  630. },
  631. "EvidenceInput": {
  632. "type": "object",
  633. "required": [
  634. "kind",
  635. "id"
  636. ],
  637. "properties": {
  638. "kind": {
  639. "type": "string",
  640. "enum": [
  641. "experience",
  642. "chunk",
  643. "memory",
  644. "document"
  645. ]
  646. },
  647. "id": {
  648. "type": "string",
  649. "format": "uuid"
  650. },
  651. "role": {
  652. "type": "string",
  653. "enum": [
  654. "supports",
  655. "contradicts",
  656. "context"
  657. ],
  658. "default": "supports"
  659. },
  660. "excerpt": {
  661. "type": "string",
  662. "maxLength": 2000
  663. }
  664. }
  665. },
  666. "ExperienceRequest": {
  667. "type": "object",
  668. "required": [
  669. "task",
  670. "outcome"
  671. ],
  672. "properties": {
  673. "task": {
  674. "type": "string",
  675. "maxLength": 2000
  676. },
  677. "outcome": {
  678. "type": "string",
  679. "enum": [
  680. "success",
  681. "failure",
  682. "partial",
  683. "unknown"
  684. ]
  685. },
  686. "problem": {
  687. "type": "string",
  688. "maxLength": 4000
  689. },
  690. "action": {
  691. "type": "string",
  692. "maxLength": 4000
  693. },
  694. "result": {
  695. "type": "string",
  696. "maxLength": 4000
  697. },
  698. "environment": {
  699. "type": "object",
  700. "description": "Free-form JSON object, max 16 KB"
  701. }
  702. }
  703. },
  704. "Experience": {
  705. "type": "object",
  706. "properties": {
  707. "id": {
  708. "type": "string"
  709. },
  710. "task": {
  711. "type": "string"
  712. },
  713. "problem": {
  714. "type": "string"
  715. },
  716. "action": {
  717. "type": "string"
  718. },
  719. "result": {
  720. "type": "string"
  721. },
  722. "outcome": {
  723. "type": "string"
  724. },
  725. "recorded_by": {
  726. "type": "string"
  727. },
  728. "created_at": {
  729. "type": "string"
  730. },
  731. "environment": {
  732. "type": "object",
  733. "nullable": true
  734. }
  735. }
  736. },
  737. "LearnRequest": {
  738. "type": "object",
  739. "required": [
  740. "namespace_id",
  741. "type",
  742. "title",
  743. "content"
  744. ],
  745. "properties": {
  746. "namespace_id": {
  747. "type": "string",
  748. "format": "uuid"
  749. },
  750. "type": {
  751. "type": "string"
  752. },
  753. "title": {
  754. "type": "string",
  755. "maxLength": 200
  756. },
  757. "content": {
  758. "type": "string",
  759. "maxLength": 100000
  760. },
  761. "summary": {
  762. "type": "string",
  763. "maxLength": 2000
  764. },
  765. "tags": {
  766. "type": "array",
  767. "items": {
  768. "type": "string"
  769. },
  770. "maxItems": 32
  771. },
  772. "confidence": {
  773. "type": "number",
  774. "minimum": 0,
  775. "maximum": 1
  776. },
  777. "target_memory_id": {
  778. "type": "string",
  779. "format": "uuid",
  780. "description": "Propose a new revision of this memory (same namespace and type)"
  781. },
  782. "base_revision": {
  783. "type": "integer",
  784. "description": "Required with target_memory_id: the revision the proposal is based on"
  785. },
  786. "evidence": {
  787. "type": "array",
  788. "maxItems": 20,
  789. "items": {
  790. "$ref": "#/components/schemas/EvidenceInput"
  791. }
  792. }
  793. }
  794. },
  795. "Candidate": {
  796. "type": "object",
  797. "properties": {
  798. "id": {
  799. "type": "string"
  800. },
  801. "namespace_id": {
  802. "type": "string"
  803. },
  804. "type": {
  805. "type": "string"
  806. },
  807. "title": {
  808. "type": "string"
  809. },
  810. "summary": {
  811. "type": "string",
  812. "nullable": true
  813. },
  814. "content": {
  815. "type": "string",
  816. "description": "Detail only"
  817. },
  818. "tags": {
  819. "type": "array",
  820. "items": {
  821. "type": "string"
  822. }
  823. },
  824. "confidence": {
  825. "type": "number",
  826. "nullable": true
  827. },
  828. "target_memory_id": {
  829. "type": "string",
  830. "nullable": true
  831. },
  832. "base_revision": {
  833. "type": "integer",
  834. "nullable": true
  835. },
  836. "state": {
  837. "type": "string",
  838. "enum": [
  839. "proposed",
  840. "accepted",
  841. "rejected"
  842. ]
  843. },
  844. "author": {
  845. "type": "string"
  846. },
  847. "reviewer": {
  848. "type": "string",
  849. "nullable": true
  850. },
  851. "review_notes": {
  852. "type": "string",
  853. "nullable": true
  854. },
  855. "resulting_memory_id": {
  856. "type": "string",
  857. "nullable": true
  858. },
  859. "resulting_revision": {
  860. "type": "integer",
  861. "nullable": true
  862. },
  863. "created_at": {
  864. "type": "string"
  865. },
  866. "reviewed_at": {
  867. "type": "string",
  868. "nullable": true
  869. },
  870. "content_trust": {
  871. "type": "string",
  872. "enum": [
  873. "proposed_knowledge"
  874. ]
  875. },
  876. "evidence": {
  877. "type": "array",
  878. "items": {
  879. "$ref": "#/components/schemas/EvidenceItem"
  880. },
  881. "description": "Detail only"
  882. }
  883. }
  884. },
  885. "EvidenceItem": {
  886. "type": "object",
  887. "properties": {
  888. "kind": {
  889. "type": "string"
  890. },
  891. "id": {
  892. "type": "string",
  893. "description": "Omitted when available is false"
  894. },
  895. "revision": {
  896. "type": "integer",
  897. "nullable": true,
  898. "description": "Target revision pinned when the link was made"
  899. },
  900. "available": {
  901. "type": "boolean",
  902. "description": "False when the target is gone or the caller cannot read it"
  903. },
  904. "role": {
  905. "type": "string"
  906. },
  907. "excerpt": {
  908. "type": "string",
  909. "nullable": true
  910. },
  911. "content_trust": {
  912. "type": "string",
  913. "enum": [
  914. "evidence",
  915. "untrusted_reference"
  916. ]
  917. }
  918. }
  919. },
  920. "ReviewRequest": {
  921. "type": "object",
  922. "required": [
  923. "decision"
  924. ],
  925. "properties": {
  926. "decision": {
  927. "type": "string",
  928. "enum": [
  929. "accept",
  930. "reject"
  931. ]
  932. },
  933. "notes": {
  934. "type": "string",
  935. "maxLength": 2000
  936. },
  937. "verify": {
  938. "type": "boolean",
  939. "default": false,
  940. "description": "Accept as verified (records a verification by the reviewer)"
  941. }
  942. }
  943. },
  944. "Sources": {
  945. "type": "object",
  946. "properties": {
  947. "memory_id": {
  948. "type": "string"
  949. },
  950. "revision": {
  951. "type": "integer"
  952. },
  953. "current_revision": {
  954. "type": "integer"
  955. },
  956. "from_candidate": {
  957. "type": "string",
  958. "nullable": true
  959. },
  960. "evidence": {
  961. "type": "array",
  962. "items": {
  963. "$ref": "#/components/schemas/EvidenceItem"
  964. }
  965. },
  966. "verifications": {
  967. "type": "array",
  968. "items": {
  969. "type": "object",
  970. "properties": {
  971. "method": {
  972. "type": "string"
  973. },
  974. "result": {
  975. "type": "string"
  976. },
  977. "notes": {
  978. "type": "string"
  979. },
  980. "reviewer": {
  981. "type": "string"
  982. },
  983. "created_at": {
  984. "type": "string"
  985. }
  986. }
  987. }
  988. }
  989. }
  990. },
  991. "FeedbackRequest": {
  992. "type": "object",
  993. "required": [
  994. "query_id",
  995. "result_id",
  996. "usefulness"
  997. ],
  998. "properties": {
  999. "query_id": {
  1000. "type": "string",
  1001. "description": "query_id returned by recall, search or context"
  1002. },
  1003. "result_id": {
  1004. "type": "string",
  1005. "format": "uuid",
  1006. "description": "Memory id or chunk id from that response"
  1007. },
  1008. "usefulness": {
  1009. "type": "string",
  1010. "enum": [
  1011. "useful",
  1012. "not_useful",
  1013. "incorrect",
  1014. "harmful"
  1015. ]
  1016. },
  1017. "comment": {
  1018. "type": "string",
  1019. "maxLength": 2000
  1020. }
  1021. }
  1022. },
  1023. "Feedback": {
  1024. "type": "object",
  1025. "properties": {
  1026. "id": {
  1027. "type": "string"
  1028. },
  1029. "query_id": {
  1030. "type": "string"
  1031. },
  1032. "target_kind": {
  1033. "type": "string",
  1034. "enum": [
  1035. "memory",
  1036. "chunk"
  1037. ]
  1038. },
  1039. "target_id": {
  1040. "type": "string"
  1041. },
  1042. "target_revision": {
  1043. "type": "integer"
  1044. },
  1045. "usefulness": {
  1046. "type": "string"
  1047. }
  1048. }
  1049. }
  1050. }
  1051. },
  1052. "paths": {
  1053. "/remember": {
  1054. "post": {
  1055. "summary": "Create a memory",
  1056. "security": [
  1057. {
  1058. "bearerAuth": []
  1059. }
  1060. ],
  1061. "parameters": [
  1062. {
  1063. "name": "Idempotency-Key",
  1064. "in": "header",
  1065. "required": false,
  1066. "description": "Replays the stored response for an identical body; a different body with the same key is 409.",
  1067. "schema": {
  1068. "type": "string",
  1069. "maxLength": 200
  1070. }
  1071. }
  1072. ],
  1073. "requestBody": {
  1074. "required": true,
  1075. "content": {
  1076. "application/json": {
  1077. "schema": {
  1078. "$ref": "#/components/schemas/RememberRequest"
  1079. }
  1080. }
  1081. }
  1082. },
  1083. "responses": {
  1084. "201": {
  1085. "description": "Created",
  1086. "content": {
  1087. "application/json": {
  1088. "schema": {
  1089. "$ref": "#/components/schemas/RememberResponse"
  1090. }
  1091. }
  1092. }
  1093. },
  1094. "200": {
  1095. "description": "Exact duplicate (or idempotent replay of a 200)",
  1096. "content": {
  1097. "application/json": {
  1098. "schema": {
  1099. "$ref": "#/components/schemas/RememberResponse"
  1100. }
  1101. }
  1102. }
  1103. },
  1104. "400": {
  1105. "description": "Invalid JSON / body",
  1106. "content": {
  1107. "application/json": {
  1108. "schema": {
  1109. "$ref": "#/components/schemas/Error"
  1110. }
  1111. }
  1112. }
  1113. },
  1114. "409": {
  1115. "description": "Idempotency-Key reused with a different body",
  1116. "content": {
  1117. "application/json": {
  1118. "schema": {
  1119. "$ref": "#/components/schemas/Error"
  1120. }
  1121. }
  1122. }
  1123. },
  1124. "422": {
  1125. "description": "Validation failed",
  1126. "content": {
  1127. "application/json": {
  1128. "schema": {
  1129. "$ref": "#/components/schemas/Error"
  1130. }
  1131. }
  1132. }
  1133. },
  1134. "401": {
  1135. "description": "Missing, invalid, revoked or expired API key",
  1136. "content": {
  1137. "application/json": {
  1138. "schema": {
  1139. "$ref": "#/components/schemas/Error"
  1140. }
  1141. }
  1142. }
  1143. },
  1144. "404": {
  1145. "description": "Not found or not visible to the caller",
  1146. "content": {
  1147. "application/json": {
  1148. "schema": {
  1149. "$ref": "#/components/schemas/Error"
  1150. }
  1151. }
  1152. }
  1153. },
  1154. "500": {
  1155. "description": "Internal error",
  1156. "content": {
  1157. "application/json": {
  1158. "schema": {
  1159. "$ref": "#/components/schemas/Error"
  1160. }
  1161. }
  1162. }
  1163. }
  1164. }
  1165. }
  1166. },
  1167. "/memories": {
  1168. "get": {
  1169. "summary": "List memories (newest first)",
  1170. "security": [
  1171. {
  1172. "bearerAuth": []
  1173. }
  1174. ],
  1175. "parameters": [
  1176. {
  1177. "name": "namespace_id",
  1178. "in": "query",
  1179. "schema": {
  1180. "type": "string",
  1181. "format": "uuid"
  1182. }
  1183. },
  1184. {
  1185. "name": "type",
  1186. "in": "query",
  1187. "schema": {
  1188. "type": "string"
  1189. }
  1190. },
  1191. {
  1192. "name": "status",
  1193. "in": "query",
  1194. "schema": {
  1195. "type": "string",
  1196. "enum": [
  1197. "active",
  1198. "retired",
  1199. "superseded",
  1200. "all"
  1201. ],
  1202. "default": "active"
  1203. }
  1204. },
  1205. {
  1206. "name": "verification_status",
  1207. "in": "query",
  1208. "schema": {
  1209. "type": "string",
  1210. "enum": [
  1211. "unverified",
  1212. "verified",
  1213. "disputed",
  1214. "rejected"
  1215. ]
  1216. }
  1217. },
  1218. {
  1219. "name": "limit",
  1220. "in": "query",
  1221. "schema": {
  1222. "type": "integer",
  1223. "minimum": 1,
  1224. "maximum": 100,
  1225. "default": 20
  1226. }
  1227. },
  1228. {
  1229. "name": "cursor",
  1230. "in": "query",
  1231. "description": "next_cursor from the previous page",
  1232. "schema": {
  1233. "type": "string"
  1234. }
  1235. }
  1236. ],
  1237. "responses": {
  1238. "200": {
  1239. "description": "Page of memories",
  1240. "content": {
  1241. "application/json": {
  1242. "schema": {
  1243. "type": "object",
  1244. "properties": {
  1245. "data": {
  1246. "type": "array",
  1247. "items": {
  1248. "$ref": "#/components/schemas/Memory"
  1249. }
  1250. },
  1251. "next_cursor": {
  1252. "type": "string",
  1253. "nullable": true
  1254. }
  1255. }
  1256. }
  1257. }
  1258. }
  1259. },
  1260. "400": {
  1261. "description": "Invalid cursor",
  1262. "content": {
  1263. "application/json": {
  1264. "schema": {
  1265. "$ref": "#/components/schemas/Error"
  1266. }
  1267. }
  1268. }
  1269. },
  1270. "422": {
  1271. "description": "Invalid filter",
  1272. "content": {
  1273. "application/json": {
  1274. "schema": {
  1275. "$ref": "#/components/schemas/Error"
  1276. }
  1277. }
  1278. }
  1279. },
  1280. "401": {
  1281. "description": "Missing, invalid, revoked or expired API key",
  1282. "content": {
  1283. "application/json": {
  1284. "schema": {
  1285. "$ref": "#/components/schemas/Error"
  1286. }
  1287. }
  1288. }
  1289. },
  1290. "404": {
  1291. "description": "Not found or not visible to the caller",
  1292. "content": {
  1293. "application/json": {
  1294. "schema": {
  1295. "$ref": "#/components/schemas/Error"
  1296. }
  1297. }
  1298. }
  1299. },
  1300. "500": {
  1301. "description": "Internal error",
  1302. "content": {
  1303. "application/json": {
  1304. "schema": {
  1305. "$ref": "#/components/schemas/Error"
  1306. }
  1307. }
  1308. }
  1309. }
  1310. }
  1311. }
  1312. },
  1313. "/memories/{id}": {
  1314. "get": {
  1315. "summary": "Get a memory (optionally an older revision)",
  1316. "security": [
  1317. {
  1318. "bearerAuth": []
  1319. }
  1320. ],
  1321. "parameters": [
  1322. {
  1323. "name": "id",
  1324. "in": "path",
  1325. "required": true,
  1326. "schema": {
  1327. "type": "string",
  1328. "format": "uuid"
  1329. }
  1330. },
  1331. {
  1332. "name": "revision",
  1333. "in": "query",
  1334. "schema": {
  1335. "type": "integer"
  1336. }
  1337. }
  1338. ],
  1339. "responses": {
  1340. "200": {
  1341. "description": "The memory",
  1342. "content": {
  1343. "application/json": {
  1344. "schema": {
  1345. "type": "object",
  1346. "properties": {
  1347. "data": {
  1348. "$ref": "#/components/schemas/Memory"
  1349. }
  1350. }
  1351. }
  1352. }
  1353. }
  1354. },
  1355. "401": {
  1356. "description": "Missing, invalid, revoked or expired API key",
  1357. "content": {
  1358. "application/json": {
  1359. "schema": {
  1360. "$ref": "#/components/schemas/Error"
  1361. }
  1362. }
  1363. }
  1364. },
  1365. "404": {
  1366. "description": "Not found or not visible to the caller",
  1367. "content": {
  1368. "application/json": {
  1369. "schema": {
  1370. "$ref": "#/components/schemas/Error"
  1371. }
  1372. }
  1373. }
  1374. },
  1375. "500": {
  1376. "description": "Internal error",
  1377. "content": {
  1378. "application/json": {
  1379. "schema": {
  1380. "$ref": "#/components/schemas/Error"
  1381. }
  1382. }
  1383. }
  1384. }
  1385. }
  1386. },
  1387. "patch": {
  1388. "summary": "Correct a memory: creates the next revision, unverified",
  1389. "security": [
  1390. {
  1391. "bearerAuth": []
  1392. }
  1393. ],
  1394. "parameters": [
  1395. {
  1396. "name": "id",
  1397. "in": "path",
  1398. "required": true,
  1399. "schema": {
  1400. "type": "string",
  1401. "format": "uuid"
  1402. }
  1403. },
  1404. {
  1405. "name": "If-Match",
  1406. "in": "header",
  1407. "required": false,
  1408. "description": "Current revision number (quoted ETag form accepted). Required unless expected_revision is in the body.",
  1409. "schema": {
  1410. "type": "string"
  1411. }
  1412. }
  1413. ],
  1414. "requestBody": {
  1415. "required": true,
  1416. "content": {
  1417. "application/json": {
  1418. "schema": {
  1419. "type": "object",
  1420. "properties": {
  1421. "title": {
  1422. "type": "string"
  1423. },
  1424. "summary": {
  1425. "type": "string"
  1426. },
  1427. "content": {
  1428. "type": "string"
  1429. },
  1430. "tags": {
  1431. "type": "array",
  1432. "items": {
  1433. "type": "string"
  1434. }
  1435. },
  1436. "attributes": {
  1437. "type": "object"
  1438. },
  1439. "confidence": {
  1440. "type": "number"
  1441. },
  1442. "importance": {
  1443. "type": "number"
  1444. },
  1445. "change_reason": {
  1446. "type": "string"
  1447. },
  1448. "expected_revision": {
  1449. "type": "integer"
  1450. }
  1451. }
  1452. }
  1453. }
  1454. }
  1455. },
  1456. "responses": {
  1457. "200": {
  1458. "description": "New revision",
  1459. "content": {
  1460. "application/json": {
  1461. "schema": {
  1462. "$ref": "#/components/schemas/RememberResponse"
  1463. }
  1464. }
  1465. }
  1466. },
  1467. "400": {
  1468. "description": "Bad body / revision",
  1469. "content": {
  1470. "application/json": {
  1471. "schema": {
  1472. "$ref": "#/components/schemas/Error"
  1473. }
  1474. }
  1475. }
  1476. },
  1477. "409": {
  1478. "description": "Memory is not active",
  1479. "content": {
  1480. "application/json": {
  1481. "schema": {
  1482. "$ref": "#/components/schemas/Error"
  1483. }
  1484. }
  1485. }
  1486. },
  1487. "412": {
  1488. "description": "Stale revision (ETag header carries the current one)",
  1489. "content": {
  1490. "application/json": {
  1491. "schema": {
  1492. "$ref": "#/components/schemas/Error"
  1493. }
  1494. }
  1495. }
  1496. },
  1497. "422": {
  1498. "description": "Validation failed",
  1499. "content": {
  1500. "application/json": {
  1501. "schema": {
  1502. "$ref": "#/components/schemas/Error"
  1503. }
  1504. }
  1505. }
  1506. },
  1507. "428": {
  1508. "description": "If-Match missing",
  1509. "content": {
  1510. "application/json": {
  1511. "schema": {
  1512. "$ref": "#/components/schemas/Error"
  1513. }
  1514. }
  1515. }
  1516. },
  1517. "401": {
  1518. "description": "Missing, invalid, revoked or expired API key",
  1519. "content": {
  1520. "application/json": {
  1521. "schema": {
  1522. "$ref": "#/components/schemas/Error"
  1523. }
  1524. }
  1525. }
  1526. },
  1527. "404": {
  1528. "description": "Not found or not visible to the caller",
  1529. "content": {
  1530. "application/json": {
  1531. "schema": {
  1532. "$ref": "#/components/schemas/Error"
  1533. }
  1534. }
  1535. }
  1536. },
  1537. "500": {
  1538. "description": "Internal error",
  1539. "content": {
  1540. "application/json": {
  1541. "schema": {
  1542. "$ref": "#/components/schemas/Error"
  1543. }
  1544. }
  1545. }
  1546. }
  1547. }
  1548. },
  1549. "delete": {
  1550. "summary": "Forget: permanently delete the memory and its revisions (needs delete permission)",
  1551. "security": [
  1552. {
  1553. "bearerAuth": []
  1554. }
  1555. ],
  1556. "parameters": [
  1557. {
  1558. "name": "id",
  1559. "in": "path",
  1560. "required": true,
  1561. "schema": {
  1562. "type": "string",
  1563. "format": "uuid"
  1564. }
  1565. }
  1566. ],
  1567. "responses": {
  1568. "200": {
  1569. "description": "Deleted"
  1570. },
  1571. "401": {
  1572. "description": "Missing, invalid, revoked or expired API key",
  1573. "content": {
  1574. "application/json": {
  1575. "schema": {
  1576. "$ref": "#/components/schemas/Error"
  1577. }
  1578. }
  1579. }
  1580. },
  1581. "404": {
  1582. "description": "Not found or not visible to the caller",
  1583. "content": {
  1584. "application/json": {
  1585. "schema": {
  1586. "$ref": "#/components/schemas/Error"
  1587. }
  1588. }
  1589. }
  1590. },
  1591. "500": {
  1592. "description": "Internal error",
  1593. "content": {
  1594. "application/json": {
  1595. "schema": {
  1596. "$ref": "#/components/schemas/Error"
  1597. }
  1598. }
  1599. }
  1600. }
  1601. }
  1602. }
  1603. },
  1604. "/memories/{id}/retire": {
  1605. "post": {
  1606. "summary": "Retire: exclude from ordinary listing",
  1607. "security": [
  1608. {
  1609. "bearerAuth": []
  1610. }
  1611. ],
  1612. "parameters": [
  1613. {
  1614. "name": "id",
  1615. "in": "path",
  1616. "required": true,
  1617. "schema": {
  1618. "type": "string",
  1619. "format": "uuid"
  1620. }
  1621. }
  1622. ],
  1623. "responses": {
  1624. "200": {
  1625. "description": "Retired"
  1626. },
  1627. "401": {
  1628. "description": "Missing, invalid, revoked or expired API key",
  1629. "content": {
  1630. "application/json": {
  1631. "schema": {
  1632. "$ref": "#/components/schemas/Error"
  1633. }
  1634. }
  1635. }
  1636. },
  1637. "404": {
  1638. "description": "Not found or not visible to the caller",
  1639. "content": {
  1640. "application/json": {
  1641. "schema": {
  1642. "$ref": "#/components/schemas/Error"
  1643. }
  1644. }
  1645. }
  1646. },
  1647. "500": {
  1648. "description": "Internal error",
  1649. "content": {
  1650. "application/json": {
  1651. "schema": {
  1652. "$ref": "#/components/schemas/Error"
  1653. }
  1654. }
  1655. }
  1656. }
  1657. }
  1658. }
  1659. },
  1660. "/memories/{id}/versions": {
  1661. "get": {
  1662. "summary": "Revision history, newest first",
  1663. "security": [
  1664. {
  1665. "bearerAuth": []
  1666. }
  1667. ],
  1668. "parameters": [
  1669. {
  1670. "name": "id",
  1671. "in": "path",
  1672. "required": true,
  1673. "schema": {
  1674. "type": "string",
  1675. "format": "uuid"
  1676. }
  1677. }
  1678. ],
  1679. "responses": {
  1680. "200": {
  1681. "description": "Revisions"
  1682. },
  1683. "401": {
  1684. "description": "Missing, invalid, revoked or expired API key",
  1685. "content": {
  1686. "application/json": {
  1687. "schema": {
  1688. "$ref": "#/components/schemas/Error"
  1689. }
  1690. }
  1691. }
  1692. },
  1693. "404": {
  1694. "description": "Not found or not visible to the caller",
  1695. "content": {
  1696. "application/json": {
  1697. "schema": {
  1698. "$ref": "#/components/schemas/Error"
  1699. }
  1700. }
  1701. }
  1702. },
  1703. "500": {
  1704. "description": "Internal error",
  1705. "content": {
  1706. "application/json": {
  1707. "schema": {
  1708. "$ref": "#/components/schemas/Error"
  1709. }
  1710. }
  1711. }
  1712. }
  1713. }
  1714. }
  1715. },
  1716. "/sessions": {
  1717. "post": {
  1718. "summary": "Start a session",
  1719. "security": [
  1720. {
  1721. "bearerAuth": []
  1722. }
  1723. ],
  1724. "parameters": [
  1725. {
  1726. "name": "Idempotency-Key",
  1727. "in": "header",
  1728. "required": false,
  1729. "description": "Replays the stored response for an identical body; a different body with the same key is 409.",
  1730. "schema": {
  1731. "type": "string",
  1732. "maxLength": 200
  1733. }
  1734. }
  1735. ],
  1736. "requestBody": {
  1737. "required": true,
  1738. "content": {
  1739. "application/json": {
  1740. "schema": {
  1741. "type": "object",
  1742. "required": [
  1743. "namespace_id",
  1744. "objective"
  1745. ],
  1746. "properties": {
  1747. "namespace_id": {
  1748. "type": "string",
  1749. "format": "uuid"
  1750. },
  1751. "objective": {
  1752. "type": "string",
  1753. "maxLength": 2000
  1754. }
  1755. }
  1756. }
  1757. }
  1758. }
  1759. },
  1760. "responses": {
  1761. "201": {
  1762. "description": "Started"
  1763. },
  1764. "422": {
  1765. "description": "Validation failed",
  1766. "content": {
  1767. "application/json": {
  1768. "schema": {
  1769. "$ref": "#/components/schemas/Error"
  1770. }
  1771. }
  1772. }
  1773. },
  1774. "409": {
  1775. "description": "Idempotency conflict",
  1776. "content": {
  1777. "application/json": {
  1778. "schema": {
  1779. "$ref": "#/components/schemas/Error"
  1780. }
  1781. }
  1782. }
  1783. },
  1784. "401": {
  1785. "description": "Missing, invalid, revoked or expired API key",
  1786. "content": {
  1787. "application/json": {
  1788. "schema": {
  1789. "$ref": "#/components/schemas/Error"
  1790. }
  1791. }
  1792. }
  1793. },
  1794. "404": {
  1795. "description": "Not found or not visible to the caller",
  1796. "content": {
  1797. "application/json": {
  1798. "schema": {
  1799. "$ref": "#/components/schemas/Error"
  1800. }
  1801. }
  1802. }
  1803. },
  1804. "500": {
  1805. "description": "Internal error",
  1806. "content": {
  1807. "application/json": {
  1808. "schema": {
  1809. "$ref": "#/components/schemas/Error"
  1810. }
  1811. }
  1812. }
  1813. }
  1814. }
  1815. }
  1816. },
  1817. "/sessions/{id}/state": {
  1818. "get": {
  1819. "summary": "Restore the latest checkpoint (revision 0 / state null when none)",
  1820. "security": [
  1821. {
  1822. "bearerAuth": []
  1823. }
  1824. ],
  1825. "parameters": [
  1826. {
  1827. "name": "id",
  1828. "in": "path",
  1829. "required": true,
  1830. "schema": {
  1831. "type": "string",
  1832. "format": "uuid"
  1833. }
  1834. }
  1835. ],
  1836. "responses": {
  1837. "200": {
  1838. "description": "Checkpoint; ETag = revision"
  1839. },
  1840. "401": {
  1841. "description": "Missing, invalid, revoked or expired API key",
  1842. "content": {
  1843. "application/json": {
  1844. "schema": {
  1845. "$ref": "#/components/schemas/Error"
  1846. }
  1847. }
  1848. }
  1849. },
  1850. "404": {
  1851. "description": "Not found or not visible to the caller",
  1852. "content": {
  1853. "application/json": {
  1854. "schema": {
  1855. "$ref": "#/components/schemas/Error"
  1856. }
  1857. }
  1858. }
  1859. },
  1860. "500": {
  1861. "description": "Internal error",
  1862. "content": {
  1863. "application/json": {
  1864. "schema": {
  1865. "$ref": "#/components/schemas/Error"
  1866. }
  1867. }
  1868. }
  1869. }
  1870. }
  1871. },
  1872. "put": {
  1873. "summary": "Save a checkpoint (If-Match = current checkpoint revision, 0 for the first)",
  1874. "security": [
  1875. {
  1876. "bearerAuth": []
  1877. }
  1878. ],
  1879. "parameters": [
  1880. {
  1881. "name": "id",
  1882. "in": "path",
  1883. "required": true,
  1884. "schema": {
  1885. "type": "string",
  1886. "format": "uuid"
  1887. }
  1888. },
  1889. {
  1890. "name": "If-Match",
  1891. "in": "header",
  1892. "required": false,
  1893. "description": "Current revision number (quoted ETag form accepted). Required unless expected_revision is in the body.",
  1894. "schema": {
  1895. "type": "string"
  1896. }
  1897. }
  1898. ],
  1899. "requestBody": {
  1900. "required": true,
  1901. "content": {
  1902. "application/json": {
  1903. "schema": {
  1904. "$ref": "#/components/schemas/SaveStateRequest"
  1905. }
  1906. }
  1907. }
  1908. },
  1909. "responses": {
  1910. "200": {
  1911. "description": "Saved; ETag = new revision"
  1912. },
  1913. "409": {
  1914. "description": "Session closed",
  1915. "content": {
  1916. "application/json": {
  1917. "schema": {
  1918. "$ref": "#/components/schemas/Error"
  1919. }
  1920. }
  1921. }
  1922. },
  1923. "412": {
  1924. "description": "Stale revision",
  1925. "content": {
  1926. "application/json": {
  1927. "schema": {
  1928. "$ref": "#/components/schemas/Error"
  1929. }
  1930. }
  1931. }
  1932. },
  1933. "422": {
  1934. "description": "Validation failed",
  1935. "content": {
  1936. "application/json": {
  1937. "schema": {
  1938. "$ref": "#/components/schemas/Error"
  1939. }
  1940. }
  1941. }
  1942. },
  1943. "428": {
  1944. "description": "If-Match missing",
  1945. "content": {
  1946. "application/json": {
  1947. "schema": {
  1948. "$ref": "#/components/schemas/Error"
  1949. }
  1950. }
  1951. }
  1952. },
  1953. "401": {
  1954. "description": "Missing, invalid, revoked or expired API key",
  1955. "content": {
  1956. "application/json": {
  1957. "schema": {
  1958. "$ref": "#/components/schemas/Error"
  1959. }
  1960. }
  1961. }
  1962. },
  1963. "404": {
  1964. "description": "Not found or not visible to the caller",
  1965. "content": {
  1966. "application/json": {
  1967. "schema": {
  1968. "$ref": "#/components/schemas/Error"
  1969. }
  1970. }
  1971. }
  1972. },
  1973. "500": {
  1974. "description": "Internal error",
  1975. "content": {
  1976. "application/json": {
  1977. "schema": {
  1978. "$ref": "#/components/schemas/Error"
  1979. }
  1980. }
  1981. }
  1982. }
  1983. }
  1984. }
  1985. },
  1986. "/sessions/{id}/complete": {
  1987. "post": {
  1988. "summary": "Complete a session",
  1989. "security": [
  1990. {
  1991. "bearerAuth": []
  1992. }
  1993. ],
  1994. "parameters": [
  1995. {
  1996. "name": "id",
  1997. "in": "path",
  1998. "required": true,
  1999. "schema": {
  2000. "type": "string",
  2001. "format": "uuid"
  2002. }
  2003. }
  2004. ],
  2005. "requestBody": {
  2006. "required": false,
  2007. "content": {
  2008. "application/json": {
  2009. "schema": {
  2010. "type": "object",
  2011. "properties": {
  2012. "outcome": {
  2013. "type": "string",
  2014. "maxLength": 4000
  2015. }
  2016. }
  2017. }
  2018. }
  2019. }
  2020. },
  2021. "responses": {
  2022. "200": {
  2023. "description": "Completed"
  2024. },
  2025. "409": {
  2026. "description": "Already closed",
  2027. "content": {
  2028. "application/json": {
  2029. "schema": {
  2030. "$ref": "#/components/schemas/Error"
  2031. }
  2032. }
  2033. }
  2034. },
  2035. "401": {
  2036. "description": "Missing, invalid, revoked or expired API key",
  2037. "content": {
  2038. "application/json": {
  2039. "schema": {
  2040. "$ref": "#/components/schemas/Error"
  2041. }
  2042. }
  2043. }
  2044. },
  2045. "404": {
  2046. "description": "Not found or not visible to the caller",
  2047. "content": {
  2048. "application/json": {
  2049. "schema": {
  2050. "$ref": "#/components/schemas/Error"
  2051. }
  2052. }
  2053. }
  2054. },
  2055. "500": {
  2056. "description": "Internal error",
  2057. "content": {
  2058. "application/json": {
  2059. "schema": {
  2060. "$ref": "#/components/schemas/Error"
  2061. }
  2062. }
  2063. }
  2064. }
  2065. }
  2066. }
  2067. },
  2068. "/memories/{id}/verifications": {
  2069. "post": {
  2070. "summary": "Record a verification of the current revision (needs the verify permission)",
  2071. "security": [
  2072. {
  2073. "bearerAuth": []
  2074. }
  2075. ],
  2076. "parameters": [
  2077. {
  2078. "name": "id",
  2079. "in": "path",
  2080. "required": true,
  2081. "schema": {
  2082. "type": "string",
  2083. "format": "uuid"
  2084. }
  2085. }
  2086. ],
  2087. "requestBody": {
  2088. "required": true,
  2089. "content": {
  2090. "application/json": {
  2091. "schema": {
  2092. "$ref": "#/components/schemas/VerifyRequest"
  2093. }
  2094. }
  2095. }
  2096. },
  2097. "responses": {
  2098. "200": {
  2099. "description": "Recorded; returns the new verification_status"
  2100. },
  2101. "409": {
  2102. "description": "Not the current revision",
  2103. "content": {
  2104. "application/json": {
  2105. "schema": {
  2106. "$ref": "#/components/schemas/Error"
  2107. }
  2108. }
  2109. }
  2110. },
  2111. "422": {
  2112. "description": "Validation failed",
  2113. "content": {
  2114. "application/json": {
  2115. "schema": {
  2116. "$ref": "#/components/schemas/Error"
  2117. }
  2118. }
  2119. }
  2120. },
  2121. "401": {
  2122. "description": "Missing, invalid, revoked or expired API key",
  2123. "content": {
  2124. "application/json": {
  2125. "schema": {
  2126. "$ref": "#/components/schemas/Error"
  2127. }
  2128. }
  2129. }
  2130. },
  2131. "404": {
  2132. "description": "Not found or not visible to the caller",
  2133. "content": {
  2134. "application/json": {
  2135. "schema": {
  2136. "$ref": "#/components/schemas/Error"
  2137. }
  2138. }
  2139. }
  2140. },
  2141. "500": {
  2142. "description": "Internal error",
  2143. "content": {
  2144. "application/json": {
  2145. "schema": {
  2146. "$ref": "#/components/schemas/Error"
  2147. }
  2148. }
  2149. }
  2150. }
  2151. }
  2152. }
  2153. },
  2154. "/recall": {
  2155. "post": {
  2156. "summary": "Hybrid recall over active memories (FTS5/bm25 fused with vector similarity by reciprocal rank fusion; lexical only, with a warning, when the embedding provider is off or down). Unverified memories are hidden unless verification_filter=include_unverified",
  2157. "security": [
  2158. {
  2159. "bearerAuth": []
  2160. }
  2161. ],
  2162. "requestBody": {
  2163. "required": true,
  2164. "content": {
  2165. "application/json": {
  2166. "schema": {
  2167. "$ref": "#/components/schemas/RecallRequest"
  2168. }
  2169. }
  2170. }
  2171. },
  2172. "responses": {
  2173. "200": {
  2174. "description": "Ranked results with warnings"
  2175. },
  2176. "422": {
  2177. "description": "Validation failed",
  2178. "content": {
  2179. "application/json": {
  2180. "schema": {
  2181. "$ref": "#/components/schemas/Error"
  2182. }
  2183. }
  2184. }
  2185. },
  2186. "401": {
  2187. "description": "Missing, invalid, revoked or expired API key",
  2188. "content": {
  2189. "application/json": {
  2190. "schema": {
  2191. "$ref": "#/components/schemas/Error"
  2192. }
  2193. }
  2194. }
  2195. },
  2196. "404": {
  2197. "description": "Not found or not visible to the caller",
  2198. "content": {
  2199. "application/json": {
  2200. "schema": {
  2201. "$ref": "#/components/schemas/Error"
  2202. }
  2203. }
  2204. }
  2205. },
  2206. "500": {
  2207. "description": "Internal error",
  2208. "content": {
  2209. "application/json": {
  2210. "schema": {
  2211. "$ref": "#/components/schemas/Error"
  2212. }
  2213. }
  2214. }
  2215. }
  2216. },
  2217. "description": " Feedback (POST /feedback) on a result's current revision adjusts its rank; such results carry feedback {useful, not_useful, incorrect_or_harmful} and demoted results are named in warnings."
  2218. }
  2219. },
  2220. "/ingestion/jobs": {
  2221. "post": {
  2222. "summary": "Ingest a Markdown/text document (chunked, indexed)",
  2223. "security": [
  2224. {
  2225. "bearerAuth": []
  2226. }
  2227. ],
  2228. "parameters": [
  2229. {
  2230. "name": "Idempotency-Key",
  2231. "in": "header",
  2232. "required": false,
  2233. "description": "Replays the stored response for an identical body; a different body with the same key is 409.",
  2234. "schema": {
  2235. "type": "string",
  2236. "maxLength": 200
  2237. }
  2238. }
  2239. ],
  2240. "requestBody": {
  2241. "required": true,
  2242. "content": {
  2243. "application/json": {
  2244. "schema": {
  2245. "$ref": "#/components/schemas/IngestRequest"
  2246. }
  2247. }
  2248. }
  2249. },
  2250. "responses": {
  2251. "201": {
  2252. "description": "Ingested (new document or new revision)",
  2253. "content": {
  2254. "application/json": {
  2255. "schema": {
  2256. "$ref": "#/components/schemas/IngestResponse"
  2257. }
  2258. }
  2259. }
  2260. },
  2261. "200": {
  2262. "description": "Unchanged or idempotent replay",
  2263. "content": {
  2264. "application/json": {
  2265. "schema": {
  2266. "$ref": "#/components/schemas/IngestResponse"
  2267. }
  2268. }
  2269. }
  2270. },
  2271. "400": {
  2272. "description": "Invalid JSON",
  2273. "content": {
  2274. "application/json": {
  2275. "schema": {
  2276. "$ref": "#/components/schemas/Error"
  2277. }
  2278. }
  2279. }
  2280. },
  2281. "409": {
  2282. "description": "Idempotency-Key reused with a different body",
  2283. "content": {
  2284. "application/json": {
  2285. "schema": {
  2286. "$ref": "#/components/schemas/Error"
  2287. }
  2288. }
  2289. }
  2290. },
  2291. "422": {
  2292. "description": "Validation failed",
  2293. "content": {
  2294. "application/json": {
  2295. "schema": {
  2296. "$ref": "#/components/schemas/Error"
  2297. }
  2298. }
  2299. }
  2300. },
  2301. "401": {
  2302. "description": "Missing, invalid, revoked or expired API key",
  2303. "content": {
  2304. "application/json": {
  2305. "schema": {
  2306. "$ref": "#/components/schemas/Error"
  2307. }
  2308. }
  2309. }
  2310. },
  2311. "404": {
  2312. "description": "Not found or not visible to the caller",
  2313. "content": {
  2314. "application/json": {
  2315. "schema": {
  2316. "$ref": "#/components/schemas/Error"
  2317. }
  2318. }
  2319. }
  2320. },
  2321. "500": {
  2322. "description": "Internal error",
  2323. "content": {
  2324. "application/json": {
  2325. "schema": {
  2326. "$ref": "#/components/schemas/Error"
  2327. }
  2328. }
  2329. }
  2330. }
  2331. }
  2332. }
  2333. },
  2334. "/jobs/{id}": {
  2335. "get": {
  2336. "summary": "Ingestion job state",
  2337. "security": [
  2338. {
  2339. "bearerAuth": []
  2340. }
  2341. ],
  2342. "parameters": [
  2343. {
  2344. "name": "id",
  2345. "in": "path",
  2346. "required": true,
  2347. "schema": {
  2348. "type": "string",
  2349. "format": "uuid"
  2350. }
  2351. }
  2352. ],
  2353. "responses": {
  2354. "200": {
  2355. "description": "Job"
  2356. },
  2357. "401": {
  2358. "description": "Missing, invalid, revoked or expired API key",
  2359. "content": {
  2360. "application/json": {
  2361. "schema": {
  2362. "$ref": "#/components/schemas/Error"
  2363. }
  2364. }
  2365. }
  2366. },
  2367. "404": {
  2368. "description": "Not found or not visible to the caller",
  2369. "content": {
  2370. "application/json": {
  2371. "schema": {
  2372. "$ref": "#/components/schemas/Error"
  2373. }
  2374. }
  2375. }
  2376. },
  2377. "500": {
  2378. "description": "Internal error",
  2379. "content": {
  2380. "application/json": {
  2381. "schema": {
  2382. "$ref": "#/components/schemas/Error"
  2383. }
  2384. }
  2385. }
  2386. }
  2387. }
  2388. }
  2389. },
  2390. "/documents/{id}": {
  2391. "get": {
  2392. "summary": "Document metadata (?include_content=true adds the normalized text)",
  2393. "security": [
  2394. {
  2395. "bearerAuth": []
  2396. }
  2397. ],
  2398. "parameters": [
  2399. {
  2400. "name": "id",
  2401. "in": "path",
  2402. "required": true,
  2403. "schema": {
  2404. "type": "string",
  2405. "format": "uuid"
  2406. }
  2407. },
  2408. {
  2409. "name": "include_content",
  2410. "in": "query",
  2411. "schema": {
  2412. "type": "boolean"
  2413. }
  2414. }
  2415. ],
  2416. "responses": {
  2417. "200": {
  2418. "description": "Document"
  2419. },
  2420. "401": {
  2421. "description": "Missing, invalid, revoked or expired API key",
  2422. "content": {
  2423. "application/json": {
  2424. "schema": {
  2425. "$ref": "#/components/schemas/Error"
  2426. }
  2427. }
  2428. }
  2429. },
  2430. "404": {
  2431. "description": "Not found or not visible to the caller",
  2432. "content": {
  2433. "application/json": {
  2434. "schema": {
  2435. "$ref": "#/components/schemas/Error"
  2436. }
  2437. }
  2438. }
  2439. },
  2440. "500": {
  2441. "description": "Internal error",
  2442. "content": {
  2443. "application/json": {
  2444. "schema": {
  2445. "$ref": "#/components/schemas/Error"
  2446. }
  2447. }
  2448. }
  2449. }
  2450. }
  2451. }
  2452. },
  2453. "/chunks/{id}": {
  2454. "get": {
  2455. "summary": "One chunk with heading path and source locator (character offsets into the normalized document text)",
  2456. "security": [
  2457. {
  2458. "bearerAuth": []
  2459. }
  2460. ],
  2461. "parameters": [
  2462. {
  2463. "name": "id",
  2464. "in": "path",
  2465. "required": true,
  2466. "schema": {
  2467. "type": "string",
  2468. "format": "uuid"
  2469. }
  2470. }
  2471. ],
  2472. "responses": {
  2473. "200": {
  2474. "description": "Chunk"
  2475. },
  2476. "401": {
  2477. "description": "Missing, invalid, revoked or expired API key",
  2478. "content": {
  2479. "application/json": {
  2480. "schema": {
  2481. "$ref": "#/components/schemas/Error"
  2482. }
  2483. }
  2484. }
  2485. },
  2486. "404": {
  2487. "description": "Not found or not visible to the caller",
  2488. "content": {
  2489. "application/json": {
  2490. "schema": {
  2491. "$ref": "#/components/schemas/Error"
  2492. }
  2493. }
  2494. }
  2495. },
  2496. "500": {
  2497. "description": "Internal error",
  2498. "content": {
  2499. "application/json": {
  2500. "schema": {
  2501. "$ref": "#/components/schemas/Error"
  2502. }
  2503. }
  2504. }
  2505. }
  2506. }
  2507. }
  2508. },
  2509. "/search": {
  2510. "post": {
  2511. "summary": "Hybrid search over current document chunks (lexical fused with vector similarity; lexical only, with a warning, when the embedding provider is off or down). Results are untrusted reference content",
  2512. "security": [
  2513. {
  2514. "bearerAuth": []
  2515. }
  2516. ],
  2517. "requestBody": {
  2518. "required": true,
  2519. "content": {
  2520. "application/json": {
  2521. "schema": {
  2522. "$ref": "#/components/schemas/SearchRequest"
  2523. }
  2524. }
  2525. }
  2526. },
  2527. "responses": {
  2528. "200": {
  2529. "description": "Ranked chunks with locators and content_trust"
  2530. },
  2531. "422": {
  2532. "description": "Validation failed",
  2533. "content": {
  2534. "application/json": {
  2535. "schema": {
  2536. "$ref": "#/components/schemas/Error"
  2537. }
  2538. }
  2539. }
  2540. },
  2541. "401": {
  2542. "description": "Missing, invalid, revoked or expired API key",
  2543. "content": {
  2544. "application/json": {
  2545. "schema": {
  2546. "$ref": "#/components/schemas/Error"
  2547. }
  2548. }
  2549. }
  2550. },
  2551. "404": {
  2552. "description": "Not found or not visible to the caller",
  2553. "content": {
  2554. "application/json": {
  2555. "schema": {
  2556. "$ref": "#/components/schemas/Error"
  2557. }
  2558. }
  2559. }
  2560. },
  2561. "500": {
  2562. "description": "Internal error",
  2563. "content": {
  2564. "application/json": {
  2565. "schema": {
  2566. "$ref": "#/components/schemas/Error"
  2567. }
  2568. }
  2569. }
  2570. }
  2571. },
  2572. "description": " Feedback (POST /feedback) on a result's current revision adjusts its rank; such results carry feedback {useful, not_useful, incorrect_or_harmful} and demoted results are named in warnings."
  2573. }
  2574. },
  2575. "/health/live": {
  2576. "get": {
  2577. "summary": "Liveness",
  2578. "responses": {
  2579. "200": {
  2580. "description": "Live"
  2581. }
  2582. }
  2583. }
  2584. },
  2585. "/health/ready": {
  2586. "get": {
  2587. "summary": "Readiness (database reachable)",
  2588. "responses": {
  2589. "200": {
  2590. "description": "Ready"
  2591. },
  2592. "503": {
  2593. "description": "Unavailable"
  2594. }
  2595. }
  2596. }
  2597. },
  2598. "/context": {
  2599. "post": {
  2600. "summary": "Assemble a token-budgeted task briefing: constraints by scope, working state, preferences, conflicts, hybrid matches and reference passages",
  2601. "security": [
  2602. {
  2603. "bearerAuth": []
  2604. }
  2605. ],
  2606. "requestBody": {
  2607. "required": true,
  2608. "content": {
  2609. "application/json": {
  2610. "schema": {
  2611. "$ref": "#/components/schemas/ContextRequest"
  2612. }
  2613. }
  2614. }
  2615. },
  2616. "responses": {
  2617. "200": {
  2618. "description": "Briefing",
  2619. "content": {
  2620. "application/json": {
  2621. "schema": {
  2622. "$ref": "#/components/schemas/ContextResponse"
  2623. }
  2624. }
  2625. }
  2626. },
  2627. "400": {
  2628. "description": "Empty body or invalid JSON",
  2629. "content": {
  2630. "application/json": {
  2631. "schema": {
  2632. "$ref": "#/components/schemas/Error"
  2633. }
  2634. }
  2635. }
  2636. },
  2637. "401": {
  2638. "description": "Missing, invalid, revoked or expired API key",
  2639. "content": {
  2640. "application/json": {
  2641. "schema": {
  2642. "$ref": "#/components/schemas/Error"
  2643. }
  2644. }
  2645. }
  2646. },
  2647. "404": {
  2648. "description": "session_id not found or not visible to the caller",
  2649. "content": {
  2650. "application/json": {
  2651. "schema": {
  2652. "$ref": "#/components/schemas/Error"
  2653. }
  2654. }
  2655. }
  2656. },
  2657. "422": {
  2658. "description": "Validation failed, unsupported_character (code points above U+FFFF), or context_budget_exceeded (the applicable constraints do not fit max_context_tokens; the error also carries required_tokens)",
  2659. "content": {
  2660. "application/json": {
  2661. "schema": {
  2662. "$ref": "#/components/schemas/Error"
  2663. }
  2664. }
  2665. }
  2666. },
  2667. "500": {
  2668. "description": "Internal error",
  2669. "content": {
  2670. "application/json": {
  2671. "schema": {
  2672. "$ref": "#/components/schemas/Error"
  2673. }
  2674. }
  2675. }
  2676. }
  2677. }
  2678. }
  2679. },
  2680. "/sessions/{id}/events": {
  2681. "post": {
  2682. "summary": "Record an experience (task, problem, action, result, outcome) in an active session",
  2683. "tags": [
  2684. "learning"
  2685. ],
  2686. "security": [
  2687. {
  2688. "bearerAuth": []
  2689. }
  2690. ],
  2691. "parameters": [
  2692. {
  2693. "name": "id",
  2694. "in": "path",
  2695. "required": true,
  2696. "schema": {
  2697. "type": "string",
  2698. "format": "uuid"
  2699. }
  2700. },
  2701. {
  2702. "name": "Idempotency-Key",
  2703. "in": "header",
  2704. "required": false,
  2705. "schema": {
  2706. "type": "string",
  2707. "maxLength": 200
  2708. },
  2709. "description": "Replays the stored response for a repeated request; 409 if reused with a different body."
  2710. }
  2711. ],
  2712. "requestBody": {
  2713. "required": true,
  2714. "content": {
  2715. "application/json": {
  2716. "schema": {
  2717. "$ref": "#/components/schemas/ExperienceRequest"
  2718. }
  2719. }
  2720. }
  2721. },
  2722. "responses": {
  2723. "201": {
  2724. "description": "Recorded",
  2725. "content": {
  2726. "application/json": {
  2727. "schema": {
  2728. "type": "object",
  2729. "properties": {
  2730. "id": {
  2731. "type": "string"
  2732. },
  2733. "session_id": {
  2734. "type": "string"
  2735. },
  2736. "outcome": {
  2737. "type": "string"
  2738. },
  2739. "created_at": {
  2740. "type": "string"
  2741. }
  2742. }
  2743. }
  2744. }
  2745. }
  2746. },
  2747. "400": {
  2748. "description": "Empty body, invalid JSON or invalid Idempotency-Key",
  2749. "content": {
  2750. "application/json": {
  2751. "schema": {
  2752. "$ref": "#/components/schemas/Error"
  2753. }
  2754. }
  2755. }
  2756. },
  2757. "401": {
  2758. "description": "Missing, invalid, revoked or expired API key",
  2759. "content": {
  2760. "application/json": {
  2761. "schema": {
  2762. "$ref": "#/components/schemas/Error"
  2763. }
  2764. }
  2765. }
  2766. },
  2767. "404": {
  2768. "description": "Session not found, or no write permission on its namespace",
  2769. "content": {
  2770. "application/json": {
  2771. "schema": {
  2772. "$ref": "#/components/schemas/Error"
  2773. }
  2774. }
  2775. }
  2776. },
  2777. "409": {
  2778. "description": "session_not_active (completed session) or idempotency_conflict",
  2779. "content": {
  2780. "application/json": {
  2781. "schema": {
  2782. "$ref": "#/components/schemas/Error"
  2783. }
  2784. }
  2785. }
  2786. },
  2787. "422": {
  2788. "description": "Validation failed or unsupported_character",
  2789. "content": {
  2790. "application/json": {
  2791. "schema": {
  2792. "$ref": "#/components/schemas/Error"
  2793. }
  2794. }
  2795. }
  2796. },
  2797. "500": {
  2798. "description": "Internal error",
  2799. "content": {
  2800. "application/json": {
  2801. "schema": {
  2802. "$ref": "#/components/schemas/Error"
  2803. }
  2804. }
  2805. }
  2806. }
  2807. }
  2808. },
  2809. "get": {
  2810. "summary": "List the experiences of a session, oldest first (max 200)",
  2811. "tags": [
  2812. "learning"
  2813. ],
  2814. "security": [
  2815. {
  2816. "bearerAuth": []
  2817. }
  2818. ],
  2819. "parameters": [
  2820. {
  2821. "name": "id",
  2822. "in": "path",
  2823. "required": true,
  2824. "schema": {
  2825. "type": "string",
  2826. "format": "uuid"
  2827. }
  2828. }
  2829. ],
  2830. "responses": {
  2831. "200": {
  2832. "description": "Experiences",
  2833. "content": {
  2834. "application/json": {
  2835. "schema": {
  2836. "type": "object",
  2837. "properties": {
  2838. "session_id": {
  2839. "type": "string"
  2840. },
  2841. "data": {
  2842. "type": "array",
  2843. "items": {
  2844. "$ref": "#/components/schemas/Experience"
  2845. }
  2846. }
  2847. }
  2848. }
  2849. }
  2850. }
  2851. },
  2852. "401": {
  2853. "description": "Missing, invalid, revoked or expired API key",
  2854. "content": {
  2855. "application/json": {
  2856. "schema": {
  2857. "$ref": "#/components/schemas/Error"
  2858. }
  2859. }
  2860. }
  2861. },
  2862. "404": {
  2863. "description": "Session not found or not readable",
  2864. "content": {
  2865. "application/json": {
  2866. "schema": {
  2867. "$ref": "#/components/schemas/Error"
  2868. }
  2869. }
  2870. }
  2871. },
  2872. "500": {
  2873. "description": "Internal error",
  2874. "content": {
  2875. "application/json": {
  2876. "schema": {
  2877. "$ref": "#/components/schemas/Error"
  2878. }
  2879. }
  2880. }
  2881. }
  2882. }
  2883. }
  2884. },
  2885. "/learn": {
  2886. "post": {
  2887. "summary": "Propose knowledge as a learning candidate (a new memory, or a new revision of target_memory_id at base_revision), with evidence",
  2888. "tags": [
  2889. "learning"
  2890. ],
  2891. "security": [
  2892. {
  2893. "bearerAuth": []
  2894. }
  2895. ],
  2896. "parameters": [
  2897. {
  2898. "name": "Idempotency-Key",
  2899. "in": "header",
  2900. "required": false,
  2901. "schema": {
  2902. "type": "string",
  2903. "maxLength": 200
  2904. },
  2905. "description": "Replays the stored response for a repeated request; 409 if reused with a different body."
  2906. }
  2907. ],
  2908. "requestBody": {
  2909. "required": true,
  2910. "content": {
  2911. "application/json": {
  2912. "schema": {
  2913. "$ref": "#/components/schemas/LearnRequest"
  2914. }
  2915. }
  2916. }
  2917. },
  2918. "responses": {
  2919. "201": {
  2920. "description": "Candidate proposed",
  2921. "content": {
  2922. "application/json": {
  2923. "schema": {
  2924. "type": "object",
  2925. "properties": {
  2926. "id": {
  2927. "type": "string"
  2928. },
  2929. "state": {
  2930. "type": "string",
  2931. "enum": [
  2932. "proposed"
  2933. ]
  2934. },
  2935. "namespace_id": {
  2936. "type": "string"
  2937. },
  2938. "type": {
  2939. "type": "string"
  2940. },
  2941. "evidence_count": {
  2942. "type": "integer"
  2943. }
  2944. }
  2945. }
  2946. }
  2947. }
  2948. },
  2949. "400": {
  2950. "description": "Empty body, invalid JSON or invalid Idempotency-Key",
  2951. "content": {
  2952. "application/json": {
  2953. "schema": {
  2954. "$ref": "#/components/schemas/Error"
  2955. }
  2956. }
  2957. }
  2958. },
  2959. "401": {
  2960. "description": "Missing, invalid, revoked or expired API key",
  2961. "content": {
  2962. "application/json": {
  2963. "schema": {
  2964. "$ref": "#/components/schemas/Error"
  2965. }
  2966. }
  2967. }
  2968. },
  2969. "404": {
  2970. "description": "Namespace not found or no write permission",
  2971. "content": {
  2972. "application/json": {
  2973. "schema": {
  2974. "$ref": "#/components/schemas/Error"
  2975. }
  2976. }
  2977. }
  2978. },
  2979. "409": {
  2980. "description": "idempotency_conflict",
  2981. "content": {
  2982. "application/json": {
  2983. "schema": {
  2984. "$ref": "#/components/schemas/Error"
  2985. }
  2986. }
  2987. }
  2988. },
  2989. "422": {
  2990. "description": "Validation failed (unknown type, bad target/base_revision, evidence that is unknown, in another tenant or not readable by the caller) or unsupported_character",
  2991. "content": {
  2992. "application/json": {
  2993. "schema": {
  2994. "$ref": "#/components/schemas/Error"
  2995. }
  2996. }
  2997. }
  2998. },
  2999. "500": {
  3000. "description": "Internal error",
  3001. "content": {
  3002. "application/json": {
  3003. "schema": {
  3004. "$ref": "#/components/schemas/Error"
  3005. }
  3006. }
  3007. }
  3008. }
  3009. }
  3010. }
  3011. },
  3012. "/candidates": {
  3013. "get": {
  3014. "summary": "List learning candidates in namespaces the caller can read, newest first",
  3015. "tags": [
  3016. "learning"
  3017. ],
  3018. "security": [
  3019. {
  3020. "bearerAuth": []
  3021. }
  3022. ],
  3023. "parameters": [
  3024. {
  3025. "name": "namespace_id",
  3026. "in": "query",
  3027. "schema": {
  3028. "type": "string",
  3029. "format": "uuid"
  3030. }
  3031. },
  3032. {
  3033. "name": "state",
  3034. "in": "query",
  3035. "schema": {
  3036. "type": "string",
  3037. "enum": [
  3038. "proposed",
  3039. "accepted",
  3040. "rejected"
  3041. ]
  3042. }
  3043. },
  3044. {
  3045. "name": "limit",
  3046. "in": "query",
  3047. "schema": {
  3048. "type": "integer",
  3049. "minimum": 1,
  3050. "maximum": 200,
  3051. "default": 50
  3052. }
  3053. }
  3054. ],
  3055. "responses": {
  3056. "200": {
  3057. "description": "Candidates (without content)",
  3058. "content": {
  3059. "application/json": {
  3060. "schema": {
  3061. "type": "object",
  3062. "properties": {
  3063. "data": {
  3064. "type": "array",
  3065. "items": {
  3066. "$ref": "#/components/schemas/Candidate"
  3067. }
  3068. }
  3069. }
  3070. }
  3071. }
  3072. }
  3073. },
  3074. "401": {
  3075. "description": "Missing, invalid, revoked or expired API key",
  3076. "content": {
  3077. "application/json": {
  3078. "schema": {
  3079. "$ref": "#/components/schemas/Error"
  3080. }
  3081. }
  3082. }
  3083. },
  3084. "422": {
  3085. "description": "Bad state or namespace_id",
  3086. "content": {
  3087. "application/json": {
  3088. "schema": {
  3089. "$ref": "#/components/schemas/Error"
  3090. }
  3091. }
  3092. }
  3093. },
  3094. "500": {
  3095. "description": "Internal error",
  3096. "content": {
  3097. "application/json": {
  3098. "schema": {
  3099. "$ref": "#/components/schemas/Error"
  3100. }
  3101. }
  3102. }
  3103. }
  3104. }
  3105. }
  3106. },
  3107. "/candidates/{id}": {
  3108. "get": {
  3109. "summary": "One candidate with content and evidence",
  3110. "tags": [
  3111. "learning"
  3112. ],
  3113. "security": [
  3114. {
  3115. "bearerAuth": []
  3116. }
  3117. ],
  3118. "parameters": [
  3119. {
  3120. "name": "id",
  3121. "in": "path",
  3122. "required": true,
  3123. "schema": {
  3124. "type": "string",
  3125. "format": "uuid"
  3126. }
  3127. }
  3128. ],
  3129. "responses": {
  3130. "200": {
  3131. "description": "Candidate",
  3132. "content": {
  3133. "application/json": {
  3134. "schema": {
  3135. "type": "object",
  3136. "properties": {
  3137. "data": {
  3138. "$ref": "#/components/schemas/Candidate"
  3139. }
  3140. }
  3141. }
  3142. }
  3143. }
  3144. },
  3145. "401": {
  3146. "description": "Missing, invalid, revoked or expired API key",
  3147. "content": {
  3148. "application/json": {
  3149. "schema": {
  3150. "$ref": "#/components/schemas/Error"
  3151. }
  3152. }
  3153. }
  3154. },
  3155. "404": {
  3156. "description": "Not found or not readable",
  3157. "content": {
  3158. "application/json": {
  3159. "schema": {
  3160. "$ref": "#/components/schemas/Error"
  3161. }
  3162. }
  3163. }
  3164. },
  3165. "500": {
  3166. "description": "Internal error",
  3167. "content": {
  3168. "application/json": {
  3169. "schema": {
  3170. "$ref": "#/components/schemas/Error"
  3171. }
  3172. }
  3173. }
  3174. }
  3175. }
  3176. }
  3177. },
  3178. "/candidates/{id}/review": {
  3179. "post": {
  3180. "summary": "Accept or reject a proposed candidate. Needs verify permission; the author cannot review its own candidate without admin. Accepting creates the memory (an identical active memory is reused) or a new revision of the target, copies the evidence and, with verify true, records a verification by the reviewer.",
  3181. "tags": [
  3182. "learning"
  3183. ],
  3184. "security": [
  3185. {
  3186. "bearerAuth": []
  3187. }
  3188. ],
  3189. "parameters": [
  3190. {
  3191. "name": "id",
  3192. "in": "path",
  3193. "required": true,
  3194. "schema": {
  3195. "type": "string",
  3196. "format": "uuid"
  3197. }
  3198. }
  3199. ],
  3200. "requestBody": {
  3201. "required": true,
  3202. "content": {
  3203. "application/json": {
  3204. "schema": {
  3205. "$ref": "#/components/schemas/ReviewRequest"
  3206. }
  3207. }
  3208. }
  3209. },
  3210. "responses": {
  3211. "200": {
  3212. "description": "Reviewed",
  3213. "content": {
  3214. "application/json": {
  3215. "schema": {
  3216. "type": "object",
  3217. "properties": {
  3218. "id": {
  3219. "type": "string"
  3220. },
  3221. "state": {
  3222. "type": "string",
  3223. "enum": [
  3224. "accepted",
  3225. "rejected"
  3226. ]
  3227. },
  3228. "resulting_memory_id": {
  3229. "type": "string"
  3230. },
  3231. "resulting_revision": {
  3232. "type": "integer"
  3233. },
  3234. "verification_status": {
  3235. "type": "string"
  3236. },
  3237. "duplicate": {
  3238. "type": "boolean"
  3239. }
  3240. }
  3241. }
  3242. }
  3243. }
  3244. },
  3245. "400": {
  3246. "description": "Empty body or invalid JSON",
  3247. "content": {
  3248. "application/json": {
  3249. "schema": {
  3250. "$ref": "#/components/schemas/Error"
  3251. }
  3252. }
  3253. }
  3254. },
  3255. "401": {
  3256. "description": "Missing, invalid, revoked or expired API key",
  3257. "content": {
  3258. "application/json": {
  3259. "schema": {
  3260. "$ref": "#/components/schemas/Error"
  3261. }
  3262. }
  3263. }
  3264. },
  3265. "403": {
  3266. "description": "self_review_not_allowed",
  3267. "content": {
  3268. "application/json": {
  3269. "schema": {
  3270. "$ref": "#/components/schemas/Error"
  3271. }
  3272. }
  3273. }
  3274. },
  3275. "404": {
  3276. "description": "Candidate not found or no verify permission",
  3277. "content": {
  3278. "application/json": {
  3279. "schema": {
  3280. "$ref": "#/components/schemas/Error"
  3281. }
  3282. }
  3283. }
  3284. },
  3285. "409": {
  3286. "description": "candidate_already_reviewed, stale_candidate (target memory changed since base_revision), target_memory_missing or target_memory_not_active",
  3287. "content": {
  3288. "application/json": {
  3289. "schema": {
  3290. "$ref": "#/components/schemas/Error"
  3291. }
  3292. }
  3293. }
  3294. },
  3295. "422": {
  3296. "description": "Validation failed",
  3297. "content": {
  3298. "application/json": {
  3299. "schema": {
  3300. "$ref": "#/components/schemas/Error"
  3301. }
  3302. }
  3303. }
  3304. },
  3305. "500": {
  3306. "description": "Internal error",
  3307. "content": {
  3308. "application/json": {
  3309. "schema": {
  3310. "$ref": "#/components/schemas/Error"
  3311. }
  3312. }
  3313. }
  3314. }
  3315. }
  3316. }
  3317. },
  3318. "/memories/{id}/sources": {
  3319. "get": {
  3320. "summary": "Evidence and verifications behind a memory revision. Evidence the caller cannot read is listed with available false and no id.",
  3321. "tags": [
  3322. "learning"
  3323. ],
  3324. "security": [
  3325. {
  3326. "bearerAuth": []
  3327. }
  3328. ],
  3329. "parameters": [
  3330. {
  3331. "name": "id",
  3332. "in": "path",
  3333. "required": true,
  3334. "schema": {
  3335. "type": "string",
  3336. "format": "uuid"
  3337. }
  3338. },
  3339. {
  3340. "name": "revision",
  3341. "in": "query",
  3342. "schema": {
  3343. "type": "integer",
  3344. "minimum": 1
  3345. },
  3346. "description": "Default: current revision"
  3347. }
  3348. ],
  3349. "responses": {
  3350. "200": {
  3351. "description": "Sources",
  3352. "content": {
  3353. "application/json": {
  3354. "schema": {
  3355. "$ref": "#/components/schemas/Sources"
  3356. }
  3357. }
  3358. }
  3359. },
  3360. "401": {
  3361. "description": "Missing, invalid, revoked or expired API key",
  3362. "content": {
  3363. "application/json": {
  3364. "schema": {
  3365. "$ref": "#/components/schemas/Error"
  3366. }
  3367. }
  3368. }
  3369. },
  3370. "404": {
  3371. "description": "Memory not found or not readable",
  3372. "content": {
  3373. "application/json": {
  3374. "schema": {
  3375. "$ref": "#/components/schemas/Error"
  3376. }
  3377. }
  3378. }
  3379. },
  3380. "422": {
  3381. "description": "revision out of range",
  3382. "content": {
  3383. "application/json": {
  3384. "schema": {
  3385. "$ref": "#/components/schemas/Error"
  3386. }
  3387. }
  3388. }
  3389. },
  3390. "500": {
  3391. "description": "Internal error",
  3392. "content": {
  3393. "application/json": {
  3394. "schema": {
  3395. "$ref": "#/components/schemas/Error"
  3396. }
  3397. }
  3398. }
  3399. }
  3400. }
  3401. }
  3402. },
  3403. "/feedback": {
  3404. "post": {
  3405. "summary": "Rate one result of a recall, search or context call (by its query_id). One rating per principal, query and result; a new rating replaces the earlier one (200). Pinned to the revision that was returned.",
  3406. "tags": [
  3407. "learning"
  3408. ],
  3409. "security": [
  3410. {
  3411. "bearerAuth": []
  3412. }
  3413. ],
  3414. "requestBody": {
  3415. "required": true,
  3416. "content": {
  3417. "application/json": {
  3418. "schema": {
  3419. "$ref": "#/components/schemas/FeedbackRequest"
  3420. }
  3421. }
  3422. }
  3423. },
  3424. "responses": {
  3425. "200": {
  3426. "description": "Updated",
  3427. "content": {
  3428. "application/json": {
  3429. "schema": {
  3430. "$ref": "#/components/schemas/Feedback"
  3431. }
  3432. }
  3433. }
  3434. },
  3435. "201": {
  3436. "description": "Recorded",
  3437. "content": {
  3438. "application/json": {
  3439. "schema": {
  3440. "$ref": "#/components/schemas/Feedback"
  3441. }
  3442. }
  3443. }
  3444. },
  3445. "400": {
  3446. "description": "Empty body or invalid JSON",
  3447. "content": {
  3448. "application/json": {
  3449. "schema": {
  3450. "$ref": "#/components/schemas/Error"
  3451. }
  3452. }
  3453. }
  3454. },
  3455. "401": {
  3456. "description": "Missing, invalid, revoked or expired API key",
  3457. "content": {
  3458. "application/json": {
  3459. "schema": {
  3460. "$ref": "#/components/schemas/Error"
  3461. }
  3462. }
  3463. }
  3464. },
  3465. "404": {
  3466. "description": "result_not_found: the result was not returned by that query, is gone, or is not readable",
  3467. "content": {
  3468. "application/json": {
  3469. "schema": {
  3470. "$ref": "#/components/schemas/Error"
  3471. }
  3472. }
  3473. }
  3474. },
  3475. "422": {
  3476. "description": "Validation failed",
  3477. "content": {
  3478. "application/json": {
  3479. "schema": {
  3480. "$ref": "#/components/schemas/Error"
  3481. }
  3482. }
  3483. }
  3484. },
  3485. "500": {
  3486. "description": "Internal error",
  3487. "content": {
  3488. "application/json": {
  3489. "schema": {
  3490. "$ref": "#/components/schemas/Error"
  3491. }
  3492. }
  3493. }
  3494. }
  3495. }
  3496. }
  3497. }
  3498. }
  3499. }

Powered by TurnKey Linux.