linkshell-cli 0.2.125 → 0.3.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/src/commands/setup.js +2 -20
- package/dist/cli/src/commands/setup.js.map +1 -1
- package/dist/cli/src/index.js +26 -28
- package/dist/cli/src/index.js.map +1 -1
- package/dist/cli/src/providers.d.ts +7 -3
- package/dist/cli/src/providers.js +19 -76
- package/dist/cli/src/providers.js.map +1 -1
- package/dist/cli/src/runtime/acp/agent-session.d.ts +1 -1
- package/dist/cli/src/runtime/acp/agent-session.js +4 -4
- package/dist/cli/src/runtime/acp/agent-session.js.map +1 -1
- package/dist/cli/src/runtime/acp/agent-workspace.d.ts +1 -1
- package/dist/cli/src/runtime/acp/agent-workspace.js +17 -62
- package/dist/cli/src/runtime/acp/agent-workspace.js.map +1 -1
- package/dist/cli/src/runtime/bridge-session.d.ts +1 -31
- package/dist/cli/src/runtime/bridge-session.js +57 -993
- package/dist/cli/src/runtime/bridge-session.js.map +1 -1
- package/dist/cli/src/runtime/screen-fallback.d.ts +1 -1
- package/dist/cli/src/runtime/screen-fallback.js +4 -4
- package/dist/cli/src/runtime/screen-fallback.js.map +1 -1
- package/dist/cli/src/runtime/screen-share.d.ts +1 -1
- package/dist/cli/src/runtime/screen-share.js +7 -7
- package/dist/cli/src/runtime/screen-share.js.map +1 -1
- package/dist/cli/tsconfig.tsbuildinfo +1 -1
- package/dist/shared-protocol/src/index.d.ts +3743 -5570
- package/dist/shared-protocol/src/index.js +19 -84
- package/dist/shared-protocol/src/index.js.map +1 -1
- package/package.json +12 -12
- package/src/commands/setup.ts +5 -31
- package/src/index.ts +29 -34
- package/src/providers.ts +26 -108
- package/src/runtime/acp/agent-workspace.ts +18 -63
- package/src/runtime/bridge-session.ts +57 -1091
- package/src/runtime/screen-fallback.ts +5 -5
- package/src/runtime/screen-share.ts +8 -8
- package/src/types/linkshell-gateway.d.ts +18 -0
- package/dist/cli/src/runtime/acp-relay.d.ts +0 -23
- package/dist/cli/src/runtime/acp-relay.js +0 -73
- package/dist/cli/src/runtime/acp-relay.js.map +0 -1
- package/src/runtime/acp/agent-session.ts +0 -1180
|
@@ -10,7 +10,7 @@ export interface ScreenFallbackOptions {
|
|
|
10
10
|
fps: number;
|
|
11
11
|
quality: number;
|
|
12
12
|
scale: number;
|
|
13
|
-
|
|
13
|
+
hostDeviceId: string;
|
|
14
14
|
onFrame: (envelope: Envelope) => void;
|
|
15
15
|
onStatus: (envelope: Envelope) => void;
|
|
16
16
|
}
|
|
@@ -38,7 +38,7 @@ export class ScreenFallback {
|
|
|
38
38
|
this.options.onStatus(
|
|
39
39
|
createEnvelope({
|
|
40
40
|
type: "screen.status",
|
|
41
|
-
|
|
41
|
+
hostDeviceId: this.options.hostDeviceId,
|
|
42
42
|
payload: { active: true, mode: "fallback" as const },
|
|
43
43
|
}),
|
|
44
44
|
);
|
|
@@ -64,7 +64,7 @@ export class ScreenFallback {
|
|
|
64
64
|
this.options.onStatus(
|
|
65
65
|
createEnvelope({
|
|
66
66
|
type: "screen.status",
|
|
67
|
-
|
|
67
|
+
hostDeviceId: this.options.hostDeviceId,
|
|
68
68
|
payload: { active: false, mode: "off" as const },
|
|
69
69
|
}),
|
|
70
70
|
);
|
|
@@ -88,7 +88,7 @@ export class ScreenFallback {
|
|
|
88
88
|
this.options.onFrame(
|
|
89
89
|
createEnvelope({
|
|
90
90
|
type: "screen.frame",
|
|
91
|
-
|
|
91
|
+
hostDeviceId: this.options.hostDeviceId,
|
|
92
92
|
payload: {
|
|
93
93
|
data: base64,
|
|
94
94
|
width: dims.width,
|
|
@@ -108,7 +108,7 @@ export class ScreenFallback {
|
|
|
108
108
|
this.options.onFrame(
|
|
109
109
|
createEnvelope({
|
|
110
110
|
type: "screen.frame",
|
|
111
|
-
|
|
111
|
+
hostDeviceId: this.options.hostDeviceId,
|
|
112
112
|
payload: {
|
|
113
113
|
data: chunk,
|
|
114
114
|
width: dims.width,
|
|
@@ -22,7 +22,7 @@ function detectMacScreenIndex(): string {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export interface ScreenShareOptions {
|
|
25
|
-
|
|
25
|
+
hostDeviceId: string;
|
|
26
26
|
fps: number;
|
|
27
27
|
quality: number;
|
|
28
28
|
scale: number;
|
|
@@ -111,7 +111,7 @@ export class ScreenShare {
|
|
|
111
111
|
this.options.onSignal(
|
|
112
112
|
createEnvelope({
|
|
113
113
|
type: "screen.ice",
|
|
114
|
-
|
|
114
|
+
hostDeviceId: this.options.hostDeviceId,
|
|
115
115
|
payload: {
|
|
116
116
|
candidate: candidate.candidate,
|
|
117
117
|
sdpMid: candidate.sdpMid ?? null,
|
|
@@ -128,7 +128,7 @@ export class ScreenShare {
|
|
|
128
128
|
this.options.onStatus(
|
|
129
129
|
createEnvelope({
|
|
130
130
|
type: "screen.status",
|
|
131
|
-
|
|
131
|
+
hostDeviceId: this.options.hostDeviceId,
|
|
132
132
|
payload: { active: true, mode: "webrtc" as const },
|
|
133
133
|
}),
|
|
134
134
|
);
|
|
@@ -136,7 +136,7 @@ export class ScreenShare {
|
|
|
136
136
|
this.options.onStatus(
|
|
137
137
|
createEnvelope({
|
|
138
138
|
type: "screen.status",
|
|
139
|
-
|
|
139
|
+
hostDeviceId: this.options.hostDeviceId,
|
|
140
140
|
payload: { active: false, mode: "off" as const, error: `WebRTC ${state}` },
|
|
141
141
|
}),
|
|
142
142
|
);
|
|
@@ -152,7 +152,7 @@ export class ScreenShare {
|
|
|
152
152
|
this.options.onStatus(
|
|
153
153
|
createEnvelope({
|
|
154
154
|
type: "screen.status",
|
|
155
|
-
|
|
155
|
+
hostDeviceId: this.options.hostDeviceId,
|
|
156
156
|
payload: { active: true, mode: "webrtc" as const },
|
|
157
157
|
}),
|
|
158
158
|
);
|
|
@@ -160,7 +160,7 @@ export class ScreenShare {
|
|
|
160
160
|
this.options.onSignal(
|
|
161
161
|
createEnvelope({
|
|
162
162
|
type: "screen.offer",
|
|
163
|
-
|
|
163
|
+
hostDeviceId: this.options.hostDeviceId,
|
|
164
164
|
payload: { sdp: offer.sdp },
|
|
165
165
|
}),
|
|
166
166
|
);
|
|
@@ -172,7 +172,7 @@ export class ScreenShare {
|
|
|
172
172
|
this.options.onStatus(
|
|
173
173
|
createEnvelope({
|
|
174
174
|
type: "screen.status",
|
|
175
|
-
|
|
175
|
+
hostDeviceId: this.options.hostDeviceId,
|
|
176
176
|
payload: {
|
|
177
177
|
active: false,
|
|
178
178
|
mode: "off" as const,
|
|
@@ -221,7 +221,7 @@ export class ScreenShare {
|
|
|
221
221
|
this.options.onStatus(
|
|
222
222
|
createEnvelope({
|
|
223
223
|
type: "screen.status",
|
|
224
|
-
|
|
224
|
+
hostDeviceId: this.options.hostDeviceId,
|
|
225
225
|
payload: { active: false, mode: "off" as const },
|
|
226
226
|
}),
|
|
227
227
|
);
|
|
@@ -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,M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