linkshell-cli 0.2.125 → 0.2.126

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.
@@ -0,0 +1,18 @@
1
+ declare module "@linkshell/gateway/embedded" {
2
+ export interface EmbeddedGatewayOptions {
3
+ port?: number;
4
+ logLevel?: "debug" | "info" | "warn" | "error";
5
+ silent?: boolean;
6
+ }
7
+
8
+ export interface EmbeddedGateway {
9
+ port: number;
10
+ httpUrl: string;
11
+ wsUrl: string;
12
+ close: () => Promise<void>;
13
+ }
14
+
15
+ export function startEmbeddedGateway(
16
+ options?: EmbeddedGatewayOptions,
17
+ ): Promise<EmbeddedGateway>;
18
+ }
@@ -1,23 +0,0 @@
1
- import type { Envelope } from "@linkshell/protocol";
2
- export interface AcpRelayOptions {
3
- command: string;
4
- args: string[];
5
- cwd: string;
6
- env: Record<string, string>;
7
- sessionId: string;
8
- terminalId: string;
9
- send: (envelope: Envelope) => void;
10
- log: (msg: string) => void;
11
- }
12
- export declare class AcpRelay {
13
- private child;
14
- private readonly options;
15
- private exited;
16
- constructor(options: AcpRelayOptions);
17
- /** Forward an acp.rpc envelope payload to the child's stdin */
18
- write(payload: unknown): void;
19
- kill(): void;
20
- get isExited(): boolean;
21
- get pid(): number | undefined;
22
- onExit(cb: (code: number | null, signal: string | null) => void): void;
23
- }
@@ -1,73 +0,0 @@
1
- import { spawn } from "node:child_process";
2
- import { createInterface } from "node:readline";
3
- import { createEnvelope } from "@linkshell/protocol";
4
- export class AcpRelay {
5
- child;
6
- options;
7
- exited = false;
8
- constructor(options) {
9
- this.options = options;
10
- this.child = spawn(options.command, options.args, {
11
- cwd: options.cwd,
12
- env: options.env,
13
- stdio: ["pipe", "pipe", "pipe"],
14
- });
15
- // Read newline-delimited JSON from stdout
16
- const rl = createInterface({ input: this.child.stdout });
17
- rl.on("line", (line) => {
18
- if (!line.trim())
19
- return;
20
- try {
21
- const msg = JSON.parse(line);
22
- // Wrap JSON-RPC message in acp.rpc envelope and send to gateway
23
- this.options.send(createEnvelope({
24
- type: "acp.rpc",
25
- sessionId: this.options.sessionId,
26
- terminalId: this.options.terminalId,
27
- payload: msg,
28
- }));
29
- }
30
- catch (e) {
31
- this.options.log(`acp-relay: failed to parse stdout line: ${e}`);
32
- }
33
- });
34
- // Log stderr
35
- this.child.stderr?.on("data", (chunk) => {
36
- this.options.log(`acp-relay stderr: ${chunk.toString().trimEnd()}`);
37
- });
38
- this.child.on("exit", (code, signal) => {
39
- this.exited = true;
40
- this.options.log(`acp-relay: process exited (code=${code}, signal=${signal})`);
41
- });
42
- this.child.on("error", (err) => {
43
- this.options.log(`acp-relay: process error: ${err.message}`);
44
- });
45
- }
46
- /** Forward an acp.rpc envelope payload to the child's stdin */
47
- write(payload) {
48
- if (this.exited || !this.child.stdin?.writable)
49
- return;
50
- try {
51
- const line = JSON.stringify(payload) + "\n";
52
- this.child.stdin.write(line);
53
- }
54
- catch (e) {
55
- this.options.log(`acp-relay: failed to write to stdin: ${e}`);
56
- }
57
- }
58
- kill() {
59
- if (!this.exited) {
60
- this.child.kill("SIGTERM");
61
- }
62
- }
63
- get isExited() {
64
- return this.exited;
65
- }
66
- get pid() {
67
- return this.child.pid;
68
- }
69
- onExit(cb) {
70
- this.child.on("exit", cb);
71
- }
72
- }
73
- //# sourceMappingURL=acp-relay.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"acp-relay.js","sourceRoot":"","sources":["../../../../src/runtime/acp-relay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAqB,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,cAAc,EAAqB,MAAM,qBAAqB,CAAC;AAcxE,MAAM,OAAO,QAAQ;IACX,KAAK,CAAe;IACX,OAAO,CAAkB;IAClC,MAAM,GAAG,KAAK,CAAC;IAEvB,YAAY,OAAwB;QAClC,IAAI,CAAC,OAAO,GAAG,OAAO,C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