atlarix 15.2.0 → 15.3.0

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.
@@ -81,11 +81,19 @@ function getRegisteredHandler(channel) {
81
81
  return handlers.get(channel);
82
82
  }
83
83
  function attachCliWindow(send) {
84
+ cliSenders.add(send);
85
+ const detach = () => {
86
+ cliSenders.delete(send);
87
+ if (cliSenders.size === 0) cliWindow = null;
88
+ };
89
+ if (cliWindow) return detach;
84
90
  const webContents = {
85
91
  id: 1,
86
92
  isDestroyed: () => false,
87
93
  isCrashed: () => false,
88
- send
94
+ send: (channel, payload) => {
95
+ for (const s3 of [...cliSenders]) s3(channel, payload);
96
+ }
89
97
  };
90
98
  cliWindow = {
91
99
  id: 1,
@@ -97,11 +105,12 @@ function attachCliWindow(send) {
97
105
  focus: noop,
98
106
  show: noop
99
107
  };
108
+ return detach;
100
109
  }
101
110
  function setSafeStorageImpl(impl) {
102
111
  safeStorageImpl = impl;
103
112
  }
104
- var handlers, ipcMain, userDataBase, noop, app, BrowserWindow, cliWindow, safeStorageImpl, safeStorage, dialog, shell, clipboard, nativeTheme, powerMonitor, powerSaveBlocker, session, Menu, Notification, contextBridge, ipcRenderer, webFrame, WebContentsView, electron_stub_default;
113
+ var handlers, ipcMain, userDataBase, noop, app, BrowserWindow, cliWindow, cliSenders, safeStorageImpl, safeStorage, dialog, shell, clipboard, nativeTheme, powerMonitor, powerSaveBlocker, session, Menu, Notification, contextBridge, ipcRenderer, webFrame, WebContentsView, electron_stub_default;
105
114
  var init_electron_stub = __esm({
106
115
  "src/headless/electron-stub.ts"() {
107
116
  handlers = /* @__PURE__ */ new Map();
@@ -140,6 +149,7 @@ var init_electron_stub = __esm({
140
149
  fromId: () => null
141
150
  };
142
151
  cliWindow = null;
152
+ cliSenders = /* @__PURE__ */ new Set();
143
153
  safeStorageImpl = {
144
154
  isEncryptionAvailable: () => false,
145
155
  encryptString: (s3) => Buffer.from(s3, "utf8"),
@@ -238276,7 +238286,7 @@ var init_framing = __esm({
238276
238286
 
238277
238287
  // src/lib/peers/peer-message.ts
238278
238288
  function peerSurfaceLabel(surface2) {
238279
- return surface2 === "cli" ? "CLI" : surface2 === "chrome" ? "browser" : "app";
238289
+ return surface2 === "cli" ? "CLI" : surface2 === "chrome" ? "browser" : surface2 === "editor" ? "editor" : "app";
238280
238290
  }
238281
238291
  var init_peer_message = __esm({
238282
238292
  "src/lib/peers/peer-message.ts"() {
@@ -238373,7 +238383,7 @@ function publish() {
238373
238383
  host,
238374
238384
  peerSocketPath(),
238375
238385
  token,
238376
- surface === "app" ? "Atlarix app" : "Atlarix CLI",
238386
+ surface === "app" ? "Atlarix app" : surface === "editor" ? "Atlarix in an editor" : "Atlarix CLI",
238377
238387
  "",
238378
238388
  surface,
238379
238389
  0,
@@ -238409,6 +238419,11 @@ function noteLiveSession(s3) {
238409
238419
  local.set(s3.sessionId, s3);
238410
238420
  if (!prev || prev.name !== s3.name || prev.chatId !== s3.chatId) publish();
238411
238421
  }
238422
+ function sessionsHeldElsewhere() {
238423
+ return new Set(
238424
+ liveRows().filter((r3) => r3.pid !== process.pid && !r3.session_id.startsWith(PROCESS_ROW_PREFIX)).map((r3) => r3.session_id)
238425
+ );
238426
+ }
238412
238427
  function forgetLiveSession(sessionId) {
238413
238428
  if (local.delete(sessionId)) publish();
238414
238429
  }
@@ -238454,7 +238469,7 @@ function listPeerSessions(exclude) {
238454
238469
  sessionId: r3.session_id,
238455
238470
  name: r3.name,
238456
238471
  workspace: r3.workspace,
238457
- surface: r3.surface === "cli" ? "cli" : r3.surface === "chrome" ? "chrome" : "app",
238472
+ surface: r3.surface === "cli" || r3.surface === "chrome" || r3.surface === "editor" ? r3.surface : "app",
238458
238473
  busy: r3.busy === 1,
238459
238474
  pid: r3.pid
238460
238475
  });
@@ -238735,7 +238750,7 @@ async function noteSessionOpen(sessionId, chatId) {
238735
238750
  noteLiveSession({
238736
238751
  sessionId,
238737
238752
  chatId,
238738
- name: (session2.title?.trim() && !isPlaceholderTitle(session2.title) ? session2.title.trim() : "") || `New ${process.env.ATLARIX_SURFACE === "cli" ? "CLI " : ""}session (${(app2?.path ?? "").split(/[\\/]/).pop() || "no folder"})`,
238753
+ name: (session2.title?.trim() && !isPlaceholderTitle(session2.title) ? session2.title.trim() : "") || `New ${process.env.ATLARIX_PEER_SURFACE === "editor" ? "editor " : process.env.ATLARIX_SURFACE === "cli" ? "CLI " : ""}session (${(app2?.path ?? "").split(/[\\/]/).pop() || "no folder"})`,
238739
238754
  workspace: app2?.path ?? ""
238740
238755
  });
238741
238756
  } catch (e3) {
@@ -239160,10 +239175,13 @@ async function verifyTrulyEmptySession(sessionId, purpose) {
239160
239175
  }
239161
239176
  return { row, empty: true, reason: "empty" };
239162
239177
  }
239163
- async function startWorkspaceSession(workspaceId) {
239178
+ async function startWorkspaceSession(workspaceId, opts = {}) {
239164
239179
  let session2 = null;
239165
239180
  try {
239166
- const rows = await listSessionsWithMessageCounts(workspaceId);
239181
+ const held = sessionsHeldElsewhere();
239182
+ const rows = (await listSessionsWithMessageCounts(workspaceId)).filter(
239183
+ (r3) => !held.has(r3.id) && !claimedSessions.has(r3.id)
239184
+ );
239167
239185
  const { reuseId, pruneIds } = pickSessionReuse(rows);
239168
239186
  if (rows.length > 0) {
239169
239187
  logger30.log(
@@ -239207,6 +239225,7 @@ async function startWorkspaceSession(workspaceId) {
239207
239225
  if (!session2) {
239208
239226
  session2 = await insertWorkspaceSession(workspaceId);
239209
239227
  }
239228
+ if (opts.claim) claimedSessions.add(session2.id);
239210
239229
  const chatId = createStreamTransport(workspaceId);
239211
239230
  await persistSessionStreamChatId(session2.id, chatId);
239212
239231
  return { sessionId: session2.id, chatId, session: session2 };
@@ -239345,9 +239364,9 @@ function registerWorkspaceSessionHandlers() {
239345
239364
  return out;
239346
239365
  }
239347
239366
  );
239348
- handle("sessions:start", async (_event, workspaceId) => {
239367
+ handle("sessions:start", async (_event, workspaceId, opts) => {
239349
239368
  await requireAuthSession();
239350
- const started = await startWorkspaceSession(workspaceId);
239369
+ const started = await startWorkspaceSession(workspaceId, { claim: opts?.claim === true });
239351
239370
  logger30.info(
239352
239371
  `sessions:start workspace=${workspaceId} session=${started.sessionId} transport=${started.chatId}`
239353
239372
  );
@@ -239525,7 +239544,7 @@ function registerWorkspaceSessionHandlers() {
239525
239544
  return { title: currentTitle };
239526
239545
  });
239527
239546
  }
239528
- var import_electron_log32, DEFAULT_SESSION_TITLES, logger30, handle;
239547
+ var import_electron_log32, DEFAULT_SESSION_TITLES, logger30, handle, claimedSessions;
239529
239548
  var init_workspace_session_handlers = __esm({
239530
239549
  "src/ipc/handlers/workspace_session_handlers.ts"() {
239531
239550
  import_electron_log32 = __toESM(require_src());
@@ -239549,6 +239568,7 @@ var init_workspace_session_handlers = __esm({
239549
239568
  DEFAULT_SESSION_TITLES = /* @__PURE__ */ new Set(["Untitled", "New session", "New chat"]);
239550
239569
  logger30 = import_electron_log32.default.scope("workspace_session_handlers");
239551
239570
  handle = createLoggedHandler(logger30);
239571
+ claimedSessions = /* @__PURE__ */ new Set();
239552
239572
  }
239553
239573
  });
239554
239574
 
@@ -342965,7 +342985,7 @@ ${err2.stack}` : "";
342965
342985
  }
342966
342986
 
342967
342987
  // src/headless/atlarix-headless.mts
342968
- var VERSION15 = false ? "dev" : "15.2.0";
342988
+ var VERSION15 = false ? "dev" : "15.3.0";
342969
342989
  if (process.argv[2] === "run") process.argv.splice(2, 1);
342970
342990
  function arg(name29) {
342971
342991
  const i4 = process.argv.indexOf(`--${name29}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atlarix",
3
- "version": "15.2.0",
3
+ "version": "15.3.0",
4
4
  "description": "Atlarix CLI: an AI coding agent in your terminal. Works with any model (Atlarix Auto, your own API key, or a local model) and runs unattended with `atlarix run` for CI.",
5
5
  "license": "PROPRIETARY",
6
6
  "author": {
@@ -65,12 +65,12 @@
65
65
  "provenance": false
66
66
  },
67
67
  "optionalDependencies": {
68
- "atlarix-darwin-arm64": "15.2.0",
69
- "atlarix-darwin-x64": "15.2.0",
70
- "atlarix-linux-x64": "15.2.0",
71
- "atlarix-linux-arm64": "15.2.0",
72
- "atlarix-linux-x64-musl": "15.2.0",
73
- "atlarix-linux-arm64-musl": "15.2.0",
74
- "atlarix-windows-x64": "15.2.0"
68
+ "atlarix-darwin-arm64": "15.3.0",
69
+ "atlarix-darwin-x64": "15.3.0",
70
+ "atlarix-linux-x64": "15.3.0",
71
+ "atlarix-linux-arm64": "15.3.0",
72
+ "atlarix-linux-x64-musl": "15.3.0",
73
+ "atlarix-linux-arm64-musl": "15.3.0",
74
+ "atlarix-windows-x64": "15.3.0"
75
75
  }
76
76
  }