chore(deno): migrate toolchain from Node 24 + pnpm to Deno 2.9.7 + TypeScript 7.0.2 (W1.5)

- root deno.json workspace (nodeModulesDir auto), npm versions registered once in imports, deno.lock;
  remove pnpm-lock/pnpm-workspace/root package.json; members keep minimal package.json (name/type/exports)
- tasks: dev, typecheck (tsc 7.0.2 per member + deno check), lint/fmt (biome, useImportExtensions),
  test (vitest via deno), check:tokens, build (web + deno compile), ci, db:migrate/reset, gen:types
- tsconfig base moved to config/ (no root tsconfig.json); deno types -> types/deno.d.ts; web drops baseUrl
- server: Deno.serve entry with graceful shutdown, --role migrate|preflight|probe, WEB_ROOT static SPA hosting;
  drop @hono/node-server, tsx, esbuild build.mjs
- logger: redact child() bindings and serialize err by message/stack; sync stdout destination; tests
- relative imports get explicit extensions (sites/mp-sync paths left for follow-up)
- crash-recovery tests spawn `deno run -A`; tasks tests use unique per-file schemas
- single-container Dockerfile + entrypoint (migrate -> preflight -> api+worker watchdog), docker-compose.yml
- docs: README, runbook, ADR-001 superseded, plan §1 validation row

Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
rootandClaude Fable 5.1 committed 2026-09-27 18:53:06 +08:00
1 parent d9f2af2f3c
commit 304feea141
226 files changed
+6601 -8620

No files matched your search

