Files
UHD_Media_Tool/packages/contracts
rootandClaude Opus 5.5 ceff9cf51f feat(ao): W4-E3 manual organize guard, series completion, engine retry, v0.1.0
- POST /organization-records: sourcePaths must resolve (realpath) under a
  registered library_root or downloader path-mapping host path; `..` and
  symlink escapes rejected (400), dryRun included. Move requires an admin
  session, or an API key with an automation_grant covering the entity or a
  matching one-time approval (consumed on use), else 403. Manual Move from a
  managed download_task with unsatisfied H&R returns 409 and opens a
  decision; never silently downgraded to Copy.
- Series slot completion: total episode count is unknown while units are
  provisional, so the slot is not satisfied and the subscription keeps
  tracking; coverage is registered per actual file (creating provisional
  episode units), and already_in_library files count as verified presence.
- POST /engine/runs/{id}/retry (admin): re-enqueue by original task name and
  raw input with idempotency key retry:<id>:<n>, audited; retry button on
  the run detail page.
- E7 regular series e2e, E8 AT24 tag removal / task disappearance e2e.
- All workspace members and root set to version 0.1.0; CHANGELOG.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-27 22:47:11 +08:00
..

@umt/contracts

所有 API、SSE 事件与能力(capability)输入输出的唯一定义(zod 4 schema + 推导出的 TS 类型)。web 与 server 共用,任何一端都不得手写重复 DTO;新增接口先在这里加 schema,再由 server 用 @hono/zod-openapi 生成 OpenAPI。

文件 内容
common.ts Id、Timestamp、DateOnly、JsonObject、游标分页、错误码、响应信封、ApiScope、ActorType
content.ts / identity.ts / assets.ts / sources.ts / policy.ts / execution.ts / agent.ts / ops.ts / organization.ts / instances.ts 每张表的 Row schema(camelCase、日期为 ISO 字符串)+ XxxCreate / XxxUpdate 输入
organization.ts 另含公开整理记录合同:PublicOrganizationRecord、OrganizationChangesQuery/Response(change_seq 游标)、OrganizeRequest
settings.ts GlobalSettings、DEFAULT_SETTINGS、GlobalSettingsUpdate、mergeSettings()
capability.ts / capabilities-io.ts CapabilityDescriptor、首批 14 个能力 ID 与目录、各能力 Input/Output schema、CAPABILITY_IO
events.ts SSE 信封、EventType、EVENT_PAYLOADS、TypedEvent 判别联合
api.ts Api 端点表(method/path/scope/params/query/body/response)、buildPath()、listEndpoints()

约定:

  • Row schema 与 packages/db/src/types.ts 的列一一对应(test/db-sync.test.ts 校验);只在 DB 存在的列(密文、key_hash、change_xid)不对外。
  • 凭证类输入(credential、url、plaintext、apiKey)只写不回显。
  • schema 不用 .default() 做可部分更新对象的缺省(zod 4 在 partial 里仍会填默认值);缺省值放常量。