fix(agent-term): guard edit_schedule targets_add/remove against empty arrays

Empty arrays are truthy in JS so 'if (input.targets_add)' would emit
'+0 tgt' for an explicit []. Add .length guard so zero-element lists
are silently skipped — consistent with fmtArgsGeneric's [N] handling.

The MCP schema defaults both fields to null, making this theoretical,
but the guard is cleaner.
This commit is contained in:
iris 2026-07-04 12:44:25 +02:00 committed by mara
commit 40bd868f65

View file

@ -1648,8 +1648,8 @@ window.marked = marked;
if (input.body != null) parts.push('body');
if (input.interval_seconds != null) parts.push('interval');
if (input.next_fire_at_unix != null) parts.push('next');
if (input.targets_add) parts.push('+' + input.targets_add.length + ' tgt');
if (input.targets_remove) parts.push('-' + input.targets_remove.length + ' tgt');
if (input.targets_add && input.targets_add.length) parts.push('+' + input.targets_add.length + ' tgt');
if (input.targets_remove && input.targets_remove.length) parts.push('-' + input.targets_remove.length + ' tgt');
return short + ' ' + parts.join(' · ');
}
case 'mcp__hyperhive__request_schedule_prompt': {