martty 0.2.28-beta.0 → 0.2.29
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/lib/acp-client.js
CHANGED
|
@@ -80,12 +80,31 @@ export function apply(ctx, config = {}) {
|
|
|
80
80
|
provide(ctx, liveAgent)
|
|
81
81
|
return
|
|
82
82
|
}
|
|
83
|
+
// Replacing the agent: the previous child must not outlive its spec.
|
|
84
|
+
if (liveAgent !== null && liveAgent.child.exitCode === null) {
|
|
85
|
+
try {
|
|
86
|
+
liveAgent.child.kill('SIGTERM')
|
|
87
|
+
} catch {
|
|
88
|
+
// already gone
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
liveAgent = null
|
|
83
92
|
const child = spawn(agent.command, agent.args ?? [], {
|
|
84
93
|
stdio: ['pipe', 'pipe', 'inherit'],
|
|
85
94
|
env: { ...process.env, ...(agent.env ?? {}) },
|
|
86
95
|
})
|
|
87
96
|
child.stdin.on('error', () => {})
|
|
88
97
|
child.stdout.on('error', () => {})
|
|
98
|
+
child.on('error', (err) => {
|
|
99
|
+
// A failed spawn (ENOENT, EACCES) emits 'error' on the child; without a
|
|
100
|
+
// listener it is an uncaught exception. Surface EOF to the transport
|
|
101
|
+
// instead so pending requests fail instead of hanging, and drop the
|
|
102
|
+
// cached handle so the next apply() retries the spawn.
|
|
103
|
+
console.error(`acp-client: failed to spawn agent ${agent.command}: ${err.message}`)
|
|
104
|
+
if (liveAgent?.child === child) liveAgent = null
|
|
105
|
+
child.stdin.destroy()
|
|
106
|
+
child.stdout.destroy()
|
|
107
|
+
})
|
|
89
108
|
const service = {
|
|
90
109
|
kind: 'spawn',
|
|
91
110
|
command: agent.command,
|
package/lib/boot.js
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Boot-time restore of a statically-registered gallery palette (ayu,
|
|
3
|
+
* iceberg, …). `/theme` persistence writes `settings.theme`; dynamic
|
|
4
|
+
* packs are restored by tui-local-plugins (they have an owner), but the
|
|
5
|
+
* builtin gallery registers with no owner, so nothing would re-activate
|
|
6
|
+
* the saved pick on the next launch. Runs after every static theme
|
|
7
|
+
* Plugin is registered; `activate` notifies the painter (or queues until
|
|
8
|
+
* `bindNotify` flushes). A broken or unknown id must not block boot.
|
|
9
|
+
*/
|
|
10
|
+
export function restorePreferredTheme(tuiTheme) {
|
|
11
|
+
const preferred = tuiTheme?.preferred?.()
|
|
12
|
+
if (typeof preferred !== 'string' || preferred === 'default') return
|
|
13
|
+
if (tuiTheme?.owner?.(preferred) !== undefined) return
|
|
14
|
+
if (!tuiTheme?.isLoaded?.(preferred)) return
|
|
15
|
+
try {
|
|
16
|
+
tuiTheme.activate(preferred)
|
|
17
|
+
} catch {
|
|
18
|
+
// a broken pack must not block TUI startup
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
1
22
|
/**
|
|
2
23
|
* Cordis client boot: tuiTheme + tuiSlots + acp-client + TUI shell.
|
|
3
24
|
*
|
|
@@ -65,6 +86,7 @@ export async function bootClient(options = {}) {
|
|
|
65
86
|
await ctx.plugin({ name: 'tui-theme-everforest', inject: everforestInject, apply: applyEverforest })
|
|
66
87
|
await ctx.plugin({ name: 'tui-theme-iceberg', inject: icebergInject, apply: applyIceberg })
|
|
67
88
|
await ctx.plugin({ name: 'tui-theme-solarized', inject: solarizedInject, apply: applySolarized })
|
|
89
|
+
restorePreferredTheme(ctx.get('tuiTheme'))
|
|
68
90
|
await ctx.plugin({ name: 'tui-slots', inject: [], apply: applySlots })
|
|
69
91
|
await ctx.plugin({ name: 'tui-commands', inject: [], apply: applyCommands })
|
|
70
92
|
await ctx.plugin({ name: 'tui-overlay', inject: [], apply: applyOverlay })
|
|
@@ -122,6 +144,7 @@ export async function bootClient(options = {}) {
|
|
|
122
144
|
applyEverforest(ctx)
|
|
123
145
|
applyIceberg(ctx)
|
|
124
146
|
applySolarized(ctx)
|
|
147
|
+
restorePreferredTheme(ctx.tuiTheme)
|
|
125
148
|
applySlots(ctx)
|
|
126
149
|
applyCommands(ctx)
|
|
127
150
|
applyOverlay(ctx)
|
package/package.json
CHANGED
|
Binary file
|
package/vendor/darwin-x64/martty
CHANGED
|
Binary file
|
|
Binary file
|
package/vendor/linux-x64/martty
CHANGED
|
Binary file
|
|
Binary file
|