@adea-ai/plugins 3.0.4 → 3.0.6
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/staged-file.d.ts +2 -0
- package/dist/staged-file.js +43 -0
- package/dist/staged-file.js.map +1 -0
- package/native/build-provenance.txt +6 -0
- package/native/staged-reader-win32-arm64.node +0 -0
- package/native/staged-reader-win32-x64.node +0 -0
- package/package.json +3 -1
- package/src/staged-file.ts +43 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { constants } from 'node:fs';
|
|
2
|
+
import { open } from 'node:fs/promises';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { createRequire } from 'node:module';
|
|
5
|
+
/** Read an already validated flat name without following a final-component symlink. */
|
|
6
|
+
export async function readStagedFile(directory, name) {
|
|
7
|
+
if (process.platform === 'win32') {
|
|
8
|
+
// The binary is built and qualified separately for each supported Windows architecture.
|
|
9
|
+
// Failure to load it is fatal: falling back to a path check would introduce a race.
|
|
10
|
+
let reader;
|
|
11
|
+
try {
|
|
12
|
+
if (process.arch !== 'x64' && process.arch !== 'arm64')
|
|
13
|
+
throw new Error('unsupported architecture');
|
|
14
|
+
reader = createRequire(import.meta.url)(`../native/staged-reader-win32-${process.arch}.node`);
|
|
15
|
+
if (typeof reader.read !== 'function')
|
|
16
|
+
throw new Error('invalid native reader');
|
|
17
|
+
}
|
|
18
|
+
catch (cause) {
|
|
19
|
+
throw new Error('STAGED_NOFOLLOW_UNSUPPORTED', { cause });
|
|
20
|
+
}
|
|
21
|
+
return reader.read(join(directory, name));
|
|
22
|
+
}
|
|
23
|
+
if (typeof constants.O_NOFOLLOW !== 'number' || constants.O_NOFOLLOW === 0)
|
|
24
|
+
throw new Error('STAGED_NOFOLLOW_UNSUPPORTED');
|
|
25
|
+
let file;
|
|
26
|
+
try {
|
|
27
|
+
file = await open(join(directory, name), constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
if (error.code === 'ELOOP')
|
|
31
|
+
throw new Error(`STAGED_FILE_UNSAFE: ${name}`, { cause: error });
|
|
32
|
+
throw error;
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
if (!(await file.stat()).isFile())
|
|
36
|
+
throw new Error(`STAGED_FILE_UNSAFE: ${name}`);
|
|
37
|
+
return await file.readFile();
|
|
38
|
+
}
|
|
39
|
+
finally {
|
|
40
|
+
await file.close();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=staged-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"staged-file.js","sourceRoot":"","sources":["../src/staged-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAE3C,uFAAuF;AACvF,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,SAAiB,EAAE,IAAY;IAClE,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QACjC,wFAAwF;QACxF,oFAAoF;QACpF,IAAI,MAA+C,CAAA;QACnD,IAAI,CAAC;YACH,IAAI,OAAO,CAAC,IAAI,KAAK,KAAK,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO;gBACpD,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;YAC7C,MAAM,GAAG,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CACrC,iCAAiC,OAAO,CAAC,IAAI,OAAO,CACpC,CAAA;YAClB,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,UAAU;gBAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAA;QACjF,CAAC;Q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
55727029d1f3a3ab2d12c78d5644573cc6ef217be2f780e4ef0463e4f16d3f66 packages/plugins/native/staged-reader-test-win32-arm64.node
|
|
4
|
+
9248afc5b2b21d134165d928c89124ebf6b15a161866dcafc3ec9091c7e54aed packages/plugins/native/staged-reader-test-win32-x64.node
|
|
5
|
+
a9ca706f8b0d95b6783ee5bbd28c2b13924fc28d7f93e1e0f368999f9940a7c9 packages/plugins/native/staged-reader-win32-arm64.node
|
|
6
|
+
bd3e69646a84aca2e7300eac1b784bba8f66a810d62ceaf1da16bada763751f0 packages/plugins/native/staged-reader-win32-x64.node
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adea-ai/plugins",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.6",
|
|
4
4
|
"description": "Deterministic compiler for AI agent plugin marketplaces: schemas, source parsing, provenance verification, per-harness materialization, and provenance-checked static artifacts.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agents",
|
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
"files": [
|
|
27
27
|
"dist",
|
|
28
28
|
"src",
|
|
29
|
+
"native/staged-reader-win32-*.node",
|
|
30
|
+
"native/build-provenance.txt",
|
|
29
31
|
"schemas",
|
|
30
32
|
"README.md"
|
|
31
33
|
],
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { constants } from 'node:fs'
|
|
2
|
+
import { open } from 'node:fs/promises'
|
|
3
|
+
import { join } from 'node:path'
|
|
4
|
+
import { createRequire } from 'node:module'
|
|
5
|
+
|
|
6
|
+
/** Read an already validated flat name without following a final-component symlink. */
|
|
7
|
+
export async function readStagedFile(directory: string, name: string): Promise<Buffer> {
|
|
8
|
+
if (process.platform === 'win32') {
|
|
9
|
+
// The binary is built and qualified separately for each supported Windows architecture.
|
|
10
|
+
// Failure to load it is fatal: falling back to a path check would introduce a race.
|
|
11
|
+
let reader: { read(path: string): Promise<Buffer> }
|
|
12
|
+
try {
|
|
13
|
+
if (process.arch !== 'x64' && process.arch !== 'arm64')
|
|
14
|
+
throw new Error('unsupported architecture')
|
|
15
|
+
reader = createRequire(import.meta.url)(
|
|
16
|
+
`../native/staged-reader-win32-${process.arch}.node`
|
|
17
|
+
) as typeof reader
|
|
18
|
+
if (typeof reader.read !== 'function') throw new Error('invalid native reader')
|
|
19
|
+
} catch (cause) {
|
|
20
|
+
throw new Error('STAGED_NOFOLLOW_UNSUPPORTED', { cause })
|
|
21
|
+
}
|
|
22
|
+
return reader.read(join(directory, name))
|
|
23
|
+
}
|
|
24
|
+
if (typeof constants.O_NOFOLLOW !== 'number' || constants.O_NOFOLLOW === 0)
|
|
25
|
+
throw new Error('STAGED_NOFOLLOW_UNSUPPORTED')
|
|
26
|
+
let file
|
|
27
|
+
try {
|
|
28
|
+
file = await open(
|
|
29
|
+
join(directory, name),
|
|
30
|
+
constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK
|
|
31
|
+
)
|
|
32
|
+
} catch (error) {
|
|
33
|
+
if ((error as NodeJS.ErrnoException).code === 'ELOOP')
|
|
34
|
+
throw new Error(`STAGED_FILE_UNSAFE: ${name}`, { cause: error })
|
|
35
|
+
throw error
|
|
36
|
+
}
|
|
37
|
+
try {
|
|
38
|
+
if (!(await file.stat()).isFile()) throw new Error(`STAGED_FILE_UNSAFE: ${name}`)
|
|
39
|
+
return await file.readFile()
|
|
40
|
+
} finally {
|
|
41
|
+
await file.close()
|
|
42
|
+
}
|
|
43
|
+
}
|