Skip to content

feat(kit): add core skill plugin capabilities#368

Merged
SonyLeo merged 12 commits into
opentiny:developfrom
gene9831:codex/skill-plugin-core
Jul 16, 2026
Merged

feat(kit): add core skill plugin capabilities#368
SonyLeo merged 12 commits into
opentiny:developfrom
gene9831:codex/skill-plugin-core

Conversation

@gene9831

@gene9831 gene9831 commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

PR 描述

新增 core skillPlugin 与 skill capabilities,将已选择的 skills 转换为 system instructions 和 runtime tools,接入 message engine。

主要改动:

  • 新增 core message/plugins/skillPlugin.ts
  • 支持 manual / auto / none 三种 request-level skill selection。
  • manual 模式支持直接传入完整 SkillDefinition[],或通过 skillNames + getSkillByName 解析。
  • auto 模式支持候选 skill summaries、偏好 skill names、select_skills runtime tool,以及选择后解析完整 skill。
  • 新增 SkillRequestContext,记录 skillsskillNamesrequestedSkillNamesunresolvedSkillNamesruntimeTools 和 selection 状态。
  • 新增 resource capability,提供 list_skill_files / read_skill_file runtime tools,并在 system instruction 中提示先 list 再 read。
  • 新增 command capability 类型占位,暂不实现 execute_skill_command
  • 新增 getUniqueStringArray 通用工具函数。
  • 增加 resource capability 和 skillPlugin 关键流程测试。

验证:

pnpm -F @opentiny/tiny-robot-kit test -- --run src/skills/test/resourceCapability.test.ts src/skills/test/skillPlugin.test.ts src/message/test/toolPlugin.test.ts
pnpm build

Summary by CodeRabbit

  • New Features
    • Added skill plugin context helpers and expanded public exports for skill selection.
    • Introduced skill selection instructions/runtime tool (select_skills) with preferred-name support.
    • Added skill resources tooling to list and read skill files.
    • Added shared skill command types plus tool-argument parsing utilities.
  • Bug Fixes
    • Improved structured, stable error responses for invalid selections and file/resource failures (including binary reads).
  • Tests
    • Added Vitest coverage for skill plugin flows and skill resource tooling.
  • Chores
    • Added a small unique-string-array utility and cleaned up type formatting.

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

✅ Preview build completed successfully!

Click the image above to preview.
Preview will be automatically removed when this PR is closed.

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds skill selection and resource capability modules, a request-scoped skillPlugin, supporting utilities and exports, and tests covering manual, automatic, custom-injection, failure, and none-selection flows.

Changes

Skill Plugin and Capabilities

