@mmmbuto/masix 0.4.0 → 0.4.1
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 +15 -13
- package/install.js +89 -26
- package/package.json +4 -3
- package/packages/plugin-base/codex-backend/0.1.4/SHA256SUMS +3 -0
- package/packages/plugin-base/codex-backend/0.1.4/codex-backend-android-aarch64-termux.pkg +0 -0
- package/packages/plugin-base/codex-backend/0.1.4/codex-backend-linux-x86_64.pkg +0 -0
- package/packages/plugin-base/codex-backend/0.1.4/codex-backend-macos-aarch64.pkg +0 -0
- package/packages/plugin-base/codex-backend/0.1.4/manifest.json +33 -0
- package/packages/plugin-base/codex-backend/CHANGELOG.md +17 -0
- package/packages/plugin-base/codex-backend/README.md +33 -0
- package/packages/plugin-base/codex-backend/source/Cargo.toml +25 -0
- package/packages/plugin-base/codex-backend/source/README-PACKAGE.txt +54 -0
- package/packages/plugin-base/codex-backend/source/plugin.manifest.json +103 -0
- package/packages/plugin-base/codex-backend/source/src/error.rs +60 -0
- package/packages/plugin-base/codex-backend/source/src/exec.rs +436 -0
- package/packages/plugin-base/codex-backend/source/src/http_backend.rs +1198 -0
- package/packages/plugin-base/codex-backend/source/src/lib.rs +328 -0
- package/packages/plugin-base/codex-backend/source/src/patch.rs +767 -0
- package/packages/plugin-base/codex-backend/source/src/policy.rs +297 -0
- package/packages/plugin-base/codex-backend/source/src/tools.rs +72 -0
- package/packages/plugin-base/codex-backend/source/src/workspace.rs +433 -0
- package/packages/plugin-base/codex-tools/0.1.3/SHA256SUMS +3 -0
- package/packages/plugin-base/codex-tools/0.1.3/codex-tools-android-aarch64-termux.pkg +0 -0
- package/packages/plugin-base/codex-tools/0.1.3/codex-tools-linux-x86_64.pkg +0 -0
- package/packages/plugin-base/codex-tools/0.1.3/codex-tools-macos-aarch64.pkg +0 -0
- package/packages/plugin-base/codex-tools/0.1.3/manifest.json +33 -0
- package/packages/plugin-base/codex-tools/CHANGELOG.md +17 -0
- package/packages/plugin-base/codex-tools/README.md +33 -0
- package/packages/plugin-base/codex-tools/source/Cargo.toml +23 -0
- package/packages/plugin-base/codex-tools/source/plugin.manifest.json +124 -0
- package/packages/plugin-base/codex-tools/source/src/main.rs +995 -0
- package/packages/plugin-base/discovery/0.2.4/SHA256SUMS +3 -0
- package/packages/plugin-base/discovery/0.2.4/discovery-android-aarch64-termux.pkg +0 -0
- package/packages/plugin-base/discovery/0.2.4/discovery-linux-x86_64.pkg +0 -0
- package/packages/plugin-base/discovery/0.2.4/discovery-macos-aarch64.pkg +0 -0
- package/packages/plugin-base/discovery/0.2.4/manifest.json +31 -0
- package/packages/plugin-base/discovery/CHANGELOG.md +17 -0
- package/packages/plugin-base/discovery/README.md +48 -0
- package/packages/plugin-base/discovery/source/Cargo.toml +14 -0
- package/packages/plugin-base/discovery/source/plugin.manifest.json +30 -0
- package/packages/plugin-base/discovery/source/src/main.rs +2570 -0
- package/prebuilt/masix +0 -0
package/README.md
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
Official Termux package for MasiX (MIT).
|
|
4
4
|
|
|
5
|
-
MasiX is
|
|
5
|
+
MasiX is a Rust automation runtime optimized for smartphone use in Termux and compatible with Linux and macOS source builds.
|
|
6
6
|
|
|
7
|
-
Current package line: `0.4.
|
|
7
|
+
Current package line: `0.4.1`.
|
|
8
8
|
|
|
9
9
|
## Function Summary
|
|
10
10
|
|
|
11
11
|
- Telegram bot automation with interactive inline menus
|
|
12
12
|
- Real MCP tool-calling flow through API-compatible endpoints
|
|
13
|
-
- Natural-language reminder scheduling
|
|
13
|
+
- Natural-language reminder scheduling with cron persistence
|
|
14
14
|
- Cron scope isolation per bot/account (`account_tag`)
|
|
15
15
|
- Workdir isolation per Telegram account
|
|
16
16
|
- User memory isolation with per-user catalog (`meta.json`)
|
|
@@ -18,8 +18,7 @@ Current package line: `0.4.0`.
|
|
|
18
18
|
- Guarded command execution (`/exec`, `/termux`) with allowlists
|
|
19
19
|
- Termux boot automation (`masix termux boot enable|disable|status`)
|
|
20
20
|
- Optional local STT via whisper.cpp (`masix config stt`)
|
|
21
|
-
-
|
|
22
|
-
- SOUL.md startup memory context
|
|
21
|
+
- Bundled `plugin-base` packages are included and installed during `npm install`
|
|
23
22
|
- Startup update checks are available on demand via `masix check-update`
|
|
24
23
|
|
|
25
24
|
## Install (Termux)
|
|
@@ -40,6 +39,15 @@ masix start
|
|
|
40
39
|
masix status
|
|
41
40
|
```
|
|
42
41
|
|
|
42
|
+
## Bundled Packages
|
|
43
|
+
|
|
44
|
+
Postinstall installs these bundled `plugin-base` packages into `~/.masix/plugins`:
|
|
45
|
+
- `discovery` `0.2.4`
|
|
46
|
+
- `codex-backend` `0.1.4`
|
|
47
|
+
- `codex-tools` `0.1.3`
|
|
48
|
+
|
|
49
|
+
Package artifacts are also included in the npm tarball under `packages/plugin-base/`.
|
|
50
|
+
|
|
43
51
|
## Useful Commands
|
|
44
52
|
|
|
45
53
|
```bash
|
|
@@ -55,15 +63,9 @@ masix termux boot status
|
|
|
55
63
|
masix stats
|
|
56
64
|
```
|
|
57
65
|
|
|
58
|
-
## Runtime Chat Commands
|
|
59
|
-
|
|
60
|
-
- `/cron ...`, `/cron list`, `/cron cancel <id>`
|
|
61
|
-
- `/exec <allowlisted-command>`
|
|
62
|
-
- `/termux ...`
|
|
63
|
-
|
|
64
66
|
## Notes
|
|
65
67
|
|
|
66
|
-
- This package targets Android + arm64
|
|
68
|
+
- This package targets Android + arm64 in Termux
|
|
67
69
|
- If no prebuilt binary is available, postinstall builds from source
|
|
68
70
|
- `masix config stt` can auto-pick and auto-download a Whisper model based on device resources
|
|
69
71
|
|
|
@@ -72,7 +74,7 @@ masix stats
|
|
|
72
74
|
- Repository README: https://github.com/DioNanos/MasiX
|
|
73
75
|
- Detailed guide: https://github.com/DioNanos/MasiX/blob/main/docs/USER_GUIDE.md
|
|
74
76
|
- Commands reference: https://github.com/DioNanos/MasiX/blob/main/docs/COMMANDS_REFERENCE.md
|
|
75
|
-
- Homebrew tap
|
|
77
|
+
- Homebrew tap: https://github.com/DioNanos/homebrew-masix
|
|
76
78
|
- Local llama.cpp endpoint guide: https://github.com/DioNanos/MasiX/blob/main/docs/TERMUX_LLAMA_CPP_LOCAL_ENDPOINT.md
|
|
77
79
|
|
|
78
80
|
## Branding
|
package/install.js
CHANGED
|
@@ -1,14 +1,40 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
|
+
const os = require('os');
|
|
2
3
|
const path = require('path');
|
|
3
|
-
const { execSync } = require('child_process');
|
|
4
|
+
const { execSync, execFileSync } = require('child_process');
|
|
4
5
|
|
|
5
6
|
const BINARY_NAME = 'masix';
|
|
6
7
|
const PACKAGE_BIN_PATH = path.join(__dirname, 'prebuilt', BINARY_NAME);
|
|
7
8
|
const PREBUILT_DIR = path.join(__dirname, 'prebuilt');
|
|
9
|
+
const BUNDLED_PACKAGES_DIR = path.join(__dirname, 'packages', 'plugin-base');
|
|
10
|
+
const TERMUX_PLATFORM = 'android-aarch64-termux';
|
|
11
|
+
const BUNDLED_PLUGINS = [
|
|
12
|
+
{
|
|
13
|
+
plugin: 'discovery',
|
|
14
|
+
version: '0.2.4',
|
|
15
|
+
packageType: 'mcp_binary',
|
|
16
|
+
file: path.join(BUNDLED_PACKAGES_DIR, 'discovery', '0.2.4', 'discovery-android-aarch64-termux.pkg'),
|
|
17
|
+
adminOnly: false
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
plugin: 'codex-backend',
|
|
21
|
+
version: '0.1.4',
|
|
22
|
+
packageType: 'library',
|
|
23
|
+
file: path.join(BUNDLED_PACKAGES_DIR, 'codex-backend', '0.1.4', 'codex-backend-android-aarch64-termux.pkg'),
|
|
24
|
+
adminOnly: true
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
plugin: 'codex-tools',
|
|
28
|
+
version: '0.1.3',
|
|
29
|
+
packageType: 'mcp_binary',
|
|
30
|
+
file: path.join(BUNDLED_PACKAGES_DIR, 'codex-tools', '0.1.3', 'codex-tools-android-aarch64-termux.pkg'),
|
|
31
|
+
adminOnly: true
|
|
32
|
+
}
|
|
33
|
+
];
|
|
8
34
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
35
|
+
const isTermux =
|
|
36
|
+
process.env.TERMUX_VERSION !== undefined ||
|
|
37
|
+
process.env.PREFIX === '/data/data/com.termux/files/usr';
|
|
12
38
|
|
|
13
39
|
if (!isTermux) {
|
|
14
40
|
console.warn('⚠️ @mmmbuto/masix is designed for Android Termux only!');
|
|
@@ -22,39 +48,42 @@ function hasValidElfPrebuilt(binaryPath) {
|
|
|
22
48
|
const buf = Buffer.alloc(4);
|
|
23
49
|
fs.readSync(fd, buf, 0, 4, 0);
|
|
24
50
|
fs.closeSync(fd);
|
|
25
|
-
return buf[0] === 0x7f && buf[1] === 0x45 && buf[2] === 0x4c && buf[3] === 0x46;
|
|
51
|
+
return buf[0] === 0x7f && buf[1] === 0x45 && buf[2] === 0x4c && buf[3] === 0x46;
|
|
26
52
|
} catch {
|
|
27
53
|
return false;
|
|
28
54
|
}
|
|
29
55
|
}
|
|
30
56
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
57
|
+
function ensureBinary() {
|
|
58
|
+
if (hasValidElfPrebuilt(PACKAGE_BIN_PATH)) {
|
|
59
|
+
fs.chmodSync(PACKAGE_BIN_PATH, 0o755);
|
|
60
|
+
console.log(`✅ Using packaged prebuilt binary: ${PACKAGE_BIN_PATH}`);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
35
64
|
console.log('🔨 No prebuilt binary found. Building from source...');
|
|
36
65
|
console.log(' This requires Rust to be installed in Termux.');
|
|
37
|
-
|
|
66
|
+
|
|
38
67
|
try {
|
|
39
68
|
const masixRoot = path.join(__dirname, '..', '..');
|
|
40
69
|
execSync('cargo build --release', {
|
|
41
70
|
cwd: masixRoot,
|
|
42
71
|
stdio: 'inherit'
|
|
43
72
|
});
|
|
44
|
-
|
|
73
|
+
|
|
45
74
|
let sourceBinary = path.join(masixRoot, 'target', 'release', BINARY_NAME);
|
|
46
75
|
if (!fs.existsSync(sourceBinary)) {
|
|
47
76
|
sourceBinary = path.join(masixRoot, 'target', 'aarch64-linux-android', 'release', BINARY_NAME);
|
|
48
77
|
}
|
|
49
|
-
|
|
50
|
-
if (fs.existsSync(sourceBinary)) {
|
|
51
|
-
fs.mkdirSync(PREBUILT_DIR, { recursive: true });
|
|
52
|
-
fs.copyFileSync(sourceBinary, PACKAGE_BIN_PATH);
|
|
53
|
-
fs.chmodSync(PACKAGE_BIN_PATH, 0o755);
|
|
54
|
-
console.log(`✅ Binary built and installed at: ${PACKAGE_BIN_PATH}`);
|
|
55
|
-
} else {
|
|
78
|
+
|
|
79
|
+
if (!fs.existsSync(sourceBinary)) {
|
|
56
80
|
throw new Error('Binary not found after build');
|
|
57
81
|
}
|
|
82
|
+
|
|
83
|
+
fs.mkdirSync(PREBUILT_DIR, { recursive: true });
|
|
84
|
+
fs.copyFileSync(sourceBinary, PACKAGE_BIN_PATH);
|
|
85
|
+
fs.chmodSync(PACKAGE_BIN_PATH, 0o755);
|
|
86
|
+
console.log(`✅ Binary built and installed at: ${PACKAGE_BIN_PATH}`);
|
|
58
87
|
} catch (error) {
|
|
59
88
|
console.error('❌ Build failed:', error.message);
|
|
60
89
|
console.error('\n📦 Please install Rust in Termux:');
|
|
@@ -63,14 +92,48 @@ if (hasValidElfPrebuilt(PACKAGE_BIN_PATH)) {
|
|
|
63
92
|
}
|
|
64
93
|
}
|
|
65
94
|
|
|
66
|
-
|
|
95
|
+
function ensureMasixHome() {
|
|
96
|
+
const masixDir = path.join(os.homedir(), '.masix');
|
|
97
|
+
if (!fs.existsSync(masixDir)) {
|
|
98
|
+
fs.mkdirSync(masixDir, { recursive: true });
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function installBundledPlugins() {
|
|
103
|
+
for (const plugin of BUNDLED_PLUGINS) {
|
|
104
|
+
if (!fs.existsSync(plugin.file)) {
|
|
105
|
+
throw new Error(`Bundled package missing: ${plugin.file}`);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const args = [
|
|
109
|
+
'plugin',
|
|
110
|
+
'install-file',
|
|
111
|
+
'--file',
|
|
112
|
+
plugin.file,
|
|
113
|
+
'--plugin',
|
|
114
|
+
plugin.plugin,
|
|
115
|
+
'--version',
|
|
116
|
+
plugin.version,
|
|
117
|
+
'--package-type',
|
|
118
|
+
plugin.packageType,
|
|
119
|
+
'--platform',
|
|
120
|
+
TERMUX_PLATFORM
|
|
121
|
+
];
|
|
122
|
+
|
|
123
|
+
if (plugin.adminOnly) {
|
|
124
|
+
args.push('--admin-only');
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
execFileSync(PACKAGE_BIN_PATH, args, { stdio: 'inherit' });
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
ensureBinary();
|
|
132
|
+
ensureMasixHome();
|
|
133
|
+
installBundledPlugins();
|
|
134
|
+
|
|
67
135
|
console.log('\n🎉 masix installed successfully!');
|
|
68
136
|
console.log(' Run "masix --help" to get started.');
|
|
69
137
|
console.log(' Run "masix config init" to create default config.');
|
|
70
|
-
console.log(' Run "masix check-update" to check for updates
|
|
71
|
-
|
|
72
|
-
// Create .masix directory if needed
|
|
73
|
-
const masixDir = path.join(require('os').homedir(), '.masix');
|
|
74
|
-
if (!fs.existsSync(masixDir)) {
|
|
75
|
-
fs.mkdirSync(masixDir, { recursive: true });
|
|
76
|
-
}
|
|
138
|
+
console.log(' Run "masix check-update" to check for updates.');
|
|
139
|
+
console.log(' Bundled plugin-base packages installed: discovery, codex-backend, codex-tools.\n');
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mmmbuto/masix",
|
|
3
|
-
"version": "0.4.
|
|
4
|
-
"description": "Termux-first MIT automation runtime (Telegram, MCP, Cron) with
|
|
3
|
+
"version": "0.4.1",
|
|
4
|
+
"description": "Termux-first MIT automation runtime (Telegram, MCP, Cron) with bundled plugin-base packages and in-core STT",
|
|
5
5
|
"main": "check-update.js",
|
|
6
6
|
"files": [
|
|
7
7
|
"README.md",
|
|
8
8
|
"install.js",
|
|
9
9
|
"check-update.js",
|
|
10
|
-
"prebuilt/"
|
|
10
|
+
"prebuilt/",
|
|
11
|
+
"packages/"
|
|
11
12
|
],
|
|
12
13
|
"bin": {
|
|
13
14
|
"masix": "prebuilt/masix",
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
3175ff8fc1e6336ea63d881b2a72d6660496656314c0ed8408c9168f3e67754d codex-backend-android-aarch64-termux.pkg
|
|
2
|
+
3175ff8fc1e6336ea63d881b2a72d6660496656314c0ed8408c9168f3e67754d codex-backend-linux-x86_64.pkg
|
|
3
|
+
3175ff8fc1e6336ea63d881b2a72d6660496656314c0ed8408c9168f3e67754d codex-backend-macos-aarch64.pkg
|
|
Binary file
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"plugin_id": "codex-backend",
|
|
3
|
+
"version": "0.1.4",
|
|
4
|
+
"visibility": "plugin-base",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"admin_only": true,
|
|
7
|
+
"package_type": "library",
|
|
8
|
+
"platforms": [
|
|
9
|
+
{
|
|
10
|
+
"id": "android-aarch64-termux",
|
|
11
|
+
"file": "codex-backend-android-aarch64-termux.pkg",
|
|
12
|
+
"sha256": "3175ff8fc1e6336ea63d881b2a72d6660496656314c0ed8408c9168f3e67754d"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"id": "linux-x86_64",
|
|
16
|
+
"file": "codex-backend-linux-x86_64.pkg",
|
|
17
|
+
"sha256": "3175ff8fc1e6336ea63d881b2a72d6660496656314c0ed8408c9168f3e67754d"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"id": "macos-aarch64",
|
|
21
|
+
"file": "codex-backend-macos-aarch64.pkg",
|
|
22
|
+
"sha256": "3175ff8fc1e6336ea63d881b2a72d6660496656314c0ed8408c9168f3e67754d"
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"install": {
|
|
26
|
+
"command": "masix plugin install-file --file <path-to-pkg> --plugin codex-backend --version 0.1.4 --package-type library --admin-only"
|
|
27
|
+
},
|
|
28
|
+
"notes": [
|
|
29
|
+
"Admin-only module. Non-admin users cannot call codex-backend tools.",
|
|
30
|
+
"Package usable without plugin server.",
|
|
31
|
+
"See docs/THIRD_PARTY_NOTICES.md for upstream Codex attribution."
|
|
32
|
+
]
|
|
33
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# codex-backend Package Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.4 - 2026-03-05
|
|
4
|
+
|
|
5
|
+
- Refreshed package artifacts for android-aarch64-termux, linux-x86_64, macos-aarch64.
|
|
6
|
+
- Added `packages/plugin-base/codex-backend/0.1.4/` with updated `manifest.json` and `SHA256SUMS`.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## 0.1.3 - 2026-03-02
|
|
10
|
+
|
|
11
|
+
- Added MIT package publication layout under `packages/plugin-base/codex-backend/0.1.3`.
|
|
12
|
+
- Included platform artifacts:
|
|
13
|
+
- `codex-backend-android-aarch64-termux.pkg`
|
|
14
|
+
- `codex-backend-linux-x86_64.pkg`
|
|
15
|
+
- `codex-backend-macos-aarch64.pkg`
|
|
16
|
+
- Added `manifest.json` with platform metadata and checksums.
|
|
17
|
+
- Added `SHA256SUMS` for manual integrity verification.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# codex-backend (`plugin-base`)
|
|
2
|
+
|
|
3
|
+
`codex-backend` provides the coding backend runtime used by `codex-tools`.
|
|
4
|
+
|
|
5
|
+
## What It Is
|
|
6
|
+
|
|
7
|
+
- Package type: `library`
|
|
8
|
+
- Visibility: `plugin-base`
|
|
9
|
+
- Admin-only: `true`
|
|
10
|
+
- Distribution: local `.pkg` install supported (`install-file`)
|
|
11
|
+
|
|
12
|
+
## Install Example
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
masix plugin install-file \
|
|
16
|
+
--file packages/plugin-base/codex-backend/0.1.4/codex-backend-linux-x86_64.pkg \
|
|
17
|
+
--plugin codex-backend \
|
|
18
|
+
--version 0.1.4 \
|
|
19
|
+
--package-type library \
|
|
20
|
+
--admin-only
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Then enable and restart:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
masix plugin enable codex-backend
|
|
27
|
+
masix restart
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Notes
|
|
31
|
+
|
|
32
|
+
- `codex-backend` is typically used together with `codex-tools`.
|
|
33
|
+
- Upstream attribution for Codex-derived behavior is documented in `docs/THIRD_PARTY_NOTICES.md`.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "masix-plugin-codex-backend"
|
|
3
|
+
version = "0.1.4"
|
|
4
|
+
edition.workspace = true
|
|
5
|
+
license.workspace = true
|
|
6
|
+
description = "Codex backend module for MasiX - OpenAI/Anthropic coding agent with admin policy enforcement"
|
|
7
|
+
|
|
8
|
+
[lib]
|
|
9
|
+
name = "masix_codex_backend"
|
|
10
|
+
path = "src/lib.rs"
|
|
11
|
+
|
|
12
|
+
[dependencies]
|
|
13
|
+
anyhow.workspace = true
|
|
14
|
+
async-trait.workspace = true
|
|
15
|
+
reqwest.workspace = true
|
|
16
|
+
serde.workspace = true
|
|
17
|
+
serde_json.workspace = true
|
|
18
|
+
sha2.workspace = true
|
|
19
|
+
thiserror.workspace = true
|
|
20
|
+
tokio.workspace = true
|
|
21
|
+
tracing.workspace = true
|
|
22
|
+
|
|
23
|
+
[dev-dependencies]
|
|
24
|
+
mockito = "1.7"
|
|
25
|
+
tokio-test = "0.4"
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
MasiX Codex Backend Plugin v0.1.2
|
|
2
|
+
==================================
|
|
3
|
+
|
|
4
|
+
This package contains the codex-backend module for MasiX.
|
|
5
|
+
|
|
6
|
+
INSTALLATION
|
|
7
|
+
------------
|
|
8
|
+
1. Extract to ~/.masix/plugins/codex-backend/
|
|
9
|
+
2. Run: masix plugin enable codex-backend
|
|
10
|
+
|
|
11
|
+
REQUIREMENTS
|
|
12
|
+
------------
|
|
13
|
+
- MasiX >= 0.3.0
|
|
14
|
+
- Admin privileges required for execution
|
|
15
|
+
|
|
16
|
+
PROVIDERS
|
|
17
|
+
---------
|
|
18
|
+
- OpenAI (gpt-4.1 default)
|
|
19
|
+
- Anthropic (claude-3-5-sonnet-latest default)
|
|
20
|
+
- OpenAI-compatible endpoints
|
|
21
|
+
|
|
22
|
+
FEATURES
|
|
23
|
+
--------
|
|
24
|
+
- HTTP backend with fallback routing
|
|
25
|
+
- Admin-only policy enforcement
|
|
26
|
+
- Bounded timeouts, logs, and output
|
|
27
|
+
- Safe path handling (no traversal, symlinks)
|
|
28
|
+
- Dry-run preview mode
|
|
29
|
+
|
|
30
|
+
CONFIGURATION
|
|
31
|
+
-------------
|
|
32
|
+
Set in ~/.masix/config.toml:
|
|
33
|
+
|
|
34
|
+
[plugins.codex-backend]
|
|
35
|
+
provider = "openai"
|
|
36
|
+
api_key = "sk-..."
|
|
37
|
+
base_url = "https://api.openai.com" # optional
|
|
38
|
+
model = "gpt-4.1" # optional
|
|
39
|
+
timeout_secs = 300
|
|
40
|
+
max_tokens = 4096
|
|
41
|
+
|
|
42
|
+
SECURITY
|
|
43
|
+
--------
|
|
44
|
+
- Admin-only execution enforced
|
|
45
|
+
- No path traversal allowed
|
|
46
|
+
- Symlink escapes blocked
|
|
47
|
+
- Output truncation prevents memory exhaustion
|
|
48
|
+
|
|
49
|
+
LICENSE
|
|
50
|
+
-------
|
|
51
|
+
MIT License - See LICENSE file
|
|
52
|
+
|
|
53
|
+
Copyright (c) 2026 Davide A. Guglielmi
|
|
54
|
+
Made in Italy
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "codex-backend",
|
|
3
|
+
"name": "Codex Backend",
|
|
4
|
+
"version": "0.1.4",
|
|
5
|
+
"visibility": "plugin-base",
|
|
6
|
+
"package_type": "library",
|
|
7
|
+
"entrypoint": "masix_codex_backend",
|
|
8
|
+
"provides": {
|
|
9
|
+
"trait": "CodingBackend",
|
|
10
|
+
"methods": [
|
|
11
|
+
"run",
|
|
12
|
+
"dry_run"
|
|
13
|
+
]
|
|
14
|
+
},
|
|
15
|
+
"admin_only": true,
|
|
16
|
+
"permissions": {
|
|
17
|
+
"required": [
|
|
18
|
+
"admin"
|
|
19
|
+
],
|
|
20
|
+
"description": "Codex backend requires admin privileges for file write operations and API access"
|
|
21
|
+
},
|
|
22
|
+
"platforms_supported": [
|
|
23
|
+
"linux-x86_64",
|
|
24
|
+
"android-aarch64-termux",
|
|
25
|
+
"macos-aarch64"
|
|
26
|
+
],
|
|
27
|
+
"platforms_tested": [
|
|
28
|
+
"linux-x86_64",
|
|
29
|
+
"android-aarch64-termux",
|
|
30
|
+
"macos-aarch64"
|
|
31
|
+
],
|
|
32
|
+
"platforms_planned": [
|
|
33
|
+
"linux-aarch64"
|
|
34
|
+
],
|
|
35
|
+
"config": {
|
|
36
|
+
"properties": {
|
|
37
|
+
"provider": {
|
|
38
|
+
"type": "string",
|
|
39
|
+
"enum": [
|
|
40
|
+
"openai",
|
|
41
|
+
"anthropic",
|
|
42
|
+
"openai-compatible"
|
|
43
|
+
],
|
|
44
|
+
"default": "openai"
|
|
45
|
+
},
|
|
46
|
+
"api_key": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"secret": true
|
|
49
|
+
},
|
|
50
|
+
"base_url": {
|
|
51
|
+
"type": "string"
|
|
52
|
+
},
|
|
53
|
+
"model": {
|
|
54
|
+
"type": "string"
|
|
55
|
+
},
|
|
56
|
+
"timeout_secs": {
|
|
57
|
+
"type": "integer",
|
|
58
|
+
"default": 300,
|
|
59
|
+
"minimum": 10,
|
|
60
|
+
"maximum": 3600
|
|
61
|
+
},
|
|
62
|
+
"max_tokens": {
|
|
63
|
+
"type": "integer",
|
|
64
|
+
"default": 4096,
|
|
65
|
+
"minimum": 1,
|
|
66
|
+
"maximum": 128000
|
|
67
|
+
},
|
|
68
|
+
"max_output_bytes": {
|
|
69
|
+
"type": "integer",
|
|
70
|
+
"default": 1048576,
|
|
71
|
+
"minimum": 1024
|
|
72
|
+
},
|
|
73
|
+
"max_log_bytes": {
|
|
74
|
+
"type": "integer",
|
|
75
|
+
"default": 65536,
|
|
76
|
+
"minimum": 1024
|
|
77
|
+
},
|
|
78
|
+
"legacy_fallback": {
|
|
79
|
+
"type": "boolean",
|
|
80
|
+
"default": false
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"required": [
|
|
84
|
+
"api_key"
|
|
85
|
+
]
|
|
86
|
+
},
|
|
87
|
+
"min_masix_version": "0.3.0",
|
|
88
|
+
"max_masix_version": "0.4.1",
|
|
89
|
+
"capabilities": [
|
|
90
|
+
"http_client",
|
|
91
|
+
"file_read",
|
|
92
|
+
"file_write"
|
|
93
|
+
],
|
|
94
|
+
"constraints": {
|
|
95
|
+
"max_concurrent_tasks": 1,
|
|
96
|
+
"requires_isolation": false,
|
|
97
|
+
"timeout_enforcement": "strict"
|
|
98
|
+
},
|
|
99
|
+
"tool_access": {
|
|
100
|
+
"default_required_role": "admin",
|
|
101
|
+
"per_tool_required_role": {}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
use std::time::Duration;
|
|
2
|
+
use thiserror::Error;
|
|
3
|
+
|
|
4
|
+
#[derive(Debug, Clone, Error)]
|
|
5
|
+
pub enum CodingError {
|
|
6
|
+
#[error("API key not configured")]
|
|
7
|
+
MissingApiKey,
|
|
8
|
+
|
|
9
|
+
#[error("Invalid provider type: {0}")]
|
|
10
|
+
InvalidProvider(String),
|
|
11
|
+
|
|
12
|
+
#[error("HTTP request failed: {0}")]
|
|
13
|
+
HttpError(String),
|
|
14
|
+
|
|
15
|
+
#[error("API error: {0}")]
|
|
16
|
+
ApiError(String),
|
|
17
|
+
|
|
18
|
+
#[error("Operation timed out after {0:?}")]
|
|
19
|
+
Timeout(Duration),
|
|
20
|
+
|
|
21
|
+
#[error("Invalid response: {0}")]
|
|
22
|
+
InvalidResponse(String),
|
|
23
|
+
|
|
24
|
+
#[error("Tool execution failed: {0}")]
|
|
25
|
+
ToolError(String),
|
|
26
|
+
|
|
27
|
+
#[error("IO error: {0}")]
|
|
28
|
+
IoError(String),
|
|
29
|
+
|
|
30
|
+
#[error("Max iterations exceeded ({0})")]
|
|
31
|
+
MaxIterationsExceeded(u32),
|
|
32
|
+
|
|
33
|
+
#[error("Output exceeded limit ({0} bytes)")]
|
|
34
|
+
OutputTooLarge(usize),
|
|
35
|
+
|
|
36
|
+
#[error("Path security violation: {0}")]
|
|
37
|
+
PathSecurityViolation(String),
|
|
38
|
+
|
|
39
|
+
#[error("Policy violation: {0}")]
|
|
40
|
+
PolicyError(String),
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
#[derive(Debug, Clone, PartialEq, serde::Serialize)]
|
|
44
|
+
pub enum ExitStatus {
|
|
45
|
+
Success,
|
|
46
|
+
Timeout,
|
|
47
|
+
Error(String),
|
|
48
|
+
MaxIterations,
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
impl std::fmt::Display for ExitStatus {
|
|
52
|
+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
53
|
+
match self {
|
|
54
|
+
ExitStatus::Success => write!(f, "success"),
|
|
55
|
+
ExitStatus::Timeout => write!(f, "timeout"),
|
|
56
|
+
ExitStatus::Error(msg) => write!(f, "error: {}", msg),
|
|
57
|
+
ExitStatus::MaxIterations => write!(f, "max_iterations"),
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|