<!-- task=m-iop-agent-chronos-extraction-decoupling/09+08_remove_agent_ui_close plan=0 tag=REFACTOR -->

# Flutter Agent UI 제거와 decouple closure

## For the Implementing Agent

`CODE_REVIEW-cloud-G08.md`의 implementation-owned 섹션 작성은 필수다. encoded predecessor의 exact PASS를 확인하고 이 child 범위만 구현·검증한다. active pair를 유지해 review 준비 완료를 보고하며 finalization은 code-review agent만 수행한다. 차단되면 질문하거나 상태를 분류하지 말고 blocker, 실제 명령/출력, 재개 조건만 evidence 필드에 기록한다.

## Background

Flutter Agent rail/panel/dependencies와 active agent-ui 정의를 제거하고 전체 residual/clean-build audit로 S03 decouple을 닫는다.

## Roadmap Targets

- Milestone: `agent-roadmap/phase/automation-runtime-bridge/milestones/iop-agent-chronos-extraction-decoupling.md`
- Milestone link: [Milestone 문서](agent-roadmap/phase/automation-runtime-bridge/milestones/iop-agent-chronos-extraction-decoupling.md)
- Task ids:
  - `decouple`: standalone binary/host/workflow/state/client/config/proto/build/document surface 제거
- Completion mode: check-on-pass

## Analysis

### Files Read

- `agent-roadmap/phase/automation-runtime-bridge/milestones/iop-agent-chronos-extraction-decoupling.md`
- `agent-roadmap/sdd/automation-runtime-bridge/iop-agent-chronos-extraction-decoupling/SDD.md`
- `agent-task/m-iop-agent-chronos-extraction-decoupling/07+06_remove_go_surface/plan_cloud_G09_0.log`
- `apps/client/lib/client_home_page.dart`
- `packages/flutter/iop_console/lib/src/iop_agent_panel.dart`
- `agent-ui/definition/views/agent/index.md`
- `agent-ui/definition/components/agent-panel/index.md`

### SDD Criteria

- SDD `agent-roadmap/sdd/automation-runtime-bridge/iop-agent-chronos-extraction-decoupling/SDD.md`는 `[승인됨]`, 잠금 `해제` 상태다.
- Target은 Acceptance Scenario `S03`과 Milestone Task `decouple`; Evidence Map row는 removed-path/reference audit, UI/source surface 부재와 IOP clean build를 요구한다.
- 이 closure child는 Agent UI rail/source/tests와 agent-ui definitions를 동기화하고 surviving navigation, full residual scan, decoupling audit로 `decouple` 완료 evidence를 만든다.

### Verification Context

- Handoff는 없다. Milestone, 승인 SDD, 보존된 parent plan과 current Flutter/agent-ui sources를 읽었고 predecessor `08+07_cleanup_build_contract`의 exact PASS `complete.log`는 missing이다.
- gap은 Agent rail/source/test 제거와 agent-ui definition/code sync다. agent-ui router 절차와 existing Flutter tests를 함께 적용한다.
- 외부 서비스는 필요 없다. Confidence는 medium-high이며 UI definition validation과 full residual audit가 모두 PASS해야 한다.

### Test Coverage Gaps

- Agent rail absence와 surviving navigation은 기존 Flutter tests를 갱신해 검증한다.

### Symbol References

- IopAgentPanel, IopConsoleSection.agent, agent capability pack을 제거한다.

### Split Judgment

- 이 closure child만 decouple Roadmap Task를 닫는다.
- Predecessor `08`의 active/archived exact PASS `complete.log`는 missing이다. PASS evidence는 Flutter/agent-ui validation, removed-path/reference audit와 IOP clean build다.

### Scope Rationale

- generic package rename과 Node 중립화는 후속 retain-node children에 둔다.

### Final Routing

- `evaluation_mode=isolated-reassessment`, finalizer=`finalize-task-policy.sh`, mode=`pair`.
- Build closures 모두 true. Scores=`2,1,2,1,2`, grade=`G08`, base/route=`local-fit`, lane=`local`.
- Review closures 모두 true. Scores=`2,1,2,1,2`, route=`official-review`, lane=`cloud`, grade=`G08`.
- `large_indivisible_context=false`; positive loop risks=`boundary_contract` (1); `review_rework_count=0`; `evidence_integrity_failure=false`; capability gap 없음.
- Canonical files: `PLAN-local-G08.md`, `CODE_REVIEW-cloud-G08.md`.

## Dependencies and Execution Order

1. `08+07_cleanup_build_contract` must each have exactly one matching PASS `complete.log`; all are currently missing.
2. Resolve only those exact predecessor completion artifacts, then implement this child scope.

## Implementation Checklist

- [ ] Refuse to start until predecessor 08+07_cleanup_build_contract has an exact PASS complete.log.
- [ ] Remove the original Flutter Agent rail, panel, capability, dependency, test, and Docker surfaces.
- [ ] Archive Agent view/component definitions through update-agent-ui, validate the remaining graph, and preserve the console-shell milestone mapping.
- [ ] Run fresh Flutter, Go, residual, Chronos-import, and diff audits and record decoupling-audit.log.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.

### [REFACTOR-3] Flutter Agent surface와 agent-ui 정의 제거

**Problem**

`IopAgentPanel`과 rail enum/slot, `agent_shell` path dependency, capability pack, Docker copy가 standalone UI를 계속 노출한다.

```dart
// packages/flutter/iop_console/lib/src/iop_console_shell.dart:7-15,135
agent,
widget.agent ?? IopAgentPanel(...)
```

**Solution**

