@anhlp/alp-runtime 0.0.0-beta.1 → 0.10.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/acp-transport.d.ts +0 -7
- package/dist/acp-transport.js +6 -20
- package/dist/board-domain.js +2 -3
- package/dist/claude-transport.js +6 -4
- package/dist/github.d.ts +1 -1
- package/dist/github.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -2
- package/dist/live.js +1 -2
- package/dist/process-info.d.ts +1 -1
- package/dist/process-info.js +1 -4
- package/dist/runtime.js +17 -49
- package/dist/session-config.js +1 -1
- package/dist/session-state.d.ts +0 -2
- package/dist/tool-results.d.ts +0 -1
- package/dist/tool-results.js +1 -5
- package/dist/transport.js +4 -8
- package/package.json +8 -15
- package/src/acp-transport.ts +3 -23
- package/src/board-domain.ts +2 -3
- package/src/claude-transport.ts +3 -5
- package/src/github.ts +1 -1
- package/src/index.ts +1 -1
- package/src/live.ts +1 -2
- package/src/process-info.ts +3 -7
- package/src/runtime.ts +9 -43
- package/src/session-config.ts +1 -1
- package/src/session-state.ts +0 -2
- package/src/tool-results.ts +1 -5
- package/src/transport.ts +4 -14
- package/LICENSE +0 -202
- package/NOTICE +0 -7
- package/dist/permission-path.d.ts +0 -2
- package/dist/permission-path.js +0 -44
- package/src/permission-path.ts +0 -37
package/NOTICE
DELETED
package/dist/permission-path.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
// packages/runtime/src/permission-path.ts
|
|
2
|
-
import { lstatSync, realpathSync } from "node:fs";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
import os from "node:os";
|
|
5
|
-
function canonical(file) {
|
|
6
|
-
const absolute = path.isAbsolute(file) ? file : `${process.cwd()}${path.sep}${file}`;
|
|
7
|
-
let current = path.parse(absolute).root;
|
|
8
|
-
for (const part of absolute.slice(current.length).split(process.platform === "win32" ? /[\\/]/ : /\//)) {
|
|
9
|
-
if (!part || part === ".") continue;
|
|
10
|
-
if (part === "..") {
|
|
11
|
-
current = path.dirname(current);
|
|
12
|
-
continue;
|
|
13
|
-
}
|
|
14
|
-
const candidate = path.join(current, part);
|
|
15
|
-
try {
|
|
16
|
-
current = realpathSync.native(candidate);
|
|
17
|
-
} catch (error) {
|
|
18
|
-
if (error?.code !== "ENOENT") throw error;
|
|
19
|
-
try {
|
|
20
|
-
if (lstatSync(candidate).isSymbolicLink()) throw new Error("Dangling symlink");
|
|
21
|
-
} catch (infoError) {
|
|
22
|
-
if (infoError?.code !== "ENOENT") throw infoError;
|
|
23
|
-
}
|
|
24
|
-
current = candidate;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return current;
|
|
28
|
-
}
|
|
29
|
-
var contains = (root, file) => {
|
|
30
|
-
const relative = path.relative(root, file);
|
|
31
|
-
return relative === "" || relative !== ".." && !relative.startsWith(`..${path.sep}`) && !path.isAbsolute(relative);
|
|
32
|
-
};
|
|
33
|
-
function writablePath(file, workdir) {
|
|
34
|
-
if (typeof file !== "string" || !file.trim() || file.includes("\0")) return false;
|
|
35
|
-
try {
|
|
36
|
-
const target = canonical(path.isAbsolute(file) ? file : `${workdir}${path.sep}${file}`);
|
|
37
|
-
return contains(canonical(workdir), target) || contains(canonical(os.tmpdir()), target);
|
|
38
|
-
} catch {
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
export {
|
|
43
|
-
writablePath
|
|
44
|
-
};
|
package/src/permission-path.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { lstatSync, realpathSync } from 'node:fs';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import os from 'node:os';
|
|
4
|
-
|
|
5
|
-
/** Resolve each component before '..', matching filesystem traversal through links.
|
|
6
|
-
* Missing leaves are allowed for creation; dangling links and other errors fail closed. */
|
|
7
|
-
function canonical(file: string): string {
|
|
8
|
-
const absolute = path.isAbsolute(file) ? file : `${process.cwd()}${path.sep}${file}`;
|
|
9
|
-
let current = path.parse(absolute).root;
|
|
10
|
-
for (const part of absolute.slice(current.length).split(process.platform === 'win32' ? /[\\/]/ : /\//)) {
|
|
11
|
-
if (!part || part === '.') continue;
|
|
12
|
-
if (part === '..') { current = path.dirname(current); continue; }
|
|
13
|
-
const candidate = path.join(current, part);
|
|
14
|
-
try { current = realpathSync.native(candidate); }
|
|
15
|
-
catch (error: any) {
|
|
16
|
-
if (error?.code !== 'ENOENT') throw error;
|
|
17
|
-
try {
|
|
18
|
-
if (lstatSync(candidate).isSymbolicLink()) throw new Error('Dangling symlink');
|
|
19
|
-
} catch (infoError: any) { if (infoError?.code !== 'ENOENT') throw infoError; }
|
|
20
|
-
current = candidate;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return current;
|
|
24
|
-
}
|
|
25
|
-
const contains = (root: string, file: string) => {
|
|
26
|
-
const relative = path.relative(root, file);
|
|
27
|
-
return relative === '' || (relative !== '..' && !relative.startsWith(`..${path.sep}`) && !path.isAbsolute(relative));
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
/** ALP's permission gate, not an OS sandbox or protection against concurrent link swaps. */
|
|
31
|
-
export function writablePath(file: unknown, workdir: string): boolean {
|
|
32
|
-
if (typeof file !== 'string' || !file.trim() || file.includes('\0')) return false;
|
|
33
|
-
try {
|
|
34
|
-
const target = canonical(path.isAbsolute(file) ? file : `${workdir}${path.sep}${file}`);
|
|
35
|
-
return contains(canonical(workdir), target) || contains(canonical(os.tmpdir()), target);
|
|
36
|
-
} catch { return false; }
|
|
37
|
-
}
|