Let a tool declare its code-card language, instead of keying the code row variant on the literal name run_code
#4724
Replies: 1 comment
|
The rc.2 source confirms the mismatch and the additive view field looks like the right boundary. I would tighten the contract in four places:
For legacy I maintain the independent DeepSeek Harness Handbook. I wrote the complete compatibility matrix, illustrative type/presenter change, failure router, and 20 regression gates here: https://github.com/sandbaseai/deepseek-harness-handbook/blob/main/docs/en/plugin-development/tool-code-card-language.md |
Uh oh!
There was an error while loading. Please reload this page.
A plugin that presents a code-execution tool of its own cannot get the
Coderow, no matter whatpresentCallreturns.dsh-client-ui-toolclassifies a row from a hardcoded name map:and the
variant === 'code'branch rendersCodeBlockwithlang: "typescript"hardcoded as well. So the code card is keyed on the wire tool name, not on the call view —run_code's ownpresentCallalready returns{ card: 'generic', kind: 'execute', rawInput: args.code }, which carries everything except the language.Two consequences for a third-party tool:
run_codeis a reserved transport name a plugin may not register or shadow;typescriptfor a non-TypeScript runtime.This already bites in-tree:
dsh-code-runtimedeclares'python'as a well-knownlanguage, so a Pythonrun_coderenders Python source under atypescriptlabel today.Minimal proposal
Add one optional field to
GenericCallView— a language hint that only means anything alongsidekind: 'execute':run_codethen returnslanguage: resolveFlavor(peekRuntime).language, and the client picks the variant from the view rather than the name:Backward compatible:
TOOL_VARIANTSstays for every other row,run_codekeeps its variant either way, and a tool that sends nolanguageis unaffected.CodeBlockalready takeslang?: stringand treats an unknown grammar as plain text, so no new rendering path is needed.Why it matters beyond one card
Code Mode is presented as a general shape — the tool registry's
modeselects it,CodeSdkLanguageis a union with room to grow, anddsh-code-runtime's seam is explicitly provider-shaped. The row variant is the one place where that generality is pinned to a single name. A tool that owns its own execution surface (a persistent REPL, a different language, a sandboxed runner) can already reuse the whole registry, the pipeline, andtool/code-dispatchfor SUBTOOL rows — only the card falls back to the generic row.Happy to send a PR if the shape looks right.
All reactions