- 상태을(를) 신규에서 해결(으)로 변경되었습니다.
0.8-4 DKernelTaskService skeleton + dshai thin client 구현 완료¶
commit:server2|92f3a91
Phase 0.8 네 번째 슬라이스 마감. dKernel 이 dshai 명령 표면의 authoritative execution surface 가 되었고, dshai 는 thin client 로 축소.
Wire surface¶
DKernelTaskService.Execute(session_id, command, args_json bytes, request_id) → (result_json bytes). opaque JSON in/out — 14 command allowlist (dfs.* 8 + vega.* 6).
Server-side dispatcher (internal/dkernel/)¶
-
dispatcher.go: guardSessionPrincipal + 14-command allowlist routing
-
dfs_commands.go: 8 dFS 명령 — args decode + DfsHandler RPC method 직접 호출 (ConnectRPC self-call X) + dshcore JSON shape 로 일관 직렬화
-
vega_commands.go: 6 Vega 명령 — 같은 패턴, DeltaHandler
-
handler.go: DKernelTaskHandler 가 dispatcher 경유
Permission boundary 보존¶
- AuthInterceptor 는 여전히 유일 permission gate
- dispatcher 의 session check 는 추가 검증 (JWT 이후)
- cross-principal session_id 재사용 = PermissionDenied
- missing/revoked/expired 는 advisory (audit interceptor 의 session_status 로 관찰)
- enforcement 는 dKernel governance 슬라이스에서
dshai thin client 화¶
dispatch() 가 ~270 줄의 typed switch 에서 한 줄의 client.ExecuteTask(...) forward 로 축소. handleLine 이 json.RawMessage(result_json) 으로 envelope embed — 이중 encoding 없음. command allowlist / args validation / base64 decode 모두 server-side.
변경하지 않은 항목¶
- AgentSessionService 는 dshai 직접 호출 유지 (라이프사이클 control plane; Execute 경유는 순환일)
- session 강제 (revoked/expired 거절) 는 advisory 유지 — 0.9+ 슬라이스
- apismoke + 모바일 SDK 는 DfsService/DeltaService 직접 호출 유지 (dshai envelope 못 말함)
테스트¶
internal/dkernel/dispatcher_test.go (신규):
- TestExecuteRejectsEmptySessionID
- TestRouteCommandRejectsUnknownCommand
- TestRouteCommandAllowlistShape (14 sub-case — list drift 자동 감지)
- TestExecuteRejectsAnonymousSession
cmd/dshai/main_test.go slim:
- 제거: args-level case (unknown command / dfs.write content / base64 / copy src+dst / malformed args) — server 위임
- 유지: envelope parsing, malformed JSON, missing command
go test ./sdk ./internal/dshcore ./internal/server \
./internal/store ./internal/handler ./internal/dkernel \
./cmd/dshai ./cmd/dsh ./cmd/sdktest — all clean
go vet ./... — clean
go build ./... — clean
docs/phase-0.8/decisions/2026-05-20-dkernel-task.md 신규 ADR. decision-log.md index 에 row 추가. 이전 3개 ADR 파일 (signer / command-audit / agent-session) 도 같은 commit 으로 올라감.