@brimveyn/aimux 1.20.1 → 1.20.2

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.
Files changed (43) hide show
  1. package/README.md +9 -1
  2. package/package.json +1 -1
  3. package/skills/aimux-orchestrator/SKILL.md +39 -5
  4. package/skills/aimux-orchestrator/references/prompts.md +11 -0
  5. package/src/cli/client/workspace-resolver.ts +61 -8
  6. package/src/cli/commands/tab/await.ts +1 -1
  7. package/src/cli/commands/tab/close.ts +1 -1
  8. package/src/cli/commands/tab/create.ts +27 -3
  9. package/src/cli/commands/tab/focus.ts +1 -1
  10. package/src/cli/commands/tab/prompt-io.ts +6 -1
  11. package/src/cli/commands/tab/run.ts +10 -2
  12. package/src/cli/commands/tab/send.ts +12 -7
  13. package/src/cli/commands/tab/snapshot.ts +2 -1
  14. package/src/cli/commands/tab/tail.ts +1 -1
  15. package/src/cli/commands/tab/wait.ts +2 -1
  16. package/src/cli/commands/worker/await.ts +5 -4
  17. package/src/cli/commands/worker/doctor.ts +25 -1
  18. package/src/cli/commands/worker/list.ts +50 -8
  19. package/src/cli/commands/worker/prompt.ts +31 -6
  20. package/src/cli/commands/worker/run.ts +56 -10
  21. package/src/cli/commands/worker/shared.ts +312 -52
  22. package/src/cli/commands/worker/stop.ts +39 -10
  23. package/src/cli/commands/worker/submit.ts +40 -0
  24. package/src/cli/commands/workspace/close.ts +1 -1
  25. package/src/cli/commands/workspace/create.ts +2 -1
  26. package/src/cli/commands/workspace/switch.ts +1 -1
  27. package/src/cli/commands/worktree/create-core.ts +27 -7
  28. package/src/cli/commands/worktree/create.ts +18 -3
  29. package/src/cli/commands/worktree/remove.ts +3 -1
  30. package/src/cli/completion/entry.ts +181 -0
  31. package/src/cli/completion/install.ts +222 -0
  32. package/src/cli/completion/plan.ts +216 -0
  33. package/src/cli/completion/scripts.ts +147 -0
  34. package/src/cli/completion/sources.ts +74 -0
  35. package/src/cli/context.ts +15 -0
  36. package/src/cli/flags.ts +45 -2
  37. package/src/cli/index.ts +20 -10
  38. package/src/cli/output.ts +3 -0
  39. package/src/cli/registry.ts +2 -0
  40. package/src/doctor.ts +4 -0
  41. package/src/git/worktree.ts +15 -1
  42. package/src/index.tsx +35 -11
  43. package/src/platform/worktree-paths.ts +21 -1
@@ -6,17 +6,25 @@ import { DEFAULT_TIMEOUT_MS } from '../tab/await-turn'
6
6
  import { resolvePromptText } from '../tab/prompt-io'
7
7
  import {
8
8
  dispatchWorkerPrompt,
9
- resolveWorkerTab,
9
+ resolveWorkerTarget,
10
10
  workerEnvelope,
11
11
  workerOutcomeExitCode,
12
12
  workerView,
13
13
  } from './shared'
14
14
 
