http: ToolContracts arm duplicates HttpInput inline — named references now expand on the wire
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- Mezza giornata
- Idoneità per principianti
- 66/100
- Tipo di issue
- Refactoring
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
- Ambito
- tooling
Direzione di ricerca
Start in plugins/http/src/index.ts: move the HttpInput interface above the declare module block and point the http arm at it. Before editing, record the params text from ToolTypeIndex.wireContracts(), then confirm it matches after the change. Read expandNamed in plugins/tool-types/src/build-dts.ts to see how a named reference is expanded. Done means the wire text is unchanged and the inline copy is gone; the sweep of other arms is a separate step.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
plugins/http/src/index.ts declares the http contract with its params written inline, and describes the same shape again in a local HttpInput interface, which the executor casts its input to:
// params are inlined structurally (not a `HttpInput` reference) so the derived wire text shows real fields.
declare module '@matatbread/matbot-plugin-api' {
interface ToolContracts {
http: ToolContract<unknown, { url: string; method?: string; headers?: Record<string, string>; body?: string; responseType?: 'text' | 'json' }>;
}
}
interface HttpInput { url: string; method?: string; headers?: Record<string, string>; body?: string; responseType?: 'text' | 'json' }
The comment's reason no longer applies. When this was written (360b7cc), wire text was the arm's source text verbatim, so a named reference would have reached the model as params: HttpInput. Since c6685bc both consumers handle a reference:
- Wire text:
expandNamed(plugins/tool-types/src/build-dts.ts) expands workspace interfaces and aliases into their fields, up toWIRE_DEPTH(2). - Generated dts: a referenced plugin-local interface or alias is bundled next to the reference (
classify→bundle), exported or not.
The inline literal is therefore a second copy of the shape. That goes against the single-source rule for tool contracts, and a field added to only one copy goes unnoticed.
Fix
Move HttpInput above the declare module block, declare http: ToolContract<unknown, HttpInput>, and drop the comment. Check that ToolTypeIndex.wireContracts() produces the same params text for http before and after.
Sweep the other tools for the same case
27 source files declare at least one arm with inline object-literal params. An inline literal isn't a problem in itself. Look for an arm whose inline shape is also described by a local interface/type, or by an input as { … } cast in the executor, and point the arm at that one declaration.
Out of scope: plugins/tool-store/src/index.ts (~L280). That contract is a runtime toolContract string, resolved by a second Program that holds only plugin-api, so a plugin-local name cannot resolve there. Inlining is still required in that case.
- Lingua principale
- TypeScript
- Stelle
- 5
- Fork
- 2
- Merge medio
- 1g 2h
- PR unite (30g)
- 12
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di MatAtBread/matbot
-
future-enhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
MatAtBread/matbot#65 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di MatAtBread/matbot
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 83/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
ranxianglei/billion-context#3583 ·
I maintainer di solito rispondono entro 1 giorno
-
bug:new
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
callstackincubator/simlock#673 ·
I maintainer di solito rispondono entro 1 giorno
-
documentation v3
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
anomalyco/opencode#56380 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno