Skip to content

feat: add well-known capabilities to API discovery - #779

Merged
hotlong merged 3 commits into
mainfrom
copilot/add-discovery-capabilities
Feb 22, 2026
Merged

feat: add well-known capabilities to API discovery#779
hotlong merged 3 commits into
mainfrom
copilot/add-discovery-capabilities

Conversation

CopilotAI commented Feb 22, 2026

Copy link
Copy Markdown
Contributor

Adds typed boolean capability flags to the Discovery response so ObjectUI can detect backend features without probing individual endpoints.

Schema (packages/spec)

  • New WellKnownCapabilitiesSchema in discovery.zod.ts with 7 fields: feed, comments, automation, cron, search, export, chunkedUpload
  • Added capabilities to GetDiscoveryResponseSchema in protocol.zod.ts

Runtime (packages/objectql)

  • getDiscovery() now builds capabilities dynamically from the service registry:
constcapabilities: WellKnownCapabilities={feed: registeredServices.has('feed'),comments: registeredServices.has('feed'),automation: registeredServices.has('automation'),cron: registeredServices.has('job'),search: registeredServices.has('search'),export: registeredServices.has('automation')||registeredServices.has('queue'),chunkedUpload: registeredServices.has('file-storage'),};

Client SDK (packages/client)

  • Added get capabilities(): WellKnownCapabilities | undefined getter, available after connect()

Tests

  • 15 new tests across discovery schema, protocol schema, protocol implementation, and client SDK
  • All 6,121 spec tests pass
Original prompt

This section details on the original issue you should resolve

<issue_title>api discovery</issue_title>
<issue_description>## 🎯 目标

扩展 Discovery 响应中的 capabilitiesservices 声明,让前端(ObjectUI)可以智能感知后端支持的功能。

📋 Tasks

  • GetDiscoveryResponsecapabilities 中新增:
    • feed: boolean — 是否支持 Feed/Chatter API
    • comments: boolean — 是否支持评论(Feed 的子集)
    • automation: boolean — 是否支持 Automation CRUD
    • cron: boolean — 是否支持 cron 调度
    • search: boolean — 是否支持全文搜索
    • export: boolean — 是否支持异步导出
    • chunkedUpload: boolean — 是否支持分片上传
  • objectql/protocol.tsgetDiscovery() 中动态检测已注册的 service 并填充 capabilities
  • 在 Client SDK 中暴露 client.capabilities getter
  • 编写测试验证 capabilities 随 service 注册动态变化

🔗 关联

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@vercel

vercelBot commented Feb 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
objectstack-playErrorErrorFeb 22, 2026 2:16am
specErrorErrorFeb 22, 2026 2:16am

Request Review

CopilotAIand others added 2 commits February 22, 2026 02:08
…rotocol schemas
Add feed, comments, automation, cron, search, export, chunkedUpload
boolean capability flags. Update GetDiscoveryResponseSchema, protocol
implementation, and client SDK with capabilities getter.
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
… ROADMAP
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
CopilotAI changed the title [WIP] Add capabilities and services to Discovery responsefeat: add well-known capabilities to API discoveryFeb 22, 2026
CopilotAI requested a review from hotlongFebruary 22, 2026 02:13
@hotlong
hotlong marked this pull request as ready for review February 22, 2026 02:30
CopilotAI review requested due to automatic review settings February 22, 2026 02:30
@hotlong
hotlong merged commit d500c67 into mainFeb 22, 2026
2 of 4 checks passed

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a typed, flat set of well-known capability flags to the API discovery contract so clients (notably ObjectUI) can adapt UI/behavior without endpoint probing, and wires the flags through server protocol + client SDK.

Changes:

  • Introduced WellKnownCapabilitiesSchema (7 boolean flags) and added it to GetDiscoveryResponseSchema.capabilities.
  • Implemented dynamic capability derivation in ObjectStackProtocolImplementation.getDiscovery() based on registered services.
  • Exposed ObjectStackClient.capabilities getter and added/updated tests and roadmap entries.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
FileDescription
packages/spec/src/api/protocol.zod.tsAdds capabilities to GetDiscoveryResponseSchema and imports the new schema.
packages/spec/src/api/protocol.test.tsAdds schema validation tests for GetDiscoveryResponseSchema.capabilities.
packages/spec/src/api/discovery.zod.tsIntroduces WellKnownCapabilitiesSchema + inferred TS type.
packages/spec/src/api/discovery.test.tsAdds tests for WellKnownCapabilitiesSchema parsing and .describe() coverage.
packages/objectql/src/protocol.tsPopulates capabilities in runtime discovery response from the service registry.
packages/objectql/src/protocol-discovery.test.tsAdds tests verifying capability flags track service registration.
packages/client/src/index.tsAdds capabilities getter to expose server-discovered flags post-connect().
packages/client/src/client.test.tsAdds tests for the new client getter behavior.
ROADMAP.mdMarks discovery capabilities + client getter work as completed.

apiName: z.string().describe('API name'),
routes: ApiRoutesSchema.optional().describe('Available endpoint paths'),
services: z.record(z.string(), ServiceInfoSchema).optional().describe('Per-service availability map'),
capabilities: WellKnownCapabilitiesSchema.optional().describe('Well-known capability flags for frontend adaptation'),

CopilotAIFeb 22, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The JSDoc for GetDiscoveryResponseSchema still says “capabilities was removed — derive from services[x].enabled”, but this schema now includes a capabilities field again. Please update/remove that note so the documentation matches the current contract (and clarifies how these well-known flags relate to services).

Copilot uses AI. Check for mistakes.
Comment on lines +326 to +327
import { GetDiscoveryResponseSchema } from './protocol.zod';

CopilotAIFeb 22, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file already imports many schemas from ./protocol.zod at the top; adding a second import later in the file makes the import section harder to maintain and can trip import-order linting. Consider moving GetDiscoveryResponseSchema into the existing top import list instead of importing it at the bottom.

Copilot uses AI. Check for mistakes.
Comment on lines +792 to +793
// ==========================================

CopilotAIFeb 22, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These new tests validate the top-level ObjectStackClient.capabilities getter, but they’re nested under describe('ObjectStackClient.automation', ...), which makes the suite misleading and harder to find. Consider moving them into a dedicated describe('ObjectStackClient.capabilities', ...) block.

Suggested change
// ==========================================
// ==========================================
});
describe('ObjectStackClient.capabilities',()=>{

Copilot uses AI. Check for mistakes.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

api discovery

3 participants

@hotlong