重构模型平台前后端并移除Redis依赖

This commit is contained in:
Winnie
2026-07-30 19:03:00 +08:00
commit c74b2abb48
172 changed files with 40825 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
# OpenAPI 契约
- `platform-api-v1.yaml`:浏览器访问的公共业务接口。
- `demo-core-extension-v1.yaml`:第 15 小步冻结的 Demo 目标扩展接口;
`platform-api-v1.yaml` 合并后构成完整公共 API v1。
- `storage-api-internal-v1.yaml`Storage Service 内部接口。
- `runtime-api-internal-v1.yaml`Runtime Manager 内部接口。
现有服务契约由对应 FastAPI 应用生成;目标扩展契约先冻结、后实现,不能
标记为已上线。所有文件均纳入结构校验。公共接口统一使用 `/api/v1`
内部服务接口统一使用 `/internal/v1`
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,699 @@
openapi: 3.1.0
info:
title: runtime-manager service
version: 0.1.0
paths:
/:
get:
summary: Root
operationId: root__get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
additionalProperties:
type: string
type: object
title: Response Root Get
/health/live:
get:
summary: Live
operationId: live_health_live_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
additionalProperties:
type: string
type: object
title: Response Live Health Live Get
/api/v1/health:
get:
summary: Public Health
operationId: public_health_api_v1_health_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
additionalProperties:
type: string
type: object
title: Response Public Health Api V1 Health Get
/health/ready:
get:
summary: Ready
operationId: ready_health_ready_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
additionalProperties: true
type: object
title: Response Ready Health Ready Get
/internal/v1/file-locks/acquire:
post:
summary: Acquire File Lock
operationId: acquire_file_lock_internal_v1_file_locks_acquire_post
parameters:
- name: X-Service-Token
in: header
required: true
schema:
type: string
title: X-Service-Token
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AcquireFileLockRequest'
responses:
'201':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties: true
title: Response Acquire File Lock Internal V1 File Locks Acquire Post
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/internal/v1/file-locks/{edit_session_id}/heartbeat:
post:
summary: Heartbeat File Lock
operationId: heartbeat_file_lock_internal_v1_file_locks__edit_session_id__heartbeat_post
parameters:
- name: edit_session_id
in: path
required: true
schema:
type: string
title: Edit Session Id
- name: X-Service-Token
in: header
required: true
schema:
type: string
title: X-Service-Token
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/FileLockTokenRequest'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties: true
title: Response Heartbeat File Lock Internal V1 File Locks Edit Session Id Heartbeat
Post
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/internal/v1/file-locks/{edit_session_id}:
delete:
summary: Release File Lock
operationId: release_file_lock_internal_v1_file_locks__edit_session_id__delete
parameters:
- name: edit_session_id
in: path
required: true
schema:
type: string
title: Edit Session Id
- name: X-Service-Token
in: header
required: true
schema:
type: string
title: X-Service-Token
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/FileLockTokenRequest'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties: true
title: Response Release File Lock Internal V1 File Locks Edit Session Id Delete
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/internal/v1/jupyter/access-tickets/{edit_session_id}:
post:
summary: Create Jupyter Access Ticket
operationId: create_jupyter_access_ticket_internal_v1_jupyter_access_tickets__edit_session_id__post
parameters:
- name: edit_session_id
in: path
required: true
schema:
type: string
title: Edit Session Id
- name: X-Service-Token
in: header
required: true
schema:
type: string
title: X-Service-Token
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/FileLockTokenRequest'
responses:
'201':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties: true
title: Response Create Jupyter Access Ticket Internal V1 Jupyter Access Tickets Edit
Session Id Post
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/internal/v1/jupyter/authorize:
get:
summary: Authorize Jupyter Proxy
operationId: authorize_jupyter_proxy_internal_v1_jupyter_authorize_get
parameters:
- name: X-Original-URI
in: header
required: true
schema:
type: string
title: X-Original-Uri
- name: X-Service-Token
in: header
required: true
schema:
type: string
title: X-Service-Token
- name: jupyter_access
in: cookie
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: Jupyter Access
responses:
'204':
description: Successful Response
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/internal/v1/runtimes/ensure:
post:
summary: Ensure Runtime
operationId: ensure_runtime_internal_v1_runtimes_ensure_post
parameters:
- name: X-Service-Token
in: header
required: true
schema:
type: string
title: X-Service-Token
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/EnsureRuntimeApiRequest'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties: true
title: Response Ensure Runtime Internal V1 Runtimes Ensure Post
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/internal/v1/runtimes/{runtime_id}:
get:
summary: Get Runtime
operationId: get_runtime_internal_v1_runtimes__runtime_id__get
parameters:
- name: runtime_id
in: path
required: true
schema:
type: string
title: Runtime Id
- name: workspace_id
in: query
required: true
schema:
type: string
minLength: 26
maxLength: 26
title: Workspace Id
- name: user_id
in: query
required: true
schema:
type: string
minLength: 26
maxLength: 26
title: User Id
- name: X-Service-Token
in: header
required: true
schema:
type: string
title: X-Service-Token
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties: true
title: Response Get Runtime Internal V1 Runtimes Runtime Id Get
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
delete:
summary: Stop Runtime
operationId: stop_runtime_internal_v1_runtimes__runtime_id__delete
parameters:
- name: runtime_id
in: path
required: true
schema:
type: string
title: Runtime Id
- name: X-Service-Token
in: header
required: true
schema:
type: string
title: X-Service-Token
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/StopRuntimeApiRequest'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties: true
title: Response Stop Runtime Internal V1 Runtimes Runtime Id Delete
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/internal/v1/runtimes/{runtime_id}/restart:
post:
summary: Restart Runtime
operationId: restart_runtime_internal_v1_runtimes__runtime_id__restart_post
parameters:
- name: runtime_id
in: path
required: true
schema:
type: string
title: Runtime Id
- name: X-Service-Token
in: header
required: true
schema:
type: string
title: X-Service-Token
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/RuntimeIdentityRequest'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties: true
title: Response Restart Runtime Internal V1 Runtimes Runtime Id Restart Post
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/internal/v1/runtimes/{runtime_id}/sessions:
post:
summary: Create Runtime Session
operationId: create_runtime_session_internal_v1_runtimes__runtime_id__sessions_post
parameters:
- name: runtime_id
in: path
required: true
schema:
type: string
title: Runtime Id
- name: X-Service-Token
in: header
required: true
schema:
type: string
title: X-Service-Token
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateRuntimeSessionApiRequest'
responses:
'201':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties: true
title: Response Create Runtime Session Internal V1 Runtimes Runtime Id Sessions Post
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/internal/v1/runtimes/{runtime_id}/sessions/{session_id}:
delete:
summary: Terminate Runtime Session
operationId: terminate_runtime_session_internal_v1_runtimes__runtime_id__sessions__session_id__delete
parameters:
- name: runtime_id
in: path
required: true
schema:
type: string
title: Runtime Id
- name: session_id
in: path
required: true
schema:
type: string
title: Session Id
- name: X-Service-Token
in: header
required: true
schema:
type: string
title: X-Service-Token
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/RuntimeIdentityRequest'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties: true
title: Response Terminate Runtime Session Internal V1 Runtimes Runtime Id Sessions Session
Id Delete
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/internal/health/runtime:
get:
summary: Internal Health
operationId: internal_health_internal_health_runtime_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
additionalProperties:
type: string
type: object
title: Response Internal Health Internal Health Runtime Get
components:
schemas:
AcquireFileLockRequest:
properties:
workspace_id:
type: string
maxLength: 26
minLength: 26
title: Workspace Id
storage_object_id:
type: string
maxLength: 26
minLength: 26
title: Storage Object Id
user_id:
type: string
maxLength: 26
minLength: 26
title: User Id
request_id:
anyOf:
- type: string
maxLength: 64
minLength: 1
- type: 'null'
title: Request Id
additionalProperties: false
type: object
required:
- workspace_id
- storage_object_id
- user_id
title: AcquireFileLockRequest
CreateRuntimeSessionApiRequest:
properties:
workspace_id:
type: string
maxLength: 26
minLength: 26
title: Workspace Id
user_id:
type: string
maxLength: 26
minLength: 26
title: User Id
request_id:
anyOf:
- type: string
maxLength: 64
minLength: 1
- type: 'null'
title: Request Id
storage_object_id:
type: string
maxLength: 26
minLength: 26
title: Storage Object Id
relative_path:
type: string
maxLength: 1024
minLength: 1
title: Relative Path
additionalProperties: false
type: object
required:
- workspace_id
- user_id
- storage_object_id
- relative_path
title: CreateRuntimeSessionApiRequest
EnsureRuntimeApiRequest:
properties:
workspace_id:
type: string
maxLength: 26
minLength: 26
title: Workspace Id
user_id:
type: string
maxLength: 26
minLength: 26
title: User Id
request_id:
anyOf:
- type: string
maxLength: 64
minLength: 1
- type: 'null'
title: Request Id
additionalProperties: false
type: object
required:
- workspace_id
- user_id
title: EnsureRuntimeApiRequest
FileLockTokenRequest:
properties:
workspace_id:
type: string
maxLength: 26
minLength: 26
title: Workspace Id
user_id:
type: string
maxLength: 26
minLength: 26
title: User Id
lock_token:
type: string
maxLength: 256
minLength: 32
title: Lock Token
additionalProperties: false
type: object
required:
- workspace_id
- user_id
- lock_token
title: FileLockTokenRequest
HTTPValidationError:
properties:
detail:
items:
$ref: '#/components/schemas/ValidationError'
type: array
title: Detail
type: object
title: HTTPValidationError
RuntimeIdentityRequest:
properties:
workspace_id:
type: string
maxLength: 26
minLength: 26
title: Workspace Id
user_id:
type: string
maxLength: 26
minLength: 26
title: User Id
request_id:
anyOf:
- type: string
maxLength: 64
minLength: 1
- type: 'null'
title: Request Id
additionalProperties: false
type: object
required:
- workspace_id
- user_id
title: RuntimeIdentityRequest
StopRuntimeApiRequest:
properties:
workspace_id:
type: string
maxLength: 26
minLength: 26
title: Workspace Id
user_id:
type: string
maxLength: 26
minLength: 26
title: User Id
request_id:
anyOf:
- type: string
maxLength: 64
minLength: 1
- type: 'null'
title: Request Id
reason:
type: string
maxLength: 64
minLength: 1
title: Reason
default: client_request
additionalProperties: false
type: object
required:
- workspace_id
- user_id
title: StopRuntimeApiRequest
ValidationError:
properties:
loc:
items:
anyOf:
- type: string
- type: integer
type: array
title: Location
msg:
type: string
title: Message
type:
type: string
title: Error Type
type: object
required:
- loc
- msg
- type
title: ValidationError
@@ -0,0 +1,550 @@
openapi: 3.1.0
info:
title: storage-api service
version: 0.1.0
paths:
/:
get:
summary: Root
operationId: root__get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
additionalProperties:
type: string
type: object
title: Response Root Get
/health/live:
get:
summary: Live
operationId: live_health_live_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
additionalProperties:
type: string
type: object
title: Response Live Health Live Get
/api/v1/health:
get:
summary: Public Health
operationId: public_health_api_v1_health_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
additionalProperties:
type: string
type: object
title: Response Public Health Api V1 Health Get
/health/ready:
get:
summary: Ready
operationId: ready_health_ready_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
additionalProperties: true
type: object
title: Response Ready Health Ready Get
/internal/v1/uploads:
post:
summary: Create Upload
operationId: create_upload_internal_v1_uploads_post
parameters:
- name: X-Service-Token
in: header
required: true
schema:
type: string
title: X-Service-Token
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateUploadRequest'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties: true
title: Response Create Upload Internal V1 Uploads Post
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/internal/v1/uploads/{upload_id}/complete:
post:
summary: Complete Upload
operationId: complete_upload_internal_v1_uploads__upload_id__complete_post
parameters:
- name: upload_id
in: path
required: true
schema:
type: string
title: Upload Id
- name: X-Service-Token
in: header
required: true
schema:
type: string
title: X-Service-Token
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CompleteUploadRequest'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties: true
title: Response Complete Upload Internal V1 Uploads Upload Id Complete Post
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/internal/v1/uploads/{upload_id}/abort:
post:
summary: Abort Upload
operationId: abort_upload_internal_v1_uploads__upload_id__abort_post
parameters:
- name: upload_id
in: path
required: true
schema:
type: string
title: Upload Id
- name: X-Service-Token
in: header
required: true
schema:
type: string
title: X-Service-Token
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties: true
title: Response Abort Upload Internal V1 Uploads Upload Id Abort Post
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/internal/v1/objects:
post:
summary: Create Server Object
operationId: create_server_object_internal_v1_objects_post
parameters:
- name: X-Service-Token
in: header
required: true
schema:
type: string
title: X-Service-Token
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ServerObjectRequest'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties: true
title: Response Create Server Object Internal V1 Objects Post
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/internal/v1/workspace-objects:
post:
summary: Register Workspace Object
operationId: register_workspace_object_internal_v1_workspace_objects_post
parameters:
- name: X-Service-Token
in: header
required: true
schema:
type: string
title: X-Service-Token
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/RegisterWorkspaceObjectRequest'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties: true
title: Response Register Workspace Object Internal V1 Workspace Objects Post
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/internal/v1/objects/{storage_object_id}/download-url:
post:
summary: Create Download Url
operationId: create_download_url_internal_v1_objects__storage_object_id__download_url_post
parameters:
- name: storage_object_id
in: path
required: true
schema:
type: string
title: Storage Object Id
- name: X-Service-Token
in: header
required: true
schema:
type: string
title: X-Service-Token
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/DownloadUrlRequest'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties: true
title: Response Create Download Url Internal V1 Objects Storage Object Id Download Url
Post
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/internal/v1/objects/{storage_object_id}:
delete:
summary: Delete Object
operationId: delete_object_internal_v1_objects__storage_object_id__delete
parameters:
- name: storage_object_id
in: path
required: true
schema:
type: string
title: Storage Object Id
- name: X-Service-Token
in: header
required: true
schema:
type: string
title: X-Service-Token
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties: true
title: Response Delete Object Internal V1 Objects Storage Object Id Delete
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/internal/health/storage:
get:
summary: Internal Health
operationId: internal_health_internal_health_storage_get
responses:
'200':
description: Successful Response
content:
application/json:
schema:
additionalProperties:
type: string
type: object
title: Response Internal Health Internal Health Storage Get
components:
schemas:
CompleteUploadRequest:
properties:
usage_type:
type: string
enum:
- data_resource
- version_artifact
- snapshot
- run_log
- run_result
title: Usage Type
visibility:
type: string
enum:
- private
- workspace
- public
title: Visibility
default: private
is_immutable:
type: boolean
title: Is Immutable
default: false
additionalProperties: false
type: object
required:
- usage_type
title: CompleteUploadRequest
CreateUploadRequest:
properties:
workspace_id:
type: string
maxLength: 26
minLength: 26
title: Workspace Id
user_id:
type: string
maxLength: 26
minLength: 26
title: User Id
usage_type:
type: string
enum:
- data_resource
- version_artifact
- snapshot
- run_log
- run_result
title: Usage Type
file_name:
type: string
maxLength: 255
minLength: 1
title: File Name
content_type:
type: string
maxLength: 255
minLength: 1
title: Content Type
expected_size_bytes:
type: integer
maximum: 104857600.0
minimum: 0.0
title: Expected Size Bytes
expected_hash:
anyOf:
- type: string
maxLength: 64
minLength: 64
- type: 'null'
title: Expected Hash
idempotency_key:
type: string
maxLength: 128
minLength: 8
title: Idempotency Key
url_scope:
type: string
enum:
- public
- internal
title: Url Scope
default: public
additionalProperties: false
type: object
required:
- workspace_id
- user_id
- usage_type
- file_name
- content_type
- expected_size_bytes
- idempotency_key
title: CreateUploadRequest
DownloadUrlRequest:
properties:
expires_seconds:
type: integer
maximum: 3600.0
minimum: 30.0
title: Expires Seconds
default: 300
additionalProperties: false
type: object
title: DownloadUrlRequest
HTTPValidationError:
properties:
detail:
items:
$ref: '#/components/schemas/ValidationError'
type: array
title: Detail
type: object
title: HTTPValidationError
RegisterWorkspaceObjectRequest:
properties:
workspace_id:
type: string
maxLength: 26
minLength: 26
title: Workspace Id
user_id:
type: string
maxLength: 26
minLength: 26
title: User Id
relative_path:
type: string
maxLength: 1024
minLength: 1
title: Relative Path
usage_type:
type: string
enum:
- working_copy
- public_script
title: Usage Type
visibility:
type: string
enum:
- private
- workspace
- public
title: Visibility
default: private
additionalProperties: false
type: object
required:
- workspace_id
- user_id
- relative_path
- usage_type
title: RegisterWorkspaceObjectRequest
ServerObjectRequest:
properties:
workspace_id:
type: string
maxLength: 26
minLength: 26
title: Workspace Id
user_id:
type: string
maxLength: 26
minLength: 26
title: User Id
usage_type:
type: string
enum:
- data_resource
- version_artifact
- snapshot
- run_log
- run_result
title: Usage Type
file_name:
type: string
maxLength: 255
minLength: 1
title: File Name
content_type:
type: string
maxLength: 255
minLength: 1
title: Content Type
content_base64:
type: string
minLength: 1
title: Content Base64
visibility:
type: string
enum:
- private
- workspace
- public
title: Visibility
default: private
is_immutable:
type: boolean
title: Is Immutable
default: false
idempotency_key:
type: string
maxLength: 128
minLength: 8
title: Idempotency Key
additionalProperties: false
type: object
required:
- workspace_id
- user_id
- usage_type
- file_name
- content_type
- content_base64
- idempotency_key
title: ServerObjectRequest
ValidationError:
properties:
loc:
items:
anyOf:
- type: string
- type: integer
type: array
title: Location
msg:
type: string
title: Message
type:
type: string
title: Error Type
type: object
required:
- loc
- msg
- type
title: ValidationError