@anhlp/alp-client 0.0.1-beta.3 → 0.0.1-beta.5
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 +22 -1
- package/dist/antigravity-probe.d.ts +1 -2
- package/dist/antigravity-probe.js +11 -5
- package/dist/command.js +3 -1
- package/dist/doctor.d.ts +1 -0
- package/dist/doctor.js +105 -11
- package/dist/index.d.ts +92 -6
- package/dist/index.js +206 -37
- package/dist/integration-lock.d.ts +37 -0
- package/dist/integration-lock.js +199 -0
- package/dist/mcp-probe.js +1 -1
- package/dist/portable.d.ts +3 -1
- package/dist/portable.js +11 -2
- package/dist/rpc/handshake.d.ts +6 -1
- package/dist/rpc/handshake.js +4 -2
- package/dist/rpc/registry.d.ts +218 -0
- package/dist/rpc/registry.js +218 -0
- package/dist/rpc/terminal-directory.d.ts +24 -0
- package/dist/rpc/terminal-directory.js +70 -0
- package/dist/service.d.ts +1 -1
- package/dist/service.js +3 -1
- package/dist/setup.js +6 -5
- package/dist/supervise.d.ts +3 -1
- package/dist/supervise.js +14 -10
- package/package.json +11 -3
- package/src/antigravity-probe.js +12 -5
- package/src/command.js +3 -1
- package/src/doctor.d.ts +1 -0
- package/src/doctor.js +106 -1
- package/src/index.js +285 -39
- package/src/integration-lock.js +203 -0
- package/src/mcp-probe.js +1 -1
- package/src/portable.js +4 -1
- package/src/rpc/handshake.js +7 -2
- package/src/rpc/registry.js +224 -0
- package/src/rpc/terminal-directory.js +61 -0
- package/src/service.js +5 -2
- package/src/setup.js +7 -5
- package/src/supervise.d.ts +3 -1
- package/src/supervise.js +18 -11
package/dist/mcp-probe.js
CHANGED
|
@@ -25,7 +25,7 @@ async function probeMcp(server, { cwd, timeoutMs = 15e3 } = {}) {
|
|
|
25
25
|
function stdioSession(server, cwd, timeoutMs) {
|
|
26
26
|
const env = { ...process.env, ...server.env ?? {} };
|
|
27
27
|
const launch = launchCommand(server.command, server.args ?? [], env);
|
|
28
|
-
const child = spawn(launch.command, launch.args, { cwd: server.cwd ?? cwd, env, stdio: ["pipe", "pipe", "pipe"], detached: true });
|
|
28
|
+
const child = spawn(launch.command, launch.args, { cwd: server.cwd ?? cwd, env: launch.env ? { ...env, ...launch.env } : env, stdio: ["pipe", "pipe", "pipe"], detached: true });
|
|
29
29
|
const signal = (name) => {
|
|
30
30
|
try {
|
|
31
31
|
process.kill(-child.pid, name);
|
package/dist/portable.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { watchTerminals } from "./rpc/terminal-directory.js";
|
|
2
2
|
export type AlpTransport = import("./rpc/client.js").AlpTransport;
|
|
3
3
|
export type TransportClose = import("./rpc/client.js").TransportClose;
|
|
4
4
|
export type TransportState = import("./rpc/client.js").TransportState;
|
|
@@ -15,4 +15,6 @@ export { AlpRpcClient, DEFAULT_MAX_PENDING } from "./rpc/client.js";
|
|
|
15
15
|
export { AlpClientError, CLIENT_ERROR, isAlpClientError } from "./rpc/errors.js";
|
|
16
16
|
export { createLineDecoder, utf8Length } from "./rpc/framing.js";
|
|
17
17
|
export { MAX_TIMER_MS, timerDelay } from "./rpc/timers.js";
|
|
18
|
+
export { AGENT_CAPABILITY, hello } from "./rpc/handshake.js";
|
|
18
19
|
export { backoffDelay, createReconnectingClient, retryable } from "./rpc/reconnect.js";
|
|
20
|
+
export { attachments, base64Encode, conversation, sha256Hex, workspaceRegistry } from "./rpc/registry.js";
|
package/dist/portable.js
CHANGED
|
@@ -4,9 +4,12 @@ import { AlpRpcClient, DEFAULT_MAX_PENDING } from "./rpc/client.js";
|
|
|
4
4
|
import { AlpClientError, CLIENT_ERROR, isAlpClientError } from "./rpc/errors.js";
|
|
5
5
|
import { createLineDecoder, utf8Length } from "./rpc/framing.js";
|
|
6
6
|
import { MAX_TIMER_MS, timerDelay } from "./rpc/timers.js";
|
|
7
|
-
import { hello } from "./rpc/handshake.js";
|
|
7
|
+
import { AGENT_CAPABILITY, hello } from "./rpc/handshake.js";
|
|
8
8
|
import { backoffDelay, createReconnectingClient, retryable } from "./rpc/reconnect.js";
|
|
9
|
+
import { attachments, base64Encode, conversation, sha256Hex, workspaceRegistry } from "./rpc/registry.js";
|
|
10
|
+
import { watchTerminals } from "./rpc/terminal-directory.js";
|
|
9
11
|
export {
|
|
12
|
+
AGENT_CAPABILITY,
|
|
10
13
|
AlpClientError,
|
|
11
14
|
AlpRpcClient,
|
|
12
15
|
AlpRpcError,
|
|
@@ -16,12 +19,18 @@ export {
|
|
|
16
19
|
MAX_FRAME,
|
|
17
20
|
MAX_TIMER_MS,
|
|
18
21
|
PROTOCOL_VERSION,
|
|
22
|
+
attachments,
|
|
19
23
|
backoffDelay,
|
|
24
|
+
base64Encode,
|
|
25
|
+
conversation,
|
|
20
26
|
createLineDecoder,
|
|
21
27
|
createReconnectingClient,
|
|
22
28
|
hello,
|
|
23
29
|
isAlpClientError,
|
|
24
30
|
retryable,
|
|
31
|
+
sha256Hex,
|
|
25
32
|
timerDelay,
|
|
26
|
-
utf8Length
|
|
33
|
+
utf8Length,
|
|
34
|
+
watchTerminals,
|
|
35
|
+
workspaceRegistry
|
|
27
36
|
};
|
package/dist/rpc/handshake.d.ts
CHANGED
|
@@ -6,13 +6,18 @@
|
|
|
6
6
|
* @param {{ request(method: string, params?: unknown, options?: import('./client.js').RequestOptions): Promise<any> }} client
|
|
7
7
|
* @param {ClientInfo} [info]
|
|
8
8
|
* @param {import('./client.js').RequestOptions} [options]
|
|
9
|
+
* @param {{ agent?: boolean }} [principal] `agent`: an ALP agent started this process (the Node entry reads ALP_AGENT_SESSION).
|
|
9
10
|
* @returns {Promise<{ protocolVersion: number } & Record<string, unknown>>}
|
|
10
11
|
*/
|
|
11
12
|
export function hello(client: {
|
|
12
13
|
request(method: string, params?: unknown, options?: import("./client.js").RequestOptions): Promise<any>;
|
|
13
|
-
}, info?: ClientInfo, options?: import("./client.js").RequestOptions
|
|
14
|
+
}, info?: ClientInfo, options?: import("./client.js").RequestOptions, { agent }?: {
|
|
15
|
+
agent?: boolean;
|
|
16
|
+
}): Promise<{
|
|
14
17
|
protocolVersion: number;
|
|
15
18
|
} & Record<string, unknown>>;
|
|
19
|
+
/** The daemon.hello capability a process an ALP agent started announces. */
|
|
20
|
+
export const AGENT_CAPABILITY: "principal.agent";
|
|
16
21
|
export type ClientInfo = {
|
|
17
22
|
name: string;
|
|
18
23
|
version: string;
|
package/dist/rpc/handshake.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
// packages/client/src/rpc/handshake.js
|
|
2
2
|
import { PROTOCOL_VERSION } from "@anhlp/alp-protocol";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
var AGENT_CAPABILITY = "principal.agent";
|
|
4
|
+
function hello(client, info = { name: "alp", version: "0" }, options, { agent = false } = {}) {
|
|
5
|
+
return client.request("daemon.hello", { protocolVersion: PROTOCOL_VERSION, client: info, ...agent ? { capabilities: [AGENT_CAPABILITY] } : {} }, options);
|
|
5
6
|
}
|
|
6
7
|
export {
|
|
8
|
+
AGENT_CAPABILITY,
|
|
7
9
|
hello
|
|
8
10
|
};
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/** Typed registry methods for portable clients. Mutations are sent once: callers retain requestId
|
|
2
|
+
* and ifRevision to reconcile a timeout by repeating the identical request. @param {{request<T = any>(method: string, params?: unknown): Promise<T>}} client */
|
|
3
|
+
export function workspaceRegistry(client: {
|
|
4
|
+
request<T = any>(method: string, params?: unknown): Promise<T>;
|
|
5
|
+
}): {
|
|
6
|
+
/** @param {string} workspaceId @returns {Promise<import('@anhlp/alp-protocol').RpcMethodMap['workspace.worktree.options']['result']>} */
|
|
7
|
+
worktreeOptions: (workspaceId: string) => Promise<import("@anhlp/alp-protocol").RpcMethodMap["workspace.worktree.options"]["result"]>;
|
|
8
|
+
/** @param {import('@anhlp/alp-protocol').RpcMethodMap['workspace.worktree.create']['params']} params @returns {Promise<import('@anhlp/alp-protocol').RpcMethodMap['workspace.worktree.create']['result']>} */
|
|
9
|
+
createWorktree: (params: import("@anhlp/alp-protocol").RpcMethodMap["workspace.worktree.create"]["params"]) => Promise<import("@anhlp/alp-protocol").RpcMethodMap["workspace.worktree.create"]["result"]>;
|
|
10
|
+
/** @param {import('@anhlp/alp-protocol').RpcMethodMap['workspace.worktree.remove']['params']} params @returns {Promise<import('@anhlp/alp-protocol').RpcMethodMap['workspace.worktree.remove']['result']>} */
|
|
11
|
+
removeWorktree: (params: import("@anhlp/alp-protocol").RpcMethodMap["workspace.worktree.remove"]["params"]) => Promise<import("@anhlp/alp-protocol").RpcMethodMap["workspace.worktree.remove"]["result"]>;
|
|
12
|
+
/** Read-only Git status of a registry workspace (capability `workspace.git`, §12.5). @param {string} workspaceId @returns {Promise<import('@anhlp/alp-protocol').RpcMethodMap['workspace.git.status']['result']>} */
|
|
13
|
+
gitStatus: (workspaceId: string) => Promise<import("@anhlp/alp-protocol").RpcMethodMap["workspace.git.status"]["result"]>;
|
|
14
|
+
/** One page of a read-only Git diff; pass `nextCursor` back as `cursor` with the same comparison and path. @param {import('@anhlp/alp-protocol').RpcMethodMap['workspace.git.diff']['params']} params @returns {Promise<import('@anhlp/alp-protocol').RpcMethodMap['workspace.git.diff']['result']>} */
|
|
15
|
+
gitDiff: (params: import("@anhlp/alp-protocol").RpcMethodMap["workspace.git.diff"]["params"]) => Promise<import("@anhlp/alp-protocol").RpcMethodMap["workspace.git.diff"]["result"]>;
|
|
16
|
+
/** @param {import('@anhlp/alp-protocol').RpcMethodMap['project.list']['params']} [params] @returns {Promise<import('@anhlp/alp-protocol').RpcMethodMap['project.list']['result']>} */
|
|
17
|
+
projects: (params?: import("@anhlp/alp-protocol").RpcMethodMap["project.list"]["params"]) => Promise<import("@anhlp/alp-protocol").RpcMethodMap["project.list"]["result"]>;
|
|
18
|
+
/** @param {import('@anhlp/alp-protocol').RpcMethodMap['workspace.list']['params']} [params] @returns {Promise<import('@anhlp/alp-protocol').RpcMethodMap['workspace.list']['result']>} */
|
|
19
|
+
workspaces: (params?: import("@anhlp/alp-protocol").RpcMethodMap["workspace.list"]["params"]) => Promise<import("@anhlp/alp-protocol").RpcMethodMap["workspace.list"]["result"]>;
|
|
20
|
+
/** @param {string} workspaceId @returns {Promise<import('@anhlp/alp-protocol').RpcMethodMap['workspace.get']['result']>} */
|
|
21
|
+
get: (workspaceId: string) => Promise<import("@anhlp/alp-protocol").RpcMethodMap["workspace.get"]["result"]>;
|
|
22
|
+
/** @param {import('@anhlp/alp-protocol').RpcMethodMap['project.register']['params']} params @returns {Promise<import('@anhlp/alp-protocol').RpcMethodMap['project.register']['result']>} */
|
|
23
|
+
register: (params: import("@anhlp/alp-protocol").RpcMethodMap["project.register"]["params"]) => Promise<import("@anhlp/alp-protocol").RpcMethodMap["project.register"]["result"]>;
|
|
24
|
+
/** @param {import('@anhlp/alp-protocol').RpcMethodMap['project.remove']['params']} params @returns {Promise<import('@anhlp/alp-protocol').RpcMethodMap['project.remove']['result']>} */
|
|
25
|
+
remove: (params: import("@anhlp/alp-protocol").RpcMethodMap["project.remove"]["params"]) => Promise<import("@anhlp/alp-protocol").RpcMethodMap["project.remove"]["result"]>;
|
|
26
|
+
/** @param {import('@anhlp/alp-protocol').RpcMethodMap['workspace.update']['params']} params @returns {Promise<import('@anhlp/alp-protocol').RpcMethodMap['workspace.update']['result']>} */
|
|
27
|
+
update: (params: import("@anhlp/alp-protocol").RpcMethodMap["workspace.update"]["params"]) => Promise<import("@anhlp/alp-protocol").RpcMethodMap["workspace.update"]["result"]>;
|
|
28
|
+
};
|
|
29
|
+
/** Canonical base64 of `bytes`, without Buffer or btoa, so it runs in browsers and Node alike. @param {Uint8Array} bytes */
|
|
30
|
+
export function base64Encode(bytes: Uint8Array): string;
|
|
31
|
+
/** Lowercase hex SHA-256 of `bytes` through WebCrypto (browsers' secure contexts, Node 19+). @param {Uint8Array} bytes */
|
|
32
|
+
export function sha256Hex(bytes: Uint8Array): Promise<string>;
|
|
33
|
+
/**
|
|
34
|
+
* Typed attachment methods (capability `attachments`, docs/protocol/alp-json-rpc-v1.md §12.6) and a
|
|
35
|
+
* chunked upload that keeps to the limits the daemon (or gateway) advertised. Mutations are sent
|
|
36
|
+
* once: `upload` resumes an interrupted upload by repeating its begin with the same requestId and
|
|
37
|
+
* continues from what the daemon holds.
|
|
38
|
+
* @param {{request<T = any>(method: string, params?: unknown): Promise<T>}} client
|
|
39
|
+
*/
|
|
40
|
+
export function attachments(client: {
|
|
41
|
+
request<T = any>(method: string, params?: unknown): Promise<T>;
|
|
42
|
+
}): {
|
|
43
|
+
/** @param {Map['attachment.begin']['params']} params @returns {Promise<Map['attachment.begin']['result']>} */
|
|
44
|
+
begin: (params: import("@anhlp/alp-protocol").PrincipalContext & {
|
|
45
|
+
sessionId: string;
|
|
46
|
+
name: string;
|
|
47
|
+
size: number;
|
|
48
|
+
mimeType: string;
|
|
49
|
+
sha256?: string;
|
|
50
|
+
requestId: string;
|
|
51
|
+
}) => Promise<{
|
|
52
|
+
uploadId: string;
|
|
53
|
+
state: "uploading" | "committed";
|
|
54
|
+
received: number;
|
|
55
|
+
size: number;
|
|
56
|
+
maxChunkBytes: number;
|
|
57
|
+
expiresAt?: string;
|
|
58
|
+
attachmentId?: string;
|
|
59
|
+
}>;
|
|
60
|
+
/** @param {Map['attachment.chunk']['params']} params @returns {Promise<Map['attachment.chunk']['result']>} */
|
|
61
|
+
chunk: (params: import("@anhlp/alp-protocol").PrincipalContext & {
|
|
62
|
+
uploadId: string;
|
|
63
|
+
offset: number;
|
|
64
|
+
data: string;
|
|
65
|
+
}) => Promise<{
|
|
66
|
+
received: number;
|
|
67
|
+
size: number;
|
|
68
|
+
}>;
|
|
69
|
+
/** @param {Map['attachment.commit']['params']} params @returns {Promise<Map['attachment.commit']['result']>} */
|
|
70
|
+
commit: (params: import("@anhlp/alp-protocol").PrincipalContext & {
|
|
71
|
+
uploadId: string;
|
|
72
|
+
sha256: string;
|
|
73
|
+
}) => Promise<{
|
|
74
|
+
attachment: import("@anhlp/alp-protocol").AttachmentInfo;
|
|
75
|
+
}>;
|
|
76
|
+
/** @param {string} uploadId @returns {Promise<Map['attachment.abort']['result']>} */
|
|
77
|
+
abort: (uploadId: string) => Promise<{
|
|
78
|
+
aborted: true;
|
|
79
|
+
}>;
|
|
80
|
+
/** Metadata only (no bytes, no path). @param {string} attachmentId @returns {Promise<Map['attachment.get']['result']>} */
|
|
81
|
+
get: (attachmentId: string) => Promise<{
|
|
82
|
+
attachment: import("@anhlp/alp-protocol").AttachmentInfo;
|
|
83
|
+
}>;
|
|
84
|
+
/** Refused (1004 attachment_referenced) while a prompt references it. @param {string} attachmentId @returns {Promise<Map['attachment.delete']['result']>} */
|
|
85
|
+
delete: (attachmentId: string) => Promise<{
|
|
86
|
+
deleted: true;
|
|
87
|
+
}>;
|
|
88
|
+
/**
|
|
89
|
+
* Uploads `data` and commits it: begin (or resume, with the same requestId), chunks of at most
|
|
90
|
+
* the smaller of `maxChunkBytes` and what begin answered, commit with its SHA-256. A chunk
|
|
91
|
+
* refused `offset_mismatch` continues from the daemon's `received`. Returns the attachment.
|
|
92
|
+
* The returned promise exposes `.uploadId` once begun and `.abort(reason?: any)` to abort on alpd.
|
|
93
|
+
* @param {{ sessionId: string, name: string, mimeType: string, data: Uint8Array, requestId: string, sha256?: string, maxChunkBytes?: number, signal?: AbortSignal, onBegun?: (uploadId: string) => void, onProgress?: (received: number, size: number) => void }} options
|
|
94
|
+
* @returns {Promise<Map['attachment.commit']['result']['attachment']> & { readonly uploadId?: string, abort(reason?: any): Promise<void> }}
|
|
95
|
+
*/
|
|
96
|
+
upload({ sessionId, name, mimeType, data, requestId, sha256, maxChunkBytes, signal, onBegun, onProgress }: {
|
|
97
|
+
sessionId: string;
|
|
98
|
+
name: string;
|
|
99
|
+
mimeType: string;
|
|
100
|
+
data: Uint8Array;
|
|
101
|
+
requestId: string;
|
|
102
|
+
sha256?: string;
|
|
103
|
+
maxChunkBytes?: number;
|
|
104
|
+
signal?: AbortSignal;
|
|
105
|
+
onBegun?: (uploadId: string) => void;
|
|
106
|
+
onProgress?: (received: number, size: number) => void;
|
|
107
|
+
}): Promise<import("@anhlp/alp-protocol").AttachmentInfo> & {
|
|
108
|
+
readonly uploadId?: string;
|
|
109
|
+
abort(reason?: any): Promise<void>;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Typed conversation methods (capabilities `session.fork` and `session.rewind`, docs/protocol/
|
|
114
|
+
* alp-json-rpc-v1.md §12.7; `session.reload` and `session.resumeCommand`, §12.8). Both change the conversation only, never a file. Mutations are sent
|
|
115
|
+
* once: keep `requestId` (and `ifGeneration`) to repeat the identical request after a timeout, which
|
|
116
|
+
* answers the first result with `duplicate: true`. After a rewind, attached clients get a
|
|
117
|
+
* `history.reset` event: drop cached history, fetch a new tail and attach with its generation.
|
|
118
|
+
* @param {{request<T = any>(method: string, params?: unknown): Promise<T>}} client
|
|
119
|
+
*/
|
|
120
|
+
export function conversation(client: {
|
|
121
|
+
request<T = any>(method: string, params?: unknown): Promise<T>;
|
|
122
|
+
}): {
|
|
123
|
+
/**
|
|
124
|
+
* A new closed root whose conversation is the source root's through or before a turn (`boundary`),
|
|
125
|
+
* or a branch a rewind set aside (`branchId`); resume it with session.create { sessionId, resume: true }.
|
|
126
|
+
* Principal fields are set by a trusted gateway on its own connection, never by a remote client.
|
|
127
|
+
* @param {Map['session.fork']['params']} params @returns {Promise<Map['session.fork']['result']>}
|
|
128
|
+
*/
|
|
129
|
+
fork: (params: import("@anhlp/alp-protocol").PrincipalContext & {
|
|
130
|
+
sessionId: string;
|
|
131
|
+
requestId: string;
|
|
132
|
+
ifGeneration: string;
|
|
133
|
+
boundary?: import("@anhlp/alp-protocol").ForkBoundary;
|
|
134
|
+
branchId?: string;
|
|
135
|
+
workspaceId?: string;
|
|
136
|
+
newSessionId?: string;
|
|
137
|
+
title?: string;
|
|
138
|
+
}) => Promise<{
|
|
139
|
+
session: import("@anhlp/alp-protocol").SessionSummary;
|
|
140
|
+
forkedFrom: import("@anhlp/alp-protocol").ForkProvenance;
|
|
141
|
+
duplicate?: true;
|
|
142
|
+
}>;
|
|
143
|
+
/**
|
|
144
|
+
* Continues the root's conversation from before `beforeTurnId` under the same session id; the
|
|
145
|
+
* later turns stay a branch (`branch.branchId`) that `fork({ branchId })` recovers.
|
|
146
|
+
* @param {Map['session.rewind']['params']} params @returns {Promise<Map['session.rewind']['result']>}
|
|
147
|
+
*/
|
|
148
|
+
rewind: (params: {
|
|
149
|
+
sessionId: string;
|
|
150
|
+
requestId: string;
|
|
151
|
+
ifGeneration: string;
|
|
152
|
+
beforeTurnId: string;
|
|
153
|
+
}) => Promise<{
|
|
154
|
+
session: import("@anhlp/alp-protocol").SessionSummary;
|
|
155
|
+
generation: string;
|
|
156
|
+
branch: import("@anhlp/alp-protocol").ConversationBranch;
|
|
157
|
+
duplicate?: true;
|
|
158
|
+
}>;
|
|
159
|
+
/**
|
|
160
|
+
* Restarts a live root's native process on its own conversation and configuration at the idle
|
|
161
|
+
* barrier (capability `session.reload`, §12.8); id, history and receipts stay. Sent once: repeat
|
|
162
|
+
* the same `requestId` after a lost answer.
|
|
163
|
+
* @param {Map['session.reload']['params']} params @returns {Promise<Map['session.reload']['result']>}
|
|
164
|
+
*/
|
|
165
|
+
reload: (params: {
|
|
166
|
+
sessionId: string;
|
|
167
|
+
requestId: string;
|
|
168
|
+
ifGeneration: string;
|
|
169
|
+
}) => Promise<{
|
|
170
|
+
session: import("@anhlp/alp-protocol").SessionSummary;
|
|
171
|
+
duplicate?: true;
|
|
172
|
+
}>;
|
|
173
|
+
/**
|
|
174
|
+
* The ALP CLI command that follows the session in a terminal (capability `session.resumeCommand`,
|
|
175
|
+
* §12.8), built by alpd: for the clipboard only, never to run.
|
|
176
|
+
* @param {Map['session.resumeCommand']['params']} params @returns {Promise<Map['session.resumeCommand']['result']>}
|
|
177
|
+
*/
|
|
178
|
+
resumeCommand: (params: {
|
|
179
|
+
sessionId: string;
|
|
180
|
+
}) => Promise<import("@anhlp/alp-protocol").ResumeCommand>;
|
|
181
|
+
/**
|
|
182
|
+
* Changes a live root's model, effort or team (capability `session.configure.live`, §12.9) at the
|
|
183
|
+
* idle barrier, through a restart of its native process on the same conversation; `configured` says
|
|
184
|
+
* what it runs with now. Sent once: repeat the same `requestId` after a lost answer. A change to
|
|
185
|
+
* another runtime is refused (1005 runtime_mismatch, `data.action: 'session.create'`).
|
|
186
|
+
* @param {Map['session.configure']['params'] & { requestId: string; ifGeneration: string }} params @returns {Promise<Map['session.configure']['result']>}
|
|
187
|
+
*/
|
|
188
|
+
configure: (params: {
|
|
189
|
+
sessionId: string;
|
|
190
|
+
mode?: string;
|
|
191
|
+
model?: string;
|
|
192
|
+
thinking?: string;
|
|
193
|
+
team?: string;
|
|
194
|
+
requestId?: string;
|
|
195
|
+
ifGeneration?: string;
|
|
196
|
+
} & {
|
|
197
|
+
requestId: string;
|
|
198
|
+
ifGeneration: string;
|
|
199
|
+
}) => Promise<{
|
|
200
|
+
session: import("@anhlp/alp-protocol").SessionSnapshot | import("@anhlp/alp-protocol").SessionSummary;
|
|
201
|
+
configured?: import("@anhlp/alp-protocol").ConfigureOutcome;
|
|
202
|
+
duplicate?: true;
|
|
203
|
+
}>;
|
|
204
|
+
/**
|
|
205
|
+
* What a change of model, effort, team or mode would run a live root with, and whether it would be
|
|
206
|
+
* taken now (capability `session.configure.live`, §12.9). Reads only.
|
|
207
|
+
* @param {Map['session.configure.preview']['params']} params @returns {Promise<Map['session.configure.preview']['result']>}
|
|
208
|
+
*/
|
|
209
|
+
configurePreview: (params: {
|
|
210
|
+
sessionId: string;
|
|
211
|
+
mode?: string;
|
|
212
|
+
model?: string;
|
|
213
|
+
thinking?: string;
|
|
214
|
+
team?: string;
|
|
215
|
+
}) => Promise<{
|
|
216
|
+
preview: import("@anhlp/alp-protocol").ConfigurePreview;
|
|
217
|
+
}>;
|
|
218
|
+
};
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
// packages/client/src/rpc/registry.js
|
|
2
|
+
function workspaceRegistry(client) {
|
|
3
|
+
return {
|
|
4
|
+
/** @param {string} workspaceId @returns {Promise<import('@anhlp/alp-protocol').RpcMethodMap['workspace.worktree.options']['result']>} */
|
|
5
|
+
worktreeOptions: (workspaceId) => client.request("workspace.worktree.options", { workspaceId }),
|
|
6
|
+
/** @param {import('@anhlp/alp-protocol').RpcMethodMap['workspace.worktree.create']['params']} params @returns {Promise<import('@anhlp/alp-protocol').RpcMethodMap['workspace.worktree.create']['result']>} */
|
|
7
|
+
createWorktree: (params) => client.request("workspace.worktree.create", params),
|
|
8
|
+
/** @param {import('@anhlp/alp-protocol').RpcMethodMap['workspace.worktree.remove']['params']} params @returns {Promise<import('@anhlp/alp-protocol').RpcMethodMap['workspace.worktree.remove']['result']>} */
|
|
9
|
+
removeWorktree: (params) => client.request("workspace.worktree.remove", params),
|
|
10
|
+
/** Read-only Git status of a registry workspace (capability `workspace.git`, §12.5). @param {string} workspaceId @returns {Promise<import('@anhlp/alp-protocol').RpcMethodMap['workspace.git.status']['result']>} */
|
|
11
|
+
gitStatus: (workspaceId) => client.request("workspace.git.status", { workspaceId }),
|
|
12
|
+
/** One page of a read-only Git diff; pass `nextCursor` back as `cursor` with the same comparison and path. @param {import('@anhlp/alp-protocol').RpcMethodMap['workspace.git.diff']['params']} params @returns {Promise<import('@anhlp/alp-protocol').RpcMethodMap['workspace.git.diff']['result']>} */
|
|
13
|
+
gitDiff: (params) => client.request("workspace.git.diff", params),
|
|
14
|
+
/** @param {import('@anhlp/alp-protocol').RpcMethodMap['project.list']['params']} [params] @returns {Promise<import('@anhlp/alp-protocol').RpcMethodMap['project.list']['result']>} */
|
|
15
|
+
projects: (params = {}) => client.request("project.list", params),
|
|
16
|
+
/** @param {import('@anhlp/alp-protocol').RpcMethodMap['workspace.list']['params']} [params] @returns {Promise<import('@anhlp/alp-protocol').RpcMethodMap['workspace.list']['result']>} */
|
|
17
|
+
workspaces: (params = {}) => client.request("workspace.list", params),
|
|
18
|
+
/** @param {string} workspaceId @returns {Promise<import('@anhlp/alp-protocol').RpcMethodMap['workspace.get']['result']>} */
|
|
19
|
+
get: (workspaceId) => client.request("workspace.get", { workspaceId }),
|
|
20
|
+
/** @param {import('@anhlp/alp-protocol').RpcMethodMap['project.register']['params']} params @returns {Promise<import('@anhlp/alp-protocol').RpcMethodMap['project.register']['result']>} */
|
|
21
|
+
register: (params) => client.request("project.register", params),
|
|
22
|
+
/** @param {import('@anhlp/alp-protocol').RpcMethodMap['project.remove']['params']} params @returns {Promise<import('@anhlp/alp-protocol').RpcMethodMap['project.remove']['result']>} */
|
|
23
|
+
remove: (params) => client.request("project.remove", params),
|
|
24
|
+
/** @param {import('@anhlp/alp-protocol').RpcMethodMap['workspace.update']['params']} params @returns {Promise<import('@anhlp/alp-protocol').RpcMethodMap['workspace.update']['result']>} */
|
|
25
|
+
update: (params) => client.request("workspace.update", params)
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
var BASE64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
29
|
+
function base64Encode(bytes) {
|
|
30
|
+
let out = "";
|
|
31
|
+
let index = 0;
|
|
32
|
+
for (; index + 2 < bytes.length; index += 3) {
|
|
33
|
+
const n = bytes[index] << 16 | bytes[index + 1] << 8 | bytes[index + 2];
|
|
34
|
+
out += BASE64[n >> 18] + BASE64[n >> 12 & 63] + BASE64[n >> 6 & 63] + BASE64[n & 63];
|
|
35
|
+
}
|
|
36
|
+
if (index < bytes.length) {
|
|
37
|
+
const n = bytes[index] << 16 | (index + 1 < bytes.length ? bytes[index + 1] : 0) << 8;
|
|
38
|
+
out += BASE64[n >> 18] + BASE64[n >> 12 & 63] + (index + 1 < bytes.length ? BASE64[n >> 6 & 63] : "=") + "=";
|
|
39
|
+
}
|
|
40
|
+
return out;
|
|
41
|
+
}
|
|
42
|
+
async function sha256Hex(bytes) {
|
|
43
|
+
const subtle = globalThis.crypto?.subtle;
|
|
44
|
+
if (!subtle) throw new Error("SHA-256 needs WebCrypto here; pass sha256 yourself");
|
|
45
|
+
const digest = new Uint8Array(await subtle.digest("SHA-256", bytes));
|
|
46
|
+
return Array.from(digest, (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
47
|
+
}
|
|
48
|
+
function attachments(client) {
|
|
49
|
+
const api = {
|
|
50
|
+
/** @param {Map['attachment.begin']['params']} params @returns {Promise<Map['attachment.begin']['result']>} */
|
|
51
|
+
begin: (params) => client.request("attachment.begin", params),
|
|
52
|
+
/** @param {Map['attachment.chunk']['params']} params @returns {Promise<Map['attachment.chunk']['result']>} */
|
|
53
|
+
chunk: (params) => client.request("attachment.chunk", params),
|
|
54
|
+
/** @param {Map['attachment.commit']['params']} params @returns {Promise<Map['attachment.commit']['result']>} */
|
|
55
|
+
commit: (params) => client.request("attachment.commit", params),
|
|
56
|
+
/** @param {string} uploadId @returns {Promise<Map['attachment.abort']['result']>} */
|
|
57
|
+
abort: (uploadId) => client.request("attachment.abort", { uploadId }),
|
|
58
|
+
/** Metadata only (no bytes, no path). @param {string} attachmentId @returns {Promise<Map['attachment.get']['result']>} */
|
|
59
|
+
get: (attachmentId) => client.request("attachment.get", { attachmentId }),
|
|
60
|
+
/** Refused (1004 attachment_referenced) while a prompt references it. @param {string} attachmentId @returns {Promise<Map['attachment.delete']['result']>} */
|
|
61
|
+
delete: (attachmentId) => client.request("attachment.delete", { attachmentId }),
|
|
62
|
+
/**
|
|
63
|
+
* Uploads `data` and commits it: begin (or resume, with the same requestId), chunks of at most
|
|
64
|
+
* the smaller of `maxChunkBytes` and what begin answered, commit with its SHA-256. A chunk
|
|
65
|
+
* refused `offset_mismatch` continues from the daemon's `received`. Returns the attachment.
|
|
66
|
+
* The returned promise exposes `.uploadId` once begun and `.abort(reason?: any)` to abort on alpd.
|
|
67
|
+
* @param {{ sessionId: string, name: string, mimeType: string, data: Uint8Array, requestId: string, sha256?: string, maxChunkBytes?: number, signal?: AbortSignal, onBegun?: (uploadId: string) => void, onProgress?: (received: number, size: number) => void }} options
|
|
68
|
+
* @returns {Promise<Map['attachment.commit']['result']['attachment']> & { readonly uploadId?: string, abort(reason?: any): Promise<void> }}
|
|
69
|
+
*/
|
|
70
|
+
upload({ sessionId, name, mimeType, data, requestId, sha256, maxChunkBytes, signal, onBegun, onProgress }) {
|
|
71
|
+
let uploadId;
|
|
72
|
+
let userAborted = false;
|
|
73
|
+
let userAbortReason;
|
|
74
|
+
const isAborted = () => userAborted || (signal?.aborted ?? false);
|
|
75
|
+
const getAbortReason = () => userAbortReason ?? signal?.reason ?? new Error("Upload aborted");
|
|
76
|
+
const onSignalAbort = () => {
|
|
77
|
+
if (uploadId) api.abort(uploadId).catch(() => {
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
signal?.addEventListener?.("abort", onSignalAbort, { once: true });
|
|
81
|
+
const run = (
|
|
82
|
+
/** @type {Promise<Map['attachment.commit']['result']['attachment']> & { uploadId?: string, abort(reason?: any): Promise<void> }} */
|
|
83
|
+
(async () => {
|
|
84
|
+
try {
|
|
85
|
+
if (isAborted()) throw getAbortReason();
|
|
86
|
+
const digest = sha256 ?? await sha256Hex(data);
|
|
87
|
+
if (isAborted()) throw getAbortReason();
|
|
88
|
+
const begun = await api.begin({ sessionId, name, size: data.length, mimeType, sha256: digest, requestId });
|
|
89
|
+
uploadId = begun.uploadId;
|
|
90
|
+
try {
|
|
91
|
+
onBegun?.(begun.uploadId);
|
|
92
|
+
} catch (error) {
|
|
93
|
+
if (begun.state !== "committed") await api.abort(begun.uploadId).catch(() => {
|
|
94
|
+
});
|
|
95
|
+
throw error;
|
|
96
|
+
}
|
|
97
|
+
if (isAborted()) {
|
|
98
|
+
if (begun.state !== "committed") await api.abort(begun.uploadId).catch(() => {
|
|
99
|
+
});
|
|
100
|
+
throw getAbortReason();
|
|
101
|
+
}
|
|
102
|
+
if (begun.state === "committed" && begun.attachmentId) return (await api.get(begun.attachmentId)).attachment;
|
|
103
|
+
const size = Math.max(1, Math.min(begun.maxChunkBytes, maxChunkBytes ?? Infinity));
|
|
104
|
+
let offset = begun.received;
|
|
105
|
+
for (let realigned = 0; offset < data.length; ) {
|
|
106
|
+
if (isAborted()) {
|
|
107
|
+
await api.abort(begun.uploadId).catch(() => {
|
|
108
|
+
});
|
|
109
|
+
throw getAbortReason();
|
|
110
|
+
}
|
|
111
|
+
const end = Math.min(data.length, offset + size);
|
|
112
|
+
try {
|
|
113
|
+
const { received } = await api.chunk({ uploadId: begun.uploadId, offset, data: base64Encode(data.subarray(offset, end)) });
|
|
114
|
+
offset = received;
|
|
115
|
+
} catch (error) {
|
|
116
|
+
if (isAborted()) {
|
|
117
|
+
await api.abort(begun.uploadId).catch(() => {
|
|
118
|
+
});
|
|
119
|
+
throw getAbortReason();
|
|
120
|
+
}
|
|
121
|
+
const held = (
|
|
122
|
+
/** @type {any} */
|
|
123
|
+
error?.data
|
|
124
|
+
);
|
|
125
|
+
if (held?.reason !== "offset_mismatch" || !Number.isSafeInteger(held.received) || ++realigned > 3) throw error;
|
|
126
|
+
offset = held.received;
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
if (isAborted()) {
|
|
130
|
+
await api.abort(begun.uploadId).catch(() => {
|
|
131
|
+
});
|
|
132
|
+
throw getAbortReason();
|
|
133
|
+
}
|
|
134
|
+
try {
|
|
135
|
+
onProgress?.(offset, data.length);
|
|
136
|
+
} catch (error) {
|
|
137
|
+
await api.abort(begun.uploadId).catch(() => {
|
|
138
|
+
});
|
|
139
|
+
throw error;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if (isAborted()) {
|
|
143
|
+
await api.abort(begun.uploadId).catch(() => {
|
|
144
|
+
});
|
|
145
|
+
throw getAbortReason();
|
|
146
|
+
}
|
|
147
|
+
return (await api.commit({ uploadId: begun.uploadId, sha256: digest })).attachment;
|
|
148
|
+
} finally {
|
|
149
|
+
signal?.removeEventListener?.("abort", onSignalAbort);
|
|
150
|
+
}
|
|
151
|
+
})()
|
|
152
|
+
);
|
|
153
|
+
Object.defineProperty(run, "uploadId", {
|
|
154
|
+
get: () => uploadId,
|
|
155
|
+
enumerable: true
|
|
156
|
+
});
|
|
157
|
+
run.abort = async (reason) => {
|
|
158
|
+
userAborted = true;
|
|
159
|
+
userAbortReason = reason ?? new Error("Upload aborted");
|
|
160
|
+
if (uploadId) await api.abort(uploadId).catch(() => {
|
|
161
|
+
});
|
|
162
|
+
};
|
|
163
|
+
return run;
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
return api;
|
|
167
|
+
}
|
|
168
|
+
function conversation(client) {
|
|
169
|
+
return {
|
|
170
|
+
/**
|
|
171
|
+
* A new closed root whose conversation is the source root's through or before a turn (`boundary`),
|
|
172
|
+
* or a branch a rewind set aside (`branchId`); resume it with session.create { sessionId, resume: true }.
|
|
173
|
+
* Principal fields are set by a trusted gateway on its own connection, never by a remote client.
|
|
174
|
+
* @param {Map['session.fork']['params']} params @returns {Promise<Map['session.fork']['result']>}
|
|
175
|
+
*/
|
|
176
|
+
fork: (params) => client.request("session.fork", params),
|
|
177
|
+
/**
|
|
178
|
+
* Continues the root's conversation from before `beforeTurnId` under the same session id; the
|
|
179
|
+
* later turns stay a branch (`branch.branchId`) that `fork({ branchId })` recovers.
|
|
180
|
+
* @param {Map['session.rewind']['params']} params @returns {Promise<Map['session.rewind']['result']>}
|
|
181
|
+
*/
|
|
182
|
+
rewind: (params) => client.request("session.rewind", params),
|
|
183
|
+
/**
|
|
184
|
+
* Restarts a live root's native process on its own conversation and configuration at the idle
|
|
185
|
+
* barrier (capability `session.reload`, §12.8); id, history and receipts stay. Sent once: repeat
|
|
186
|
+
* the same `requestId` after a lost answer.
|
|
187
|
+
* @param {Map['session.reload']['params']} params @returns {Promise<Map['session.reload']['result']>}
|
|
188
|
+
*/
|
|
189
|
+
reload: (params) => client.request("session.reload", params),
|
|
190
|
+
/**
|
|
191
|
+
* The ALP CLI command that follows the session in a terminal (capability `session.resumeCommand`,
|
|
192
|
+
* §12.8), built by alpd: for the clipboard only, never to run.
|
|
193
|
+
* @param {Map['session.resumeCommand']['params']} params @returns {Promise<Map['session.resumeCommand']['result']>}
|
|
194
|
+
*/
|
|
195
|
+
resumeCommand: (params) => client.request("session.resumeCommand", params),
|
|
196
|
+
/**
|
|
197
|
+
* Changes a live root's model, effort or team (capability `session.configure.live`, §12.9) at the
|
|
198
|
+
* idle barrier, through a restart of its native process on the same conversation; `configured` says
|
|
199
|
+
* what it runs with now. Sent once: repeat the same `requestId` after a lost answer. A change to
|
|
200
|
+
* another runtime is refused (1005 runtime_mismatch, `data.action: 'session.create'`).
|
|
201
|
+
* @param {Map['session.configure']['params'] & { requestId: string; ifGeneration: string }} params @returns {Promise<Map['session.configure']['result']>}
|
|
202
|
+
*/
|
|
203
|
+
configure: (params) => client.request("session.configure", params),
|
|
204
|
+
/**
|
|
205
|
+
* What a change of model, effort, team or mode would run a live root with, and whether it would be
|
|
206
|
+
* taken now (capability `session.configure.live`, §12.9). Reads only.
|
|
207
|
+
* @param {Map['session.configure.preview']['params']} params @returns {Promise<Map['session.configure.preview']['result']>}
|
|
208
|
+
*/
|
|
209
|
+
configurePreview: (params) => client.request("session.configure.preview", params)
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
export {
|
|
213
|
+
attachments,
|
|
214
|
+
base64Encode,
|
|
215
|
+
conversation,
|
|
216
|
+
sha256Hex,
|
|
217
|
+
workspaceRegistry
|
|
218
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A terminal directory for one connection. Subscribe before requesting the atomic snapshot.
|
|
3
|
+
* Invalidations are coalesced; a reconnect installs a new watcher and replaces state with its
|
|
4
|
+
* full snapshot (reset), rather than replaying obsolete list mutations. No output is replayed.
|
|
5
|
+
* @param {{request<T = any>(method:string, params?:any):Promise<T>, onNotification?(listener:(method:string,params:any)=>void):()=>void, onClose(listener:(error:Error)=>void):()=>void}} connection
|
|
6
|
+
* @param {{capabilities:readonly string[], workspaceId?:string, pollMs?:number, onSnapshot:(terminals:import('@anhlp/alp-protocol').TerminalInfo[])=>void, onError?:(error:unknown)=>void, onMode?:(mode:'events'|'polling')=>void}} options
|
|
7
|
+
*/
|
|
8
|
+
export function watchTerminals(connection: {
|
|
9
|
+
request<T = any>(method: string, params?: any): Promise<T>;
|
|
10
|
+
onNotification?(listener: (method: string, params: any) => void): () => void;
|
|
11
|
+
onClose(listener: (error: Error) => void): () => void;
|
|
12
|
+
}, options: {
|
|
13
|
+
capabilities: readonly string[];
|
|
14
|
+
workspaceId?: string;
|
|
15
|
+
pollMs?: number;
|
|
16
|
+
onSnapshot: (terminals: import("@anhlp/alp-protocol").TerminalInfo[]) => void;
|
|
17
|
+
onError?: (error: unknown) => void;
|
|
18
|
+
onMode?: (mode: "events" | "polling") => void;
|
|
19
|
+
}): {
|
|
20
|
+
ready: Promise<void>;
|
|
21
|
+
refresh: () => Promise<void>;
|
|
22
|
+
close: (unwatch?: boolean) => void;
|
|
23
|
+
mode: string;
|
|
24
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// packages/client/src/rpc/terminal-directory.js
|
|
2
|
+
function watchTerminals(connection, options) {
|
|
3
|
+
const events = options.capabilities.includes("terminal.watch") && !!connection.onNotification;
|
|
4
|
+
let closed = false;
|
|
5
|
+
let watchId = "";
|
|
6
|
+
let cursor = "";
|
|
7
|
+
let again = false;
|
|
8
|
+
let refreshing;
|
|
9
|
+
const pending = /* @__PURE__ */ new Map();
|
|
10
|
+
const off = connection.onNotification?.((method, params) => {
|
|
11
|
+
if (closed || !events || method !== "terminal.changed" || !/^[0-9a-f]{32}$/.test(params?.watchId) || !/^[0-9a-f]{32}$/.test(params?.cursor)) return;
|
|
12
|
+
if (pending.size >= 4 && !pending.has(params.watchId)) pending.delete(pending.keys().next().value ?? "");
|
|
13
|
+
pending.set(params.watchId, params.cursor);
|
|
14
|
+
if (params.watchId === watchId && params.cursor !== cursor) {
|
|
15
|
+
again = true;
|
|
16
|
+
void refresh();
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
function refresh() {
|
|
20
|
+
if (closed) return Promise.resolve();
|
|
21
|
+
if (refreshing) return refreshing;
|
|
22
|
+
refreshing = (async () => {
|
|
23
|
+
do {
|
|
24
|
+
again = false;
|
|
25
|
+
try {
|
|
26
|
+
const result = await connection.request(events ? "terminal.watch" : "terminal.list", { ...options.workspaceId ? { workspaceId: options.workspaceId } : {}, ...events && cursor ? { after: cursor } : {} });
|
|
27
|
+
if (closed) return;
|
|
28
|
+
if (!Array.isArray(result?.terminals)) throw new Error("Invalid terminal directory snapshot");
|
|
29
|
+
if (events) {
|
|
30
|
+
if (!/^[0-9a-f]{32}$/.test(result.watchId) || !/^[0-9a-f]{32}$/.test(result.cursor) || typeof result.reset !== "boolean") throw new Error("Invalid terminal directory cursor");
|
|
31
|
+
watchId = result.watchId;
|
|
32
|
+
cursor = result.cursor;
|
|
33
|
+
again = pending.has(watchId) && pending.get(watchId) !== cursor;
|
|
34
|
+
pending.clear();
|
|
35
|
+
}
|
|
36
|
+
options.onSnapshot(result.terminals);
|
|
37
|
+
} catch (error) {
|
|
38
|
+
options.onError?.(error);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
} while (again && !closed);
|
|
42
|
+
})().finally(() => {
|
|
43
|
+
refreshing = void 0;
|
|
44
|
+
});
|
|
45
|
+
return refreshing;
|
|
46
|
+
}
|
|
47
|
+
const timer = events ? void 0 : setInterval(() => {
|
|
48
|
+
void refresh();
|
|
49
|
+
}, options.pollMs ?? 5e3);
|
|
50
|
+
let offClose = () => {
|
|
51
|
+
};
|
|
52
|
+
function close(unwatch = true) {
|
|
53
|
+
if (closed) return;
|
|
54
|
+
closed = true;
|
|
55
|
+
if (timer !== void 0) clearInterval(timer);
|
|
56
|
+
off?.();
|
|
57
|
+
offClose();
|
|
58
|
+
pending.clear();
|
|
59
|
+
if (events && unwatch) void connection.request("terminal.unwatch", {}).catch(() => {
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
offClose = connection.onClose(() => close(false));
|
|
63
|
+
if (closed) offClose();
|
|
64
|
+
options.onMode?.(events ? "events" : "polling");
|
|
65
|
+
const ready = refresh();
|
|
66
|
+
return { ready, refresh, close, mode: events ? "events" : "polling" };
|
|
67
|
+
}
|
|
68
|
+
export {
|
|
69
|
+
watchTerminals
|
|
70
|
+
};
|
package/dist/service.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export function serviceFor({ home, env, platform, uid }: {
|
|
|
32
32
|
ignore: boolean;
|
|
33
33
|
})[][];
|
|
34
34
|
} | undefined;
|
|
35
|
-
/** The service definition that runs `entry` with `execPath
|
|
35
|
+
/** The service definition that runs `entry` (alpd.js with `execPath`, or the ALP executable) for `home`. */
|
|
36
36
|
export function serviceDefinition(service: any, { home, entry, execPath, env }: {
|
|
37
37
|
home: any;
|
|
38
38
|
entry: any;
|