@anhlp/alp-daemon 0.0.0-stage → 0.0.1-beta.10
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/LICENSE +202 -0
- package/NOTICE +7 -0
- package/README.md +14 -2
- package/dist/THIRD-PARTY-NOTICES.txt +456 -0
- package/dist/alp-templates.d.ts +5 -0
- package/dist/alpd.js +64050 -0
- package/dist/attachments.d.ts +187 -0
- package/dist/attachments.js +856 -0
- package/dist/build-manifest.json +150 -0
- package/dist/conversation.d.ts +119 -0
- package/dist/conversation.js +688 -0
- package/dist/disk.d.ts +67 -0
- package/dist/disk.js +152 -0
- package/dist/files.d.ts +262 -0
- package/dist/files.js +674 -0
- package/dist/git.d.ts +98 -0
- package/dist/git.js +1246 -0
- package/dist/gitignore.d.ts +62 -0
- package/dist/gitignore.js +254 -0
- package/dist/history.d.ts +24 -0
- package/dist/history.js +149 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +28 -0
- package/dist/lifecycle.d.ts +101 -0
- package/dist/lifecycle.js +239 -0
- package/dist/lock.d.ts +21 -0
- package/dist/lock.js +42 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +363 -0
- package/dist/model-catalog.d.ts +2 -0
- package/dist/model-catalog.js +44 -0
- package/dist/native-entry.d.ts +2 -0
- package/dist/native-entry.js +3 -0
- package/dist/native-register.d.ts +1 -0
- package/dist/native-register.js +13 -0
- package/dist/native-terminal.d.ts +45 -0
- package/dist/native-terminal.js +201 -0
- package/dist/operations.d.ts +40 -0
- package/dist/operations.js +313 -0
- package/dist/registry.d.ts +89 -0
- package/dist/registry.js +343 -0
- package/dist/rpc-error.d.ts +6 -0
- package/dist/rpc-error.js +11 -0
- package/dist/scheduler.d.ts +96 -0
- package/dist/scheduler.js +298 -0
- package/dist/schedules.d.ts +70 -0
- package/dist/schedules.js +246 -0
- package/dist/server.d.ts +60 -0
- package/dist/server.js +1958 -0
- package/dist/store.d.ts +178 -0
- package/dist/store.js +386 -0
- 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 +203 -0
- package/dist/terminals.js +570 -0
- package/dist/windows-terminal.d.ts +32 -0
- package/dist/windows-terminal.js +79 -0
- package/dist/worktrees.d.ts +65 -0
- package/dist/worktrees.js +318 -0
- 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 +163 -4
- package/src/alp-templates.d.ts +5 -0
- package/src/attachments.ts +908 -0
- package/src/conversation.ts +857 -0
- package/src/disk.ts +175 -0
- package/src/files.ts +884 -0
- package/src/git.ts +1220 -0
- package/src/gitignore.ts +277 -0
- package/src/history.ts +118 -0
- package/src/index.ts +12 -0
- package/src/lifecycle.ts +283 -0
- package/src/lock.ts +53 -0
- package/src/main.ts +381 -0
- package/src/model-catalog.ts +36 -0
- package/src/native-entry.ts +5 -0
- package/src/native-register.ts +21 -0
- package/src/native-terminal.ts +127 -0
- package/src/operations.ts +329 -0
- package/src/registry.ts +238 -0
- package/src/rpc-error.ts +4 -0
- package/src/scheduler.ts +438 -0
- package/src/schedules.ts +297 -0
- package/src/server.ts +2238 -0
- package/src/store.ts +449 -0
- package/src/terminal-screen.ts +74 -0
- package/src/terminals.ts +653 -0
- package/src/windows-terminal.ts +74 -0
- package/src/worktrees.ts +382 -0
package/dist/git.d.ts
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { Stats } from 'node:fs';
|
|
2
|
+
import type { GitCompare, GitDiffPage, GitFacts, GitStatus } from '@anhlp/alp-protocol';
|
|
3
|
+
/**
|
|
4
|
+
* `workspace.git.status` and `workspace.git.diff` (docs/protocol/alp-json-rpc-v1.md §12.5): the
|
|
5
|
+
* read-only Git state of a registry workspace, for Paseo's branch header and Changes panel.
|
|
6
|
+
*
|
|
7
|
+
* The workspace and its repository configuration are not trusted, so Git runs boxed in:
|
|
8
|
+
* - the Git found on the absolute PATH entries outside the workspace, by its real path
|
|
9
|
+
* (gitignore.ts resolveGit), spawned with an argument list, no shell, in the workspace's real
|
|
10
|
+
* path, its own process group killed at the call's deadline;
|
|
11
|
+
* - GIT_DIR and GIT_WORK_TREE set by alpd to the repository it checked (the workspace's `.git`,
|
|
12
|
+
* validated as the registry validates worktrees: core repositoryIdentity), every other GIT_*
|
|
13
|
+
* variable of alpd's dropped, no system or global configuration, no optional locks, no prompts,
|
|
14
|
+
* no lazy fetch, no replace objects, PATH without the workspace's entries;
|
|
15
|
+
* - configuration overrides so nothing the repository names runs: no fsmonitor, hooks to the null
|
|
16
|
+
* device, no pager, no colour, no external diff or textconv (flags too), every
|
|
17
|
+
* filter.<driver>.{clean,smudge,process} the repository's configuration names emptied and
|
|
18
|
+
* `required` false, no submodule recursion (`--ignore-submodules=dirty`: a gitlink's recorded
|
|
19
|
+
* commit only, never a Git run inside it), no network protocol, `diff.autoRefreshIndex` off (a
|
|
20
|
+
* porcelain `git diff` would otherwise rewrite the index even with GIT_OPTIONAL_LOCKS=0);
|
|
21
|
+
* - `--literal-pathspecs`: a path is never pathspec magic, and always after `--`; a base branch is
|
|
22
|
+
* a validated name resolved only as `refs/remotes/origin/<name>` then `refs/heads/<name>` with
|
|
23
|
+
* `rev-parse --verify --end-of-options`, never a revision expression;
|
|
24
|
+
* - every output read as a stream with a bound; at most GIT_READ.maxConcurrent Git processes at
|
|
25
|
+
* once in alpd.
|
|
26
|
+
* Content alpd shows is checked first: both sides of every file are scanned for a private key
|
|
27
|
+
* (files.ts PRIVATE_KEY), historical and deleted ones included; untracked files are read by alpd
|
|
28
|
+
* itself, confined as workspace.files.read confines a read. Errors carry fixed messages; the
|
|
29
|
+
* cause is logged, never answered.
|
|
30
|
+
*
|
|
31
|
+
* `workspace.git.facts` reads in the same box for an owner's host directory that need not be a
|
|
32
|
+
* registry workspace (a project-only, preflight or nested folder): its repository's root, branch,
|
|
33
|
+
* HEAD, origin and whether anything changed, never a file list or content.
|
|
34
|
+
*/
|
|
35
|
+
export declare const GIT_READ: Readonly<{
|
|
36
|
+
/** One call (all of its Git processes, waiting for a turn included) gets this long. */
|
|
37
|
+
timeoutMs: 15000;
|
|
38
|
+
/** Git processes these reads run at once in alpd, and processes that may wait for one. */
|
|
39
|
+
maxConcurrent: 4;
|
|
40
|
+
maxQueued: 32;
|
|
41
|
+
maxErrorBytes: number;
|
|
42
|
+
/** Configuration, change list and untracked list output, at most. */
|
|
43
|
+
maxListBytes: number;
|
|
44
|
+
/** Ancestors retained per listing; exceeding the budget fails the read closed. */
|
|
45
|
+
maxAncestors: 16384;
|
|
46
|
+
/** One patch stream, at most (its files are at most a window's worth of content). */
|
|
47
|
+
maxPatchStreamBytes: number;
|
|
48
|
+
/** One side of a file scanned for a private key; a larger side is `too_large`. */
|
|
49
|
+
maxScanBytes: number;
|
|
50
|
+
/** Files whose content one window reads and diffs together, and their content's total. */
|
|
51
|
+
windowFiles: 64;
|
|
52
|
+
windowBytes: number;
|
|
53
|
+
/** Pathspec bytes on one command line. */
|
|
54
|
+
maxArgBytes: number;
|
|
55
|
+
/** Worktree files whose size and time enter a diff's snapshot. */
|
|
56
|
+
maxSnapshotStats: 5000;
|
|
57
|
+
}>;
|
|
58
|
+
/** A Git read that failed: answered as `1000 git_failed` with a fixed message; `cause` is logged only. */
|
|
59
|
+
export declare class GitReadFailed extends Error {
|
|
60
|
+
readonly cause: string;
|
|
61
|
+
constructor(cause: string);
|
|
62
|
+
}
|
|
63
|
+
/** Git processes these reads run now, for tests. */
|
|
64
|
+
export declare const gitReadsRunning: () => number;
|
|
65
|
+
/** A branch name as `git check-ref-format --branch` accepts one, never starting with '-' (no option, no revision syntax). */
|
|
66
|
+
export declare function validBranchName(name: unknown): name is string;
|
|
67
|
+
/**
|
|
68
|
+
* origin's URL as a client may see it: no user, password or token, no query or fragment; a local
|
|
69
|
+
* path, a `file:` URL or anything unrecognized is null.
|
|
70
|
+
*/
|
|
71
|
+
export declare function scrubRemoteUrl(url: string | null): string | null;
|
|
72
|
+
export type GitReaderOptions = {
|
|
73
|
+
/** Resolves a workspaceId for status and diff; without it they are unavailable (facts needs none). */
|
|
74
|
+
registry?: {
|
|
75
|
+
resolve(workspaceId: string): Promise<string>;
|
|
76
|
+
};
|
|
77
|
+
/** Which git: a name looked up on PATH (outside the workspace), or an absolute path (tests). */
|
|
78
|
+
binary?: string;
|
|
79
|
+
timeoutMs?: number;
|
|
80
|
+
log?: (message: string, fields: Record<string, unknown>) => void;
|
|
81
|
+
/** Tests only: called after a window's contents were scanned and before Git writes their patch, where a racing writer could change a file. */
|
|
82
|
+
probe?: (step: 'scanned') => Promise<void> | void;
|
|
83
|
+
/** Tests only: how an untracked path's ancestor directories are inspected (default async lstat), to inject its failures. */
|
|
84
|
+
inspect?: (file: string) => Stats | Promise<Stats>;
|
|
85
|
+
};
|
|
86
|
+
type DiffParams = {
|
|
87
|
+
workspaceId: string;
|
|
88
|
+
compare: GitCompare;
|
|
89
|
+
path?: string;
|
|
90
|
+
cursor?: string;
|
|
91
|
+
};
|
|
92
|
+
export declare function createGitReader({ registry, binary, timeoutMs, log, probe, inspect }: GitReaderOptions): {
|
|
93
|
+
status: (workspaceId: unknown) => Promise<GitStatus>;
|
|
94
|
+
diff: (params: DiffParams) => Promise<GitDiffPage>;
|
|
95
|
+
facts: (directory: unknown) => Promise<GitFacts>;
|
|
96
|
+
};
|
|
97
|
+
export type GitReader = ReturnType<typeof createGitReader>;
|
|
98
|
+
export {};
|