@grackle-ai/server 0.35.1 → 0.36.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/adapter-manager.d.ts +1 -1
- package/dist/adapter-manager.d.ts.map +1 -1
- package/dist/adapters/codespace.d.ts +1 -1
- package/dist/adapters/codespace.d.ts.map +1 -1
- package/dist/adapters/codespace.js +7 -2
- package/dist/adapters/codespace.js.map +1 -1
- package/dist/adapters/docker.d.ts +1 -1
- package/dist/adapters/docker.d.ts.map +1 -1
- package/dist/adapters/docker.js +8 -3
- package/dist/adapters/docker.js.map +1 -1
- package/dist/adapters/local.d.ts +1 -1
- package/dist/adapters/local.d.ts.map +1 -1
- package/dist/adapters/local.js +1 -1
- package/dist/adapters/local.js.map +1 -1
- package/dist/adapters/ssh.d.ts +1 -1
- package/dist/adapters/ssh.d.ts.map +1 -1
- package/dist/adapters/ssh.js +6 -2
- package/dist/adapters/ssh.js.map +1 -1
- package/dist/grpc-service.js +1 -1
- package/dist/grpc-service.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/ws-bridge.js +1 -1
- package/dist/ws-bridge.js.map +1 -1
- package/package.json +5 -4
- package/dist/adapters/adapter.d.ts +0 -50
- package/dist/adapters/adapter.d.ts.map +0 -1
- package/dist/adapters/adapter.js +0 -24
- package/dist/adapters/adapter.js.map +0 -1
- package/dist/adapters/powerline-transport.d.ts +0 -7
- package/dist/adapters/powerline-transport.d.ts.map +0 -1
- package/dist/adapters/powerline-transport.js +0 -22
- package/dist/adapters/powerline-transport.js.map +0 -1
- package/dist/adapters/remote-adapter-utils.d.ts +0 -161
- package/dist/adapters/remote-adapter-utils.d.ts.map +0 -1
- package/dist/adapters/remote-adapter-utils.js +0 -598
- package/dist/adapters/remote-adapter-utils.js.map +0 -1
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import type { PowerLineConnection, ProvisionEvent } from "./adapter.js";
|
|
2
|
-
import { findFreePort } from "../utils/ports.js";
|
|
3
|
-
import { type ChildProcess } from "node:child_process";
|
|
4
|
-
/** Default timeout for remote command execution. */
|
|
5
|
-
declare const REMOTE_EXEC_DEFAULT_TIMEOUT_MS: number;
|
|
6
|
-
/** Timeout for the initial SSH connectivity test. */
|
|
7
|
-
declare const SSH_CONNECTIVITY_TIMEOUT_MS: number;
|
|
8
|
-
/** Remote directory where PowerLine artifacts are installed. Uses $HOME (not ~) so it expands inside double-quoted shell strings. */
|
|
9
|
-
declare const REMOTE_POWERLINE_DIRECTORY: string;
|
|
10
|
-
/**
|
|
11
|
-
* Check if we are running from a monorepo source checkout.
|
|
12
|
-
* We detect this by checking for `rush.json` at the repo root,
|
|
13
|
-
* computed relative to this file's compiled location (packages/server/dist/adapters → 4 levels up).
|
|
14
|
-
* The old approach (checking for a sibling powerline dist) would false-positive when
|
|
15
|
-
* `@grackle-ai/powerline` is installed alongside the server in node_modules.
|
|
16
|
-
*/
|
|
17
|
-
export declare function isDevMode(): boolean;
|
|
18
|
-
/** Abstraction for executing commands on a remote host. */
|
|
19
|
-
export interface RemoteExecutor {
|
|
20
|
-
/** Execute a shell command on the remote host and return stdout. */
|
|
21
|
-
exec(command: string, opts?: {
|
|
22
|
-
timeout?: number;
|
|
23
|
-
}): Promise<string>;
|
|
24
|
-
/** Copy a local file or directory to a path on the remote host. */
|
|
25
|
-
copyTo(localPath: string, remotePath: string): Promise<void>;
|
|
26
|
-
}
|
|
27
|
-
/** Abstraction for a long-lived port-forwarding tunnel. */
|
|
28
|
-
export interface RemoteTunnel {
|
|
29
|
-
/** The local port the tunnel is bound to. */
|
|
30
|
-
localPort: number;
|
|
31
|
-
/** Open the tunnel (spawns a background process). */
|
|
32
|
-
open(): Promise<void>;
|
|
33
|
-
/** Close the tunnel (kills the background process). */
|
|
34
|
-
close(): Promise<void>;
|
|
35
|
-
/** Return true if the tunnel process is still running. */
|
|
36
|
-
isAlive(): boolean;
|
|
37
|
-
}
|
|
38
|
-
interface TunnelState {
|
|
39
|
-
tunnel: RemoteTunnel;
|
|
40
|
-
/** Optional reverse tunnel so remote agents can reach the host MCP endpoint. */
|
|
41
|
-
reverseTunnel?: RemoteTunnel;
|
|
42
|
-
}
|
|
43
|
-
/** Register an active tunnel for an environment, closing any existing tunnel first. */
|
|
44
|
-
export declare function registerTunnel(environmentId: string, state: TunnelState): void;
|
|
45
|
-
/** Get the tunnel state for an environment. */
|
|
46
|
-
export declare function getTunnel(environmentId: string): TunnelState | undefined;
|
|
47
|
-
/** Close and unregister the tunnel(s) for an environment. */
|
|
48
|
-
export declare function closeTunnel(environmentId: string): Promise<void>;
|
|
49
|
-
/** Close all active tunnels (called during server shutdown). */
|
|
50
|
-
export declare function closeAllTunnels(): Promise<void>;
|
|
51
|
-
/**
|
|
52
|
-
* Base class for tunnels backed by a long-lived child process.
|
|
53
|
-
* Subclasses provide the command and arguments to spawn.
|
|
54
|
-
*/
|
|
55
|
-
export declare abstract class ProcessTunnel implements RemoteTunnel {
|
|
56
|
-
localPort: number;
|
|
57
|
-
protected process: ChildProcess | undefined;
|
|
58
|
-
constructor(localPort: number);
|
|
59
|
-
/** Return the command and arguments to spawn the tunnel process. */
|
|
60
|
-
protected abstract spawnArgs(): {
|
|
61
|
-
command: string;
|
|
62
|
-
args: string[];
|
|
63
|
-
};
|
|
64
|
-
/** Open the tunnel by spawning the background process. */
|
|
65
|
-
open(): Promise<void>;
|
|
66
|
-
/** Close the tunnel by killing the background process. */
|
|
67
|
-
close(): Promise<void>;
|
|
68
|
-
/** Return true if the tunnel process is still running. */
|
|
69
|
-
isAlive(): boolean;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Write the environment variable file to the remote PowerLine directory.
|
|
73
|
-
* Used during both initial bootstrap and reconnect (tokens may have rotated).
|
|
74
|
-
*/
|
|
75
|
-
export declare function writeRemoteEnvFile(executor: RemoteExecutor, powerlineToken: string, extraEnv?: Record<string, string>): Promise<void>;
|
|
76
|
-
/**
|
|
77
|
-
* Probe whether the remote PowerLine is listening on its port.
|
|
78
|
-
* Throws if the port is not reachable.
|
|
79
|
-
*/
|
|
80
|
-
export declare function probeRemotePowerLine(executor: RemoteExecutor): Promise<void>;
|
|
81
|
-
/** Options for {@link startRemotePowerLine}. */
|
|
82
|
-
interface StartRemotePowerLineOptions {
|
|
83
|
-
/** Additional environment variables forwarded to the remote PowerLine. */
|
|
84
|
-
extraEnv?: Record<string, string>;
|
|
85
|
-
/** Explicit working directory for the PowerLine process. */
|
|
86
|
-
workingDirectory?: string;
|
|
87
|
-
/**
|
|
88
|
-
* Host address to bind the PowerLine to. Defaults to unset (PowerLine's
|
|
89
|
-
* own default, 127.0.0.1). Use "0.0.0.0" for Docker containers where
|
|
90
|
-
* the port is accessed via Docker's port mapping.
|
|
91
|
-
*/
|
|
92
|
-
host?: string;
|
|
93
|
-
/**
|
|
94
|
-
* When true, detects `/workspaces/*\/` on the remote host (codespace
|
|
95
|
-
* convention) and uses it as the working directory.
|
|
96
|
-
*/
|
|
97
|
-
autoDetectWorkspace?: boolean;
|
|
98
|
-
/**
|
|
99
|
-
* When true, the compound script starts with a TCP probe and exits
|
|
100
|
-
* immediately if PowerLine is already listening. This avoids a separate
|
|
101
|
-
* SSH round trip for the initial health check.
|
|
102
|
-
*/
|
|
103
|
-
probeFirst?: boolean;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Ensure the remote PowerLine process is running.
|
|
107
|
-
*
|
|
108
|
-
* Batches env-var write, process start, and port probe into a **single SSH
|
|
109
|
-
* call** to minimize per-call latency (each `gh codespace ssh` round trip
|
|
110
|
-
* takes ~10-15 s through GitHub's relay).
|
|
111
|
-
*
|
|
112
|
-
* Uses Node's `spawn({ detached: true })` to properly daemonize the
|
|
113
|
-
* PowerLine process, avoiding the SSH-hanging issue where `nohup ... &`
|
|
114
|
-
* keeps the session alive through GitHub's codespace relay.
|
|
115
|
-
*
|
|
116
|
-
* When `probeFirst` is true the script begins with a TCP port check and
|
|
117
|
-
* returns immediately if PowerLine is already listening, combining the
|
|
118
|
-
* "is it alive?" check and the "start if not" logic into one SSH call.
|
|
119
|
-
*
|
|
120
|
-
* This is the "restart" middle path — it assumes code is already installed
|
|
121
|
-
* and skips npm install, git checks, and artifact copies.
|
|
122
|
-
*/
|
|
123
|
-
export declare function startRemotePowerLine(executor: RemoteExecutor, powerlineToken: string, options?: StartRemotePowerLineOptions): Promise<{
|
|
124
|
-
alreadyRunning: boolean;
|
|
125
|
-
}>;
|
|
126
|
-
/**
|
|
127
|
-
* Bootstrap the PowerLine on a remote host via the given executor.
|
|
128
|
-
* Yields progress events for each stage of the process.
|
|
129
|
-
* @param extraEnv - Additional env vars to forward (from adapter config).
|
|
130
|
-
*/
|
|
131
|
-
export declare function bootstrapPowerLine(executor: RemoteExecutor, powerlineToken: string, extraEnv?: Record<string, string>, workingDirectory?: string, host?: string): AsyncGenerator<ProvisionEvent>;
|
|
132
|
-
/**
|
|
133
|
-
* Connect to a PowerLine through a local tunnel port, retrying until the gRPC
|
|
134
|
-
* service responds to a ping.
|
|
135
|
-
*/
|
|
136
|
-
export declare function connectThroughTunnel(environmentId: string, localPort: number, powerlineToken: string): Promise<PowerLineConnection>;
|
|
137
|
-
/**
|
|
138
|
-
* Poll until a TCP connection can be established on localhost at the given port.
|
|
139
|
-
* Used to wait for a tunnel process to begin accepting connections.
|
|
140
|
-
*/
|
|
141
|
-
export declare function waitForLocalPort(port: number): Promise<void>;
|
|
142
|
-
/**
|
|
143
|
-
* Build a shell command that kills the remote PowerLine process.
|
|
144
|
-
* Prefers killing by tracked PID (written at startup) to avoid terminating
|
|
145
|
-
* unrelated services on the same port. Falls back to port-based kill.
|
|
146
|
-
*/
|
|
147
|
-
export declare function buildRemoteKillCommand(): string;
|
|
148
|
-
/**
|
|
149
|
-
* Stop the remote PowerLine process and close the tunnel.
|
|
150
|
-
* Shared by SSH and Codespace adapters.
|
|
151
|
-
*/
|
|
152
|
-
export declare function remoteStop(environmentId: string, executor: RemoteExecutor): Promise<void>;
|
|
153
|
-
/**
|
|
154
|
-
* Stop the remote PowerLine, remove artifacts, and close the tunnel.
|
|
155
|
-
* Shared by SSH and Codespace adapters.
|
|
156
|
-
*/
|
|
157
|
-
export declare function remoteDestroy(environmentId: string, executor: RemoteExecutor): Promise<void>;
|
|
158
|
-
/** Check that the tunnel is alive and the PowerLine responds to a ping. */
|
|
159
|
-
export declare function remoteHealthCheck(connection: PowerLineConnection): Promise<boolean>;
|
|
160
|
-
export { findFreePort, REMOTE_POWERLINE_DIRECTORY, SSH_CONNECTIVITY_TIMEOUT_MS, REMOTE_EXEC_DEFAULT_TIMEOUT_MS };
|
|
161
|
-
//# sourceMappingURL=remote-adapter-utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remote-adapter-utils.d.ts","sourceRoot":"","sources":["../../src/adapters/remote-adapter-utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAExE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD,OAAO,EAAS,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAU9D,oDAAoD;AACpD,QAAA,MAAM,8BAA8B,EAAE,MAAe,CAAC;AAatD,qDAAqD;AACrD,QAAA,MAAM,2BAA2B,EAAE,MAAe,CAAC;AACnD,qIAAqI;AACrI,QAAA,MAAM,0BAA0B,EAAE,MAAmC,CAAC;AAItE;;;;;;GAMG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAGnC;AAcD,2DAA2D;AAC3D,MAAM,WAAW,cAAc;IAC7B,oEAAoE;IACpE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACpE,mEAAmE;IACnE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EA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