feat(agents): add kiro adapter#135
Conversation
Greptile SummaryAdds the Kiro (AWS) agent adapter, following the same structure as the existing copilot and goose adapters: a
Confidence Score: 4/5Safe to merge after addressing the nil-map panic in hooks.go; all other paths are straightforward additions that follow established patterns. The backend/internal/adapters/agent/kiro/hooks.go — specifically the Important Files Changed
Sequence DiagramsequenceDiagram
participant AO as AO Daemon
participant Plugin as kiro.Plugin
participant FS as .kiro/agents/ao.json
participant CLI as kiro-cli
AO->>Plugin: GetAgentHooks(cfg)
Plugin->>FS: readKiroHooks (preserve unmanaged keys)
FS-->>Plugin: topLevel + rawHooks
Plugin->>Plugin: merge kiroManagedHooks (deduplicate)
Plugin->>FS: writeKiroHooks (atomic temp+rename)
AO->>Plugin: GetLaunchCommand(cfg)
Plugin->>Plugin: kiroBinary() [cached resolve]
Plugin-->>AO: [kiro-cli, chat, --no-interactive, (trust flags), --, prompt]
AO->>CLI: exec
CLI->>AO: hook: ao hooks kiro session-start
AO->>AO: DeriveActivityState("session-start") → Active
CLI->>AO: hook: ao hooks kiro permission-request
AO->>AO: DeriveActivityState("permission-request") → WaitingInput
CLI->>AO: hook: ao hooks kiro stop
AO->>AO: DeriveActivityState("stop") → Idle
AO->>Plugin: GetRestoreCommand(cfg)
Plugin-->>AO: [kiro-cli, chat, --no-interactive, --resume-id, id, (trust flags)]
Reviews (2): Last reviewed commit: "feat(agents): add kiro adapter" | Re-trigger Greptile |
Registers the kiro harness, stacked on the agent platform. Includes its own activity deriver. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
| if err := json.Unmarshal(data, &topLevel); err != nil { | ||
| return nil, nil, fmt.Errorf("parse %s: %w", hooksPath, err) | ||
| } |
There was a problem hiding this comment.
readKiroHooks can return a nil topLevel map when the ao.json file contains the literal JSON value null. json.Unmarshal([]byte("null"), &topLevel) succeeds in Go but silently sets topLevel to nil. A subsequent call to GetAgentHooks — which adds entries to rawHooks and then reaches topLevel["hooks"] = hooksJSON in writeKiroHooks — will panic with "assignment to entry in nil map". This can be triggered by any tool (including a failed earlier write) that leaves the config file as bare null.
| if err := json.Unmarshal(data, &topLevel); err != nil { | |
| return nil, nil, fmt.Errorf("parse %s: %w", hooksPath, err) | |
| } | |
| if err := json.Unmarshal(data, &topLevel); err != nil { | |
| return nil, nil, fmt.Errorf("parse %s: %w", hooksPath, err) | |
| } | |
| if topLevel == nil { | |
| topLevel = map[string]json.RawMessage{} | |
| } |
Adds the kiro harness, stacked on #119 (agent platform). Adapter package +
Constructors()registration + resolver test. Includes its own activity deriver.🤖 Generated with Claude Code
Stack