gitlab-ai-provider 6.1.0 → 6.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 CHANGED
@@ -2,6 +2,20 @@
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
+ ## 6.2.0 (2026-03-30)
6
+
7
+ - feat: support aiCatalogItemVersionId in createWorkflow for custom agent session linking ([861c98d](https://gitlab.com/vglafirov/gitlab-ai-provider/commit/861c98d))
8
+ - feat: support per-call flowConfig and flowConfigSchemaVersion overrides for custom agents ([9ba0308](https://gitlab.com/vglafirov/gitlab-ai-provider/commit/9ba0308))
9
+ - feat: support per-call workflowDefinition override via providerOptions.gitlab ([7f8ced2](https://gitlab.com/vglafirov/gitlab-ai-provider/commit/7f8ced2))
10
+ - chore: remove debug logging from doStream ([46a5278](https://gitlab.com/vglafirov/gitlab-ai-provider/commit/46a5278))
11
+ - chore: remove debug logging from doStream ([7a2594f](https://gitlab.com/vglafirov/gitlab-ai-provider/commit/7a2594f))
12
+ - fix: reset workflow when workflowDefinition changes between agents ([30e95f8](https://gitlab.com/vglafirov/gitlab-ai-provider/commit/30e95f8))
13
+ - fix: use callWorkflowDefinition in startRequest, not instance workflowOptions ([23f14ef](https://gitlab.com/vglafirov/gitlab-ai-provider/commit/23f14ef))
14
+
15
+ ## <small>6.1.1 (2026-03-29)</small>
16
+
17
+ - fix: update dist ([9f4b816](https://gitlab.com/vglafirov/gitlab-ai-provider/commit/9f4b816))
18
+
5
19
  ## 6.1.0 (2026-03-29)
6
20
 
7
21
  - fix(approval): defer stream close while approval is pending and send rejection to DWS ([9344828](https://gitlab.com/vglafirov/gitlab-ai-provider/commit/9344828))
package/dist/index.d.mts CHANGED
@@ -704,6 +704,7 @@ declare class GitLabWorkflowLanguageModel implements LanguageModelV3 {
704
704
  private readonly modelCache;
705
705
  private detectedProjectPath;
706
706
  private currentWorkflowId;
707
+ private currentWorkflowDefinition;
707
708
  private persistedAgentEmitted;
708
709
  private readonly activeClients;
709
710
  private _selectedModelRef?;
@@ -1583,6 +1584,7 @@ declare class GitLabWorkflowTokenClient {
1583
1584
  agentPrivileges?: number[];
1584
1585
  environment?: string;
1585
1586
  allowAgentToRequestUser?: boolean;
1587
+ aiCatalogItemVersionId?: number;
1586
1588
  }): Promise<string>;
1587
1589
  /**
1588
1590
  * Invalidate cached tokens.
package/dist/index.d.ts CHANGED
@@ -704,6 +704,7 @@ declare class GitLabWorkflowLanguageModel implements LanguageModelV3 {
704
704
  private readonly modelCache;
705
705
  private detectedProjectPath;
706
706
  private currentWorkflowId;
707
+ private currentWorkflowDefinition;
707
708
  private persistedAgentEmitted;
708
709
  private readonly activeClients;
709
710
  private _selectedModelRef?;
@@ -1583,6 +1584,7 @@ declare class GitLabWorkflowTokenClient {
1583
1584
  agentPrivileges?: number[];
1584
1585
  environment?: string;
1585
1586
  allowAgentToRequestUser?: boolean;
1587
+ aiCatalogItemVersionId?: number;
1586
1588
  }): Promise<string>;
1587
1589
  /**
1588
1590
  * Invalidate cached tokens.
package/dist/index.js CHANGED
@@ -1653,7 +1653,7 @@ var GitLabOpenAILanguageModel = class {
1653
1653
  var import_isomorphic_ws = __toESM(require("isomorphic-ws"));
1654
1654
 
1655
1655
  // src/version.ts
1656
- var VERSION = true ? "6.0.0" : "0.0.0-dev";
1656
+ var VERSION = true ? "6.1.1" : "0.0.0-dev";
1657
1657
 
1658
1658
  // src/gitlab-workflow-types.ts
1659
1659
  var WorkflowType = /* @__PURE__ */ ((WorkflowType2) => {
@@ -2406,7 +2406,10 @@ var GitLabWorkflowTokenClient = class {
2406
2406
  workflow_definition: options?.workflowDefinition ?? DEFAULT_WORKFLOW_DEFINITION,
2407
2407
  agent_privileges: options?.agentPrivileges ?? DEFAULT_AGENT_PRIVILEGES,
2408
2408
  environment: options?.environment ?? WORKFLOW_ENVIRONMENT,
2409
- allow_agent_to_request_user: options?.allowAgentToRequestUser ?? true
2409
+ allow_agent_to_request_user: options?.allowAgentToRequestUser ?? true,
2410
+ ...options?.aiCatalogItemVersionId !== void 0 && {
2411
+ ai_catalog_item_version_id: options.aiCatalogItemVersionId
2412
+ }
2410
2413
  };
2411
2414
  try {
2412
2415
  const response = await this.fetchFn(url, {
@@ -3046,6 +3049,9 @@ var GitLabWorkflowLanguageModel = class _GitLabWorkflowLanguageModel {
3046
3049
  // When DWS sends INPUT_REQUIRED, the workflow stays alive server-side.
3047
3050
  // On the next doStream() call we reuse this ID (skip createWorkflow).
3048
3051
  currentWorkflowId = null;
3052
+ // Track which workflowDefinition/flowConfig the current workflow was created with.
3053
+ // When the agent changes, reset the workflow so a new one is created correctly.
3054
+ currentWorkflowDefinition = null;
3049
3055
  // Persisted across turns so that cumulative DWS chat logs don't re-emit
3050
3056
  // messages that were already streamed in a previous doStream() call.
3051
3057
  persistedAgentEmitted = /* @__PURE__ */ new Map();
@@ -3428,11 +3434,21 @@ var GitLabWorkflowLanguageModel = class _GitLabWorkflowLanguageModel {
3428
3434
  const additionalContext = this.buildAdditionalContext(options.prompt);
3429
3435
  const toolExecutor = this.toolExecutor ?? null;
3430
3436
  const availableToolNames = new Set(options.tools?.map((t) => t.name) ?? []);
3437
+ const gitlabProviderOptions = options.providerOptions?.["gitlab"];
3438
+ const callWorkflowDefinition = gitlabProviderOptions?.workflowDefinition ?? this.workflowOptions.workflowDefinition;
3439
+ const callFlowConfig = gitlabProviderOptions?.flowConfig ?? void 0;
3440
+ const callFlowConfigSchemaVersion = gitlabProviderOptions?.flowConfigSchemaVersion ?? void 0;
3441
+ const callAiCatalogItemVersionId = gitlabProviderOptions?.aiCatalogItemVersionId ?? void 0;
3431
3442
  await this.tokenClient.getToken(
3432
- this.workflowOptions.workflowDefinition ?? DEFAULT_WORKFLOW_DEFINITION,
3443
+ callWorkflowDefinition ?? DEFAULT_WORKFLOW_DEFINITION,
3433
3444
  this.workflowOptions.rootNamespaceId
3434
3445
  );
3435
3446
  const projectId = await this.resolveProjectId();
3447
+ const effectiveDefinition = callFlowConfig ?? callWorkflowDefinition ?? DEFAULT_WORKFLOW_DEFINITION;
3448
+ if (this.currentWorkflowId && this.currentWorkflowDefinition !== effectiveDefinition) {
3449
+ this.currentWorkflowId = null;
3450
+ this.currentWorkflowDefinition = null;
3451
+ }
3436
3452
  let workflowId;
3437
3453
  if (this.currentWorkflowId) {
3438
3454
  workflowId = this.currentWorkflowId;
@@ -3440,10 +3456,12 @@ var GitLabWorkflowLanguageModel = class _GitLabWorkflowLanguageModel {
3440
3456
  workflowId = await this.tokenClient.createWorkflow(goal, {
3441
3457
  projectId,
3442
3458
  namespaceId: this.workflowOptions.namespaceId,
3443
- workflowDefinition: this.workflowOptions.workflowDefinition,
3444
- agentPrivileges: this.workflowOptions.agentPrivileges
3459
+ workflowDefinition: callWorkflowDefinition,
3460
+ agentPrivileges: this.workflowOptions.agentPrivileges,
3461
+ aiCatalogItemVersionId: callAiCatalogItemVersionId
3445
3462
  });
3446
3463
  this.currentWorkflowId = workflowId;
3464
+ this.currentWorkflowDefinition = effectiveDefinition;
3447
3465
  }
3448
3466
  const wsClient = new GitLabWorkflowClient();
3449
3467
  this.activeClients.add(wsClient);
@@ -3498,7 +3516,7 @@ var GitLabWorkflowLanguageModel = class _GitLabWorkflowLanguageModel {
3498
3516
  );
3499
3517
  }
3500
3518
  );
3501
- const workflowDef = this.workflowOptions.workflowDefinition ?? DEFAULT_WORKFLOW_DEFINITION;
3519
+ const workflowDef = callWorkflowDefinition ?? DEFAULT_WORKFLOW_DEFINITION;
3502
3520
  const capabilities = this.workflowOptions.clientCapabilities ?? DEFAULT_CLIENT_CAPABILITIES;
3503
3521
  const workflowMetadata = await this.buildWorkflowMetadata();
3504
3522
  const metadataStr = JSON.stringify(workflowMetadata);
@@ -3527,15 +3545,17 @@ var GitLabWorkflowLanguageModel = class _GitLabWorkflowLanguageModel {
3527
3545
  mcpTools: trimmed.mcpTools,
3528
3546
  preapproved_tools: trimmedPreapproved
3529
3547
  };
3530
- if (this.workflowOptions.flowConfig) {
3531
- startReq.flowConfig = this.workflowOptions.flowConfig;
3548
+ const resolvedFlowConfig = callFlowConfig ?? this.workflowOptions.flowConfig;
3549
+ const resolvedFlowConfigSchemaVersion = callFlowConfigSchemaVersion ?? this.workflowOptions.flowConfigSchemaVersion;
3550
+ if (resolvedFlowConfig) {
3551
+ startReq.flowConfig = resolvedFlowConfig;
3532
3552
  } else if (this.workflowOptions.systemPrompt) {
3533
3553
  startReq.flowConfig = {
3534
3554
  prompts: [{ prompt_template: { system: this.workflowOptions.systemPrompt } }]
3535
3555
  };
3536
3556
  }
3537
- if (this.workflowOptions.flowConfigSchemaVersion) {
3538
- startReq.flowConfigSchemaVersion = this.workflowOptions.flowConfigSchemaVersion;
3557
+ if (resolvedFlowConfigSchemaVersion) {
3558
+ startReq.flowConfigSchemaVersion = resolvedFlowConfigSchemaVersion;
3539
3559
  } else if (startReq.flowConfig) {
3540
3560
  startReq.flowConfigSchemaVersion = "v1";
3541
3561
  }