Skip to content

Commit 2a447b5

Browse files
ersinkocclaude
andcommitted
🐛 fix(ui): remove remaining background agent references from autonomous hub
Fixes API error on autonomous page load — stale references to deleted background-agent types in templates, preview cards, AI chat creator, and app.test.ts mock were causing type errors and 404 API calls. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 3567b15 commit 2a447b5

6 files changed

Lines changed: 23 additions & 96 deletions

File tree

packages/gateway/src/app.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ vi.mock('./routes/index.js', async (importOriginal) => {
8585
cliToolsRoutes: createMockRoutes(),
8686
cliChatRoutes: createMockRoutes(),
8787
securityRoutes: createMockRoutes(),
88-
backgroundAgentsRoutes: createMockRoutes(),
8988
subagentRoutes: createMockRoutes(),
9089
bridgeRoutes: createMockRoutes(),
9190
orchestraRoutes: createMockRoutes(),

packages/ui/src/pages/autonomous/components/AIChatCreator.tsx

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -81,22 +81,13 @@ function extractAgentConfig(content: string): ProposedAgentConfig | null {
8181
return null;
8282
}
8383

84-
// Validate kind
85-
const kind = parsed.kind === 'background' ? 'background' : 'soul';
84+
// All agents are soul agents now (background agents deprecated in favor of Claw)
85+
const kind = 'soul' as const;
8686

8787
// Validate autonomy level (1-4)
8888
let autonomyLevel = typeof parsed.autonomyLevel === 'number' ? parsed.autonomyLevel : 2;
8989
autonomyLevel = Math.max(1, Math.min(4, autonomyLevel));
9090

91-
// Validate background agent fields
92-
let bgMode: 'continuous' | 'interval' | 'event' | undefined;
93-
let bgIntervalMs: number | undefined;
94-
if (kind === 'background') {
95-
const validModes = ['continuous', 'interval', 'event'];
96-
bgMode = validModes.includes(parsed.bgMode) ? parsed.bgMode : 'interval';
97-
bgIntervalMs = typeof parsed.bgIntervalMs === 'number' ? parsed.bgIntervalMs : 300000; // 5 min default
98-
}
99-
10091
// Validate provider/model (use defaults if missing)
10192
const provider = parsed.provider || 'openai';
10293
const model = parsed.model || 'gpt-4o';
@@ -114,8 +105,6 @@ function extractAgentConfig(content: string): ProposedAgentConfig | null {
114105
heartbeatEnabled: kind === 'soul' ? parsed.heartbeatEnabled !== false : false,
115106
autonomyLevel,
116107
estimatedCost: parsed.estimatedCost || '~$0.50/day',
117-
bgMode,
118-
bgIntervalMs,
119108
provider,
120109
model,
121110
};
@@ -193,25 +182,21 @@ When you have enough information, output a COMPLETE JSON configuration block in
193182
## Field Requirements
194183
195184
### Required Fields (MUST include):
196-
- **kind**: "soul" for scheduled agents, "background" for workers
185+
- **kind**: "soul" (always use "soul")
197186
- **name**: Short, memorable, unique name (2-4 words max)
198187
- **emoji**: Single relevant emoji representing the agent
199188
- **role**: Professional role title (e.g., "Research Analyst", "Security Monitor")
200189
- **personality**: 1-2 sentences describing communication style, tone, approach
201190
- **mission**: 2-3 sentences describing what the agent does, when, and how
202191
- **tools**: Array of tool names (use "core." prefix for built-in tools)
203192
- **skills**: Array of skill IDs from the INSTALLED SKILLS list below (use exact IDs)
204-
- **heartbeatInterval**: Valid cron expression for soul agents (omit for background/event agents)
193+
- **heartbeatInterval**: Valid cron expression for soul agents
205194
- **heartbeatEnabled**: boolean (true for soul agents with schedules)
206195
- **autonomyLevel**: 1-4 (1=ask permission, 2=notify, 3=log only, 4=full autonomy)
207196
- **estimatedCost**: Daily cost estimate (e.g., "~$0.50/day", "~$2-5/day")
208197
- **provider**: AI provider ID (use "${defaults.provider}")
209198
- **model**: AI model ID (use "${defaults.model}")
210199
211-
### Background Agent Fields (when kind="background"):
212-
- **bgMode**: "continuous" | "interval" | "event"
213-
- **bgIntervalMs**: number (milliseconds between runs, for interval mode)
214-
215200
### Tool Selection Guidelines:
216201
Commonly useful tools:
217202
- "core.search_web" - for web research
@@ -501,12 +486,6 @@ export function AIChatCreator({ onCreated, onClose }: Props) {
501486
if (!config.mission?.trim()) errors.push('Mission is required');
502487
if (!config.role?.trim()) errors.push('Role is required');
503488
if (!config.personality?.trim()) errors.push('Personality is required');
504-
if (config.kind === 'background') {
505-
const validModes = ['continuous', 'interval', 'event'];
506-
if (!validModes.includes(config.bgMode || '')) {
507-
errors.push('Background agent mode must be: continuous, interval, or event');
508-
}
509-
}
510489
return errors;
511490
};
512491

packages/ui/src/pages/autonomous/components/AgentPreviewCard.tsx

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Bot, Repeat, Cpu, Puzzle } from '../../../components/icons';
77
import { cronToHuman } from '../helpers';
88

99
export interface ProposedAgentConfig {
10-
kind: 'soul' | 'background';
10+
kind: 'soul';
1111
name: string;
1212
emoji: string;
1313
role: string;
@@ -19,8 +19,6 @@ export interface ProposedAgentConfig {
1919
heartbeatEnabled?: boolean;
2020
autonomyLevel?: number;
2121
estimatedCost?: string;
22-
bgMode?: 'continuous' | 'interval' | 'event';
23-
bgIntervalMs?: number;
2422
provider?: string;
2523
model?: string;
2624
}
@@ -33,16 +31,9 @@ interface Props {
3331
}
3432

3533
export function AgentPreviewCard({ config, onConfirm, confirmLabel, isCreating }: Props) {
36-
const schedule =
37-
config.kind === 'soul' && config.heartbeatInterval
38-
? cronToHuman(config.heartbeatInterval)
39-
: config.kind === 'background' && config.bgMode === 'interval' && config.bgIntervalMs
40-
? `Every ${Math.round(config.bgIntervalMs / 60_000)} min`
41-
: config.kind === 'background' && config.bgMode === 'event'
42-
? 'On demand'
43-
: config.kind === 'background' && config.bgMode === 'continuous'
44-
? 'Continuous'
45-
: null;
34+
const schedule = config.heartbeatInterval
35+
? cronToHuman(config.heartbeatInterval)
36+
: null;
4637

4738
return (
4839
<div className="border border-primary/30 bg-primary/5 rounded-xl p-4 space-y-3">
@@ -55,13 +46,9 @@ export function AgentPreviewCard({ config, onConfirm, confirmLabel, isCreating }
5546
{config.name}
5647
</h4>
5748
<span
58-
className={`text-xs px-2 py-0.5 rounded-full shrink-0 ${
59-
config.kind === 'soul'
60-
? 'bg-primary/10 text-primary'
61-
: 'bg-text-muted/10 text-text-muted dark:text-dark-text-muted'
62-
}`}
49+
className="text-xs px-2 py-0.5 rounded-full shrink-0 bg-primary/10 text-primary"
6350
>
64-
{config.kind === 'soul' ? 'Soul Agent' : 'Background'}
51+
Soul Agent
6552
</span>
6653
</div>
6754
<p className="text-xs text-text-muted dark:text-dark-text-muted">{config.role}</p>

packages/ui/src/pages/autonomous/components/HelpPanel.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ export function HelpPanel({ onClose }: Props) {
6565
<div className="flex items-center gap-2 mb-2">
6666
<Zap className="w-4 h-4 text-text-muted dark:text-dark-text-muted" />
6767
<h4 className="font-medium text-text-primary dark:text-dark-text-primary">
68-
Background Agents
68+
Claw Agents
6969
</h4>
7070
</div>
7171
<p className="text-xs text-text-muted dark:text-dark-text-muted">
72-
Lightweight workers that run continuously, on intervals, or on demand. Great for
73-
monitoring, data processing, or event-driven tasks.
72+
Autonomous agents with workspace, directives, and audit trail. Run continuously,
73+
on intervals, event-driven, or single-shot. Use Fleet for multi-worker coordination.
7474
</p>
7575
</div>
7676
</section>

packages/ui/src/pages/autonomous/components/TemplateCatalog.tsx

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,8 @@ export function TemplateCatalog({ onSelect, crewTemplates, onDeployCrew }: Props
111111
<h4 className="font-medium text-sm text-text-primary dark:text-dark-text-primary truncate">
112112
{template.name}
113113
</h4>
114-
<span
115-
className={`text-xs px-1.5 py-0.5 rounded-full ${
116-
template.kind === 'soul'
117-
? 'bg-primary/10 text-primary'
118-
: 'bg-text-muted/10 text-text-muted dark:text-dark-text-muted'
119-
}`}
120-
>
121-
{template.kind === 'soul' ? 'Soul' : 'Background'}
114+
<span className="text-xs px-1.5 py-0.5 rounded-full bg-primary/10 text-primary">
115+
Soul
122116
</span>
123117
</div>
124118
</div>
@@ -134,11 +128,7 @@ export function TemplateCatalog({ onSelect, crewTemplates, onDeployCrew }: Props
134128
<span>
135129
{template.heartbeatInterval
136130
? cronToHuman(template.heartbeatInterval)
137-
: template.bgMode === 'event'
138-
? 'On demand'
139-
: template.bgMode === 'interval' && template.bgIntervalMs
140-
? `Every ${Math.round(template.bgIntervalMs / 60_000)}m`
141-
: 'Continuous'}
131+
: 'On demand'}
142132
</span>
143133
<span>{template.estimatedCost}</span>
144134
</div>

packages/ui/src/pages/autonomous/data/agent-templates.ts

Lines changed: 7 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ export interface AgentTemplate {
3030
heartbeatInterval: string;
3131
autonomyLevel: number;
3232
estimatedCost: string;
33-
kind: 'soul' | 'background';
34-
bgMode?: 'continuous' | 'interval' | 'event';
35-
bgIntervalMs?: number;
33+
kind: 'soul';
3634
tags: string[];
3735
/** Default provider for this agent */
3836
provider?: string;
@@ -210,8 +208,7 @@ export const AGENT_TEMPLATES: AgentTemplate[] = [
210208
heartbeatInterval: '',
211209
autonomyLevel: 2,
212210
estimatedCost: '$0.10-$0.50/use',
213-
kind: 'background',
214-
bgMode: 'event',
211+
kind: 'soul',
215212
tags: ['research', 'papers', 'academic'],
216213
},
217214
{
@@ -285,8 +282,7 @@ export const AGENT_TEMPLATES: AgentTemplate[] = [
285282
heartbeatInterval: '',
286283
autonomyLevel: 1,
287284
estimatedCost: '$0.10-$0.30/use',
288-
kind: 'background',
289-
bgMode: 'event',
285+
kind: 'soul',
290286
tags: ['blog', 'writing', 'content'],
291287
},
292288
{
@@ -336,8 +332,7 @@ export const AGENT_TEMPLATES: AgentTemplate[] = [
336332
heartbeatInterval: '',
337333
autonomyLevel: 2,
338334
estimatedCost: '$0.10-$0.50/review',
339-
kind: 'background',
340-
bgMode: 'event',
335+
kind: 'soul',
341336
tags: ['code-review', 'github', 'quality'],
342337
},
343338
{
@@ -385,8 +380,7 @@ export const AGENT_TEMPLATES: AgentTemplate[] = [
385380
heartbeatInterval: '',
386381
autonomyLevel: 2,
387382
estimatedCost: '$0.05-$0.20/bug',
388-
kind: 'background',
389-
bgMode: 'event',
383+
kind: 'soul',
390384
tags: ['bugs', 'triage', 'quality'],
391385
},
392386

@@ -412,8 +406,7 @@ export const AGENT_TEMPLATES: AgentTemplate[] = [
412406
heartbeatInterval: '',
413407
autonomyLevel: 1,
414408
estimatedCost: '$0.10-$0.30/meeting',
415-
kind: 'background',
416-
bgMode: 'event',
409+
kind: 'soul',
417410
tags: ['meetings', 'notes', 'action-items'],
418411
},
419412
{
@@ -463,9 +456,7 @@ export const AGENT_TEMPLATES: AgentTemplate[] = [
463456
heartbeatInterval: '',
464457
autonomyLevel: 3,
465458
estimatedCost: '$1-$5/day',
466-
kind: 'background',
467-
bgMode: 'interval',
468-
bgIntervalMs: 900_000,
459+
kind: 'soul',
469460
tags: ['uptime', 'monitoring', 'alerts'],
470461
},
471462
{
@@ -554,22 +545,3 @@ export function templateToSoulPayload(template: AgentTemplate, defaults: { provi
554545
};
555546
}
556547

557-
export function templateToBgPayload(template: AgentTemplate, defaults: { provider: string; model: string }): Record<string, unknown> {
558-
return {
559-
name: template.name,
560-
mission: template.mission,
561-
mode: template.bgMode || 'interval',
562-
allowed_tools: template.tools || [],
563-
interval_ms: template.bgIntervalMs || 300_000,
564-
auto_start: false,
565-
limits: {
566-
maxTurnsPerCycle: 10,
567-
maxToolCallsPerCycle: 50,
568-
maxCyclesPerHour: 60,
569-
cycleTimeoutMs: 120_000,
570-
},
571-
provider: template.provider || defaults.provider,
572-
model: template.model || defaults.model,
573-
skills: template.skills || [],
574-
};
575-
}

0 commit comments

Comments
 (0)