offsite 0.0.37 → 0.0.39

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.
@@ -5,7 +5,7 @@ import path from "node:path";
5
5
  import { consola } from "consola";
6
6
  import { WebSocketServer } from "ws";
7
7
  import { z } from "zod";
8
- import os from "node:os";
8
+ import os, { homedir } from "node:os";
9
9
  import { deleteSession, forkSession, getSessionInfo, getSessionMessages, getSubagentMessages, listSessions, query, renameSession } from "@anthropic-ai/claude-agent-sdk";
10
10
  import { execFile, spawn } from "node:child_process";
11
11
  import readline from "node:readline";
@@ -3172,8 +3172,6 @@ async function find(provider, paths) {
3172
3172
  });
3173
3173
  }
3174
3174
  }
3175
- //#endregion
3176
- //#region ../core/src/terminal.ts
3177
3175
  function encodeFrame(kind, id, data) {
3178
3176
  const frame = new Uint8Array(5 + data.length);
3179
3177
  frame[0] = kind;
@@ -3970,7 +3968,7 @@ function input(connection, bytes) {
3970
3968
  terminal.pty.write(Buffer.from(frame.data));
3971
3969
  }
3972
3970
  async function createTab(projectId) {
3973
- const cwd = projectPath(projectId);
3971
+ const cwd = projectId === "global" ? homedir() : projectPath(projectId);
3974
3972
  if (!statSync(cwd, { throwIfNoEntry: false })?.isDirectory()) {
3975
3973
  console.error(`${cwd} is not a folder, terminal not created`);
3976
3974
  return;
@@ -4386,7 +4384,7 @@ async function updateSession(id, patch) {
4386
4384
  db.delete(sessions$1).where(eq(sessions$1.sessionId, id)).run();
4387
4385
  const all = withStatus(allProviders.flatMap((provider) => listed[provider]));
4388
4386
  const session = all.find((item) => item.id === id);
4389
- if (session !== void 0 && all.every((item) => item.projectId !== session.projectId || item.status === "inactive")) closeProjectTabs(session.projectId);
4387
+ if (session !== void 0 && all.every((item) => item.projectId !== session.projectId || item.status === "inactive") && [...runs.values()].every((other) => other.sessionId === id || other.cwd !== projectPath(session.projectId) || all.some((item) => item.id === other.sessionId))) closeProjectTabs(session.projectId);
4390
4388
  } else if (patch.status !== void 0) {
4391
4389
  const set = patch.status === "active" ? {
4392
4390
  status: patch.status,
@@ -5576,6 +5574,7 @@ const IDLE_LIMIT = 6e5;
5576
5574
  var Run = class {
5577
5575
  provider = "claude";
5578
5576
  sessionId;
5577
+ cwd;
5579
5578
  messages = [];
5580
5579
  pending = /* @__PURE__ */ new Map();
5581
5580
  published = /* @__PURE__ */ new Map();
@@ -5598,6 +5597,7 @@ var Run = class {
5598
5597
  stopping = false;
5599
5598
  constructor(options) {
5600
5599
  this.sessionId = options.sessionId;
5600
+ this.cwd = options.cwd;
5601
5601
  this.resumeAt = options.resumeAt;
5602
5602
  this.settings = options.settings;
5603
5603
  this.query = query({