@skaft/octet 0.0.0 → 0.10.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/LICENSE +21 -0
- package/README.md +20 -2
- package/bin/octet +5 -0
- package/bin/octet-host +5 -0
- package/lib/launch.js +83 -0
- package/package.json +19 -13
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Achuthan Mukundan and Skaft Software contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
-
#
|
|
1
|
+
# octet npm launcher
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`@skaft/octet` is a small Node.js launcher for the native octet runtime. npm
|
|
4
|
+
selects one exact-version platform package through `optionalDependencies`; the
|
|
5
|
+
`octet` and `octet-host` commands start the selected native binary directly.
|
|
6
|
+
|
|
7
|
+
These scoped names are source packaging identities, not proof of registry rights
|
|
8
|
+
or availability. Use the installation command only after an authorized release
|
|
9
|
+
has published the packages.
|
|
10
|
+
|
|
11
|
+
The launcher requires Node.js but does not access the network, download an
|
|
12
|
+
archive, or execute an install lifecycle hook. Install it with scripts, audit,
|
|
13
|
+
and funding requests disabled:
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
npm install --global --ignore-scripts --no-audit --no-fund @skaft/octet@0.10.4
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
GNU/Linux uses the glibc x64 package. macOS uses the arm64 or x64 package that
|
|
20
|
+
matches the running executable. `octet doctor` reports a missing `rg`
|
|
21
|
+
prerequisite.
|
package/bin/octet
ADDED
package/bin/octet-host
ADDED
package/lib/launch.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('node:fs');
|
|
4
|
+
const path = require('node:path');
|
|
5
|
+
const { spawnSync } = require('node:child_process');
|
|
6
|
+
|
|
7
|
+
const PLATFORMS = Object.freeze({
|
|
8
|
+
'darwin-arm64': '@skaft/octet-darwin-arm64',
|
|
9
|
+
'darwin-x64': '@skaft/octet-darwin-x64',
|
|
10
|
+
'linux-x64': '@skaft/octet-linux-x64-gnu',
|
|
11
|
+
'win32-x64': '@skaft/octet-win32-x64',
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
function selectedPackage(platform = process.platform, architecture = process.arch) {
|
|
15
|
+
if (platform === 'linux' && architecture === 'x64') {
|
|
16
|
+
const libc = process.report?.getReport?.().header?.glibcVersionRuntime;
|
|
17
|
+
if (!libc) throw new Error('octet npm package requires GNU libc on Linux; musl is not supported');
|
|
18
|
+
}
|
|
19
|
+
const key = `${platform}-${architecture}`;
|
|
20
|
+
const selected = PLATFORMS[key];
|
|
21
|
+
if (!selected) throw new Error(`octet npm package does not support this platform: ${key}`);
|
|
22
|
+
return selected;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function findPlatformRoot(launcherRoot, packageName) {
|
|
26
|
+
const packageLeaf = packageName.slice(packageName.indexOf('/') + 1);
|
|
27
|
+
const candidates = [
|
|
28
|
+
path.join(launcherRoot, 'node_modules', ...packageName.split('/')),
|
|
29
|
+
path.join(launcherRoot, '..', packageLeaf),
|
|
30
|
+
];
|
|
31
|
+
for (const candidate of candidates) {
|
|
32
|
+
try {
|
|
33
|
+
if (fs.lstatSync(candidate).isDirectory() && !fs.lstatSync(candidate).isSymbolicLink()) return candidate;
|
|
34
|
+
} catch (error) {
|
|
35
|
+
if (error.code !== 'ENOENT') throw error;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
throw new Error(`octet npm package is missing the selected platform runtime: ${packageName}`);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function launch(commandName, args = process.argv.slice(2)) {
|
|
42
|
+
if (commandName !== 'octet' && commandName !== 'octet-host') throw new Error('invalid native command');
|
|
43
|
+
const launcherRoot = path.resolve(__dirname, '..');
|
|
44
|
+
const packageName = selectedPackage();
|
|
45
|
+
const platformRoot = findPlatformRoot(launcherRoot, packageName);
|
|
46
|
+
const executableName = process.platform === 'win32' ? `${commandName}.exe` : commandName;
|
|
47
|
+
const executable = path.join(platformRoot, 'bin', executableName);
|
|
48
|
+
const versionPath = path.join(platformRoot, 'share', 'octet', '.octet-version');
|
|
49
|
+
const required = [
|
|
50
|
+
...['package.json', 'README.md', 'LICENSE'].map((name) => path.join(platformRoot, name)), executable,
|
|
51
|
+
path.join(platformRoot, 'share', 'octet', 'README.md'),
|
|
52
|
+
path.join(platformRoot, 'share', 'octet', 'docs'),
|
|
53
|
+
path.join(platformRoot, 'share', 'octet', 'examples'),
|
|
54
|
+
path.join(platformRoot, 'share', 'octet', 'sdk'),
|
|
55
|
+
];
|
|
56
|
+
for (const file of required) {
|
|
57
|
+
try {
|
|
58
|
+
const stat = fs.lstatSync(file);
|
|
59
|
+
if (stat.isSymbolicLink() || (file === executable ? !stat.isFile() : !stat.isFile() && !stat.isDirectory())) {
|
|
60
|
+
throw new Error(`octet npm platform package is incomplete: ${platformRoot}`);
|
|
61
|
+
}
|
|
62
|
+
} catch (error) {
|
|
63
|
+
if (error.code === 'ENOENT') throw new Error(`octet npm platform package is incomplete: ${platformRoot}`);
|
|
64
|
+
throw error;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (process.platform !== 'win32' && (fs.statSync(executable).mode & 0o111) === 0) {
|
|
68
|
+
throw new Error(`octet npm platform executable is not executable: ${executable}`);
|
|
69
|
+
}
|
|
70
|
+
const version = fs.readFileSync(path.join(launcherRoot, 'package.json'), 'utf8').match(/"version"\s*:\s*"([^"]+)"/);
|
|
71
|
+
if (!version || fs.readFileSync(versionPath, 'utf8').trim() !== version[1]) {
|
|
72
|
+
throw new Error('octet npm platform version does not match launcher version');
|
|
73
|
+
}
|
|
74
|
+
const result = spawnSync(executable, args, { cwd: process.cwd(), env: process.env, stdio: 'inherit' });
|
|
75
|
+
if (result.error) throw result.error;
|
|
76
|
+
if (result.signal) {
|
|
77
|
+
process.kill(process.pid, result.signal);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
process.exitCode = result.status === null ? 1 : result.status;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
module.exports = { PLATFORMS, selectedPackage, findPlatformRoot, launch };
|
package/package.json
CHANGED
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skaft/octet",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.10.4",
|
|
4
|
+
"description": "Native octet coding agent launcher",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"repository":
|
|
7
|
-
|
|
8
|
-
"url": "git+https://github.com/skaft-software/octet.git"
|
|
9
|
-
},
|
|
10
|
-
"publishConfig": {
|
|
11
|
-
"access": "public",
|
|
12
|
-
"tag": "reserved",
|
|
13
|
-
"registry": "https://registry.npmjs.org/"
|
|
14
|
-
},
|
|
6
|
+
"repository": "https://github.com/skaft-software/octet",
|
|
7
|
+
"homepage": "https://octet.skaft.org",
|
|
15
8
|
"files": [
|
|
16
|
-
"README.md"
|
|
17
|
-
|
|
9
|
+
"README.md",
|
|
10
|
+
"LICENSE",
|
|
11
|
+
"bin/",
|
|
12
|
+
"lib/"
|
|
13
|
+
],
|
|
14
|
+
"bin": {
|
|
15
|
+
"octet": "bin/octet",
|
|
16
|
+
"octet-host": "bin/octet-host"
|
|
17
|
+
},
|
|
18
|
+
"optionalDependencies": {
|
|
19
|
+
"@skaft/octet-darwin-arm64": "0.10.4",
|
|
20
|
+
"@skaft/octet-darwin-x64": "0.10.4",
|
|
21
|
+
"@skaft/octet-linux-x64-gnu": "0.10.4",
|
|
22
|
+
"@skaft/octet-win32-x64": "0.10.4"
|
|
23
|
+
}
|
|
18
24
|
}
|