Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

feat: expose model database updates through the public Go SDK

Cerrado
#255 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Ya se ha fusionado un pull request relacionado.

  • #256 de @ezynda3 — fusionado

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
45/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
go
Área
backend, cli

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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).

Lenguaje dominante
Go
Estrellas
146
Forks
31
Merge medio
4 h 35 min
PR fusionados (30 d)
54

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de mark3labs/kit

Todos los issues de mark3labs/kit

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.