staklink 0.3.57 → 0.3.58
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/README.md +0 -2
- package/dist/proxy-server.cjs +187 -79
- package/dist/staklink-cli.cjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/proxy-server.cjs
CHANGED
|
@@ -56958,7 +56958,7 @@ var SSEManager = class {
|
|
|
56958
56958
|
var sseManager = new SSEManager();
|
|
56959
56959
|
|
|
56960
56960
|
// src/proxy/version.ts
|
|
56961
|
-
var VERSION = "0.3.
|
|
56961
|
+
var VERSION = "0.3.58";
|
|
56962
56962
|
|
|
56963
56963
|
// node_modules/uuid/dist/esm/stringify.js
|
|
56964
56964
|
var byteToHex = [];
|
|
@@ -57127,81 +57127,52 @@ Don't try to write summaries or docs in .md file unless specifically asked to! D
|
|
|
57127
57127
|
Do not make branch / PR if not specifically asked to.
|
|
57128
57128
|
`;
|
|
57129
57129
|
|
|
57130
|
-
// src/agent/
|
|
57131
|
-
function
|
|
57132
|
-
|
|
57133
|
-
|
|
57134
|
-
|
|
57135
|
-
|
|
57136
|
-
|
|
57137
|
-
GOOSE_MODEL: "claude-sonnet-4-5",
|
|
57138
|
-
GOOSE_CLI_MIN_PRIORITY: "1.0",
|
|
57139
|
-
CONFIGURE: "false",
|
|
57140
|
-
ANTHROPIC_API_KEY: apiKey,
|
|
57141
|
-
PATH: `${path8.join(os.homedir(), ".local", "bin")}:${process.env.PATH}`
|
|
57142
|
-
};
|
|
57130
|
+
// src/agent/session.ts
|
|
57131
|
+
async function exportSession(name17) {
|
|
57132
|
+
const safeName = sanitizeShellArg(name17);
|
|
57133
|
+
const cmd = `goose session export --name ${safeName} --format json`;
|
|
57134
|
+
const res = await executeCommand(cmd, process.cwd(), {});
|
|
57135
|
+
const session = JSON.parse(res.stdout);
|
|
57136
|
+
return JSON.stringify(filterConversationForAssistant(session.conversation), null, 2);
|
|
57143
57137
|
}
|
|
57144
|
-
|
|
57145
|
-
|
|
57146
|
-
|
|
57147
|
-
const cleanPrompt = sanitizeShellArg(prompt);
|
|
57148
|
-
let system = system_prompt ? sanitizeShellArg(system_prompt) + "\n\n" : "";
|
|
57149
|
-
system += SYSTEM_SUFFIX;
|
|
57150
|
-
system = sanitizeShellArg(system);
|
|
57151
|
-
console.log("Using Goose CLI", cleanPrompt, system);
|
|
57152
|
-
let cmd = `goose run --with-builtin developer -t "${cleanPrompt}" --system "${system}"`;
|
|
57153
|
-
if (session) {
|
|
57154
|
-
session = sanitizeShellArg(session);
|
|
57155
|
-
session = session.replaceAll(" ", "_");
|
|
57156
|
-
cmd += ` --name ${session}`;
|
|
57138
|
+
function shouldIncludeForAssistant(item) {
|
|
57139
|
+
if (!item.annotations) {
|
|
57140
|
+
return true;
|
|
57157
57141
|
}
|
|
57158
|
-
|
|
57159
|
-
|
|
57160
|
-
}
|
|
57161
|
-
function createGooseConfig() {
|
|
57162
|
-
const configDir = path8.join(os.homedir(), ".config", "goose");
|
|
57163
|
-
const configPath = path8.join(configDir, "config.yaml");
|
|
57164
|
-
const configContent = `extensions:
|
|
57165
|
-
extension_name:
|
|
57166
|
-
bundled: true
|
|
57167
|
-
display_name: "Dev"
|
|
57168
|
-
enabled: true
|
|
57169
|
-
name: "developer"
|
|
57170
|
-
timeout: 300
|
|
57171
|
-
type: "builtin"
|
|
57172
|
-
`;
|
|
57173
|
-
try {
|
|
57174
|
-
if (!fs9.existsSync(configDir)) {
|
|
57175
|
-
fs9.mkdirSync(configDir, { recursive: true });
|
|
57176
|
-
}
|
|
57177
|
-
fs9.writeFileSync(configPath, configContent, "utf-8");
|
|
57178
|
-
console.log(`Created goose config at ${configPath}`);
|
|
57179
|
-
} catch (error86) {
|
|
57180
|
-
console.warn("Error creating goose config:", error86);
|
|
57142
|
+
if (!item.annotations.audience) {
|
|
57143
|
+
return true;
|
|
57181
57144
|
}
|
|
57145
|
+
return item.annotations.audience.includes("assistant");
|
|
57182
57146
|
}
|
|
57183
|
-
|
|
57184
|
-
|
|
57185
|
-
|
|
57186
|
-
|
|
57187
|
-
|
|
57188
|
-
|
|
57189
|
-
|
|
57190
|
-
|
|
57191
|
-
|
|
57147
|
+
function filterContentForAssistant(content) {
|
|
57148
|
+
return content.filter(shouldIncludeForAssistant).map((item) => {
|
|
57149
|
+
if (item.type === "toolResponse" && item.toolResult?.value?.content) {
|
|
57150
|
+
return {
|
|
57151
|
+
...item,
|
|
57152
|
+
toolResult: {
|
|
57153
|
+
...item.toolResult,
|
|
57154
|
+
value: {
|
|
57155
|
+
...item.toolResult.value,
|
|
57156
|
+
content: item.toolResult.value.content.filter(shouldIncludeForAssistant)
|
|
57157
|
+
}
|
|
57158
|
+
}
|
|
57159
|
+
};
|
|
57192
57160
|
}
|
|
57193
|
-
|
|
57194
|
-
|
|
57195
|
-
|
|
57196
|
-
|
|
57197
|
-
|
|
57198
|
-
|
|
57199
|
-
|
|
57200
|
-
|
|
57201
|
-
|
|
57202
|
-
|
|
57203
|
-
|
|
57204
|
-
|
|
57161
|
+
return item;
|
|
57162
|
+
});
|
|
57163
|
+
}
|
|
57164
|
+
function filterMessagesForAssistant(messages) {
|
|
57165
|
+
return messages.map((message) => ({
|
|
57166
|
+
...message,
|
|
57167
|
+
content: filterContentForAssistant(message.content)
|
|
57168
|
+
}));
|
|
57169
|
+
}
|
|
57170
|
+
function removeEmptyMessages(messages) {
|
|
57171
|
+
return messages.filter((message) => message.content.length > 0);
|
|
57172
|
+
}
|
|
57173
|
+
function filterConversationForAssistant(messages, removeEmpty = true) {
|
|
57174
|
+
const filtered = filterMessagesForAssistant(messages);
|
|
57175
|
+
return removeEmpty ? removeEmptyMessages(filtered) : filtered;
|
|
57205
57176
|
}
|
|
57206
57177
|
|
|
57207
57178
|
// node_modules/aieo/node_modules/zod/v4/classic/external.js
|
|
@@ -111119,9 +111090,129 @@ async function callModel(opts) {
|
|
|
111119
111090
|
};
|
|
111120
111091
|
}
|
|
111121
111092
|
|
|
111093
|
+
// src/agent/summary.ts
|
|
111094
|
+
var SYSTEM = `You are a software development expert. Your job is to summarize a software development session.`;
|
|
111095
|
+
var makeSummaryPrompt = (sessionData) => {
|
|
111096
|
+
return `Please summarize the following software development session:
|
|
111097
|
+
|
|
111098
|
+
${sessionData}
|
|
111099
|
+
|
|
111100
|
+
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 the session.
|
|
111101
|
+
`;
|
|
111102
|
+
};
|
|
111103
|
+
async function summarizeSession(sessionData, apiKey) {
|
|
111104
|
+
const systemMessage = {
|
|
111105
|
+
role: "system",
|
|
111106
|
+
content: SYSTEM
|
|
111107
|
+
};
|
|
111108
|
+
const userMessage = {
|
|
111109
|
+
role: "user",
|
|
111110
|
+
content: [
|
|
111111
|
+
{
|
|
111112
|
+
type: "text",
|
|
111113
|
+
text: makeSummaryPrompt(sessionData)
|
|
111114
|
+
}
|
|
111115
|
+
]
|
|
111116
|
+
};
|
|
111117
|
+
const messages = [systemMessage, userMessage];
|
|
111118
|
+
const res = await callModel({
|
|
111119
|
+
provider: "anthropic",
|
|
111120
|
+
apiKey,
|
|
111121
|
+
messages,
|
|
111122
|
+
thinkingSpeed: "fast"
|
|
111123
|
+
});
|
|
111124
|
+
return res.text;
|
|
111125
|
+
}
|
|
111126
|
+
|
|
111127
|
+
// src/agent/goose.ts
|
|
111128
|
+
function goose_env(apiKey) {
|
|
111129
|
+
return {
|
|
111130
|
+
GOOSE_CONTEXT_STRATEGY: "summarize",
|
|
111131
|
+
GOOSE_MAX_TURNS: "2000",
|
|
111132
|
+
GOOSE_MODE: "auto",
|
|
111133
|
+
GOOSE_PROVIDER: "anthropic",
|
|
111134
|
+
GOOSE_MODEL: "claude-sonnet-4-5",
|
|
111135
|
+
GOOSE_CLI_MIN_PRIORITY: "1.0",
|
|
111136
|
+
CONFIGURE: "false",
|
|
111137
|
+
ANTHROPIC_API_KEY: apiKey,
|
|
111138
|
+
PATH: `${path8.join(os.homedir(), ".local", "bin")}:${process.env.PATH}`
|
|
111139
|
+
};
|
|
111140
|
+
}
|
|
111141
|
+
async function runAgent({ prompt, apiKey, cwd, system_prompt, session, resume, summarize }) {
|
|
111142
|
+
const env = goose_env(apiKey);
|
|
111143
|
+
console.log("RUN goose with env", env);
|
|
111144
|
+
const cleanPrompt = sanitizeShellArg(prompt);
|
|
111145
|
+
let system = system_prompt ? sanitizeShellArg(system_prompt) + "\n\n" : "";
|
|
111146
|
+
system += SYSTEM_SUFFIX;
|
|
111147
|
+
system = sanitizeShellArg(system);
|
|
111148
|
+
console.log("Using Goose CLI", cleanPrompt, system);
|
|
111149
|
+
let cmd = `goose run --with-builtin developer -t "${cleanPrompt}" --system "${system}"`;
|
|
111150
|
+
if (session) {
|
|
111151
|
+
session = sanitizeShellArg(session);
|
|
111152
|
+
session = session.replaceAll(" ", "_");
|
|
111153
|
+
cmd += ` --name ${session}`;
|
|
111154
|
+
}
|
|
111155
|
+
if (resume) {
|
|
111156
|
+
cmd += ` --resume`;
|
|
111157
|
+
}
|
|
111158
|
+
const res = await executeCommand(cmd, cwd, env, (l) => console.log(l));
|
|
111159
|
+
const output = res.stdout;
|
|
111160
|
+
if (summarize && session) {
|
|
111161
|
+
const sessionData = await exportSession(session);
|
|
111162
|
+
const summary = await summarizeSession(sessionData, apiKey);
|
|
111163
|
+
return { output, summary };
|
|
111164
|
+
}
|
|
111165
|
+
return output;
|
|
111166
|
+
}
|
|
111167
|
+
function createGooseConfig() {
|
|
111168
|
+
const configDir = path8.join(os.homedir(), ".config", "goose");
|
|
111169
|
+
const configPath = path8.join(configDir, "config.yaml");
|
|
111170
|
+
const configContent = `extensions:
|
|
111171
|
+
extension_name:
|
|
111172
|
+
bundled: true
|
|
111173
|
+
display_name: "Dev"
|
|
111174
|
+
enabled: true
|
|
111175
|
+
name: "developer"
|
|
111176
|
+
timeout: 300
|
|
111177
|
+
type: "builtin"
|
|
111178
|
+
`;
|
|
111179
|
+
try {
|
|
111180
|
+
if (!fs9.existsSync(configDir)) {
|
|
111181
|
+
fs9.mkdirSync(configDir, { recursive: true });
|
|
111182
|
+
}
|
|
111183
|
+
fs9.writeFileSync(configPath, configContent, "utf-8");
|
|
111184
|
+
console.log(`Created goose config at ${configPath}`);
|
|
111185
|
+
} catch (error86) {
|
|
111186
|
+
console.warn("Error creating goose config:", error86);
|
|
111187
|
+
}
|
|
111188
|
+
}
|
|
111189
|
+
async function runGooseWeb(apiKey, cwd, port) {
|
|
111190
|
+
try {
|
|
111191
|
+
createGooseConfig();
|
|
111192
|
+
const env = goose_env(apiKey);
|
|
111193
|
+
const runner = new Runner(cwd, () => {
|
|
111194
|
+
});
|
|
111195
|
+
try {
|
|
111196
|
+
await runner.stopAndDeleteProcess("goose");
|
|
111197
|
+
} catch (error86) {
|
|
111198
|
+
}
|
|
111199
|
+
await runner.startSingleProcess({
|
|
111200
|
+
name: "goose",
|
|
111201
|
+
script: "goose",
|
|
111202
|
+
args: `web --host 0.0.0.0 --port ${port}`,
|
|
111203
|
+
cwd,
|
|
111204
|
+
instances: 1,
|
|
111205
|
+
autorestart: true,
|
|
111206
|
+
env
|
|
111207
|
+
});
|
|
111208
|
+
} catch (error86) {
|
|
111209
|
+
console.error("Error occurred while starting Goose:", error86);
|
|
111210
|
+
}
|
|
111211
|
+
}
|
|
111212
|
+
|
|
111122
111213
|
// src/agent/claude_code.ts
|
|
111123
111214
|
var import_child_process = require("child_process");
|
|
111124
|
-
async function runAgent2(prompt, apiKey, cwd) {
|
|
111215
|
+
async function runAgent2({ prompt, apiKey, cwd }) {
|
|
111125
111216
|
if (!apiKey) {
|
|
111126
111217
|
throw new Error("Missing ANTHROPIC_API_KEY");
|
|
111127
111218
|
}
|
|
@@ -111172,11 +111263,11 @@ function findClaudePath() {
|
|
|
111172
111263
|
// src/agent/repair.ts
|
|
111173
111264
|
var repair_exports = {};
|
|
111174
111265
|
__export(repair_exports, {
|
|
111175
|
-
SYSTEM: () =>
|
|
111266
|
+
SYSTEM: () => SYSTEM2,
|
|
111176
111267
|
makeRepairPrompt: () => makeRepairPrompt,
|
|
111177
111268
|
parseXML: () => parseXML
|
|
111178
111269
|
});
|
|
111179
|
-
var
|
|
111270
|
+
var SYSTEM2 = `You are a software systems expert. Your job is to help set up the development environment for a software project. Fix the user's pm2 config and/or docker-compose files, and use the pm2 and docker cli to get the project running. YOUR GOAL IS TO THE GET THE frontend APP IN THE PM2 CONFIG FILE TO RUN CORRECTLY! Other apps and docker containers are only supporting services. You can restart the pm2 environment with "npx -y staklink reload" after making changes to the pm2 config or docker-compose files.
|
|
111180
111271
|
|
|
111181
111272
|
When you have gotten the frontend running, or gotten as far as you can, respond to the user by saying either "<status>COMPLETE</status>" or "<status>FAILED</status>". If COMPLETE, then tell the user the fixed config files (put the exact raw content of the files in the XML tags, no extra text like triple backticks or language label). FOR YOUR FINAL TEXT RESPONSE, USE THE THE FOLLOWING XML FORMAT:
|
|
111182
111273
|
|
|
@@ -111248,6 +111339,11 @@ var parseXML = (rawResponse) => {
|
|
|
111248
111339
|
};
|
|
111249
111340
|
|
|
111250
111341
|
// src/agent/index.ts
|
|
111342
|
+
async function go() {
|
|
111343
|
+
const session = await exportSession("asdfijij8fjeffefe");
|
|
111344
|
+
console.log(session);
|
|
111345
|
+
}
|
|
111346
|
+
go().catch(console.error);
|
|
111251
111347
|
var AGENTS = {
|
|
111252
111348
|
goose: runAgent,
|
|
111253
111349
|
claude_code: runAgent2
|
|
@@ -111262,7 +111358,7 @@ function chooseAgent(agentName) {
|
|
|
111262
111358
|
|
|
111263
111359
|
// src/agent/validate.ts
|
|
111264
111360
|
var fs10 = __toESM(require("fs/promises"), 1);
|
|
111265
|
-
var
|
|
111361
|
+
var SYSTEM3 = `You are a frontend validation expert. Your job is to analyze logs and a screenshot to determine if a frontend application is running correctly.
|
|
111266
111362
|
|
|
111267
111363
|
You will be provided with:
|
|
111268
111364
|
1. PM2 process logs from all services
|
|
@@ -111294,7 +111390,7 @@ async function runValidation(screenshotPath, logs, apiKey) {
|
|
|
111294
111390
|
const base64Image = imageBuffer.toString("base64");
|
|
111295
111391
|
const systemMessage = {
|
|
111296
111392
|
role: "system",
|
|
111297
|
-
content:
|
|
111393
|
+
content: SYSTEM3
|
|
111298
111394
|
};
|
|
111299
111395
|
const userMessage = {
|
|
111300
111396
|
role: "user",
|
|
@@ -113219,7 +113315,7 @@ ${diff.trim()}`);
|
|
|
113219
113315
|
return async (req, res) => {
|
|
113220
113316
|
const request_id = startReq();
|
|
113221
113317
|
try {
|
|
113222
|
-
const { repoName, apiKey, agent_name, session } = req.body;
|
|
113318
|
+
const { repoName, apiKey, agent_name, session, resume, summarize } = req.body;
|
|
113223
113319
|
const params = getParams(req);
|
|
113224
113320
|
const workspaceRoot2 = await workspaceRoot();
|
|
113225
113321
|
let repoPath = workspaceRoot2;
|
|
@@ -113234,7 +113330,15 @@ ${diff.trim()}`);
|
|
|
113234
113330
|
}
|
|
113235
113331
|
}
|
|
113236
113332
|
const agentFn = chooseAgent(agent_name || "goose");
|
|
113237
|
-
agentFn(
|
|
113333
|
+
agentFn({
|
|
113334
|
+
prompt: params.prompt,
|
|
113335
|
+
apiKey,
|
|
113336
|
+
cwd: repoPath,
|
|
113337
|
+
system_prompt: params.system,
|
|
113338
|
+
session,
|
|
113339
|
+
resume: resume ? true : false,
|
|
113340
|
+
summarize: summarize ? true : false
|
|
113341
|
+
}).then((result) => {
|
|
113238
113342
|
const finalResult = transformResult ? transformResult(result) : result;
|
|
113239
113343
|
finishReq(request_id, {
|
|
113240
113344
|
success: true,
|
|
@@ -113271,7 +113375,11 @@ ${diff.trim()}`);
|
|
|
113271
113375
|
}
|
|
113272
113376
|
}
|
|
113273
113377
|
return {
|
|
113274
|
-
prompt: repair_exports.makeRepairPrompt(
|
|
113378
|
+
prompt: repair_exports.makeRepairPrompt(
|
|
113379
|
+
podConfigPath,
|
|
113380
|
+
history,
|
|
113381
|
+
req.body.prompt
|
|
113382
|
+
),
|
|
113275
113383
|
system: repair_exports.SYSTEM
|
|
113276
113384
|
};
|
|
113277
113385
|
},
|
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.58";
|
|
10971
10971
|
|
|
10972
10972
|
// src/cli.ts
|
|
10973
10973
|
var STAKLINK_PROXY = "staklink-proxy";
|