@landstrip/landstrip-api 0.19.13 → 0.19.14

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.
Files changed (2) hide show
  1. package/README.md +23 -40
  2. package/package.json +7 -7
package/README.md CHANGED
@@ -1,60 +1,43 @@
1
1
  # @landstrip/landstrip-api
2
2
 
3
- Node.js wrapper, native binaries, and TypeScript types for the Landstrip sandbox.
4
- Requires Node.js 18 or newer; binaries are provided for Linux, macOS, and Windows
5
- on x64 and arm64.
3
+ Node.js wrapper and types for Landstrip. Requires Node.js ≥18; native binaries
4
+ support Linux, macOS, and Windows on x64/arm64.
6
5
 
7
- ## Install and run
6
+ ## Install
8
7
 
9
8
  ```sh
10
9
  npm install --save-dev @landstrip/landstrip-api
11
- npx landstrip run -p policy.json -- cargo test
12
10
  ```
13
11
 
14
- See the [quick start](../../README.md#quick-start) for an example policy and
15
- [landstrip(1)](../landstrip/man/man1/landstrip.1) for CLI options, policy rules,
16
- and platform limits.
12
+ See the [quick start](../../README.md#quick-start) for a policy and CLI example;
13
+ [landstrip(1)](../landstrip/man/man1/landstrip.1) covers policy and platform limits.
17
14
 
18
15
  ## Node.js API
19
16
 
20
17
  ```js
21
- const { execFileSync } = require('node:child_process');
22
- const { binaryPath } = require('@landstrip/landstrip-api');
18
+ const { execFileSync } = require("node:child_process");
19
+ const { binaryPath } = require("@landstrip/landstrip-api");
23
20
 
24
- execFileSync(binaryPath(), ['run', '-p', 'policy.json', '--', 'cargo', 'test'], {
25
- stdio: 'inherit',
21
+ execFileSync(binaryPath(), ["run", "-p", "policy.json", "--", "cargo", "test"], {
22
+ stdio: "inherit",
26
23
  });
27
24
  ```
28
25
 
29
- `binaryPath()` returns the installed native binary's canonical path and checks
30
- that it belongs to an official Landstrip package. It throws if the platform is
31
- unsupported, the binary is missing, or package ownership cannot be verified.
32
- `packageName()` returns the platform's binary package name. Both accept optional
33
- `platform` and `arch` arguments, defaulting to the current process.
26
+ `binaryPath()` resolves an official installed binary or throws; `packageName()`
27
+ returns its package name. Both accept `platform` and `arch`, defaulting to the
28
+ current process.
34
29
 
35
- The package exports [`LandstripTrap` and `LandstripControlResponse`](lib/index.d.ts)
36
- for structured events and Linux broker replies. Runtime traps and approval
37
- queries are Linux-only; macOS's `--trap` reports setup and launch failures.
38
- Descriptor lifetimes and the reply protocol are covered in the manual.
30
+ Types: [`LandstripTrap`, `LandstripControlResponse`](lib/index.d.ts).
31
+ Proxy helpers: [`/proxy`](lib/proxy.d.ts). [`/shared`](lib/shared.d.ts) provides:
39
32
 
40
- Integration helpers are exported through [`/shared`](lib/shared.d.ts) and
41
- [`/proxy`](lib/proxy.d.ts).
42
-
43
- `decodeLandstripTrap(value)` and `parseTrapLine(line)` from `/shared` return a
44
- validated `LandstripTrap`, or `null` for malformed input. Extra fields are
45
- preserved. Missing or unknown denial states are normalized to `info`, never
46
- queries; query IDs must be decimal `u64` strings and nonzero for queries.
47
- `isQueryTrap(trap)` narrows validated events to `LandstripQueryTrap` with
48
- `state: 'query'`. The declarations include all five native mechanisms and the
49
- current Windows error codes; the previously declared `POLICY_TCP_BIND_UNSUPPORTED`
50
- code remains accepted alongside `POLICY_LOCAL_BINDING_UNSUPPORTED`.
51
-
52
- `writeLandstripPolicyFile(policy, prefix = 'landstrip-')` from `/shared` writes
53
- `policy.json` and returns `{ dir, path }`. The caller owns `dir` and must remove it
54
- with `rmSync(dir, { recursive: true, force: true })` after use. Serialization
55
- happens before directory creation; failed writes remove partial files and their
56
- directory. If cleanup also fails, an `AggregateError` reports both errors and the
57
- directory path.
33
+ - `decodeLandstripTrap(value)` / `parseTrapLine(line)`: validated trap or `null`.
34
+ Extra fields survive; missing/unknown denial states become `info`, never queries.
35
+ - `isQueryTrap(trap)`: narrows validated events to `LandstripQueryTrap`.
36
+ Query IDs are decimal `u64` strings, nonzero for queries.
37
+ - `writeLandstripPolicyFile(policy, prefix = 'landstrip-')`: returns `{ dir, path }`.
38
+ Remove `dir` with `rmSync(dir, { recursive: true, force: true })` after use.
39
+ Failed writes clean up; failed cleanup reports both errors and the directory
40
+ path in an `AggregateError`.
58
41
 
59
42
  ## Development
60
43
 
@@ -62,5 +45,5 @@ Run `make ci` from the repository root.
62
45
 
63
46
  ## License
64
47
 
65
- [Apache-2.0](LICENSE). The bundled native binary is
48
+ [Apache-2.0](LICENSE); bundled native binaries are
66
49
  [LGPL-3.0-or-later](../landstrip/LICENSE).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@landstrip/landstrip-api",
3
- "version": "0.19.13",
3
+ "version": "0.19.14",
4
4
  "description": "Sandbox runner using Landlock, Seatbelt, and AppContainer",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/landstrip/landstrip#readme",
@@ -40,12 +40,12 @@
40
40
  "ipaddr.js": "^2.5.0"
41
41
  },
42
42
  "optionalDependencies": {
43
- "@landstrip/landstrip-darwin-arm64": "0.19.13",
44
- "@landstrip/landstrip-darwin-x64": "0.19.13",
45
- "@landstrip/landstrip-linux-x64": "0.19.13",
46
- "@landstrip/landstrip-linux-arm64": "0.19.13",
47
- "@landstrip/landstrip-win32-x64": "0.19.13",
48
- "@landstrip/landstrip-win32-arm64": "0.19.13"
43
+ "@landstrip/landstrip-darwin-arm64": "0.19.14",
44
+ "@landstrip/landstrip-darwin-x64": "0.19.14",
45
+ "@landstrip/landstrip-linux-x64": "0.19.14",
46
+ "@landstrip/landstrip-linux-arm64": "0.19.14",
47
+ "@landstrip/landstrip-win32-x64": "0.19.14",
48
+ "@landstrip/landstrip-win32-arm64": "0.19.14"
49
49
  },
50
50
  "publishConfig": {
51
51
  "access": "public"