gitlab-ai-provider 5.0.0 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/dist/gitlab-ai-provider-5.1.0.tgz +0 -0
- package/dist/index.d.mts +54 -1
- package/dist/index.d.ts +1212 -1296
- package/dist/index.js +173 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +170 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## 5.1.0 (2026-03-17)
|
|
6
|
+
|
|
7
|
+
- Merge branch 'fix/model-config-inparams-cache-ttl' into 'main' ([a9fdfa0](https://gitlab.com/vglafirov/gitlab-ai-provider/commit/a9fdfa0))
|
|
8
|
+
- feat(model-config): add GitLabModelConfigRegistry with correct YAML parsing and cache TTL ([6ec09ad](https://gitlab.com/vglafirov/gitlab-ai-provider/commit/6ec09ad))
|
|
9
|
+
|
|
5
10
|
## 5.0.0 (2026-03-02)
|
|
6
11
|
|
|
7
12
|
- feat: move package to gitlab-ai-provider under vglafirov namespace ([3b5060f](https://gitlab.com/vglafirov/gitlab-ai-provider/commit/3b5060f))
|
|
Binary file
|
package/dist/index.d.mts
CHANGED
|
@@ -1518,4 +1518,57 @@ declare class GitLabWorkflowTokenClient {
|
|
|
1518
1518
|
invalidateToken(workflowDefinition?: string, rootNamespaceId?: string): void;
|
|
1519
1519
|
}
|
|
1520
1520
|
|
|
1521
|
-
|
|
1521
|
+
/**
|
|
1522
|
+
* Fetches and caches model configuration from the GitLab AI Gateway's
|
|
1523
|
+
* models.yml definition file. Provides per-model context window and
|
|
1524
|
+
* output token limits keyed by `gitlab_identifier`.
|
|
1525
|
+
*
|
|
1526
|
+
* Results are cached both in memory and on disk at
|
|
1527
|
+
* `~/.cache/opencode/gitlab-model-configs.json`
|
|
1528
|
+
* (or `$XDG_CACHE_HOME/opencode/...` when set).
|
|
1529
|
+
*
|
|
1530
|
+
* @see https://gitlab.com/gitlab-org/modelops/applied-ml/code-suggestions/ai-assist/-/blob/main/ai_gateway/model_selection/models.yml
|
|
1531
|
+
*/
|
|
1532
|
+
interface ModelConfig {
|
|
1533
|
+
/** Maximum input context tokens */
|
|
1534
|
+
context: number;
|
|
1535
|
+
/** Maximum output tokens (from params.max_tokens) */
|
|
1536
|
+
output: number;
|
|
1537
|
+
}
|
|
1538
|
+
interface ModelConfigRegistryOptions {
|
|
1539
|
+
/** Override the URL to fetch models.yml from */
|
|
1540
|
+
url?: string;
|
|
1541
|
+
/** Cache TTL in milliseconds (default: 24 hours) */
|
|
1542
|
+
ttlMs?: number;
|
|
1543
|
+
/** Custom fetch implementation */
|
|
1544
|
+
fetch?: typeof fetch;
|
|
1545
|
+
}
|
|
1546
|
+
declare class GitLabModelConfigRegistry {
|
|
1547
|
+
private readonly url;
|
|
1548
|
+
private readonly ttlMs;
|
|
1549
|
+
private readonly fetchFn;
|
|
1550
|
+
private memCache;
|
|
1551
|
+
private memExpiresAt;
|
|
1552
|
+
private pending;
|
|
1553
|
+
constructor(options?: ModelConfigRegistryOptions);
|
|
1554
|
+
/**
|
|
1555
|
+
* Get model configs, fetching and caching as needed.
|
|
1556
|
+
* Returns a Map keyed by `gitlab_identifier` (the discovery `ref`).
|
|
1557
|
+
*/
|
|
1558
|
+
getConfigs(): Promise<Map<string, ModelConfig>>;
|
|
1559
|
+
/**
|
|
1560
|
+
* Look up config for a single model ref.
|
|
1561
|
+
* Returns defaults if the ref is not found or fetch fails.
|
|
1562
|
+
*/
|
|
1563
|
+
getConfig(ref: string): Promise<ModelConfig>;
|
|
1564
|
+
/** Invalidate both in-memory and file caches. */
|
|
1565
|
+
invalidateCache(): void;
|
|
1566
|
+
private fetchConfigs;
|
|
1567
|
+
}
|
|
1568
|
+
/**
|
|
1569
|
+
* Parse models.yml to extract gitlab_identifier → { context, output } mapping.
|
|
1570
|
+
* Uses simple line-by-line parsing to avoid a YAML dependency.
|
|
1571
|
+
*/
|
|
1572
|
+
declare function parseModelsYml(text: string): Map<string, ModelConfig>;
|
|
1573
|
+
|
|
1574
|
+
export { AGENT_PRIVILEGES, type ActionResponsePayload, type AdditionalContext, type AiChatAvailableModels, type AiModel, BUNDLED_CLIENT_ID, CLIENT_VERSION, type ClientEvent, DEFAULT_AGENT_PRIVILEGES, DEFAULT_AI_GATEWAY_URL, DEFAULT_CLIENT_CAPABILITIES, DEFAULT_WORKFLOW_DEFINITION, type DirectAccessToken, type DiscoveredModels, GITLAB_COM_URL, type GenerateTokenResponse, type GitLabAgenticOptions, type GitLabAnthropicConfig, GitLabAnthropicLanguageModel, GitLabDirectAccessClient, type GitLabDirectAccessConfig, GitLabError, type GitLabErrorOptions, GitLabModelCache, GitLabModelConfigRegistry, GitLabModelDiscovery, GitLabOAuthManager, type GitLabOAuthTokenResponse, type GitLabOAuthTokens, type GitLabOpenAIConfig, GitLabOpenAILanguageModel, type GitLabProject, GitLabProjectCache, GitLabProjectDetector, type GitLabProjectDetectorConfig, type GitLabProvider, type GitLabProviderSettings, GitLabWorkflowClient, type GitLabWorkflowClientConfig, GitLabWorkflowLanguageModel, type GitLabWorkflowLanguageModelConfig, type GitLabWorkflowOptions, GitLabWorkflowTokenClient, MODEL_ID_TO_ANTHROPIC_MODEL, MODEL_MAPPINGS, type McpToolDefinition, type ModelCacheEntry, type ModelConfig, type ModelConfigRegistryOptions, type ModelDiscoveryConfig, type ModelMapping, type ModelProvider, type NewCheckpoint, OAUTH_SCOPES, OPENCODE_GITLAB_AUTH_CLIENT_ID, type OpenAIApiType, type OpenCodeAuth, type OpenCodeAuthApi, type OpenCodeAuthOAuth, type RunMcpTool, type StartRequest, TOKEN_EXPIRY_SKEW_MS, VERSION, WORKFLOW_ENVIRONMENT, WS_HEARTBEAT_INTERVAL_MS, WS_KEEPALIVE_PING_INTERVAL_MS, type WorkflowAction, type WorkflowClientEvent, type WorkflowStatus, type WorkflowToolExecutor, WorkflowType, type WorkflowWebSocketOptions, createGitLab, getAnthropicModelForModelId, getModelMapping, getOpenAIApiType, getOpenAIModelForModelId, getProviderForModelId, getValidModelsForProvider, getWorkflowModelRef, gitlab, isResponsesApiModel, isWorkflowModel, parseModelsYml };
|