adhdev 0.8.50 → 0.8.54

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.
Files changed (53) hide show
  1. package/dist/cli/index.js +2115 -853
  2. package/dist/cli/index.js.map +1 -1
  3. package/dist/index.js +1391 -613
  4. package/dist/index.js.map +1 -1
  5. package/package.json +3 -2
  6. package/vendor/session-host-daemon/index.d.mts +3 -0
  7. package/vendor/session-host-daemon/index.d.ts +3 -0
  8. package/vendor/session-host-daemon/index.js +33 -2
  9. package/vendor/session-host-daemon/index.js.map +1 -1
  10. package/vendor/session-host-daemon/index.mjs +34 -2
  11. package/vendor/session-host-daemon/index.mjs.map +1 -1
  12. package/vendor/session-host-daemon/node_modules/@adhdev/session-host-core/index.d.mts +16 -1
  13. package/vendor/session-host-daemon/node_modules/@adhdev/session-host-core/index.d.ts +16 -1
  14. package/vendor/session-host-daemon/node_modules/@adhdev/session-host-core/index.js +59 -0
  15. package/vendor/session-host-daemon/node_modules/@adhdev/session-host-core/index.js.map +1 -1
  16. package/vendor/session-host-daemon/node_modules/@adhdev/session-host-core/index.mjs +54 -0
  17. package/vendor/session-host-daemon/node_modules/@adhdev/session-host-core/index.mjs.map +1 -1
  18. package/vendor/terminal-mux-cli/index.d.mts +1 -0
  19. package/vendor/terminal-mux-cli/index.d.ts +1 -0
  20. package/vendor/terminal-mux-cli/index.js +2070 -0
  21. package/vendor/terminal-mux-cli/index.mjs +2062 -0
  22. package/vendor/terminal-mux-cli/node_modules/@adhdev/session-host-core/index.d.mts +442 -0
  23. package/vendor/terminal-mux-cli/node_modules/@adhdev/session-host-core/index.d.ts +442 -0
  24. package/vendor/terminal-mux-cli/node_modules/@adhdev/session-host-core/index.js +676 -0
  25. package/vendor/terminal-mux-cli/node_modules/@adhdev/session-host-core/index.js.map +1 -0
  26. package/vendor/terminal-mux-cli/node_modules/@adhdev/session-host-core/index.mjs +627 -0
  27. package/vendor/terminal-mux-cli/node_modules/@adhdev/session-host-core/index.mjs.map +1 -0
  28. package/vendor/terminal-mux-cli/node_modules/@adhdev/session-host-core/package.json +7 -0
  29. package/vendor/terminal-mux-cli/node_modules/@adhdev/terminal-mux-control/api.d.mts +16 -0
  30. package/vendor/terminal-mux-cli/node_modules/@adhdev/terminal-mux-control/api.d.ts +16 -0
  31. package/vendor/terminal-mux-cli/node_modules/@adhdev/terminal-mux-control/api.js +206 -0
  32. package/vendor/terminal-mux-cli/node_modules/@adhdev/terminal-mux-control/api.mjs +17 -0
  33. package/vendor/terminal-mux-cli/node_modules/@adhdev/terminal-mux-control/chunk-7RNMRPVZ.mjs +183 -0
  34. package/vendor/terminal-mux-cli/node_modules/@adhdev/terminal-mux-control/chunk-R4EFW6W3.mjs +46 -0
  35. package/vendor/terminal-mux-cli/node_modules/@adhdev/terminal-mux-control/chunk-XZWWVN5W.mjs +164 -0
  36. package/vendor/terminal-mux-cli/node_modules/@adhdev/terminal-mux-control/control-socket.d.mts +35 -0
  37. package/vendor/terminal-mux-cli/node_modules/@adhdev/terminal-mux-control/control-socket.d.ts +35 -0
  38. package/vendor/terminal-mux-cli/node_modules/@adhdev/terminal-mux-control/control-socket.js +219 -0
  39. package/vendor/terminal-mux-cli/node_modules/@adhdev/terminal-mux-control/control-socket.mjs +13 -0
  40. package/vendor/terminal-mux-cli/node_modules/@adhdev/terminal-mux-control/index.d.mts +5 -0
  41. package/vendor/terminal-mux-cli/node_modules/@adhdev/terminal-mux-control/index.d.ts +5 -0
  42. package/vendor/terminal-mux-cli/node_modules/@adhdev/terminal-mux-control/index.js +427 -0
  43. package/vendor/terminal-mux-cli/node_modules/@adhdev/terminal-mux-control/index.mjs +34 -0
  44. package/vendor/terminal-mux-cli/node_modules/@adhdev/terminal-mux-control/package.json +33 -0
  45. package/vendor/terminal-mux-cli/node_modules/@adhdev/terminal-mux-control/storage.d.mts +49 -0
  46. package/vendor/terminal-mux-cli/node_modules/@adhdev/terminal-mux-control/storage.d.ts +49 -0
  47. package/vendor/terminal-mux-cli/node_modules/@adhdev/terminal-mux-control/storage.js +222 -0
  48. package/vendor/terminal-mux-cli/node_modules/@adhdev/terminal-mux-control/storage.mjs +16 -0
  49. package/vendor/terminal-mux-cli/node_modules/@adhdev/terminal-mux-core/index.d.mts +164 -0
  50. package/vendor/terminal-mux-cli/node_modules/@adhdev/terminal-mux-core/index.d.ts +164 -0
  51. package/vendor/terminal-mux-cli/node_modules/@adhdev/terminal-mux-core/index.js +993 -0
  52. package/vendor/terminal-mux-cli/node_modules/@adhdev/terminal-mux-core/index.mjs +957 -0
  53. package/vendor/terminal-mux-cli/node_modules/@adhdev/terminal-mux-core/package.json +7 -0
