Skip to content

fix: 适配器信息添加 protocolVersion#641

Draft
ikenxuan wants to merge 1 commit intomainfrom
adapterinfo
Draft

fix: 适配器信息添加 protocolVersion#641
ikenxuan wants to merge 1 commit intomainfrom
adapterinfo

Conversation

@ikenxuan
Copy link
Copy Markdown
Collaborator

@ikenxuan ikenxuan commented Apr 1, 2026

Summary by Sourcery

在适配器信息中添加协议版本元数据,并在基础适配器实现中对其进行初始化。

新功能:

  • 在适配器元数据中加入 protocolVersion 字段,用于描述适配器协议实现的版本。

改进:

  • 记录未来重构意图:将适配器信息重组为基础信息和协议实现细节两部分。
Original summary in English

Summary by Sourcery

Add protocol version metadata to adapter information and initialize it in the base adapter implementation.

New Features:

  • Include a protocolVersion field in adapter metadata to describe the adapter protocol implementation version.

Enhancements:

  • Document future refactor intent to restructure adapter information into base info and protocol implementation details.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 1, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cc75e05d-396d-4d85-b5e7-6049ef1ff9ec

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch adapterinfo

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai bot commented Apr 1, 2026

审查者指南(在小型 PR 上折叠)

审查者指南

为适配器元数据新增 protocolVersion 字段,并确保在基础适配器实现中设置默认值,同时记录未来对适配器信息结构进行重构的计划。

带有 protocolVersion 的更新后 AdapterInfo 类图

classDiagram
  class AdapterInfo {
    number index
    string name
    string desc
    AdapterPlatform platform
    AdapterStandard standard
    AdapterProtocol protocol
    string protocolVersion
    AdapterCommunication communication
    string address
    string~null secret
  }

  class AdapterBase {
    +AdapterInfo info
    +start()
    +stop()
  }

  AdapterBase --> AdapterInfo
Loading

文件级变更

变更 详情 文件
扩展适配器元数据以包含协议实现版本,并将其接入基础适配器的默认信息。
  • 向 AdapterInfo 添加 protocolVersion: string,以便每个适配器都可以声明其协议实现版本。
  • 在 AdapterBase 的默认 adapterInfo 中使用空字符串初始化 protocolVersion,以保持向后兼容并避免出现 undefined 值。
  • 插入 TODO 注释,指出当前适配器信息结构比较混乱,后续应将其拆分为基础适配器信息和协议/SDK 信息。
packages/core/src/types/adapter/info.ts
packages/core/src/adapter/base/index.ts

提示与命令

与 Sourcery 交互

  • 触发新的审查: 在 pull request 中评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审查评论。
  • 从审查评论生成 GitHub issue: 在某条审查评论下回复,请 Sourcery 从该评论创建 issue。你也可以回复 @sourcery-ai issue 来从该评论创建 issue。
  • 生成 pull request 标题: 在 pull request 标题任意位置写上 @sourcery-ai,即可随时生成标题。你也可以在 pull request 中评论 @sourcery-ai title 来(重新)生成标题。
  • 生成 pull request 摘要: 在 pull request 正文任意位置写上 @sourcery-ai summary,即可在你想要的位置生成 PR 摘要。你也可以在 pull request 中评论 @sourcery-ai summary 来(重新)生成摘要。
  • 生成审查者指南: 在 pull request 中评论 @sourcery-ai guide,即可随时(重新)生成审查者指南。
  • 解决所有 Sourcery 评论: 在 pull request 中评论 @sourcery-ai resolve,即可标记解决所有 Sourcery 评论。如果你已经处理了所有评论且不想再看到它们,这会很有用。
  • 关闭所有 Sourcery 审查: 在 pull request 中评论 @sourcery-ai dismiss,即可关闭所有现有的 Sourcery 审查。尤其适用于你想从头开始一次新的审查 —— 别忘了再评论 @sourcery-ai review 来触发新的审查!

自定义你的体验

访问你的 控制面板 以:

  • 启用或禁用审查功能,例如 Sourcery 自动生成的 pull request 摘要、审查者指南等。
  • 更改审查语言。
  • 添加、移除或编辑自定义审查指令。
  • 调整其他审查设置。

获取帮助

Original review guide in English
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds a new protocolVersion field to adapter metadata and ensures a default value is set for the base adapter implementation, while also documenting a future refactor for adapter info structure.

Class diagram for updated AdapterInfo with protocolVersion

classDiagram
  class AdapterInfo {
    number index
    string name
    string desc
    AdapterPlatform platform
    AdapterStandard standard
    AdapterProtocol protocol
    string protocolVersion
    AdapterCommunication communication
    string address
    string~null secret
  }

  class AdapterBase {
    +AdapterInfo info
    +start()
    +stop()
  }

  AdapterBase --> AdapterInfo
Loading

File-Level Changes

Change Details Files
Extend adapter metadata to include protocol implementation version and wire it into the base adapter default info.
  • Add protocolVersion: string to AdapterInfo so each adapter can declare its protocol implementation version.
  • Initialize protocolVersion with an empty string in AdapterBase default adapterInfo to maintain backward compatibility and avoid undefined values.
  • Insert TODO comments noting that the adapter info structure is currently messy and should later be split into basic adapter info and protocol/SDK info.
packages/core/src/types/adapter/info.ts
packages/core/src/adapter/base/index.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

你可以通过以下命令安装该版本:

pnpm add https://pkg.pr.new/node-karin@276465b -w

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a protocolVersion field to the AdapterInfo interface and its base implementation. Feedback suggests removing an unnecessary Byte Order Mark (BOM) character from the start of a file and eliminating redundant TODO comments to maintain code cleanliness.

@@ -1,4 +1,4 @@
/**
/**
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.

medium

文件开头包含了不可见的 BOM (Byte Order Mark) 字符(\ufeff)。在 UTF-8 编码的 TypeScript 项目中,通常不需要 BOM,且它可能会导致某些构建工具、编辑器或环境出现解析异常。建议移除该字符。

Suggested change
/**
/**

| 'other'
| (string & {})

// TODO: 太乱了,后续需要重新设计适配器信息结构,分为适配器基本信息和协议实现(或者协议SDK)信息两部分
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.

medium

此处添加了重复的 TODO 注释。在下方的 JSDoc(第 94 行)中已经包含了相同的说明。建议移除此处的单行注释,以保持代码简洁并避免冗余。

Sign up for free to 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.

1 participant