pub enum Dialect {
Claude,
Qwen,
Gemini,
Copilot,
Cursor,
OpenCode,
Codex,
Antigravity,
}Expand description
Which agent CLI’s hook protocol to speak.
Variants§
Implementations§
Source§impl Dialect
impl Dialect
Sourcepub fn from_agent(s: &str) -> Option<Self>
pub fn from_agent(s: &str) -> Option<Self>
Map an --agent value to a dialect. Accepts the CLI’s stable id.
Sourcepub fn agent_id(self) -> &'static str
pub fn agent_id(self) -> &'static str
The agent tag stamped onto the kintsugi_core::ProposedCommand so the
log and TUI attribute the command to the right CLI.
Sourcepub fn parse(self, input: &str) -> Parsed
pub fn parse(self, input: &str) -> Parsed
Parse one CLI’s hook payload into a normalized command.
Sourcepub fn parse_content(self, input: &str) -> Option<ContentCall>
pub fn parse_content(self, input: &str) -> Option<ContentCall>
Extract a non-shell content-tool call for provenance observation, if this
payload is one. Tolerant: returns None (rather than erroring) for shell
tools, unparseable input, or dialects that only ever carry shell commands
(Cursor / OpenCode). Observation never blocks, so a miss is harmless.
Sourcepub fn parse_write(self, input: &str) -> Option<WriteCall>
pub fn parse_write(self, input: &str) -> Option<WriteCall>
Extract a file-write call from a payload delivered on the explicit
--event write route (the generated OpenCode plugin, or a Cursor write
matcher). Tolerant like [parse_content]: None for a non-write payload,
unparseable input, an unknown tool name, or a dialect with no pinned write
surface. Observation never blocks, so a miss is harmless.
Every shape parsed here traces to a pinned fixture in tests/fixtures/:
Cursor cursor-write.json, cursor-str-replace.json,
cursor-after-file-edit.json; OpenCode opencode-write-v1.json,
opencode-write-v2.json. This is deliberately separate from
[parse_content]: that surface feeds the ingest classifier, and
emitting a call there for a Cursor payload would claim a Read/WebFetch arg
shape no fixture pins.
Sourcepub fn parse_post(self, input: &str) -> Option<PostToolCall>
pub fn parse_post(self, input: &str) -> Option<PostToolCall>
Extract a completed tool call from a PostToolUse-style payload, for
V1.1 result-content observation. Tolerant in the same way as
[parse_content]: returns None for unparseable input, missing
identity/response fields, or a dialect with no pinned post surface —
observation never blocks, so a miss is harmless. Every shape parsed
here traces to a pinned fixture in tests/fixtures/ (the 0.2.1
lesson: never write to a documented-but-unverified shape).
Divergence note (Antigravity): the documented post payload is camelCase
toolCall.args, which is what this parser reads — while the pre-tool
parser reads toolCall.arguments. At least one of the two is wrong for
the live wire; only a live CLI can say which. The pre-tool path is
deliberately left unchanged here; reconciliation rides on the
live-verification checkbox in the fixtures README.
Sourcepub fn format(self, resolved: &Resolved) -> HookOutcome
pub fn format(self, resolved: &Resolved) -> HookOutcome
Serialize a resolved decision into this CLI’s stdout protocol.
Sourcepub fn pass(self) -> HookOutcome
pub fn pass(self) -> HookOutcome
The “allow / no opinion” output used on the fail-open path and for SAFE commands. Most CLIs treat empty output as “proceed normally”; Cursor’s beforeShellExecution gate is answered with an explicit allow.
Trait Implementations§
impl Copy for Dialect
impl Eq for Dialect
impl StructuralPartialEq for Dialect
Auto Trait Implementations§
impl Forget for Dialect
impl Freeze for Dialect
impl Move for Dialect
impl RefUnwindSafe for Dialect
impl Send for Dialect
impl Sync for Dialect
impl Unpin for Dialect
impl UnsafeUnpin for Dialect
impl UnwindSafe for Dialect
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.