/** * module: activity-registry —— 本模块要外界提供的能力(编码规范 §10.1 / §5.3)。 */ import type { ActivityManifest } from '@contracts'; import type { AssetKind, AssetVersion, IncrementState, PackageVersion, ReplayVerdict } from './internal/domain/versioning.ts'; export type Clock = { now(): Date }; export type IdGenerator = { next(): string }; export type RegistryStore = { /** 返回是否新增了这一包版本(同版重复安装返回 false) */ savePackage(manifest: ActivityManifest, artifact: string): Promise; listPackages(activityId?: string): Promise; manifest(activityId: string, packageVersion?: string): Promise; artifact(activityId: string, packageVersion: string): Promise; setEnabled(activityId: string, enabled: boolean): Promise; setState(activityId: string, version: string, state: PackageVersion['state']): Promise; enabledOf(activityId: string): Promise; listAssets(activityId: string): Promise; saveAsset(asset: AssetVersion, body: string): Promise; setAssetEffective(activityId: string, kind: AssetKind, version: number): Promise; saveIncrement(input: { id: string; activityId: string; kind: AssetKind; diff: string; evidenceEntryIds: readonly string[]; state: IncrementState; createdAt: Date; }): Promise; getIncrement(id: string): Promise< | { id: string; activityId: string; kind: AssetKind; diff: string; state: IncrementState; } | undefined >; setIncrementState(id: string, state: IncrementState, report?: ReplayVerdict, by?: string): Promise; }; /** 工具契约核对 —— app 注入 `toolbox`(L2):装不齐不上架 */ export type ToolContractProbe = { assertContractsAvailable(names: readonly string[]): Promise<{ ok: boolean; missing: string[] }>; }; /** 模型名核对 —— app 注入 `llm`(L1) */ export type ModelBindingProbe = { assertNamesBound(names: readonly string[]): Promise<{ ok: boolean; missing: string[] }>; }; /** 台账声明合并 —— app 注入 `ledger`(L1):安装时依声明自生长 */ export type LedgerDeclarationApplier = { applyDeclarations( declarations: ActivityManifest['declarations']['ledger'], ): Promise }>>; }; /** 模版净化门 —— app 注入 `interaction`(L3) */ export type TemplateGuard = { isSafe(html: string): boolean };