@modootoday/pmcp 0.11.0 → 0.13.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/README.md +92 -494
- package/dist/cli.js +9307 -3930
- package/dist/{embed-BBhv3y5x.d.ts → embed-BW6AWD1e.d.ts} +1 -1
- package/dist/harness-egress-bridge.d.ts +2 -0
- package/dist/harness-egress-bridge.js +74 -0
- package/dist/harness-launch-gate.d.ts +2 -0
- package/dist/harness-launch-gate.js +1187 -0
- package/dist/harness-pane-runner.d.ts +2 -0
- package/dist/harness-pane-runner.js +118 -0
- package/dist/harness-worker.d.ts +2 -0
- package/dist/harness-worker.js +2737 -0
- package/dist/http.d.ts +3 -3
- package/dist/http.js +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +1 -1
- package/dist/stdio.d.ts +1 -1
- package/dist/stdio.js +1 -1
- package/dist/tui-worker.d.ts +2 -0
- package/dist/tui-worker.js +5973 -0
- package/docs/embeddings.md +125 -0
- package/docs/hosting.md +46 -0
- package/docs/mailbox.md +59 -0
- package/docs/project-configuration.md +203 -0
- package/docs/skills.md +74 -0
- package/docs/terminal-harness.md +393 -0
- package/docs/terminal-workspace.md +116 -0
- package/package.json +3 -2
- package/dist/{server-CwWcRjqz.d.ts → server-9w4R1caM.d.ts} +4 -4
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// src/harness/adapters/egress/bridge-runtime.ts
|
|
2
|
+
import { spawn } from "child_process";
|
|
3
|
+
import { isAbsolute } from "path";
|
|
4
|
+
|
|
5
|
+
// src/harness/adapters/egress/bridge-listener.ts
|
|
6
|
+
import { connect, createServer } from "net";
|
|
7
|
+
async function createLoopbackBridge(path2) {
|
|
8
|
+
const sockets = /* @__PURE__ */ new Set();
|
|
9
|
+
const server = createServer((client) => {
|
|
10
|
+
if (sockets.size >= 32) {
|
|
11
|
+
client.destroy();
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const upstream = connect(path2);
|
|
15
|
+
for (const socket of [client, upstream]) {
|
|
16
|
+
sockets.add(socket);
|
|
17
|
+
socket.once("close", () => sockets.delete(socket));
|
|
18
|
+
socket.setTimeout(6e4, () => socket.destroy());
|
|
19
|
+
socket.on("error", () => {
|
|
20
|
+
client.destroy();
|
|
21
|
+
upstream.destroy();
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
client.once("close", () => upstream.destroy());
|
|
25
|
+
upstream.once("close", () => client.destroy());
|
|
26
|
+
client.pipe(upstream);
|
|
27
|
+
upstream.pipe(client);
|
|
28
|
+
});
|
|
29
|
+
await new Promise((resolve, reject) => {
|
|
30
|
+
server.once("error", reject);
|
|
31
|
+
server.listen(0, "127.0.0.1", resolve);
|
|
32
|
+
});
|
|
33
|
+
const address = server.address();
|
|
34
|
+
if (!address || typeof address === "string")
|
|
35
|
+
throw new Error("invalid_egress_bridge_address");
|
|
36
|
+
return {
|
|
37
|
+
url: `http://127.0.0.1:${address.port}`,
|
|
38
|
+
async close() {
|
|
39
|
+
for (const socket of sockets) socket.destroy();
|
|
40
|
+
await new Promise(
|
|
41
|
+
(resolve, reject) => server.close((error) => error ? reject(error) : resolve())
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// src/harness/adapters/egress/bridge-runtime.ts
|
|
48
|
+
var [separator, executable, ...args] = process.argv.slice(2);
|
|
49
|
+
var path = process.env.PMCP_HTTPS_PROXY_SOCKET;
|
|
50
|
+
if (separator !== "--" || !executable || !isAbsolute(executable) || !path || !/^\/state\/e[a-f0-9]{8}$/.test(path))
|
|
51
|
+
throw new Error("invalid_egress_bridge_invocation");
|
|
52
|
+
var bridge = await createLoopbackBridge(path);
|
|
53
|
+
var environment = { ...process.env };
|
|
54
|
+
for (const key of ["HTTP_PROXY", "HTTPS_PROXY", "ALL_PROXY"])
|
|
55
|
+
environment[key] = bridge.url;
|
|
56
|
+
for (const key of ["http_proxy", "https_proxy", "all_proxy"])
|
|
57
|
+
environment[key] = bridge.url;
|
|
58
|
+
environment.NO_PROXY = "";
|
|
59
|
+
environment.no_proxy = "";
|
|
60
|
+
var child = spawn(executable, args, {
|
|
61
|
+
env: environment,
|
|
62
|
+
stdio: "inherit"
|
|
63
|
+
});
|
|
64
|
+
process.on("SIGTERM", () => child.kill("SIGTERM"));
|
|
65
|
+
process.on("SIGINT", () => child.kill("SIGINT"));
|
|
66
|
+
child.once("error", async () => {
|
|
67
|
+
await bridge.close();
|
|
68
|
+
process.exitCode = 1;
|
|
69
|
+
});
|
|
70
|
+
child.once("exit", async (code) => {
|
|
71
|
+
await bridge.close();
|
|
72
|
+
process.exitCode = code ?? 1;
|
|
73
|
+
});
|
|
74
|
+
//# sourceMappingURL=harness-egress-bridge.js.map
|