sparkecoder 0.1.6 → 0.1.7
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/agent/index.js +2 -1
- package/dist/agent/index.js.map +1 -1
- package/dist/cli.js +23 -12
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +23 -12
- package/dist/index.js.map +1 -1
- package/dist/server/index.js +23 -12
- package/dist/server/index.js.map +1 -1
- package/dist/tools/index.js +2 -1
- package/dist/tools/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1166,7 +1166,8 @@ async function runBackground(command, workingDirectory, options) {
|
|
|
1166
1166
|
cwd: workingDirectory,
|
|
1167
1167
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1168
1168
|
sessionId: options.sessionId,
|
|
1169
|
-
background: true
|
|
1169
|
+
background: true,
|
|
1170
|
+
name: options.name
|
|
1170
1171
|
}, workingDirectory);
|
|
1171
1172
|
const logFile = join2(logDir, "output.log");
|
|
1172
1173
|
const wrappedCommand = `(${command}) 2>&1 | tee -a ${shellEscape(logFile)}`;
|
|
@@ -3989,7 +3990,10 @@ terminals2.post(
|
|
|
3989
3990
|
return c.json({ error: "tmux is not installed. Background terminals require tmux." }, 400);
|
|
3990
3991
|
}
|
|
3991
3992
|
const workingDirectory = body.cwd || session.workingDirectory;
|
|
3992
|
-
const result = await runBackground(body.command, workingDirectory, {
|
|
3993
|
+
const result = await runBackground(body.command, workingDirectory, {
|
|
3994
|
+
sessionId,
|
|
3995
|
+
name: body.name
|
|
3996
|
+
});
|
|
3993
3997
|
return c.json({
|
|
3994
3998
|
id: result.id,
|
|
3995
3999
|
name: body.name || null,
|
|
@@ -4013,7 +4017,7 @@ terminals2.get("/:sessionId/terminals", async (c) => {
|
|
|
4013
4017
|
const running = await isRunning(meta.id);
|
|
4014
4018
|
return {
|
|
4015
4019
|
id: meta.id,
|
|
4016
|
-
name: null,
|
|
4020
|
+
name: meta.name || null,
|
|
4017
4021
|
command: meta.command,
|
|
4018
4022
|
cwd: meta.cwd,
|
|
4019
4023
|
status: running ? "running" : "stopped",
|
|
@@ -4097,10 +4101,17 @@ terminals2.post(
|
|
|
4097
4101
|
"/:sessionId/terminals/:terminalId/write",
|
|
4098
4102
|
zValidator4("json", writeSchema),
|
|
4099
4103
|
async (c) => {
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
+
const terminalId = c.req.param("terminalId");
|
|
4105
|
+
const body = c.req.valid("json");
|
|
4106
|
+
const isRunning2 = await isRunning(terminalId);
|
|
4107
|
+
if (!isRunning2) {
|
|
4108
|
+
return c.json({ error: "Terminal is not running" }, 400);
|
|
4109
|
+
}
|
|
4110
|
+
const success = await sendInput(terminalId, body.input, { pressEnter: false });
|
|
4111
|
+
if (!success) {
|
|
4112
|
+
return c.json({ error: "Failed to write to terminal" }, 500);
|
|
4113
|
+
}
|
|
4114
|
+
return c.json({ success: true, written: body.input.length });
|
|
4104
4115
|
}
|
|
4105
4116
|
);
|
|
4106
4117
|
terminals2.post("/:sessionId/terminals/kill-all", async (c) => {
|
|
@@ -4109,12 +4120,12 @@ terminals2.post("/:sessionId/terminals/kill-all", async (c) => {
|
|
|
4109
4120
|
if (!session) {
|
|
4110
4121
|
return c.json({ error: "Session not found" }, 404);
|
|
4111
4122
|
}
|
|
4112
|
-
const
|
|
4123
|
+
const sessionTerminals = await listSessionTerminals(sessionId, session.workingDirectory);
|
|
4113
4124
|
let killed = 0;
|
|
4114
|
-
for (const
|
|
4115
|
-
const
|
|
4116
|
-
if (
|
|
4117
|
-
const success = await killTerminal(id);
|
|
4125
|
+
for (const terminal of sessionTerminals) {
|
|
4126
|
+
const isRunning2 = await isRunning(terminal.id);
|
|
4127
|
+
if (isRunning2) {
|
|
4128
|
+
const success = await killTerminal(terminal.id);
|
|
4118
4129
|
if (success) killed++;
|
|
4119
4130
|
}
|
|
4120
4131
|
}
|