staklink 0.3.77 → 0.3.79
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 +50 -14
- package/dist/staklink-cli.cjs +1 -1
- package/package.json +1 -1
package/dist/proxy-server.cjs
CHANGED
|
@@ -61213,7 +61213,7 @@ var SSEManager = class {
|
|
|
61213
61213
|
var sseManager = new SSEManager();
|
|
61214
61214
|
|
|
61215
61215
|
// src/proxy/version.ts
|
|
61216
|
-
var VERSION = "0.3.
|
|
61216
|
+
var VERSION = "0.3.79";
|
|
61217
61217
|
|
|
61218
61218
|
// node_modules/uuid/dist/esm/stringify.js
|
|
61219
61219
|
var byteToHex = [];
|
|
@@ -61302,12 +61302,27 @@ function finishReq(id, result) {
|
|
|
61302
61302
|
function failReq(id, error87) {
|
|
61303
61303
|
if (REQS[id]) {
|
|
61304
61304
|
REQS[id].status = "failed";
|
|
61305
|
-
REQS[id].error = error87;
|
|
61305
|
+
REQS[id].error = serializeError(error87);
|
|
61306
61306
|
if (REQS[id].req_type) {
|
|
61307
61307
|
BUSY_REQ_TYPES.delete(REQS[id].req_type);
|
|
61308
61308
|
}
|
|
61309
61309
|
}
|
|
61310
61310
|
}
|
|
61311
|
+
function serializeError(error87) {
|
|
61312
|
+
if (error87 instanceof Error) {
|
|
61313
|
+
return {
|
|
61314
|
+
message: error87.message,
|
|
61315
|
+
name: error87.name,
|
|
61316
|
+
stack: error87.stack
|
|
61317
|
+
};
|
|
61318
|
+
}
|
|
61319
|
+
try {
|
|
61320
|
+
JSON.stringify(error87);
|
|
61321
|
+
return error87;
|
|
61322
|
+
} catch {
|
|
61323
|
+
return { message: String(error87) };
|
|
61324
|
+
}
|
|
61325
|
+
}
|
|
61311
61326
|
function checkReq(id) {
|
|
61312
61327
|
return REQS[id];
|
|
61313
61328
|
}
|
|
@@ -121571,9 +121586,10 @@ async function runAgent({
|
|
|
121571
121586
|
system_prompt,
|
|
121572
121587
|
session,
|
|
121573
121588
|
summarize,
|
|
121574
|
-
model
|
|
121589
|
+
model,
|
|
121590
|
+
searchApiKey
|
|
121575
121591
|
}) {
|
|
121576
|
-
createGooseConfig();
|
|
121592
|
+
createGooseConfig(searchApiKey);
|
|
121577
121593
|
const env = goose_env(apiKey, model);
|
|
121578
121594
|
console.log("RUN goose with env", env);
|
|
121579
121595
|
const cleanPrompt = sanitizeShellArg(prompt);
|
|
@@ -121592,6 +121608,9 @@ async function runAgent({
|
|
|
121592
121608
|
} catch {
|
|
121593
121609
|
}
|
|
121594
121610
|
}
|
|
121611
|
+
if (searchApiKey) {
|
|
121612
|
+
cmd += ` --with-streamable-http-extension "https://mcp.exa.ai/mcp?exaApiKey=${searchApiKey}"`;
|
|
121613
|
+
}
|
|
121595
121614
|
const res = await executeCommand(cmd, cwd, env, (l) => console.log(l));
|
|
121596
121615
|
const output = res.stdout;
|
|
121597
121616
|
if (summarize && session) {
|
|
@@ -121601,10 +121620,10 @@ async function runAgent({
|
|
|
121601
121620
|
}
|
|
121602
121621
|
return output;
|
|
121603
121622
|
}
|
|
121604
|
-
function createGooseConfig() {
|
|
121623
|
+
function createGooseConfig(exaApiKey) {
|
|
121605
121624
|
const configDir = path7.join(os.homedir(), ".config", "goose");
|
|
121606
121625
|
const configPath = path7.join(configDir, "config.yaml");
|
|
121607
|
-
|
|
121626
|
+
let configContent = `extensions:
|
|
121608
121627
|
extension_name:
|
|
121609
121628
|
bundled: true
|
|
121610
121629
|
display_name: "Dev"
|
|
@@ -121613,6 +121632,17 @@ function createGooseConfig() {
|
|
|
121613
121632
|
timeout: 300
|
|
121614
121633
|
type: "builtin"
|
|
121615
121634
|
`;
|
|
121635
|
+
if (exaApiKey) {
|
|
121636
|
+
configContent += `
|
|
121637
|
+
exa:
|
|
121638
|
+
enabled: true
|
|
121639
|
+
type: streamable_http
|
|
121640
|
+
name: exa
|
|
121641
|
+
description: "Search the web and github"
|
|
121642
|
+
uri: https://mcp.exa.ai/mcp?exaApiKey=2f23c2d5-9304-43e7-986f-e73596406e98
|
|
121643
|
+
timeout: 300
|
|
121644
|
+
`;
|
|
121645
|
+
}
|
|
121616
121646
|
try {
|
|
121617
121647
|
if (!fs8.existsSync(configDir)) {
|
|
121618
121648
|
fs8.mkdirSync(configDir, { recursive: true });
|
|
@@ -132886,7 +132916,7 @@ async function streamGooseToSSE(sessionId, prompt, apiKey, res, options) {
|
|
|
132886
132916
|
console.log("Session doesn't exist, don't resume");
|
|
132887
132917
|
}
|
|
132888
132918
|
log("Streaming Goose to SSE", { sessionId, prompt, apiKey, resume });
|
|
132889
|
-
createGooseConfig();
|
|
132919
|
+
createGooseConfig(options?.searchApiKey);
|
|
132890
132920
|
const textAccumulators = /* @__PURE__ */ new Map();
|
|
132891
132921
|
let finishData = null;
|
|
132892
132922
|
try {
|
|
@@ -133028,7 +133058,7 @@ var SESSIONS = /* @__PURE__ */ new Map();
|
|
|
133028
133058
|
function issueToken(sessionId) {
|
|
133029
133059
|
return jwt3.sign({ sessionId }, JWT_SECRET, { expiresIn: TOKEN_EXPIRY });
|
|
133030
133060
|
}
|
|
133031
|
-
function createSession(sessionId, webhookUrl, apiKey) {
|
|
133061
|
+
function createSession(sessionId, webhookUrl, apiKey, searchApiKey) {
|
|
133032
133062
|
const now3 = Date.now();
|
|
133033
133063
|
const existing = SESSIONS.get(sessionId);
|
|
133034
133064
|
if (existing) {
|
|
@@ -133039,6 +133069,9 @@ function createSession(sessionId, webhookUrl, apiKey) {
|
|
|
133039
133069
|
if (apiKey !== void 0) {
|
|
133040
133070
|
existing.apiKey = apiKey;
|
|
133041
133071
|
}
|
|
133072
|
+
if (searchApiKey !== void 0) {
|
|
133073
|
+
existing.searchApiKey = searchApiKey;
|
|
133074
|
+
}
|
|
133042
133075
|
return { token: issueToken(sessionId), created: false };
|
|
133043
133076
|
}
|
|
133044
133077
|
SESSIONS.set(sessionId, {
|
|
@@ -133046,7 +133079,8 @@ function createSession(sessionId, webhookUrl, apiKey) {
|
|
|
133046
133079
|
createdAt: now3,
|
|
133047
133080
|
lastActivity: now3,
|
|
133048
133081
|
webhookUrl,
|
|
133049
|
-
apiKey
|
|
133082
|
+
apiKey,
|
|
133083
|
+
searchApiKey
|
|
133050
133084
|
});
|
|
133051
133085
|
return { token: issueToken(sessionId), created: true };
|
|
133052
133086
|
}
|
|
@@ -133082,7 +133116,7 @@ var createAsyncAgentHandler = (getParams, transformResult) => {
|
|
|
133082
133116
|
return async (req, res) => {
|
|
133083
133117
|
const request_id = startReq();
|
|
133084
133118
|
try {
|
|
133085
|
-
const { repoName, apiKey, agent_name, session, summarize, model } = req.body;
|
|
133119
|
+
const { repoName, apiKey, agent_name, session, summarize, model, searchApiKey } = req.body;
|
|
133086
133120
|
const params = getParams(req);
|
|
133087
133121
|
const workspaceRoot2 = await workspaceRoot();
|
|
133088
133122
|
let repoPath = workspaceRoot2;
|
|
@@ -133104,7 +133138,8 @@ var createAsyncAgentHandler = (getParams, transformResult) => {
|
|
|
133104
133138
|
system_prompt: params.system,
|
|
133105
133139
|
session,
|
|
133106
133140
|
summarize: summarize ? true : false,
|
|
133107
|
-
model
|
|
133141
|
+
model,
|
|
133142
|
+
searchApiKey
|
|
133108
133143
|
}).then((result) => {
|
|
133109
133144
|
const finalResult = transformResult ? transformResult(result) : result;
|
|
133110
133145
|
finishReq(request_id, {
|
|
@@ -133112,6 +133147,7 @@ var createAsyncAgentHandler = (getParams, transformResult) => {
|
|
|
133112
133147
|
result: finalResult
|
|
133113
133148
|
});
|
|
133114
133149
|
}).catch((error87) => {
|
|
133150
|
+
error("Agent error:", error87);
|
|
133115
133151
|
failReq(request_id, error87);
|
|
133116
133152
|
});
|
|
133117
133153
|
res.json({ request_id, status: "pending" });
|
|
@@ -135218,20 +135254,20 @@ async function startProxyServer() {
|
|
|
135218
135254
|
prompt,
|
|
135219
135255
|
session.apiKey || process.env.ANTHROPIC_API_KEY || "",
|
|
135220
135256
|
res,
|
|
135221
|
-
{ system, webhookUrl: session.webhookUrl }
|
|
135257
|
+
{ system, webhookUrl: session.webhookUrl, searchApiKey: session.searchApiKey }
|
|
135222
135258
|
);
|
|
135223
135259
|
clearInterval(keepAliveInterval);
|
|
135224
135260
|
});
|
|
135225
135261
|
app.use(requireAuth);
|
|
135226
135262
|
app.post("/session", async (req, res) => {
|
|
135227
|
-
const { sessionId, webhookUrl, apiKey } = req.body;
|
|
135263
|
+
const { sessionId, webhookUrl, apiKey, searchApiKey } = req.body;
|
|
135228
135264
|
if (!sessionId) {
|
|
135229
135265
|
res.status(400).json({
|
|
135230
135266
|
error: "Missing required fields: sessionId, webhookUrl"
|
|
135231
135267
|
});
|
|
135232
135268
|
return;
|
|
135233
135269
|
}
|
|
135234
|
-
const { token, created } = createSession(sessionId, webhookUrl, apiKey);
|
|
135270
|
+
const { token, created } = createSession(sessionId, webhookUrl, apiKey, searchApiKey);
|
|
135235
135271
|
res.json({
|
|
135236
135272
|
sessionId,
|
|
135237
135273
|
token,
|
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.79";
|
|
10971
10971
|
|
|
10972
10972
|
// src/cli.ts
|
|
10973
10973
|
var STAKLINK_PROXY = "staklink-proxy";
|