Conversation
…ction tool Collapse the three flat tool registrations into a single sema(action=search|stats|reindex) tool. The execute and render logic of the three former tools is kept verbatim; only the tool surface changes, so three per-round schema payloads become one. The open output schema root records the producing sub-tool via __act so render dispatches; an explicit additionalProperties value is required by the dsh schema compiler. 【中文】将 sema_search/sema_reindex/sema_stats 三件平铺工具聚合为 sema(action=search|stats|reindex) 单件。三件原工具的 execute 与 render 逻辑逐字保留,仅收敛工具面——每轮注入 schema 从三件降为 一件。输出 schema 根保持开放(additionalProperties 显式声明—— dsh schema 编译器拒省略态),内部 __act 字段记录产出子工具供 render 分发。
|
DSH should remain the primary host, and I accept the single |
Per review: tighten the contract so action is a closed set instead of a free-form string. The parameter schema now declares enum: [search, stats, reindex] — the dsh tool wrapper enforces it before execute runs (bogus actions throw ToolArgsError instead of silently running a search). A runtime guard inside execute keeps the rejection explicit even if args arrive unvalidated, and render surfaces rejected values as plain text via the no-__act branch instead of falling through to the search renderer. Test added covering both layers. 按评审意见收紧契约:action 从开放字符串改为必填枚举。参数 schema 声明 enum: [search, stats, reindex],由 dsh 工具包装层在 execute 前 强制(未知值抛 ToolArgsError,不再静默回退 search);execute 内保留 运行时拒绝作为防御纵深;render 对无 __act 的拒绝值走纯文本出口。 新增测试覆盖两层。
|
Addressed in 9cef5e0: |
Aggregate sema_search / sema_reindex / sema_stats into one action tool
Base: upstream
601c3f5(the commit this fork tracks) · stacked series: this PR → pr-2 → pr-4 → pr-5 → pr-3Motivation
Three flat tool registrations mean three JSON schemas injected into every model round, for a plugin whose actions share one subject (the index). The harness itself aggregates same-family tools behind an
actionparameter (its built-incode_intel), and this plugin fits the same shape naturally:sema(action=search|stats|reindex).What changes
src/tools.ts: the three tools'executeandrenderlogic is kept verbatim (moved intoexecSearch/execReindex/execStatsand the three render helpers); only the tool surface collapses into onesematool.additionalProperties: true) because the canonical value shape differs per action; an internal__actfield records which sub-tool produced the value sorenderdispatches. Note the schema compiler rejects an omittedadditionalProperties, so the explicit value is required, not stylistic.src/index.ts: header comment updated (registers one aggregated tool).tests/plugin.test.ts: registration and end-to-end tests updated to call the aggregated tool withaction.Before / after
Tool output rendering is unchanged from the model's perspective — each action renders exactly as its former flat tool did (including the
sema_search:/sema_stats:render prefixes).Testing
tsc --noEmitclean under the repo tsconfig (strict + noUncheckedIndexedAccess).