Skip to main content Crate agent_doc Copy item path Source Expand description § Module: lib (agent_doc)§ Spec
Exposes the public API surface consumed by the CLI binary, FFI layer, and editor plugins.
Re-exports: component, crdt, debounce, ffi, frontmatter, merge, template.
Provides two boundary-ID utilities used across all write paths:
new_boundary_id() — 8-hex-char UUID v4 prefix (length controlled by BOUNDARY_ID_LEN).
new_boundary_id_with_summary(summary) — same ID optionally suffixed with a 3-word,
20-char-max slug derived from summary (format: a0cfeb34:boundary-fix).
format_boundary_marker(id) — renders the canonical HTML comment form
<!-- agent:boundary:<id> --> used in document component boundaries.
BOUNDARY_ID_LEN = 8 is a public constant; callers may read but should not override.
§ Agentic Contracts
All public symbols are safe to call from FFI consumers (JNA, napi-rs) via ffi module.
new_boundary_id is non-deterministic (UUID v4); callers must not rely on ordering.
new_boundary_id_with_summary(None) and new_boundary_id_with_summary(Some("")) both
return a plain 8-char ID with no suffix.
Slug derivation: lowercase, non-alphanumeric chars → -, collapse runs, take first 3 words,
truncate to 20 chars.
§ Evals
new_boundary_id_len: result is exactly BOUNDARY_ID_LEN chars of hex
new_boundary_id_with_summary_none: None summary → plain 8-char hex
new_boundary_id_with_summary_empty: Some("") → plain 8-char hex
new_boundary_id_with_summary_slug: Some("Boundary Fix") → "<id>:boundary-fix"
new_boundary_id_with_summary_truncate: long summary → slug capped at 20 chars
format_boundary_marker: "abc123" → "<!-- agent:boundary:abc123 -->"
component Module: component crdt Module: crdt debounce Module: debounce ffi Module: ffi frontmatter Module: frontmatter ipc_socket Socket-based IPC for editor plugin communication. merge Module: merge template Module: template BOUNDARY_ID_LEN Default number of hex characters for boundary IDs. format_boundary_marker Format a boundary marker comment. new_boundary_id Generate a new boundary ID (short hex string from UUID v4). new_boundary_id_with_summary Generate a boundary ID with an optional summary suffix.