tmux-ide 2.9.20 → 2.9.22
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/bin/cli.js +16998 -4283
- package/package.json +3 -2
- package/packages/contracts/src/command-catalog.ts +116 -0
- package/packages/contracts/src/commands.ts +5 -4
- package/packages/contracts/src/daemon-events.ts +2 -1
- package/packages/contracts/src/index.ts +3 -0
- package/packages/contracts/src/pane-reader.ts +121 -0
- package/packages/contracts/src/pane-stream.ts +18 -0
- package/packages/contracts/src/plain-text.ts +61 -0
- package/packages/contracts/src/visual-theme-presets.ts +58 -2
- package/packages/daemon/dist/command-center/command-catalog-routes.js +78 -0
- package/packages/daemon/dist/command-center/plugin-routes.js +84 -0
- package/packages/daemon/dist/command-center/server.js +13 -0
- package/packages/daemon/dist/command-center/tmux-server-reader.js +41 -0
- package/packages/daemon/dist/command-center/tmux-servers.js +6 -0
- package/packages/daemon/dist/doctor.js +106 -43
- package/packages/daemon/dist/lib/cli-action-bridge.js +15 -0
- package/packages/daemon/dist/lib/cli-command.js +13 -0
- package/packages/daemon/dist/lib/daemon-embed.js +39 -1
- package/packages/daemon/dist/lib/headless-daemon.js +1 -0
- package/packages/daemon/dist/lib/pane-reader-files.js +226 -0
- package/packages/daemon/dist/lib/remote-tmux-command.js +8 -5
- package/packages/daemon/dist/lib/tmux-client-execution.js +73 -7
- package/packages/daemon/dist/lib/tmux-pane-reader.js +105 -0
- package/packages/daemon/dist/lib/tmux-server-features.js +38 -0
- package/packages/daemon/dist/lib/tmux-server-owner.js +9 -0
- package/packages/daemon/dist/lib/worktree.js +18 -0
- package/packages/daemon/dist/native/TmuxIdeNotifier.app/Contents/Info.plist +2 -2
- package/packages/daemon/dist/native/TmuxIdeNotifier.app/Contents/MacOS/tmux-ide-notifier +0 -0
- package/packages/daemon/dist/native/TmuxIdeNotifier.app/Contents/Resources/Assets.car +0 -0
- package/packages/daemon/dist/native/TmuxIdeNotifier.app/Contents/_CodeSignature/CodeResources +2 -2
- package/packages/daemon/dist/open-browser.js +26 -12
- package/packages/daemon/dist/open-reader.js +84 -0
- package/packages/daemon/dist/plugins/action-catalog.js +129 -0
- package/packages/daemon/dist/plugins/action-cli.js +212 -0
- package/packages/daemon/dist/plugins/api-table.js +303 -0
- package/packages/daemon/dist/plugins/cli.js +556 -0
- package/packages/daemon/dist/plugins/consent.js +107 -0
- package/packages/daemon/dist/plugins/daemon-plugins.js +124 -0
- package/packages/daemon/dist/plugins/discovery.js +142 -0
- package/packages/daemon/dist/plugins/examples/worktree-tasks.js +115 -0
- package/packages/daemon/dist/plugins/exec-sandbox.js +202 -0
- package/packages/daemon/dist/plugins/host/actions-prelude.js +279 -0
- package/packages/daemon/dist/plugins/host/entry.js +4 -0
- package/packages/daemon/dist/plugins/host/host-api-prelude.js +232 -0
- package/packages/daemon/dist/plugins/host/lua-state.js +493 -0
- package/packages/daemon/dist/plugins/host/main.js +322 -0
- package/packages/daemon/dist/plugins/host/sandbox.js +299 -0
- package/packages/daemon/dist/plugins/host-calls.js +279 -0
- package/packages/daemon/dist/plugins/manifest.js +69 -0
- package/packages/daemon/dist/plugins/plugin-exec.js +261 -0
- package/packages/daemon/dist/plugins/plugin-log.js +54 -0
- package/packages/daemon/dist/plugins/plugin-store.js +74 -0
- package/packages/daemon/dist/plugins/protocol.js +252 -0
- package/packages/daemon/dist/plugins/safe-files.js +97 -0
- package/packages/daemon/dist/plugins/supervisor.js +790 -0
- package/packages/daemon/dist/plugins/worktree-calls.js +154 -0
- package/packages/daemon/dist/restore.js +57 -40
- package/packages/daemon/dist/terminal/mirror/session-channel.js +4 -1
- package/packages/daemon/dist/terminal/pane-stream/pane-stream-websocket.js +12 -3
- package/packages/daemon/dist/terminal/protocol/reader-option.js +66 -0
- package/packages/daemon/dist/terminal/protocol/session-descriptor-discovery.js +7 -2
- package/packages/daemon/dist/tmux-upgrade/cli.js +106 -0
- package/packages/daemon/dist/tmux-upgrade/io.js +540 -0
- package/packages/daemon/dist/tmux-upgrade/plan.js +238 -0
- package/packages/daemon/dist/tmux-upgrade/run.js +199 -0
- package/packages/daemon/dist/tui/chrome/snapshot.js +3 -4
- package/packages/daemon/dist/tui/mirror/runtime/application-home-agent-navigation.js +64 -4
- package/packages/daemon/dist/tui/mirror/runtime/application-home-agents-owner.js +62 -5
- package/packages/daemon/dist/tui/mirror/runtime/application-home-experience.js +2 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-machine-agent-navigation.js +12 -8
- package/packages/daemon/dist/tui/mirror/runtime/application-palette-command-owner.js +30 -2
- package/packages/daemon/dist/tui/mirror/runtime/application-plugin-commands.js +152 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-plugin-form.js +251 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-interaction-controller.js +125 -111
- package/packages/daemon/dist/tui/mirror/workspace/application-command-description.js +14 -0
- package/packages/daemon/dist/tui/mirror/workspace/palette-list-layout.js +5 -0
- package/packages/daemon/src/command-center/command-catalog-routes.ts +116 -0
- package/packages/daemon/src/command-center/plugin-routes.ts +110 -0
- package/packages/daemon/src/command-center/server.ts +15 -0
- package/packages/daemon/src/command-center/tmux-server-reader.ts +62 -0
- package/packages/daemon/src/command-center/tmux-servers.ts +6 -0
- package/packages/daemon/src/doctor.ts +118 -45
- package/packages/daemon/src/lib/cli-action-bridge.ts +19 -0
- package/packages/daemon/src/lib/cli-command.ts +16 -0
- package/packages/daemon/src/lib/daemon-embed.ts +59 -0
- package/packages/daemon/src/lib/headless-daemon.ts +1 -0
- package/packages/daemon/src/lib/pane-reader-files.ts +294 -0
- package/packages/daemon/src/lib/remote-tmux-command.ts +13 -6
- package/packages/daemon/src/lib/tmux-client-execution.ts +79 -7
- package/packages/daemon/src/lib/tmux-pane-reader.ts +144 -0
- package/packages/daemon/src/lib/tmux-server-features.ts +43 -0
- package/packages/daemon/src/lib/tmux-server-owner.ts +9 -0
- package/packages/daemon/src/lib/worktree.ts +16 -0
- package/packages/daemon/src/open-browser.ts +59 -18
- package/packages/daemon/src/open-reader.ts +148 -0
- package/packages/daemon/src/plugins/action-catalog.ts +141 -0
- package/packages/daemon/src/plugins/action-cli.ts +248 -0
- package/packages/daemon/src/plugins/api-table.ts +346 -0
- package/packages/daemon/src/plugins/cli.ts +630 -0
- package/packages/daemon/src/plugins/consent.ts +125 -0
- package/packages/daemon/src/plugins/daemon-plugins.ts +172 -0
- package/packages/daemon/src/plugins/discovery.ts +176 -0
- package/packages/daemon/src/plugins/examples/worktree-tasks.ts +120 -0
- package/packages/daemon/src/plugins/exec-sandbox.ts +264 -0
- package/packages/daemon/src/plugins/host/actions-prelude.ts +280 -0
- package/packages/daemon/src/plugins/host/entry.ts +5 -0
- package/packages/daemon/src/plugins/host/host-api-prelude.ts +233 -0
- package/packages/daemon/src/plugins/host/lua-state.ts +557 -0
- package/packages/daemon/src/plugins/host/main.ts +359 -0
- package/packages/daemon/src/plugins/host/sandbox.ts +301 -0
- package/packages/daemon/src/plugins/host-calls.ts +343 -0
- package/packages/daemon/src/plugins/manifest.ts +74 -0
- package/packages/daemon/src/plugins/plugin-exec.ts +326 -0
- package/packages/daemon/src/plugins/plugin-log.ts +63 -0
- package/packages/daemon/src/plugins/plugin-store.ts +80 -0
- package/packages/daemon/src/plugins/protocol.ts +275 -0
- package/packages/daemon/src/plugins/safe-files.ts +105 -0
- package/packages/daemon/src/plugins/supervisor.ts +954 -0
- package/packages/daemon/src/plugins/worktree-calls.ts +183 -0
- package/packages/daemon/src/restore.ts +80 -44
- package/packages/daemon/src/terminal/mirror/events.ts +2 -0
- package/packages/daemon/src/terminal/mirror/session-channel.ts +6 -1
- package/packages/daemon/src/terminal/pane-stream/pane-stream-websocket.ts +15 -2
- package/packages/daemon/src/terminal/protocol/reader-option.ts +77 -0
- package/packages/daemon/src/terminal/protocol/session-descriptor-discovery.ts +10 -1
- package/packages/daemon/src/tmux-upgrade/cli.ts +118 -0
- package/packages/daemon/src/tmux-upgrade/io.ts +596 -0
- package/packages/daemon/src/tmux-upgrade/plan.ts +353 -0
- package/packages/daemon/src/tmux-upgrade/run.ts +325 -0
- package/packages/daemon/src/tui/chrome/snapshot.ts +3 -4
- package/packages/daemon/src/tui/mirror/runtime/application-fleet-switcher.tsx +3 -1
- package/packages/daemon/src/tui/mirror/runtime/application-home-agent-navigation.ts +110 -10
- package/packages/daemon/src/tui/mirror/runtime/application-home-agents-owner.ts +90 -6
- package/packages/daemon/src/tui/mirror/runtime/application-home-experience.ts +2 -0
- package/packages/daemon/src/tui/mirror/runtime/application-machine-agent-navigation.ts +20 -9
- package/packages/daemon/src/tui/mirror/runtime/application-palette-command-owner.ts +42 -2
- package/packages/daemon/src/tui/mirror/runtime/application-palette-preview.tsx +7 -1
- package/packages/daemon/src/tui/mirror/runtime/application-plugin-commands.ts +229 -0
- package/packages/daemon/src/tui/mirror/runtime/application-plugin-form.ts +312 -0
- package/packages/daemon/src/tui/mirror/runtime/application-root-v2.tsx +2 -2
- package/packages/daemon/src/tui/mirror/runtime/application-terminal-interaction-controller.ts +149 -128
- package/packages/daemon/src/tui/mirror/workspace/application-command-description.ts +44 -2
- package/packages/daemon/src/tui/mirror/workspace/palette-list-layout.ts +4 -0
- package/packages/tmux-bridge/src/runner.ts +3 -1
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { closeSync, constants, fstatSync, lstatSync, openSync, readSync, realpathSync, statSync, } from "node:fs";
|
|
3
|
+
import { dirname, extname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
4
|
+
import { PANE_READER_ASSET_MAX_BYTES, PANE_READER_MAX_BYTES, PANE_READER_PAGE_BYTES, hasControlCharacter, } from "@tmux-ide/contracts";
|
|
5
|
+
import { isMarkdownPath } from "../terminal/protocol/reader-option.js";
|
|
6
|
+
const IMAGE_MIME = {
|
|
7
|
+
".png": "image/png",
|
|
8
|
+
".jpg": "image/jpeg",
|
|
9
|
+
".jpeg": "image/jpeg",
|
|
10
|
+
".gif": "image/gif",
|
|
11
|
+
".webp": "image/webp",
|
|
12
|
+
".svg": "image/svg+xml",
|
|
13
|
+
};
|
|
14
|
+
function revisionOf(stat) {
|
|
15
|
+
return createHash("sha256")
|
|
16
|
+
.update(`${stat.dev}:${stat.ino}:${stat.size}:${stat.mtimeNs}:${stat.ctimeNs}`)
|
|
17
|
+
.digest("hex")
|
|
18
|
+
.slice(0, 32);
|
|
19
|
+
}
|
|
20
|
+
function missingError(error) {
|
|
21
|
+
const code = error?.code;
|
|
22
|
+
return code === "ENOENT" || code === "ENOTDIR" || code === "ELOOP" || code === "EISDIR";
|
|
23
|
+
}
|
|
24
|
+
function realpathOrNull(path) {
|
|
25
|
+
try {
|
|
26
|
+
return realpathSync(path);
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
if (missingError(error))
|
|
30
|
+
return null;
|
|
31
|
+
throw error;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/** Equal to or below `root`, compared by path segments rather than by string prefix. */
|
|
35
|
+
export function isInside(root, path) {
|
|
36
|
+
const rel = relative(root, path);
|
|
37
|
+
return rel === "" || (!isAbsolute(rel) && rel !== ".." && !rel.startsWith(`..${sep}`));
|
|
38
|
+
}
|
|
39
|
+
/** The nearest ancestor of `directory` holding a `.git` entry; no git process is run. */
|
|
40
|
+
export function gitRoot(directory) {
|
|
41
|
+
for (let current = directory;;) {
|
|
42
|
+
try {
|
|
43
|
+
lstatSync(join(current, ".git"));
|
|
44
|
+
return current;
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
/* keep walking up */
|
|
48
|
+
}
|
|
49
|
+
const parent = dirname(current);
|
|
50
|
+
if (parent === current)
|
|
51
|
+
return null;
|
|
52
|
+
current = parent;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const NO_SEAMS = Object.freeze({});
|
|
56
|
+
/**
|
|
57
|
+
* Opens `real` (already resolved) without following a swapped-in final
|
|
58
|
+
* symlink, and only as a regular file. Then proves the descriptor is still the
|
|
59
|
+
* file at that real path: a fresh stat of the path, following every symlink on
|
|
60
|
+
* it, names the same device and inode as the open descriptor. A path or a
|
|
61
|
+
* folder on it swapped between resolving and opening is refused ("swapped").
|
|
62
|
+
* No separate realpath check is needed: whatever the path now resolves to,
|
|
63
|
+
* the stat proves the open file is the one it leads to.
|
|
64
|
+
*/
|
|
65
|
+
function openRegular(real, seams) {
|
|
66
|
+
let fd;
|
|
67
|
+
try {
|
|
68
|
+
fd = openSync(real, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
if (missingError(error))
|
|
72
|
+
return null;
|
|
73
|
+
throw error;
|
|
74
|
+
}
|
|
75
|
+
const stat = fstatSync(fd, { bigint: true });
|
|
76
|
+
if (!stat.isFile()) {
|
|
77
|
+
closeSync(fd);
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
seams.afterOpen?.();
|
|
81
|
+
let now = null;
|
|
82
|
+
try {
|
|
83
|
+
now = statSync(real, { bigint: true });
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
if (!missingError(error)) {
|
|
87
|
+
closeSync(fd);
|
|
88
|
+
throw error;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (!now || now.dev !== stat.dev || now.ino !== stat.ino) {
|
|
92
|
+
closeSync(fd);
|
|
93
|
+
return "swapped";
|
|
94
|
+
}
|
|
95
|
+
return { fd, stat };
|
|
96
|
+
}
|
|
97
|
+
function readChunk(fd, offset, size) {
|
|
98
|
+
const length = Math.max(0, Math.min(PANE_READER_PAGE_BYTES, size - offset));
|
|
99
|
+
const buffer = Buffer.alloc(length);
|
|
100
|
+
let done = 0;
|
|
101
|
+
while (done < length) {
|
|
102
|
+
const read = readSync(fd, buffer, done, length - done, offset + done);
|
|
103
|
+
if (read === 0)
|
|
104
|
+
break;
|
|
105
|
+
done += read;
|
|
106
|
+
}
|
|
107
|
+
return buffer.subarray(0, done);
|
|
108
|
+
}
|
|
109
|
+
/** One page of `opened`, re-checking after the read that the file did not change. */
|
|
110
|
+
function page(opened, limit, have, request, seams) {
|
|
111
|
+
const revision = revisionOf(opened.stat);
|
|
112
|
+
const size = Number(opened.stat.size);
|
|
113
|
+
if (size > limit)
|
|
114
|
+
return { state: "too_large", revision, size };
|
|
115
|
+
if (request) {
|
|
116
|
+
if (request.revision !== revision || request.offset > size)
|
|
117
|
+
return { state: "changed" };
|
|
118
|
+
}
|
|
119
|
+
else if (have === revision)
|
|
120
|
+
return { state: "unchanged", revision };
|
|
121
|
+
const offset = request?.offset ?? 0;
|
|
122
|
+
const bytes = seams.read
|
|
123
|
+
? seams.read(opened.fd, offset, size, readChunk)
|
|
124
|
+
: readChunk(opened.fd, offset, size);
|
|
125
|
+
const after = fstatSync(opened.fd, { bigint: true });
|
|
126
|
+
if (revisionOf(after) !== revision ||
|
|
127
|
+
bytes.length !== Math.min(PANE_READER_PAGE_BYTES, size - offset))
|
|
128
|
+
return { state: "changed" };
|
|
129
|
+
return { state: "ok", revision, size, offset, chunk: bytes.toString("base64") };
|
|
130
|
+
}
|
|
131
|
+
/** A page of the Markdown file at `path`; its real path must still be Markdown. */
|
|
132
|
+
export function readReaderPage(path, have, request, seams = NO_SEAMS) {
|
|
133
|
+
// A whole-file read retries once if the file changed underneath it.
|
|
134
|
+
for (let attempt = 0;; attempt++) {
|
|
135
|
+
const real = realpathOrNull(path);
|
|
136
|
+
if (!real || !isMarkdownPath(real))
|
|
137
|
+
return { state: "missing" };
|
|
138
|
+
const opened = openRegular(real, seams);
|
|
139
|
+
if (!opened || opened === "swapped") {
|
|
140
|
+
// A document swapped mid-open reads again once, then reports changed.
|
|
141
|
+
if (opened === "swapped" && !request && attempt === 0)
|
|
142
|
+
continue;
|
|
143
|
+
return opened === "swapped" ? { state: "changed" } : { state: "missing" };
|
|
144
|
+
}
|
|
145
|
+
try {
|
|
146
|
+
const result = page(opened, PANE_READER_MAX_BYTES, have, request, seams);
|
|
147
|
+
if (result.state !== "changed" || request || attempt > 0)
|
|
148
|
+
return result;
|
|
149
|
+
}
|
|
150
|
+
finally {
|
|
151
|
+
closeSync(opened.fd);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
const SCHEME = /^[a-z][a-z0-9+.-]*:/iu;
|
|
156
|
+
/** The decoded relative path `src` names, or null when the reader must not follow it. */
|
|
157
|
+
export function localImageReference(src) {
|
|
158
|
+
if (src.includes("\0") || SCHEME.test(src) || src.startsWith("//") || src.startsWith("\\"))
|
|
159
|
+
return null;
|
|
160
|
+
const bare = src.split(/[?#]/u, 1)[0] ?? "";
|
|
161
|
+
let decoded;
|
|
162
|
+
try {
|
|
163
|
+
decoded = decodeURIComponent(bare);
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
return null;
|
|
167
|
+
}
|
|
168
|
+
if (!decoded ||
|
|
169
|
+
hasControlCharacter(decoded) ||
|
|
170
|
+
decoded.startsWith("/") ||
|
|
171
|
+
decoded.startsWith("~") ||
|
|
172
|
+
decoded.startsWith("\\") ||
|
|
173
|
+
isAbsolute(decoded))
|
|
174
|
+
return null;
|
|
175
|
+
return decoded;
|
|
176
|
+
}
|
|
177
|
+
function imageMime(path) {
|
|
178
|
+
return IMAGE_MIME[extname(path).toLowerCase()] ?? null;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* A page of the image `src` names, relative to the Markdown file at `markdown`.
|
|
182
|
+
* Allowed only inside the file's git repository, or its folder when there is
|
|
183
|
+
* none, after every symlink is resolved.
|
|
184
|
+
*/
|
|
185
|
+
export function readReaderAssetPage(markdown, src, request, seams = NO_SEAMS) {
|
|
186
|
+
const reference = localImageReference(src);
|
|
187
|
+
if (reference === null)
|
|
188
|
+
return { state: "refused" };
|
|
189
|
+
const document = realpathOrNull(markdown);
|
|
190
|
+
if (!document || !isMarkdownPath(document))
|
|
191
|
+
return { state: "missing" };
|
|
192
|
+
const base = dirname(document);
|
|
193
|
+
const root = gitRoot(base) ?? base;
|
|
194
|
+
const candidate = resolve(base, reference);
|
|
195
|
+
// Refuse outside paths before touching the file system, so the answer never
|
|
196
|
+
// says whether a file outside the root exists.
|
|
197
|
+
if (!isInside(root, candidate) || !imageMime(candidate))
|
|
198
|
+
return { state: "refused" };
|
|
199
|
+
const real = realpathOrNull(candidate);
|
|
200
|
+
if (!real)
|
|
201
|
+
return { state: "missing" };
|
|
202
|
+
const mime = imageMime(real);
|
|
203
|
+
if (!isInside(root, real) || !mime)
|
|
204
|
+
return { state: "refused" };
|
|
205
|
+
const opened = openRegular(real, seams);
|
|
206
|
+
if (opened === "swapped")
|
|
207
|
+
return { state: "refused" };
|
|
208
|
+
if (!opened)
|
|
209
|
+
return { state: "missing" };
|
|
210
|
+
try {
|
|
211
|
+
// The name as written must still lead to the file that was opened.
|
|
212
|
+
if (realpathOrNull(candidate) !== real)
|
|
213
|
+
return { state: "refused" };
|
|
214
|
+
const result = page(opened, PANE_READER_ASSET_MAX_BYTES, null, request, seams);
|
|
215
|
+
if (result.state === "unchanged")
|
|
216
|
+
return { state: "changed" };
|
|
217
|
+
if (result.state === "too_large")
|
|
218
|
+
return { state: "too_large" };
|
|
219
|
+
if (result.state === "changed")
|
|
220
|
+
return result;
|
|
221
|
+
return { ...result, mime };
|
|
222
|
+
}
|
|
223
|
+
finally {
|
|
224
|
+
closeSync(opened.fd);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { shellEscape } from "./shell.js";
|
|
2
|
+
// Respect the host's existing installation preference, then try the installer
|
|
3
|
+
// and common package-manager prefixes. Never source shell profiles.
|
|
4
|
+
const REMOTE_PATH = 'export PATH="${PATH:-/usr/bin:/bin}:$HOME/.local/bin:/opt/homebrew/bin:/usr/local/bin:/home/linuxbrew/.linuxbrew/bin:$HOME/.npm-global/bin"; ';
|
|
2
5
|
/** Fixed commands only. SSH normally omits interactive shell PATH setup. */
|
|
3
6
|
export function remoteTmuxIdeCommand(operation) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
return remoteTmuxIdeArgsCommand(operation === "discover" ? ["remote-daemon-info", "--json"] : ["update", "--daemon", "--json"]);
|
|
8
|
+
}
|
|
9
|
+
/** `tmux-ide <args…>` on a remote host, each argument quoted for its shell. */
|
|
10
|
+
export function remoteTmuxIdeArgsCommand(args) {
|
|
11
|
+
const script = REMOTE_PATH + `exec tmux-ide ${args.map(shellEscape).join(" ")}`;
|
|
9
12
|
return `/bin/sh -c ${shellEscape(script)}`;
|
|
10
13
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { execFileSync } from "node:child_process";
|
|
1
2
|
import { fileURLToPath } from "node:url";
|
|
2
3
|
import { accessSync, constants, realpathSync, statSync } from "node:fs";
|
|
3
4
|
import { delimiter, isAbsolute, join, resolve } from "node:path";
|
|
@@ -58,9 +59,78 @@ export function tmuxClientEnvironment(source, executable) {
|
|
|
58
59
|
}
|
|
59
60
|
return { ...environment, ...bundledTmuxResourceEnvironment(executable) };
|
|
60
61
|
}
|
|
61
|
-
/**
|
|
62
|
-
|
|
62
|
+
/**
|
|
63
|
+
* The socket an ordinary tmux client reaches, or null inside tmux (where the
|
|
64
|
+
* server exists by definition). Ordinary clients pass no -S or -L in
|
|
65
|
+
* production, so this is tmux's own rule: $TMUX, else the default socket.
|
|
66
|
+
*/
|
|
67
|
+
export function ordinaryTargetSocket(environment) {
|
|
68
|
+
if (environment.TMUX)
|
|
69
|
+
return null;
|
|
70
|
+
const uid = process.getuid?.() ?? 0;
|
|
71
|
+
return join(environment.TMUX_TMPDIR || "/tmp", `tmux-${uid}`, "default");
|
|
72
|
+
}
|
|
73
|
+
const answering = new Set();
|
|
74
|
+
/**
|
|
75
|
+
* Does a server answer on this socket? A socket file alone is not enough: a
|
|
76
|
+
* server that crashed leaves one behind. `probe` asks with `list-sessions`,
|
|
77
|
+
* which never starts a server. A running server is remembered for the process.
|
|
78
|
+
*/
|
|
79
|
+
export function serverAnswers(socket, probe) {
|
|
80
|
+
if (answering.has(socket))
|
|
81
|
+
return true;
|
|
82
|
+
try {
|
|
83
|
+
if (!statSync(socket).isSocket())
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
try {
|
|
90
|
+
execFileSync(probe, ["-S", socket, "list-sessions", "-F", "#{pid}"], {
|
|
91
|
+
stdio: ["ignore", "ignore", "pipe"],
|
|
92
|
+
timeout: 3000,
|
|
93
|
+
env: withBundledTmuxResources(probe, process.env),
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
const stderr = String(error.stderr ?? "");
|
|
98
|
+
// A refused connection is a stale socket. Anything else (a protocol
|
|
99
|
+
// mismatch, a timeout) means something is there: keep the PATH client.
|
|
100
|
+
if (/no server running|error connecting|connection refused|no such file/iu.test(stderr))
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
answering.add(socket);
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Ordinary CLI commands retain PATH selection for a running server. When no
|
|
108
|
+
* server runs, the next command starts one, so bundled tmux goes first: a
|
|
109
|
+
* Homebrew client must not start a reduced-feature server (#766).
|
|
110
|
+
* TMUX_IDE_TMUX_BIN always wins.
|
|
111
|
+
*/
|
|
112
|
+
export function resolveOrdinaryTmuxClient(environment, cwd, options = {}) {
|
|
113
|
+
const bundled = options.bundled ??
|
|
114
|
+
(() => resolveBundledTmux([
|
|
115
|
+
...(environment.TMUX_IDE_CLI ? [environment.TMUX_IDE_CLI] : []),
|
|
116
|
+
fileURLToPath(import.meta.url),
|
|
117
|
+
]));
|
|
63
118
|
const configured = environment.TMUX_IDE_TMUX_BIN;
|
|
119
|
+
if (!configured) {
|
|
120
|
+
const socket = ordinaryTargetSocket(environment);
|
|
121
|
+
if (socket !== null) {
|
|
122
|
+
let starter = null;
|
|
123
|
+
try {
|
|
124
|
+
starter = bundled();
|
|
125
|
+
}
|
|
126
|
+
catch {
|
|
127
|
+
// An invalid bundle falls back to the PATH client below.
|
|
128
|
+
}
|
|
129
|
+
const running = options.serverRunning ?? ((at) => serverAnswers(at, starter));
|
|
130
|
+
if (starter && !running(socket))
|
|
131
|
+
return { executable: starter, environment: withBundledTmuxResources(starter, environment) };
|
|
132
|
+
}
|
|
133
|
+
}
|
|
64
134
|
const candidates = configured
|
|
65
135
|
? [configured]
|
|
66
136
|
: (environment.PATH ?? "/usr/bin:/bin")
|
|
@@ -83,11 +153,7 @@ export function resolveOrdinaryTmuxClient(environment, cwd) {
|
|
|
83
153
|
}
|
|
84
154
|
}
|
|
85
155
|
if (!executable && !configured)
|
|
86
|
-
executable =
|
|
87
|
-
resolveBundledTmux([
|
|
88
|
-
...(environment.TMUX_IDE_CLI ? [environment.TMUX_IDE_CLI] : []),
|
|
89
|
-
fileURLToPath(import.meta.url),
|
|
90
|
-
]) ?? undefined;
|
|
156
|
+
executable = bundled() ?? undefined;
|
|
91
157
|
if (!executable)
|
|
92
158
|
throw new Error("tmux_executable_unavailable");
|
|
93
159
|
return { executable, environment: withBundledTmuxResources(executable, environment) };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { basename, dirname } from "node:path";
|
|
2
|
+
import { PaneReaderAssetRequestSchemaZ, PaneReaderAssetResponseSchemaZ, PaneReaderRequestSchemaZ, PaneReaderResponseSchemaZ, } from "@tmux-ide/contracts";
|
|
3
|
+
import { decodeTmuxArgument } from "../terminal/protocol/session-descriptor-discovery.js";
|
|
4
|
+
import { readerOption } from "../terminal/protocol/reader-option.js";
|
|
5
|
+
import { readReaderAssetPage, readReaderPage } from "./pane-reader-files.js";
|
|
6
|
+
/** Any identity, liveness or option failure. Carries no path or detail. */
|
|
7
|
+
export class PaneReaderUnavailable extends Error {
|
|
8
|
+
constructor() {
|
|
9
|
+
super("The reader pane is unavailable");
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Serves only the file named by the target pane's `@tmux_ide_reader` option,
|
|
14
|
+
* for a pane whose identity is proven again before and after the read, and
|
|
15
|
+
* whose reader process is alive.
|
|
16
|
+
*/
|
|
17
|
+
export function createPaneReaderResolver(options) {
|
|
18
|
+
let readers = 0;
|
|
19
|
+
const withReader = async (target, cancellation, work) => {
|
|
20
|
+
const signal = AbortSignal.any([cancellation, AbortSignal.timeout(2500)]);
|
|
21
|
+
const workspace = options.registry.get(target.workspaceName);
|
|
22
|
+
const assertCurrent = () => {
|
|
23
|
+
options.assertOpen();
|
|
24
|
+
signal.throwIfAborted();
|
|
25
|
+
if (target.generation !== options.generation ||
|
|
26
|
+
!workspace ||
|
|
27
|
+
options.registry.get(target.workspaceName) !== workspace)
|
|
28
|
+
throw new PaneReaderUnavailable();
|
|
29
|
+
};
|
|
30
|
+
assertCurrent();
|
|
31
|
+
if (readers >= 8)
|
|
32
|
+
throw new PaneReaderUnavailable();
|
|
33
|
+
readers++;
|
|
34
|
+
try {
|
|
35
|
+
const sessions = await options.catalog();
|
|
36
|
+
assertCurrent();
|
|
37
|
+
const matching = sessions.filter((s) => s.liveSessionId === target.liveSessionId);
|
|
38
|
+
if (matching.length !== 1 || matching[0].sessionName !== workspace.sessionName)
|
|
39
|
+
throw new PaneReaderUnavailable();
|
|
40
|
+
const snapshot = await options.inventory.discoverTerminalInventory(signal);
|
|
41
|
+
assertCurrent();
|
|
42
|
+
if (snapshot.catalog.invalidRuntimeProof ||
|
|
43
|
+
snapshot.catalog.duplicateSemanticStamp ||
|
|
44
|
+
snapshot.catalog.duplicateRuntimePaneBinding)
|
|
45
|
+
throw new PaneReaderUnavailable();
|
|
46
|
+
const matches = snapshot.panes.filter((p) => p.workspaceName === target.workspaceName &&
|
|
47
|
+
p.semanticPaneId === target.semanticPaneId &&
|
|
48
|
+
p.sessionName === workspace.sessionName);
|
|
49
|
+
if (matches.length !== 1)
|
|
50
|
+
throw new PaneReaderUnavailable();
|
|
51
|
+
const pane = { ...matches[0] };
|
|
52
|
+
if (!pane.nativePaneBirthId || !/^%[0-9]+$/u.test(pane.runtimePaneId))
|
|
53
|
+
throw new PaneReaderUnavailable();
|
|
54
|
+
const observe = async () => {
|
|
55
|
+
const raw = await options.run([
|
|
56
|
+
"display-message",
|
|
57
|
+
"-p",
|
|
58
|
+
"-t",
|
|
59
|
+
pane.runtimePaneId,
|
|
60
|
+
"#{qa:@tmux_ide_pane_id}\t#{qa:pane_birth_id}\t#{pane_pid}\t#{qa:@tmux_ide_reader}",
|
|
61
|
+
], signal);
|
|
62
|
+
assertCurrent();
|
|
63
|
+
if (raw.length > 16_384)
|
|
64
|
+
throw new PaneReaderUnavailable();
|
|
65
|
+
const [semantic, birth, panePid, option] = raw
|
|
66
|
+
.trimEnd()
|
|
67
|
+
.split("\t")
|
|
68
|
+
.map(decodeTmuxArgument);
|
|
69
|
+
if (semantic !== target.semanticPaneId || birth !== pane.nativePaneBirthId)
|
|
70
|
+
throw new PaneReaderUnavailable();
|
|
71
|
+
const reader = readerOption(option ?? "", panePid ?? "", options.alive);
|
|
72
|
+
if (!reader)
|
|
73
|
+
throw new PaneReaderUnavailable();
|
|
74
|
+
return reader;
|
|
75
|
+
};
|
|
76
|
+
const reader = await observe();
|
|
77
|
+
const result = work(reader);
|
|
78
|
+
const current = await observe();
|
|
79
|
+
if (current.path !== reader.path || current.pid !== reader.pid)
|
|
80
|
+
throw new PaneReaderUnavailable();
|
|
81
|
+
return result;
|
|
82
|
+
}
|
|
83
|
+
finally {
|
|
84
|
+
readers--;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
return {
|
|
88
|
+
read: async (input, cancellation) => {
|
|
89
|
+
const request = PaneReaderRequestSchemaZ.parse(input);
|
|
90
|
+
return withReader(request.target, cancellation, (reader) => PaneReaderResponseSchemaZ.parse({
|
|
91
|
+
version: 1,
|
|
92
|
+
name: reader.name,
|
|
93
|
+
folder: basename(dirname(reader.path)),
|
|
94
|
+
...readReaderPage(reader.path, request.have, request.page),
|
|
95
|
+
}));
|
|
96
|
+
},
|
|
97
|
+
asset: async (input, cancellation) => {
|
|
98
|
+
const request = PaneReaderAssetRequestSchemaZ.parse(input);
|
|
99
|
+
return withReader(request.target, cancellation, (reader) => PaneReaderAssetResponseSchemaZ.parse({
|
|
100
|
+
version: 1,
|
|
101
|
+
...readReaderAssetPage(reader.path, request.src, request.page),
|
|
102
|
+
}));
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { nativeSplitCapability } from "../terminal/protocol/native-split-resize.js";
|
|
2
|
+
const UNKNOWN = (command) => new RegExp(`^unknown command: ${command}$`, "mu");
|
|
3
|
+
/** The same reading of the server as the mirror's: the stock resize when it refuses
|
|
4
|
+
* the split command by name, and full only with the split capability it requires. */
|
|
5
|
+
export function nativeCommands(probe) {
|
|
6
|
+
const ask = (command) => {
|
|
7
|
+
try {
|
|
8
|
+
return { output: probe([command, "-V"]) };
|
|
9
|
+
}
|
|
10
|
+
catch (error) {
|
|
11
|
+
const failure = error;
|
|
12
|
+
return { failure: String(failure.stderr ?? failure.message ?? "") };
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const split = ask("tmux-ide-resize-split");
|
|
16
|
+
const events = ask("tmux-ide-events");
|
|
17
|
+
const failures = [split.failure, events.failure].filter((text) => text !== undefined);
|
|
18
|
+
if (failures.some((text) => /no server running|error connecting/u.test(text)))
|
|
19
|
+
return "no-server";
|
|
20
|
+
const refused = (answer, command) => answer.failure !== undefined && UNKNOWN(command).test(answer.failure);
|
|
21
|
+
if (refused(split, "tmux-ide-resize-split")) {
|
|
22
|
+
if (refused(events, "tmux-ide-events"))
|
|
23
|
+
return "stock";
|
|
24
|
+
// The journal answers: a tmux-ide tmux built before the split command.
|
|
25
|
+
if (events.output !== undefined)
|
|
26
|
+
return "older";
|
|
27
|
+
return "unknown";
|
|
28
|
+
}
|
|
29
|
+
if (split.output !== undefined && events.output !== undefined) {
|
|
30
|
+
try {
|
|
31
|
+
return nativeSplitCapability(split.output) ? "full" : "partial";
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return "partial";
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return failures.length === 2 ? "unknown" : "partial";
|
|
38
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createPaneReaderResolver } from "./tmux-pane-reader.js";
|
|
1
2
|
import { createNativeBrowserResolver } from "./tmux-native-browser.js";
|
|
2
3
|
import { createNativeSurfaceContextResolver } from "./native-surface-context.js";
|
|
3
4
|
import { shellEscape } from "./shell.js";
|
|
@@ -528,6 +529,14 @@ export async function createNativeTmuxServerOwner(options) {
|
|
|
528
529
|
inventory: terminalInventoryRuntime,
|
|
529
530
|
run: generationRunAsync,
|
|
530
531
|
}),
|
|
532
|
+
paneReader: createPaneReaderResolver({
|
|
533
|
+
generation,
|
|
534
|
+
assertOpen,
|
|
535
|
+
registry: workspaceRegistry,
|
|
536
|
+
catalog,
|
|
537
|
+
inventory: terminalInventoryRuntime,
|
|
538
|
+
run: generationRunAsync,
|
|
539
|
+
}),
|
|
531
540
|
catalog,
|
|
532
541
|
readWindowSplitLayout: async (workspaceName, input) => {
|
|
533
542
|
assertOpen();
|
|
@@ -151,6 +151,24 @@ export function mapWorktreeError(stderr, fallbackMessage) {
|
|
|
151
151
|
}
|
|
152
152
|
return new WorktreeError(text.length > 0 ? text : fallbackMessage, "GIT_FAILED");
|
|
153
153
|
}
|
|
154
|
+
// ---------------------------------------------------------------------------
|
|
155
|
+
// io — git shell-outs (map stderr → WorktreeError)
|
|
156
|
+
// ---------------------------------------------------------------------------
|
|
157
|
+
/**
|
|
158
|
+
* `env` with git hooks off for every git command run with it: core.hooksPath
|
|
159
|
+
* points at /dev/null, through GIT_CONFIG_* (which outrank the repository's
|
|
160
|
+
* own config, a relative hooksPath that a branch carries included).
|
|
161
|
+
*/
|
|
162
|
+
export function gitHooksOff(env) {
|
|
163
|
+
const count = Number.parseInt(env.GIT_CONFIG_COUNT ?? "0", 10);
|
|
164
|
+
const index = Number.isInteger(count) && count >= 0 ? count : 0;
|
|
165
|
+
return {
|
|
166
|
+
...env,
|
|
167
|
+
GIT_CONFIG_COUNT: String(index + 1),
|
|
168
|
+
[`GIT_CONFIG_KEY_${index}`]: "core.hooksPath",
|
|
169
|
+
[`GIT_CONFIG_VALUE_${index}`]: "/dev/null",
|
|
170
|
+
};
|
|
171
|
+
}
|
|
154
172
|
let gitRunner = (repoDir, args) => execFileSync("git", args, {
|
|
155
173
|
cwd: repoDir,
|
|
156
174
|
encoding: "utf-8",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
<key>CFBundlePackageType</key>
|
|
22
22
|
<string>APPL</string>
|
|
23
23
|
<key>CFBundleShortVersionString</key>
|
|
24
|
-
<string>2.9.
|
|
24
|
+
<string>2.9.22</string>
|
|
25
25
|
<key>CFBundleVersion</key>
|
|
26
|
-
<string>2.9.
|
|
26
|
+
<string>2.9.22</string>
|
|
27
27
|
<key>LSMinimumSystemVersion</key>
|
|
28
28
|
<string>11.0</string>
|
|
29
29
|
<key>LSUIElement</key>
|
|
Binary file
|
|
Binary file
|
package/packages/daemon/dist/native/TmuxIdeNotifier.app/Contents/_CodeSignature/CodeResources
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
</data>
|
|
11
11
|
<key>Resources/Assets.car</key>
|
|
12
12
|
<data>
|
|
13
|
-
|
|
13
|
+
Cx0kflSNo25xIPuHfTvLfggPEdA=
|
|
14
14
|
</data>
|
|
15
15
|
</dict>
|
|
16
16
|
<key>files2</key>
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
<dict>
|
|
27
27
|
<key>hash2</key>
|
|
28
28
|
<data>
|
|
29
|
-
|
|
29
|
+
6P/aOxWEmYu/LP87/6VutmD2v02KSwG2hwcfWcR90Xo=
|
|
30
30
|
</data>
|
|
31
31
|
</dict>
|
|
32
32
|
</dict>
|
|
@@ -112,8 +112,9 @@ export async function nativeControlsNotice(run, pane, executable, wait = {}) {
|
|
|
112
112
|
await sleep(250);
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
/** Where a new browser or reader pane goes: resolved IDs, before any mutation. */
|
|
116
|
+
export function resolveOpenPaneTarget(run, options, environment, kind = "BROWSER") {
|
|
117
|
+
const noun = kind.toLowerCase();
|
|
117
118
|
const inheritedPane = /^%\d+$/u.test(environment.TMUX_PANE ?? "")
|
|
118
119
|
? environment.TMUX_PANE
|
|
119
120
|
: undefined;
|
|
@@ -126,7 +127,7 @@ export function createBrowserPane(run, executable, url, options, environment, cw
|
|
|
126
127
|
? `$${inheritedServer[3]}:.${inheritedPane}`
|
|
127
128
|
: undefined);
|
|
128
129
|
if (!target)
|
|
129
|
-
throw new IdeError("Run tmux-ide open inside a tmux pane, or select a session with --session NAME.", { code:
|
|
130
|
+
throw new IdeError("Run tmux-ide open inside a tmux pane, or select a session with --session NAME.", { code: `${kind}_TARGET_REQUIRED`, exitCode: 2 });
|
|
130
131
|
// Resolve IDs before mutation. No implicit last-used session or window target.
|
|
131
132
|
const identity = run([
|
|
132
133
|
"display-message",
|
|
@@ -142,11 +143,11 @@ export function createBrowserPane(run, executable, url, options, environment, cw
|
|
|
142
143
|
!/^\$\d+$/u.test(session ?? "") ||
|
|
143
144
|
!/^@\d+$/u.test(window ?? "") ||
|
|
144
145
|
!/^%\d+$/u.test(sourcePane ?? ""))
|
|
145
|
-
throw new IdeError(
|
|
146
|
-
code:
|
|
146
|
+
throw new IdeError(`The ${noun} target is no longer available.`, {
|
|
147
|
+
code: `${kind}_TARGET_UNAVAILABLE`,
|
|
147
148
|
});
|
|
148
149
|
if (implicit && serverPid !== inheritedServer?.[2])
|
|
149
|
-
throw new IdeError("The current pane belongs to a different tmux server. Select a session explicitly.", { code:
|
|
150
|
+
throw new IdeError("The current pane belongs to a different tmux server. Select a session explicitly.", { code: `${kind}_TARGET_MISMATCH`, exitCode: 2 });
|
|
150
151
|
if (options.session && options.pane) {
|
|
151
152
|
const selected = run([
|
|
152
153
|
"display-message",
|
|
@@ -157,21 +158,28 @@ export function createBrowserPane(run, executable, url, options, environment, cw
|
|
|
157
158
|
]).trim();
|
|
158
159
|
if (selected !== session)
|
|
159
160
|
throw new IdeError("The pane does not belong to the requested session.", {
|
|
160
|
-
code:
|
|
161
|
+
code: `${kind}_TARGET_MISMATCH`,
|
|
161
162
|
exitCode: 2,
|
|
162
163
|
});
|
|
163
164
|
}
|
|
165
|
+
return { session: session, window: window, sourcePane: sourcePane };
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* The tmux argv that creates the pane and runs `command` in it directly (no
|
|
169
|
+
* shell parsing). `format` is what tmux prints for the new pane.
|
|
170
|
+
*/
|
|
171
|
+
export function openPaneArgs(target, options, environment, cwd, namespace, command, format, windowName) {
|
|
164
172
|
const args = options.window
|
|
165
|
-
? ["new-window", "-t", `${session}:`, "-n",
|
|
173
|
+
? ["new-window", "-t", `${target.session}:`, "-n", windowName]
|
|
166
174
|
: [
|
|
167
175
|
"split-window",
|
|
168
176
|
options.split === "down" ? "-v" : "-h",
|
|
169
177
|
"-t",
|
|
170
|
-
`${session}:${window}.${sourcePane}`,
|
|
178
|
+
`${target.session}:${target.window}.${target.sourcePane}`,
|
|
171
179
|
"-l",
|
|
172
180
|
`${options.size ?? "50"}%`,
|
|
173
181
|
];
|
|
174
|
-
args.push("-c", resolve(cwd), "-P", "-F",
|
|
182
|
+
args.push("-c", resolve(cwd), "-P", "-F", format);
|
|
175
183
|
// tmux supplies the new pane's TMUX and TMUX_PANE. Never copy the caller's
|
|
176
184
|
// native-surface route, which belongs to a different pane.
|
|
177
185
|
const childEnvironment = { ...namespace };
|
|
@@ -189,10 +197,16 @@ export function createBrowserPane(run, executable, url, options, environment, cw
|
|
|
189
197
|
for (const [key, value] of Object.entries(childEnvironment))
|
|
190
198
|
args.push("-e", `${key}=${value}`);
|
|
191
199
|
// Multiple command arguments use tmux's direct exec path, not shell parsing.
|
|
192
|
-
args.push(
|
|
200
|
+
args.push(...command);
|
|
201
|
+
return args;
|
|
202
|
+
}
|
|
203
|
+
export function createBrowserPane(run, executable, url, options, environment, cwd, namespace) {
|
|
204
|
+
validateBrowserOpen(url, options);
|
|
205
|
+
const target = resolveOpenPaneTarget(run, options, environment);
|
|
206
|
+
const args = openPaneArgs(target, options, environment, cwd, namespace, [executable, "open", ...(url === undefined ? [] : [url]), "--no-merge"], "#{session_id}\t#{window_id}\t#{pane_id}", "Browser");
|
|
193
207
|
const [createdSession, createdWindow, pane] = run(args).trim().split("\t");
|
|
194
208
|
if (!/^%\d+$/u.test(pane ?? "") ||
|
|
195
|
-
createdSession !== session ||
|
|
209
|
+
createdSession !== target.session ||
|
|
196
210
|
!/^@\d+$/u.test(createdWindow ?? ""))
|
|
197
211
|
throw new IdeError("tmux did not return the created browser pane ID.", {
|
|
198
212
|
code: "BROWSER_CREATE_FAILED",
|