gitlab-ai-provider 6.4.0 → 6.4.2
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 +8 -0
- package/README.md +33 -0
- package/dist/gitlab-ai-provider-6.4.2.tgz +0 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +54 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/gitlab-ai-provider-6.4.0.tgz +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1582,7 +1582,7 @@ var GitLabOpenAILanguageModel = class {
|
|
|
1582
1582
|
import WebSocket from "isomorphic-ws";
|
|
1583
1583
|
|
|
1584
1584
|
// src/version.ts
|
|
1585
|
-
var VERSION = true ? "6.
|
|
1585
|
+
var VERSION = true ? "6.4.1" : "0.0.0-dev";
|
|
1586
1586
|
|
|
1587
1587
|
// src/gitlab-workflow-types.ts
|
|
1588
1588
|
var WorkflowType = /* @__PURE__ */ ((WorkflowType2) => {
|
|
@@ -1594,7 +1594,7 @@ var WS_KEEPALIVE_PING_INTERVAL_MS = 45e3;
|
|
|
1594
1594
|
var WS_HEARTBEAT_INTERVAL_MS = 6e4;
|
|
1595
1595
|
var DEFAULT_WORKFLOW_DEFINITION = "chat" /* CHAT */;
|
|
1596
1596
|
var DEFAULT_CLIENT_CAPABILITIES = ["shell_command"];
|
|
1597
|
-
var CLIENT_VERSION = "
|
|
1597
|
+
var CLIENT_VERSION = "8.51.0";
|
|
1598
1598
|
var STOP_REASON_USER = "USER_ACTION_TRIGGERED_STOP";
|
|
1599
1599
|
var AGENT_PRIVILEGES = {
|
|
1600
1600
|
READ_WRITE_FILES: 1,
|
|
@@ -1781,6 +1781,7 @@ var GitLabWorkflowClient = class {
|
|
|
1781
1781
|
}
|
|
1782
1782
|
delete headers["content-type"];
|
|
1783
1783
|
headers["x-gitlab-client-type"] = "node-websocket";
|
|
1784
|
+
headers["x-gitlab-language-server-version"] = CLIENT_VERSION;
|
|
1784
1785
|
const parsedUrl = new URL(options.instanceUrl);
|
|
1785
1786
|
const origin = parsedUrl.origin;
|
|
1786
1787
|
headers["origin"] = origin;
|
|
@@ -3419,7 +3420,8 @@ var GitLabWorkflowLanguageModel = class _GitLabWorkflowLanguageModel {
|
|
|
3419
3420
|
this.sessionWorkflows.set(sessionKey, {
|
|
3420
3421
|
workflowId,
|
|
3421
3422
|
workflowDefinition: effectiveDefinition,
|
|
3422
|
-
agentEmitted: /* @__PURE__ */ new Map()
|
|
3423
|
+
agentEmitted: /* @__PURE__ */ new Map(),
|
|
3424
|
+
toolEntries: /* @__PURE__ */ new Set()
|
|
3423
3425
|
});
|
|
3424
3426
|
sess = this.sessionWorkflows.get(sessionKey);
|
|
3425
3427
|
}
|
|
@@ -3439,6 +3441,8 @@ var GitLabWorkflowLanguageModel = class _GitLabWorkflowLanguageModel {
|
|
|
3439
3441
|
currentAgentMessageId: "",
|
|
3440
3442
|
activeClient: wsClient,
|
|
3441
3443
|
processedRequestIDs: /* @__PURE__ */ new Set(),
|
|
3444
|
+
emittedToolEntries: new Set(sess?.toolEntries),
|
|
3445
|
+
emittedToolKeys: /* @__PURE__ */ new Set(),
|
|
3442
3446
|
sessionKey
|
|
3443
3447
|
};
|
|
3444
3448
|
for (const msg of options.prompt) {
|
|
@@ -3517,10 +3521,6 @@ var GitLabWorkflowLanguageModel = class _GitLabWorkflowLanguageModel {
|
|
|
3517
3521
|
const resolvedFlowConfigSchemaVersion = callFlowConfigSchemaVersion ?? this.workflowOptions.flowConfigSchemaVersion;
|
|
3518
3522
|
if (resolvedFlowConfig) {
|
|
3519
3523
|
startReq.flowConfig = resolvedFlowConfig;
|
|
3520
|
-
} else if (this.workflowOptions.systemPrompt) {
|
|
3521
|
-
startReq.flowConfig = {
|
|
3522
|
-
prompts: [{ prompt_template: { system: this.workflowOptions.systemPrompt } }]
|
|
3523
|
-
};
|
|
3524
3524
|
}
|
|
3525
3525
|
if (resolvedFlowConfigSchemaVersion) {
|
|
3526
3526
|
startReq.flowConfigSchemaVersion = resolvedFlowConfigSchemaVersion;
|
|
@@ -3588,6 +3588,7 @@ var GitLabWorkflowLanguageModel = class _GitLabWorkflowLanguageModel {
|
|
|
3588
3588
|
const { requestID, data } = event;
|
|
3589
3589
|
if (ss.processedRequestIDs.has(requestID)) break;
|
|
3590
3590
|
ss.processedRequestIDs.add(requestID);
|
|
3591
|
+
ss.emittedToolKeys.add(data.name);
|
|
3591
3592
|
let parsedArgs;
|
|
3592
3593
|
try {
|
|
3593
3594
|
JSON.parse(data.args);
|
|
@@ -3637,6 +3638,7 @@ var GitLabWorkflowLanguageModel = class _GitLabWorkflowLanguageModel {
|
|
|
3637
3638
|
if (ss.processedRequestIDs.has(event.requestID)) break;
|
|
3638
3639
|
ss.processedRequestIDs.add(event.requestID);
|
|
3639
3640
|
const mapped = mapBuiltinTool(event.toolName, event.data, availableToolNames);
|
|
3641
|
+
ss.emittedToolKeys.add(mapped.toolName);
|
|
3640
3642
|
const mappedArgs = JSON.stringify(mapped.args);
|
|
3641
3643
|
if (ss.activeTextBlockId) {
|
|
3642
3644
|
controller.enqueue({ type: "text-end", id: ss.activeTextBlockId });
|
|
@@ -3818,6 +3820,51 @@ var GitLabWorkflowLanguageModel = class _GitLabWorkflowLanguageModel {
|
|
|
3818
3820
|
}
|
|
3819
3821
|
for (let i = 0; i < chatLog.length; i++) {
|
|
3820
3822
|
const entry = chatLog[i];
|
|
3823
|
+
if (entry.message_type === "tool" && entry.tool_info) {
|
|
3824
|
+
const toolId = entry.message_id || entry.correlation_id || `tool-${i}`;
|
|
3825
|
+
if (ss.emittedToolEntries.has(toolId)) continue;
|
|
3826
|
+
const name = entry.tool_info.name;
|
|
3827
|
+
const args = JSON.stringify(entry.tool_info.args ?? {});
|
|
3828
|
+
if (ss.emittedToolKeys.has(name)) {
|
|
3829
|
+
ss.emittedToolEntries.add(toolId);
|
|
3830
|
+
const sess2 = this.sessionWorkflows.get(ss.sessionKey);
|
|
3831
|
+
if (sess2) sess2.toolEntries.add(toolId);
|
|
3832
|
+
continue;
|
|
3833
|
+
}
|
|
3834
|
+
if (ss.activeTextBlockId) {
|
|
3835
|
+
controller.enqueue({ type: "text-end", id: ss.activeTextBlockId });
|
|
3836
|
+
ss.activeTextBlockId = null;
|
|
3837
|
+
}
|
|
3838
|
+
controller.enqueue({
|
|
3839
|
+
type: "tool-input-start",
|
|
3840
|
+
id: toolId,
|
|
3841
|
+
toolName: name,
|
|
3842
|
+
providerExecuted: true
|
|
3843
|
+
});
|
|
3844
|
+
controller.enqueue({ type: "tool-input-delta", id: toolId, delta: args });
|
|
3845
|
+
controller.enqueue({ type: "tool-input-end", id: toolId });
|
|
3846
|
+
controller.enqueue({
|
|
3847
|
+
type: "tool-call",
|
|
3848
|
+
toolCallId: toolId,
|
|
3849
|
+
toolName: name,
|
|
3850
|
+
input: args,
|
|
3851
|
+
providerExecuted: true,
|
|
3852
|
+
dynamic: true
|
|
3853
|
+
});
|
|
3854
|
+
const response = entry.tool_info.tool_response;
|
|
3855
|
+
const output = typeof response === "string" ? response : response ? response.content : entry.content || "";
|
|
3856
|
+
controller.enqueue({
|
|
3857
|
+
type: "tool-result",
|
|
3858
|
+
toolCallId: toolId,
|
|
3859
|
+
toolName: name,
|
|
3860
|
+
result: { output, title: name, metadata: {} },
|
|
3861
|
+
isError: false
|
|
3862
|
+
});
|
|
3863
|
+
ss.emittedToolEntries.add(toolId);
|
|
3864
|
+
const sess = this.sessionWorkflows.get(ss.sessionKey);
|
|
3865
|
+
if (sess) sess.toolEntries.add(toolId);
|
|
3866
|
+
continue;
|
|
3867
|
+
}
|
|
3821
3868
|
if (entry.message_type !== "agent") continue;
|
|
3822
3869
|
const content = entry.content || "";
|
|
3823
3870
|
const msgId = entry.message_id || `idx-${i}`;
|