Repository navigation
feat: add Kiro CLI adapter - #115
Conversation
|
Hi, thank you for your contribution, but this PR doesn't seem to resolve the integration. I'm not sure that it was tested or not. There is no such There are things that can give you hints to solve the integration:
Please make sure you test all the workflows, from agent list, agent send, agent open, and all the features work well with the new agent type (kiro) in the agent console. Thank you. |
|
You were right, it was not tested against a running Kiro and the path was wrong. Now reads 431 tests pass in |
|
@codeaholicguy thanks for the pointers, they were exactly what was needed. Pushed in 27ec937. The adapter now reads sessions from Tests cover the running-session mapping, the PID liveness check, malformed lock files, and the missing-transcript case. Ready for another look when you have time. |
|
@codeaholicguy before I port this onto the current adapter layout (main has moved far enough that it is a re-implementation, not a rebase): is a Kiro CLI adapter still something you want in ai-devkit? If yes, I will redo it against main with the lock-file session discovery you pointed me at and keep the diff to the adapter plus its tests. If the answer is no, or it is on hold, I would rather close this than leave it conflicting in your queue. |
|
@mvanhorn yes, if possible, please sync with the latest structure and update the PR, I will follow up after the PR is updated |
Detects running Kiro CLI agents by matching PIDs from ~/.kiro/sessions/cli/<session-id>.lock to the sibling metadata and transcript files, and exposes sessions through the standard adapter surface. Follows the GrokCliAdapter shape for process discovery: declares processNames and resolves against the shared AgentDetectionContext snapshot when one is supplied, so the manager scans processes once per refresh rather than per adapter. Registered alongside the other agents in the adapter index, the startable-agent registry, the CLI type filters and the docs.
27ec937 to
e0d90bf
Compare
|
Synced. The branch is now rebuilt on current main rather than trailing it, so the diff is just the Kiro adapter against today's structure. What changed in the port:
The Kiro suite is 12/12. Running the agent-manager suite before and after this change gives the same 224 pre-existing failures on main, with 13 more passing tests after, so this adds coverage without touching anything that was already red. |
|
|
||
| async detectAgents(context?: AgentDetectionContext): Promise<AgentInfo[]> { | ||
| const snapshot = context?.processes ?? (await captureProcessSnapshot(this.processNames)); | ||
| const relevant = filterByProcessNames(snapshot, this.processNames); |
There was a problem hiding this comment.
It reports non-Kiro Node processes as Kiro agents.
- The adapter watches every node process.
- isKiroExecutable then accepts a process if any word in its command line is kiro or kiro-cli, not just the program name.
- In the probe, all of these matched:
- node /usr/local/bin/ai-devkit agent start --type kiro
- node server.js --name kiro
- kiro-cli chat
- So running ai-devkit agent start --type kiro (or any command with a kiro argument) makes a fake "Kiro process running" agent appear. agent send could then target the wrong process.
There was a problem hiding this comment.
Each Kiro session runs as a chain of four processes. For example
55111 kiro-cli ← the adapter detects this one
└─55168 kiro-cli-chat chat
└─55198 bun … tui.js chat
└─55236 kiro-cli-chat acp ← the lock file holds this PID
The lock files:
9513a8c7-….lock {"pid":55236, …} → the acp process under 55111 (ttys007)
b511fa44-….lock {"pid":53216, …} → the acp process under 53123 (ttys001)
detectAgents needs the lock's PID to be one of the processes it collected. It only collects processes named kiro-cli, kiro or node, so kiro-cli-chat (55236, 53216) is never collected. Neither lock matches, and both kiro-cli processes fall through to the basic process-only agent: session ID pid- and no sessionFilePath.
The unit tests missed this because they write the lock with the same PID as the fake kiro-cli process. Real Kiro writes the PID of the acp process three levels down.
| function extractPaneProcessIds(value: unknown): Pick<HerdrAgentPane, "foregroundPids" | "shellPid"> { | ||
| function extractPaneProcessIds( | ||
| value: unknown, | ||
| ): Pick<HerdrAgentPane, "foregroundPids" | "shellPid"> { |
There was a problem hiding this comment.
unrelated formatting change
|
@mvanhorn This has 1 blocker, after it is fixed then it good to go. |
|
Thanks @codeaholicguy, all three addressed in 92778b8.
Heads up: the two capacity rendering tests in |
|
@mvanhorn please resolve all the conflict then it's good to go |
Resolve conflicts from the provider reorganization: take main's providers/grok path for GrokCliAdapter, keep the KiroAdapter export next to it, keep Kiro in the sessions help text using main's formatting, and expect 7 registered adapters in the channel test now that Kiro is included. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EzFUaXW84Y6LHzKysc5mTc
|
Merged main in (7525a2b) and resolved the conflicts. GrokCliAdapter now comes from the new providers/grok path, with the Kiro export next to it, and the channel test expects 7 adapters with Kiro registered. It's mergeable again, and the agent-manager and cli suites pass. KiroAdapter still lives in adapters/ rather than providers/kiro/. Happy to move it over to match the new layout if you'd like. |
Summary
Adds a Kiro CLI adapter to
agent-managerso AI DevKit can detect, list, start, and route messages to Kiro CLI sessions, the same way it already does for Claude Code, Codex, Copilot, Gemini CLI, OpenCode, and Pi.Why this matters
Closes the maintainer-declared work item in #109 ("Support Kiro CLI in agent-manager"). Kiro was the one requested coding agent not yet wired into the adapter layer, so
agent list,agent start --type kiro,agent sessions --type kiro, and the channel bridge had no way to reach it.Changes
KiroAdapter(packages/agent-manager/src/adapters/KiroAdapter.ts), mirroring the existingPiAdapter: process detection, PID-to-session tracker matching, defensive JSONL session parsing, conversation/listSessionssupport, and idle/waiting status. Reads sessions from~/.kiro/cli/sessionsand gracefully returns empty results when that directory is absent.AgentTypeunion with'kiro'and exportedKiroAdapterfromadapters/index.tsandagent-manager/src/index.ts.kiroin theAGENTSregistry (launch commandkiro-cli; process matcher accepts thekiro-cliorkirobasename) and added it toStartableAgentType.new KiroAdapter()in bothAgentManagerfactories (cli/src/commands/agent.tsandcli/src/services/channel/channel-runner.ts), added theKirodisplay label, extended the--typehelp text, and added'kiro'toVALID_AGENT_TYPES.Testing
KiroAdapter.test.ts(type identity,kiro-cli/kiroprocess matching with no false positives, session detection) — agent-manager suite: 435 passed.sessions.test.ts,agent.test.ts,channel.test.ts, andStartAgentPane.test.tsfor the new type/registration/cycle order — cli suite: 808 passed.nx run-many -t build -p agent-manager(swc +tsctypecheck) andnx run-many -t lint -p agent-manager cliboth clean.Fixes #109
AI was used for assistance.