staklink 0.3.76 → 0.3.78
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 +49 -8
- 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.78";
|
|
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
|
}
|
|
@@ -121547,13 +121562,17 @@ function sanitizeShellArg2(arg) {
|
|
|
121547
121562
|
}
|
|
121548
121563
|
|
|
121549
121564
|
// src/agent/goose.ts
|
|
121550
|
-
function goose_env(apiKey) {
|
|
121565
|
+
function goose_env(apiKey, model = "sonnet") {
|
|
121566
|
+
const models = {
|
|
121567
|
+
sonnet: "claude-sonnet-4-5",
|
|
121568
|
+
opus: "claude-opus-4-5"
|
|
121569
|
+
};
|
|
121551
121570
|
return {
|
|
121552
121571
|
GOOSE_CONTEXT_STRATEGY: "summarize",
|
|
121553
121572
|
GOOSE_MAX_TURNS: "2000",
|
|
121554
121573
|
GOOSE_MODE: "auto",
|
|
121555
121574
|
GOOSE_PROVIDER: "anthropic",
|
|
121556
|
-
GOOSE_MODEL:
|
|
121575
|
+
GOOSE_MODEL: models[model] || models.sonnet,
|
|
121557
121576
|
GOOSE_CLI_MIN_PRIORITY: "1.0",
|
|
121558
121577
|
CONFIGURE: "false",
|
|
121559
121578
|
ANTHROPIC_API_KEY: apiKey,
|
|
@@ -121566,10 +121585,11 @@ async function runAgent({
|
|
|
121566
121585
|
cwd,
|
|
121567
121586
|
system_prompt,
|
|
121568
121587
|
session,
|
|
121569
|
-
summarize
|
|
121588
|
+
summarize,
|
|
121589
|
+
model
|
|
121570
121590
|
}) {
|
|
121571
121591
|
createGooseConfig();
|
|
121572
|
-
const env = goose_env(apiKey);
|
|
121592
|
+
const env = goose_env(apiKey, model);
|
|
121573
121593
|
console.log("RUN goose with env", env);
|
|
121574
121594
|
const cleanPrompt = sanitizeShellArg(prompt);
|
|
121575
121595
|
let system = system_prompt ? sanitizeShellArg(system_prompt) + "\n\n" : "";
|
|
@@ -132883,6 +132903,7 @@ async function streamGooseToSSE(sessionId, prompt, apiKey, res, options) {
|
|
|
132883
132903
|
log("Streaming Goose to SSE", { sessionId, prompt, apiKey, resume });
|
|
132884
132904
|
createGooseConfig();
|
|
132885
132905
|
const textAccumulators = /* @__PURE__ */ new Map();
|
|
132906
|
+
let finishData = null;
|
|
132886
132907
|
try {
|
|
132887
132908
|
const result = streamText2({
|
|
132888
132909
|
model: goose("anthropic/claude-sonnet-4-5", {
|
|
@@ -132946,6 +132967,12 @@ async function streamGooseToSSE(sessionId, prompt, apiKey, res, options) {
|
|
|
132946
132967
|
(error87) => error("Error posting to webhook", error87)
|
|
132947
132968
|
);
|
|
132948
132969
|
break;
|
|
132970
|
+
case "finish":
|
|
132971
|
+
finishData = {
|
|
132972
|
+
finishReason: p.finishReason,
|
|
132973
|
+
totalUsage: p.totalUsage
|
|
132974
|
+
};
|
|
132975
|
+
break;
|
|
132949
132976
|
}
|
|
132950
132977
|
}
|
|
132951
132978
|
}
|
|
@@ -132953,6 +132980,18 @@ async function streamGooseToSSE(sessionId, prompt, apiKey, res, options) {
|
|
|
132953
132980
|
error("Streaming error:", error87);
|
|
132954
132981
|
sendSSE(res, "error", { type: "error", error: error87.message });
|
|
132955
132982
|
} finally {
|
|
132983
|
+
if (options?.webhookUrl) {
|
|
132984
|
+
postToWebhook(options.webhookUrl, {
|
|
132985
|
+
sessionId,
|
|
132986
|
+
type: "finish",
|
|
132987
|
+
timestamp: Date.now(),
|
|
132988
|
+
...finishData || {}
|
|
132989
|
+
}).catch((error87) => error("Error posting to webhook", error87));
|
|
132990
|
+
}
|
|
132991
|
+
sendSSE(res, "done", {
|
|
132992
|
+
type: "done",
|
|
132993
|
+
...finishData || {}
|
|
132994
|
+
});
|
|
132956
132995
|
res.end();
|
|
132957
132996
|
}
|
|
132958
132997
|
}
|
|
@@ -133058,7 +133097,7 @@ var createAsyncAgentHandler = (getParams, transformResult) => {
|
|
|
133058
133097
|
return async (req, res) => {
|
|
133059
133098
|
const request_id = startReq();
|
|
133060
133099
|
try {
|
|
133061
|
-
const { repoName, apiKey, agent_name, session, summarize } = req.body;
|
|
133100
|
+
const { repoName, apiKey, agent_name, session, summarize, model } = req.body;
|
|
133062
133101
|
const params = getParams(req);
|
|
133063
133102
|
const workspaceRoot2 = await workspaceRoot();
|
|
133064
133103
|
let repoPath = workspaceRoot2;
|
|
@@ -133079,7 +133118,8 @@ var createAsyncAgentHandler = (getParams, transformResult) => {
|
|
|
133079
133118
|
cwd: repoPath,
|
|
133080
133119
|
system_prompt: params.system,
|
|
133081
133120
|
session,
|
|
133082
|
-
summarize: summarize ? true : false
|
|
133121
|
+
summarize: summarize ? true : false,
|
|
133122
|
+
model
|
|
133083
133123
|
}).then((result) => {
|
|
133084
133124
|
const finalResult = transformResult ? transformResult(result) : result;
|
|
133085
133125
|
finishReq(request_id, {
|
|
@@ -133087,6 +133127,7 @@ var createAsyncAgentHandler = (getParams, transformResult) => {
|
|
|
133087
133127
|
result: finalResult
|
|
133088
133128
|
});
|
|
133089
133129
|
}).catch((error87) => {
|
|
133130
|
+
error("Agent error:", error87);
|
|
133090
133131
|
failReq(request_id, error87);
|
|
133091
133132
|
});
|
|
133092
133133
|
res.json({ request_id, status: "pending" });
|
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.78";
|
|
10971
10971
|
|
|
10972
10972
|
// src/cli.ts
|
|
10973
10973
|
var STAKLINK_PROXY = "staklink-proxy";
|