offsite 0.0.16 → 0.0.17

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.
@@ -1,5 +1,5 @@
1
1
  import { createHash, randomBytes, randomUUID } from "node:crypto";
2
- import { chmodSync, closeSync, createReadStream, existsSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, watch, writeFileSync } from "node:fs";
2
+ import { chmodSync, closeSync, createReadStream, existsSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, readlinkSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, watch, writeFileSync } from "node:fs";
3
3
  import { createServer } from "node:http";
4
4
  import path from "node:path";
5
5
  import { consola } from "consola";
@@ -2722,8 +2722,15 @@ async function updateSession(id, patch) {
2722
2722
  break;
2723
2723
  case "opencode": await renameOpenCode(id, patch.title);
2724
2724
  }
2725
- if (patch.status === "inactive") db.delete(sessions$1).where(eq(sessions$1.sessionId, id)).run();
2726
- else if (patch.status !== void 0) {
2725
+ if (patch.status === "inactive") {
2726
+ const run = runs.get(id);
2727
+ if (run !== void 0) {
2728
+ if (run.running) await run.interrupt();
2729
+ run.stop();
2730
+ await run.closed;
2731
+ }
2732
+ db.delete(sessions$1).where(eq(sessions$1.sessionId, id)).run();
2733
+ } else if (patch.status !== void 0) {
2727
2734
  const set = patch.status === "active" ? {
2728
2735
  status: patch.status,
2729
2736
  interactedAt: Date.now()
@@ -4692,6 +4699,7 @@ function newFilePatch(cwd, file, prefix) {
4692
4699
  const name = `${prefix}${file}`;
4693
4700
  const header = `diff --git a/${name} b/${name}\nnew file\n--- /dev/null\n+++ b/${name}\n`;
4694
4701
  const full = path.join(cwd, file);
4702
+ if (lstatSync(full).isSymbolicLink()) return `${header}@@ -0,0 +1 @@\n+${readlinkSync(full)}\n`;
4695
4703
  if (statSync(full).size > NEW_FILE_LIMIT) return `${header}Binary or large file\n`;
4696
4704
  const content = readFileSync(full, "utf8");
4697
4705
  if (content.includes("\0")) return `${header}Binary or large file\n`;