staklink 0.3.67 → 0.3.68
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 +54 -15
- 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.68";
|
|
61233
61233
|
|
|
61234
61234
|
// node_modules/uuid/dist/esm/stringify.js
|
|
61235
61235
|
var byteToHex = [];
|
|
@@ -105427,14 +105427,32 @@ async function callModel(opts) {
|
|
|
105427
105427
|
// src/agent/summary.ts
|
|
105428
105428
|
var SYSTEM = `You are a software development expert. Your job is to summarize a software development session.`;
|
|
105429
105429
|
var makeSummaryPrompt = (sessionData) => {
|
|
105430
|
-
return `Please summarize the following software development
|
|
105430
|
+
return `Please summarize the following software development interaction:
|
|
105431
105431
|
|
|
105432
105432
|
${sessionData}
|
|
105433
105433
|
|
|
105434
|
-
Be sure to mention specific file names, or names of new functions, classes, components, data models, endpoints, or other code elements that were created or modified. For file names, use the full file path. In general, just make it easy for the user to understand what was done in
|
|
105434
|
+
Be sure to mention specific file names, or names of new functions, classes, components, data models, endpoints, or other code elements that were created or modified. For file names, use the full file path. In general, just make it easy for the user to understand what was done in this interaction.
|
|
105435
105435
|
`;
|
|
105436
105436
|
};
|
|
105437
|
+
function extractLastInteraction(messages) {
|
|
105438
|
+
if (!messages || messages.length === 0) {
|
|
105439
|
+
return [];
|
|
105440
|
+
}
|
|
105441
|
+
const result = [];
|
|
105442
|
+
let i = messages.length - 1;
|
|
105443
|
+
while (i >= 0 && (messages[i].role === "assistant" || messages[i].role === "tool")) {
|
|
105444
|
+
result.unshift(messages[i]);
|
|
105445
|
+
i--;
|
|
105446
|
+
}
|
|
105447
|
+
while (i >= 0 && messages[i].role === "user") {
|
|
105448
|
+
result.unshift(messages[i]);
|
|
105449
|
+
i--;
|
|
105450
|
+
}
|
|
105451
|
+
return result;
|
|
105452
|
+
}
|
|
105437
105453
|
async function summarizeSession(sessionData, apiKey) {
|
|
105454
|
+
const lastInteraction = extractLastInteraction(sessionData);
|
|
105455
|
+
const dataToSummarize = JSON.stringify(lastInteraction, null, 2);
|
|
105438
105456
|
const systemMessage = {
|
|
105439
105457
|
role: "system",
|
|
105440
105458
|
content: SYSTEM
|
|
@@ -105444,7 +105462,7 @@ async function summarizeSession(sessionData, apiKey) {
|
|
|
105444
105462
|
content: [
|
|
105445
105463
|
{
|
|
105446
105464
|
type: "text",
|
|
105447
|
-
text: makeSummaryPrompt(
|
|
105465
|
+
text: makeSummaryPrompt(dataToSummarize)
|
|
105448
105466
|
}
|
|
105449
105467
|
]
|
|
105450
105468
|
};
|
|
@@ -121495,7 +121513,7 @@ function goose_env(apiKey) {
|
|
|
121495
121513
|
PATH: `${path8.join(os.homedir(), ".local", "bin")}:${process.env.PATH}`
|
|
121496
121514
|
};
|
|
121497
121515
|
}
|
|
121498
|
-
async function runAgent({ prompt, apiKey, cwd, system_prompt, session,
|
|
121516
|
+
async function runAgent({ prompt, apiKey, cwd, system_prompt, session, summarize }) {
|
|
121499
121517
|
createGooseConfig();
|
|
121500
121518
|
const env = goose_env(apiKey);
|
|
121501
121519
|
console.log("RUN goose with env", env);
|
|
@@ -121509,15 +121527,17 @@ async function runAgent({ prompt, apiKey, cwd, system_prompt, session, resume, s
|
|
|
121509
121527
|
session = sanitizeShellArg(session);
|
|
121510
121528
|
session = session.replaceAll(" ", "_");
|
|
121511
121529
|
cmd += ` --name ${session}`;
|
|
121512
|
-
|
|
121513
|
-
|
|
121514
|
-
|
|
121530
|
+
try {
|
|
121531
|
+
exportSession(session, "assistant");
|
|
121532
|
+
cmd += ` --resume`;
|
|
121533
|
+
} catch {
|
|
121534
|
+
}
|
|
121515
121535
|
}
|
|
121516
121536
|
const res = await executeCommand(cmd, cwd, env, (l) => console.log(l));
|
|
121517
121537
|
const output = res.stdout;
|
|
121518
121538
|
if (summarize && session) {
|
|
121519
121539
|
const sessionData = exportSession(session, "assistant");
|
|
121520
|
-
const summary = await summarizeSession(
|
|
121540
|
+
const summary = await summarizeSession(sessionData, apiKey);
|
|
121521
121541
|
return { output, summary };
|
|
121522
121542
|
}
|
|
121523
121543
|
return output;
|
|
@@ -132795,7 +132815,13 @@ _a153 = symbol153;
|
|
|
132795
132815
|
|
|
132796
132816
|
// src/agent/goose-streaming.ts
|
|
132797
132817
|
async function streamGooseToSSE(sessionId, prompt, apiKey, res, options) {
|
|
132798
|
-
|
|
132818
|
+
let resume = false;
|
|
132819
|
+
try {
|
|
132820
|
+
exportSession(sessionId, "assistant");
|
|
132821
|
+
resume = true;
|
|
132822
|
+
} catch {
|
|
132823
|
+
}
|
|
132824
|
+
log("Streaming Goose to SSE", { sessionId, prompt, apiKey, resume });
|
|
132799
132825
|
createGooseConfig();
|
|
132800
132826
|
const textAccumulators = /* @__PURE__ */ new Map();
|
|
132801
132827
|
try {
|
|
@@ -132803,7 +132829,7 @@ async function streamGooseToSSE(sessionId, prompt, apiKey, res, options) {
|
|
|
132803
132829
|
model: goose("anthropic/claude-sonnet-4-5", {
|
|
132804
132830
|
sessionName: sessionId,
|
|
132805
132831
|
apiKey,
|
|
132806
|
-
resume
|
|
132832
|
+
resume
|
|
132807
132833
|
}),
|
|
132808
132834
|
prompt,
|
|
132809
132835
|
system: options?.system
|
|
@@ -134823,7 +134849,7 @@ ${diff.trim()}`);
|
|
|
134823
134849
|
res.status(401).json({ error: "Invalid or expired token" });
|
|
134824
134850
|
return;
|
|
134825
134851
|
}
|
|
134826
|
-
const { prompt, system
|
|
134852
|
+
const { prompt, system } = req.body;
|
|
134827
134853
|
if (!prompt) {
|
|
134828
134854
|
res.status(400).json({
|
|
134829
134855
|
error: "Missing required field: prompt"
|
|
@@ -134840,7 +134866,7 @@ ${diff.trim()}`);
|
|
|
134840
134866
|
prompt,
|
|
134841
134867
|
session.apiKey || process.env.ANTHROPIC_API_KEY || "",
|
|
134842
134868
|
res,
|
|
134843
|
-
{ system,
|
|
134869
|
+
{ system, webhookUrl: session.webhookUrl }
|
|
134844
134870
|
);
|
|
134845
134871
|
});
|
|
134846
134872
|
app.use(requireAuth);
|
|
@@ -134864,7 +134890,7 @@ ${diff.trim()}`);
|
|
|
134864
134890
|
return async (req, res) => {
|
|
134865
134891
|
const request_id = startReq();
|
|
134866
134892
|
try {
|
|
134867
|
-
const { repoName, apiKey, agent_name, session,
|
|
134893
|
+
const { repoName, apiKey, agent_name, session, summarize } = req.body;
|
|
134868
134894
|
const params = getParams(req);
|
|
134869
134895
|
const workspaceRoot2 = await workspaceRoot();
|
|
134870
134896
|
let repoPath = workspaceRoot2;
|
|
@@ -134885,7 +134911,6 @@ ${diff.trim()}`);
|
|
|
134885
134911
|
cwd: repoPath,
|
|
134886
134912
|
system_prompt: params.system,
|
|
134887
134913
|
session,
|
|
134888
|
-
resume: resume ? true : false,
|
|
134889
134914
|
summarize: summarize ? true : false
|
|
134890
134915
|
}).then((result) => {
|
|
134891
134916
|
const finalResult = transformResult ? transformResult(result) : result;
|
|
@@ -134903,6 +134928,20 @@ ${diff.trim()}`);
|
|
|
134903
134928
|
}
|
|
134904
134929
|
};
|
|
134905
134930
|
};
|
|
134931
|
+
app.post("/validate_session", async (req, res) => {
|
|
134932
|
+
log("===> POST /validate_session");
|
|
134933
|
+
const { session } = req.body;
|
|
134934
|
+
if (!session) {
|
|
134935
|
+
res.status(400).json({ error: "Missing required field: session" });
|
|
134936
|
+
return;
|
|
134937
|
+
}
|
|
134938
|
+
try {
|
|
134939
|
+
exportSession(session, "assistant");
|
|
134940
|
+
res.json({ exists: true });
|
|
134941
|
+
} catch (error87) {
|
|
134942
|
+
res.json({ exists: false });
|
|
134943
|
+
}
|
|
134944
|
+
});
|
|
134906
134945
|
app.post(
|
|
134907
134946
|
"/agent",
|
|
134908
134947
|
createAsyncAgentHandler((req) => ({
|
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.68";
|
|
10971
10971
|
|
|
10972
10972
|
// src/cli.ts
|
|
10973
10973
|
var STAKLINK_PROXY = "staklink-proxy";
|