@k1e1n04/mav 0.1.24 → 0.1.25
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 -0
- package/bin/mav.ts +31 -0
- package/dist/bin/mav.js +27 -0
- package/dist/bin/mav.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/src/agent.d.ts +8 -1
- package/dist/src/agent.js +16 -2
- package/dist/src/agent.js.map +1 -1
- package/dist/src/hook-injector.d.ts +22 -0
- package/dist/src/hook-injector.js +101 -0
- package/dist/src/hook-injector.js.map +1 -0
- package/dist/src/index.js +43 -15
- package/dist/src/index.js.map +1 -1
- package/dist/src/ipc-server.d.ts +13 -0
- package/dist/src/ipc-server.js +58 -0
- package/dist/src/ipc-server.js.map +1 -0
- package/dist/src/session-manager.d.ts +2 -1
- package/dist/src/session-manager.js +2 -2
- package/dist/src/session-manager.js.map +1 -1
- package/dist/src/ui/app.d.ts +1 -1
- package/dist/src/ui/app.js +2 -2
- package/dist/src/ui/app.js.map +1 -1
- package/dist/src/ui/overview.d.ts +2 -1
- package/dist/src/ui/overview.js +20 -3
- package/dist/src/ui/overview.js.map +1 -1
- package/package.json +1 -1
- package/src/agent.ts +22 -2
- package/src/hook-injector.ts +131 -0
- package/src/index.ts +49 -15
- package/src/ipc-server.ts +72 -0
- package/src/session-manager.ts +3 -2
- package/src/ui/app.ts +2 -1
- package/src/ui/overview.ts +21 -2
package/src/ui/app.ts
CHANGED
|
@@ -22,6 +22,7 @@ export class App {
|
|
|
22
22
|
statePath: string,
|
|
23
23
|
terminal = new TerminalUI(),
|
|
24
24
|
agentConfigs: AgentConfig[] = [],
|
|
25
|
+
socketPath?: string,
|
|
25
26
|
) {
|
|
26
27
|
this.manager = manager
|
|
27
28
|
this.statePath = statePath
|
|
@@ -31,7 +32,7 @@ export class App {
|
|
|
31
32
|
if (session) {
|
|
32
33
|
this.switchToDetail(session)
|
|
33
34
|
}
|
|
34
|
-
}, agentConfigs)
|
|
35
|
+
}, agentConfigs, socketPath)
|
|
35
36
|
this.detailUI = new DetailUI(terminal, () => {
|
|
36
37
|
if (this.mode === 'detail') {
|
|
37
38
|
this.switchToOverview()
|
package/src/ui/overview.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { SessionManager } from '../session-manager.js'
|
|
|
2
2
|
import type { AgentSession } from '../agent.js'
|
|
3
3
|
import type { AgentConfig } from '../config.js'
|
|
4
4
|
import { getAgentDefaults, resolveSessionArgs } from '../agent-launch.js'
|
|
5
|
+
import { buildHookArgs } from '../hook-injector.js'
|
|
5
6
|
import { completePath } from './path-completion.js'
|
|
6
7
|
import type { KeyInfo, TerminalUI } from './terminal.js'
|
|
7
8
|
|
|
@@ -39,6 +40,7 @@ export class OverviewUI {
|
|
|
39
40
|
private manager: SessionManager
|
|
40
41
|
private onSessionCreated?: (session: SessionManager['selectedSession']) => void
|
|
41
42
|
private agentConfigs: AgentConfig[]
|
|
43
|
+
private socketPath: string | undefined
|
|
42
44
|
private promptState: PromptState = null
|
|
43
45
|
private displaySessionIds: string[] = []
|
|
44
46
|
private visible = false
|
|
@@ -48,11 +50,13 @@ export class OverviewUI {
|
|
|
48
50
|
manager: SessionManager,
|
|
49
51
|
onSessionCreated?: (session: SessionManager['selectedSession']) => void,
|
|
50
52
|
agentConfigs: AgentConfig[] = [],
|
|
53
|
+
socketPath?: string,
|
|
51
54
|
) {
|
|
52
55
|
this.terminal = terminal
|
|
53
56
|
this.manager = manager
|
|
54
57
|
this.onSessionCreated = onSessionCreated
|
|
55
58
|
this.agentConfigs = agentConfigs
|
|
59
|
+
this.socketPath = socketPath
|
|
56
60
|
|
|
57
61
|
this.syncList()
|
|
58
62
|
|
|
@@ -275,12 +279,27 @@ export class OverviewUI {
|
|
|
275
279
|
...getAgentDefaults(agentType),
|
|
276
280
|
}
|
|
277
281
|
const { args, newSessionId } = resolveSessionArgs(agentType, defaults.args, undefined, false)
|
|
282
|
+
|
|
283
|
+
let hookedArgs = args
|
|
284
|
+
let hookFiles: string[] = []
|
|
285
|
+
if (this.socketPath) {
|
|
286
|
+
try {
|
|
287
|
+
const hookCmd = `mav report cwd "$(pwd)"`
|
|
288
|
+
const hookResult = buildHookArgs(agentType, args, hookCmd, { cwd })
|
|
289
|
+
hookedArgs = hookResult.args
|
|
290
|
+
hookFiles = hookResult.hookFiles
|
|
291
|
+
} catch {
|
|
292
|
+
// hook injection failed — start agent without hooks
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
const ipcContext = this.socketPath ? { socketPath: this.socketPath, hookFiles } : undefined
|
|
278
297
|
const session = this.manager.addSession({
|
|
279
298
|
type: agentType,
|
|
280
299
|
cmd: defaults.cmd,
|
|
281
|
-
args,
|
|
300
|
+
args: hookedArgs,
|
|
282
301
|
cwd,
|
|
283
|
-
}) as AgentSession & { sessionId?: string }
|
|
302
|
+
}, ipcContext) as AgentSession & { sessionId?: string }
|
|
284
303
|
session.baseArgs = defaults.args
|
|
285
304
|
if (newSessionId != null) {
|
|
286
305
|
session.sessionId = newSessionId
|