Agent enum/rail/slot/default panel과 capability-only contract를 제거하고 surviving console sections를 유지한다. direct/path dependencies와 Docker copy를 제거하고 lockfile을 재생성한다. `update-agent-ui`로 Agent view/component를 exact archive log로 이동하고 indexes를 정리하며 console-shell은 Milestone pending `계획` 상태를 유지한다. `validate-agent-ui` PASS 후 code changes를 검증한다.

```dart
// after
enum IopConsoleSection { overview, edges, nodes, runtime, executionLogs, maintenance, settings }
```

**Modified Files and Checklist**

- [ ] Update/delete every REFACTOR-3 path in Modified Files Summary.
- [ ] Do not manually edit `agent-ui/.sync-state.json`; preserve its milestone pending mapping.

**Test Strategy**

- Agent rail absence와 remaining rail navigation을 Flutter widget test로 갱신한다.
- `make client-test`와 `make client-build-web`을 실행한다.

**Verification**

- `make client-test`
- `make client-build-web`
- `test -z "$(rg --sort path -n 'IopAgentPanel|IopConsoleSection\.agent|agent_shell|iopDefaultCapabilityPack|IopCapabilityPack' apps/client packages/flutter/iop_console agent-ui/definition --glob '!agent-ui/definition/archive/**')"`

### [REFACTOR-4] 삭제 completeness와 clean build 증거

**Problem**

대규모 삭제 뒤 manifest 외 잔존 참조, Chronos import, generated drift를 한 audit로 닫아야 한다.

```text
# SDD.md:88
removed-path/reference audit + IOP clean build
```

**Solution**

fresh full tests와 deterministic residual scan의 실제 output을 `decoupling-audit.log`에 저장한다. generic old-path exception은 exact 두 prefix로 제한하고 다음 task owner를 함께 기록한다.

```text
# after: decoupling-audit.log
remove_residuals=0
chronos_imports=0
generic_exceptions=packages/go/agentruntime,packages/go/agentprovider/cli
```

**Modified Files and Checklist**

- [ ] `agent-task/m-iop-agent-chronos-extraction-decoupling/09+08_remove_agent_ui_close/decoupling-audit.log` — exact command/output and exception list.
- [ ] `agent-task/m-iop-agent-chronos-extraction-decoupling/09+08_remove_agent_ui_close/CODE_REVIEW-cloud-G08.md` — actual evidence.

**Test Strategy**

- `go test -count=1 ./...` fresh full suite, Flutter tests/build, proto/tidy idempotency를 사용한다.

**Verification**

- `go test -count=1 ./...`
- `test -z "$(rg --sort path -n 'git\.toki-labs\.com/toki/chronos|/config/workspace/chronos' apps packages cmd proto configs)"`
- `git diff --check`

## Modified Files Summary

| File | Item |
|------|------|
| `apps/client/Dockerfile` | REFACTOR-3 |
| `apps/client/README.md` | REFACTOR-3 |
| `apps/client/lib/client_home_page.dart` | REFACTOR-3 |
| `apps/client/lib/main.dart` | REFACTOR-3 |
| `apps/client/pubspec.yaml` | REFACTOR-3 |
| `apps/client/pubspec.lock` | REFACTOR-3 |
| `packages/flutter/iop_console/lib/src/iop_agent_panel.dart` | REFACTOR-3 |
| `packages/flutter/iop_console/lib/src/iop_console_contract.dart` | REFACTOR-3 |
| `packages/flutter/iop_console/lib/src/iop_console_shell.dart` | REFACTOR-3 |
| `packages/flutter/iop_console/pubspec.yaml` | REFACTOR-3 |
| `packages/flutter/iop_console/test/iop_console_shell_test.dart` | REFACTOR-3 |
| `agent-ui/definition/index.md` | REFACTOR-3 |
| `agent-ui/definition/views/index.md` | REFACTOR-3 |
| `agent-ui/definition/views/agent/index.md` | REFACTOR-3 |
| `agent-ui/definition/components/index.md` | REFACTOR-3 |
| `agent-ui/definition/components/agent-panel/index.md` | REFACTOR-3 |
| `agent-ui/definition/components/console-shell/index.md` | REFACTOR-3 |
| `agent-ui/definition/archive/views/agent/index.log` | REFACTOR-3 |
| `agent-ui/definition/archive/components/agent-panel/index.log` | REFACTOR-3 |
| `agent-task/m-iop-agent-chronos-extraction-decoupling/09+08_remove_agent_ui_close/decoupling-audit.log` | REFACTOR-4 |
| `agent-task/m-iop-agent-chronos-extraction-decoupling/09+08_remove_agent_ui_close/CODE_REVIEW-cloud-G08.md` | REFACTOR-4 |

## Final Verification

1. Confirm exact PASS `complete.log` for `08+07_cleanup_build_contract`.
2. `make client-test`
3. `make client-build-web`
4. `test -z "$(rg --sort path -n 'IopAgentPanel|IopConsoleSection\.agent|agent_shell|iopDefaultCapabilityPack|IopCapabilityPack' apps/client packages/flutter/iop_console agent-ui/definition --glob '!agent-ui/definition/archive/**')"`
5. `go test -count=1 ./...`
6. `test -z "$(rg --sort path -n 'git\.toki-labs\.com/toki/chronos|/config/workspace/chronos' apps packages cmd proto configs)"`
7. `git diff --check`

Commands containing `go test -count=1` require fresh output; all other checks are rerun against the current checkout.

After completing all code changes, fill implementation-owned sections in `CODE_REVIEW-*-G??.md`.
