yumoqing 19a3d67c68 feat: 投标产线模块(bidding_general)
- 12张 bid_* 表(models+DDL+CRUD):招标信息/邮箱配置/人员/招标文件/评分项/资质/
  投标文件要求/章节/评审/评分/知识库/标书
- 7个角色能力模块(bid_*_capability):采集摘要/解析/知识库资质/编写/评审/合成/评分
- bid_flow 状态对账器:角色任务唯一创建者+阻塞门禁(源头守门,引擎零特判)
- bid_mail:阿里云企业邮 IMAP 采集(凭据存DB AES,客户端专用密码兼容)
- 能力包注册(bid_ability)+ 角色工具自注册(role_tool_schemas)
- 技能:6 common 状态机/规范 + 9 角色技能(pipelines/bidding_general,随 pipeline-core 部署)
- i18n(zh/en)、init/data.json(appcodes+pipelines记录)、build.sh、RBAC load_path
2026-08-26 23:45:03 +08:00

59 lines
2.2 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""pipeline-bidding 模块装载入口。
宿主应用(pipeline-app)在 init() 中调用 load_pipeline_bidding() 即挂载投标产线:
能力包注册(bid_ability)+ 角色工具 schema 注册(role_tool_schemas)+ 对账器启动(bid_flow)。
未装本模块的宿主完全零接触(不 import 本包则以上全部不发生)。
表结构不在此处建(铁律:运行期不做 schema 变更),建表走部署期:
json2ddl 生成 → build.sh 应用 / 人工执行(见 build.sh)。
"""
import logging
logger = logging.getLogger("pipeline.bidding")
_loaded = False
def load_pipeline_bidding():
"""挂载投标产线(幂等)。"""
global _loaded
if _loaded:
return True
ok = True
# 1. 角色工具 schema → 引擎分发字典(全路径模块,引擎裸名约定不变)
try:
from .role_tool_schemas import register_role_tools
n = register_role_tools()
logger.info("[pipeline_bidding] role tool schemas: %d", n)
except Exception as e:
logger.warning("[pipeline_bidding] role tool schema 注册失败: %s", str(e)[:200])
ok = False
# 2. 主 agent 能力包 + slash 命令(import 即注册,与开发产线同机制)
try:
from . import bid_ability # noqa: F401
logger.info("[pipeline_bidding] ability registered: bidding_general")
except Exception as e:
logger.warning("[pipeline_bidding] ability 注册失败: %s", str(e)[:200])
ok = False
# 3. 状态对账器(角色任务唯一创建者 + 阻塞门禁守门)。
# PIPELINE_MODE=web 时不注册(与引擎 poller 同款模式开关)。
import os
mode = (os.environ.get("PIPELINE_MODE", "all") or "all").strip().lower()
if mode in ("all", "worker"):
try:
from .bid_flow import start_poller
start_poller()
except Exception as e:
logger.warning("[pipeline_bidding] poller 启动失败: %s", str(e)[:200])
ok = False
else:
logger.info("[pipeline_bidding] PIPELINE_MODE=web,poller 不启动")
_loaded = ok or _loaded
logger.info("[pipeline_bidding] v0.1.0 loaded")
return True