15
15
  export const workerPrompt: CliCommand = {
16
- args: [{ name: 'worker', required: true }, { name: 'text' }],
16
+ args: [
17
+ { complete: { kind: 'dynamic', source: 'worker' }, name: 'worker', required: true },
18
+ { complete: { kind: 'none' }, name: 'text' },
19
+ ],
17
20
  flags: [
18
21
  ...SHARED_FLAGS,
19
- { description: 'read the prompt from this file', kind: 'string', name: 'prompt-file' },
22
+ {
23
+ complete: { kind: 'file' },
24
+ description: 'read the prompt from this file',
25
+ kind: 'string',
26
+ name: 'prompt-file',
27
+ },
20
28
  { description: 'read the prompt from stdin', kind: 'boolean', name: 'stdin' },
21
29
  {
22
30
  description: 'return after prompt uptake instead of turn completion',
@@ -24,11 +32,23 @@ export const workerPrompt: CliCommand = {
24
32
  name: 'detach',
25
33
  },
26
34
  { description: 'overall turn cap in milliseconds', kind: 'number', name: 'timeout' },
35
+ {
36
+ description:
37
+ 'milliseconds to wait for the detached submit→working confirmation (default 15000)',
38
+ kind: 'number',
39
+ name: 'uptake-timeout',
40
+ },
41
+ {
42
+ description:
43
+ 'clear the composer (<C-u>) before writing, so text typed by a human in the UI cannot be concatenated onto this prompt',
44
+ kind: 'boolean',
45
+ name: 'replace',
46
+ },
27
47
  ],
28
48
  group: 'worker',
29
49
  run: async (ctx) => {
30
50
  const selector = ctx.args.positionals[0] ?? ''
31
- const tab = await resolveWorkerTab(ctx, selector)
51
+ const { tab, workspace } = await resolveWorkerTarget(ctx, selector)
32
52
  const promptFile =
33
53
  typeof ctx.args.flags['prompt-file'] === 'string' ? ctx.args.flags['prompt-file'] : undefined
34
54
  const text = await resolvePromptText(
@@ -36,12 +56,17 @@ export const workerPrompt: CliCommand = {
36
56
  ctx.args.flags.stdin === true,
37
57
  ctx.args.positionals[1]
38
58
  )
39
- const outcome = await dispatchWorkerPrompt(ctx, tab.id, text, {
59
+ const outcome = await dispatchWorkerPrompt(ctx, workspace, tab.id, text, {
40
60
  detach: ctx.args.flags.detach === true,
61
+ replace: ctx.args.flags.replace === true,
41
62
  timeoutMs:
42
63
  typeof ctx.args.flags.timeout === 'number' ? ctx.args.flags.timeout : DEFAULT_TIMEOUT_MS,
64
+ uptakeTimeoutMs:
65
+ typeof ctx.args.flags['uptake-timeout'] === 'number'
66
+ ? ctx.args.flags['uptake-timeout']
67
+ : undefined,
43
68
  })
44
- writeJson(workerEnvelope(workerView(ctx, tab), outcome))
69
+ writeJson(workerEnvelope(workspace, workerView(workspace, tab), outcome))
45
70
  return workerOutcomeExitCode(outcome)
46
71
  },
47
72
  summary: 'Prompt an existing named worker and await its outcome',
@@ -14,22 +14,39 @@ import {
14
14
  } from './shared'
15
15
 
16
16
  export const workerRun: CliCommand = {
17
- args: [{ name: 'text' }],
17
+ args: [{ complete: { kind: 'none' }, name: 'text' }],
18
18
  flags: [
19
19
  ...SHARED_FLAGS,
20
- { description: 'unique workspace-scoped worker name', kind: 'string', name: 'name' },
21
20
  {
21
+ complete: { kind: 'none' },
22
+ description: 'unique workspace-scoped worker name',
23
+ kind: 'string',
24
+ name: 'name',
25
+ },
26
+ {
27
+ complete: { kind: 'dynamic', source: 'assistant' },
22
28
  description: 'assistant id (claude, codex, opencode, ...)',
23
29
  kind: 'string',
24
30
  name: 'assistant',
25
31
  },
26
- { description: 'model passed through to the assistant', kind: 'string', name: 'model' },
27
32
  {
33
+ complete: { kind: 'none' },
34
+ description: 'model passed through to the assistant',
35
+ kind: 'string',
36
+ name: 'model',
37
+ },
38
+ {
39
+ complete: { kind: 'none' },
28
40
  description: 'reasoning effort passed through to the assistant',
29
41
  kind: 'string',
30
42
  name: 'effort',
31
43
  },
32
- { description: 'read the prompt from this file', kind: 'string', name: 'prompt-file' },
44
+ {
45
+ complete: { kind: 'file' },
46
+ description: 'read the prompt from this file',
47
+ kind: 'string',
48
+ name: 'prompt-file',
49
+ },
33
50
  { description: 'read the prompt from stdin', kind: 'boolean', name: 'stdin' },
34
51
  {
35
52
  description: 'return after prompt uptake instead of turn completion',
@@ -37,14 +54,31 @@ export const workerRun: CliCommand = {
37
54
  name: 'detach',
38
55
  },
39
56
  { description: 'overall turn cap in milliseconds', kind: 'number', name: 'timeout' },
40
- { description: 'co-locate in an existing worktree id', kind: 'string', name: 'worktree' },
57
+ {
58
+ description:
59
+ 'milliseconds to wait for the detached submit→working confirmation (default 15000)',
60
+ kind: 'number',
61
+ name: 'uptake-timeout',
62
+ },
63
+ {
64
+ complete: { kind: 'dynamic', source: 'worktree' },
65
+ description: 'co-locate in an existing worktree id',
66
+ kind: 'string',
67
+ name: 'worktree',
68
+ },
41
69
  {
42
70
  description: 'run in the workspace active worktree instead of creating one',
43
71
  kind: 'boolean',
44
72
  name: 'no-worktree',
45
73
  },
46
- { description: 'base ref for the fresh worktree (default HEAD)', kind: 'string', name: 'base' },
47
74
  {
75
+ complete: { kind: 'dynamic', source: 'git-ref' },
76
+ description: 'base ref for the fresh worktree (default HEAD)',
77
+ kind: 'string',
78
+ name: 'base',
79
+ },
80
+ {
81
+ complete: { kind: 'none' },
48
82
  description: 'branch for the fresh worktree (default aimux/<name>)',
49
83
  kind: 'string',
50
84
  name: 'branch',
@@ -69,6 +103,11 @@ export const workerRun: CliCommand = {
69
103
  ctx.args.flags.stdin === true,
70
104
  ctx.args.positionals[0]
71
105
  )
106
+ // Resolve the target workspace ONCE, up front, and use that record for
107
+ // every later step. The repo a worktree is cut from comes from this record,
108
+ // so an orchestrator that omits --workspace at least gets the resolved
109
+ // identity echoed back in the response instead of having to infer it.
110
+ const workspace = ctx.getWorkspace()
72
111
  const result = await createCliTab(ctx, {
73
112
  assistantId: assistant,
74
113
  base: typeof ctx.args.flags.base === 'string' ? ctx.args.flags.base : undefined,
@@ -80,16 +119,23 @@ export const workerRun: CliCommand = {
80
119
  workerName: name,
81
120
  worktreeId: worktree,
82
121
  })
83
- const tabs = await (await ctx.getDaemon()).listTabs(ctx.getWorkspace().id)
122
+ const tabs = await (await ctx.getDaemon()).listTabs(workspace.id)
84
123
  const tab = tabs.tabs.find((entry) => entry.id === result.tabId)
85
124
  if (!tab) throw new Error(`created worker disappeared: ${result.tabId}`)
86
- const worker = workerView(ctx, tab)
87
- const outcome = await dispatchWorkerPrompt(ctx, result.tabId, text, {
125
+ const worker = workerView(workspace, tab)
126
+ const outcome = await dispatchWorkerPrompt(ctx, workspace, result.tabId, text, {
127
+ // The tab was spawned microseconds ago: its assistant is still booting, so
128
+ // the prompt must not be written until the TUI is reading keystrokes.
129
+ awaitFirstPaint: true,
88
130
  detach: ctx.args.flags.detach === true,
89
131
  timeoutMs:
90
132
  typeof ctx.args.flags.timeout === 'number' ? ctx.args.flags.timeout : DEFAULT_TIMEOUT_MS,
133
+ uptakeTimeoutMs:
134
+ typeof ctx.args.flags['uptake-timeout'] === 'number'
135
+ ? ctx.args.flags['uptake-timeout']
136
+ : undefined,
91
137
  })
92
- writeJson(workerEnvelope(worker, outcome))
138
+ writeJson(workerEnvelope(workspace, worker, outcome))
93
139
  return workerOutcomeExitCode(outcome)
94
140
  },
95
141
  summary: 'Create a named worker, dispatch a prompt, and await its outcome',