+1 -1
View File
@@ -1,5 +1,5 @@
import { z } from "zod";
import { EntityBase, Id, JsonObject, NonNegInt, SERVER_MANAGED, Timestamp } from "./common";
import { EntityBase, Id, JsonObject, NonNegInt, SERVER_MANAGED, Timestamp } from "./common.ts";
// 人工/AI 域:Agent 运行、证据/计划产物、待处理事项、审批、持续授权(REQ §10、§11.3、§11.4)
+13 -13
View File
@@ -1,17 +1,17 @@
import { z } from "zod";
import * as agent from "./agent";
import * as assets from "./assets";
import { CapabilityDescriptor, KnownCapabilityId } from "./capability";
import { type ApiScope, CursorQuery, cursorPage, Id, IdParam } from "./common";
import * as content from "./content";
import * as execution from "./execution";
import * as identity from "./identity";
import * as instances from "./instances";
import * as ops from "./ops";
import * as organization from "./organization";
import * as policy from "./policy";
import { GlobalSettings, GlobalSettingsUpdate } from "./settings";
import * as sources from "./sources";
import * as agent from "./agent.ts";
import * as assets from "./assets.ts";
import { CapabilityDescriptor, KnownCapabilityId } from "./capability.ts";
import { type ApiScope, CursorQuery, cursorPage, Id, IdParam } from "./common.ts";
import * as content from "./content.ts";
import * as execution from "./execution.ts";
import * as identity from "./identity.ts";
import * as instances from "./instances.ts";
import * as ops from "./ops.ts";
import * as organization from "./organization.ts";
import * as policy from "./policy.ts";
import { GlobalSettings, GlobalSettingsUpdate } from "./settings.ts";
import * as sources from "./sources.ts";
// 所有 REST 端点的路径常量与请求/响应 schema 汇总。
// path 相对 API_PREFIX,参数用 OpenAPI 风格 `{id}`(server 的 createRoute 直接使用);
+2 -2
View File
@@ -1,6 +1,6 @@
import { z } from "zod";
import { EntityBase, Id, JsonObject, NonNegInt, SERVER_MANAGED, Timestamp } from "./common";
import { Segment } from "./content";
import { EntityBase, Id, JsonObject, NonNegInt, SERVER_MANAGED, Timestamp } from "./common.ts";
import { Segment } from "./content.ts";
// 文件域:资产、资产-内容单元覆盖、资产位置、路径绑定(REQ §7.1、§8.2、§12.2)
// 资产与位置分离;path_binding 一旦建立不因元数据刷新改变,只有显式整理可替换(旧绑定标 superseded)。
+10 -10
View File
@@ -1,14 +1,14 @@
import { z } from "zod";
import { MediaAsset } from "./assets";
import type { KnownCapabilityId } from "./capability";
import { Id, JsonObject, NonNegInt } from "./common";
import { MediaEntity, MediaKind } from "./content";
import { AcquisitionPlan, DownloadTask, Task, TaskStatus } from "./execution";
import { ExternalEntityType, ExternalIdentity } from "./identity";
import { ServerMapping } from "./ops";
import { OrganizationAction, OrganizationRecord } from "./organization";
import { AcquisitionSlot, PolicyRevision } from "./policy";
import { SourceRelease } from "./sources";
import { MediaAsset } from "./assets.ts";
import type { KnownCapabilityId } from "./capability.ts";
import { Id, JsonObject, NonNegInt } from "./common.ts";
import { MediaEntity, MediaKind } from "./content.ts";
import { AcquisitionPlan, DownloadTask, Task, TaskStatus } from "./execution.ts";
import { ExternalEntityType, ExternalIdentity } from "./identity.ts";
import { ServerMapping } from "./ops.ts";
import { OrganizationAction, OrganizationRecord } from "./organization.ts";
import { AcquisitionSlot, PolicyRevision } from "./policy.ts";
import { SourceRelease } from "./sources.ts";
// 首批能力的输入/输出 schema;名字与 CAPABILITY_CATALOG 中的 inputSchema/outputSchema 一致。
// 写能力的输入只接受计划/对象 ID,不接受模型自拟的幂等键或任意路径。
+1 -1
View File
@@ -1,5 +1,5 @@
import { z } from "zod";
import { ApiScope } from "./common";
import { ApiScope } from "./common.ts";
/**
* 能力调用上下文(REQ §10.3)。产品自有接口,不是 Pi SDK 原生 API。
+1 -1
View File
@@ -1,5 +1,5 @@
import { z } from "zod";
import { DateOnly, EntityBase, Id, JsonObject, SERVER_MANAGED, Timestamp } from "./common";
import { DateOnly, EntityBase, Id, JsonObject, SERVER_MANAGED, Timestamp } from "./common.ts";
// 内容域:本地作品、内容单元、别名(REQ §3.1、§5.1、§5.4、§7.5)
// 本地 UUID 是主身份;季/集编号、外部 ID 都可修订,不是唯一身份。
+5 -5
View File
@@ -1,9 +1,9 @@
import { z } from "zod";
import { AgentRunStatus, DecisionKind, DecisionStatus, Severity } from "./agent";
import { Id, NonNegInt, Timestamp } from "./common";
import { DownloadStatus, PauseReason, TaskKind, TaskStatus } from "./execution";
import { OrganizationStatus } from "./organization";
import { FeedHealth } from "./sources";
import { AgentRunStatus, DecisionKind, DecisionStatus, Severity } from "./agent.ts";
import { Id, NonNegInt, Timestamp } from "./common.ts";
import { DownloadStatus, PauseReason, TaskKind, TaskStatus } from "./execution.ts";
import { OrganizationStatus } from "./organization.ts";
import { FeedHealth } from "./sources.ts";
/** SSE 事件信封:seq 在进程内单调递增,客户端断线后用 ?after=<seq> 补读 */
export const EventEnvelope = z.object({
+2 -2
View File
@@ -1,6 +1,6 @@
import { z } from "zod";
import { EntityBase, Id, JsonObject, NonNegInt, SERVER_MANAGED, Timestamp } from "./common";
import { AcquisitionPriority } from "./policy";
import { EntityBase, Id, JsonObject, NonNegInt, SERVER_MANAGED, Timestamp } from "./common.ts";
import { AcquisitionPriority } from "./policy.ts";
// 执行域:业务任务、下载计划、下载任务、操作账本(REQ §8.4、§11;ADR-002)
+1 -1
View File
@@ -1,5 +1,5 @@
import { z } from "zod";
import { ActorType, EntityBase, Id, JsonObject, Timestamp } from "./common";
import { ActorType, EntityBase, Id, JsonObject, Timestamp } from "./common.ts";
// 身份域:外部身份映射与修订(REQ §7.2)
// provider + entityType + externalId 对 accepted 唯一;TMDB movie:123 与 tv:123 是两个身份。
+16 -16
View File
@@ -1,16 +1,16 @@
export * from "./agent";
export * from "./api";
export * from "./assets";
export * from "./capabilities-io";
export * from "./capability";
export * from "./common";
export * from "./content";
export * from "./events";
export * from "./execution";
export * from "./identity";
export * from "./instances";
export * from "./ops";
export * from "./organization";
export * from "./policy";
export * from "./settings";
export * from "./sources";
export * from "./agent.ts";
export * from "./api.ts";
export * from "./assets.ts";
export * from "./capabilities-io.ts";
export * from "./capability.ts";
export * from "./common.ts";
export * from "./content.ts";
export * from "./events.ts";
export * from "./execution.ts";
export * from "./identity.ts";
export * from "./instances.ts";
export * from "./ops.ts";
export * from "./organization.ts";
export * from "./policy.ts";
export * from "./settings.ts";
export * from "./sources.ts";
+1 -1
View File
@@ -1,5 +1,5 @@
import { z } from "zod";
import { EntityBase, Id, JsonObject, SERVER_MANAGED, Timestamp } from "./common";
import { EntityBase, Id, JsonObject, SERVER_MANAGED, Timestamp } from "./common.ts";
// 实例域:媒体库根、下载器实例、媒体服务器实例、路径映射(REQ §7.1、§8.4、§12.5)
// 凭证只以 secretRef 暴露;创建/更新时的 credential 是只写明文,服务端加密为 secret 后丢弃。
+1 -1
View File
@@ -1,5 +1,5 @@
import { z } from "zod";
import { ActorType, ApiScope, EntityBase, Id, JsonObject, NonNegInt, SERVER_MANAGED, Timestamp } from "./common";
import { ActorType, ApiScope, EntityBase, Id, JsonObject, NonNegInt, SERVER_MANAGED, Timestamp } from "./common.ts";
// 运维域:校验运行、媒体服务器库存映射、API Key、审计、outbox、凭证(REQ §8.1、§7.4、§13.2)
+2 -2
View File
@@ -1,6 +1,6 @@
import { z } from "zod";
import { ActorType, EntityBase, Id, JsonObject, NonNegInt, Timestamp } from "./common";
import { MediaKind } from "./content";
import { ActorType, EntityBase, Id, JsonObject, NonNegInt, Timestamp } from "./common.ts";
import { MediaKind } from "./content.ts";
// 整理域:整理记录(批次)+ 逐文件结果,以及对外开放的整理记录 API 合同(REQ §12.4)
// 自动与手动整理产生同格式记录;读记录需 organize.read,发起整理需 organize.execute。
+1 -1
View File
@@ -1,5 +1,5 @@
import { z } from "zod";
import { EntityBase, Id, JsonObject, SERVER_MANAGED, Timestamp } from "./common";
import { EntityBase, Id, JsonObject, SERVER_MANAGED, Timestamp } from "./common.ts";
// 规则域:订阅、策略版本、收录 Slot、偏好标签与抑制记录(REQ §6)
+1 -1
View File
@@ -1,5 +1,5 @@
import { z } from "zod";
import { Id, Timestamp } from "./common";
import { Id, Timestamp } from "./common.ts";
// 全局设置:存于 settings 表(key → jsonb)。每个顶层分组对应一个 settings.key。
// schema 本身不带 .default()(zod 4 在 partial 里仍会套默认值,会让 PATCH 覆盖现值);
+1 -1
View File
@@ -1,5 +1,5 @@
import { z } from "zod";
import { EntityBase, Id, JsonObject, NonNegInt, SERVER_MANAGED, Timestamp } from "./common";
import { EntityBase, Id, JsonObject, NonNegInt, SERVER_MANAGED, Timestamp } from "./common.ts";
// 来源域:站点、站点账号、Feed、站点资源、观察(REQ §4)
// 含 passkey 的 Feed URL 只以 urlSecretRef 保存,对外只给脱敏的 urlDisplay。