kcode-k1-chat-thread-web-code-open-targets 0.1.0

Pure Open presentation and target classification for K1 Chat Web-code
Documentation
# Open presentation and target classification

`kcode-k1-chat-thread-web-code-open-targets` is a pure leaf for presenting an opened `CodeDocument` and deciding whether a historical `ChatBox` is an original output of that Open.

## Presentation

`present_open` preserves the document's UTF-8 documentation and code bytes as strings. Message index 1 contains the complete `Documentation.md`. Every nonterminal code chunk follows as a Tool Message payload, and the final code chunk—including the single empty chunk for empty code—is the successful terminal result. `OpenLayout` records the originating call box, tool call ID, and total number of code chunks.

The returned `WebCodeOutput` uses `k1.web-code-open/v1` metadata with the supplied authority, name, and version, the document language, `documentation_message_index: 1`, `code_message_start: 2`, and the total `code_message_count`.

## Target classification

`classify_original_target` requires exactly one box with the requested ID.

- Correlated Tool Message index 1 is documentation.
- Correlated Tool Message indexes 2 through `code_message_count` are code.
- A correlated successful Tool Result v2 with `k1.web-code-open/v1` metadata is code.
- Missing, duplicate, malformed, foreign-Open, out-of-layout, failed, generic, and non-Open targets are rejected with a stable `TargetRejection` and code.

Classification validates correlation and payload kind only. It does not perform history I/O, assign box IDs, parse Open metadata JSON, authorize overwrites, mutate documents, persist state, or invoke tools. Callers own append ordering and must provide the authoritative complete history and the `OpenLayout` returned for the active Open.