Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

feat: expose model database updates through the public Go SDK

Chiusa
#255 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Una pull request collegata è già stata integrata.

  • #256 di @ezynda3 — integrata

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
go
Ambito
backend, cli

Direzione di ricerca

Start by reading pkg/kit/models.go, cmd/update_models.go, and internal/models/cache.go at the pinned commit to understand current update logic. Extract the operation into reusable Kit code and expose it via pkg/kit as UpdateModels. Add hermetic tests with temp dirs and local HTTP servers; done means public SDK updates models atomically with CLI behavior unchanged.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement
Feature Description

Expose the kit update-models operation through github.com/mark3labs/kit/pkg/kit. Embedders should be able to update the shared model database without installing or executing the Kit CLI.

The SDK should support the existing source choices: default models.dev URL (including all model types), KIT_MODELS_URL, an explicit HTTP(S) URL, a local JSON file, and reset to the embedded database. Keep cache paths, schema versions, catalog decoding, and conditional HTTP requests inside Kit.

Motivation / Use Case

BONNIE wants bonnie update models and ./my-agent update models in compiled agent binaries: https://github.com/mark3labs/bonnie/issues/59.

BONNIE imports only Kit's public SDK. At its pinned Kit v0.136.0 (c50c75cbdd467614092116b049d5fcf43d6dc6b5):

  • pkg/kit/models.go:5-41 exposes registry queries, but no update operation.
  • cmd/update_models.go:50-168 owns source selection, download, local-file import, and reset. It writes directly to stderr and starts its timeout from context.Background().
  • internal/models/cache.go:34-73 owns schema version 3 and the shared providers.json data path. The write and remove functions are also internal (lines 111-148).

These internal functions cannot be imported by an external Go module. Writing the cache independently would couple BONNIE to Kit's private schema. This is a request for a supported public operation, not for public access to the private cache structs.

Proposed Implementation

Extract the operation into reusable Kit code and make both the Kit CLI and a public SDK wrapper use it. Exact API names are open; an illustrative shape is:

func UpdateModels(ctx context.Context, opts UpdateModelsOptions) (UpdateModelsResult, error)

Requested contract:

  • Accept caller cancellation and use a bounded network timeout (the CLI currently uses 30 seconds).
  • Return structured results for updated, not-modified, and reset states, with provider/model counts where applicable. Do not print, parse CLI arguments, start a model, or require provider credentials.
  • Preserve Kit's shared cache location and schema handling; support ETag/304 behavior without allowing a validator from one source to mask data from another source.
  • Validate input before replacing the cache. A failed download or invalid input must not destroy the previous usable cache; use atomic replacement so readers do not see a partial file.
  • Document whether an already loaded registry sees updates. Restart/next-process visibility is sufficient for BONNIE; live registry reload is not required.
  • Add hermetic tests with temporary data directories and local HTTP servers for source selection, 200/304 responses, malformed/empty data, cancellation, failed writes, and embedded reset. Keep CLI behavior compatible.
Alternatives Considered
  • I've considered workarounds or alternative approaches

Installing/executing Kit separately defeats the standalone-binary use case. Importing kit/internal/models is not allowed by Go. Copying Kit's updater or independently maintaining its cache schema would create a second implementation that can drift.

Checklist
  • I've searched existing issues and this hasn't been requested yet

Searched open and closed issues for model update API, update-models, and model database. No matching public-updater request was found. This request follows the existing public-SDK pattern used for provider OAuth login (#180).

Lingua principale
Go
Stelle
146
Fork
31
Merge medio
4h 35m
PR unite (30g)
54

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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di mark3labs/kit

Tutte le issue di mark3labs/kit

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.