Skip to main content

AIC V2 框架(分支 redesign-prototype)

业务可见性优先的新范式框架——框架 = 可选能力层(opt-in), 不是强制约束层。 打开一个应用, 30 秒内知道它在干嘛; 开发者写应用 = 传统写法 + 两个 API(ctx/mount)。

教程(tutorial/ 或 aic skills 分发到 .claude/.codex/.agent)

01-quickstart.md   3 分钟跑起来(init → 打开 app.py → 写业务 → 跑)
02-plugin.md       插件 = 普通包(apply(ctx))
03-ctx-events.md   ctx 用法 + 事件四模式
04-toolchain.md    工具链(init/graph/template/skills)
05-real-app.md     真实业务对照(review / constplan 迁移形态)

怎么跑

cd prototype
python verify.py             # 内核机制: 装配/事件/卸载零残留/覆盖可恢复(9/9)
python verify_events.py      # 事件四模式: EMIT/WATERFALL/PARALLEL/SERIAL(5/5)
python verify_review.py      # review 真实业务: 提取→检索→引擎→报告→事件(9/9)
python verify_constplan.py   # ConstPlan 真实业务: 创建→并行章节→合并→渲染→版本化(11/11)
python verify_toolchain.py   # 工具链端到端: init→运行→graph→template→skills(8/8)

# 工具链(V2 版 aic 命令; 或 pip install -e . 后 aic 全局可用)
python -m aic.cli init my_app --root <dir>          # 生成应用骨架
python -m aic.cli graph --app <app_dir>             # 计算图 graph-viz.html
python -m aic.cli template <src_app> --out <dir>    # 插件模板提取
python -m aic.cli skills --root <dir>               # V2 skill 分发

全量验证 42/42(5 套, 经真实 FastAPI TestClient)。

框架包结构(prototype/aic/)

aic/
├── __init__.py   统一入口(ctx/mount/unmount/mounted/Task/EventMode)
├── context.py    能力容器: register/get/effect/on/emit + 事件四模式
├── assembly.py   装配: mount/unmount(可逆, 零残留/不误伤)+ mounted()
├── task.py       会话信封 Task(可选, 不约束)
├── cli.py        命令入口: init / graph / template / skills(UTF-8 输出)
├── init.py       骨架生成(app.py + plugins/ + 示例插件 + README)
├── graph.py      计算图(AST 扫描: 装配/能力/依赖/事件 → graph-viz.html)
├── template.py   插件模板提取(plugins/ 全带走, 代码可见可改)
└── skills.py     V2 范式 skill 分发(三平台)

开发者只需要知道两个概念

ctx    能力容器: register(提供) / get(取用) / effect(清理) / on/emit(事件)
mount  装配插件(可逆: 卸载零残留——后台机制)

机制(全部后台, 不要求理解——框架替你做的)

  • 可逆装配: mount/unmount 零残留、不误伤
  • 覆盖可恢复: ctx.register 同 key 覆盖 → 撤销恢复前一个(换实现零改动)
  • 事件四模式: EMIT(观察)/ WATERFALL(中间件)/ PARALLEL(并发)/ SERIAL(顺序加工) ——插件间通信机制, 框架职责, 不是业务胶水
  • 会话信封 Task(可选): 多插件协作统一上下文(身份/工作区/元数据/轮次)
  • 装配可计算: mounted() / aic graph(装配/依赖/能力/事件 → graph-viz.html)
  • 工具: aic init / template(骨架与模板, 代码可见可改)

示例应用(真实业务验证)

demo/          文件转换(converter 业务插件 + extract 公共插件)
review_app/    审查(extract/standard/engine 公共插件 + service 普通模块)
constplan_app/ 施工方案编写(迁移自 ConstPlan: 分章并行→合并→渲染→版本化)
  • 业务 = 普通模块普通函数, 唯一 AIC 痕迹 = ctx.get("...") 取能力(像用 NumPy)
  • 公共能力 = 插件, mount 注入; 换引擎 = 同 key 覆盖(业务零改动)
  • 落盘 = 直接写文件(无产物通道); DB/Celery/MinIO 等生产化设施 = 普通库用法

不做的事

  • 不强制业务进插件(业务默认写在 app.py/普通模块, 可复用才抽)
  • 不预设会话模型(业务自己管状态, 落盘直接写文件)
  • 无壳布局契约 / 无注入声明 / 无 promote 上浮(插件平铺, 无私有公共之分)
  • HTTP/路由不归 AIC 管(应用直接用 FastAPI, 零新概念)

打包安装

pip install -e prototype      # 装 aic-v2 包 → aic 命令全局可用
# 注意: 与旧版 ai-composer(同名 aic 包)冲突, 正式切换需先卸载旧版

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aic_v2-3.0.0.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aic_v2-3.0.0-py3-none-any.whl (19.6 kB view details)

Uploaded Python 3

File details

Details for the file aic_v2-3.0.0.tar.gz.

File metadata

  • Download URL: aic_v2-3.0.0.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.4

File hashes

Hashes for aic_v2-3.0.0.tar.gz
Algorithm Hash digest
SHA256 b6dc72710a29f2920d507da101a161e5948603f98c8638aedfa6c1ad68b81103
MD5 c0bdab13cc8943873b155d5955d3aec7
BLAKE2b-256 2524d89c1158ccb3f8931ae14930b2db9fcafe33e2a2ba5b8c5834175c691bbd

See more details on using hashes here.

File details

Details for the file aic_v2-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: aic_v2-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 19.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.4

File hashes

Hashes for aic_v2-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0edc7e8e6759cd10b313f7a93a078d06740a1c89428587c086ed97a23913cced
MD5 49e8eb7498229f6a9b0629139745c601
BLAKE2b-256 75cddfa78453c95d69544edc5ce7c1a259ed78ed78f7ec96ad82eeb4acf57fa5

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

3.0.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page