{"openapi":"3.1.0","info":{"title":"AI Narrative Director API","version":"1.0.0"},"paths":{"/healthz":{"get":{"responses":{"200":{"description":"进程可用"}}}},"/api/v1/plan":{"post":{"operationId":"narrativePlanV1","description":"UTF-8 JSON，文稿用空行分段，最多 120 段。可选传入内容理解接口的 analysis。","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlanRequest"}}}},"responses":{"200":{"description":"按叙事顺序排列、带原文引句的叙事导演方案","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlanResponse"}}}},"400":{"description":"INVALID_JSON — 请求体必须是有效的 UTF-8 JSON。\nINVALID_INPUT — 请提交非空文稿和符合契约的输入，文稿最多 120 段。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"UNAUTHORIZED — 需要有效的服务访问令牌。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"NOT_FOUND — 找不到该接口。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"405":{"description":"METHOD_NOT_ALLOWED — 请求方法不受支持。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"PAYLOAD_TOO_LARGE — 请求体超过 512 KiB。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"UNSUPPORTED_MEDIA_TYPE — 请使用 application/json。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"SOURCE_MISMATCH — 上游方案和文稿不匹配，请使用同一版本的完整文稿。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR — 服务内部出错。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"ANALYSIS_FAILED — 模型未生成可用方案。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"BUSY — 服务繁忙，请稍后重试。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}},"schemas":{"PlanRequest":{"type":"object","properties":{"manuscript":{"type":"string","maxLength":80000,"pattern":"\\S"},"contentAnalysis":{"type":"object","properties":{"summary":{"type":"string","minLength":1},"beats":{"minItems":1,"maxItems":120,"type":"array","items":{"type":"object","properties":{"role":{"type":"string","minLength":1},"description":{"type":"string","minLength":1},"evidence":{"type":"object","properties":{"paragraph":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"quote":{"type":"string","minLength":1}},"required":["paragraph","quote"],"additionalProperties":false}},"required":["role","description","evidence"],"additionalProperties":{}}}},"required":["summary","beats"],"additionalProperties":{}}},"required":["manuscript"],"additionalProperties":false},"PlanResponse":{"type":"object","properties":{"apiVersion":{"type":"string","const":"v1"},"role":{"type":"string","const":"narrative"},"requestId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"runId":{"type":"string","minLength":1},"model":{"type":"string","minLength":1},"promptVersion":{"type":"string","const":"1.0.0"},"schemaVersion":{"type":"string","const":"1.0.0"},"sourceHash":{"type":"string","pattern":"^[0-9a-f]{64}$"},"plan":{"type":"object","properties":{"strategy":{"type":"string","minLength":1},"beats":{"minItems":1,"maxItems":120,"type":"array","items":{"type":"object","properties":{"phase":{"type":"string","enum":["hook","setup","clue","turn","reveal","resolution","transition"]},"decision":{"type":"string","minLength":1},"reveal":{"type":"string","minLength":1},"withhold":{"type":"string","minLength":1},"evidence":{"type":"object","properties":{"paragraph":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"quote":{"type":"string","minLength":1}},"required":["paragraph","quote"],"additionalProperties":false}},"required":["phase","decision","reveal","withhold","evidence"],"additionalProperties":false}}},"required":["strategy","beats"],"additionalProperties":false}},"required":["apiVersion","role","requestId","runId","model","promptVersion","schemaVersion","sourceHash","plan"],"additionalProperties":false},"Error":{"type":"object","properties":{"apiVersion":{"type":"string","const":"v1"},"requestId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"error":{"type":"object","properties":{"code":{"type":"string","enum":["INVALID_JSON","INVALID_INPUT","SOURCE_MISMATCH","UNAUTHORIZED","NOT_FOUND","METHOD_NOT_ALLOWED","PAYLOAD_TOO_LARGE","UNSUPPORTED_MEDIA_TYPE","INTERNAL_ERROR","ANALYSIS_FAILED","BUSY"]},"message":{"type":"string","minLength":1}},"required":["code","message"],"additionalProperties":false}},"required":["apiVersion","requestId","error"],"additionalProperties":false}}}}