staklink 0.3.62 → 0.3.63
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 +14 -10
- package/dist/staklink-cli.cjs +1 -1
- package/package.json +1 -1
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.63";
|
|
61233
61233
|
|
|
61234
61234
|
// node_modules/uuid/dist/esm/stringify.js
|
|
61235
61235
|
var byteToHex = [];
|
|
@@ -132792,7 +132792,7 @@ async function streamGooseToSSE(sessionId, prompt, apiKey, res, options) {
|
|
|
132792
132792
|
try {
|
|
132793
132793
|
const result = streamText2({
|
|
132794
132794
|
model: goose("anthropic/claude-sonnet-4-5", {
|
|
132795
|
-
sessionName:
|
|
132795
|
+
sessionName: sessionId,
|
|
132796
132796
|
apiKey,
|
|
132797
132797
|
resume: options?.resume
|
|
132798
132798
|
}),
|
|
@@ -132891,7 +132891,7 @@ var SESSIONS = /* @__PURE__ */ new Map();
|
|
|
132891
132891
|
function issueToken(sessionId) {
|
|
132892
132892
|
return jwt3.sign({ sessionId }, JWT_SECRET, { expiresIn: TOKEN_EXPIRY });
|
|
132893
132893
|
}
|
|
132894
|
-
function createSession(sessionId, webhookUrl) {
|
|
132894
|
+
function createSession(sessionId, webhookUrl, apiKey) {
|
|
132895
132895
|
const now3 = Date.now();
|
|
132896
132896
|
const existing = SESSIONS.get(sessionId);
|
|
132897
132897
|
if (existing) {
|
|
@@ -132899,13 +132899,17 @@ function createSession(sessionId, webhookUrl) {
|
|
|
132899
132899
|
if (webhookUrl !== void 0) {
|
|
132900
132900
|
existing.webhookUrl = webhookUrl;
|
|
132901
132901
|
}
|
|
132902
|
+
if (apiKey !== void 0) {
|
|
132903
|
+
existing.apiKey = apiKey;
|
|
132904
|
+
}
|
|
132902
132905
|
return { token: issueToken(sessionId), created: false };
|
|
132903
132906
|
}
|
|
132904
132907
|
SESSIONS.set(sessionId, {
|
|
132905
132908
|
sessionId,
|
|
132906
132909
|
createdAt: now3,
|
|
132907
132910
|
lastActivity: now3,
|
|
132908
|
-
webhookUrl
|
|
132911
|
+
webhookUrl,
|
|
132912
|
+
apiKey
|
|
132909
132913
|
});
|
|
132910
132914
|
return { token: issueToken(sessionId), created: true };
|
|
132911
132915
|
}
|
|
@@ -134809,10 +134813,10 @@ ${diff.trim()}`);
|
|
|
134809
134813
|
res.status(401).json({ error: "Invalid or expired token" });
|
|
134810
134814
|
return;
|
|
134811
134815
|
}
|
|
134812
|
-
const { prompt,
|
|
134816
|
+
const { prompt, system, resume } = req.body;
|
|
134813
134817
|
if (!prompt) {
|
|
134814
134818
|
res.status(400).json({
|
|
134815
|
-
error: "Missing required
|
|
134819
|
+
error: "Missing required field: prompt"
|
|
134816
134820
|
});
|
|
134817
134821
|
return;
|
|
134818
134822
|
}
|
|
@@ -134824,21 +134828,21 @@ ${diff.trim()}`);
|
|
|
134824
134828
|
await streamGooseToSSE(
|
|
134825
134829
|
sessionId,
|
|
134826
134830
|
prompt,
|
|
134827
|
-
apiKey || process.env.ANTHROPIC_API_KEY || "",
|
|
134831
|
+
session.apiKey || process.env.ANTHROPIC_API_KEY || "",
|
|
134828
134832
|
res,
|
|
134829
|
-
{ system,
|
|
134833
|
+
{ system, resume, webhookUrl: session.webhookUrl }
|
|
134830
134834
|
);
|
|
134831
134835
|
});
|
|
134832
134836
|
app.use(requireAuth);
|
|
134833
134837
|
app.post("/session", async (req, res) => {
|
|
134834
|
-
const { sessionId, webhookUrl } = req.body;
|
|
134838
|
+
const { sessionId, webhookUrl, apiKey } = req.body;
|
|
134835
134839
|
if (!sessionId) {
|
|
134836
134840
|
res.status(400).json({
|
|
134837
134841
|
error: "Missing required fields: sessionId, webhookUrl"
|
|
134838
134842
|
});
|
|
134839
134843
|
return;
|
|
134840
134844
|
}
|
|
134841
|
-
const { token, created } = createSession(sessionId, webhookUrl);
|
|
134845
|
+
const { token, created } = createSession(sessionId, webhookUrl, apiKey);
|
|
134842
134846
|
res.json({
|
|
134843
134847
|
sessionId,
|
|
134844
134848
|
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.63";
|
|
10971
10971
|
|
|
10972
10972
|
// src/cli.ts
|
|
10973
10973
|
var STAKLINK_PROXY = "staklink-proxy";
|