@gea-ai/contract

中文文档
0.2.261114-alpha.0发布于 2026/11/15Apache-2.0TypeScriptES Module近 30 天下载 5448

Portable GEA schemas, API payload types and RPC contracts.

原始使用文档
文档目录3 节
  1. Model boundary types
  2. Benchmarks API preparation
  3. Public HTTP identity projections

@gea-ai/contract

Portable public contracts and shared TypeScript payload types for GEA.

This package owns shared contract-first schemas, inferred TypeScript types, and ORPC contract routers that can be consumed by ORPC implementations and public SDK packages.

Route implementations should import these contracts and use @orpc/server contract implementers instead of redefining route-local input schemas. Shared RPC payload types that need to cross package boundaries, such as agent chat messages and common ORPC error shapes, also live here so web, CLI, SDK, agent, and ORPC packages derive the same API surface.

Agent snapshots describe native Connector requirements and their exposed operations. Feishu declares the existing platform Connector's call operation; its Tool receives lark-cli argv and optional stdin. The platform owns CLI execution and Connection credentials. Business identity is selected by --as bot or --as user in each command's argv. Agent and Extension host-command contributions and Computer CLI preparation are removed.

Already published snapshots remain loadable for Channel operation. Parsing discards their retired Agent commands and Extension command-contribution metadata without changing stored artifacts or their hashes. Those fields grant no execution capability; rebuild an old Agent to declare the Feishu Connector.

agentNodeSnapshotMetadataSchema reuses the canonical model, schema version, environment, and Computer fields for retained metadata readers. Version summaries and shared-secret protection can validate those fields independently of execution admission; runnable snapshots still use the complete snapshot schemas.

Ordinary Computer commands.run and custom Tool command permissions remain separate capabilities for Agents that explicitly enable a Computer.

App Server absolute-path fields accept POSIX and Windows drive paths, including the verbatim drive form returned by Rust canonicalization on Windows. The contract preserves the native path rather than rewriting project identity; relative and drive-relative paths remain invalid.

Worker contract objects retain concrete Zod schemas and cached field identity. Private Connector, Core, Session, Channel, and initialization diagnostic subtrees also use deferredSchemaShape getters: their complete construction expressions stay in the getter so importing an unused branch does not build its helper schemas. Keep shared helpers cached, and keep cross-schema .shape reads inside getters; reading .shape snapshots every field of that object. Composition methods in the pinned Zod version preserve raw getters, but object spreads evaluate them. After a contract release, release the SDK against it and rebuild applications to include these initialization savings.

Model boundary types

@gea-ai/contract/model-contracts owns AgentModelMessage, AgentModelUsage and AgentFinishReason. Context and Worker AI usage use these structural contracts. Existing ai message/usage/finish types remain assignable, and the context API names and generics are preserved. Coordinate contract-before-SDK releases when migrating these shared types.

Benchmarks API preparation

@gea-ai/contract/benchmarks-api exports independent Project-scoped schemas for Benchmarks, versions, cases, uploads and runs. @gea-ai/contract/benchmarks-openapi exports their standalone OpenAPI 3.1 document. These are prepared contracts; the new routes are not served yet. See the contract boundary for publishing, scopes, idempotency, JSON limits and pagination semantics.

Public HTTP identity projections

AgentHttpSession from @gea-ai/contract/agent-http-api (also reused by the ORPC AppAgentSession) now includes optional nullable owner with user_id and display_name. Administrative list/detail guarantee the property; ordinary and local producers may omit it. MemberHttpMember / MemberHttpList from @gea-ai/contract/member-http-api include optional user_id, returned only with include_user_id=true on member list/detail. These inferred types are canonical for SDK consumers; no parallel Agent SDK DTO or member HTTP client exists. Member email is a required nullable contact field (string | null), including for members created without a real email. Consumers must accept explicit null; internal authentication handles are not part of this public contact field. Regenerate external OpenAPI SDKs to expose the query and nullable email. Old member requests retain the same fields, with nullable email; session clients rejecting unknown fields must update their schema before consuming administrative responses.

版本与发布记录

@gea-ai/contract 共发布 122 个版本,首次发布于 2026/05/14;过去 12 个月发布了 122 个版本。

版本发布日期距今
0.2.261114-alpha.0latest2026/11/151 天前
0.2.261113-alpha.02026/11/133 天前
0.1.261111-alpha.12026/11/123 天前
0.1.261111-alpha.02026/11/124 天前
0.1.261106-alpha.02026/11/069 天前
0.1.261102-alpha.22026/11/0213 天前

其他发布通道:alpha → 0.1.260514-alpha。

关于 @gea-ai/contract 的常见问题

@gea-ai/contract 是什么?

Portable GEA schemas, API payload types and RPC contracts.

如何安装 @gea-ai/contract?

在项目目录运行 npm install @gea-ai/contract,或使用 pnpm add / yarn add / bun add。

@gea-ai/contract 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@gea-ai/contract 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@gea-ai/contract 可以商用吗?

@gea-ai/contract 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@gea-ai/contract 的下载量有多少?

根据 npm 官方下载统计,@gea-ai/contract 在 2026/10/16 – 2026/11/14 这 30 天内被下载 5,448 次,日均约 182 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@gea-ai/contract 还在维护吗?

最新版本 0.2.261114-alpha.0 发布于 2026/11/15(1 天前);至今共发布 122 个版本,其中过去 12 个月发布了 122 个;首次发布于 2026/05/14。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。