mumucc 0.4.16 → 0.4.18
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mumucc",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.18",
|
|
4
4
|
"description": "Open-source AI coding assistant CLI with multi-model support (Anthropic, OpenAI/GPT, DeepSeek, GLM, Ollama, etc.), MCP integration, agent swarms, and out-of-the-box developer experience.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
package/shims/globals.ts
CHANGED
|
@@ -104,6 +104,51 @@ function buildProfileDescription(): string {
|
|
|
104
104
|
return `Optional profile override for this agent. Available profiles: ${profiles.map(profile => `'${profile.id}'`).join(', ')}.`
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
+
function getRecentUserMessagesText(
|
|
108
|
+
messages: MessageType[],
|
|
109
|
+
maxMessages = 4,
|
|
110
|
+
): string {
|
|
111
|
+
return messages
|
|
112
|
+
.filter((m): m is Extract<MessageType, { type: 'user' }> => m.type === 'user')
|
|
113
|
+
.slice(-maxMessages)
|
|
114
|
+
.map(m => {
|
|
115
|
+
const content = m.message.content
|
|
116
|
+
if (typeof content === 'string') {
|
|
117
|
+
return content
|
|
118
|
+
}
|
|
119
|
+
if (Array.isArray(content)) {
|
|
120
|
+
return extractTextContent(content, '\n')
|
|
121
|
+
}
|
|
122
|
+
return ''
|
|
123
|
+
})
|
|
124
|
+
.join('\n')
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function hasExplicitNoTeamRequest(text: string): boolean {
|
|
128
|
+
if (!text) return false
|
|
129
|
+
return (
|
|
130
|
+
/(不要|别|禁止|不允许|无需|不用).{0,8}(team|团队|swarm|teammate)/i.test(
|
|
131
|
+
text,
|
|
132
|
+
) ||
|
|
133
|
+
/(no|without)\s+(team|swarm)/i.test(text)
|
|
134
|
+
)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function hasExplicitTeamRequest(text: string): boolean {
|
|
138
|
+
if (!text) return false
|
|
139
|
+
return /(team|团队|swarm|teammate|团队模式|多代理编队|调度团队)/i.test(text)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function hasExplicitNoBackgroundRequest(text: string): boolean {
|
|
143
|
+
if (!text) return false
|
|
144
|
+
return (
|
|
145
|
+
/(不要|别|禁止|不允许|无需|不用).{0,8}(挂后台|后台|异步|background)/i.test(
|
|
146
|
+
text,
|
|
147
|
+
) ||
|
|
148
|
+
/(no|without)\s+background/i.test(text)
|
|
149
|
+
)
|
|
150
|
+
}
|
|
151
|
+
|
|
107
152
|
// Base input schema without multi-agent parameters
|
|
108
153
|
const baseInputSchema = lazySchema(() => z.object({
|
|
109
154
|
description: z.string().describe('A short (3-5 word) description of the task'),
|
|
@@ -282,19 +327,34 @@ export const AgentTool = buildTool({
|
|
|
282
327
|
// Get app state for permission mode and agent filtering
|
|
283
328
|
const appState = toolUseContext.getAppState();
|
|
284
329
|
const permissionMode = appState.toolPermissionContext.mode;
|
|
330
|
+
const recentUserText = getRecentUserMessagesText(toolUseContext.messages);
|
|
331
|
+
const noTeamRequested = hasExplicitNoTeamRequest(recentUserText);
|
|
332
|
+
const teamRequested = hasExplicitTeamRequest(recentUserText);
|
|
333
|
+
const noBackgroundRequested = hasExplicitNoBackgroundRequest(recentUserText);
|
|
285
334
|
// In-process teammates get a no-op setAppState; setAppStateForTasks
|
|
286
335
|
// reaches the root store so task registration/progress/kill stay visible.
|
|
287
336
|
const rootSetAppState = toolUseContext.setAppStateForTasks ?? toolUseContext.setAppState;
|
|
337
|
+
let effectiveRunInBackground = run_in_background;
|
|
338
|
+
let effectiveTeamName = team_name;
|
|
339
|
+
const teamModeAllowed = Boolean(appState.teamContext?.teamName) || (teamRequested && !noTeamRequested);
|
|
340
|
+
|
|
341
|
+
if (noBackgroundRequested) {
|
|
342
|
+
effectiveRunInBackground = false;
|
|
343
|
+
}
|
|
344
|
+
if (effectiveTeamName && !teamModeAllowed) {
|
|
345
|
+
logForDebugging(`[AgentTool] Ignoring team_name='${effectiveTeamName}' because team mode was not explicitly requested in recent user messages`);
|
|
346
|
+
effectiveTeamName = undefined;
|
|
347
|
+
}
|
|
288
348
|
|
|
289
349
|
// Check if user is trying to use agent teams without access
|
|
290
|
-
if (
|
|
350
|
+
if (effectiveTeamName && !isAgentSwarmsEnabled()) {
|
|
291
351
|
throw new Error('Agent Teams is not yet available on your plan.');
|
|
292
352
|
}
|
|
293
353
|
|
|
294
354
|
// Teammates (in-process or tmux) passing `name` would trigger spawnTeammate()
|
|
295
355
|
// below, but TeamFile.members is a flat array with one leadAgentId — nested
|
|
296
356
|
// teammates land in the roster with no provenance and confuse the lead.
|
|
297
|
-
const explicitTeamName =
|
|
357
|
+
const explicitTeamName = effectiveTeamName;
|
|
298
358
|
const teamName = explicitTeamName;
|
|
299
359
|
if (isTeammate() && teamName && name) {
|
|
300
360
|
throw new Error('Teammates cannot spawn other teammates — the team roster is flat. To spawn a subagent instead, omit the `name` parameter.');
|
|
@@ -302,7 +362,7 @@ export const AgentTool = buildTool({
|
|
|
302
362
|
// In-process teammates cannot spawn background agents (their lifecycle is
|
|
303
363
|
// tied to the leader's process). Tmux teammates are separate processes and
|
|
304
364
|
// can manage their own background agents.
|
|
305
|
-
if (isInProcessTeammate() && teamName &&
|
|
365
|
+
if (isInProcessTeammate() && teamName && effectiveRunInBackground === true) {
|
|
306
366
|
throw new Error('In-process teammates cannot spawn background agents. Use run_in_background=false for synchronous subagents.');
|
|
307
367
|
}
|
|
308
368
|
|
|
@@ -491,7 +551,7 @@ export const AgentTool = buildTool({
|
|
|
491
551
|
color: selectedAgent.color as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
|
|
492
552
|
is_built_in_agent: isBuiltInAgent(selectedAgent),
|
|
493
553
|
is_resume: false,
|
|
494
|
-
is_async: (
|
|
554
|
+
is_async: (effectiveRunInBackground === true || selectedAgent.background === true) && !isBackgroundTasksDisabled,
|
|
495
555
|
is_fork: isForkPath
|
|
496
556
|
});
|
|
497
557
|
|
|
@@ -594,7 +654,7 @@ export const AgentTool = buildTool({
|
|
|
594
654
|
agent_type: selectedAgent.agentType as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS
|
|
595
655
|
}),
|
|
596
656
|
scope: selectedAgent.memory as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
|
|
597
|
-
|
|
657
|
+
source: 'subagent' as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS
|
|
598
658
|
});
|
|
599
659
|
}
|
|
600
660
|
|
|
@@ -613,7 +673,7 @@ export const AgentTool = buildTool({
|
|
|
613
673
|
isBuiltInAgent: isBuiltInAgent(selectedAgent),
|
|
614
674
|
startTime,
|
|
615
675
|
agentType: selectedAgent.agentType,
|
|
616
|
-
isAsync: (
|
|
676
|
+
isAsync: (effectiveRunInBackground === true || selectedAgent.background === true) && !isBackgroundTasksDisabled
|
|
617
677
|
};
|
|
618
678
|
|
|
619
679
|
// Use inline env check instead of coordinatorModule to avoid circular
|
|
@@ -622,7 +682,7 @@ export const AgentTool = buildTool({
|
|
|
622
682
|
|
|
623
683
|
// Fork subagent experiment: force ALL spawns async for a unified
|
|
624
684
|
// <task-notification> interaction model (not just fork spawns — all of them).
|
|
625
|
-
const forceAsync = isForkSubagentEnabled();
|
|
685
|
+
const forceAsync = isForkPath && isForkSubagentEnabled();
|
|
626
686
|
|
|
627
687
|
// Assistant mode: force all agents async. Synchronous subagents hold the
|
|
628
688
|
// main loop's turn open until they complete — the daemon's inputQueue
|
|
@@ -632,7 +692,7 @@ export const AgentTool = buildTool({
|
|
|
632
692
|
// <task-notification> re-entry there is handled by the else branch
|
|
633
693
|
// below (registerAsyncAgentTask + notifyOnCompletion).
|
|
634
694
|
const assistantForceAsync = feature('KAIROS') ? appState.kairosEnabled : false;
|
|
635
|
-
const shouldRunAsync = (
|
|
695
|
+
const shouldRunAsync = (effectiveRunInBackground === true || selectedAgent.background === true || isCoordinator || forceAsync || assistantForceAsync || (proactiveModule?.isProactiveActive() ?? false)) && !isBackgroundTasksDisabled;
|
|
636
696
|
// Assemble the worker's tool pool independently of the parent's.
|
|
637
697
|
// Workers always get their tools from assembleToolPool with their own
|
|
638
698
|
// permission mode, so they aren't affected by the parent's tool
|
|
@@ -265,6 +265,8 @@ Usage notes:
|
|
|
265
265
|
: ''
|
|
266
266
|
}
|
|
267
267
|
- To continue a previously spawned agent, use ${SEND_MESSAGE_TOOL_NAME} with the agent's ID or name as the \`to\` field. The agent resumes with its full context preserved. ${forkEnabled ? 'Each fresh Agent invocation with a subagent_type starts without context — provide a complete task description.' : 'Each Agent invocation starts fresh — provide a complete task description.'}
|
|
268
|
+
- Do NOT use \`name\` or \`team_name\` unless the user explicitly asked for Team/team/swarm mode, or the current session is already inside a Team. For ordinary agent delegation, omit both fields.
|
|
269
|
+
- If the user explicitly says not to use Team mode or not to run in background, you must respect that and keep the agent as a normal foreground subagent.
|
|
268
270
|
- The agent's outputs should generally be trusted
|
|
269
271
|
- Clearly tell the agent whether you expect it to write code or just to do research (search, file reads, web fetches, etc.)${forkEnabled ? '' : ", since it is not aware of the user's intent"}
|
|
270
272
|
- If the agent description mentions that it should be used proactively, then you should try your best to use it without the user having to ask for it first. Use your judgement.
|
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
import { assignTeammateColor } from '../../utils/swarm/teammateLayoutManager.js'
|
|
27
27
|
import {
|
|
28
28
|
ensureTasksDir,
|
|
29
|
+
clearLeaderTeamName,
|
|
29
30
|
resetTaskList,
|
|
30
31
|
setLeaderTeamName,
|
|
31
32
|
} from '../../utils/tasks.js'
|
|
@@ -163,9 +164,19 @@ export const TeamCreateTool: Tool<InputSchema, Output> = buildTool({
|
|
|
163
164
|
const existingTeam = appState.teamContext?.teamName
|
|
164
165
|
|
|
165
166
|
if (existingTeam) {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
167
|
+
if (readTeamFile(existingTeam)) {
|
|
168
|
+
throw new Error(
|
|
169
|
+
`Already leading team "${existingTeam}". A leader can only manage one team at a time. Use TeamDelete to end the current team before creating a new one.`,
|
|
170
|
+
)
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Recover from a previously failed implicit spawn that populated
|
|
174
|
+
// AppState.teamContext before the team file was written.
|
|
175
|
+
clearLeaderTeamName()
|
|
176
|
+
setAppState(prev => ({
|
|
177
|
+
...prev,
|
|
178
|
+
teamContext: undefined,
|
|
179
|
+
}))
|
|
169
180
|
}
|
|
170
181
|
|
|
171
182
|
// If team already exists, generate a unique name instead of failing
|
|
@@ -24,7 +24,10 @@ import { getCwd } from '../../utils/cwd.js'
|
|
|
24
24
|
import { logForDebugging } from '../../utils/debug.js'
|
|
25
25
|
import { errorMessage } from '../../utils/errors.js'
|
|
26
26
|
import { execFileNoThrow } from '../../utils/execFileNoThrow.js'
|
|
27
|
-
import {
|
|
27
|
+
import {
|
|
28
|
+
getDefaultMainLoopModel,
|
|
29
|
+
parseUserSpecifiedModel,
|
|
30
|
+
} from '../../utils/model/model.js'
|
|
28
31
|
import type { PermissionMode } from '../../utils/permissions/PermissionMode.js'
|
|
29
32
|
import { isTmuxAvailable } from '../../utils/swarm/backends/detection.js'
|
|
30
33
|
import {
|
|
@@ -52,8 +55,11 @@ import {
|
|
|
52
55
|
import { buildInheritedEnvVars } from '../../utils/swarm/spawnUtils.js'
|
|
53
56
|
import {
|
|
54
57
|
readTeamFileAsync,
|
|
58
|
+
registerTeamForSessionCleanup,
|
|
55
59
|
sanitizeAgentName,
|
|
56
60
|
sanitizeName,
|
|
61
|
+
type TeamFile,
|
|
62
|
+
getTeamFilePath,
|
|
57
63
|
writeTeamFileAsync,
|
|
58
64
|
} from '../../utils/swarm/teamHelpers.js'
|
|
59
65
|
import {
|
|
@@ -66,6 +72,7 @@ import {
|
|
|
66
72
|
import { getHardcodedTeammateModelFallback } from '../../utils/swarm/teammateModel.js'
|
|
67
73
|
import { registerTask } from '../../utils/task/framework.js'
|
|
68
74
|
import { writeToMailbox } from '../../utils/teammateMailbox.js'
|
|
75
|
+
import { ensureTasksDir, resetTaskList, setLeaderTeamName } from '../../utils/tasks.js'
|
|
69
76
|
import type { CustomAgentDefinition } from '../AgentTool/loadAgentsDir.js'
|
|
70
77
|
import { isCustomAgent } from '../AgentTool/loadAgentsDir.js'
|
|
71
78
|
|
|
@@ -102,6 +109,64 @@ export function resolveTeammateModel(
|
|
|
102
109
|
return inputModel ?? getDefaultTeammateModel(leaderModel)
|
|
103
110
|
}
|
|
104
111
|
|
|
112
|
+
type EnsuredTeamContext = {
|
|
113
|
+
teamFile: TeamFile
|
|
114
|
+
teamFilePath: string
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
async function ensureTeamExistsForSpawn(
|
|
118
|
+
teamName: string,
|
|
119
|
+
context: ToolUseContext,
|
|
120
|
+
): Promise<EnsuredTeamContext> {
|
|
121
|
+
const existing = await readTeamFileAsync(teamName)
|
|
122
|
+
if (existing) {
|
|
123
|
+
return {
|
|
124
|
+
teamFile: existing,
|
|
125
|
+
teamFilePath: getTeamFilePath(teamName),
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const appState = context.getAppState()
|
|
130
|
+
const now = Date.now()
|
|
131
|
+
const leadAgentId = formatAgentId(TEAM_LEAD_NAME, teamName)
|
|
132
|
+
const leadModel = parseUserSpecifiedModel(
|
|
133
|
+
appState.mainLoopModelForSession ??
|
|
134
|
+
appState.mainLoopModel ??
|
|
135
|
+
getDefaultMainLoopModel(),
|
|
136
|
+
)
|
|
137
|
+
const taskListId = sanitizeName(teamName)
|
|
138
|
+
|
|
139
|
+
const teamFile: TeamFile = {
|
|
140
|
+
name: teamName,
|
|
141
|
+
createdAt: now,
|
|
142
|
+
leadAgentId,
|
|
143
|
+
leadSessionId: getSessionId(),
|
|
144
|
+
members: [
|
|
145
|
+
{
|
|
146
|
+
agentId: leadAgentId,
|
|
147
|
+
name: TEAM_LEAD_NAME,
|
|
148
|
+
agentType: TEAM_LEAD_NAME,
|
|
149
|
+
model: leadModel,
|
|
150
|
+
joinedAt: now,
|
|
151
|
+
tmuxPaneId: '',
|
|
152
|
+
cwd: getCwd(),
|
|
153
|
+
subscriptions: [],
|
|
154
|
+
},
|
|
155
|
+
],
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
await writeTeamFileAsync(teamName, teamFile)
|
|
159
|
+
registerTeamForSessionCleanup(teamName)
|
|
160
|
+
await resetTaskList(taskListId)
|
|
161
|
+
await ensureTasksDir(taskListId)
|
|
162
|
+
setLeaderTeamName(taskListId)
|
|
163
|
+
|
|
164
|
+
return {
|
|
165
|
+
teamFile,
|
|
166
|
+
teamFilePath: getTeamFilePath(teamName),
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
105
170
|
// ============================================================================
|
|
106
171
|
// Types
|
|
107
172
|
// ============================================================================
|
|
@@ -328,6 +393,8 @@ async function handleSpawnSplitPane(
|
|
|
328
393
|
)
|
|
329
394
|
}
|
|
330
395
|
|
|
396
|
+
const ensuredTeam = await ensureTeamExistsForSpawn(teamName, context)
|
|
397
|
+
|
|
331
398
|
// Generate unique name if duplicate exists in team
|
|
332
399
|
const uniqueName = await generateUniqueTeammateName(name, teamName)
|
|
333
400
|
|
|
@@ -450,14 +517,15 @@ async function handleSpawnSplitPane(
|
|
|
450
517
|
const windowName = insideTmux ? 'current' : 'swarm-view'
|
|
451
518
|
|
|
452
519
|
// Track the teammate in AppState's teamContext with color
|
|
453
|
-
// If spawning without spawnTeam, set up the leader as team lead
|
|
454
520
|
setAppState(prev => ({
|
|
455
521
|
...prev,
|
|
456
522
|
teamContext: {
|
|
457
523
|
...prev.teamContext,
|
|
458
|
-
teamName
|
|
459
|
-
teamFilePath:
|
|
460
|
-
|
|
524
|
+
teamName,
|
|
525
|
+
teamFilePath:
|
|
526
|
+
prev.teamContext?.teamFilePath || ensuredTeam.teamFilePath,
|
|
527
|
+
leadAgentId:
|
|
528
|
+
prev.teamContext?.leadAgentId || ensuredTeam.teamFile.leadAgentId,
|
|
461
529
|
teammates: {
|
|
462
530
|
...(prev.teamContext?.teammates || {}),
|
|
463
531
|
[teammateId]: {
|
|
@@ -488,12 +556,7 @@ async function handleSpawnSplitPane(
|
|
|
488
556
|
})
|
|
489
557
|
|
|
490
558
|
// Register agent in the team file
|
|
491
|
-
const teamFile =
|
|
492
|
-
if (!teamFile) {
|
|
493
|
-
throw new Error(
|
|
494
|
-
`Team "${teamName}" does not exist. Call spawnTeam first to create the team.`,
|
|
495
|
-
)
|
|
496
|
-
}
|
|
559
|
+
const teamFile = ensuredTeam.teamFile
|
|
497
560
|
teamFile.members.push({
|
|
498
561
|
agentId: teammateId,
|
|
499
562
|
name: sanitizedName,
|
|
@@ -568,6 +631,8 @@ async function handleSpawnSeparateWindow(
|
|
|
568
631
|
)
|
|
569
632
|
}
|
|
570
633
|
|
|
634
|
+
const ensuredTeam = await ensureTeamExistsForSpawn(teamName, context)
|
|
635
|
+
|
|
571
636
|
// Generate unique name if duplicate exists in team
|
|
572
637
|
const uniqueName = await generateUniqueTeammateName(name, teamName)
|
|
573
638
|
|
|
@@ -668,9 +733,11 @@ async function handleSpawnSeparateWindow(
|
|
|
668
733
|
...prev,
|
|
669
734
|
teamContext: {
|
|
670
735
|
...prev.teamContext,
|
|
671
|
-
teamName
|
|
672
|
-
teamFilePath:
|
|
673
|
-
|
|
736
|
+
teamName,
|
|
737
|
+
teamFilePath:
|
|
738
|
+
prev.teamContext?.teamFilePath || ensuredTeam.teamFilePath,
|
|
739
|
+
leadAgentId:
|
|
740
|
+
prev.teamContext?.leadAgentId || ensuredTeam.teamFile.leadAgentId,
|
|
674
741
|
teammates: {
|
|
675
742
|
...(prev.teamContext?.teammates || {}),
|
|
676
743
|
[teammateId]: {
|
|
@@ -702,12 +769,7 @@ async function handleSpawnSeparateWindow(
|
|
|
702
769
|
})
|
|
703
770
|
|
|
704
771
|
// Register agent in the team file
|
|
705
|
-
const teamFile =
|
|
706
|
-
if (!teamFile) {
|
|
707
|
-
throw new Error(
|
|
708
|
-
`Team "${teamName}" does not exist. Call spawnTeam first to create the team.`,
|
|
709
|
-
)
|
|
710
|
-
}
|
|
772
|
+
const teamFile = ensuredTeam.teamFile
|
|
711
773
|
teamFile.members.push({
|
|
712
774
|
agentId: teammateId,
|
|
713
775
|
name: sanitizedName,
|
|
@@ -863,6 +925,8 @@ async function handleSpawnInProcess(
|
|
|
863
925
|
)
|
|
864
926
|
}
|
|
865
927
|
|
|
928
|
+
const ensuredTeam = await ensureTeamExistsForSpawn(teamName, context)
|
|
929
|
+
|
|
866
930
|
// Generate unique name if duplicate exists in team
|
|
867
931
|
const uniqueName = await generateUniqueTeammateName(name, teamName)
|
|
868
932
|
|
|
@@ -940,39 +1004,22 @@ async function handleSpawnInProcess(
|
|
|
940
1004
|
}
|
|
941
1005
|
|
|
942
1006
|
// Track the teammate in AppState's teamContext
|
|
943
|
-
// Auto-register leader if spawning without prior spawnTeam call
|
|
944
1007
|
setAppState(prev => {
|
|
945
|
-
const
|
|
946
|
-
|
|
947
|
-
? formatAgentId(TEAM_LEAD_NAME, teamName)
|
|
948
|
-
: prev.teamContext!.leadAgentId
|
|
1008
|
+
const leadAgentId =
|
|
1009
|
+
prev.teamContext?.leadAgentId || ensuredTeam.teamFile.leadAgentId
|
|
949
1010
|
|
|
950
|
-
// Build teammates map, including leader if needed for inbox polling
|
|
951
1011
|
const existingTeammates = prev.teamContext?.teammates || {}
|
|
952
|
-
const leadEntry = needsLeaderSetup
|
|
953
|
-
? {
|
|
954
|
-
[leadAgentId]: {
|
|
955
|
-
name: TEAM_LEAD_NAME,
|
|
956
|
-
agentType: TEAM_LEAD_NAME,
|
|
957
|
-
color: assignTeammateColor(leadAgentId),
|
|
958
|
-
tmuxSessionName: 'in-process',
|
|
959
|
-
tmuxPaneId: 'leader',
|
|
960
|
-
cwd: getCwd(),
|
|
961
|
-
spawnedAt: Date.now(),
|
|
962
|
-
},
|
|
963
|
-
}
|
|
964
|
-
: {}
|
|
965
1012
|
|
|
966
1013
|
return {
|
|
967
1014
|
...prev,
|
|
968
1015
|
teamContext: {
|
|
969
1016
|
...prev.teamContext,
|
|
970
|
-
teamName
|
|
971
|
-
teamFilePath:
|
|
1017
|
+
teamName,
|
|
1018
|
+
teamFilePath:
|
|
1019
|
+
prev.teamContext?.teamFilePath || ensuredTeam.teamFilePath,
|
|
972
1020
|
leadAgentId,
|
|
973
1021
|
teammates: {
|
|
974
1022
|
...existingTeammates,
|
|
975
|
-
...leadEntry,
|
|
976
1023
|
[teammateId]: {
|
|
977
1024
|
name: sanitizedName,
|
|
978
1025
|
agentType: agent_type,
|
|
@@ -988,12 +1035,7 @@ async function handleSpawnInProcess(
|
|
|
988
1035
|
})
|
|
989
1036
|
|
|
990
1037
|
// Register agent in the team file
|
|
991
|
-
const teamFile =
|
|
992
|
-
if (!teamFile) {
|
|
993
|
-
throw new Error(
|
|
994
|
-
`Team "${teamName}" does not exist. Call spawnTeam first to create the team.`,
|
|
995
|
-
)
|
|
996
|
-
}
|
|
1038
|
+
const teamFile = ensuredTeam.teamFile
|
|
997
1039
|
teamFile.members.push({
|
|
998
1040
|
agentId: teammateId,
|
|
999
1041
|
name: sanitizedName,
|