Skip to main content

Wire protocol for the tabapp agent platform — artifacts, events, tools, sessions.

Project description

tabapp-protocol

tabapp agent 平台的 wire 协议层 —— artifact / event / tool / session 的 canonical schema。一份源生成两个发行包:

发行 包名 安装 import
PyPI tabapp-protocol pip install tabapp-protocol from tabapp_protocol import ...
npm @tabapp/protocol pnpm add @tabapp/protocol import { ... } from '@tabapp/protocol'

Python Pydantic 模型是权威源。schemas/ 下的 JSON Schema 由 Python 导出,TS 类型再从 JSON Schema 自动生成。

目录

backend/libs/protocol/
├── pyproject.toml             Python 包配置(tabapp-protocol)
├── version.py                 PROTOCOL_VERSION 单一来源
├── _common.py                 共享原子类型(ProducerRef 等)
├── artifacts/                 /v1/audio /v1/image ... + discriminated union
├── events/                    EventEnvelope + 15 种事件类型
├── tools/                     ToolDescriptor + 副作用枚举
├── session/                   SessionConfig + subagent 模板
├── tenancy/                   TenantIdentity / AuthContext / UsageRecord
├── api/                       HTTP 请求/响应壳
├── openapi/generate.py        生成 schemas/*.schema.json
├── schemas/                   生成的 JSON Schema(已入版本)
└── codegen/
    └── ts/                    @tabapp/protocol —— TS 包源码与 codegen

构建与发布

# Python —— wheel + sdist 进 dist/
cd backend/libs/protocol
python -m build
twine upload dist/*

# TypeScript —— 先刷新 JSON Schema,再 transpile
python -m libs.protocol.openapi.generate     # 刷新 schemas/*.schema.json
cd codegen/ts
pnpm install
pnpm run build                                # codegen + tsc → dist/
pnpm publish --access public

或者用一键脚本:

./scripts/publish-protocol.sh --dry-run      # 校验版本 + 出包到本地
./scripts/publish-protocol.sh                # 真发(需登录)

版本规则

version.py 里的 PROTOCOL_VERSION 是单一来源。pyproject.tomlcodegen/ts/package.json 必须保持同步 —— 发布脚本会校验,任一不一致 直接退出。

升档 触发 wire 影响
MAJOR 破坏性变更 启用 /v2/...,过渡期 ≥ 6 个月
MINOR 加 artifact / event / 字段,扩 enum 向后兼容
PATCH 文档 / codegen / 边角修复 无 schema 变化

monorepo 内部使用

仓库内代码用 from libs.protocol import ...。PyPI wheel 把目录 重命名成 tabapp_protocol/,外部 consumer 用 from tabapp_protocol import ...。两条 import 路径指向同一份 Pydantic 模型。

Project details


Download files

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

Source Distribution

tabapp_protocol-1.0.0.tar.gz (30.6 kB view details)

Uploaded Source

Built Distribution

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

tabapp_protocol-1.0.0-py3-none-any.whl (72.4 kB view details)

Uploaded Python 3

File details

Details for the file tabapp_protocol-1.0.0.tar.gz.

File metadata

  • Download URL: tabapp_protocol-1.0.0.tar.gz
  • Upload date:
  • Size: 30.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.12

File hashes

Hashes for tabapp_protocol-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e17cd6d3ffda74a4c4fb75abc026d4a9f76a49b7921f0000f1090ae2bc359bf4
MD5 515100fcd96a6be53a743b15a4d850b3
BLAKE2b-256 de8fe6030a9b837746b726d1a80a139ef5a2423ca8073497a66cdb8d42f99372

See more details on using hashes here.

File details

Details for the file tabapp_protocol-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for tabapp_protocol-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 779f31c18d0802a0bd784ba987c04ce9203775c2eef03950e6a112d8264f54d8
MD5 8ce5c7f53ae0254b09f68167945964c2
BLAKE2b-256 f5ccb0b4478eae2b9d4f2584cac8a2f0696c56b9dd24681fdfd4cd8066d4f740

See more details on using hashes here.

Supported by

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