agent-dev-env 0.1.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.
- package/LICENSE +21 -0
- package/dist/assets/bridge/bridge.js +202 -0
- package/dist/assets/guest/guest-agent-mac.js +586 -0
- package/dist/assets/guest/guest-agent-ubuntu.js +481 -0
- package/dist/assets/guest/guest-agent-windows.js +466 -0
- package/dist/assets/images/mac/CHANGELOG.md +265 -0
- package/dist/assets/images/mac/README.md +63 -0
- package/dist/assets/images/mac/sandbox.pkr.hcl +468 -0
- package/dist/assets/images/mac/vars/sandbox-macos-tahoe.pkrvars.hcl +39 -0
- package/dist/assets/images/ubuntu-arm64-vmware/CHANGELOG.md +239 -0
- package/dist/assets/images/ubuntu-arm64-vmware/README.md +177 -0
- package/dist/assets/images/ubuntu-arm64-vmware/autoinstall/meta-data +2 -0
- package/dist/assets/images/ubuntu-arm64-vmware/autoinstall/user-data +34 -0
- package/dist/assets/images/ubuntu-arm64-vmware/sandbox.pkr.hcl +776 -0
- package/dist/assets/images/ubuntu-arm64-vmware/vars/sandbox-ubuntu-24-04-arm64-vmware.pkrvars.hcl +71 -0
- package/dist/assets/images/windows-arm64-qemu/CHANGELOG.md +209 -0
- package/dist/assets/images/windows-arm64-qemu/README.md +142 -0
- package/dist/assets/images/windows-arm64-qemu/autounattend.xml +325 -0
- package/dist/assets/images/windows-arm64-qemu/qemu-with-tpm.sh +170 -0
- package/dist/assets/images/windows-arm64-qemu/sandbox.pkr.hcl +1012 -0
- package/dist/assets/images/windows-arm64-qemu/vars/sandbox-windows-11-arm64-qemu.pkrvars.hcl +83 -0
- package/dist/assets/images/windows-arm64-vmware/CHANGELOG.md +270 -0
- package/dist/assets/images/windows-arm64-vmware/README.md +171 -0
- package/dist/assets/images/windows-arm64-vmware/autounattend.xml +311 -0
- package/dist/assets/images/windows-arm64-vmware/sandbox.pkr.hcl +1036 -0
- package/dist/assets/images/windows-arm64-vmware/vars/sandbox-windows-11-arm64-vmware.pkrvars.hcl +83 -0
- package/dist/assets/rules/agent-rules-linux.md +68 -0
- package/dist/assets/rules/agent-rules.md +71 -0
- package/dist/assets/watchdog/watch-build-ocr.swift +40 -0
- package/dist/assets/watchdog/watch-build.py +275 -0
- package/dist/cli.js +52 -0
- package/dist/commands/delete.js +179 -0
- package/dist/commands/doctor.js +165 -0
- package/dist/commands/list.js +38 -0
- package/dist/commands/not-yet.js +15 -0
- package/dist/commands/register.js +150 -0
- package/dist/commands/run.js +65 -0
- package/dist/commands/status.js +142 -0
- package/dist/commands/stop.js +186 -0
- package/dist/commands/sync.js +98 -0
- package/dist/lib/exec.js +250 -0
- package/dist/lib/ghcr.js +82 -0
- package/dist/lib/git.js +100 -0
- package/dist/lib/logger.js +87 -0
- package/dist/lib/network.js +63 -0
- package/dist/lib/paths.js +116 -0
- package/dist/lib/platform.js +87 -0
- package/dist/lib/prompt.js +66 -0
- package/dist/lib/qemu.js +373 -0
- package/dist/lib/regex.js +9 -0
- package/dist/lib/ssh.js +230 -0
- package/dist/lib/tart.js +210 -0
- package/dist/lib/template.js +35 -0
- package/dist/lib/vars.js +99 -0
- package/dist/lib/vmrun.js +334 -0
- package/dist/lifecycle/build-macos.js +23 -0
- package/dist/lifecycle/build-qemu.js +204 -0
- package/dist/lifecycle/build-shared.js +355 -0
- package/dist/lifecycle/build-ubuntu.js +184 -0
- package/dist/lifecycle/build-watchdog.js +146 -0
- package/dist/lifecycle/build-windows-vmware.js +112 -0
- package/dist/lifecycle/build.js +55 -0
- package/dist/lifecycle/catalog.js +165 -0
- package/dist/lifecycle/deploy.js +161 -0
- package/dist/lifecycle/tag.js +77 -0
- package/dist/lifecycle/watch-build.js +64 -0
- package/dist/runners/bridges.js +153 -0
- package/dist/runners/framework.js +66 -0
- package/dist/runners/macos-bridges.js +143 -0
- package/dist/runners/macos-guest.js +76 -0
- package/dist/runners/macos-rules.js +77 -0
- package/dist/runners/macos-summary.js +145 -0
- package/dist/runners/macos.js +258 -0
- package/dist/runners/openchamber.js +60 -0
- package/dist/runners/options.js +56 -0
- package/dist/runners/qemu-image.js +183 -0
- package/dist/runners/rules.js +49 -0
- package/dist/runners/ubuntu-bridges.js +154 -0
- package/dist/runners/ubuntu-guest.js +136 -0
- package/dist/runners/ubuntu-image.js +26 -0
- package/dist/runners/ubuntu-rules.js +86 -0
- package/dist/runners/ubuntu-shared.js +65 -0
- package/dist/runners/ubuntu-summary.js +141 -0
- package/dist/runners/ubuntu.js +117 -0
- package/dist/runners/vmware-common.js +158 -0
- package/dist/runners/vmware-image.js +242 -0
- package/dist/runners/windows-autologon.js +119 -0
- package/dist/runners/windows-bridges.js +136 -0
- package/dist/runners/windows-guest.js +213 -0
- package/dist/runners/windows-image.js +23 -0
- package/dist/runners/windows-qemu-summary.js +85 -0
- package/dist/runners/windows-qemu.js +189 -0
- package/dist/runners/windows-shared.js +68 -0
- package/dist/runners/windows-summary.js +104 -0
- package/dist/runners/windows.js +96 -0
- package/dist/settings/common.js +107 -0
- package/dist/settings/macos-copy.js +223 -0
- package/dist/settings/macos.js +41 -0
- package/dist/settings/ubuntu-copy.js +223 -0
- package/dist/settings/ubuntu.js +68 -0
- package/package.json +52 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Andrey Meshkov
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// packages/bridge-core/src/bin.ts
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
|
|
6
|
+
// packages/bridge-core/src/index.ts
|
|
7
|
+
import { rmSync, writeFileSync } from "node:fs";
|
|
8
|
+
|
|
9
|
+
// packages/bridge-core/src/endpoints.ts
|
|
10
|
+
var PIPE_PREFIX = "\\\\.\\pipe\\";
|
|
11
|
+
function parseEndpoint(spec) {
|
|
12
|
+
const sep = spec.indexOf(":");
|
|
13
|
+
if (sep <= 0) {
|
|
14
|
+
throw new Error(`invalid endpoint '${spec}' (expected unix:|pipe:|tcp:)`);
|
|
15
|
+
}
|
|
16
|
+
const scheme = spec.slice(0, sep);
|
|
17
|
+
const rest = spec.slice(sep + 1);
|
|
18
|
+
switch (scheme) {
|
|
19
|
+
case "unix": {
|
|
20
|
+
if (!rest) {
|
|
21
|
+
throw new Error(`invalid unix endpoint '${spec}': missing path`);
|
|
22
|
+
}
|
|
23
|
+
return { kind: "unix", path: rest };
|
|
24
|
+
}
|
|
25
|
+
case "pipe": {
|
|
26
|
+
if (!rest) {
|
|
27
|
+
throw new Error(`invalid pipe endpoint '${spec}': missing name`);
|
|
28
|
+
}
|
|
29
|
+
const name = rest.startsWith(PIPE_PREFIX) ? rest : `${PIPE_PREFIX}${rest}`;
|
|
30
|
+
return { kind: "pipe", name };
|
|
31
|
+
}
|
|
32
|
+
case "tcp": {
|
|
33
|
+
const m = /^([^:]+):(\d+)$/.exec(rest);
|
|
34
|
+
const port = m ? Number(m[2]) : NaN;
|
|
35
|
+
if (!m || !Number.isInteger(port) || port < 1 || port > 65535) {
|
|
36
|
+
throw new Error(`invalid tcp endpoint '${spec}' (expected tcp:host:port, port 1-65535)`);
|
|
37
|
+
}
|
|
38
|
+
return { kind: "tcp", host: m[1], port };
|
|
39
|
+
}
|
|
40
|
+
default:
|
|
41
|
+
throw new Error(
|
|
42
|
+
`unknown endpoint scheme '${scheme}' in '${spec}' (expected unix:|pipe:|tcp:)`
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function formatEndpoint(endpoint) {
|
|
47
|
+
switch (endpoint.kind) {
|
|
48
|
+
case "unix":
|
|
49
|
+
return `unix:${endpoint.path}`;
|
|
50
|
+
case "pipe":
|
|
51
|
+
return `pipe:${endpoint.name}`;
|
|
52
|
+
case "tcp":
|
|
53
|
+
return `tcp:${endpoint.host}:${endpoint.port}`;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// packages/bridge-core/src/forwarder.ts
|
|
58
|
+
import net from "node:net";
|
|
59
|
+
import { existsSync, unlinkSync } from "node:fs";
|
|
60
|
+
function startForwarder(options) {
|
|
61
|
+
const sockets = /* @__PURE__ */ new Set();
|
|
62
|
+
const server = net.createServer((client) => {
|
|
63
|
+
sockets.add(client);
|
|
64
|
+
client.on("close", () => sockets.delete(client));
|
|
65
|
+
forwardConnection(client, options.forward, sockets);
|
|
66
|
+
});
|
|
67
|
+
return bind(server, options.listen).then(() => {
|
|
68
|
+
options.log?.(
|
|
69
|
+
`listening on ${formatEndpoint(options.listen)} \u2192 ${formatEndpoint(options.forward)}`
|
|
70
|
+
);
|
|
71
|
+
return {
|
|
72
|
+
close: () => closeForwarder(server, sockets, options.listen, options.log)
|
|
73
|
+
};
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
function forwardConnection(client, target, sockets) {
|
|
77
|
+
const upstream = connectTo(target);
|
|
78
|
+
sockets.add(upstream);
|
|
79
|
+
upstream.on("close", () => sockets.delete(upstream));
|
|
80
|
+
upstream.once("connect", () => {
|
|
81
|
+
client.pipe(upstream);
|
|
82
|
+
upstream.pipe(client);
|
|
83
|
+
});
|
|
84
|
+
const tearDown = () => {
|
|
85
|
+
client.destroy();
|
|
86
|
+
upstream.destroy();
|
|
87
|
+
};
|
|
88
|
+
upstream.once("error", tearDown);
|
|
89
|
+
client.once("error", () => {
|
|
90
|
+
upstream.destroy();
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
async function bind(server, endpoint) {
|
|
94
|
+
switch (endpoint.kind) {
|
|
95
|
+
case "unix":
|
|
96
|
+
if (existsSync(endpoint.path)) {
|
|
97
|
+
unlinkSync(endpoint.path);
|
|
98
|
+
}
|
|
99
|
+
await listen(server, endpoint.path);
|
|
100
|
+
break;
|
|
101
|
+
case "pipe":
|
|
102
|
+
await listen(server, endpoint.name);
|
|
103
|
+
break;
|
|
104
|
+
case "tcp":
|
|
105
|
+
await listen(server, { port: endpoint.port, host: endpoint.host });
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function listen(server, spec) {
|
|
110
|
+
return new Promise((resolve, reject) => {
|
|
111
|
+
server.once("error", reject);
|
|
112
|
+
server.listen(spec, () => {
|
|
113
|
+
server.removeListener("error", reject);
|
|
114
|
+
resolve();
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
function connectTo(endpoint) {
|
|
119
|
+
switch (endpoint.kind) {
|
|
120
|
+
case "unix":
|
|
121
|
+
return net.connect({ path: endpoint.path });
|
|
122
|
+
case "pipe":
|
|
123
|
+
return net.connect({ path: endpoint.name });
|
|
124
|
+
case "tcp":
|
|
125
|
+
return net.connect({ port: endpoint.port, host: endpoint.host });
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function closeForwarder(server, sockets, listen2, log) {
|
|
129
|
+
return new Promise((resolve) => {
|
|
130
|
+
for (const socket of sockets) {
|
|
131
|
+
socket.destroy();
|
|
132
|
+
}
|
|
133
|
+
server.close(() => {
|
|
134
|
+
if (listen2.kind === "unix" && existsSync(listen2.path)) {
|
|
135
|
+
unlinkSync(listen2.path);
|
|
136
|
+
}
|
|
137
|
+
log?.("closed");
|
|
138
|
+
resolve();
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// packages/bridge-core/src/index.ts
|
|
144
|
+
function parseBridgeArgs(argv) {
|
|
145
|
+
const values = /* @__PURE__ */ new Map();
|
|
146
|
+
for (let i = 0; i < argv.length; i += 2) {
|
|
147
|
+
const flag = argv[i];
|
|
148
|
+
if (flag === "--listen" || flag === "--forward" || flag === "--pidfile") {
|
|
149
|
+
values.set(flag, argv[i + 1] ?? "");
|
|
150
|
+
} else {
|
|
151
|
+
throw new Error(`unknown argument: ${flag}`);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
const listenSpec = values.get("--listen");
|
|
155
|
+
const forwardSpec = values.get("--forward");
|
|
156
|
+
if (!listenSpec || !forwardSpec) {
|
|
157
|
+
throw new Error("usage: bridge --listen <endpoint> --forward <endpoint> [--pidfile PATH]");
|
|
158
|
+
}
|
|
159
|
+
const pidfile = values.get("--pidfile");
|
|
160
|
+
return {
|
|
161
|
+
listen: parseEndpoint(listenSpec),
|
|
162
|
+
forward: parseEndpoint(forwardSpec),
|
|
163
|
+
pidfile: pidfile || void 0
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
async function runBridge(options) {
|
|
167
|
+
const running = await startForwarder(options);
|
|
168
|
+
if (options.pidfile) {
|
|
169
|
+
writeFileSync(options.pidfile, `${process.pid}
|
|
170
|
+
`);
|
|
171
|
+
}
|
|
172
|
+
await new Promise((resolve) => {
|
|
173
|
+
const stop = () => {
|
|
174
|
+
void running.close().then(() => {
|
|
175
|
+
if (options.pidfile) {
|
|
176
|
+
rmSync(options.pidfile, { force: true });
|
|
177
|
+
}
|
|
178
|
+
resolve();
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
process.on("SIGINT", stop);
|
|
182
|
+
process.on("SIGTERM", stop);
|
|
183
|
+
});
|
|
184
|
+
return 0;
|
|
185
|
+
}
|
|
186
|
+
async function main(argv) {
|
|
187
|
+
const args = parseBridgeArgs(argv);
|
|
188
|
+
return runBridge({
|
|
189
|
+
listen: args.listen,
|
|
190
|
+
forward: args.forward,
|
|
191
|
+
pidfile: args.pidfile,
|
|
192
|
+
log: (message) => process.stderr.write(`${message}
|
|
193
|
+
`)
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// packages/bridge-core/src/bin.ts
|
|
198
|
+
if (process.argv[1] === fileURLToPath(import.meta.url)) {
|
|
199
|
+
void main(process.argv.slice(2)).then((code) => {
|
|
200
|
+
process.exit(code);
|
|
201
|
+
});
|
|
202
|
+
}
|