@amalgm/shell 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/PURPOSE.md +73 -0
- package/README.md +33 -0
- package/dist/automations-host.d.ts +19 -0
- package/dist/automations-host.js +41 -0
- package/dist/automations-host.js.map +1 -0
- package/dist/boot.d.ts +53 -0
- package/dist/boot.js +249 -0
- package/dist/boot.js.map +1 -0
- package/dist/bundle-apps.d.ts +12 -0
- package/dist/bundle-apps.js +71 -0
- package/dist/bundle-apps.js.map +1 -0
- package/dist/bundle-automations.d.ts +8 -0
- package/dist/bundle-automations.js +106 -0
- package/dist/bundle-automations.js.map +1 -0
- package/dist/bundle-bindings.d.ts +8 -0
- package/dist/bundle-bindings.js +101 -0
- package/dist/bundle-bindings.js.map +1 -0
- package/dist/bundle-port.d.ts +14 -0
- package/dist/bundle-port.js +166 -0
- package/dist/bundle-port.js.map +1 -0
- package/dist/chat-host.d.ts +32 -0
- package/dist/chat-host.js +167 -0
- package/dist/chat-host.js.map +1 -0
- package/dist/chat-payloads-host.d.ts +8 -0
- package/dist/chat-payloads-host.js +76 -0
- package/dist/chat-payloads-host.js.map +1 -0
- package/dist/chat-relay-host.d.ts +24 -0
- package/dist/chat-relay-host.js +90 -0
- package/dist/chat-relay-host.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +157 -0
- package/dist/cli.js.map +1 -0
- package/dist/compose.d.ts +32 -0
- package/dist/compose.js +35 -0
- package/dist/compose.js.map +1 -0
- package/dist/credentials-host.d.ts +7 -0
- package/dist/credentials-host.js +143 -0
- package/dist/credentials-host.js.map +1 -0
- package/dist/diagnostics-host.d.ts +3 -0
- package/dist/diagnostics-host.js +92 -0
- package/dist/diagnostics-host.js.map +1 -0
- package/dist/drivers/claude-code.d.ts +27 -0
- package/dist/drivers/claude-code.js +72 -0
- package/dist/drivers/claude-code.js.map +1 -0
- package/dist/event-triggers-host.d.ts +4 -0
- package/dist/event-triggers-host.js +48 -0
- package/dist/event-triggers-host.js.map +1 -0
- package/dist/events-host.d.ts +9 -0
- package/dist/events-host.js +34 -0
- package/dist/events-host.js.map +1 -0
- package/dist/external-proxy-host.d.ts +15 -0
- package/dist/external-proxy-host.js +166 -0
- package/dist/external-proxy-host.js.map +1 -0
- package/dist/filesystem.d.ts +7 -0
- package/dist/filesystem.js +71 -0
- package/dist/filesystem.js.map +1 -0
- package/dist/forward.d.ts +11 -0
- package/dist/forward.js +36 -0
- package/dist/forward.js.map +1 -0
- package/dist/gateway.d.ts +33 -0
- package/dist/gateway.js +85 -0
- package/dist/gateway.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/local-host.d.ts +8 -0
- package/dist/local-host.js +101 -0
- package/dist/local-host.js.map +1 -0
- package/dist/machine-host.d.ts +56 -0
- package/dist/machine-host.js +340 -0
- package/dist/machine-host.js.map +1 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.js +4 -0
- package/dist/main.js.map +1 -0
- package/dist/parity.d.ts +40 -0
- package/dist/parity.js +108 -0
- package/dist/parity.js.map +1 -0
- package/dist/ports-host.d.ts +8 -0
- package/dist/ports-host.js +26 -0
- package/dist/ports-host.js.map +1 -0
- package/dist/pty-host.d.ts +14 -0
- package/dist/pty-host.js +141 -0
- package/dist/pty-host.js.map +1 -0
- package/dist/release-catalog.d.ts +5 -0
- package/dist/release-catalog.js +23 -0
- package/dist/release-catalog.js.map +1 -0
- package/dist/state-host.d.ts +4 -0
- package/dist/state-host.js +67 -0
- package/dist/state-host.js.map +1 -0
- package/dist/state-store.d.ts +15 -0
- package/dist/state-store.js +63 -0
- package/dist/state-store.js.map +1 -0
- package/dist/user-ground-host.d.ts +58 -0
- package/dist/user-ground-host.js +809 -0
- package/dist/user-ground-host.js.map +1 -0
- package/dist/wire-client.d.ts +44 -0
- package/dist/wire-client.js +235 -0
- package/dist/wire-client.js.map +1 -0
- package/dist/workspace-host.d.ts +5 -0
- package/dist/workspace-host.js +73 -0
- package/dist/workspace-host.js.map +1 -0
- package/dist/workspace-store.d.ts +10 -0
- package/dist/workspace-store.js +47 -0
- package/dist/workspace-store.js.map +1 -0
- package/package.json +55 -0
package/dist/forward.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { request as httpRequest } from "node:http";
|
|
2
|
+
/**
|
|
3
|
+
* Forward a gateway prefix to a brick's own HTTP server on loopback —
|
|
4
|
+
* the engine's gateway architecture (prefixes route to per-service ports)
|
|
5
|
+
* applied inside the shell. The prefix is re-rooted onto the brick
|
|
6
|
+
* server's own root (both agents and browser root their APIs at /v1):
|
|
7
|
+
* /agents/sessions reaches the agents server as /v1/sessions.
|
|
8
|
+
*/
|
|
9
|
+
export function forwardMount(prefix, port, options = {}) {
|
|
10
|
+
const root = options.root ?? "";
|
|
11
|
+
return {
|
|
12
|
+
prefix,
|
|
13
|
+
stream: (req, res, pathname) => {
|
|
14
|
+
const url = new URL(req.url ?? "/", "http://localhost");
|
|
15
|
+
const suffix = `${root}${pathname.slice(prefix.length)}` || "/";
|
|
16
|
+
const upstream = httpRequest({
|
|
17
|
+
host: "127.0.0.1",
|
|
18
|
+
port: port(),
|
|
19
|
+
method: req.method,
|
|
20
|
+
path: `${suffix}${url.search}`,
|
|
21
|
+
headers: { ...req.headers, host: `127.0.0.1:${port()}` },
|
|
22
|
+
}, (up) => {
|
|
23
|
+
res.writeHead(up.statusCode ?? 502, up.headers);
|
|
24
|
+
up.pipe(res);
|
|
25
|
+
});
|
|
26
|
+
upstream.on("error", () => {
|
|
27
|
+
if (!res.headersSent) {
|
|
28
|
+
res.writeHead(502, { "Content-Type": "application/json" });
|
|
29
|
+
}
|
|
30
|
+
res.end(JSON.stringify({ error: "upstream unavailable" }));
|
|
31
|
+
});
|
|
32
|
+
req.pipe(upstream);
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=forward.js.map
|
|
@@ -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AAE,EAAE,cAAc,EAAE,kBAAkB,EAAE,CAAC,CAAC;gBAC7D,CAAC;gBACD,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,sBAAsB,EAAE,CAAC,CAAC,CAAC;YAC7D,CAAC,CAAC,CAAC;YACH,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACrB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { IncomingMessage, Server, ServerResponse } from "node:http";
|
|
2
|
+
import type { Duplex } from "node:stream";
|
|
3
|
+
/**
|
|
4
|
+
* A brick's served surface: a path prefix plus either a JSON-RPC handler
|
|
5
|
+
* (the shell writes the response) or a stream handler (the mount owns the
|
|
6
|
+
* response — SSE tails, long polls). Auth is decided before either runs.
|
|
7
|
+
*/
|
|
8
|
+
export interface BrickMount {
|
|
9
|
+
readonly prefix: string;
|
|
10
|
+
readonly handle?: (request: unknown) => Promise<unknown>;
|
|
11
|
+
readonly stream?: (req: IncomingMessage, res: ServerResponse, pathname: string) => void | Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
/** A WebSocket-capable brick. Kernel auth is decided before `handle` runs. */
|
|
14
|
+
export interface BrickUpgradeMount {
|
|
15
|
+
readonly prefix: string;
|
|
16
|
+
readonly handle: (req: IncomingMessage, socket: Duplex, head: Buffer, authorized: boolean) => void;
|
|
17
|
+
}
|
|
18
|
+
export interface GatewayConfig {
|
|
19
|
+
/** Environment the auth law reads. Defaults to process.env. */
|
|
20
|
+
env?: NodeJS.ProcessEnv;
|
|
21
|
+
/** Brick surfaces to serve, matched by longest prefix. */
|
|
22
|
+
mounts?: readonly BrickMount[];
|
|
23
|
+
/** WebSocket surfaces, admitted by the same runtime-token law. */
|
|
24
|
+
upgrades?: readonly BrickUpgradeMount[];
|
|
25
|
+
/** Paths whose brick performs its own request authentication. */
|
|
26
|
+
exemptPrefixes?: readonly string[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The composed gateway: kernel law decides every request (preflight,
|
|
30
|
+
* exemption, auth), the shell only routes what the law allows to the
|
|
31
|
+
* brick that owns the prefix. No behavior lives here — axiom 1.
|
|
32
|
+
*/
|
|
33
|
+
export declare function createGateway(config?: GatewayConfig): Server;
|
package/dist/gateway.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { timingSafeEqual } from "node:crypto";
|
|
2
|
+
import { createServer } from "node:http";
|
|
3
|
+
import { decideRuntimeHttp, isAuthorizedRuntimeRequest, isHealthPath, pathnameOf, runtimeAuthRequired, runtimeCorsHeaders, runtimeTokenFromEnv, } from "@amalgm/core/transport";
|
|
4
|
+
/**
|
|
5
|
+
* The composed gateway: kernel law decides every request (preflight,
|
|
6
|
+
* exemption, auth), the shell only routes what the law allows to the
|
|
7
|
+
* brick that owns the prefix. No behavior lives here — axiom 1.
|
|
8
|
+
*/
|
|
9
|
+
export function createGateway(config = {}) {
|
|
10
|
+
const env = config.env ?? process.env;
|
|
11
|
+
const policy = {
|
|
12
|
+
required: runtimeAuthRequired(env),
|
|
13
|
+
expectedToken: runtimeTokenFromEnv(env),
|
|
14
|
+
timingSafeEqual,
|
|
15
|
+
};
|
|
16
|
+
const mounts = [...(config.mounts ?? [])].sort((a, b) => b.prefix.length - a.prefix.length);
|
|
17
|
+
const upgrades = [...(config.upgrades ?? [])].sort((a, b) => b.prefix.length - a.prefix.length);
|
|
18
|
+
const server = createServer((req, res) => {
|
|
19
|
+
const pathname = pathnameOf(req.url);
|
|
20
|
+
const origin = String(req.headers.origin ?? "");
|
|
21
|
+
const cors = runtimeCorsHeaders(origin);
|
|
22
|
+
const decision = decideRuntimeHttp({ method: req.method ?? "GET", pathname, headers: req.headers }, policy, { exemptPrefixes: config.exemptPrefixes });
|
|
23
|
+
if (decision.kind === "preflight") {
|
|
24
|
+
res.writeHead(decision.status, cors).end();
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (decision.kind === "reject") {
|
|
28
|
+
res.writeHead(decision.status, { ...cors, ...decision.headers });
|
|
29
|
+
res.end(decision.body);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (isHealthPath(pathname)) {
|
|
33
|
+
res.writeHead(200, { ...cors, "Content-Type": "application/json" });
|
|
34
|
+
res.end(JSON.stringify({ ok: true }));
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const mount = mounts.find((m) => pathname === m.prefix || pathname.startsWith(`${m.prefix}/`));
|
|
38
|
+
if (!mount) {
|
|
39
|
+
res.writeHead(404, { ...cors, "Content-Type": "application/json" });
|
|
40
|
+
res.end(JSON.stringify({ error: "not found" }));
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (mount.stream) {
|
|
44
|
+
for (const [name, value] of Object.entries(cors))
|
|
45
|
+
res.setHeader(name, value);
|
|
46
|
+
void mount.stream(req, res, pathname);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const handle = mount.handle;
|
|
50
|
+
if (!handle) {
|
|
51
|
+
res.writeHead(404, { ...cors, "Content-Type": "application/json" });
|
|
52
|
+
res.end(JSON.stringify({ error: "not found" }));
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const chunks = [];
|
|
56
|
+
req.on("data", (chunk) => chunks.push(chunk));
|
|
57
|
+
req.on("end", () => {
|
|
58
|
+
void (async () => {
|
|
59
|
+
try {
|
|
60
|
+
const raw = Buffer.concat(chunks).toString("utf8");
|
|
61
|
+
const body = raw ? JSON.parse(raw) : {};
|
|
62
|
+
const result = await handle(body);
|
|
63
|
+
res.writeHead(200, { ...cors, "Content-Type": "application/json" });
|
|
64
|
+
res.end(JSON.stringify(result ?? null));
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
res.writeHead(500, { ...cors, "Content-Type": "application/json" });
|
|
68
|
+
res.end(JSON.stringify({ error: error instanceof Error ? error.message : "internal error" }));
|
|
69
|
+
}
|
|
70
|
+
})();
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
server.on("upgrade", (req, socket, head) => {
|
|
74
|
+
const pathname = pathnameOf(req.url);
|
|
75
|
+
const upgrade = upgrades.find((candidate) => pathname === candidate.prefix || pathname.startsWith(`${candidate.prefix}/`));
|
|
76
|
+
if (!upgrade) {
|
|
77
|
+
socket.end("HTTP/1.1 404 Not Found\r\nConnection: close\r\n\r\n");
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const authorized = isAuthorizedRuntimeRequest(req.headers, policy);
|
|
81
|
+
upgrade.handle(req, socket, head, authorized);
|
|
82
|
+
});
|
|
83
|
+
return server;
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=gateway.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gateway.js","sourceRoot":"","sources":["../src/gateway.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAIzC,OAAO,EACL,iBAAiB,EACjB,0BAA0B,EAC1B,YAAY,EACZ,UAAU,EACV,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AAwChC;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,SAAwB,EAAE;IACtD,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;IACtC,MAAM,MAAM,GAAsB;QAChC,QAAQ,EAAE,mBAAmB,CAAC,GAAG,CAAC;QAClC,aAAa,EAAE,mBAAmB,CAAC,GAAG,CAAC;QACvC,eAAe;KAChB,CAAC;IACF,MAAM,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAC5C,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,MA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AAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;QACzC,MAAM,QAAQ,GAAG,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACrC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAC3B,CAAC,SAAS,EAAE,EAAE,CAAC,QAAQ,KAAK,SAAS,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,CAC5F,CAAC;QACF,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,CAAC,GAAG,CAAC,qDAAqD,CAAC,CAAC;YAClE,OAAO;QACT,CAAC;QACD,MAAM,UAAU,GAAG,0BAA0B,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACnE,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export { composeShell } from "./compose.js";
|
|
2
|
+
export type { ShellConfig, ComposedShell } from "./compose.js";
|
|
3
|
+
export { createGateway } from "./gateway.js";
|
|
4
|
+
export type { GatewayConfig, BrickMount, BrickUpgradeMount } from "./gateway.js";
|
|
5
|
+
export { bootShell } from "./boot.js";
|
|
6
|
+
export type { BootedShell, BootConfig } from "./boot.js";
|
|
7
|
+
export { ChatHost } from "./chat-host.js";
|
|
8
|
+
export type { ChatDriver, ChatHostConfig } from "./chat-host.js";
|
|
9
|
+
export { ChatRelayHost } from "./chat-relay-host.js";
|
|
10
|
+
export type { ChatRelayHostConfig } from "./chat-relay-host.js";
|
|
11
|
+
export { createClaudeCodeDriver } from "./drivers/claude-code.js";
|
|
12
|
+
export type { ClaudeCodeDriverOptions, ClaudeQuery } from "./drivers/claude-code.js";
|
|
13
|
+
export { engineSurfaceProbes, measureEngineParity, paritySummary } from "./parity.js";
|
|
14
|
+
export type { ParityProbe, ParityResult, ParityOptions, ParitySummary } from "./parity.js";
|
|
15
|
+
export { FileStateEventStore } from "./state-store.js";
|
|
16
|
+
export { FileWorkspaceStore } from "./workspace-store.js";
|
|
17
|
+
export { WireClient, WireRequestError } from "./wire-client.js";
|
|
18
|
+
export type { WireClientOptions } from "./wire-client.js";
|
|
19
|
+
export { UserGroundHost } from "./user-ground-host.js";
|
|
20
|
+
export type { UserGroundHostOptions } from "./user-ground-host.js";
|
|
21
|
+
export { MachineHost, defaultMachineName } from "./machine-host.js";
|
|
22
|
+
export type { MachineHostOptions } from "./machine-host.js";
|
|
23
|
+
export { shellReleaseCatalog, shellReleaseVerifier } from "./release-catalog.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { composeShell } from "./compose.js";
|
|
2
|
+
export { createGateway } from "./gateway.js";
|
|
3
|
+
export { bootShell } from "./boot.js";
|
|
4
|
+
export { ChatHost } from "./chat-host.js";
|
|
5
|
+
export { ChatRelayHost } from "./chat-relay-host.js";
|
|
6
|
+
export { createClaudeCodeDriver } from "./drivers/claude-code.js";
|
|
7
|
+
export { engineSurfaceProbes, measureEngineParity, paritySummary } from "./parity.js";
|
|
8
|
+
export { FileStateEventStore } from "./state-store.js";
|
|
9
|
+
export { FileWorkspaceStore } from "./workspace-store.js";
|
|
10
|
+
export { WireClient, WireRequestError } from "./wire-client.js";
|
|
11
|
+
export { UserGroundHost } from "./user-ground-host.js";
|
|
12
|
+
export { MachineHost, defaultMachineName } from "./machine-host.js";
|
|
13
|
+
export { shellReleaseCatalog, shellReleaseVerifier } from "./release-catalog.js";
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEtF,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEhE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEpE,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BrickMount } from "./gateway.js";
|
|
2
|
+
export interface LocalHostConfig {
|
|
3
|
+
readonly home: string;
|
|
4
|
+
readonly env: NodeJS.ProcessEnv;
|
|
5
|
+
readonly amalgmPath: string;
|
|
6
|
+
readonly workspaceRoot: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function localMount(config: LocalHostConfig): BrickMount;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { createLocalApi } from "@amalgm/core/local";
|
|
4
|
+
export function localMount(config) {
|
|
5
|
+
const amalgmPath = config.amalgmPath;
|
|
6
|
+
const workspaceRoot = config.workspaceRoot;
|
|
7
|
+
const api = createLocalApi({
|
|
8
|
+
discovery: discoveryHost(config),
|
|
9
|
+
environment: {
|
|
10
|
+
homedir: config.home,
|
|
11
|
+
workspaceRoot,
|
|
12
|
+
ensure: () => ensureLocalEnvironment(amalgmPath),
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
return {
|
|
16
|
+
prefix: "/local",
|
|
17
|
+
stream: async (req, res, pathname) => {
|
|
18
|
+
try {
|
|
19
|
+
const response = await api(await fetchRequest(req, pathname));
|
|
20
|
+
res.writeHead(response.status, Object.fromEntries(response.headers.entries()));
|
|
21
|
+
res.end(Buffer.from(await response.arrayBuffer()));
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
res.writeHead(500, { "content-type": "application/json" });
|
|
25
|
+
res.end(JSON.stringify({ error: error instanceof Error ? error.message : "internal error" }));
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function discoveryHost(config) {
|
|
31
|
+
return {
|
|
32
|
+
homedir: config.home,
|
|
33
|
+
join,
|
|
34
|
+
exists: existsSync,
|
|
35
|
+
nonEmptyFile(path) {
|
|
36
|
+
try {
|
|
37
|
+
const stats = statSync(path);
|
|
38
|
+
return stats.isFile() && stats.size > 0;
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
readJson(path) {
|
|
45
|
+
try {
|
|
46
|
+
return JSON.parse(readFileSync(path, "utf8"));
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
env: (name) => config.env[name],
|
|
53
|
+
// CLI/keychain probing is an optional host fact. File and env evidence
|
|
54
|
+
// remain useful when no interactive credential backend is composed.
|
|
55
|
+
authStatus: () => null,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function ensureLocalEnvironment(root) {
|
|
59
|
+
let created = false;
|
|
60
|
+
for (const directory of ["", "browser", "agents", "instructions", ".memories", "conversations/active", "conversations/saved", "workspaces"]) {
|
|
61
|
+
const path = join(root, directory);
|
|
62
|
+
if (!existsSync(path)) {
|
|
63
|
+
mkdirSync(path, { recursive: true });
|
|
64
|
+
created = true;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const configFile = join(root, "config.json");
|
|
68
|
+
if (!existsSync(configFile)) {
|
|
69
|
+
writeFileSync(configFile, JSON.stringify({ version: 1, createdAt: new Date().toISOString() }, null, 2) + "\n");
|
|
70
|
+
created = true;
|
|
71
|
+
}
|
|
72
|
+
const discoveryFile = join(root, "agents", "discovery.json");
|
|
73
|
+
if (!existsSync(discoveryFile)) {
|
|
74
|
+
writeFileSync(discoveryFile, JSON.stringify({ version: 1, lastScan: null, discovered: [] }, null, 2) + "\n");
|
|
75
|
+
created = true;
|
|
76
|
+
}
|
|
77
|
+
return { created, path: root };
|
|
78
|
+
}
|
|
79
|
+
async function fetchRequest(req, pathname) {
|
|
80
|
+
const url = new URL(req.url ?? pathname, "http://local.local");
|
|
81
|
+
const headers = new Headers();
|
|
82
|
+
for (const [name, value] of Object.entries(req.headers)) {
|
|
83
|
+
if (Array.isArray(value))
|
|
84
|
+
for (const item of value)
|
|
85
|
+
headers.append(name, item);
|
|
86
|
+
else if (value !== undefined)
|
|
87
|
+
headers.set(name, value);
|
|
88
|
+
}
|
|
89
|
+
const method = req.method ?? "GET";
|
|
90
|
+
const chunks = [];
|
|
91
|
+
if (method !== "GET" && method !== "HEAD") {
|
|
92
|
+
for await (const chunk of req)
|
|
93
|
+
chunks.push(chunk);
|
|
94
|
+
}
|
|
95
|
+
return new Request(`http://local.local${pathname}${url.search}`, {
|
|
96
|
+
method,
|
|
97
|
+
headers,
|
|
98
|
+
body: chunks.length ? Buffer.concat(chunks) : undefined,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=local-host.js.map
|
|
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K,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;QACxD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YAAE,KAAK,MAAM,IAAI,IAAI,KAAK;gBAAE,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;aAC1E,IAAI,KAAK,KAAK,SAAS;YAAE,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACzD,CAAC;IACD,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,IAAI,KAAK,CAAC;IACnC,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,MAAM,KAAK,KAAK,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QAC1C,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG;YAAE,MAAM,CAAC,IAAI,CAAC,KAAe,CAAC,CAAC;IAC9D,CAAC;IACD,OAAO,IAAI,OAAO,CAAC,qBAAqB,QAAQ,GAAG,GAAG,CAAC,MAAM,EAAE,EAAE;QAC/D,MAAM;QACN,OAAO;QACP,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS;KACxD,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type JoinMachineInput, type MachineSetupPorts, type ReadyMachine } from "@amalgm/core/identity";
|
|
2
|
+
export interface MachineHostOptions {
|
|
3
|
+
readonly homedir?: string;
|
|
4
|
+
readonly amalgmRoot?: string;
|
|
5
|
+
/** Required for an unambiguous resume when more than one user is present. */
|
|
6
|
+
readonly userEmail?: string;
|
|
7
|
+
readonly appUrl: string;
|
|
8
|
+
readonly runtimeVersion: string;
|
|
9
|
+
readonly runtimeLabel?: string;
|
|
10
|
+
readonly branch?: string;
|
|
11
|
+
readonly proxyUrl?: string;
|
|
12
|
+
readonly runtimePort?: number;
|
|
13
|
+
readonly showSetup?: (input: {
|
|
14
|
+
verificationUrl: string;
|
|
15
|
+
setupCode: string;
|
|
16
|
+
}) => Promise<void> | void;
|
|
17
|
+
readonly diagnostic?: (event: {
|
|
18
|
+
stage: string;
|
|
19
|
+
status: "started" | "completed" | "failed";
|
|
20
|
+
code?: string;
|
|
21
|
+
}) => void;
|
|
22
|
+
}
|
|
23
|
+
interface MachinePaths {
|
|
24
|
+
readonly userRoot: string;
|
|
25
|
+
readonly machineDir: string;
|
|
26
|
+
readonly publicRecord: string;
|
|
27
|
+
readonly secretAuth: string;
|
|
28
|
+
readonly installation: string;
|
|
29
|
+
readonly status: string;
|
|
30
|
+
}
|
|
31
|
+
/** The production effects around Core's machine-setup operation. It does not
|
|
32
|
+
* decide ordering, readiness, or installation selection; those remain Core. */
|
|
33
|
+
export declare class MachineHost {
|
|
34
|
+
readonly options: MachineHostOptions;
|
|
35
|
+
readonly homedir: string;
|
|
36
|
+
readonly amalgmRoot: string;
|
|
37
|
+
readonly deviceFile: string;
|
|
38
|
+
readonly ports: MachineSetupPorts;
|
|
39
|
+
private selectedUserEmail;
|
|
40
|
+
private groundHost;
|
|
41
|
+
private running;
|
|
42
|
+
constructor(options: MachineHostOptions);
|
|
43
|
+
join(input: Omit<JoinMachineInput, "appUrl" | "platform" | "appVersion" | "runtimeLabel" | "branch">): Promise<ReadyMachine>;
|
|
44
|
+
resume(): Promise<ReadyMachine>;
|
|
45
|
+
selectedPaths(): MachinePaths;
|
|
46
|
+
close(): Promise<void>;
|
|
47
|
+
private ensureInstallationRoot;
|
|
48
|
+
private paths;
|
|
49
|
+
private requireSelectedUser;
|
|
50
|
+
private resolveUserForResume;
|
|
51
|
+
private loadMachine;
|
|
52
|
+
private saveMachine;
|
|
53
|
+
private startRuntime;
|
|
54
|
+
}
|
|
55
|
+
export declare function defaultMachineName(): string;
|
|
56
|
+
export {};
|