Layer / File(s) Summary
Skill capability contracts and tools
packages/kit/src/skills/capabilities/*.ts
Adds skill selection and resource runtime tools, instruction builders, command contracts, and tool-argument parsing.
skillPlugin lifecycle and request integration
packages/kit/src/message/plugins/skillPlugin.ts
Implements selection modes, request context storage, runtime tool provisioning, skill resolution, and instruction injection.
Exports and supporting package utilities
packages/kit/src/message/plugins/index.ts, packages/kit/src/utils.ts, packages/kit/src/message/utils.ts, packages/kit/package.json
Exports skill APIs, adds unique-string handling and Vite, and reformats an async-generator declaration.
Capability and plugin behavior tests
packages/kit/src/skills/test/*.test.ts
Tests resource tools and skillPlugin behavior across selection and instruction-injection flows.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant MessageEngine
  participant skillPlugin
  participant Model
  participant SkillResources
  MessageEngine->>skillPlugin: initialize selection and request context
  skillPlugin->>Model: provide selection tools and instructions
  Model->>skillPlugin: select requested skills
  skillPlugin->>SkillResources: resolve selected skill tools
  SkillResources->>Model: return file listings or file content
  skillPlugin->>Model: inject resolved skill instructions
Loading

Possibly related PRs

Suggested reviewers: SonyLeo

Poem

A rabbit hops through skills so bright,
Selecting tools by candlelight.
Files unfold, instructions flow,
Clever prompts guide where to go.
🐰

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding core skill plugin capabilities to the kit package.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@gene9831
gene9831 marked this pull request as ready for review June 30, 2026 08:15
@gene9831

gene9831 commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
packages/kit/src/skills/capabilities/selection.ts (1)

10-37: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add an empty-candidates guard for consistency with createSkillResourceInstructionsMessage.

createSkillSelectionRuntimeTools already short-circuits when candidates.length === 0 (no tool is exposed), but createSkillSelectionInstructionsMessage has no equivalent guard — it will still instruct the model to "Use the select_skills tool before answering" even when no tool is actually registered. The resource capability module (resources.ts) applies the same guard (hasSkillResources) symmetrically to both its instructions and runtime-tools functions; this module doesn't.

If callers in skillPlugin.ts always supply non-empty candidates before invoking this function, this is currently unreachable, but adding the guard removes the fragile cross-file assumption.

♻️ Suggested guard
 export const createSkillSelectionInstructionsMessage = ({
   candidates,
   preferredSkillNames,
 }: {
   candidates: SkillCandidate[]
   preferredSkillNames?: string[]
 }): ChatCompletionSystemMessageParam => {
+  if (candidates.length === 0) {
+    return undefined
+  }
+
   const lines = [

Note: this would also require updating the return type to ChatCompletionSystemMessageParam | undefined, matching createSkillResourceInstructionsMessage's signature.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/kit/src/skills/capabilities/selection.ts` around lines 10 - 37,
`createSkillSelectionInstructionsMessage` should mirror the empty-candidates
guard used by `createSkillSelectionRuntimeTools` and
`createSkillResourceInstructionsMessage`. Add a check for `candidates.length ===
0` at the start of the function, return `undefined` in that case, and update the
return type accordingly to `ChatCompletionSystemMessageParam | undefined`. Keep
the rest of the message-building logic in `selection.ts` unchanged for non-empty
candidates.
packages/kit/src/skills/capabilities/resources.ts (1)

11-51: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Consider restricting skillName to the active skill names via enum, mirroring selection.ts.

select_skills's parameter schema constrains skillNames via enum: candidateNames (selection.ts:74), but list_skill_files/read_skill_file's skillName parameter here has no such constraint, even though only names present in the current skills array are ever valid (see findSkill). Since these tools are already built per-call inside createSkillResourceRuntimeTools(skills), the schema could be generated dynamically with enum: skills.map((skill) => skill.name) to reduce hallucinated skill names, consistent with the guidance already established in selection.ts.

Handler-side validation (skill_not_found) already covers correctness, so this is purely a model-steering improvement, not a functional gap.

Also applies to: 93-108

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/kit/src/skills/capabilities/resources.ts` around lines 11 - 51, The
`skillName` parameter in `skillResourceTools` is currently unconstrained, which
can lead the model to invent invalid names. Update
`createSkillResourceRuntimeTools(skills)` so the schemas for `listSkillFiles`
and `readSkillFile` set `skillName` to an `enum` built from `skills.map((skill)
=> skill.name)`, matching the pattern used in `selection.ts` for
`select_skills`. Keep the existing `findSkill`/`skill_not_found` runtime
validation unchanged, and apply the same schema change anywhere the same tool
definitions are duplicated.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/kit/src/message/plugins/skillPlugin.ts`:
- Around line 234-258: In resolveSkillsByNames, avoid marking a skill as
unresolved when getSkillByName returns a valid SkillDefinition whose skill.name
differs from the requested name; track resolution status from the actual lookup
result rather than only the requested name. Update the unresolvedSkillNames
bookkeeping so aliases/normalized names don’t create contradictory state, and
ensure onSkillsResolved/SkillRequestContext only receive truly unresolved
entries. Also distinguish resolver failures in the try/catch from “not found”
cases by preserving the failure path in the results object instead of collapsing
every exception into a generic failed flag.

---

Nitpick comments:
In `@packages/kit/src/skills/capabilities/resources.ts`:
- Around line 11-51: The `skillName` parameter in `skillResourceTools` is
currently unconstrained, which can lead the model to invent invalid names.
Update `createSkillResourceRuntimeTools(skills)` so the schemas for
`listSkillFiles` and `readSkillFile` set `skillName` to an `enum` built from
`skills.map((skill) => skill.name)`, matching the pattern used in `selection.ts`
for `select_skills`. Keep the existing `findSkill`/`skill_not_found` runtime
validation unchanged, and apply the same schema change anywhere the same tool
definitions are duplicated.

In `@packages/kit/src/skills/capabilities/selection.ts`:
- Around line 10-37: `createSkillSelectionInstructionsMessage` should mirror the
empty-candidates guard used by `createSkillSelectionRuntimeTools` and
`createSkillResourceInstructionsMessage`. Add a check for `candidates.length ===
0` at the start of the function, return `undefined` in that case, and update the
return type accordingly to `ChatCompletionSystemMessageParam | undefined`. Keep
the rest of the message-building logic in `selection.ts` unchanged for non-empty
candidates.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: db793450-50c7-4d95-8bf0-0c15f4acbbce

📥 Commits

Reviewing files that changed from the base of the PR and between 79556a0 and 1514455.

📒 Files selected for processing (10)
  • packages/kit/src/message/plugins/index.ts
  • packages/kit/src/message/plugins/skillPlugin.ts
  • packages/kit/src/message/utils.ts
  • packages/kit/src/skills/capabilities/commands.ts
  • packages/kit/src/skills/capabilities/resources.ts
  • packages/kit/src/skills/capabilities/selection.ts
  • packages/kit/src/skills/capabilities/utils.ts
  • packages/kit/src/skills/test/resourceCapability.test.ts
  • packages/kit/src/skills/test/skillPlugin.test.ts
  • packages/kit/src/utils.ts

Comment thread packages/kit/src/message/plugins/skillPlugin.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/kit/src/skills/capabilities/selection.ts (1)

80-98: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Reject empty skill selections explicitly packages/kit/src/skills/capabilities/selection.ts:82-86getUniqueStringArray returns [] for an empty skillNames array, so if (!requestedSkillNames) won’t catch it. If zero selections should be invalid, add an explicit requestedSkillNames.length === 0 check before continuing.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/kit/src/skills/capabilities/selection.ts` around lines 80 - 98, The
handler only rejects missing skillNames, not an explicitly empty array. Update
the validation in the selection capability handler to also reject when
requestedSkillNames.length === 0, returning the existing skill_names_required
response before invalid-name checks.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/kit/package.json`:
- Line 80: Move the vite entry from dependencies to devDependencies in
packages/kit/package.json, preserving its version specification and ensuring it
is removed from the runtime dependency list.

---

Outside diff comments:
In `@packages/kit/src/skills/capabilities/selection.ts`:
- Around line 80-98: The handler only rejects missing skillNames, not an
explicitly empty array. Update the validation in the selection capability
handler to also reject when requestedSkillNames.length === 0, returning the
existing skill_names_required response before invalid-name checks.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 2a4f6dc7-f3e7-47f5-876a-24bcf68b7909

📥 Commits

Reviewing files that changed from the base of the PR and between 96263b1 and ae3941f.

📒 Files selected for processing (6)
  • packages/kit/package.json
  • packages/kit/src/message/plugins/index.ts
  • packages/kit/src/message/plugins/skillPlugin.ts
  • packages/kit/src/skills/capabilities/resources.ts
  • packages/kit/src/skills/capabilities/selection.ts
  • packages/kit/src/skills/test/skillPlugin.test.ts
✅ Files skipped from review due to trivial changes (1)
  • packages/kit/src/message/plugins/index.ts

Comment thread packages/kit/package.json Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/kit/src/message/plugins/skillPlugin.ts (1)

221-242: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Preserve resolver errors in resolveSkillsByNames
catch still folds resolver exceptions into unresolvedSkillNames, so a transient getSkillByName failure is indistinguishable from a missing skill. Surface the error separately or include it in the result.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/kit/src/message/plugins/skillPlugin.ts` around lines 221 - 242,
Update resolveSkillsByNames so getSkillByName exceptions are preserved
separately from genuinely unresolved skill names: capture each resolver error in
the per-name result, return the collected errors (or otherwise expose them), and
keep unresolvedSkillNames limited to missing or undefined skills.
🧹 Nitpick comments (1)
packages/kit/src/skills/test/skillPlugin.test.ts (1)

37-45: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Extract the duplicated onInstructionsResolved system-message injection mock.

The same mock pattern — prepending a system message with skillContext.instructions.join('\n\n') to context.requestBody.messages — appears at lines 37-45 and 280-288. Extracting a shared helper (e.g., createInstructionInjectingMock()) would reduce duplication and keep both tests in sync if the injection logic evolves.

Also applies to: 280-288

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/kit/src/skills/test/skillPlugin.test.ts` around lines 37 - 45,
Extract the duplicated onInstructionsResolved mock logic into a shared helper
such as createInstructionInjectingMock(), preserving the system-message
construction and prepending behavior. Replace both occurrences around the
existing test sections, including the one near the later referenced location,
with calls to the helper so both tests remain consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@packages/kit/src/message/plugins/skillPlugin.ts`:
- Around line 221-242: Update resolveSkillsByNames so getSkillByName exceptions
are preserved separately from genuinely unresolved skill names: capture each
resolver error in the per-name result, return the collected errors (or otherwise
expose them), and keep unresolvedSkillNames limited to missing or undefined
skills.

---

Nitpick comments:
In `@packages/kit/src/skills/test/skillPlugin.test.ts`:
- Around line 37-45: Extract the duplicated onInstructionsResolved mock logic
into a shared helper such as createInstructionInjectingMock(), preserving the
system-message construction and prepending behavior. Replace both occurrences
around the existing test sections, including the one near the later referenced
location, with calls to the helper so both tests remain consistent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 5b03cfa1-0f10-413d-bffa-21d7347f093a

📥 Commits

Reviewing files that changed from the base of the PR and between 43b5d5b and 9865f0d.

📒 Files selected for processing (4)
  • packages/kit/package.json
  • packages/kit/src/message/plugins/index.ts
  • packages/kit/src/message/plugins/skillPlugin.ts
  • packages/kit/src/skills/test/skillPlugin.test.ts

@SonyLeo

SonyLeo commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

辛苦看一下,如果是特性设计,请忽略。


  • 阻塞:skill instructions 未实际注入请求。
    skillPlugin.ts:323 仅将 instructions 写入 customContext,message engine 不会自动传给模型。建议在 onBeforeRequest 中合并为临时 system message,并补充端到端测试。

  • 阻塞:浏览器 loader 与核心 skill 类型缺少公开导出。
    index.ts:7 未导出 browser loadSkillSkillDefinitionSkillCandidate;内部路径又受 package.json#exports 限制。建议补齐根入口及 ./node 的公共导出。

  • 重要:auto 模式隐式依赖 toolPlugin
    skillPlugin.ts:320 缺少 toolPlugin 时仍进入 selecting,但请求中没有 select_skills。建议自动集成该能力,或缺少依赖时立即报错。

  • 重要:resolver 可启用候选集外的 skill。
    skillPlugin.ts:224 未校验 resolver 返回的 skill.name 是否等于请求名称。建议拒绝名称不匹配的结果,并对最终 skills 去重。

  • 重要:SkillPluginOptions 默认类型约束错误。
    skillPlugin.ts:118 显式使用默认类型时,none/manual 也会被要求提供 resolver 和 candidate provider。建议改为按 selection 分支分发的联合类型。

  • 重要:maxSelectedSkills 缺少运行时校验。
    selection.ts:53 小数、NaNInfinity 会生成非法 maxItems。建议限制为非负有限整数并补充边界测试。

  • 重要:多个 select_skills 调用存在竞态。
    skillPlugin.ts:291 多个调用会并行覆盖 skill context,最终结果不确定。建议限制为一次调用或串行处理。

  • 一般:新增测试无法通过严格类型检查。
    skillPlugin.test.ts:46、295 直接访问联合类型的 .function,产生 TS2339。建议先按 type === 'function' 缩窄类型。

…ith new utility functions and type definitions
@gene9831

Copy link
Copy Markdown
Collaborator Author

辛苦看一下,如果是特性设计,请忽略。

  • 阻塞:skill instructions 未实际注入请求。
    skillPlugin.ts:323 仅将 instructions 写入 customContext,message engine 不会自动传给模型。建议在 onBeforeRequest 中合并为临时 system message,并补充端到端测试。
  • 阻塞:浏览器 loader 与核心 skill 类型缺少公开导出。
    index.ts:7 未导出 browser loadSkillSkillDefinitionSkillCandidate;内部路径又受 package.json#exports 限制。建议补齐根入口及 ./node 的公共导出。
  • 重要:auto 模式隐式依赖 toolPlugin
    skillPlugin.ts:320 缺少 toolPlugin 时仍进入 selecting,但请求中没有 select_skills。建议自动集成该能力,或缺少依赖时立即报错。
  • 重要:resolver 可启用候选集外的 skill。
    skillPlugin.ts:224 未校验 resolver 返回的 skill.name 是否等于请求名称。建议拒绝名称不匹配的结果,并对最终 skills 去重。
  • 重要:SkillPluginOptions 默认类型约束错误。
    skillPlugin.ts:118 显式使用默认类型时,none/manual 也会被要求提供 resolver 和 candidate provider。建议改为按 selection 分支分发的联合类型。
  • 重要:maxSelectedSkills 缺少运行时校验。
    selection.ts:53 小数、NaNInfinity 会生成非法 maxItems。建议限制为非负有限整数并补充边界测试。
  • 重要:多个 select_skills 调用存在竞态。
    skillPlugin.ts:291 多个调用会并行覆盖 skill context,最终结果不确定。建议限制为一次调用或串行处理。
  • 一般:新增测试无法通过严格类型检查。
    skillPlugin.test.ts:46、295 直接访问联合类型的 .function,产生 TS2339。建议先按 type === 'function' 缩窄类型。

1. Skill instructions 未实际注入请求

这里不自动合并为 system message 是有意设计。不同模型/provider 可能通过 system message、user message、独立请求字段或 provider 侧缓存承载 instructions,因此 skillPlugin 只负责生成并通过 SkillRequestContext.instructions 暴露,不固定注入策略。

调用方可以在 onBeforeRequest 中通过 getSkillRequestContext(context)?.instructions 获取并按 provider 要求修改 requestBody。相关文档和端到端示例会放到专门的文档 PR,已记录在 TODO.md

2. Browser loader 与核心 skill 类型缺少公开导出

已处理。根入口现在导出 browser loadSkill/loadSkillWithDetails./node 继续导出 Node loader。

两个入口均公开 SkillDefinitionSkillCandidate;loader 对应的 options/result/job 类型也随各自入口导出。没有额外公开内部资源类型,以控制公共 API 范围。

3. Auto 模式隐式依赖 toolPlugin

已处理。没有在 skillPlugin 内重复集成工具收集和执行逻辑;auto 模式启动时会检查是否存在启用的 toolPlugin,缺失时在模型请求发出前立即抛出明确错误:

skillPlugin auto mode requires an enabled toolPlugin

对应测试已补充。

4. Resolver 可启用候选集外的 skill

已处理。resolver 返回结果现在必须满足 skill.name === requestedName,否则该请求名称会进入 unresolvedSkillNames,不会启用错误 skill。

最终 enabled skills 也会按名称去重,包括 resolver 结果和 manual inline skills,并补充了名称不匹配及重复 skill 测试。

5. SkillPluginOptions 默认类型约束错误

已处理。SkillPluginOptions 已改为按 selection 分支分发的联合类型。

现在 none、manual inline skills、manual skillNames 和 auto 会分别获得正确的 resolver/candidate provider 类型约束,不再因为默认泛型是完整联合类型而错误要求所有 provider。

6. maxSelectedSkills 缺少运行时校验

已处理为宽松归一化,而不是直接拒绝配置:

  • 小数向下取整;
  • 最小限制为 0
  • 最大限制为候选 skill 数量;
  • NaNInfinity 和未配置时回退为候选 skill 数量。

这样可以保证生成合法的 JSON Schema maxItems,同时对调用方输入更兼容。相关边界测试已补充。

7. 多个 select_skills 调用存在竞态

已处理。每个 auto selection runtime tool 只允许一次有效 resolution,并在第一次调用进入异步流程前同步加锁。

后续并发或重复调用会返回:

skill_selection_already_resolved

已补充并发调用测试,确认 resolver 只执行一次。

8. 新增测试无法通过严格类型检查

这个暂不处理,部分类型无法完全严格

SonyLeo
SonyLeo previously approved these changes Jul 15, 2026
@SonyLeo
SonyLeo merged commit b59f1ea into opentiny:develop Jul 16, 2026
4 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🧹 Preview Cleaned Up

The preview deployment has been removed.

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.

3 participants