Skip to content

feat: agent swarm#424

Open
kermanx wants to merge 71 commits into
mainfrom
xtr/agent-swarm-progress-ui
Open

feat: agent swarm#424
kermanx wants to merge 71 commits into
mainfrom
xtr/agent-swarm-progress-ui

Conversation

@kermanx
Copy link
Copy Markdown
Collaborator

@kermanx kermanx commented Jun 4, 2026

Related Issue

No linked issue. Problem explained below.

Problem

AgentSwarm work can launch many subagents at once, but the TUI did not have a dedicated command flow or live progress surface for tracking which agents are queued, running, suspended, completed, or failed.

What changed

  • Added template-based AgentSwarm launches with shared subagent type selection.
  • Added /swarm <task> and a kimi swarm-demo preview command for the TUI progress UI.
  • Added live AgentSwarm progress rendering above the input box, including suspended retry state when provider rate limits requeue subagents.
  • Added and updated tests for CLI options, slash command parsing, session event flow, subagent queue behavior, SDK event typing, and TUI progress rendering.
  • Updated user docs and changesets already present in this branch.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 4, 2026

🦋 Changeset detected

Latest commit: 1dc2a84

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@moonshot-ai/agent-core Minor
@moonshot-ai/kimi-code-sdk Minor
@moonshot-ai/kimi-code Minor
@moonshot-ai/acp-adapter Patch
@moonshot-ai/migration-legacy Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@kermanx kermanx changed the title feat: add AgentSwarm TUI support feat: agent swarm Jun 4, 2026
kermanx added 10 commits June 4, 2026 18:20
…ess-ui

# Conflicts:
#	apps/kimi-code/src/tui/controllers/session-event-handler.ts
#	apps/kimi-code/test/cli/options.test.ts
#	docs/en/reference/slash-commands.md
#	docs/zh/reference/slash-commands.md
@kermanx kermanx marked this pull request as ready for review June 6, 2026 07:44
@kermanx
Copy link
Copy Markdown
Collaborator Author

kermanx commented Jun 6, 2026

@codex

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jun 6, 2026

pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@1dc2a84
npx https://pkg.pr.new/@moonshot-ai/kimi-code@1dc2a84

commit: 1dc2a84

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dc029d586d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/agent-core/src/tools/builtin/collaboration/agent-swarm.ts Outdated
Comment thread packages/agent-core/src/tools/builtin/collaboration/agent-swarm.ts
Comment thread apps/kimi-code/src/tui/commands/swarm.ts
Comment thread apps/kimi-code/src/tui/components/messages/agent-swarm-progress.ts Outdated
Comment thread packages/agent-core/src/tools/builtin/collaboration/agent-swarm.ts
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b9dc203cae

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/agent-core/src/agent/turn/index.ts Outdated
Comment thread packages/node-sdk/src/rpc.ts
@kermanx
Copy link
Copy Markdown
Collaborator Author

kermanx commented Jun 6, 2026

@codex

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0d50b541a4

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +35 to +37
if (host.state.appState.permissionMode === 'manual') {
if (!(await activateSwarmForTask(host))) return;
showSwarmStartPermissionPrompt(host, prompt);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Defer swarm activation until the user confirms

In Manual mode, /swarm <prompt> enables task-triggered swarm mode before showing the permission prompt. If the user presses Esc (or the later Auto permission update fails), no prompt turn is sent, so the task-triggered mode never reaches the turn-end auto-exit path and the next normal user prompt unexpectedly runs in swarm mode. Consider moving activation until after a start choice is confirmed, or rolling it back on cancel/failure.

Useful? React with 👍 / 👎.

Comment on lines +260 to +262
const body = result.status === 'completed' ? (result.result ?? '') : (result.error ?? 'unknown error');
lines.push(
`<subagent${mode}${agentId}${item}${state} outcome="${result.status}">${body}</subagent>`,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Escape subagent result bodies before wrapping them

Subagent summaries/errors are arbitrary model text, but this wraps them directly inside <subagent>...</subagent>. When a subagent reports code or XML containing </subagent>, the new TUI parser stops at that first closing tag and truncates/misattributes the rest of the swarm result, which can hide failures or resume IDs from the parent/TUI. Escape the body (or use a non-ambiguous encoding) just like attributes are escaped.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant