@one-agent-ctx/native-runtime 0.1.0 → 0.1.4
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/README.md +1 -1
- package/cli.d.ts +2 -0
- package/cli.js +26 -0
- package/package.json +10 -6
- package/platform.js +6 -4
package/README.md
CHANGED
|
@@ -124,7 +124,7 @@ Current tests and remaining migration gaps are recorded in
|
|
|
124
124
|
Cross-compilation must not be described as native Windows execution.
|
|
125
125
|
|
|
126
126
|
For the Node package, the [npm native qualification and release runbook](docs/refactor/06-platform-and-path-portability.md#npm-原生包资格)
|
|
127
|
-
defines the
|
|
127
|
+
defines the six macOS/Linux/Windows targets, NAPI and CLI native qualification,
|
|
128
128
|
runtime receipts, and explicit release prerequisites.
|
|
129
129
|
|
|
130
130
|
See `docs/refactor/README.md` for the design source of truth and
|
package/cli.d.ts
ADDED
package/cli.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const { resolvePlatform } = require('./platform.js');
|
|
3
|
+
const { createHash } = require('node:crypto');
|
|
4
|
+
const { readFileSync } = require('node:fs');
|
|
5
|
+
|
|
6
|
+
/** Resolve the CLI distributed with the exact native platform package. */
|
|
7
|
+
function cliPath() {
|
|
8
|
+
const platform = resolvePlatform(process.platform, process.arch,
|
|
9
|
+
process.platform === 'linux' ? process.report.getReport().header.glibcVersionRuntime : undefined);
|
|
10
|
+
const packageName = `@one-agent-ctx/runtime-${platform.id}`;
|
|
11
|
+
try {
|
|
12
|
+
const binary = require.resolve(`${packageName}/${platform.cli}`);
|
|
13
|
+
const receipt = require(`${packageName}/artifact.json`);
|
|
14
|
+
const version = require('./package.json').version;
|
|
15
|
+
const digest = createHash('sha256').update(readFileSync(binary)).digest('hex');
|
|
16
|
+
if (receipt.version !== version || receipt.platform !== platform.id || receipt.cliSha256 !== digest) {
|
|
17
|
+
throw new Error(`${packageName} CLI bytes differ from its published artifact identity`);
|
|
18
|
+
}
|
|
19
|
+
return binary;
|
|
20
|
+
} catch (cause) {
|
|
21
|
+
if (cause.code !== 'MODULE_NOT_FOUND') throw cause;
|
|
22
|
+
throw new Error(`${packageName} CLI is not installed. Install @one-agent-ctx/native-runtime with optional dependencies enabled.`, { cause });
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
module.exports = { cliPath };
|
package/package.json
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@one-agent-ctx/native-runtime",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Agent Context OS - native Node.js binding (napi-rs). Memories, skills, resources, self-evolution.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
7
7
|
"files": [
|
|
8
8
|
"index.js",
|
|
9
9
|
"index.d.ts",
|
|
10
|
-
"platform.js"
|
|
10
|
+
"platform.js",
|
|
11
|
+
"cli.js",
|
|
12
|
+
"cli.d.ts"
|
|
11
13
|
],
|
|
12
14
|
"optionalDependencies": {
|
|
13
|
-
"@one-agent-ctx/runtime-darwin-arm64": "0.1.
|
|
14
|
-
"@one-agent-ctx/runtime-darwin-x64": "0.1.
|
|
15
|
-
"@one-agent-ctx/runtime-
|
|
16
|
-
"@one-agent-ctx/runtime-
|
|
15
|
+
"@one-agent-ctx/runtime-darwin-arm64": "0.1.4",
|
|
16
|
+
"@one-agent-ctx/runtime-darwin-x64": "0.1.4",
|
|
17
|
+
"@one-agent-ctx/runtime-linux-arm64": "0.1.4",
|
|
18
|
+
"@one-agent-ctx/runtime-linux-x64": "0.1.4",
|
|
19
|
+
"@one-agent-ctx/runtime-win32-x64-msvc": "0.1.4",
|
|
20
|
+
"@one-agent-ctx/runtime-win32-arm64-msvc": "0.1.4"
|
|
17
21
|
},
|
|
18
22
|
"scripts": {
|
|
19
23
|
"test:npm": "node --test tests/harness/npm-release.test.mjs",
|
package/platform.js
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
// One distribution roster drives package resolution and release qualification.
|
|
4
4
|
const platforms = Object.freeze([
|
|
5
|
-
{ id: 'darwin-arm64', os: 'darwin', cpu: 'arm64', target: 'aarch64-apple-darwin', runner: 'macos-15', library: 'libctxos_napi.dylib' },
|
|
6
|
-
{ id: 'darwin-x64', os: 'darwin', cpu: 'x64', target: 'x86_64-apple-darwin', runner: 'macos-15-intel', library: 'libctxos_napi.dylib' },
|
|
7
|
-
{ id: '
|
|
8
|
-
{ id: '
|
|
5
|
+
{ id: 'darwin-arm64', os: 'darwin', cpu: 'arm64', target: 'aarch64-apple-darwin', runner: 'macos-15', library: 'libctxos_napi.dylib', cli: 'ctxos' },
|
|
6
|
+
{ id: 'darwin-x64', os: 'darwin', cpu: 'x64', target: 'x86_64-apple-darwin', runner: 'macos-15-intel', library: 'libctxos_napi.dylib', cli: 'ctxos' },
|
|
7
|
+
{ id: 'linux-arm64', os: 'linux', cpu: 'arm64', target: 'aarch64-unknown-linux-gnu', runner: 'ubuntu-24.04-arm', library: 'libctxos_napi.so', cli: 'ctxos' },
|
|
8
|
+
{ id: 'linux-x64', os: 'linux', cpu: 'x64', target: 'x86_64-unknown-linux-gnu', runner: 'ubuntu-24.04', library: 'libctxos_napi.so', cli: 'ctxos' },
|
|
9
|
+
{ id: 'win32-arm64-msvc', os: 'win32', cpu: 'arm64', target: 'aarch64-pc-windows-msvc', runner: 'windows-11-arm', library: 'ctxos_napi.dll', cli: 'ctxos.exe' },
|
|
10
|
+
{ id: 'win32-x64-msvc', os: 'win32', cpu: 'x64', target: 'x86_64-pc-windows-msvc', runner: 'windows-2025', library: 'ctxos_napi.dll', cli: 'ctxos.exe' },
|
|
9
11
|
].map(Object.freeze));
|
|
10
12
|
|
|
11
13
|
function resolvePlatform(os, cpu, glibcVersion) {
|