martty 0.3.0 → 0.3.1-beta.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/README.md +9 -9
- package/bin/martty.js +14 -34
- package/lib/spawn-tui.js +26 -19
- package/package.json +9 -3
- package/vendor/darwin-arm64/martty +0 -0
- package/vendor/darwin-x64/martty +0 -0
- package/vendor/linux-arm64/martty +0 -0
- package/vendor/linux-x64/martty +0 -0
- package/vendor/win32-x64/martty.exe +0 -0
package/README.md
CHANGED
|
@@ -272,16 +272,16 @@ credential, session, theme, and demo options.
|
|
|
272
272
|
|
|
273
273
|
## Supported platforms
|
|
274
274
|
|
|
275
|
-
| Node platform key |
|
|
275
|
+
| Node platform key | npm package |
|
|
276
276
|
|---|---|
|
|
277
|
-
| `darwin-arm64` |
|
|
278
|
-
| `darwin-x64` |
|
|
279
|
-
| `linux-x64` |
|
|
280
|
-
| `linux-arm64` |
|
|
281
|
-
| `win32-x64` |
|
|
282
|
-
|
|
283
|
-
If
|
|
284
|
-
|
|
277
|
+
| `darwin-arm64` | `@openma/martty-darwin-arm64` |
|
|
278
|
+
| `darwin-x64` | `@openma/martty-darwin-x64` |
|
|
279
|
+
| `linux-x64` | `@openma/martty-linux-x64` |
|
|
280
|
+
| `linux-arm64` | `@openma/martty-linux-arm64` |
|
|
281
|
+
| `win32-x64` | `@openma/martty-win32-x64` |
|
|
282
|
+
|
|
283
|
+
If launch reports a missing native package, reinstall with optional dependencies
|
|
284
|
+
enabled (`npm install --include=optional martty`) and check the table above.
|
|
285
285
|
|
|
286
286
|
## Uninstall
|
|
287
287
|
|
package/bin/martty.js
CHANGED
|
@@ -8,26 +8,10 @@ import { createInterface } from 'node:readline/promises'
|
|
|
8
8
|
import { resolveDependencyStack } from '../lib/agent.js'
|
|
9
9
|
import { bootClient, parseClientArgv, painterArgs, uiSettingsPath } from '../lib/boot.js'
|
|
10
10
|
import { runHarnessCommandAsync } from '../lib/harnesses.js'
|
|
11
|
+
import { nativeBinary } from '../lib/spawn-tui.js'
|
|
11
12
|
|
|
12
13
|
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
13
|
-
const platformKey = process.platform + '-' + process.arch
|
|
14
|
-
const vendorDir = path.join(__dirname, '..', 'vendor')
|
|
15
|
-
const binaryName = process.platform === 'win32' ? 'martty.exe' : 'martty'
|
|
16
|
-
const packaged = path.join(vendorDir, platformKey, binaryName)
|
|
17
14
|
const configuredBin = process.env.MARTTY_BIN || process.env.DSH_TUI_BIN
|
|
18
|
-
let binaryPath = packaged
|
|
19
|
-
if (typeof configuredBin === 'string' && configuredBin.length > 0) {
|
|
20
|
-
if (fs.existsSync(configuredBin)) {
|
|
21
|
-
binaryPath = configuredBin
|
|
22
|
-
} else {
|
|
23
|
-
// Never silently fall back: the user believes they are running their
|
|
24
|
-
// own build (devlocalinstall.sh has caught this confusion before).
|
|
25
|
-
console.error(
|
|
26
|
-
`martty: ${configuredBin} (from ${process.env.MARTTY_BIN ? 'MARTTY_BIN' : 'DSH_TUI_BIN'})`
|
|
27
|
-
+ ' does not exist — falling back to the bundled binary',
|
|
28
|
-
)
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
15
|
|
|
32
16
|
const argv = process.argv.slice(2)
|
|
33
17
|
const wantDemoSkin = argv.includes('--demo-skin')
|
|
@@ -109,23 +93,19 @@ if (!wantHelp && !wantVersion && !wantDemo && !wantDemoSkin) {
|
|
|
109
93
|
}
|
|
110
94
|
}
|
|
111
95
|
|
|
112
|
-
if (!fs.existsSync(
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
} else {
|
|
126
|
-
console.error('No platform binaries are bundled in this install.')
|
|
127
|
-
}
|
|
128
|
-
console.error('Hint: run scripts/build-npm.sh on this machine to build and package a native binary.')
|
|
96
|
+
if (configuredBin && !fs.existsSync(configuredBin)) {
|
|
97
|
+
// Never silently fall back: the user believes they are running their
|
|
98
|
+
// own build (devlocalinstall.sh has caught this confusion before).
|
|
99
|
+
console.error(
|
|
100
|
+
`martty: ${configuredBin} (from ${process.env.MARTTY_BIN ? 'MARTTY_BIN' : 'DSH_TUI_BIN'})`
|
|
101
|
+
+ ' does not exist — falling back to the installed native binary',
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
let binaryPath
|
|
105
|
+
try {
|
|
106
|
+
binaryPath = nativeBinary({ envBin: configuredBin && fs.existsSync(configuredBin) ? configuredBin : null })
|
|
107
|
+
} catch (error) {
|
|
108
|
+
console.error(`martty: ${error instanceof Error ? error.message : String(error)}`)
|
|
129
109
|
process.exit(1)
|
|
130
110
|
}
|
|
131
111
|
|
package/lib/spawn-tui.js
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import { spawn } from 'node:child_process'
|
|
9
9
|
import { randomBytes, timingSafeEqual } from 'node:crypto'
|
|
10
|
+
import { createRequire } from 'node:module'
|
|
10
11
|
import fs from 'node:fs'
|
|
11
12
|
import { createServer } from 'node:net'
|
|
12
13
|
import path from 'node:path'
|
|
@@ -15,8 +16,8 @@ import { fileURLToPath } from 'node:url'
|
|
|
15
16
|
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
16
17
|
|
|
17
18
|
/** Select the first existing native painter in development-to-release order. */
|
|
18
|
-
export function selectNativeBinary({ envBin, devBin, packagedBin }) {
|
|
19
|
-
for (const candidate of [envBin, devBin, packagedBin]) {
|
|
19
|
+
export function selectNativeBinary({ envBin, devBin, optionalBin, packagedBin }) {
|
|
20
|
+
for (const candidate of [envBin, devBin, optionalBin, packagedBin]) {
|
|
20
21
|
if (typeof candidate === 'string' && candidate.length > 0 && fs.existsSync(candidate)) {
|
|
21
22
|
return candidate
|
|
22
23
|
}
|
|
@@ -25,28 +26,34 @@ export function selectNativeBinary({ envBin, devBin, packagedBin }) {
|
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
/**
|
|
28
|
-
*
|
|
29
|
+
* Installed optional platform binary, or the local development binary.
|
|
29
30
|
* Honors `MARTTY_BIN`, with `DSH_TUI_BIN` as a compatibility fallback.
|
|
31
|
+
* @param {{ packageRoot?: string, platform?: string, arch?: string, envBin?: string | null, devBin?: string | null }} [options]
|
|
30
32
|
* @returns {string}
|
|
31
33
|
*/
|
|
32
|
-
export function nativeBinary() {
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const
|
|
34
|
+
export function nativeBinary(options = {}) {
|
|
35
|
+
const packageRoot = options.packageRoot ?? path.join(__dirname, '..')
|
|
36
|
+
const platform = options.platform ?? process.platform
|
|
37
|
+
const arch = options.arch ?? process.arch
|
|
38
|
+
const key = `${platform}-${arch}`
|
|
39
|
+
const exe = platform === 'win32' ? 'martty.exe' : 'martty'
|
|
40
|
+
const packageName = `@openma/martty-${key}`
|
|
41
|
+
const req = createRequire(path.join(packageRoot, 'package.json'))
|
|
42
|
+
let optionalBin
|
|
43
|
+
try { optionalBin = req.resolve(`${packageName}/bin/${exe}`) }
|
|
44
|
+
catch (error) {
|
|
45
|
+
if (error?.code !== 'MODULE_NOT_FOUND' && error?.code !== 'ERR_PACKAGE_PATH_NOT_EXPORTED') throw error
|
|
46
|
+
}
|
|
47
|
+
const envBin = options.envBin === undefined
|
|
48
|
+
? process.env.MARTTY_BIN || process.env.DSH_TUI_BIN : options.envBin
|
|
49
|
+
const devBin = options.devBin === undefined
|
|
50
|
+
? path.join(packageRoot, '..', 'target', 'debug', exe) : options.devBin
|
|
51
|
+
const packagedBin = path.join(packageRoot, 'vendor', key, exe)
|
|
52
|
+
const selected = selectNativeBinary({ envBin, devBin, optionalBin, packagedBin })
|
|
39
53
|
if (selected === undefined) {
|
|
40
|
-
let have = []
|
|
41
|
-
try {
|
|
42
|
-
have = fs.readdirSync(path.join(__dirname, '..', 'vendor'))
|
|
43
|
-
} catch {
|
|
44
|
-
// vendor dir missing entirely
|
|
45
|
-
}
|
|
46
54
|
throw new Error(
|
|
47
|
-
`
|
|
48
|
-
|
|
49
|
-
' rebuild the package on this machine with scripts/build-npm.sh',
|
|
55
|
+
`Martty native package ${packageName} is missing for ${key}; reinstall Martty with optional dependencies`
|
|
56
|
+
+ ' (npm install --include=optional). From source, build with scripts/build-npm.sh.',
|
|
50
57
|
)
|
|
51
58
|
}
|
|
52
59
|
return selected
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "martty",
|
|
3
|
-
"version": "0.3.0",
|
|
3
|
+
"version": "0.3.1-beta.0",
|
|
4
4
|
"description": "Terminal-native ACP client UI; Cordis client tree, any ACP agent",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -64,7 +64,6 @@
|
|
|
64
64
|
"lib",
|
|
65
65
|
"creator",
|
|
66
66
|
"skills/tui-plugin-development/SKILL.md",
|
|
67
|
-
"vendor",
|
|
68
67
|
"cordis.patch.yml",
|
|
69
68
|
"README.md",
|
|
70
69
|
"LICENSE"
|
|
@@ -95,5 +94,12 @@
|
|
|
95
94
|
"agent",
|
|
96
95
|
"acp",
|
|
97
96
|
"agent-client-protocol"
|
|
98
|
-
]
|
|
97
|
+
],
|
|
98
|
+
"optionalDependencies": {
|
|
99
|
+
"@openma/martty-darwin-arm64": "0.3.1-beta.0",
|
|
100
|
+
"@openma/martty-darwin-x64": "0.3.1-beta.0",
|
|
101
|
+
"@openma/martty-linux-x64": "0.3.1-beta.0",
|
|
102
|
+
"@openma/martty-linux-arm64": "0.3.1-beta.0",
|
|
103
|
+
"@openma/martty-win32-x64": "0.3.1-beta.0"
|
|
104
|
+
}
|
|
99
105
|
}
|
|
Binary file
|
package/vendor/darwin-x64/martty
DELETED
|
Binary file
|
|
Binary file
|
package/vendor/linux-x64/martty
DELETED
|
Binary file
|
|
Binary file
|