{ "openapi": "3.1.0", "info": { "title": "seal-use Wrapped API", "version": "0.10.28", "description": "HTTP contract for the seal-use wrapped backend API, served by the local HTTP adapter\n(`seal-use http`, or the `seal-use service start` daemon; default http://127.0.0.1:8787).\n\nThese endpoints describe the stable wrapped API for frontend developers and agents. They are\nnot the raw downstream Seal endpoints: seal-use is responsible for enterprise selection,\nsource authentication, response compaction, and diagnostics-friendly fields.\n\nEvery operation declares `x-implementation-status`, so a caller can tell what the running\nadapter actually serves:\n\n- `implemented` — routed by `src/http/routes.ts` today. `src/http/openapi-implementation.test.ts`\n fails when an `implemented` operation has no matching route.\n- `planned` — contract-only, designed but not routed yet. Calling it returns 404.\n\nThe same capabilities are reachable through the CLI, and through the optional MCP server when\nit is enabled.\n" }, "servers": [ { "url": "http://localhost:8787", "description": "Local HTTP adapter (`seal-use http`, or the `seal-use service start` daemon). Loopback-only by default." } ], "security": [ { "localSession": [] } ], "tags": [ { "name": "Corps", "description": "Local enterprise configuration selection." }, { "name": "Source", "description": "Source-derived Seal enterprise configuration." }, { "name": "Auth", "description": "Wrapped authentication diagnostics and current identity." }, { "name": "Approval Runs", "description": "Wrapped approval run history, summaries, document URLs, and trace bridge helpers." }, { "name": "Approval Knowledge", "description": "Wrapped approval rules, documents, preferences, and search." }, { "name": "Simulation", "description": "Wrapped simulation batch record access." } ], "paths": { "/v1/corps": { "get": { "tags": [ "Corps" ], "operationId": "listCorps", "x-implementation-status": "implemented", "summary": "List configured enterprises", "responses": { "200": { "description": "Configured enterprises.", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "object", "required": [ "id", "name", "sourceType", "current" ], "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "sourceType": { "type": "string", "enum": [ "hose", "direct", "seal" ] }, "current": { "type": "boolean" } } } } } } } } } }, "/v1/corps/current": { "get": { "tags": [ "Corps" ], "operationId": "getCurrentCorp", "x-implementation-status": "planned", "summary": "Get current enterprise", "description": "Returns the configured default enterprise in stateful mode. Stateless mode has no current enterprise and requires an explicit corpId for enterprise operations.", "responses": { "200": { "description": "Current enterprise.", "content": { "application/json": { "schema": { "type": "object", "required": [ "id", "name", "sourceType", "current" ], "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "sourceType": { "type": "string", "enum": [ "hose", "direct", "seal" ] }, "current": { "type": "boolean" } } } } } } } } }, "/v1/corps/current/switch": { "post": { "tags": [ "Corps" ], "operationId": "switchCurrentCorp", "x-implementation-status": "planned", "summary": "Switch current enterprise", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "corpId" ], "properties": { "corpId": { "type": "string" } } } } } }, "responses": { "200": { "description": "Switched enterprise.", "content": { "application/json": { "schema": { "type": "object", "required": [ "current", "id", "name" ], "properties": { "current": { "type": "boolean" }, "id": { "type": "string" }, "name": { "type": "string" } } } } } }, "404": { "description": "Requested resource was not found.", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true, "required": [ "error" ], "properties": { "error": { "type": "string" }, "message": { "type": "string" }, "details": {} } } } } } } } }, "/v1/source/config": { "get": { "tags": [ "Source" ], "operationId": "getSourceConfig", "x-implementation-status": "planned", "summary": "Resolve source-derived Seal enterprise config", "parameters": [ { "name": "corpId", "in": "query", "schema": { "type": "string" }, "description": "Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used." } ], "responses": { "200": { "description": "Redacted Seal enterprise config.", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true, "description": "Redacted Seal enterprise config resolved from the configured source." } } } }, "401": { "description": "Local service authentication failed or downstream Seal auth failed.", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true, "required": [ "error" ], "properties": { "error": { "type": "string" }, "message": { "type": "string" }, "details": {} } } } } } } } }, "/v1/auth/diagnose": { "get": { "tags": [ "Auth" ], "operationId": "diagnoseAuth", "x-implementation-status": "planned", "summary": "Diagnose wrapped source-to-Seal authentication", "parameters": [ { "name": "corpId", "in": "query", "schema": { "type": "string" }, "description": "Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used." } ], "responses": { "200": { "description": "Authentication stage diagnosis.", "content": { "application/json": { "schema": { "type": "object", "required": [ "stages" ], "properties": { "stages": { "type": "array", "items": { "$ref": "#/components/schemas/AuthStage" } } } } } } } } } }, "/v1/whoami": { "get": { "tags": [ "Auth" ], "operationId": "whoami", "x-implementation-status": "implemented", "summary": "Get current wrapped Seal identity", "parameters": [ { "name": "corpId", "in": "query", "schema": { "type": "string" }, "description": "Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used." } ], "responses": { "200": { "description": "Current Seal user and tenant.", "content": { "application/json": { "schema": { "type": "object", "required": [ "user", "tenant" ], "properties": { "user": { "$ref": "#/components/schemas/SealUser" }, "tenant": { "$ref": "#/components/schemas/SealTenant" } } } } } }, "401": { "description": "Local service authentication failed or downstream Seal auth failed.", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true, "required": [ "error" ], "properties": { "error": { "type": "string" }, "message": { "type": "string" }, "details": {} } } } } } } } }, "/v1/session": { "get": { "tags": [ "Auth" ], "operationId": "getSession", "x-implementation-status": "implemented", "summary": "Get current wrapped Seal session metadata", "parameters": [ { "name": "corpId", "in": "query", "schema": { "type": "string" }, "description": "Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used." } ], "responses": { "200": { "description": "Current session metadata.", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true, "required": [ "user", "session" ], "properties": { "user": { "$ref": "#/components/schemas/SealUser" }, "session": { "type": "object", "additionalProperties": true } } } } } }, "401": { "description": "Local service authentication failed or downstream Seal auth failed.", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true, "required": [ "error" ], "properties": { "error": { "type": "string" }, "message": { "type": "string" }, "details": {} } } } } } } } }, "/v1/approval/context": { "get": { "tags": [ "Approval Knowledge" ], "operationId": "getApprovalContext", "x-implementation-status": "planned", "summary": "Get rules, documents, and style preferences together", "parameters": [ { "name": "corpId", "in": "query", "schema": { "type": "string" }, "description": "Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used." }, { "name": "documentLimit", "in": "query", "schema": { "type": "integer", "minimum": 1 } }, { "name": "latestRuleVersion", "in": "query", "schema": { "type": "boolean" } }, { "name": "ruleVersionNumber", "in": "query", "schema": { "type": "integer" } } ], "responses": { "200": { "description": "Approval context.", "content": { "application/json": { "schema": { "type": "object", "required": [ "rules", "documents", "stylePreferences" ], "properties": { "rules": {}, "documents": {}, "stylePreferences": {} } } } } } } } }, "/v1/approval/search": { "post": { "tags": [ "Approval Knowledge" ], "operationId": "searchApprovalKnowledge", "x-implementation-status": "planned", "summary": "Search approval rules, documents, and preferences", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "keywords" ], "properties": { "keywords": { "type": "array", "minItems": 1, "items": { "type": "string" } }, "matchMode": { "type": "string", "enum": [ "any", "all" ] }, "areas": { "type": "array", "items": { "type": "string", "enum": [ "rules", "documents", "preferences" ] } }, "maxResults": { "type": "integer" } } } } } }, "responses": { "200": { "description": "Search results with line context.", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true } } } } } } }, "/v1/approval/rules": { "get": { "tags": [ "Approval Knowledge" ], "operationId": "listApprovalRules", "x-implementation-status": "implemented", "summary": "List current draft approval rules", "responses": { "200": { "description": "Draft rules.", "content": { "application/json": { "schema": { "type": "object", "required": [ "rules" ], "properties": { "rules": { "type": "array", "items": { "$ref": "#/components/schemas/ApprovalRule" } }, "hasPendingDeletes": { "type": "boolean" } } } } } } } }, "post": { "tags": [ "Approval Knowledge" ], "operationId": "createApprovalRule", "x-implementation-status": "planned", "summary": "Create draft approval rule", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "description", "scope", "strictness" ], "properties": { "description": { "type": "string" }, "scope": { "type": "string" }, "strictness": { "type": "string", "enum": [ "MUST_FOLLOW", "SHOULD_FOLLOW", "SUGGESTION" ] } } } } } }, "responses": { "200": { "description": "Created rule.", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true, "required": [ "id", "description", "scope", "strictness" ], "properties": { "id": { "type": "string" }, "description": { "type": "string" }, "scope": { "type": "string" }, "strictness": { "type": "string", "enum": [ "MUST_FOLLOW", "SHOULD_FOLLOW", "SUGGESTION" ] }, "status": { "type": "string" } } } } } } } } }, "/v1/approval/rules/{ruleId}": { "parameters": [ { "name": "ruleId", "in": "path", "required": true, "schema": { "type": "string" }, "description": "Approval rule ID." } ], "patch": { "tags": [ "Approval Knowledge" ], "operationId": "updateApprovalRule", "x-implementation-status": "planned", "summary": "Update draft approval rule", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "additionalProperties": false, "properties": { "description": { "type": "string" }, "scope": { "type": "string" }, "strictness": { "type": "string", "enum": [ "MUST_FOLLOW", "SHOULD_FOLLOW", "SUGGESTION" ] } } } } } }, "responses": { "200": { "description": "Updated rule.", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true, "required": [ "id", "description", "scope", "strictness" ], "properties": { "id": { "type": "string" }, "description": { "type": "string" }, "scope": { "type": "string" }, "strictness": { "type": "string", "enum": [ "MUST_FOLLOW", "SHOULD_FOLLOW", "SUGGESTION" ] }, "status": { "type": "string" } } } } } } } }, "delete": { "tags": [ "Approval Knowledge" ], "operationId": "deleteApprovalRule", "x-implementation-status": "planned", "summary": "Delete draft approval rule", "responses": { "200": { "description": "Deleted." } } } }, "/v1/approval/rule-versions": { "get": { "tags": [ "Approval Knowledge" ], "operationId": "listApprovalRuleVersions", "x-implementation-status": "planned", "summary": "List published approval rule versions", "responses": { "200": { "description": "Published rule versions.", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "object", "additionalProperties": true, "required": [ "id", "versionNumber", "versionName", "rules" ], "properties": { "id": { "type": "string" }, "versionNumber": { "type": "integer" }, "versionName": { "type": "string" }, "publishedByName": { "type": "string" }, "rules": { "type": "array", "items": { "type": "object", "additionalProperties": true } } } } } } } } } } }, "/v1/approval/rule-versions/{versionId}": { "parameters": [ { "name": "versionId", "in": "path", "required": true, "schema": { "type": "string" }, "description": "Published rule version ID." } ], "get": { "tags": [ "Approval Knowledge" ], "operationId": "getApprovalRuleVersion", "x-implementation-status": "planned", "summary": "Get published approval rule version", "responses": { "200": { "description": "Rule version.", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true, "required": [ "id", "versionNumber", "versionName", "rules" ], "properties": { "id": { "type": "string" }, "versionNumber": { "type": "integer" }, "versionName": { "type": "string" }, "publishedByName": { "type": "string" }, "rules": { "type": "array", "items": { "type": "object", "additionalProperties": true } } } } } } } } } }, "/v1/approval/rules/by-version": { "get": { "tags": [ "Approval Knowledge" ], "operationId": "getApprovalRuleByVersion", "x-implementation-status": "planned", "summary": "Get one wrapped rule from a published version", "parameters": [ { "name": "corpId", "in": "query", "schema": { "type": "string" }, "description": "Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used." }, { "name": "versionNumber", "in": "query", "schema": { "type": "integer" } }, { "name": "versionId", "in": "query", "schema": { "type": "string" } }, { "name": "latest", "in": "query", "schema": { "type": "boolean" } }, { "name": "code", "in": "query", "schema": { "type": "string" }, "description": "Display rule code such as '#0038'." }, { "name": "runtimeId", "in": "query", "schema": { "type": "string" }, "description": "Runtime rule ID such as rule-205." }, { "name": "recordId", "in": "query", "schema": { "type": "string" }, "description": "Infer versionNumber from an approval run." } ], "responses": { "200": { "description": "One rule from a published version.", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true } } } } } } }, "/v1/approval/rule-versions/publish": { "post": { "tags": [ "Approval Knowledge" ], "operationId": "publishApprovalRuleVersion", "x-implementation-status": "planned", "summary": "Publish current draft rules", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "versionName" ], "properties": { "versionName": { "type": "string" } } } } } }, "responses": { "200": { "description": "Published version.", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true } } } } } } }, "/v1/approval/documents": { "get": { "tags": [ "Approval Knowledge" ], "operationId": "listApprovalDocuments", "x-implementation-status": "planned", "summary": "List approval knowledge documents", "parameters": [ { "name": "offset", "in": "query", "schema": { "type": "integer", "minimum": 0, "default": 0 }, "description": "Zero-based pagination offset." }, { "name": "limit", "in": "query", "schema": { "type": "integer", "minimum": 1, "default": 20 } }, { "name": "scenario", "in": "query", "schema": { "type": "array", "items": { "type": "string" } }, "style": "form", "explode": true } ], "responses": { "200": { "description": "Documents.", "content": { "application/json": { "schema": { "type": "object", "required": [ "articles" ], "properties": { "articles": { "type": "array", "items": { "$ref": "#/components/schemas/ApprovalDocument" } }, "total": { "type": "integer" } } } } } } } }, "post": { "tags": [ "Approval Knowledge" ], "operationId": "createApprovalDocument", "x-implementation-status": "planned", "summary": "Create approval knowledge document", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "title", "purpose", "content" ], "properties": { "title": { "type": "string" }, "purpose": { "type": "string" }, "content": { "type": "string" }, "contentType": { "type": "string" }, "status": { "type": "string" }, "scenarios": { "type": "array", "items": { "type": "string" } }, "tags": { "type": "array", "items": { "type": "string" } } } } } } }, "responses": { "200": { "description": "Created document.", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true, "required": [ "id", "title", "content" ], "properties": { "id": { "type": "string" }, "title": { "type": "string" }, "purpose": { "type": "string" }, "content": { "type": "string", "description": "Usually Markdown." }, "contentType": { "type": "string" }, "status": { "type": "string" }, "enabled": { "type": "boolean" }, "scenarios": { "type": "array", "items": { "type": "string" } }, "tags": { "type": "array", "items": { "type": "string" } } } } } } } } } }, "/v1/approval/documents/{documentId}": { "parameters": [ { "name": "documentId", "in": "path", "required": true, "schema": { "type": "string" }, "description": "Approval knowledge document ID." } ], "get": { "tags": [ "Approval Knowledge" ], "operationId": "getApprovalDocument", "x-implementation-status": "planned", "summary": "Get approval knowledge document", "responses": { "200": { "description": "Document.", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true, "required": [ "id", "title", "content" ], "properties": { "id": { "type": "string" }, "title": { "type": "string" }, "purpose": { "type": "string" }, "content": { "type": "string", "description": "Usually Markdown." }, "contentType": { "type": "string" }, "status": { "type": "string" }, "enabled": { "type": "boolean" }, "scenarios": { "type": "array", "items": { "type": "string" } }, "tags": { "type": "array", "items": { "type": "string" } } } } } } } } }, "patch": { "tags": [ "Approval Knowledge" ], "operationId": "updateApprovalDocument", "x-implementation-status": "planned", "summary": "Update approval knowledge document", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "additionalProperties": false, "properties": { "title": { "type": "string" }, "purpose": { "type": "string" }, "content": { "type": "string" }, "contentType": { "type": "string" }, "status": { "type": "string" }, "enabled": { "type": "boolean" }, "scenarios": { "type": "array", "items": { "type": "string" } }, "tags": { "type": "array", "items": { "type": "string" } } } } } } }, "responses": { "200": { "description": "Updated document.", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true, "required": [ "id", "title", "content" ], "properties": { "id": { "type": "string" }, "title": { "type": "string" }, "purpose": { "type": "string" }, "content": { "type": "string", "description": "Usually Markdown." }, "contentType": { "type": "string" }, "status": { "type": "string" }, "enabled": { "type": "boolean" }, "scenarios": { "type": "array", "items": { "type": "string" } }, "tags": { "type": "array", "items": { "type": "string" } } } } } } } } }, "delete": { "tags": [ "Approval Knowledge" ], "operationId": "deleteApprovalDocument", "x-implementation-status": "planned", "summary": "Delete approval knowledge document", "responses": { "200": { "description": "Deleted document confirmation." } } } }, "/v1/approval/style-preferences": { "get": { "tags": [ "Approval Knowledge" ], "operationId": "getApprovalStylePreferences", "x-implementation-status": "planned", "summary": "Get approval style preferences", "responses": { "200": { "description": "Style preferences.", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true, "properties": { "tone": { "type": "string" }, "language": { "type": "string" }, "detailLevel": { "type": "string" }, "outputFormat": { "type": "string" }, "examples": { "type": "array", "items": { "type": "string" } }, "prohibitedPhrases": { "type": "array", "items": { "type": "string" } }, "customInstructions": { "type": "string" } } } } } } } }, "patch": { "tags": [ "Approval Knowledge" ], "operationId": "updateApprovalStylePreferences", "x-implementation-status": "planned", "summary": "Update approval style preferences", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true, "properties": { "tone": { "type": "string" }, "language": { "type": "string" }, "detailLevel": { "type": "string" }, "outputFormat": { "type": "string" }, "examples": { "type": "array", "items": { "type": "string" } }, "prohibitedPhrases": { "type": "array", "items": { "type": "string" } }, "customInstructions": { "type": "string" } } } } } }, "responses": { "200": { "description": "Updated style preferences.", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true, "properties": { "tone": { "type": "string" }, "language": { "type": "string" }, "detailLevel": { "type": "string" }, "outputFormat": { "type": "string" }, "examples": { "type": "array", "items": { "type": "string" } }, "prohibitedPhrases": { "type": "array", "items": { "type": "string" } }, "customInstructions": { "type": "string" } } } } } } } } }, "/v1/preferences": { "get": { "tags": [ "Approval Knowledge" ], "operationId": "getPreferences", "x-implementation-status": "implemented", "summary": "Get current decision, thinking-depth and rule-version preferences", "parameters": [ { "name": "corpId", "in": "query", "schema": { "type": "string" }, "description": "Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used." } ], "responses": { "200": { "description": "Decision preferences, thinking depth preference and the bound rule set version.", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true, "properties": { "tone": { "type": "string" }, "language": { "type": "string" }, "detailLevel": { "type": "string" }, "outputFormat": { "type": "string" }, "examples": { "type": "array", "items": { "type": "string" } }, "prohibitedPhrases": { "type": "array", "items": { "type": "string" } }, "customInstructions": { "type": "string" } } } } } } } } }, "/v1/preferences/decision": { "post": { "tags": [ "Approval Knowledge" ], "operationId": "updatePreferenceDecision", "x-implementation-status": "implemented", "summary": "Update decision preferences (takes effect immediately for the running approval agent)", "parameters": [ { "name": "corpId", "in": "query", "schema": { "type": "string" }, "description": "Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used." } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "explicitApprove": { "type": "string" }, "explicitReject": { "type": "string" }, "exemptApprove": { "type": "string" }, "review": { "type": "string" }, "dryRun": { "type": "boolean", "description": "Return the before/after diff without writing." } } } } } }, "responses": { "200": { "description": "Updated preferences, or the previewed diff when dryRun is set.", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true, "properties": { "tone": { "type": "string" }, "language": { "type": "string" }, "detailLevel": { "type": "string" }, "outputFormat": { "type": "string" }, "examples": { "type": "array", "items": { "type": "string" } }, "prohibitedPhrases": { "type": "array", "items": { "type": "string" } }, "customInstructions": { "type": "string" } } } } } } } } }, "/v1/approval-runs": { "get": { "tags": [ "Approval Runs" ], "operationId": "searchApprovalRuns", "x-implementation-status": "implemented", "summary": "Search wrapped approval run history", "parameters": [ { "name": "corpId", "in": "query", "schema": { "type": "string" }, "description": "Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used." }, { "name": "offset", "in": "query", "schema": { "type": "integer", "minimum": 0, "default": 0 }, "description": "Zero-based pagination offset." }, { "name": "limit", "in": "query", "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 50 }, "description": "Maximum number of records to return." }, { "name": "startDate", "in": "query", "schema": { "type": "string" }, "description": "Creation-time lower bound in milliseconds." }, { "name": "endDate", "in": "query", "schema": { "type": "string" }, "description": "Creation-time upper bound in milliseconds." }, { "name": "status", "in": "query", "schema": { "type": "string" } }, { "name": "taskMode", "in": "query", "schema": { "type": "string" } }, { "name": "manualApprovalStatus", "in": "query", "schema": { "oneOf": [ { "type": "string" }, { "type": "array", "items": { "type": "string" } } ] } }, { "name": "sourceDocumentSN", "in": "query", "schema": { "type": "string" }, "description": "Hose/易快报单号 or other external source document number." }, { "name": "sourceDocumentId", "in": "query", "schema": { "type": "string" } }, { "name": "humanResult", "in": "query", "schema": { "type": "string" }, "description": "Local human result contains filter, such as 驳回 or 通过." }, { "name": "query", "in": "query", "schema": { "type": "string" }, "description": "Search across record ID, source document fields, document ID, and trace fields." }, { "name": "includeBridge", "in": "query", "schema": { "type": "boolean", "default": false }, "description": "Include full Langfuse bridge rows." } ], "responses": { "200": { "description": "Compact wrapped approval run list.", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true, "required": [ "records" ], "properties": { "records": { "type": "array", "items": { "$ref": "#/components/schemas/ApprovalRun" } }, "total": { "type": "integer" }, "bridge": { "type": "array", "items": { "type": "object", "additionalProperties": true } } } } } } } } } }, "/v1/approval-runs/summary": { "get": { "tags": [ "Approval Runs" ], "operationId": "summarizeApprovalRuns", "x-implementation-status": "implemented", "summary": "Summarize approval runs by local date", "parameters": [ { "name": "corpId", "in": "query", "schema": { "type": "string" }, "description": "Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used." }, { "name": "date", "in": "query", "schema": { "type": "string", "format": "date" } }, { "name": "timezone", "in": "query", "schema": { "type": "string", "default": "Asia/Shanghai" } }, { "name": "limit", "in": "query", "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 50 }, "description": "Maximum number of records to return." }, { "name": "query", "in": "query", "schema": { "type": "string" } }, { "name": "humanResult", "in": "query", "schema": { "type": "string" } } ], "responses": { "200": { "description": "Date summary with counts and compact records.", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true, "properties": { "date": { "type": "string" }, "timezone": { "type": "string" }, "matched": { "type": "integer" }, "statusCounts": { "type": "object", "additionalProperties": { "type": "integer" } }, "taskModeCounts": { "type": "object", "additionalProperties": { "type": "integer" } } } } } } } } } }, "/v1/approval-runs/stats": { "get": { "tags": [ "Approval Runs" ], "operationId": "statApprovalRuns", "x-implementation-status": "implemented", "summary": "Aggregate approval run counts by status and source system", "parameters": [ { "name": "corpId", "in": "query", "schema": { "type": "string" }, "description": "Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used." }, { "name": "since", "in": "query", "schema": { "type": "string" }, "description": "Time window such as 3months, 7days or 24hours." }, { "name": "dedupeBy", "in": "query", "schema": { "type": "string", "enum": [ "sourceDocumentSN", "sourceDocumentId", "id" ], "default": "sourceDocumentSN" }, "description": "Field used to count distinct business documents." }, { "name": "status", "in": "query", "schema": { "type": "string" } }, { "name": "sourceSystem", "in": "query", "schema": { "type": "string" } }, { "name": "taskMode", "in": "query", "schema": { "type": "string" } } ], "responses": { "200": { "description": "Counts grouped by status and source system, plus the deduplicated total.", "content": { "application/json": { "schema": { "type": "object" } } } } } } }, "/v1/approval-runs/pick": { "get": { "tags": [ "Approval Runs" ], "operationId": "pickApprovalRuns", "x-implementation-status": "implemented", "summary": "Pick likely approval runs by document number or trace key", "parameters": [ { "name": "corpId", "in": "query", "schema": { "type": "string" }, "description": "Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used." }, { "name": "query", "in": "query", "schema": { "type": "string" } }, { "name": "sn", "in": "query", "schema": { "type": "string" }, "description": "Source document number for direct lookup." }, { "name": "batch", "in": "query", "schema": { "type": "string" }, "description": "Optional simulation batch ID." }, { "name": "latest", "in": "query", "schema": { "type": "boolean" } }, { "name": "fields", "in": "query", "schema": { "type": "string" }, "description": "Comma-separated response fields." }, { "name": "limit", "in": "query", "schema": { "type": "integer", "default": 20 } }, { "name": "maxScan", "in": "query", "schema": { "type": "integer", "default": 1000 } } ], "responses": { "200": { "description": "Picked records and suggested next actions.", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true } } } } } } }, "/v1/approval-runs/bridge": { "get": { "tags": [ "Approval Runs" ], "operationId": "getApprovalRunLangfuseBridge", "x-implementation-status": "planned", "summary": "Resolve approval runs to Langfuse trace or session hints", "parameters": [ { "name": "corpId", "in": "query", "schema": { "type": "string" }, "description": "Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used." }, { "name": "recordId", "in": "query", "schema": { "type": "string" } }, { "name": "sourceDocumentSN", "in": "query", "schema": { "type": "string" } }, { "name": "sourceDocumentId", "in": "query", "schema": { "type": "string" } }, { "name": "simulationBatchId", "in": "query", "schema": { "type": "string" } } ], "responses": { "200": { "description": "Trace/session bridge hints.", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true, "properties": { "count": { "type": "integer" }, "records": { "type": "array", "items": { "$ref": "#/components/schemas/ApprovalRun" } }, "bridge": { "type": "array", "items": { "type": "object", "additionalProperties": true } } } } } } } } } }, "/v1/approval-runs/url": { "get": { "tags": [ "Approval Runs" ], "operationId": "getApprovalRunUrl", "x-implementation-status": "implemented", "summary": "Get enterprise assist URL and optional source document URL", "parameters": [ { "name": "corpId", "in": "query", "schema": { "type": "string" }, "description": "Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used." }, { "name": "recordId", "in": "query", "schema": { "type": "string" } }, { "name": "sourceDocumentSN", "in": "query", "schema": { "type": "string" } }, { "name": "sourceDocumentId", "in": "query", "schema": { "type": "string" } } ], "responses": { "200": { "description": "Enterprise and document URLs.", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true, "properties": { "enterpriseAssistUrl": { "type": "string" }, "enterpriseUrl": { "type": "string" }, "documentUrl": { "type": "string" }, "recordId": { "type": "string" }, "sourceDocumentSN": { "type": "string" } } } } } } } } }, "/v1/approval-runs/{recordId}": { "parameters": [ { "name": "recordId", "in": "path", "required": true, "schema": { "type": "string" }, "description": "seal-use approval run record ID." } ], "get": { "tags": [ "Approval Runs" ], "operationId": "getApprovalRun", "x-implementation-status": "implemented", "summary": "Get wrapped approval run detail", "parameters": [ { "name": "summary", "in": "query", "schema": { "type": "boolean" } }, { "name": "fields", "in": "query", "schema": { "type": "string" }, "description": "Comma-separated field paths such as metadata,document.fields,result.summary." } ], "responses": { "200": { "description": "Approval run detail plus stable aliases and human result.", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true } } } } } } }, "/v1/approval-runs/{recordId}/cited-rules": { "parameters": [ { "name": "recordId", "in": "path", "required": true, "schema": { "type": "string" }, "description": "seal-use approval run record ID." } ], "get": { "tags": [ "Approval Runs" ], "operationId": "getApprovalRunCitedRules", "x-implementation-status": "implemented", "summary": "Extract rules cited or matched by the AI result", "responses": { "200": { "description": "Cited rule summaries.", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true } } } } } } }, "/v1/approval-runs/{recordId}/document-summary": { "parameters": [ { "name": "recordId", "in": "path", "required": true, "schema": { "type": "string" }, "description": "seal-use approval run record ID." } ], "get": { "tags": [ "Approval Runs" ], "operationId": "getApprovalRunDocumentSummary", "x-implementation-status": "implemented", "summary": "Get key document fields and compact AI/manual result", "responses": { "200": { "description": "Document summary.", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true } } } } } } }, "/v1/approval-runs/{recordId}/attachments": { "parameters": [ { "name": "recordId", "in": "path", "required": true, "schema": { "type": "string" }, "description": "seal-use approval run record ID." } ], "get": { "tags": [ "Approval Runs" ], "operationId": "getApprovalRunAttachments", "x-implementation-status": "implemented", "summary": "List compact attachment metadata", "parameters": [ { "name": "summary", "in": "query", "schema": { "type": "boolean" } } ], "responses": { "200": { "description": "Attachment metadata.", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true } } } } } } }, "/v1/approval-runs/{recordId}/result": { "parameters": [ { "name": "recordId", "in": "path", "required": true, "schema": { "type": "string" }, "description": "seal-use approval run record ID." } ], "get": { "tags": [ "Approval Runs" ], "operationId": "getApprovalRunResult", "x-implementation-status": "implemented", "summary": "Get AI result, optionally as a compact summary", "parameters": [ { "name": "summary", "in": "query", "schema": { "type": "boolean" } } ], "responses": { "200": { "description": "AI result or summary.", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true } } } } } } }, "/v1/simulation/create-batch": { "post": { "tags": [ "Simulation" ], "operationId": "createSimulationBatch", "x-implementation-status": "implemented", "summary": "Create a simulation batch", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true } } } }, "responses": { "200": { "description": "Created batch id.", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true } } } } } } }, "/v1/simulation/create-material-pack-batch": { "post": { "tags": [ "Simulation" ], "operationId": "createMaterialPackBatch", "x-implementation-status": "planned", "summary": "Create a material pack simulation batch", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true } } } }, "responses": { "200": { "description": "Created batch id.", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true } } } } } } }, "/v1/simulation/batches": { "get": { "tags": [ "Simulation" ], "operationId": "listSimulationBatches", "x-implementation-status": "implemented", "summary": "List simulation batches", "parameters": [ { "name": "limit", "in": "query", "schema": { "type": "integer" }, "description": "Max batches to return." } ], "responses": { "200": { "description": "Simulation batches.", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "object", "additionalProperties": true } } } } } } } }, "/v1/simulation/batch/{batchId}": { "parameters": [ { "name": "batchId", "in": "path", "required": true, "schema": { "type": "string" }, "description": "Simulation batch ID." } ], "get": { "tags": [ "Simulation" ], "operationId": "getSimulationBatch", "x-implementation-status": "implemented", "summary": "Get a simulation batch detail including echoed create params", "responses": { "200": { "description": "Simulation batch detail.", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true } } } } } } }, "/v1/simulation/batches/{batchId}/records": { "parameters": [ { "name": "batchId", "in": "path", "required": true, "schema": { "type": "string" }, "description": "Simulation batch ID." } ], "get": { "tags": [ "Simulation" ], "operationId": "getSimulationBatchRecords", "x-implementation-status": "planned", "summary": "Get wrapped simulation batch records", "parameters": [ { "name": "query", "in": "query", "schema": { "type": "string" }, "description": "Optional local contains filter for record/document/trace identifiers." } ], "responses": { "200": { "description": "Compact simulation records and bridge hints.", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true } } } } } } }, "/v1/simulation/templates": { "get": { "tags": [ "Simulation" ], "operationId": "listSimulationTemplates", "x-implementation-status": "planned", "summary": "List simulation test templates", "responses": { "200": { "description": "Simulation templates.", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "object", "additionalProperties": true } } } } } } } }, "/v1/simulation/integration-status": { "get": { "tags": [ "Simulation" ], "operationId": "getSimulationIntegrationStatus", "x-implementation-status": "planned", "summary": "Get available source integration status for simulation", "responses": { "200": { "description": "Integration status.", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true } } } } } } }, "/v1/simulation/hosecloud-integrations": { "get": { "tags": [ "Simulation" ], "operationId": "listSimulationHosecloudIntegrations", "x-implementation-status": "planned", "summary": "List hosecloud source integrations available for simulation", "responses": { "200": { "description": "Hosecloud integrations.", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "object", "additionalProperties": true } } } } } } } }, "/v1/material-packages/upload": { "post": { "tags": [ "Simulation" ], "operationId": "uploadMaterialPackage", "x-implementation-status": "planned", "summary": "Upload a material package ZIP for simulation", "requestBody": { "required": true, "content": { "multipart/form-data": { "schema": { "type": "object", "properties": { "file": { "type": "string", "format": "binary" } } } } } }, "responses": { "200": { "description": "Parsed material package with schema config.", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true } } } } } } } }, "components": { "securitySchemes": { "localSession": { "type": "apiKey", "in": "header", "name": "X-Seal-Home-Session", "description": "Reserved header. The local adapter does not currently authenticate requests: it acts with\nthe credentials already stored on this machine for the selected enterprise. Keep it bound\nto loopback (`--host 127.0.0.1`) and do not expose the port to a network or an origin you\ndo not control.\n" } }, "parameters": { "CorpId": { "name": "corpId", "in": "query", "schema": { "type": "string" }, "description": "Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used." }, "Offset": { "name": "offset", "in": "query", "schema": { "type": "integer", "minimum": 0, "default": 0 }, "description": "Zero-based pagination offset." }, "Limit": { "name": "limit", "in": "query", "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 50 }, "description": "Maximum number of records to return." }, "RuleId": { "name": "ruleId", "in": "path", "required": true, "schema": { "type": "string" }, "description": "Approval rule ID." }, "VersionId": { "name": "versionId", "in": "path", "required": true, "schema": { "type": "string" }, "description": "Published rule version ID." }, "DocumentId": { "name": "documentId", "in": "path", "required": true, "schema": { "type": "string" }, "description": "Approval knowledge document ID." }, "RecordId": { "name": "recordId", "in": "path", "required": true, "schema": { "type": "string" }, "description": "seal-use approval run record ID." }, "BatchId": { "name": "batchId", "in": "path", "required": true, "schema": { "type": "string" }, "description": "Simulation batch ID." } }, "responses": { "BadRequest": { "description": "Invalid request.", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true, "required": [ "error" ], "properties": { "error": { "type": "string" }, "message": { "type": "string" }, "details": {} } } } } }, "Unauthorized": { "description": "Local service authentication failed or downstream Seal auth failed.", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true, "required": [ "error" ], "properties": { "error": { "type": "string" }, "message": { "type": "string" }, "details": {} } } } } }, "NotFound": { "description": "Requested resource was not found.", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true, "required": [ "error" ], "properties": { "error": { "type": "string" }, "message": { "type": "string" }, "details": {} } } } } } }, "schemas": { "ErrorResponse": { "type": "object", "additionalProperties": true, "required": [ "error" ], "properties": { "error": { "type": "string" }, "message": { "type": "string" }, "details": {} } }, "CorpSummary": { "type": "object", "required": [ "id", "name", "sourceType", "current" ], "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "sourceType": { "type": "string", "enum": [ "hose", "direct", "seal" ] }, "current": { "type": "boolean" } } }, "SwitchCorpRequest": { "type": "object", "required": [ "corpId" ], "properties": { "corpId": { "type": "string" } } }, "SwitchCorpResponse": { "type": "object", "required": [ "current", "id", "name" ], "properties": { "current": { "type": "boolean" }, "id": { "type": "string" }, "name": { "type": "string" } } }, "SourceConfig": { "type": "object", "additionalProperties": true, "description": "Redacted Seal enterprise config resolved from the configured source." }, "AuthStage": { "type": "object", "additionalProperties": true, "required": [ "name", "ok" ], "properties": { "name": { "type": "string", "examples": [ "hose.openapi", "hose.provisional", "seal.sso", "seal.whoami" ] }, "ok": { "type": "boolean" }, "error": { "type": "string" } } }, "AuthDiagnosis": { "type": "object", "required": [ "stages" ], "properties": { "stages": { "type": "array", "items": { "$ref": "#/components/schemas/AuthStage" } } } }, "SealUser": { "type": "object", "additionalProperties": true, "required": [ "id", "name" ], "properties": { "id": { "type": "string" }, "tenantId": { "type": "string" }, "name": { "type": "string" }, "isAdmin": { "type": "boolean" }, "permissions": { "type": "array", "items": { "type": "string" } } } }, "SealTenant": { "type": "object", "additionalProperties": true, "required": [ "id", "name" ], "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "tenantSlug": { "type": "string" } } }, "WhoamiResponse": { "type": "object", "required": [ "user", "tenant" ], "properties": { "user": { "$ref": "#/components/schemas/SealUser" }, "tenant": { "$ref": "#/components/schemas/SealTenant" } } }, "SessionResponse": { "type": "object", "additionalProperties": true, "required": [ "user", "session" ], "properties": { "user": { "$ref": "#/components/schemas/SealUser" }, "session": { "type": "object", "additionalProperties": true } } }, "ApprovalRule": { "type": "object", "additionalProperties": true, "required": [ "id", "description", "scope", "strictness" ], "properties": { "id": { "type": "string" }, "description": { "type": "string" }, "scope": { "type": "string" }, "strictness": { "type": "string", "enum": [ "MUST_FOLLOW", "SHOULD_FOLLOW", "SUGGESTION" ] }, "status": { "type": "string" } } }, "ApprovalRuleInput": { "type": "object", "required": [ "description", "scope", "strictness" ], "properties": { "description": { "type": "string" }, "scope": { "type": "string" }, "strictness": { "type": "string", "enum": [ "MUST_FOLLOW", "SHOULD_FOLLOW", "SUGGESTION" ] } } }, "ApprovalRulePatch": { "type": "object", "additionalProperties": false, "properties": { "description": { "type": "string" }, "scope": { "type": "string" }, "strictness": { "type": "string", "enum": [ "MUST_FOLLOW", "SHOULD_FOLLOW", "SUGGESTION" ] } } }, "ApprovalRulesResponse": { "type": "object", "required": [ "rules" ], "properties": { "rules": { "type": "array", "items": { "$ref": "#/components/schemas/ApprovalRule" } }, "hasPendingDeletes": { "type": "boolean" } } }, "RuleSetVersion": { "type": "object", "additionalProperties": true, "required": [ "id", "versionNumber", "versionName", "rules" ], "properties": { "id": { "type": "string" }, "versionNumber": { "type": "integer" }, "versionName": { "type": "string" }, "publishedByName": { "type": "string" }, "rules": { "type": "array", "items": { "type": "object", "additionalProperties": true } } } }, "PublishRuleVersionRequest": { "type": "object", "required": [ "versionName" ], "properties": { "versionName": { "type": "string" } } }, "ApprovalDocument": { "type": "object", "additionalProperties": true, "required": [ "id", "title", "content" ], "properties": { "id": { "type": "string" }, "title": { "type": "string" }, "purpose": { "type": "string" }, "content": { "type": "string", "description": "Usually Markdown." }, "contentType": { "type": "string" }, "status": { "type": "string" }, "enabled": { "type": "boolean" }, "scenarios": { "type": "array", "items": { "type": "string" } }, "tags": { "type": "array", "items": { "type": "string" } } } }, "ApprovalDocumentInput": { "type": "object", "required": [ "title", "purpose", "content" ], "properties": { "title": { "type": "string" }, "purpose": { "type": "string" }, "content": { "type": "string" }, "contentType": { "type": "string" }, "status": { "type": "string" }, "scenarios": { "type": "array", "items": { "type": "string" } }, "tags": { "type": "array", "items": { "type": "string" } } } }, "ApprovalDocumentPatch": { "type": "object", "additionalProperties": false, "properties": { "title": { "type": "string" }, "purpose": { "type": "string" }, "content": { "type": "string" }, "contentType": { "type": "string" }, "status": { "type": "string" }, "enabled": { "type": "boolean" }, "scenarios": { "type": "array", "items": { "type": "string" } }, "tags": { "type": "array", "items": { "type": "string" } } } }, "ApprovalDocumentsResponse": { "type": "object", "required": [ "articles" ], "properties": { "articles": { "type": "array", "items": { "$ref": "#/components/schemas/ApprovalDocument" } }, "total": { "type": "integer" } } }, "ApprovalStylePreferences": { "type": "object", "additionalProperties": true, "properties": { "tone": { "type": "string" }, "language": { "type": "string" }, "detailLevel": { "type": "string" }, "outputFormat": { "type": "string" }, "examples": { "type": "array", "items": { "type": "string" } }, "prohibitedPhrases": { "type": "array", "items": { "type": "string" } }, "customInstructions": { "type": "string" } } }, "ApprovalContext": { "type": "object", "required": [ "rules", "documents", "stylePreferences" ], "properties": { "rules": {}, "documents": {}, "stylePreferences": {} } }, "ApprovalSearchRequest": { "type": "object", "required": [ "keywords" ], "properties": { "keywords": { "type": "array", "minItems": 1, "items": { "type": "string" } }, "matchMode": { "type": "string", "enum": [ "any", "all" ] }, "areas": { "type": "array", "items": { "type": "string", "enum": [ "rules", "documents", "preferences" ] } }, "maxResults": { "type": "integer" } } }, "ApprovalSearchResponse": { "type": "object", "additionalProperties": true }, "ApprovalRun": { "type": "object", "additionalProperties": true, "required": [ "id" ], "properties": { "id": { "type": "string" }, "sourceDocumentSN": { "type": "string", "description": "External document number, often Hose/易快报单号." }, "sourceDocumentId": { "type": "string" }, "status": { "type": "string" }, "taskMode": { "type": "string" }, "finalExecutionMode": { "type": "string" }, "ruleSetVersionNumber": { "type": "integer" }, "langfuseTraceId": { "type": "string" }, "langfuseSessionFallback": { "type": "string" } } }, "ApprovalRunsResponse": { "type": "object", "additionalProperties": true, "required": [ "records" ], "properties": { "records": { "type": "array", "items": { "$ref": "#/components/schemas/ApprovalRun" } }, "total": { "type": "integer" }, "bridge": { "type": "array", "items": { "type": "object", "additionalProperties": true } } } }, "ApprovalRunsSummary": { "type": "object", "additionalProperties": true, "properties": { "date": { "type": "string" }, "timezone": { "type": "string" }, "matched": { "type": "integer" }, "statusCounts": { "type": "object", "additionalProperties": { "type": "integer" } }, "taskModeCounts": { "type": "object", "additionalProperties": { "type": "integer" } } } }, "RunUrlResponse": { "type": "object", "additionalProperties": true, "properties": { "enterpriseAssistUrl": { "type": "string" }, "enterpriseUrl": { "type": "string" }, "documentUrl": { "type": "string" }, "recordId": { "type": "string" }, "sourceDocumentSN": { "type": "string" } } }, "BridgeResponse": { "type": "object", "additionalProperties": true, "properties": { "count": { "type": "integer" }, "records": { "type": "array", "items": { "$ref": "#/components/schemas/ApprovalRun" } }, "bridge": { "type": "array", "items": { "type": "object", "additionalProperties": true } } } } } } }