@agentims/native-core-linux-arm64 0.1.0 → 0.2.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/bin/core.mjs ADDED
@@ -0,0 +1,54 @@
1
+ /** Minimal host for the existing Rust daemon. No communication logic lives here. */
2
+ import { createHash } from "node:crypto";
3
+ import { readFileSync, lstatSync } from "node:fs";
4
+ import { createRequire } from "node:module";
5
+ import { dirname, join } from "node:path";
6
+ import { fileURLToPath } from "node:url";
7
+ async function main() {
8
+ const base = dirname(fileURLToPath(import.meta.url));
9
+ const manifest = JSON.parse(readFileSync(join(base, "manifest.json"), "utf8"));
10
+ if (!manifest || typeof manifest !== "object" || !("execution" in manifest) || manifest.execution !== "node-addon-driver"
11
+ || !("platform" in manifest) || manifest.platform !== `${process.platform}-${process.arch}`
12
+ || !("addon_package" in manifest) || manifest.addon_package !== `@agentims/native-sdk-${process.platform}-${process.arch}`
13
+ || !("addon_version" in manifest) || typeof manifest.addon_version !== "string"
14
+ || !("addon_sha256" in manifest) || typeof manifest.addon_sha256 !== "string"
15
+ || !("sha256" in manifest) || typeof manifest.sha256 !== "string")
16
+ throw new Error("Invalid native driver binding");
17
+ const [major, minor, patch] = process.versions.node.split(".").map(Number);
18
+ if (major !== 24 || (minor ?? 0) < 22 || minor === 22 && (patch ?? 0) < 2)
19
+ throw new Error("Native driver requires supported Node 24");
20
+ const require = createRequire(import.meta.url);
21
+ let addon;
22
+ if ("private_payload" in manifest && manifest.private_payload === true)
23
+ addon = join(base, "engine.node");
24
+ else {
25
+ const metadata = JSON.parse(readFileSync(require.resolve(manifest.addon_package), "utf8"));
26
+ if (!metadata || typeof metadata !== "object" || !("version" in metadata) || metadata.version !== manifest.addon_version)
27
+ throw new Error("Native resource version differs");
28
+ addon = require.resolve(manifest.addon_package + "/addon");
29
+ }
30
+ for (const [path, expected] of [[fileURLToPath(import.meta.url), manifest.sha256], [addon, manifest.addon_sha256]]) {
31
+ if (!path || !expected || !lstatSync(path).isFile() || lstatSync(path).isSymbolicLink()
32
+ || createHash("sha256").update(readFileSync(path)).digest("hex") !== expected)
33
+ throw new Error("Native resource bytes differ");
34
+ }
35
+ const binding = require(addon);
36
+ if (binding.bindingAbi() !== 1 || binding.daemonDriverAbi() !== 1)
37
+ throw new Error("Native driver ABI differs");
38
+ const command = new binding.NativeDaemonCommand(process.argv.slice(2));
39
+ const shutdown = () => command.shutdown();
40
+ if (command.cancellable) {
41
+ process.on("SIGTERM", shutdown);
42
+ process.on("SIGINT", shutdown);
43
+ }
44
+ try {
45
+ process.exitCode = await command.run();
46
+ }
47
+ finally {
48
+ if (command.cancellable) {
49
+ process.off("SIGTERM", shutdown);
50
+ process.off("SIGINT", shutdown);
51
+ }
52
+ }
53
+ }
54
+ main().catch(() => { process.stderr.write("AgentIM native driver failed; original device state was preserved\n"); process.exitCode = 1; });
package/bin/manifest.json CHANGED
@@ -1,9 +1,13 @@
1
1
  {
2
+ "execution": "node-addon-driver",
3
+ "driver_abi": 1,
2
4
  "platform": "linux-arm64",
3
5
  "target": "aarch64-unknown-linux-gnu",
4
- "native": false,
5
6
  "build_mode": "cross",
6
- "sha256": "df8ed89e1fad259fbcf7571a25c34cdd2d69a6198efc88db2abc8f74013791e0",
7
- "bytes": 163280464,
8
- "source_digest": "131c6fb3893b6d7d9e12aea8961ceb04f0671e2dd7d3785661b8b61843220416"
7
+ "execution_validated": false,
8
+ "sha256": "0beb23f7d48a466982b9582a1bd301ee6996b266aa02683f1c76bea664d18976",
9
+ "source_digest": "eab693676ea2c62283247c05f300c60cf73eacbe94f74528e1d0eb0f59b39efc",
10
+ "addon_package": "@agentims/native-sdk-linux-arm64",
11
+ "addon_version": "0.2.0",
12
+ "addon_sha256": "33de5e070950b747d9c323aaff067710fedf916c830b9f5e71359c665348b5e1"
9
13
  }
package/package.json CHANGED
@@ -1,19 +1,22 @@
1
1
  {
2
2
  "name": "@agentims/native-core-linux-arm64",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=24.22.2 <25"
7
7
  },
8
8
  "exports": {
9
9
  ".": "./package.json",
10
- "./core": "./bin/agentim-daemon"
10
+ "./core": "./bin/core.mjs"
11
11
  },
12
12
  "files": [
13
13
  "bin",
14
14
  "licenses",
15
15
  "LICENSE"
16
16
  ],
17
+ "dependencies": {
18
+ "@agentims/native-sdk-linux-arm64": "0.2.0"
19
+ },
17
20
  "os": [
18
21
  "linux"
19
22
  ],
@@ -1,4 +0,0 @@
1
- [diffend] Oversized file quarantined before diffing.
2
- name: package/bin/agentim-daemon
3
- size: 163280464 bytes
4
- sha256: df8ed89e1fad259fbcf7571a25c34cdd2d69a6198efc88db2abc8f74013791e0