staklink 0.4.4 → 0.4.5
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 +146 -25
- package/dist/staklink-cli.cjs +1 -1
- package/package.json +1 -1
package/dist/proxy-server.cjs
CHANGED
|
@@ -60777,7 +60777,7 @@ var SSEManager = class {
|
|
|
60777
60777
|
var sseManager = new SSEManager();
|
|
60778
60778
|
|
|
60779
60779
|
// src/proxy/version.ts
|
|
60780
|
-
var VERSION = "0.4.
|
|
60780
|
+
var VERSION = "0.4.5";
|
|
60781
60781
|
|
|
60782
60782
|
// node_modules/uuid/dist/esm/stringify.js
|
|
60783
60783
|
var byteToHex = [];
|
|
@@ -60950,7 +60950,12 @@ var fs8 = __toESM(require("fs"), 1);
|
|
|
60950
60950
|
var path7 = __toESM(require("path"), 1);
|
|
60951
60951
|
var os = __toESM(require("os"), 1);
|
|
60952
60952
|
|
|
60953
|
-
// src/agent/
|
|
60953
|
+
// src/agent/system_prompt.ts
|
|
60954
|
+
var SYSTEM_CORE = `You are a software systems expert. You are working on a cloud dev server (code-server) that is running a software project. The user's application is being run with pm2. You can use the pm2 cli to inspect the running processes. There may also be supporting services running as docker containers. Because you are running on a cloud server, certain operation may not be possible, such as launching a desktop application, or opening a browser window. The user can see the running application from the pm2 service called "frontend" in an iframe on their end.
|
|
60955
|
+
|
|
60956
|
+
Do not commit or push code to github. That is handled by a workflow after you are done working.
|
|
60957
|
+
|
|
60958
|
+
`;
|
|
60954
60959
|
var SYSTEM_SUFFIX = `
|
|
60955
60960
|
You can ignore the .pod-config directory if you see it, its just config stuff
|
|
60956
60961
|
|
|
@@ -137820,7 +137825,8 @@ async function runAgent({
|
|
|
137820
137825
|
const env2 = goose_env(apiKey, model);
|
|
137821
137826
|
console.log("RUN goose with env", env2);
|
|
137822
137827
|
const cleanPrompt = sanitizeShellArg(prompt);
|
|
137823
|
-
let system =
|
|
137828
|
+
let system = SYSTEM_CORE;
|
|
137829
|
+
system += system_prompt ? sanitizeShellArg(system_prompt) + "\n\n" : "";
|
|
137824
137830
|
system += SYSTEM_SUFFIX;
|
|
137825
137831
|
system = sanitizeShellArg(system);
|
|
137826
137832
|
console.log("Using Goose CLI", cleanPrompt, system);
|
|
@@ -139430,7 +139436,8 @@ async function runAgent3({
|
|
|
139430
139436
|
session,
|
|
139431
139437
|
summarize
|
|
139432
139438
|
}) {
|
|
139433
|
-
let system =
|
|
139439
|
+
let system = SYSTEM_CORE;
|
|
139440
|
+
system += system_prompt ? system_prompt + "\n\n" : "";
|
|
139434
139441
|
system += SYSTEM_SUFFIX;
|
|
139435
139442
|
console.log("Codex agent using API key:", apiKey ? `${apiKey.substring(0, 8)}...` : "MISSING");
|
|
139436
139443
|
if (apiKey) {
|
|
@@ -139463,7 +139470,7 @@ __export(repair_exports, {
|
|
|
139463
139470
|
makeRepairPrompt: () => makeRepairPrompt,
|
|
139464
139471
|
parseXML: () => parseXML
|
|
139465
139472
|
});
|
|
139466
|
-
var SYSTEM2 =
|
|
139473
|
+
var SYSTEM2 = SYSTEM_CORE + `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.
|
|
139467
139474
|
|
|
139468
139475
|
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:
|
|
139469
139476
|
|
|
@@ -141103,6 +141110,97 @@ Stderr: ${error88.stderr}`
|
|
|
141103
141110
|
};
|
|
141104
141111
|
|
|
141105
141112
|
// src/proxy/git_actions.ts
|
|
141113
|
+
var IMAGE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
141114
|
+
".png",
|
|
141115
|
+
".jpg",
|
|
141116
|
+
".jpeg",
|
|
141117
|
+
".gif",
|
|
141118
|
+
".bmp",
|
|
141119
|
+
".webp",
|
|
141120
|
+
".ico",
|
|
141121
|
+
".svg",
|
|
141122
|
+
".tiff",
|
|
141123
|
+
".tif",
|
|
141124
|
+
".avif"
|
|
141125
|
+
]);
|
|
141126
|
+
var MIME_TYPES = {
|
|
141127
|
+
".png": "image/png",
|
|
141128
|
+
".jpg": "image/jpeg",
|
|
141129
|
+
".jpeg": "image/jpeg",
|
|
141130
|
+
".gif": "image/gif",
|
|
141131
|
+
".bmp": "image/bmp",
|
|
141132
|
+
".webp": "image/webp",
|
|
141133
|
+
".ico": "image/x-icon",
|
|
141134
|
+
".svg": "image/svg+xml",
|
|
141135
|
+
".tiff": "image/tiff",
|
|
141136
|
+
".tif": "image/tiff",
|
|
141137
|
+
".avif": "image/avif"
|
|
141138
|
+
};
|
|
141139
|
+
function isImageFile(filePath) {
|
|
141140
|
+
return IMAGE_EXTENSIONS.has(import_path4.default.extname(filePath).toLowerCase());
|
|
141141
|
+
}
|
|
141142
|
+
async function binaryDiffContent(repo, filePath, action) {
|
|
141143
|
+
const isBinary = await isGitBinaryFile(repo, filePath);
|
|
141144
|
+
if (!isBinary) {
|
|
141145
|
+
return null;
|
|
141146
|
+
}
|
|
141147
|
+
if (action === "delete") {
|
|
141148
|
+
if (isImageFile(filePath)) {
|
|
141149
|
+
return `Binary image file deleted: ${filePath}`;
|
|
141150
|
+
}
|
|
141151
|
+
return `Binary file deleted: ${filePath}`;
|
|
141152
|
+
}
|
|
141153
|
+
if (isImageFile(filePath)) {
|
|
141154
|
+
try {
|
|
141155
|
+
const absPath = import_path4.default.join(repo.printcwd(), filePath);
|
|
141156
|
+
const buffer = import_fs4.default.readFileSync(absPath);
|
|
141157
|
+
const ext2 = import_path4.default.extname(filePath).toLowerCase();
|
|
141158
|
+
const mime = MIME_TYPES[ext2] || "application/octet-stream";
|
|
141159
|
+
const b64 = buffer.toString("base64");
|
|
141160
|
+
return `--- ${action === "create" ? "/dev/null" : `a/${filePath}`}
|
|
141161
|
+
+++ b/${filePath}
|
|
141162
|
+
Binary image file (${mime}, ${formatBytes(buffer.length)})
|
|
141163
|
+
data:${mime};base64,${b64}`;
|
|
141164
|
+
} catch {
|
|
141165
|
+
return `Binary image file changed: ${filePath} (could not read file)`;
|
|
141166
|
+
}
|
|
141167
|
+
}
|
|
141168
|
+
return `Binary file changed: ${filePath}`;
|
|
141169
|
+
}
|
|
141170
|
+
async function isGitBinaryFile(repo, filePath) {
|
|
141171
|
+
try {
|
|
141172
|
+
const numstat = await repo.execCommand(
|
|
141173
|
+
`git diff --numstat HEAD -- "${filePath}"`
|
|
141174
|
+
);
|
|
141175
|
+
if (numstat.trim().startsWith("- -")) {
|
|
141176
|
+
return true;
|
|
141177
|
+
}
|
|
141178
|
+
} catch {
|
|
141179
|
+
}
|
|
141180
|
+
try {
|
|
141181
|
+
const absPath = import_path4.default.join(repo.printcwd(), filePath);
|
|
141182
|
+
const buf = Buffer.alloc(8192);
|
|
141183
|
+
const fd = import_fs4.default.openSync(absPath, "r");
|
|
141184
|
+
const bytesRead = import_fs4.default.readSync(fd, buf, 0, 8192, 0);
|
|
141185
|
+
import_fs4.default.closeSync(fd);
|
|
141186
|
+
for (let i = 0; i < bytesRead; i++) {
|
|
141187
|
+
if (buf[i] === 0) {
|
|
141188
|
+
return true;
|
|
141189
|
+
}
|
|
141190
|
+
}
|
|
141191
|
+
} catch {
|
|
141192
|
+
}
|
|
141193
|
+
return false;
|
|
141194
|
+
}
|
|
141195
|
+
function formatBytes(bytes) {
|
|
141196
|
+
if (bytes < 1024) {
|
|
141197
|
+
return `${bytes} B`;
|
|
141198
|
+
}
|
|
141199
|
+
if (bytes < 1024 * 1024) {
|
|
141200
|
+
return `${(bytes / 1024).toFixed(1)} KB`;
|
|
141201
|
+
}
|
|
141202
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
141203
|
+
}
|
|
141106
141204
|
async function handleBranchDiff(req, res) {
|
|
141107
141205
|
try {
|
|
141108
141206
|
const results = [];
|
|
@@ -141154,12 +141252,17 @@ async function handleBranchDiff(req, res) {
|
|
|
141154
141252
|
action = "modify";
|
|
141155
141253
|
}
|
|
141156
141254
|
let content = "";
|
|
141157
|
-
|
|
141158
|
-
|
|
141159
|
-
|
|
141160
|
-
|
|
141161
|
-
|
|
141162
|
-
|
|
141255
|
+
const binaryContent = await binaryDiffContent(repo, filePath, action);
|
|
141256
|
+
if (binaryContent !== null) {
|
|
141257
|
+
content = binaryContent;
|
|
141258
|
+
} else {
|
|
141259
|
+
try {
|
|
141260
|
+
content = await repo.execCommand(
|
|
141261
|
+
`git diff ${mergeBase} -- "${filePath}"`
|
|
141262
|
+
);
|
|
141263
|
+
} catch (error88) {
|
|
141264
|
+
warn(`Error getting branch diff for ${filePath}:`, error88);
|
|
141265
|
+
}
|
|
141163
141266
|
}
|
|
141164
141267
|
results.push({
|
|
141165
141268
|
file: `${repoName}/${filePath}`,
|
|
@@ -141210,15 +141313,24 @@ async function handleDiff(_req, res) {
|
|
|
141210
141313
|
action = "modify";
|
|
141211
141314
|
}
|
|
141212
141315
|
let content = "";
|
|
141213
|
-
|
|
141214
|
-
|
|
141215
|
-
|
|
141216
|
-
|
|
141217
|
-
|
|
141218
|
-
|
|
141316
|
+
const binaryContent = await binaryDiffContent(repo, filePath, action);
|
|
141317
|
+
if (binaryContent !== null) {
|
|
141318
|
+
content = binaryContent;
|
|
141319
|
+
} else {
|
|
141320
|
+
try {
|
|
141321
|
+
if (action === "delete") {
|
|
141322
|
+
content = await repo.execCommand(
|
|
141323
|
+
`git diff HEAD -- "${filePath}"`
|
|
141324
|
+
);
|
|
141325
|
+
} else {
|
|
141326
|
+
log("Getting diff for", filePath);
|
|
141327
|
+
content = await repo.execCommand(
|
|
141328
|
+
`git diff HEAD -- "${filePath}"`
|
|
141329
|
+
);
|
|
141330
|
+
}
|
|
141331
|
+
} catch (error88) {
|
|
141332
|
+
warn(`Error getting diff for ${filePath}:`, error88);
|
|
141219
141333
|
}
|
|
141220
|
-
} catch (error88) {
|
|
141221
|
-
warn(`Error getting diff for ${filePath}:`, error88);
|
|
141222
141334
|
}
|
|
141223
141335
|
results.push({
|
|
141224
141336
|
file: `${repoName}/${filePath}`,
|
|
@@ -141231,15 +141343,24 @@ async function handleDiff(_req, res) {
|
|
|
141231
141343
|
const untrackedLines = untrackedOutput.trim().split("\n").filter((line) => line);
|
|
141232
141344
|
for (const filePath of untrackedLines) {
|
|
141233
141345
|
let content = "";
|
|
141234
|
-
|
|
141235
|
-
|
|
141236
|
-
|
|
141237
|
-
|
|
141346
|
+
const binaryContent = await binaryDiffContent(
|
|
141347
|
+
repo,
|
|
141348
|
+
filePath,
|
|
141349
|
+
"create"
|
|
141350
|
+
);
|
|
141351
|
+
if (binaryContent !== null) {
|
|
141352
|
+
content = binaryContent;
|
|
141353
|
+
} else {
|
|
141354
|
+
try {
|
|
141355
|
+
const fileContent = await repo.execCommand(`cat "${filePath}"`);
|
|
141356
|
+
const lines2 = fileContent.split("\n");
|
|
141357
|
+
content = `--- /dev/null
|
|
141238
141358
|
+++ b/${filePath}
|
|
141239
141359
|
@@ -0,0 +1,${lines2.length} @@
|
|
141240
141360
|
${lines2.map((line) => "+" + line).join("\n")}`;
|
|
141241
|
-
|
|
141242
|
-
|
|
141361
|
+
} catch (error88) {
|
|
141362
|
+
warn(`Error reading untracked file ${filePath}:`, error88);
|
|
141363
|
+
}
|
|
141243
141364
|
}
|
|
141244
141365
|
results.push({
|
|
141245
141366
|
file: `${repoName}/${filePath}`,
|
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.4.
|
|
10970
|
+
var VERSION = "0.4.5";
|
|
10971
10971
|
|
|
10972
10972
|
// src/deps.ts
|
|
10973
10973
|
var import_child_process = require("child_process");
|