@alfe.ai/claude-code-host 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/dist/cli.cjs ADDED
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env node
2
+ const require_host_config = require("./host-config.cjs");
3
+ //#region src/cli.ts
4
+ /**
5
+ * `alfe-claude-host` — the daemon-supervised entry point.
6
+ *
7
+ * `alfe-claude-host run` starts the persistent chat bridge and stays alive for
8
+ * the daemon's lifetime. It is spawned by the Alfe daemon (Phase 3
9
+ * `runtime-process.ts` → `{ command:'alfe-claude-host', args:['run'] }`) and
10
+ * supervised like the OpenClaw gateway.
11
+ *
12
+ * PROCESS INVARIANTS (Phase 2 plan B1/B2 + `runtime-process.ts:158-169`):
13
+ * - Exit 0 ONLY on SIGTERM from the daemon (graceful stop).
14
+ * - Exit NON-ZERO on any unrecoverable startup/runtime error (→ the daemon
15
+ * backs off and restarts).
16
+ * - NEVER exit 0 spontaneously — a spontaneous graceful exit hot-loops the
17
+ * daemon's restart path.
18
+ */
19
+ async function run() {
20
+ const host = new require_host_config.ClaudeCodeHost(require_host_config.resolveHostConfig());
21
+ let shuttingDown = false;
22
+ const shutdown = () => {
23
+ if (shuttingDown) return;
24
+ shuttingDown = true;
25
+ try {
26
+ host.stop();
27
+ } finally {
28
+ process.exit(0);
29
+ }
30
+ };
31
+ process.on("SIGTERM", shutdown);
32
+ process.on("SIGINT", shutdown);
33
+ await host.start();
34
+ await new Promise(() => {});
35
+ }
36
+ function main() {
37
+ const cmd = process.argv[2];
38
+ if (cmd && cmd !== "run") {
39
+ process.stderr.write(`Unknown command: ${cmd}\nUsage: alfe-claude-host run\n`);
40
+ process.exit(1);
41
+ }
42
+ run().catch((err) => {
43
+ const message = err instanceof Error ? err.message : String(err);
44
+ process.stderr.write(`[alfe-claude-host] fatal: ${message}\n`);
45
+ process.exit(1);
46
+ });
47
+ }
48
+ main();
49
+ //#endregion
package/dist/cli.d.cts ADDED
@@ -0,0 +1 @@
1
+ export {};
package/dist/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {};
package/dist/cli.js ADDED
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env node
2
+ import { n as ClaudeCodeHost, t as resolveHostConfig } from "./host-config.js";
3
+ //#region src/cli.ts
4
+ /**
5
+ * `alfe-claude-host` — the daemon-supervised entry point.
6
+ *
7
+ * `alfe-claude-host run` starts the persistent chat bridge and stays alive for
8
+ * the daemon's lifetime. It is spawned by the Alfe daemon (Phase 3
9
+ * `runtime-process.ts` → `{ command:'alfe-claude-host', args:['run'] }`) and
10
+ * supervised like the OpenClaw gateway.
11
+ *
12
+ * PROCESS INVARIANTS (Phase 2 plan B1/B2 + `runtime-process.ts:158-169`):
13
+ * - Exit 0 ONLY on SIGTERM from the daemon (graceful stop).
14
+ * - Exit NON-ZERO on any unrecoverable startup/runtime error (→ the daemon
15
+ * backs off and restarts).
16
+ * - NEVER exit 0 spontaneously — a spontaneous graceful exit hot-loops the
17
+ * daemon's restart path.
18
+ */
19
+ async function run() {
20
+ const host = new ClaudeCodeHost(resolveHostConfig());
21
+ let shuttingDown = false;
22
+ const shutdown = () => {
23
+ if (shuttingDown) return;
24
+ shuttingDown = true;
25
+ try {
26
+ host.stop();
27
+ } finally {
28
+ process.exit(0);
29
+ }
30
+ };
31
+ process.on("SIGTERM", shutdown);
32
+ process.on("SIGINT", shutdown);
33
+ await host.start();
34
+ await new Promise(() => {});
35
+ }
36
+ function main() {
37
+ const cmd = process.argv[2];
38
+ if (cmd && cmd !== "run") {
39
+ process.stderr.write(`Unknown command: ${cmd}\nUsage: alfe-claude-host run\n`);
40
+ process.exit(1);
41
+ }
42
+ run().catch((err) => {
43
+ const message = err instanceof Error ? err.message : String(err);
44
+ process.stderr.write(`[alfe-claude-host] fatal: ${message}\n`);
45
+ process.exit(1);
46
+ });
47
+ }
48
+ main();
49
+ //#endregion
50
+ export {};