staklink 0.3.70 → 0.3.72
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/dist/proxy-server.cjs +140 -77
- package/dist/staklink-cli.cjs +1 -1
- package/package.json +2 -2
package/dist/proxy-server.cjs
CHANGED
|
@@ -61229,7 +61229,7 @@ var SSEManager = class {
|
|
|
61229
61229
|
var sseManager = new SSEManager();
|
|
61230
61230
|
|
|
61231
61231
|
// src/proxy/version.ts
|
|
61232
|
-
var VERSION = "0.3.
|
|
61232
|
+
var VERSION = "0.3.72";
|
|
61233
61233
|
|
|
61234
61234
|
// node_modules/uuid/dist/esm/stringify.js
|
|
61235
61235
|
var byteToHex = [];
|
|
@@ -61396,6 +61396,9 @@ The actual dev server is being run with pm2... so you can use pm2 logs to see de
|
|
|
61396
61396
|
Don't try to write summaries or docs in .md file unless specifically asked to! Default to output text response to the user.
|
|
61397
61397
|
|
|
61398
61398
|
Do not make branch / PR if not specifically asked to.
|
|
61399
|
+
|
|
61400
|
+
The repo being worked on may have extensive testing! If asked to test, try limit stdout logs and only pay attention to stderr logs. Something like this for exampe: "npm run test:unit 2>&1 > /dev/null | tail -n 20". We need to be smart about minimizing token usage during testing!
|
|
61401
|
+
|
|
61399
61402
|
`;
|
|
61400
61403
|
|
|
61401
61404
|
// node_modules/aieo/node_modules/zod/v4/classic/external.js
|
|
@@ -120919,113 +120922,173 @@ function createProcessError(message, exitCode, stderr, metadata) {
|
|
|
120919
120922
|
});
|
|
120920
120923
|
}
|
|
120921
120924
|
function shouldIncludeForAudience(item, audience) {
|
|
120922
|
-
|
|
120925
|
+
try {
|
|
120926
|
+
if (!item?.annotations?.audience || !Array.isArray(item.annotations.audience)) {
|
|
120927
|
+
return true;
|
|
120928
|
+
}
|
|
120929
|
+
return item.annotations.audience.includes(audience);
|
|
120930
|
+
} catch {
|
|
120923
120931
|
return true;
|
|
120924
120932
|
}
|
|
120925
|
-
return item.annotations.audience.includes(audience);
|
|
120926
120933
|
}
|
|
120927
120934
|
function extractToolResultText(content, audience) {
|
|
120928
|
-
|
|
120929
|
-
|
|
120930
|
-
|
|
120931
|
-
|
|
120932
|
-
|
|
120935
|
+
if (!content || !Array.isArray(content)) {
|
|
120936
|
+
return "";
|
|
120937
|
+
}
|
|
120938
|
+
return content.filter((c) => c && typeof c === "object" && shouldIncludeForAudience(c, audience)).map((c) => {
|
|
120939
|
+
try {
|
|
120940
|
+
if (c.type === "text" && c.text) {
|
|
120941
|
+
return c.text;
|
|
120942
|
+
} else if (c.type === "resource" && c.resource?.text) {
|
|
120943
|
+
return c.resource.text;
|
|
120944
|
+
}
|
|
120945
|
+
return JSON.stringify(c);
|
|
120946
|
+
} catch {
|
|
120947
|
+
return "";
|
|
120933
120948
|
}
|
|
120934
|
-
return JSON.stringify(c);
|
|
120935
120949
|
}).join("\n");
|
|
120936
120950
|
}
|
|
120937
120951
|
function convertTextContent(content) {
|
|
120938
120952
|
return {
|
|
120939
120953
|
type: "text",
|
|
120940
|
-
text: content
|
|
120954
|
+
text: content?.text ?? ""
|
|
120941
120955
|
};
|
|
120942
120956
|
}
|
|
120943
120957
|
function convertToolRequest(content) {
|
|
120944
|
-
|
|
120945
|
-
|
|
120946
|
-
|
|
120947
|
-
|
|
120948
|
-
|
|
120949
|
-
|
|
120958
|
+
try {
|
|
120959
|
+
return {
|
|
120960
|
+
type: "tool-call",
|
|
120961
|
+
toolCallId: content?.id || generateId3(),
|
|
120962
|
+
toolName: content?.toolCall?.value?.name ?? "unknown",
|
|
120963
|
+
input: content?.toolCall?.value?.arguments ?? {}
|
|
120964
|
+
};
|
|
120965
|
+
} catch {
|
|
120966
|
+
return null;
|
|
120967
|
+
}
|
|
120950
120968
|
}
|
|
120951
120969
|
function convertToolResponse(content, audience) {
|
|
120952
|
-
|
|
120953
|
-
|
|
120954
|
-
|
|
120955
|
-
|
|
120956
|
-
|
|
120957
|
-
|
|
120958
|
-
|
|
120959
|
-
|
|
120960
|
-
|
|
120961
|
-
|
|
120962
|
-
|
|
120970
|
+
try {
|
|
120971
|
+
const resultText = extractToolResultText(content?.toolResult?.value?.content, audience);
|
|
120972
|
+
return {
|
|
120973
|
+
type: "tool-result",
|
|
120974
|
+
toolCallId: content?.id || generateId3(),
|
|
120975
|
+
toolName: "unknown",
|
|
120976
|
+
// Goose doesn't include tool name in response
|
|
120977
|
+
output: {
|
|
120978
|
+
type: "text",
|
|
120979
|
+
value: resultText
|
|
120980
|
+
}
|
|
120981
|
+
};
|
|
120982
|
+
} catch {
|
|
120983
|
+
return null;
|
|
120984
|
+
}
|
|
120963
120985
|
}
|
|
120964
120986
|
function convertAssistantMessage(message, audience) {
|
|
120965
|
-
|
|
120966
|
-
|
|
120967
|
-
if (!
|
|
120968
|
-
|
|
120987
|
+
try {
|
|
120988
|
+
const content = [];
|
|
120989
|
+
if (!message?.content || !Array.isArray(message.content)) {
|
|
120990
|
+
return null;
|
|
120991
|
+
}
|
|
120992
|
+
for (const item of message.content) {
|
|
120993
|
+
if (!item || typeof item !== "object") {
|
|
120994
|
+
continue;
|
|
120995
|
+
}
|
|
120996
|
+
if (!shouldIncludeForAudience(item, audience)) {
|
|
120997
|
+
continue;
|
|
120998
|
+
}
|
|
120999
|
+
if (item.type === "text" && "text" in item && item.text) {
|
|
121000
|
+
content.push(convertTextContent(item));
|
|
121001
|
+
} else if (item.type === "toolRequest" && "toolCall" in item) {
|
|
121002
|
+
const toolCall = convertToolRequest(item);
|
|
121003
|
+
if (toolCall) {
|
|
121004
|
+
content.push(toolCall);
|
|
121005
|
+
}
|
|
121006
|
+
}
|
|
120969
121007
|
}
|
|
120970
|
-
if (
|
|
120971
|
-
|
|
120972
|
-
} else if (item.type === "toolRequest" && "toolCall" in item) {
|
|
120973
|
-
content.push(convertToolRequest(item));
|
|
121008
|
+
if (content.length === 0) {
|
|
121009
|
+
return null;
|
|
120974
121010
|
}
|
|
120975
|
-
|
|
120976
|
-
|
|
121011
|
+
return {
|
|
121012
|
+
role: "assistant",
|
|
121013
|
+
content
|
|
121014
|
+
};
|
|
121015
|
+
} catch {
|
|
120977
121016
|
return null;
|
|
120978
121017
|
}
|
|
120979
|
-
return {
|
|
120980
|
-
role: "assistant",
|
|
120981
|
-
content
|
|
120982
|
-
};
|
|
120983
121018
|
}
|
|
120984
121019
|
function convertUserMessage(message, audience) {
|
|
120985
|
-
|
|
120986
|
-
|
|
120987
|
-
|
|
120988
|
-
|
|
120989
|
-
if (!
|
|
120990
|
-
|
|
121020
|
+
try {
|
|
121021
|
+
const messages = [];
|
|
121022
|
+
const textParts = [];
|
|
121023
|
+
const toolResults = [];
|
|
121024
|
+
if (!message?.content || !Array.isArray(message.content)) {
|
|
121025
|
+
return [];
|
|
120991
121026
|
}
|
|
120992
|
-
|
|
120993
|
-
|
|
120994
|
-
|
|
120995
|
-
|
|
121027
|
+
for (const item of message.content) {
|
|
121028
|
+
if (!item || typeof item !== "object") {
|
|
121029
|
+
continue;
|
|
121030
|
+
}
|
|
121031
|
+
if (!shouldIncludeForAudience(item, audience)) {
|
|
121032
|
+
continue;
|
|
121033
|
+
}
|
|
121034
|
+
if (item.type === "text" && "text" in item && item.text) {
|
|
121035
|
+
textParts.push(convertTextContent(item));
|
|
121036
|
+
} else if (item.type === "toolResponse" && "toolResult" in item) {
|
|
121037
|
+
const result = convertToolResponse(item, audience);
|
|
121038
|
+
if (result) {
|
|
121039
|
+
toolResults.push(result);
|
|
121040
|
+
}
|
|
121041
|
+
}
|
|
120996
121042
|
}
|
|
121043
|
+
if (textParts.length > 0) {
|
|
121044
|
+
const userMessage = {
|
|
121045
|
+
role: "user",
|
|
121046
|
+
content: textParts
|
|
121047
|
+
};
|
|
121048
|
+
messages.push(userMessage);
|
|
121049
|
+
}
|
|
121050
|
+
if (toolResults.length > 0) {
|
|
121051
|
+
const toolMessage = {
|
|
121052
|
+
role: "tool",
|
|
121053
|
+
content: toolResults
|
|
121054
|
+
};
|
|
121055
|
+
messages.push(toolMessage);
|
|
121056
|
+
}
|
|
121057
|
+
return messages;
|
|
121058
|
+
} catch {
|
|
121059
|
+
return [];
|
|
120997
121060
|
}
|
|
120998
|
-
if (textParts.length > 0) {
|
|
120999
|
-
const userMessage = {
|
|
121000
|
-
role: "user",
|
|
121001
|
-
content: textParts
|
|
121002
|
-
};
|
|
121003
|
-
messages.push(userMessage);
|
|
121004
|
-
}
|
|
121005
|
-
if (toolResults.length > 0) {
|
|
121006
|
-
const toolMessage = {
|
|
121007
|
-
role: "tool",
|
|
121008
|
-
content: toolResults
|
|
121009
|
-
};
|
|
121010
|
-
messages.push(toolMessage);
|
|
121011
|
-
}
|
|
121012
|
-
return messages;
|
|
121013
121061
|
}
|
|
121014
121062
|
function convertGooseMessage(message, audience) {
|
|
121015
|
-
|
|
121016
|
-
|
|
121017
|
-
|
|
121018
|
-
|
|
121019
|
-
|
|
121063
|
+
try {
|
|
121064
|
+
if (!message || typeof message !== "object") {
|
|
121065
|
+
return [];
|
|
121066
|
+
}
|
|
121067
|
+
if (message.role === "assistant") {
|
|
121068
|
+
const converted = convertAssistantMessage(message, audience);
|
|
121069
|
+
return converted ? [converted] : [];
|
|
121070
|
+
} else if (message.role === "user") {
|
|
121071
|
+
return convertUserMessage(message, audience);
|
|
121072
|
+
}
|
|
121073
|
+
return [];
|
|
121074
|
+
} catch {
|
|
121075
|
+
return [];
|
|
121020
121076
|
}
|
|
121021
121077
|
}
|
|
121022
121078
|
function convertGooseMessages(messages, audience) {
|
|
121023
|
-
|
|
121024
|
-
|
|
121025
|
-
|
|
121026
|
-
|
|
121079
|
+
try {
|
|
121080
|
+
if (!messages || !Array.isArray(messages)) {
|
|
121081
|
+
return [];
|
|
121082
|
+
}
|
|
121083
|
+
const result = [];
|
|
121084
|
+
for (const message of messages) {
|
|
121085
|
+
const converted = convertGooseMessage(message, audience);
|
|
121086
|
+
result.push(...converted);
|
|
121087
|
+
}
|
|
121088
|
+
return result;
|
|
121089
|
+
} catch {
|
|
121090
|
+
return [];
|
|
121027
121091
|
}
|
|
121028
|
-
return result;
|
|
121029
121092
|
}
|
|
121030
121093
|
function parseModelId(modelId) {
|
|
121031
121094
|
const slashIndex = modelId.indexOf("/");
|
|
@@ -121493,7 +121556,7 @@ function exportSession(name40, audience = "user") {
|
|
|
121493
121556
|
encoding: "utf-8"
|
|
121494
121557
|
});
|
|
121495
121558
|
const session = JSON.parse(stdout);
|
|
121496
|
-
return convertGooseMessages(session
|
|
121559
|
+
return convertGooseMessages(session?.conversation ?? [], audience);
|
|
121497
121560
|
}
|
|
121498
121561
|
function sanitizeShellArg2(arg) {
|
|
121499
121562
|
return arg.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/`/g, "\\`").replace(/\$/g, "\\$").replace(/\n/g, " ").replace(/\r/g, "").replace(/!/g, "\\!");
|
package/dist/staklink-cli.cjs
CHANGED
|
@@ -10967,7 +10967,7 @@ var glob = Object.assign(glob_, {
|
|
|
10967
10967
|
glob.glob = glob;
|
|
10968
10968
|
|
|
10969
10969
|
// src/proxy/version.ts
|
|
10970
|
-
var VERSION = "0.3.
|
|
10970
|
+
var VERSION = "0.3.72";
|
|
10971
10971
|
|
|
10972
10972
|
// src/cli.ts
|
|
10973
10973
|
var STAKLINK_PROXY = "staklink-proxy";
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "staklink",
|
|
3
3
|
"displayName": "staklink",
|
|
4
4
|
"description": "staklink process manager",
|
|
5
|
-
"version": "0.3.
|
|
5
|
+
"version": "0.3.72",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"publisher": "stakwork",
|
|
8
8
|
"engines": {
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
"@ai-sdk/google": "^3.0.6",
|
|
119
119
|
"@types/jsonwebtoken": "^9.0.10",
|
|
120
120
|
"ai": "^6.0.26",
|
|
121
|
-
"ai-sdk-provider-goose": "^0.1.
|
|
121
|
+
"ai-sdk-provider-goose": "^0.1.10",
|
|
122
122
|
"aieo": "^0.1.29",
|
|
123
123
|
"async-mutex": "^0.5.0",
|
|
124
124
|
"commander": "^14.0.1",
|