feat(workspace): pnpm monorepo 骨架与包边界(A1.1)
六个包:@aps/contracts、@aps/provider-sdk、@aps/server、@aps/client-app、@aps/desktop、@aps/provider-aps。依赖方向 contracts <- provider-sdk <- server <- client,providers/* 只依赖 provider-sdk。TypeScript 项目引用串起构建,pnpm typecheck 全绿。server 内部按 entry/app/agent/core/workflows 建目录并写明各自不该出现什么。
This commit is contained in:
parent
fd14783e0e
commit
d2aa837579
|
|
@ -75,3 +75,7 @@ beihai-shipyard-aps-data/
|
|||
/Pi-Agent兜底能力详细方案.md
|
||||
/Pi-Agent接入计划.md
|
||||
/Pi-Agent接入详细计划.md
|
||||
|
||||
# ---- 新平台构建产物(TS 项目引用输出)----
|
||||
dist/
|
||||
*.tsbuildinfo
|
||||
|
|
|
|||
39
README.md
39
README.md
|
|
@ -24,13 +24,40 @@
|
|||
|
||||
设计文档在飞书评审中,评审通过后随本分支的后续提交入库(任务表 A0.10)。在此之前仓库里没有设计文档是正常的。
|
||||
|
||||
## 目录规划
|
||||
## 目录与包
|
||||
|
||||
一个 pnpm monorepo,四个一级目录(架构设计第 2 节):
|
||||
|
||||
```
|
||||
client/ 客户端(桌面 Electron 与浏览器共用)
|
||||
server/ 平台服务(entry / app / agent / core / provider-sdk / workflows)
|
||||
providers/ Provider 适配器(aps / erp / ems)
|
||||
contracts/ 客户端与服务端共享的契约
|
||||
contracts/ @aps/contracts 共享契约(只有类型,无运行时依赖)
|
||||
server/ @aps/server 平台服务:entry / app / agent / core / workflows
|
||||
server/provider-sdk/ @aps/provider-sdk 业务系统接入平台的契约与契约测试
|
||||
providers/aps/ @aps/provider-aps APS 适配器(ERP / EMS 同构)
|
||||
client/app/ @aps/client-app 界面:对话、工作区、审批
|
||||
client/desktop/ @aps/desktop Electron 壳:窗口、本地守护、离线升级
|
||||
docs/ 架构、ADR、规范与评测集
|
||||
```
|
||||
|
||||
骨架随 A1 建立。
|
||||
依赖方向(A1.2 接入 CI 检查):
|
||||
|
||||
```
|
||||
contracts ← provider-sdk ← server ← client
|
||||
↑
|
||||
providers/*
|
||||
```
|
||||
|
||||
## 快速开始
|
||||
|
||||
```bash
|
||||
pnpm install # 需要 Node >= 22.19.0
|
||||
pnpm typecheck # 等价于 tsc -b,按项目引用顺序构建全部包
|
||||
```
|
||||
|
||||
## 开发约定
|
||||
|
||||
| 约定 | 出处 |
|
||||
| --- | --- |
|
||||
| 能力命名与描述七要素 | `docs/spec/capability-description.md` |
|
||||
| 问法评测集与门槛 | `docs/eval/README.md` |
|
||||
| 数据存储写法(整数毫秒、应用侧主键、JSONB/TEXT) | `docs/adr/0007-storage-and-consistency.md` |
|
||||
| 架构决策记录 | `docs/adr/`(写完不改,改结论就新写一份) |
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
/**
|
||||
* 客户端界面(架构设计第 2 节):对话、工作区、审批。
|
||||
*
|
||||
* 只做界面与本地能力;业务判断、权限判断、持有业务凭据都不在这里。
|
||||
* 界面只认平台事件(@aps/contracts 的 PlatformEvent),对引擎无感。
|
||||
*/
|
||||
export const CLIENT_APP_PACKAGE = '@aps/client-app';
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"name": "@aps/client-app",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"scripts": {
|
||||
"typecheck": "tsc -b"
|
||||
},
|
||||
"dependencies": {
|
||||
"@aps/contracts": "workspace:*"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": ".",
|
||||
"outDir": "dist",
|
||||
"tsBuildInfoFile": "dist/.tsbuildinfo",
|
||||
"lib": ["ES2022", "DOM"]
|
||||
},
|
||||
"include": ["index.ts"],
|
||||
"references": [{ "path": "../../contracts" }]
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
/**
|
||||
* Electron 壳(ADR-0004):窗口、本地守护、离线升级。
|
||||
*
|
||||
* 本地能力(文件、打印、设备)归属这一层;不装业务逻辑,不绕开服务端调业务系统。
|
||||
* 落地见任务 A10.5(壳与本地守护)与 A10.6(离线升级与回滚)。
|
||||
*/
|
||||
export const DESKTOP_PACKAGE = '@aps/desktop';
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"name": "@aps/desktop",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"scripts": {
|
||||
"typecheck": "tsc -b"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": ".",
|
||||
"outDir": "dist",
|
||||
"tsBuildInfoFile": "dist/.tsbuildinfo"
|
||||
},
|
||||
"include": ["index.ts"]
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
/**
|
||||
* 客户端与服务端共享的契约(架构设计第 2 节)。
|
||||
*
|
||||
* 只放类型与模式定义,不引入运行时依赖:这一层被所有包依赖,任何依赖都会变成全局耦合。
|
||||
* 引擎差异不在这里体现——引擎事件经适配层转成下面的平台事件,界面对引擎无感。
|
||||
*/
|
||||
|
||||
/** 能力标识,形如 `aps.schedule.preview`。命名与描述规范见 docs/spec/capability-description.md */
|
||||
export type CapabilityId = string;
|
||||
|
||||
/** 执行回执:所有能力调用的统一返回(架构设计 4.2) */
|
||||
export interface ExecutionReceipt {
|
||||
executionId: string;
|
||||
status: 'accepted' | 'succeeded' | 'failed' | 'pending-confirmation';
|
||||
result?: unknown;
|
||||
errorKind?: string;
|
||||
}
|
||||
|
||||
/** 平台事件:唯一面向客户端的事件形态(实施设计 1.7 定义事件模型) */
|
||||
export type PlatformEvent =
|
||||
| { type: 'message.delta'; sessionId: string; text: string }
|
||||
| { type: 'tool.call'; sessionId: string; capabilityId: CapabilityId }
|
||||
| { type: 'receipt'; sessionId: string; receipt: ExecutionReceipt };
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"name": "@aps/contracts",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"typecheck": "tsc -b"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"extends": "../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": ".",
|
||||
"outDir": "dist",
|
||||
"tsBuildInfoFile": "dist/.tsbuildinfo"
|
||||
},
|
||||
"include": ["index.ts"]
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"name": "aps-agent-platform",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"engines": {
|
||||
"node": ">=22.19.0"
|
||||
},
|
||||
"scripts": {
|
||||
"typecheck": "tsc -b",
|
||||
"build": "tsc -b",
|
||||
"clean": "tsc -b --clean"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^7.0.2"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,259 @@
|
|||
lockfileVersion: '9.0'
|
||||
|
||||
settings:
|
||||
autoInstallPeers: true
|
||||
excludeLinksFromLockfile: false
|
||||
|
||||
importers:
|
||||
|
||||
.:
|
||||
devDependencies:
|
||||
typescript:
|
||||
specifier: ^7.0.2
|
||||
version: 7.0.2
|
||||
|
||||
client/app:
|
||||
dependencies:
|
||||
'@aps/contracts':
|
||||
specifier: workspace:*
|
||||
version: link:../../contracts
|
||||
|
||||
client/desktop: {}
|
||||
|
||||
contracts: {}
|
||||
|
||||
providers/aps:
|
||||
dependencies:
|
||||
'@aps/contracts':
|
||||
specifier: workspace:*
|
||||
version: link:../../contracts
|
||||
'@aps/provider-sdk':
|
||||
specifier: workspace:*
|
||||
version: link:../../server/provider-sdk
|
||||
|
||||
server:
|
||||
dependencies:
|
||||
'@aps/contracts':
|
||||
specifier: workspace:*
|
||||
version: link:../contracts
|
||||
'@aps/provider-sdk':
|
||||
specifier: workspace:*
|
||||
version: link:provider-sdk
|
||||
|
||||
server/provider-sdk:
|
||||
dependencies:
|
||||
'@aps/contracts':
|
||||
specifier: workspace:*
|
||||
version: link:../../contracts
|
||||
|
||||
packages:
|
||||
|
||||
'@typescript/typescript-aix-ppc64@7.0.2':
|
||||
resolution: {integrity: sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ==}
|
||||
engines: {node: '>=16.20.0'}
|
||||
cpu: [ppc64]
|
||||
os: [aix]
|
||||
|
||||
'@typescript/typescript-darwin-arm64@7.0.2':
|
||||
resolution: {integrity: sha512-gowzar9MwS/aRWp6f3a4KUqzRjAZjOsmGNCM6LcTgXum+dBfgsBVMN+AgvOCCbguXyick6LJhpBszxMebJ8syA==}
|
||||
engines: {node: '>=16.20.0'}
|
||||
cpu: [arm64]
|
||||
os: [darwin]
|
||||
|
||||
'@typescript/typescript-darwin-x64@7.0.2':
|
||||
resolution: {integrity: sha512-SZ9xZInqApNlNGc9s0W1VSsktYSOe9cFqNOIqmN1Gs8SmkjKZYFt017G4VwPxASInODuAdbTW7sXiFUf893RgA==}
|
||||
engines: {node: '>=16.20.0'}
|
||||
cpu: [x64]
|
||||
os: [darwin]
|
||||
|
||||
'@typescript/typescript-freebsd-arm64@7.0.2':
|
||||
resolution: {integrity: sha512-W5NH4y/J0plIIS5b2xvTEkU7JFxyqdMAOgf+Ilhl0vHQXKO5dZoxd+C/jEtq56c4F3wk71RB4BMRQ2XdI+bwYQ==}
|
||||
engines: {node: '>=16.20.0'}
|
||||
cpu: [arm64]
|
||||
os: [freebsd]
|
||||
|
||||
'@typescript/typescript-freebsd-x64@7.0.2':
|
||||
resolution: {integrity: sha512-UMGDx5sTpzNw3WiPebH7l90IWfJggEd+egHt/q6p7/Cm3zqoV7VxkGXt+3DxPIw8CcmvAB0j3sVVfbhX+M4Tpw==}
|
||||
engines: {node: '>=16.20.0'}
|
||||
cpu: [x64]
|
||||
os: [freebsd]
|
||||
|
||||
'@typescript/typescript-linux-arm64@7.0.2':
|
||||
resolution: {integrity: sha512-Qh4eU4/y3yDjnfjjyPYihMj5/ODIlmt+Bzu17OI+fiSRDW57QmU5SiN63exPRNJPKUzcc1INa1NXdrJ+MqHjUQ==}
|
||||
engines: {node: '>=16.20.0'}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
|
||||
'@typescript/typescript-linux-arm@7.0.2':
|
||||
resolution: {integrity: sha512-gffT3xPz9sR7j/YJExkyPntrI0P2EP9XbOyWzth2/Gs0RstK+90RBcO0ncXoXy/beYll1SXw846Nf2zdnEz0QQ==}
|
||||
engines: {node: '>=16.20.0'}
|
||||
cpu: [arm]
|
||||
os: [linux]
|
||||
|
||||
'@typescript/typescript-linux-loong64@7.0.2':
|
||||
resolution: {integrity: sha512-uEHck9i8hoAzXPiYRib1O7miOnz23SxIeVl6F4LXox+qov1K35jHcEW6VHKvZI+pyvl7fZEP4MCU5LYvIq1GuQ==}
|
||||
engines: {node: '>=16.20.0'}
|
||||
cpu: [loong64]
|
||||
os: [linux]
|
||||
|
||||
'@typescript/typescript-linux-mips64el@7.0.2':
|
||||
resolution: {integrity: sha512-R4KvAMnE43W5Qeqb0Ly56O3mWMWIAgsMyz36DCaycd5nbg/9kzm0liw3JocfRqyJY0KPmzFjbswozXyW0DnIYA==}
|
||||
engines: {node: '>=16.20.0'}
|
||||
cpu: [mips64el]
|
||||
os: [linux]
|
||||
|
||||
'@typescript/typescript-linux-ppc64@7.0.2':
|
||||
resolution: {integrity: sha512-DORx5b3sd/4S7eayxm4FQv+A7CrkUIGRaHiwI8oiHTAI1fAPWhF4J0vAlkC8biAlHSVVwxMQ3tjZ2/DVbnQiiA==}
|
||||
engines: {node: '>=16.20.0'}
|
||||
cpu: [ppc64]
|
||||
os: [linux]
|
||||
|
||||
'@typescript/typescript-linux-riscv64@7.0.2':
|
||||
resolution: {integrity: sha512-wf0jqEDOjrPRnKwYRyyJDRo11KMbvMFrU+q4zqKyChODBzvlkbhNQfKvLxQCcwTpdDaXSHZTVuh0JoCrKCUMHQ==}
|
||||
engines: {node: '>=16.20.0'}
|
||||
cpu: [riscv64]
|
||||
os: [linux]
|
||||
|
||||
'@typescript/typescript-linux-s390x@7.0.2':
|
||||
resolution: {integrity: sha512-IkwJc3L7yhytWd/ewjyxNDfOmswCm9GWMJT/ue/dU4aZNbwZeYAetq42VyLmsmSjvoX7z74X6ZaYCtzAr0EuGw==}
|
||||
engines: {node: '>=16.20.0'}
|
||||
cpu: [s390x]
|
||||
os: [linux]
|
||||
|
||||
'@typescript/typescript-linux-x64@7.0.2':
|
||||
resolution: {integrity: sha512-EYdf2cNg7rgCWJnxCdJ+F3V39O8ihb37eHAu1LK8oAFizgTQbPOK7zHHXbPt8rX24COqODXeI3sIf0fCXG7H/A==}
|
||||
engines: {node: '>=16.20.0'}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
|
||||
'@typescript/typescript-netbsd-arm64@7.0.2':
|
||||
resolution: {integrity: sha512-+polYF4MF04aPpO5FTkHran9yUQDSXqy5GiSDKpsll5jy3l3+g9QLhpf39T+ePtefhXLOGrLl0QIjkQP6VnelA==}
|
||||
engines: {node: '>=16.20.0'}
|
||||
cpu: [arm64]
|
||||
os: [netbsd]
|
||||
|
||||
'@typescript/typescript-netbsd-x64@7.0.2':
|
||||
resolution: {integrity: sha512-8YIT0EHM/3dq10ZOVF/A7pc/YSMtbcecct4rWtexrnSCHOPcpC2KTLXfTCR6vDpnSiY12heNb1GiN/wu+T/FyA==}
|
||||
engines: {node: '>=16.20.0'}
|
||||
cpu: [x64]
|
||||
os: [netbsd]
|
||||
|
||||
'@typescript/typescript-openbsd-arm64@7.0.2':
|
||||
resolution: {integrity: sha512-APT8+ClYnuYm1u9+kgGXoMj2VzWzcymwh2gNSQVySHfkRDGOTVkoWLjCmOQSaO+PoqQ57B0flRp9SA+7GnnkzQ==}
|
||||
engines: {node: '>=16.20.0'}
|
||||
cpu: [arm64]
|
||||
os: [openbsd]
|
||||
|
||||
'@typescript/typescript-openbsd-x64@7.0.2':
|
||||
resolution: {integrity: sha512-yX7s+Q0Dln0Dt9tEzZsAjXXR/+ytBM7AlglaqyeMPxQszJ1JhlJdZ6jLA+IzldHtflX81em7lDao1xXu+aRRkg==}
|
||||
engines: {node: '>=16.20.0'}
|
||||
cpu: [x64]
|
||||
os: [openbsd]
|
||||
|
||||
'@typescript/typescript-sunos-x64@7.0.2':
|
||||
resolution: {integrity: sha512-dLJDGaLZ1D4HPQn62u1n8mBDkJREwMsAkCdkwd4Ieqw+x3TUyTsqY0YiBCtE6H6OzzgGk3iuZ3vFWRS+E8/d1g==}
|
||||
engines: {node: '>=16.20.0'}
|
||||
cpu: [x64]
|
||||
os: [sunos]
|
||||
|
||||
'@typescript/typescript-win32-arm64@7.0.2':
|
||||
resolution: {integrity: sha512-Gyl1Vy6OsWesLzmq+EP0Fb7b4Nid5232AvcA2SFcdYreldpNtYFFofPjnt62y9hQy7VTaZp65ICJjuAQRaVcIQ==}
|
||||
engines: {node: '>=16.20.0'}
|
||||
cpu: [arm64]
|
||||
os: [win32]
|
||||
|
||||
'@typescript/typescript-win32-x64@7.0.2':
|
||||
resolution: {integrity: sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g==}
|
||||
engines: {node: '>=16.20.0'}
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
|
||||
typescript@7.0.2:
|
||||
resolution: {integrity: sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA==}
|
||||
engines: {node: '>=16.20.0'}
|
||||
hasBin: true
|
||||
|
||||
snapshots:
|
||||
|
||||
'@typescript/typescript-aix-ppc64@7.0.2':
|
||||
optional: true
|
||||
|
||||
'@typescript/typescript-darwin-arm64@7.0.2':
|
||||
optional: true
|
||||
|
||||
'@typescript/typescript-darwin-x64@7.0.2':
|
||||
optional: true
|
||||
|
||||
'@typescript/typescript-freebsd-arm64@7.0.2':
|
||||
optional: true
|
||||
|
||||
'@typescript/typescript-freebsd-x64@7.0.2':
|
||||
optional: true
|
||||
|
||||
'@typescript/typescript-linux-arm64@7.0.2':
|
||||
optional: true
|
||||
|
||||
'@typescript/typescript-linux-arm@7.0.2':
|
||||
optional: true
|
||||
|
||||
'@typescript/typescript-linux-loong64@7.0.2':
|
||||
optional: true
|
||||
|
||||
'@typescript/typescript-linux-mips64el@7.0.2':
|
||||
optional: true
|
||||
|
||||
'@typescript/typescript-linux-ppc64@7.0.2':
|
||||
optional: true
|
||||
|
||||
'@typescript/typescript-linux-riscv64@7.0.2':
|
||||
optional: true
|
||||
|
||||
'@typescript/typescript-linux-s390x@7.0.2':
|
||||
optional: true
|
||||
|
||||
'@typescript/typescript-linux-x64@7.0.2':
|
||||
optional: true
|
||||
|
||||
'@typescript/typescript-netbsd-arm64@7.0.2':
|
||||
optional: true
|
||||
|
||||
'@typescript/typescript-netbsd-x64@7.0.2':
|
||||
optional: true
|
||||
|
||||
'@typescript/typescript-openbsd-arm64@7.0.2':
|
||||
optional: true
|
||||
|
||||
'@typescript/typescript-openbsd-x64@7.0.2':
|
||||
optional: true
|
||||
|
||||
'@typescript/typescript-sunos-x64@7.0.2':
|
||||
optional: true
|
||||
|
||||
'@typescript/typescript-win32-arm64@7.0.2':
|
||||
optional: true
|
||||
|
||||
'@typescript/typescript-win32-x64@7.0.2':
|
||||
optional: true
|
||||
|
||||
typescript@7.0.2:
|
||||
optionalDependencies:
|
||||
'@typescript/typescript-aix-ppc64': 7.0.2
|
||||
'@typescript/typescript-darwin-arm64': 7.0.2
|
||||
'@typescript/typescript-darwin-x64': 7.0.2
|
||||
'@typescript/typescript-freebsd-arm64': 7.0.2
|
||||
'@typescript/typescript-freebsd-x64': 7.0.2
|
||||
'@typescript/typescript-linux-arm': 7.0.2
|
||||
'@typescript/typescript-linux-arm64': 7.0.2
|
||||
'@typescript/typescript-linux-loong64': 7.0.2
|
||||
'@typescript/typescript-linux-mips64el': 7.0.2
|
||||
'@typescript/typescript-linux-ppc64': 7.0.2
|
||||
'@typescript/typescript-linux-riscv64': 7.0.2
|
||||
'@typescript/typescript-linux-s390x': 7.0.2
|
||||
'@typescript/typescript-linux-x64': 7.0.2
|
||||
'@typescript/typescript-netbsd-arm64': 7.0.2
|
||||
'@typescript/typescript-netbsd-x64': 7.0.2
|
||||
'@typescript/typescript-openbsd-arm64': 7.0.2
|
||||
'@typescript/typescript-openbsd-x64': 7.0.2
|
||||
'@typescript/typescript-sunos-x64': 7.0.2
|
||||
'@typescript/typescript-win32-arm64': 7.0.2
|
||||
'@typescript/typescript-win32-x64': 7.0.2
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
# 工作区定义(任务 A1.1)。包边界与依赖方向见 docs/adr/0001 与架构设计第 2 节。
|
||||
packages:
|
||||
- contracts
|
||||
- server
|
||||
- server/provider-sdk
|
||||
- client/app
|
||||
- client/desktop
|
||||
- providers/aps
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
/**
|
||||
* APS Provider(架构设计第 6 节):把 APS 的能力翻译成平台契约。
|
||||
*
|
||||
* 只做适配:参数校验、调用 APS、结果归一化。不判断权限、不碰模型上下文。
|
||||
* APS 本身是独立系统(Python),以现有代码搬迁适配——见决策 D8 与任务 B1~B7。
|
||||
*/
|
||||
import type { CapabilityProvider, ProviderManifest } from '@aps/provider-sdk';
|
||||
|
||||
export const APS_PROVIDER_ID = 'aps';
|
||||
|
||||
export function manifest(): ProviderManifest {
|
||||
return { id: APS_PROVIDER_ID, capabilities: [] };
|
||||
}
|
||||
|
||||
export const provider: Pick<CapabilityProvider, 'manifest'> = { manifest };
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"name": "@aps/provider-aps",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"scripts": {
|
||||
"typecheck": "tsc -b"
|
||||
},
|
||||
"dependencies": {
|
||||
"@aps/contracts": "workspace:*",
|
||||
"@aps/provider-sdk": "workspace:*"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": ".",
|
||||
"outDir": "dist",
|
||||
"tsBuildInfoFile": "dist/.tsbuildinfo"
|
||||
},
|
||||
"include": ["index.ts"],
|
||||
"references": [
|
||||
{ "path": "../../contracts" },
|
||||
{ "path": "../../server/provider-sdk" }
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
# @aps/server
|
||||
|
||||
平台服务。目录按架构设计第 2 节建立,各模块的边界与「不该出现什么」以该节为准。
|
||||
|
||||
| 目录 | 职责 | 不该出现什么 |
|
||||
| --- | --- | --- |
|
||||
| `entry/` | HTTP / SSE 入口、会话、鉴权 | 业务规则、直接调业务系统 |
|
||||
| `app/` | 请求编排、能力查询、审批流转、事件推送 | 引擎内部概念、直接 import Pi |
|
||||
| `agent/` | 引擎适配:`AgentRuntime` 接口 + Pi / Codex 实现 | 业务规则、碰凭据 |
|
||||
| `core/` | 能力目录、身份映射、策略、凭据、执行、审计 | 业务数据、直接拼业务系统 URL |
|
||||
| `workflows/` | 跨系统顺序流程 | 配置化 DAG 引擎 |
|
||||
|
||||
依赖方向(A1.2 会接入 CI 检查):
|
||||
|
||||
```
|
||||
contracts ← provider-sdk ← server ← client
|
||||
↑
|
||||
providers/*
|
||||
```
|
||||
|
||||
- `providers/*` 只依赖 `@aps/provider-sdk`(与 `@aps/contracts`),不依赖 `@aps/server`
|
||||
- 只有 `agent/` 允许 import 引擎包;其它模块必须经这一层
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
/**
|
||||
* 平台服务(架构设计第 2 节):引擎中立的服务端。
|
||||
*
|
||||
* 内部模块与边界:
|
||||
* entry/ HTTP / SSE 入口、会话、鉴权(只做协议,不做业务)
|
||||
* app/ 应用服务:请求编排、能力查询、审批流转、事件推送
|
||||
* agent/ 引擎适配:统一 AgentRuntime 接口 + Pi / Codex 实现(唯一允许 import 引擎的地方)
|
||||
* core/ 控制面:能力目录、身份、策略、凭据、执行、审计
|
||||
* workflows/ 跨系统顺序流程
|
||||
*
|
||||
* 依赖方向:contracts ← provider-sdk ← server ← client。server 不 import client 与 providers/*。
|
||||
*/
|
||||
export const SERVER_PACKAGE = '@aps/server';
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"name": "@aps/server",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"typecheck": "tsc -b"
|
||||
},
|
||||
"dependencies": {
|
||||
"@aps/contracts": "workspace:*",
|
||||
"@aps/provider-sdk": "workspace:*"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
/**
|
||||
* Provider 契约(架构设计第 6 节):业务系统接入平台的唯一形状。
|
||||
*
|
||||
* 只有三个方法:查能力、执行、查状态。Provider 是适配器,不是业务系统,也不承载模型上下文。
|
||||
* 能力描述怎么写见 docs/spec/capability-description.md;契约测试套件见任务 A2.4。
|
||||
*/
|
||||
import type { CapabilityId, ExecutionReceipt } from '@aps/contracts';
|
||||
|
||||
export interface ProviderManifest {
|
||||
id: string;
|
||||
capabilities: CapabilityId[];
|
||||
}
|
||||
|
||||
export interface CapabilityProvider {
|
||||
manifest(): ProviderManifest;
|
||||
execute(capabilityId: CapabilityId, params: unknown): Promise<ExecutionReceipt>;
|
||||
status(executionId: string): Promise<ExecutionReceipt>;
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"name": "@aps/provider-sdk",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"typecheck": "tsc -b"
|
||||
},
|
||||
"dependencies": {
|
||||
"@aps/contracts": "workspace:*"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": ".",
|
||||
"outDir": "dist",
|
||||
"tsBuildInfoFile": "dist/.tsbuildinfo"
|
||||
},
|
||||
"include": ["index.ts"],
|
||||
"references": [{ "path": "../../contracts" }]
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"extends": "../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": ".",
|
||||
"outDir": "dist",
|
||||
"tsBuildInfoFile": "dist/.tsbuildinfo"
|
||||
},
|
||||
"include": ["index.ts", "entry", "app", "agent", "core", "workflows"],
|
||||
"exclude": ["provider-sdk"],
|
||||
"references": [
|
||||
{ "path": "../contracts" },
|
||||
{ "path": "provider-sdk" }
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2022",
|
||||
"lib": ["ES2022"],
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"strict": true,
|
||||
"noUncheckedIndexedAccess": true,
|
||||
"exactOptionalPropertyTypes": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"isolatedModules": true,
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"sourceMap": true,
|
||||
"composite": true,
|
||||
"incremental": true,
|
||||
"noEmitOnError": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"files": [],
|
||||
"references": [
|
||||
{ "path": "contracts" },
|
||||
{ "path": "server/provider-sdk" },
|
||||
{ "path": "server" },
|
||||
{ "path": "client/app" },
|
||||
{ "path": "client/desktop" },
|
||||
{ "path": "providers/aps" }
|
||||
]
|
||||
}
|
||||
Loading…
Reference in New Issue