@anhlp/alp-daemon 0.0.1-beta.4 → 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/dist/THIRD-PARTY-NOTICES.txt +26 -1
- package/dist/alpd.js +11047 -3021
- package/dist/attachments.d.ts +25 -49
- package/dist/attachments.js +45 -8
- package/dist/build-manifest.json +14 -1
- package/dist/conversation.js +18 -2
- package/dist/disk.d.ts +67 -0
- package/dist/disk.js +152 -0
- package/dist/files.d.ts +141 -2
- package/dist/files.js +377 -68
- package/dist/git.d.ts +8 -2
- package/dist/git.js +111 -12
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -0
- package/dist/main.js +37 -11
- package/dist/native-terminal.d.ts +45 -0
- package/dist/native-terminal.js +198 -0
- package/dist/operations.d.ts +8 -2
- package/dist/operations.js +20 -10
- package/dist/registry.js +1 -1
- package/dist/scheduler.js +8 -2
- package/dist/schedules.d.ts +2 -1
- package/dist/schedules.js +6 -4
- package/dist/server.d.ts +4 -2
- package/dist/server.js +166 -42
- package/dist/store.d.ts +3 -1
- package/dist/store.js +4 -3
- package/dist/terminal-native/README.md +201 -0
- package/dist/terminal-native/prebuilt/darwin-arm64/manifest.json +11 -0
- package/dist/terminal-native/prebuilt/darwin-arm64/terminal-owner +0 -0
- package/dist/terminal-native/prebuilt/darwin-x64/manifest.json +11 -0
- package/dist/terminal-native/prebuilt/darwin-x64/terminal-owner +0 -0
- package/dist/terminal-native/prebuilt/linux-arm64-glibc/manifest.json +10 -0
- package/dist/terminal-native/prebuilt/linux-arm64-glibc/terminal-owner +0 -0
- package/dist/terminal-native/prebuilt/linux-arm64-musl/manifest.json +10 -0
- package/dist/terminal-native/prebuilt/linux-arm64-musl/terminal-owner +0 -0
- package/dist/terminal-native/prebuilt/linux-x64-glibc/manifest.json +10 -0
- package/dist/terminal-native/prebuilt/linux-x64-glibc/terminal-owner +0 -0
- package/dist/terminal-native/prebuilt/linux-x64-musl/manifest.json +10 -0
- package/dist/terminal-native/prebuilt/linux-x64-musl/terminal-owner +0 -0
- package/dist/terminal-native/terminal-owner.c +389 -0
- package/dist/terminal-screen.d.ts +24 -0
- package/dist/terminal-screen.js +99 -0
- package/dist/terminals.d.ts +43 -7
- package/dist/terminals.js +222 -139
- package/dist/windows-terminal.d.ts +29 -0
- package/dist/windows-terminal.js +122 -0
- package/dist/worktrees.d.ts +25 -1
- package/dist/worktrees.js +74 -2
- package/native/README.md +201 -0
- package/native/prebuilt/darwin-arm64/manifest.json +11 -0
- package/native/prebuilt/darwin-arm64/terminal-owner +0 -0
- package/native/prebuilt/darwin-x64/manifest.json +11 -0
- package/native/prebuilt/darwin-x64/terminal-owner +0 -0
- package/native/prebuilt/linux-arm64-glibc/manifest.json +10 -0
- package/native/prebuilt/linux-arm64-glibc/terminal-owner +0 -0
- package/native/prebuilt/linux-arm64-musl/manifest.json +10 -0
- package/native/prebuilt/linux-arm64-musl/terminal-owner +0 -0
- package/native/prebuilt/linux-x64-glibc/manifest.json +10 -0
- package/native/prebuilt/linux-x64-glibc/terminal-owner +0 -0
- package/native/prebuilt/linux-x64-musl/manifest.json +10 -0
- package/native/prebuilt/linux-x64-musl/terminal-owner +0 -0
- package/native/terminal-owner.c +389 -0
- package/package.json +11 -7
- package/src/attachments.ts +46 -8
- package/src/conversation.ts +22 -2
- package/src/disk.ts +175 -0
- package/src/files.ts +505 -80
- package/src/git.ts +113 -18
- package/src/index.ts +1 -0
- package/src/main.ts +30 -11
- package/src/native-terminal.ts +122 -0
- package/src/operations.ts +27 -11
- package/src/registry.ts +1 -1
- package/src/scheduler.ts +13 -3
- package/src/schedules.ts +5 -2
- package/src/server.ts +157 -35
- package/src/store.ts +2 -1
- package/src/terminal-screen.ts +74 -0
- package/src/terminals.ts +205 -155
- package/src/windows-terminal.ts +123 -0
- package/src/worktrees.ts +97 -2
package/dist/files.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export declare const LIMITS: Readonly<{
|
|
|
27
27
|
}>;
|
|
28
28
|
export declare class FilesError extends Error {
|
|
29
29
|
}
|
|
30
|
+
type Kind = 'file' | 'directory';
|
|
30
31
|
/**
|
|
31
32
|
* The files under `projectRoot` matching `query`, best first. `projectRoot` must be an absolute path
|
|
32
33
|
* of a directory; anything else throws FilesError.
|
|
@@ -42,6 +43,63 @@ export declare function searchWorkspaceFiles(projectRoot: string, { query, limit
|
|
|
42
43
|
}>;
|
|
43
44
|
truncated?: true;
|
|
44
45
|
}>;
|
|
46
|
+
/**
|
|
47
|
+
* Bounds of one workspace.files.find walk, deeper and larger than search's: as complete as
|
|
48
|
+
* `git ls-files` is for the Paseo bridge, which ranks the whole set itself. A snapshot of the
|
|
49
|
+
* names it found is kept `ttlMs` after its last page, at most `snapshots` of them in alpd.
|
|
50
|
+
*/
|
|
51
|
+
export declare const FIND_LIMITS: Readonly<{
|
|
52
|
+
depth: 64;
|
|
53
|
+
scanned: 100000;
|
|
54
|
+
ms: 10000;
|
|
55
|
+
ttlMs: 60000;
|
|
56
|
+
snapshots: 16;
|
|
57
|
+
}>;
|
|
58
|
+
export type FoundEntry = {
|
|
59
|
+
path: string;
|
|
60
|
+
kind: Kind;
|
|
61
|
+
};
|
|
62
|
+
export type FindOptions = {
|
|
63
|
+
query?: string;
|
|
64
|
+
kinds?: readonly Kind[];
|
|
65
|
+
matchMode?: 'subsequence' | 'suffix';
|
|
66
|
+
now?: () => number;
|
|
67
|
+
git?: GitCheckOptions;
|
|
68
|
+
};
|
|
69
|
+
/** Whether `candidate` holds the characters of `query` in order (the Paseo bridge's last ranking tier). */
|
|
70
|
+
export declare function inOrder(query: string, candidate: string): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Every file and directory under `projectRoot` whose path, case-insensitively, holds `query`'s
|
|
73
|
+
* characters in order (`subsequence`, every name the Paseo bridge's ranking can match) or is it or
|
|
74
|
+
* ends with `/query` (`suffix`); every name for an empty query. In path order (code units).
|
|
75
|
+
*
|
|
76
|
+
* As `git ls-files --cached --others --exclude-standard` lists a repository: dot names included,
|
|
77
|
+
* .gitignore'd ones left out (Git's answer, failing closed as search does), and links whose real
|
|
78
|
+
* path is inside the root listed as their target's kind, never entered. Outside a repository,
|
|
79
|
+
* names starting with `.` and SKIPPED_FOLDERS are skipped. Blocked paths never appear. Bounded by
|
|
80
|
+
* FIND_LIMITS; `truncated` when a bound stopped the walk.
|
|
81
|
+
*/
|
|
82
|
+
export declare function findWorkspaceEntries(projectRoot: string, { query, kinds, matchMode, now, git }?: FindOptions): Promise<{
|
|
83
|
+
entries: FoundEntry[];
|
|
84
|
+
truncated?: true;
|
|
85
|
+
}>;
|
|
86
|
+
/**
|
|
87
|
+
* workspace.files.find in pages: the first call (no cursor) walks and keeps the snapshot; each
|
|
88
|
+
* `nextCursor` names the snapshot and where the next page starts, for the connection (`owner`) that
|
|
89
|
+
* asked and the same params only. A snapshot is dropped after its last page, FIND_LIMITS.ttlMs
|
|
90
|
+
* after its last use, or when more than FIND_LIMITS.snapshots are kept (the oldest first).
|
|
91
|
+
*/
|
|
92
|
+
export declare function createFindPages({ now, git }?: {
|
|
93
|
+
now?: () => number;
|
|
94
|
+
git?: GitCheckOptions;
|
|
95
|
+
}): (owner: unknown, projectRoot: string, { query, kinds, matchMode, limit, cursor }?: Omit<FindOptions, "now" | "git"> & {
|
|
96
|
+
limit?: number;
|
|
97
|
+
cursor?: string;
|
|
98
|
+
}) => Promise<{
|
|
99
|
+
entries: FoundEntry[];
|
|
100
|
+
nextCursor?: string;
|
|
101
|
+
truncated?: true;
|
|
102
|
+
}>;
|
|
45
103
|
/**
|
|
46
104
|
* A refusal of workspace.files.list or workspace.files.read: the JSON-RPC code and `data.reason`
|
|
47
105
|
* alpd answers with. Messages are fixed or name only the client's own relative path, never a host
|
|
@@ -85,23 +143,35 @@ export type ListedEntry = {
|
|
|
85
143
|
kind: 'file' | 'directory';
|
|
86
144
|
size?: number;
|
|
87
145
|
modifiedAt?: string;
|
|
146
|
+
target?: string;
|
|
88
147
|
};
|
|
89
148
|
/**
|
|
90
149
|
* The entries of a directory under `projectRoot` (its root without `relative`): regular files and
|
|
91
150
|
* directories only (links, sockets, devices are left out), never a blocked one (blockedFilePath)
|
|
92
151
|
* and, unless `includeIgnored`, none .gitignore'd. Directories first, then by name. Each directory
|
|
93
152
|
* on the way is checked (real directory, real path, same device and inode) before and after the
|
|
94
|
-
* read. At most WORKSPACE_FILES.maxListEntries entries; then `truncated
|
|
153
|
+
* read. At most WORKSPACE_FILES.maxListEntries entries; then `truncated` and `nextCursor`, which
|
|
154
|
+
* `cursor` takes to answer the entries after them.
|
|
155
|
+
*
|
|
156
|
+
* With `internalLinks` (workspace.files.browse): a link whose real path is inside the root and not
|
|
157
|
+
* blocked is listed as what it leads to, with that path as `target`, and `relative` may go through
|
|
158
|
+
* such links (the answer's `target` then names the directory listed, and entries are under it).
|
|
159
|
+
* Both the link's path and its target must pass .gitignore. A link leading outside is left out,
|
|
160
|
+
* and refused (`outside`) as `relative`.
|
|
95
161
|
*/
|
|
96
|
-
export declare function listWorkspaceDirectory(projectRoot: string, { path: relative, includeIgnored, now, probe, git }?: {
|
|
162
|
+
export declare function listWorkspaceDirectory(projectRoot: string, { path: relative, includeIgnored, cursor, internalLinks, now, probe, git }?: {
|
|
97
163
|
path?: string;
|
|
98
164
|
includeIgnored?: boolean;
|
|
165
|
+
cursor?: string;
|
|
166
|
+
internalLinks?: boolean;
|
|
99
167
|
now?: () => number;
|
|
100
168
|
probe?: FileProbe;
|
|
101
169
|
git?: GitCheckOptions;
|
|
102
170
|
}): Promise<{
|
|
103
171
|
entries: ListedEntry[];
|
|
104
172
|
truncated?: true;
|
|
173
|
+
nextCursor?: string;
|
|
174
|
+
target?: string;
|
|
105
175
|
}>;
|
|
106
176
|
/**
|
|
107
177
|
* The content of a UTF-8 text file under `projectRoot`, read-only: refused when it is blocked
|
|
@@ -121,3 +191,72 @@ export declare function readWorkspaceFile(projectRoot: string, { path: relative,
|
|
|
121
191
|
size: number;
|
|
122
192
|
modifiedAt: string;
|
|
123
193
|
}>;
|
|
194
|
+
/** Images a preview answers as such, by extension (the Paseo bridge's own list). */
|
|
195
|
+
export declare const PREVIEW_IMAGES: Readonly<Record<string, string>>;
|
|
196
|
+
export type FilePreview = {
|
|
197
|
+
path: string;
|
|
198
|
+
target?: string;
|
|
199
|
+
kind: 'text' | 'image' | 'binary';
|
|
200
|
+
mimeType: string;
|
|
201
|
+
size: number;
|
|
202
|
+
modifiedAt: string;
|
|
203
|
+
revision: string;
|
|
204
|
+
encoding: 'base64' | 'none';
|
|
205
|
+
content?: string;
|
|
206
|
+
offset?: number;
|
|
207
|
+
nextOffset?: number;
|
|
208
|
+
};
|
|
209
|
+
/**
|
|
210
|
+
* A preview of a file under `projectRoot`, as the Paseo bridge's Files panel showed one: `image`
|
|
211
|
+
* by extension (PREVIEW_IMAGES), else `text` when the whole file is (classify), else `binary`
|
|
212
|
+
* (metadata only, no content). Text and image bytes come as base64 in chunks of at most
|
|
213
|
+
* WORKSPACE_FILES.maxPreviewChunkBytes: the first from `offset` 0, each next one from the
|
|
214
|
+
* `nextOffset` before with the `revision` the first answered (a file that changed since is
|
|
215
|
+
* refused `changed`, so the chunks are of one file). At most `maxBytes` (and
|
|
216
|
+
* WORKSPACE_FILES.maxPreviewBytes), else `too_large`.
|
|
217
|
+
*
|
|
218
|
+
* Refused as workspace.files.read refuses: a blocked path, a .gitignore'd one (unless
|
|
219
|
+
* `includeIgnored`), missing or not a regular file, reached through a link, more than one name, a
|
|
220
|
+
* change while it is read; a text file holding a private key (and any chunk holding one) is
|
|
221
|
+
* refused `blocked_path`. With `internalLinks`, `relative` may go through links whose real path is
|
|
222
|
+
* inside the root (internalSegments): that real path, answered as `target`, is what is read, and
|
|
223
|
+
* both paths must pass .gitignore.
|
|
224
|
+
*/
|
|
225
|
+
export declare function previewWorkspaceFile(projectRoot: string, { path: relative, includeIgnored, internalLinks, maxBytes, offset, revision, probe, git }: {
|
|
226
|
+
path: string;
|
|
227
|
+
includeIgnored?: boolean;
|
|
228
|
+
internalLinks?: boolean;
|
|
229
|
+
maxBytes?: number;
|
|
230
|
+
offset?: number;
|
|
231
|
+
revision?: string;
|
|
232
|
+
probe?: FileProbe;
|
|
233
|
+
git?: GitCheckOptions;
|
|
234
|
+
}): Promise<FilePreview>;
|
|
235
|
+
/** Bounds of host.directories.search: home's directories `depth` levels down, `scanned` looked at; a typed path's parent read up to `listed` entries. */
|
|
236
|
+
export declare const HOST_DIRECTORIES: Readonly<{
|
|
237
|
+
depth: 4;
|
|
238
|
+
scanned: 5000;
|
|
239
|
+
listed: 20000;
|
|
240
|
+
defaultLimit: 30;
|
|
241
|
+
maxLimit: 100;
|
|
242
|
+
}>;
|
|
243
|
+
/** How well a name matches a query, as the Paseo bridge ranks names: 0 equal, 1 starts with it, 2 holds it, 3 its letters in order, undefined none; case-insensitive. */
|
|
244
|
+
export declare function nameRank(candidate: string, query: string): number | undefined;
|
|
245
|
+
/**
|
|
246
|
+
* The daemon host's directories for the folder a user adds as a project, as the Paseo bridge
|
|
247
|
+
* suggested them: a `query` that is a path (absolute, or `~` and `~/…` under `home`) answers the
|
|
248
|
+
* directories of its parent whose name starts with what follows the last separator (dot names only
|
|
249
|
+
* when that starts with `.`), by name; any other word answers the directories under `home`, up to
|
|
250
|
+
* HOST_DIRECTORIES.depth levels and .scanned of them (no dot names, none of SKIPPED_FOLDERS), whose
|
|
251
|
+
* name matches it (nameRank), best, then nearest, first. Names only; a link is neither listed nor
|
|
252
|
+
* entered. Absolute paths: the caller is the host's owner (never remote).
|
|
253
|
+
*/
|
|
254
|
+
export declare function searchHostDirectories(query: unknown, { limit, home }?: {
|
|
255
|
+
limit?: number;
|
|
256
|
+
home?: string;
|
|
257
|
+
}): Promise<{
|
|
258
|
+
entries: Array<{
|
|
259
|
+
path: string;
|
|
260
|
+
}>;
|
|
261
|
+
truncated?: true;
|
|
262
|
+
}>;
|