gitlab-ai-provider 5.3.1 → 5.3.3
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 +10 -0
- package/dist/gitlab-ai-provider-5.3.3.tgz +0 -0
- package/dist/index.d.mts +20 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +44 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +44 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/gitlab-ai-provider-5.3.1.tgz +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1509,7 +1509,7 @@ var GitLabOpenAILanguageModel = class {
|
|
|
1509
1509
|
import WebSocket from "isomorphic-ws";
|
|
1510
1510
|
|
|
1511
1511
|
// src/version.ts
|
|
1512
|
-
var VERSION = true ? "5.3.
|
|
1512
|
+
var VERSION = true ? "5.3.2" : "0.0.0-dev";
|
|
1513
1513
|
|
|
1514
1514
|
// src/gitlab-workflow-types.ts
|
|
1515
1515
|
var WorkflowType = /* @__PURE__ */ ((WorkflowType2) => {
|
|
@@ -1735,6 +1735,8 @@ var GitLabWorkflowClient = class {
|
|
|
1735
1735
|
});
|
|
1736
1736
|
} else if (checkpoint.status === "STOPPED" || checkpoint.status === "CANCELLED") {
|
|
1737
1737
|
this.emit({ type: "completed" });
|
|
1738
|
+
} else if (checkpoint.status === "TOOL_CALL_APPROVAL_REQUIRED" || checkpoint.status === "PLAN_APPROVAL_REQUIRED") {
|
|
1739
|
+
this.emit({ type: "completed" });
|
|
1738
1740
|
}
|
|
1739
1741
|
return;
|
|
1740
1742
|
}
|
|
@@ -2949,6 +2951,17 @@ var GitLabWorkflowLanguageModel = class _GitLabWorkflowLanguageModel {
|
|
|
2949
2951
|
* alongside `toolExecutor`. Takes precedence over `workflowOptions.onSelectModel`.
|
|
2950
2952
|
*/
|
|
2951
2953
|
onSelectModel = null;
|
|
2954
|
+
/**
|
|
2955
|
+
* Set the system prompt to override DWS's default.
|
|
2956
|
+
* Sent via `flowConfig.prompts[].prompt_template.system` at stream time.
|
|
2957
|
+
* Can be updated between doStream() calls (e.g., per agent/session).
|
|
2958
|
+
*/
|
|
2959
|
+
set systemPrompt(prompt) {
|
|
2960
|
+
this.workflowOptions.systemPrompt = prompt ?? void 0;
|
|
2961
|
+
}
|
|
2962
|
+
get systemPrompt() {
|
|
2963
|
+
return this.workflowOptions.systemPrompt ?? null;
|
|
2964
|
+
}
|
|
2952
2965
|
get toolExecutor() {
|
|
2953
2966
|
return this._toolExecutor;
|
|
2954
2967
|
}
|
|
@@ -3317,9 +3330,15 @@ var GitLabWorkflowLanguageModel = class _GitLabWorkflowLanguageModel {
|
|
|
3317
3330
|
};
|
|
3318
3331
|
if (this.workflowOptions.flowConfig) {
|
|
3319
3332
|
startReq.flowConfig = this.workflowOptions.flowConfig;
|
|
3333
|
+
} else if (this.workflowOptions.systemPrompt) {
|
|
3334
|
+
startReq.flowConfig = {
|
|
3335
|
+
prompts: [{ prompt_template: { system: this.workflowOptions.systemPrompt } }]
|
|
3336
|
+
};
|
|
3320
3337
|
}
|
|
3321
3338
|
if (this.workflowOptions.flowConfigSchemaVersion) {
|
|
3322
3339
|
startReq.flowConfigSchemaVersion = this.workflowOptions.flowConfigSchemaVersion;
|
|
3340
|
+
} else if (startReq.flowConfig) {
|
|
3341
|
+
startReq.flowConfigSchemaVersion = "v1";
|
|
3323
3342
|
}
|
|
3324
3343
|
wsClient.sendStartRequest(startReq);
|
|
3325
3344
|
controller.enqueue({
|
|
@@ -3576,7 +3595,7 @@ var GitLabWorkflowLanguageModel = class _GitLabWorkflowLanguageModel {
|
|
|
3576
3595
|
if (!chatLog || !Array.isArray(chatLog) || chatLog.length === 0) {
|
|
3577
3596
|
return;
|
|
3578
3597
|
}
|
|
3579
|
-
if (checkpoint.status !== "RUNNING" && checkpoint.status !== "INPUT_REQUIRED" && checkpoint.status !== "FINISHED" && checkpoint.status !== "COMPLETED") {
|
|
3598
|
+
if (checkpoint.status !== "RUNNING" && checkpoint.status !== "INPUT_REQUIRED" && checkpoint.status !== "FINISHED" && checkpoint.status !== "COMPLETED" && checkpoint.status !== "TOOL_CALL_APPROVAL_REQUIRED") {
|
|
3580
3599
|
return;
|
|
3581
3600
|
}
|
|
3582
3601
|
for (let i = 0; i < chatLog.length; i++) {
|
|
@@ -3722,7 +3741,8 @@ var GitLabWorkflowLanguageModel = class _GitLabWorkflowLanguageModel {
|
|
|
3722
3741
|
// ---------------------------------------------------------------------------
|
|
3723
3742
|
async buildWorkflowMetadata() {
|
|
3724
3743
|
const metadata = {
|
|
3725
|
-
extended_logging: false
|
|
3744
|
+
extended_logging: false,
|
|
3745
|
+
tool_approval_for_session_enabled: true
|
|
3726
3746
|
};
|
|
3727
3747
|
try {
|
|
3728
3748
|
const workDir = this.workflowOptions.workingDirectory ?? process.cwd();
|
|
@@ -3760,13 +3780,16 @@ var GitLabWorkflowLanguageModel = class _GitLabWorkflowLanguageModel {
|
|
|
3760
3780
|
/**
|
|
3761
3781
|
* Extract the user's goal (last user message) from the AI SDK prompt.
|
|
3762
3782
|
*/
|
|
3783
|
+
static SYSTEM_REMINDER_RE = /<system-reminder>([\s\S]*?)<\/system-reminder>/g;
|
|
3763
3784
|
extractGoalFromPrompt(prompt) {
|
|
3764
3785
|
for (let i = prompt.length - 1; i >= 0; i--) {
|
|
3765
3786
|
const message = prompt[i];
|
|
3766
3787
|
if (message.role === "user") {
|
|
3767
3788
|
const textParts = message.content.filter((part) => part.type === "text").map((part) => part.text);
|
|
3768
3789
|
if (textParts.length > 0) {
|
|
3769
|
-
|
|
3790
|
+
const raw = textParts.join("\n");
|
|
3791
|
+
const cleaned = raw.replace(_GitLabWorkflowLanguageModel.SYSTEM_REMINDER_RE, "").trim();
|
|
3792
|
+
return cleaned || raw;
|
|
3770
3793
|
}
|
|
3771
3794
|
}
|
|
3772
3795
|
}
|
|
@@ -3860,6 +3883,23 @@ var GitLabWorkflowLanguageModel = class _GitLabWorkflowLanguageModel {
|
|
|
3860
3883
|
metadata: JSON.stringify({ role: "assistant" })
|
|
3861
3884
|
});
|
|
3862
3885
|
}
|
|
3886
|
+
} else if (message.role === "user") {
|
|
3887
|
+
for (const part of message.content) {
|
|
3888
|
+
if (part.type === "text") {
|
|
3889
|
+
const text = part.text;
|
|
3890
|
+
const matches = text.matchAll(_GitLabWorkflowLanguageModel.SYSTEM_REMINDER_RE);
|
|
3891
|
+
for (const match of matches) {
|
|
3892
|
+
const inner = match[1].trim();
|
|
3893
|
+
if (inner) {
|
|
3894
|
+
context.push({
|
|
3895
|
+
category: "agent_context",
|
|
3896
|
+
content: inner,
|
|
3897
|
+
metadata: JSON.stringify({ source: "system-reminder" })
|
|
3898
|
+
});
|
|
3899
|
+
}
|
|
3900
|
+
}
|
|
3901
|
+
}
|
|
3902
|
+
}
|
|
3863
3903
|
}
|
|
3864
3904
|
}
|
|
3865
3905
|
return context;
|