linkshell-cli 0.2.64 → 0.2.66
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 +3 -0
- package/dist/cli/src/index.js +28 -1
- package/dist/cli/src/index.js.map +1 -1
- package/dist/cli/src/runtime/acp/acp-client.d.ts +41 -0
- package/dist/cli/src/runtime/acp/acp-client.js +102 -0
- package/dist/cli/src/runtime/acp/acp-client.js.map +1 -0
- package/dist/cli/src/runtime/acp/agent-session.d.ts +42 -0
- package/dist/cli/src/runtime/acp/agent-session.js +492 -0
- package/dist/cli/src/runtime/acp/agent-session.js.map +1 -0
- package/dist/cli/src/runtime/acp/json-rpc.d.ts +21 -0
- package/dist/cli/src/runtime/acp/json-rpc.js +150 -0
- package/dist/cli/src/runtime/acp/json-rpc.js.map +1 -0
- package/dist/cli/src/runtime/acp/provider-resolver.d.ts +13 -0
- package/dist/cli/src/runtime/acp/provider-resolver.js +22 -0
- package/dist/cli/src/runtime/acp/provider-resolver.js.map +1 -0
- package/dist/cli/src/runtime/bridge-session.d.ts +9 -0
- package/dist/cli/src/runtime/bridge-session.js +163 -41
- package/dist/cli/src/runtime/bridge-session.js.map +1 -1
- package/dist/cli/src/utils/daemon.d.ts +6 -0
- package/dist/cli/src/utils/daemon.js +22 -0
- package/dist/cli/src/utils/daemon.js.map +1 -1
- package/dist/cli/src/utils/keep-awake.d.ts +6 -0
- package/dist/cli/src/utils/keep-awake.js +48 -0
- package/dist/cli/src/utils/keep-awake.js.map +1 -0
- package/dist/cli/tsconfig.tsbuildinfo +1 -1
- package/dist/shared-protocol/src/index.d.ts +1108 -54
- package/dist/shared-protocol/src/index.js +112 -1
- package/dist/shared-protocol/src/index.js.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +38 -1
- package/src/runtime/acp/acp-client.ts +133 -0
- package/src/runtime/acp/agent-session.ts +589 -0
- package/src/runtime/acp/json-rpc.ts +177 -0
- package/src/runtime/acp/provider-resolver.ts +37 -0
- package/src/runtime/bridge-session.ts +189 -41
- package/src/utils/daemon.ts +28 -0
- package/src/utils/keep-awake.ts +61 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { spawn, type ChildProcess } from "node:child_process";
|
|
2
|
+
import { platform } from "node:os";
|
|
3
|
+
|
|
4
|
+
export interface KeepAwakeHandle {
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
stop: () => void;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function shouldKeepAwake(optionEnabled: boolean | undefined): boolean {
|
|
10
|
+
if (process.env.LINKSHELL_KEEP_AWAKE === "0") return false;
|
|
11
|
+
if (platform() !== "darwin") return false;
|
|
12
|
+
return optionEnabled !== false;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function startKeepAwake(): KeepAwakeHandle {
|
|
16
|
+
if (platform() !== "darwin") {
|
|
17
|
+
return { enabled: false, stop: () => {} };
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
let child: ChildProcess | undefined;
|
|
21
|
+
let stopping = false;
|
|
22
|
+
|
|
23
|
+
try {
|
|
24
|
+
child = spawn("caffeinate", ["-i", "-w", String(process.pid)], {
|
|
25
|
+
stdio: "ignore",
|
|
26
|
+
detached: false,
|
|
27
|
+
});
|
|
28
|
+
} catch (error) {
|
|
29
|
+
process.stderr.write(
|
|
30
|
+
`[bridge] keep-awake unavailable: ${error instanceof Error ? error.message : String(error)}\n`,
|
|
31
|
+
);
|
|
32
|
+
return { enabled: false, stop: () => {} };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
child.on("error", (error) => {
|
|
36
|
+
if (stopping) return;
|
|
37
|
+
process.stderr.write(`[bridge] keep-awake unavailable: ${error.message}\n`);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
child.on("exit", (code, signal) => {
|
|
41
|
+
if (stopping) return;
|
|
42
|
+
process.stderr.write(
|
|
43
|
+
`[bridge] keep-awake stopped unexpectedly (code=${code ?? "null"}, signal=${signal ?? "null"})\n`,
|
|
44
|
+
);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
process.stderr.write(
|
|
48
|
+
"[bridge] keep-awake enabled (macOS idle sleep prevention)\n",
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
enabled: true,
|
|
53
|
+
stop: () => {
|
|
54
|
+
stopping = true;
|
|
55
|
+
if (child && !child.killed) {
|
|
56
|
+
child.kill("SIGTERM");
|
|
57
|
+
}
|
|
58
|
+
child = undefined;
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
}
|