@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/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()
@@ -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