gitlab-ai-provider 5.1.2 → 5.2.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.2.0.tgz +0 -0
- package/dist/index.d.mts +38 -1
- package/dist/index.d.ts +38 -1
- package/dist/index.js +57 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +56 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/gitlab-ai-provider-5.1.2.tgz +0 -0
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.2.0 (2026-03-18)
|
|
6
|
+
|
|
7
|
+
- fix: update dists ([57692b5](https://gitlab.com/vglafirov/gitlab-ai-provider/commit/57692b5))
|
|
8
|
+
- feat: add discoverWorkflowModels() for high-level workflow model discovery ([b61ed5a](https://gitlab.com/vglafirov/gitlab-ai-provider/commit/b61ed5a))
|
|
9
|
+
|
|
5
10
|
## <small>5.1.2 (2026-03-17)</small>
|
|
6
11
|
|
|
7
12
|
- fix: regenerate dists ([091d3ae](https://gitlab.com/vglafirov/gitlab-ai-provider/commit/091d3ae))
|
|
Binary file
|
package/dist/index.d.mts
CHANGED
|
@@ -1573,4 +1573,41 @@ declare class GitLabModelConfigRegistry {
|
|
|
1573
1573
|
*/
|
|
1574
1574
|
declare function parseModelsYml(text: string): Map<string, ModelConfig>;
|
|
1575
1575
|
|
|
1576
|
-
|
|
1576
|
+
/**
|
|
1577
|
+
* High-level workflow model discovery.
|
|
1578
|
+
*
|
|
1579
|
+
* Combines project detection, GraphQL model discovery, model config lookup,
|
|
1580
|
+
* and MODEL_MAPPINGS to produce a list of available workflow models with
|
|
1581
|
+
* their token limits. Consumers map these into their own internal model
|
|
1582
|
+
* representations.
|
|
1583
|
+
*/
|
|
1584
|
+
|
|
1585
|
+
interface DiscoveredWorkflowModel {
|
|
1586
|
+
/** Model ID suitable for use with `sdk.workflowChat()` (e.g. "duo-workflow-sonnet-4-6") */
|
|
1587
|
+
id: string;
|
|
1588
|
+
/** Upstream model ref (e.g. "claude_sonnet_4_6") */
|
|
1589
|
+
ref: string;
|
|
1590
|
+
/** Human-readable name (e.g. "Claude Sonnet 4.6") */
|
|
1591
|
+
name: string;
|
|
1592
|
+
/** Max input context tokens */
|
|
1593
|
+
context: number;
|
|
1594
|
+
/** Max output tokens */
|
|
1595
|
+
output: number;
|
|
1596
|
+
/** Whether this model was admin-pinned */
|
|
1597
|
+
pinned: boolean;
|
|
1598
|
+
}
|
|
1599
|
+
interface WorkflowDiscoveryConfig {
|
|
1600
|
+
instanceUrl: string;
|
|
1601
|
+
getHeaders: () => Record<string, string>;
|
|
1602
|
+
fetch?: typeof fetch;
|
|
1603
|
+
}
|
|
1604
|
+
interface WorkflowDiscoveryOptions {
|
|
1605
|
+
workingDirectory: string;
|
|
1606
|
+
}
|
|
1607
|
+
interface WorkflowDiscoveryResult {
|
|
1608
|
+
models: DiscoveredWorkflowModel[];
|
|
1609
|
+
project: GitLabProject | null;
|
|
1610
|
+
}
|
|
1611
|
+
declare function discoverWorkflowModels(config: WorkflowDiscoveryConfig, options: WorkflowDiscoveryOptions): Promise<WorkflowDiscoveryResult>;
|
|
1612
|
+
|
|
1613
|
+
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, type DiscoveredWorkflowModel, 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 WorkflowDiscoveryConfig, type WorkflowDiscoveryOptions, type WorkflowDiscoveryResult, type WorkflowStatus, type WorkflowToolExecutor, WorkflowType, type WorkflowWebSocketOptions, createGitLab, discoverWorkflowModels, getAnthropicModelForModelId, getModelMapping, getOpenAIApiType, getOpenAIModelForModelId, getProviderForModelId, getValidModelsForProvider, getWorkflowModelRef, gitlab, isResponsesApiModel, isWorkflowModel, parseModelsYml };
|
package/dist/index.d.ts
CHANGED
|
@@ -1573,4 +1573,41 @@ declare class GitLabModelConfigRegistry {
|
|
|
1573
1573
|
*/
|
|
1574
1574
|
declare function parseModelsYml(text: string): Map<string, ModelConfig>;
|
|
1575
1575
|
|
|
1576
|
-
|
|
1576
|
+
/**
|
|
1577
|
+
* High-level workflow model discovery.
|
|
1578
|
+
*
|
|
1579
|
+
* Combines project detection, GraphQL model discovery, model config lookup,
|
|
1580
|
+
* and MODEL_MAPPINGS to produce a list of available workflow models with
|
|
1581
|
+
* their token limits. Consumers map these into their own internal model
|
|
1582
|
+
* representations.
|
|
1583
|
+
*/
|
|
1584
|
+
|
|
1585
|
+
interface DiscoveredWorkflowModel {
|
|
1586
|
+
/** Model ID suitable for use with `sdk.workflowChat()` (e.g. "duo-workflow-sonnet-4-6") */
|
|
1587
|
+
id: string;
|
|
1588
|
+
/** Upstream model ref (e.g. "claude_sonnet_4_6") */
|
|
1589
|
+
ref: string;
|
|
1590
|
+
/** Human-readable name (e.g. "Claude Sonnet 4.6") */
|
|
1591
|
+
name: string;
|
|
1592
|
+
/** Max input context tokens */
|
|
1593
|
+
context: number;
|
|
1594
|
+
/** Max output tokens */
|
|
1595
|
+
output: number;
|
|
1596
|
+
/** Whether this model was admin-pinned */
|
|
1597
|
+
pinned: boolean;
|
|
1598
|
+
}
|
|
1599
|
+
interface WorkflowDiscoveryConfig {
|
|
1600
|
+
instanceUrl: string;
|
|
1601
|
+
getHeaders: () => Record<string, string>;
|
|
1602
|
+
fetch?: typeof fetch;
|
|
1603
|
+
}
|
|
1604
|
+
interface WorkflowDiscoveryOptions {
|
|
1605
|
+
workingDirectory: string;
|
|
1606
|
+
}
|
|
1607
|
+
interface WorkflowDiscoveryResult {
|
|
1608
|
+
models: DiscoveredWorkflowModel[];
|
|
1609
|
+
project: GitLabProject | null;
|
|
1610
|
+
}
|
|
1611
|
+
declare function discoverWorkflowModels(config: WorkflowDiscoveryConfig, options: WorkflowDiscoveryOptions): Promise<WorkflowDiscoveryResult>;
|
|
1612
|
+
|
|
1613
|
+
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, type DiscoveredWorkflowModel, 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 WorkflowDiscoveryConfig, type WorkflowDiscoveryOptions, type WorkflowDiscoveryResult, type WorkflowStatus, type WorkflowToolExecutor, WorkflowType, type WorkflowWebSocketOptions, createGitLab, discoverWorkflowModels, getAnthropicModelForModelId, getModelMapping, getOpenAIApiType, getOpenAIModelForModelId, getProviderForModelId, getValidModelsForProvider, getWorkflowModelRef, gitlab, isResponsesApiModel, isWorkflowModel, parseModelsYml };
|
package/dist/index.js
CHANGED
|
@@ -61,6 +61,7 @@ __export(index_exports, {
|
|
|
61
61
|
WS_KEEPALIVE_PING_INTERVAL_MS: () => WS_KEEPALIVE_PING_INTERVAL_MS,
|
|
62
62
|
WorkflowType: () => WorkflowType,
|
|
63
63
|
createGitLab: () => createGitLab,
|
|
64
|
+
discoverWorkflowModels: () => discoverWorkflowModels,
|
|
64
65
|
getAnthropicModelForModelId: () => getAnthropicModelForModelId,
|
|
65
66
|
getModelMapping: () => getModelMapping,
|
|
66
67
|
getOpenAIApiType: () => getOpenAIApiType,
|
|
@@ -1576,7 +1577,7 @@ var GitLabOpenAILanguageModel = class {
|
|
|
1576
1577
|
var import_isomorphic_ws = __toESM(require("isomorphic-ws"));
|
|
1577
1578
|
|
|
1578
1579
|
// src/version.ts
|
|
1579
|
-
var VERSION = true ? "5.
|
|
1580
|
+
var VERSION = true ? "5.2.0" : "0.0.0-dev";
|
|
1580
1581
|
|
|
1581
1582
|
// src/gitlab-workflow-types.ts
|
|
1582
1583
|
var WorkflowType = /* @__PURE__ */ ((WorkflowType2) => {
|
|
@@ -4493,6 +4494,60 @@ function parseModelsYml(text) {
|
|
|
4493
4494
|
}
|
|
4494
4495
|
return configs;
|
|
4495
4496
|
}
|
|
4497
|
+
|
|
4498
|
+
// src/gitlab-workflow-discovery.ts
|
|
4499
|
+
var configRegistry = new GitLabModelConfigRegistry();
|
|
4500
|
+
async function discoverWorkflowModels(config, options) {
|
|
4501
|
+
const detector = new GitLabProjectDetector({
|
|
4502
|
+
instanceUrl: config.instanceUrl,
|
|
4503
|
+
getHeaders: config.getHeaders,
|
|
4504
|
+
fetch: config.fetch
|
|
4505
|
+
});
|
|
4506
|
+
let project = null;
|
|
4507
|
+
try {
|
|
4508
|
+
project = await detector.detectProject(options.workingDirectory);
|
|
4509
|
+
} catch {
|
|
4510
|
+
return { models: [], project: null };
|
|
4511
|
+
}
|
|
4512
|
+
const namespaceId = project?.namespaceId;
|
|
4513
|
+
if (!namespaceId) return { models: [], project };
|
|
4514
|
+
const discovery = new GitLabModelDiscovery({
|
|
4515
|
+
instanceUrl: config.instanceUrl,
|
|
4516
|
+
getHeaders: config.getHeaders,
|
|
4517
|
+
fetch: config.fetch
|
|
4518
|
+
});
|
|
4519
|
+
const [discovered, configs] = await Promise.all([
|
|
4520
|
+
discovery.discover(`gid://gitlab/Group/${namespaceId}`),
|
|
4521
|
+
configRegistry.getConfigs()
|
|
4522
|
+
]);
|
|
4523
|
+
const refToID = /* @__PURE__ */ new Map();
|
|
4524
|
+
for (const [id, mapping] of Object.entries(MODEL_MAPPINGS)) {
|
|
4525
|
+
if (mapping.provider === "workflow" && id !== "duo-workflow" && id !== "duo-workflow-default") {
|
|
4526
|
+
refToID.set(mapping.model, id);
|
|
4527
|
+
}
|
|
4528
|
+
}
|
|
4529
|
+
const all = discovered.pinnedModel ? [discovered.pinnedModel] : [
|
|
4530
|
+
...discovered.selectableModels ?? [],
|
|
4531
|
+
...discovered.defaultModel ? [discovered.defaultModel] : []
|
|
4532
|
+
];
|
|
4533
|
+
const seen = /* @__PURE__ */ new Set();
|
|
4534
|
+
const models = [];
|
|
4535
|
+
for (const model of all) {
|
|
4536
|
+
if (!model.ref || seen.has(model.ref)) continue;
|
|
4537
|
+
seen.add(model.ref);
|
|
4538
|
+
const id = refToID.get(model.ref) ?? `duo-workflow-${model.ref.replace(/[/_]/g, "-")}`;
|
|
4539
|
+
const limits = configs.get(model.ref);
|
|
4540
|
+
models.push({
|
|
4541
|
+
id,
|
|
4542
|
+
ref: model.ref,
|
|
4543
|
+
name: model.name,
|
|
4544
|
+
context: limits?.context ?? 2e5,
|
|
4545
|
+
output: limits?.output ?? 64e3,
|
|
4546
|
+
pinned: !!discovered.pinnedModel && discovered.pinnedModel.ref === model.ref
|
|
4547
|
+
});
|
|
4548
|
+
}
|
|
4549
|
+
return { models, project };
|
|
4550
|
+
}
|
|
4496
4551
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4497
4552
|
0 && (module.exports = {
|
|
4498
4553
|
AGENT_PRIVILEGES,
|
|
@@ -4527,6 +4582,7 @@ function parseModelsYml(text) {
|
|
|
4527
4582
|
WS_KEEPALIVE_PING_INTERVAL_MS,
|
|
4528
4583
|
WorkflowType,
|
|
4529
4584
|
createGitLab,
|
|
4585
|
+
discoverWorkflowModels,
|
|
4530
4586
|
getAnthropicModelForModelId,
|
|
4531
4587
|
getModelMapping,
|
|
4532
4588
|
getOpenAIApiType,
|