@@ -0,0 +1,427 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ AdhMuxControlClient: () => AdhMuxControlClient,
34
+ AdhMuxControlServer: () => AdhMuxControlServer,
35
+ TerminalMuxStorage: () => TerminalMuxStorage,
36
+ buildWorkspaceName: () => buildWorkspaceName,
37
+ createAdhMuxControlServer: () => createAdhMuxControlServer,
38
+ getRootDir: () => getRootDir,
39
+ getWorkspaceControlEndpoint: () => getWorkspaceControlEndpoint,
40
+ getWorkspaceSocketInfo: () => getWorkspaceSocketInfo,
41
+ getWorkspaceState: () => getWorkspaceState,
42
+ requestWorkspaceControl: () => requestWorkspaceControl,
43
+ sanitizeWorkspaceName: () => sanitizeWorkspaceName,
44
+ toWorkspaceRef: () => toWorkspaceRef,
45
+ withAdhMuxControlClient: () => withAdhMuxControlClient
46
+ });
47
+ module.exports = __toCommonJS(index_exports);
48
+
49
+ // src/control-socket.ts
50
+ var import_net = __toESM(require("net"));
51
+ var import_fs2 = __toESM(require("fs"));
52
+
53
+ // src/storage.ts
54
+ var import_fs = __toESM(require("fs"));
55
+ var import_os = __toESM(require("os"));
56
+ var import_path = __toESM(require("path"));
57
+ function getRootDir() {
58
+ return import_path.default.join(import_os.default.homedir(), ".adhdev", "terminal-mux");
59
+ }
60
+ var WINDOW_MARKER = "--w--";
61
+ function getWorkspacesDir() {
62
+ return import_path.default.join(getRootDir(), "workspaces");
63
+ }
64
+ function getStatePath() {
65
+ return import_path.default.join(getRootDir(), "state.json");
66
+ }
67
+ function sanitizeWorkspaceName(name) {
68
+ return name.trim().replace(/[^a-zA-Z0-9._-]+/g, "-");
69
+ }
70
+ function toWorkspaceRef(name) {
71
+ const workspaceName = sanitizeWorkspaceName(name);
72
+ const markerIndex = workspaceName.indexOf(WINDOW_MARKER);
73
+ if (markerIndex < 0) {
74
+ return {
75
+ sessionName: workspaceName,
76
+ windowName: workspaceName,
77
+ workspaceName
78
+ };
79
+ }
80
+ return {
81
+ sessionName: workspaceName.slice(0, markerIndex),
82
+ windowName: workspaceName.slice(markerIndex + WINDOW_MARKER.length),
83
+ workspaceName
84
+ };
85
+ }
86
+ function buildWorkspaceName(sessionName, windowName) {
87
+ const session = sanitizeWorkspaceName(sessionName);
88
+ const window = sanitizeWorkspaceName(windowName);
89
+ if (!session || session === window) return window;
90
+ return `${session}${WINDOW_MARKER}${window}`;
91
+ }
92
+ function getWorkspaceControlEndpoint(name) {
93
+ const sanitized = sanitizeWorkspaceName(name);
94
+ if (process.platform === "win32") {
95
+ return {
96
+ kind: "pipe",
97
+ path: `\\\\.\\pipe\\adhmux-${sanitized}`
98
+ };
99
+ }
100
+ return {
101
+ kind: "unix",
102
+ path: import_path.default.join(import_os.default.tmpdir(), `adhmux-${sanitized}.sock`)
103
+ };
104
+ }
105
+ var TerminalMuxStorage = class {
106
+ workspacesDir = getWorkspacesDir();
107
+ statePath = getStatePath();
108
+ listWorkspaceNames() {
109
+ return this.listWorkspaces().map((workspace) => workspace.name);
110
+ }
111
+ listWorkspaces() {
112
+ if (!import_fs.default.existsSync(this.workspacesDir)) return [];
113
+ return import_fs.default.readdirSync(this.workspacesDir, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".json")).flatMap((entry) => {
114
+ const name = entry.name.replace(/\.json$/, "");
115
+ const filePath = this.getWorkspacePath(name);
116
+ let title = name;
117
+ let paneCount = 0;
118
+ let updatedAt = 0;
119
+ try {
120
+ const parsed = JSON.parse(import_fs.default.readFileSync(filePath, "utf8"));
121
+ title = parsed.title || name;
122
+ paneCount = Object.keys(parsed.panes || {}).length;
123
+ updatedAt = import_fs.default.statSync(filePath).mtimeMs;
124
+ } catch {
125
+ return [];
126
+ }
127
+ return [{
128
+ name,
129
+ title,
130
+ paneCount,
131
+ updatedAt
132
+ }];
133
+ }).sort((a, b) => b.updatedAt - a.updatedAt || a.name.localeCompare(b.name));
134
+ }
135
+ listSessions() {
136
+ const grouped = /* @__PURE__ */ new Map();
137
+ for (const workspace of this.listWorkspaces()) {
138
+ const ref = toWorkspaceRef(workspace.name);
139
+ const items = grouped.get(ref.sessionName) || [];
140
+ items.push(workspace);
141
+ grouped.set(ref.sessionName, items);
142
+ }
143
+ return Array.from(grouped.entries()).map(([sessionName, workspaces]) => {
144
+ const sorted = [...workspaces].sort((a, b) => b.updatedAt - a.updatedAt || a.name.localeCompare(b.name));
145
+ const active = sorted[0];
146
+ return {
147
+ name: sessionName,
148
+ title: toWorkspaceRef(active.name).sessionName,
149
+ windowCount: workspaces.length,
150
+ updatedAt: active.updatedAt,
151
+ activeWindowName: toWorkspaceRef(active.name).windowName
152
+ };
153
+ }).sort((a, b) => b.updatedAt - a.updatedAt || a.name.localeCompare(b.name));
154
+ }
155
+ listSessionWindows(sessionName) {
156
+ const normalizedSession = sanitizeWorkspaceName(sessionName);
157
+ return this.listWorkspaces().filter((workspace) => toWorkspaceRef(workspace.name).sessionName === normalizedSession);
158
+ }
159
+ resolveSessionWindowWorkspace(sessionName, windowName) {
160
+ const windows = this.listSessionWindows(sessionName);
161
+ if (windows.length === 0) return null;
162
+ if (!windowName) return windows[0].name;
163
+ const normalizedWindow = sanitizeWorkspaceName(windowName);
164
+ const exact = windows.find((workspace) => toWorkspaceRef(workspace.name).windowName === normalizedWindow);
165
+ return exact?.name || null;
166
+ }
167
+ loadWorkspace(name) {
168
+ const filePath = this.getWorkspacePath(name);
169
+ if (!import_fs.default.existsSync(filePath)) return null;
170
+ const parsed = JSON.parse(import_fs.default.readFileSync(filePath, "utf8"));
171
+ return parsed?.workspaceId ? parsed : null;
172
+ }
173
+ saveWorkspace(name, workspace) {
174
+ import_fs.default.mkdirSync(this.workspacesDir, { recursive: true });
175
+ import_fs.default.writeFileSync(this.getWorkspacePath(name), JSON.stringify(workspace, null, 2), "utf8");
176
+ }
177
+ renameWorkspace(fromName, toName) {
178
+ const fromPath = this.getWorkspacePath(fromName);
179
+ const toPath = this.getWorkspacePath(toName);
180
+ if (!import_fs.default.existsSync(fromPath)) {
181
+ throw new Error(`Workspace not found: ${fromName}`);
182
+ }
183
+ import_fs.default.mkdirSync(this.workspacesDir, { recursive: true });
184
+ import_fs.default.renameSync(fromPath, toPath);
185
+ }
186
+ deleteWorkspace(name) {
187
+ const filePath = this.getWorkspacePath(name);
188
+ if (!import_fs.default.existsSync(filePath)) {
189
+ throw new Error(`Workspace not found: ${name}`);
190
+ }
191
+ import_fs.default.unlinkSync(filePath);
192
+ const state = this.loadClientState();
193
+ if (state.lastWorkspace === sanitizeWorkspaceName(name)) {
194
+ this.saveClientState({ ...state, lastWorkspace: void 0, updatedAt: Date.now() });
195
+ }
196
+ }
197
+ getLastWorkspace() {
198
+ const state = this.loadClientState();
199
+ return state.lastWorkspace || null;
200
+ }
201
+ setLastWorkspace(name) {
202
+ this.saveClientState({
203
+ ...this.loadClientState(),
204
+ lastWorkspace: sanitizeWorkspaceName(name),
205
+ updatedAt: Date.now()
206
+ });
207
+ }
208
+ getWorkspacePath(name) {
209
+ return import_path.default.join(this.workspacesDir, `${sanitizeWorkspaceName(name)}.json`);
210
+ }
211
+ loadClientState() {
212
+ if (!import_fs.default.existsSync(this.statePath)) {
213
+ return { updatedAt: 0 };
214
+ }
215
+ try {
216
+ const parsed = JSON.parse(import_fs.default.readFileSync(this.statePath, "utf8"));
217
+ return typeof parsed === "object" && parsed ? parsed : { updatedAt: 0 };
218
+ } catch {
219
+ return { updatedAt: 0 };
220
+ }
221
+ }
222
+ saveClientState(state) {
223
+ import_fs.default.mkdirSync(getRootDir(), { recursive: true });
224
+ import_fs.default.writeFileSync(this.statePath, JSON.stringify(state, null, 2), "utf8");
225
+ }
226
+ };
227
+
228
+ // src/control-socket.ts
229
+ function serializeEnvelope(envelope) {
230
+ return `${JSON.stringify(envelope)}
231
+ `;
232
+ }
233
+ function createControlLineParser(onEnvelope) {
234
+ let buffer = "";
235
+ return (chunk) => {
236
+ buffer += chunk.toString();
237
+ let newlineIndex = buffer.indexOf("\n");
238
+ while (newlineIndex >= 0) {
239
+ const rawLine = buffer.slice(0, newlineIndex).trim();
240
+ buffer = buffer.slice(newlineIndex + 1);
241
+ if (rawLine) {
242
+ onEnvelope(JSON.parse(rawLine));
243
+ }
244
+ newlineIndex = buffer.indexOf("\n");
245
+ }
246
+ };
247
+ }
248
+ var AdhMuxControlClient = class {
249
+ endpoint;
250
+ socket = null;
251
+ waiters = /* @__PURE__ */ new Map();
252
+ eventListeners = /* @__PURE__ */ new Set();
253
+ constructor(workspaceName) {
254
+ this.endpoint = getWorkspaceControlEndpoint(workspaceName);
255
+ }
256
+ async connect() {
257
+ if (this.socket && !this.socket.destroyed) return;
258
+ const socket = import_net.default.createConnection(this.endpoint.path);
259
+ this.socket = socket;
260
+ socket.on("data", createControlLineParser((envelope) => {
261
+ if (envelope.kind === "response") {
262
+ const waiter = this.waiters.get(envelope.requestId);
263
+ if (!waiter) return;
264
+ this.waiters.delete(envelope.requestId);
265
+ waiter.resolve(envelope.response);
266
+ return;
267
+ }
268
+ if (envelope.kind === "event") {
269
+ for (const listener of this.eventListeners) listener(envelope.event);
270
+ }
271
+ }));
272
+ socket.on("error", (error) => {
273
+ for (const waiter of this.waiters.values()) {
274
+ waiter.reject(error);
275
+ }
276
+ this.waiters.clear();
277
+ });
278
+ await new Promise((resolve, reject) => {
279
+ socket.once("connect", () => resolve());
280
+ socket.once("error", reject);
281
+ });
282
+ }
283
+ async request(request) {
284
+ await this.connect();
285
+ if (!this.socket) throw new Error("adhmux control socket unavailable");
286
+ const requestId = `${Date.now()}-${Math.random().toString(36).slice(2)}`;
287
+ const envelope = { kind: "request", requestId, request };
288
+ const response = await new Promise((resolve, reject) => {
289
+ this.waiters.set(requestId, { resolve, reject });
290
+ this.socket?.write(serializeEnvelope(envelope));
291
+ });
292
+ return response;
293
+ }
294
+ onEvent(listener) {
295
+ this.eventListeners.add(listener);
296
+ return () => {
297
+ this.eventListeners.delete(listener);
298
+ };
299
+ }
300
+ async close() {
301
+ if (!this.socket) return;
302
+ const socket = this.socket;
303
+ this.socket = null;
304
+ for (const waiter of this.waiters.values()) {
305
+ waiter.reject(new Error("adhmux control client closed"));
306
+ }
307
+ this.waiters.clear();
308
+ await new Promise((resolve) => {
309
+ let settled = false;
310
+ const done = () => {
311
+ if (settled) return;
312
+ settled = true;
313
+ resolve();
314
+ };
315
+ socket.once("close", done);
316
+ socket.end();
317
+ socket.destroy();
318
+ setTimeout(done, 50);
319
+ });
320
+ }
321
+ };
322
+ async function withAdhMuxControlClient(workspaceName, fn) {
323
+ const client = new AdhMuxControlClient(workspaceName);
324
+ try {
325
+ return await fn(client);
326
+ } finally {
327
+ await client.close();
328
+ }
329
+ }
330
+ var AdhMuxControlServer = class {
331
+ endpoint;
332
+ sockets = /* @__PURE__ */ new Set();
333
+ server;
334
+ constructor(workspaceName, handle) {
335
+ this.endpoint = getWorkspaceControlEndpoint(workspaceName);
336
+ if (this.endpoint.kind === "unix" && import_fs2.default.existsSync(this.endpoint.path)) {
337
+ import_fs2.default.unlinkSync(this.endpoint.path);
338
+ }
339
+ this.server = import_net.default.createServer((socket) => {
340
+ this.sockets.add(socket);
341
+ socket.on("close", () => {
342
+ this.sockets.delete(socket);
343
+ });
344
+ socket.on("data", createControlLineParser(async (envelope) => {
345
+ if (envelope.kind !== "request") return;
346
+ const response = await handle(envelope.request).catch((error) => ({
347
+ success: false,
348
+ error: error?.message || String(error)
349
+ }));
350
+ socket.write(
351
+ serializeEnvelope({
352
+ kind: "response",
353
+ requestId: envelope.requestId,
354
+ response
355
+ })
356
+ );
357
+ }));
358
+ });
359
+ this.server.listen(this.endpoint.path);
360
+ this.server.on("close", () => {
361
+ if (this.endpoint.kind === "unix" && import_fs2.default.existsSync(this.endpoint.path)) {
362
+ import_fs2.default.unlinkSync(this.endpoint.path);
363
+ }
364
+ });
365
+ }
366
+ broadcast(event) {
367
+ const envelope = serializeEnvelope({ kind: "event", event });
368
+ for (const socket of this.sockets) {
369
+ if (!socket.destroyed) socket.write(envelope);
370
+ }
371
+ }
372
+ close() {
373
+ this.server.close();
374
+ }
375
+ };
376
+ function createAdhMuxControlServer(workspaceName, handle) {
377
+ return new AdhMuxControlServer(workspaceName, handle);
378
+ }
379
+
380
+ // src/api.ts
381
+ function isControlSocketUnavailable(error) {
382
+ const message = error instanceof Error ? error.message : String(error);
383
+ return /ENOENT|ECONNREFUSED|EPIPE|socket/i.test(message);
384
+ }
385
+ async function requestWorkspaceControl(workspaceName, request) {
386
+ try {
387
+ return await withAdhMuxControlClient(workspaceName, (client) => client.request(request));
388
+ } catch (error) {
389
+ if (isControlSocketUnavailable(error)) return null;
390
+ throw error;
391
+ }
392
+ }
393
+ async function getWorkspaceState(workspaceName) {
394
+ return requestWorkspaceControl(workspaceName, { type: "workspace_state" });
395
+ }
396
+ async function getWorkspaceSocketInfo(workspaceName) {
397
+ const endpoint = getWorkspaceControlEndpoint(workspaceName);
398
+ const client = new AdhMuxControlClient(workspaceName);
399
+ try {
400
+ await client.connect();
401
+ return { workspaceName, live: true, endpoint };
402
+ } catch (error) {
403
+ if (isControlSocketUnavailable(error)) {
404
+ return { workspaceName, live: false, endpoint };
405
+ }
406
+ throw error;
407
+ } finally {
408
+ await client.close().catch(() => {
409
+ });
410
+ }
411
+ }
412
+ // Annotate the CommonJS export names for ESM import in node:
413
+ 0 && (module.exports = {
414
+ AdhMuxControlClient,
415
+ AdhMuxControlServer,
416
+ TerminalMuxStorage,
417
+ buildWorkspaceName,
418
+ createAdhMuxControlServer,
419
+ getRootDir,
420
+ getWorkspaceControlEndpoint,
421
+ getWorkspaceSocketInfo,
422
+ getWorkspaceState,
423
+ requestWorkspaceControl,
424
+ sanitizeWorkspaceName,
425
+ toWorkspaceRef,
426
+ withAdhMuxControlClient
427
+ });
@@ -0,0 +1,34 @@
1
+ import {
2
+ getWorkspaceSocketInfo,
3
+ getWorkspaceState,
4
+ requestWorkspaceControl
5
+ } from "./chunk-R4EFW6W3.mjs";
6
+ import {
7
+ AdhMuxControlClient,
8
+ AdhMuxControlServer,
9
+ createAdhMuxControlServer,
10
+ withAdhMuxControlClient
11
+ } from "./chunk-XZWWVN5W.mjs";
12
+ import {
13
+ TerminalMuxStorage,
14
+ buildWorkspaceName,
15
+ getRootDir,
16
+ getWorkspaceControlEndpoint,
17
+ sanitizeWorkspaceName,
18
+ toWorkspaceRef
19
+ } from "./chunk-7RNMRPVZ.mjs";
20
+ export {
21
+ AdhMuxControlClient,
22
+ AdhMuxControlServer,
23
+ TerminalMuxStorage,
24
+ buildWorkspaceName,
25
+ createAdhMuxControlServer,
26
+ getRootDir,
27
+ getWorkspaceControlEndpoint,
28
+ getWorkspaceSocketInfo,
29
+ getWorkspaceState,
30
+ requestWorkspaceControl,
31
+ sanitizeWorkspaceName,
32
+ toWorkspaceRef,
33
+ withAdhMuxControlClient
34
+ };
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@adhdev/terminal-mux-control",
3
+ "private": true,
4
+ "main": "./index.js",
5
+ "module": "./index.mjs",
6
+ "types": "./index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./index.d.ts",
10
+ "import": "./index.mjs",
11
+ "require": "./index.js",
12
+ "default": "./index.js"
13
+ },
14
+ "./api": {
15
+ "types": "./api.d.ts",
16
+ "import": "./api.mjs",
17
+ "require": "./api.js",
18
+ "default": "./api.js"
19
+ },
20
+ "./storage": {
21
+ "types": "./storage.d.ts",
22
+ "import": "./storage.mjs",
23
+ "require": "./storage.js",
24
+ "default": "./storage.js"
25
+ },
26
+ "./control-socket": {
27
+ "types": "./control-socket.d.ts",
28
+ "import": "./control-socket.mjs",
29
+ "require": "./control-socket.js",
30
+ "default": "./control-socket.js"
31
+ }
32
+ }
33
+ }
@@ -0,0 +1,49 @@
1
+ import { PersistedMuxWorkspaceState } from '@adhdev/terminal-mux-core';
2
+
3
+ interface StoredWorkspaceInfo {
4
+ name: string;
5
+ title: string;
6
+ paneCount: number;
7
+ updatedAt: number;
8
+ }
9
+ interface StoredSessionInfo {
10
+ name: string;
11
+ title: string;
12
+ windowCount: number;
13
+ updatedAt: number;
14
+ activeWindowName: string;
15
+ }
16
+ declare function getRootDir(): string;
17
+ declare function sanitizeWorkspaceName(name: string): string;
18
+ interface WorkspaceRef {
19
+ sessionName: string;
20
+ windowName: string;
21
+ workspaceName: string;
22
+ }
23
+ declare function toWorkspaceRef(name: string): WorkspaceRef;
24
+ declare function buildWorkspaceName(sessionName: string, windowName: string): string;
25
+ interface WorkspaceControlEndpoint {
26
+ kind: 'unix' | 'pipe';
27
+ path: string;
28
+ }
29
+ declare function getWorkspaceControlEndpoint(name: string): WorkspaceControlEndpoint;
30
+ declare class TerminalMuxStorage {
31
+ private readonly workspacesDir;
32
+ private readonly statePath;
33
+ listWorkspaceNames(): string[];
34
+ listWorkspaces(): StoredWorkspaceInfo[];
35
+ listSessions(): StoredSessionInfo[];
36
+ listSessionWindows(sessionName: string): StoredWorkspaceInfo[];
37
+ resolveSessionWindowWorkspace(sessionName: string, windowName?: string): string | null;
38
+ loadWorkspace(name: string): PersistedMuxWorkspaceState | null;
39
+ saveWorkspace(name: string, workspace: PersistedMuxWorkspaceState): void;
40
+ renameWorkspace(fromName: string, toName: string): void;
41
+ deleteWorkspace(name: string): void;
42
+ getLastWorkspace(): string | null;
43
+ setLastWorkspace(name: string): void;
44
+ private getWorkspacePath;
45
+ private loadClientState;
46
+ private saveClientState;
47
+ }
48
+
49
+ export { type StoredSessionInfo, type StoredWorkspaceInfo, TerminalMuxStorage, type WorkspaceControlEndpoint, type WorkspaceRef, buildWorkspaceName, getRootDir, getWorkspaceControlEndpoint, sanitizeWorkspaceName, toWorkspaceRef };
@@ -0,0 +1,49 @@
1
+ import { PersistedMuxWorkspaceState } from '@adhdev/terminal-mux-core';
2
+
3
+ interface StoredWorkspaceInfo {
4
+ name: string;
5
+ title: string;
6
+ paneCount: number;
7
+ updatedAt: number;
8
+ }
9
+ interface StoredSessionInfo {
10
+ name: string;
11
+ title: string;
12
+ windowCount: number;
13
+ updatedAt: number;
14
+ activeWindowName: string;
15
+ }
16
+ declare function getRootDir(): string;
17
+ declare function sanitizeWorkspaceName(name: string): string;
18
+ interface WorkspaceRef {
19
+ sessionName: string;
20
+ windowName: string;
21
+ workspaceName: string;
22
+ }
23
+ declare function toWorkspaceRef(name: string): WorkspaceRef;
24
+ declare function buildWorkspaceName(sessionName: string, windowName: string): string;
25
+ interface WorkspaceControlEndpoint {
26
+ kind: 'unix' | 'pipe';
27
+ path: string;
28
+ }
29
+ declare function getWorkspaceControlEndpoint(name: string): WorkspaceControlEndpoint;
30
+ declare class TerminalMuxStorage {
31
+ private readonly workspacesDir;
32
+ private readonly statePath;
33
+ listWorkspaceNames(): string[];
34
+ listWorkspaces(): StoredWorkspaceInfo[];
35
+ listSessions(): StoredSessionInfo[];
36
+ listSessionWindows(sessionName: string): StoredWorkspaceInfo[];
37
+ resolveSessionWindowWorkspace(sessionName: string, windowName?: string): string | null;
38
+ loadWorkspace(name: string): PersistedMuxWorkspaceState | null;
39
+ saveWorkspace(name: string, workspace: PersistedMuxWorkspaceState): void;
40
+ renameWorkspace(fromName: string, toName: string): void;
41
+ deleteWorkspace(name: string): void;
42
+ getLastWorkspace(): string | null;
43
+ setLastWorkspace(name: string): void;
44
+ private getWorkspacePath;
45
+ private loadClientState;
46
+ private saveClientState;
47
+ }
48
+
49
+ export { type StoredSessionInfo, type StoredWorkspaceInfo, TerminalMuxStorage, type WorkspaceControlEndpoint, type WorkspaceRef, buildWorkspaceName, getRootDir, getWorkspaceControlEndpoint, sanitizeWorkspaceName, toWorkspaceRef };