1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
//! Canonical labels and formatting for workflow notices in session
//! transcripts.
use std::fmt;
/// Canonical labels for bracketed workflow notices appended to a session
/// transcript.
///
/// Session output rendering uses the same labels to recognize trailing
/// workflow notices, so producing notices through this enum keeps new labels
/// aligned with summary render ordering.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum TranscriptNotice {
/// Prompt `/apply` command status.
Apply,
/// Automatic focused-review addressing status.
AutoAddress,
/// Automatic published-branch push result.
BranchPush,
/// Automatic published-branch push failure.
BranchPushError,
/// Session auto-commit result.
Commit,
/// Earlier turns compacted to fit the model's context window.
Context,
/// Failed compaction of earlier turns; the turn continued without them.
ContextWarning,
/// Agent-assisted auto-commit recovery attempt.
CommitAssist,
/// Session auto-commit failure.
CommitError,
/// Advisory for a commit that ran without a configured pre-commit hook.
CommitWarning,
/// Follow-on session creation failure.
ContinueError,
/// Generic prompt submission failure.
Error,
/// Session fork creation failure.
ForkError,
/// Follow-up task execution failure.
FollowUpTaskError,
/// Merge workflow progress.
Merge,
/// Merge workflow failure.
MergeError,
/// Main checkout changed during a provider turn.
MainCheckoutWarning,
/// Prompt image-paste failure.
PasteImageError,
/// Queued prompt failure.
QueueError,
/// Session sync workflow progress.
Rebase,
/// Agent-assisted session sync recovery attempt.
RebaseAssist,
/// Session sync workflow failure.
RebaseError,
/// Reply submission failure.
ReplyError,
/// Review-request creation result.
ReviewRequest,
/// Successful forge review-thread replies and resolution.
ReviewComments,
/// Partial or failed forge review-thread resolution.
ReviewCommentsWarning,
/// Review-request sync warning.
ReviewRequestSyncWarning,
/// Review-request watch enablement and automatic follow-up.
ReviewWatch,
/// Hint that the native sandbox may have blocked a command.
Sandbox,
/// Commands running without the native sandbox, with the fix.
SandboxWarning,
/// Draft session start failure.
StartError,
/// Completed-turn metadata persistence failure.
TurnMetadataError,
}
impl TranscriptNotice {
/// Returns the bracketed transcript prefix for this notice kind.
pub const fn prefix(self) -> &'static str {
match self {
Self::Apply => "[Apply]",
Self::AutoAddress => "[Auto Address]",
Self::BranchPush => "[Branch Push]",
Self::BranchPushError => "[Branch Push Error]",
Self::Commit => "[Commit]",
Self::CommitAssist => "[Commit Assist]",
Self::CommitError => "[Commit Error]",
Self::CommitWarning => "[Commit Warning]",
Self::Context => "[Context]",
Self::ContextWarning => "[Context Warning]",
Self::ContinueError => "[Continue Error]",
Self::Error => "[Error]",
Self::ForkError => "[Fork Error]",
Self::FollowUpTaskError => "[Follow-Up Task Error]",
Self::Merge => "[Merge]",
Self::MergeError => "[Merge Error]",
Self::MainCheckoutWarning => "[Main Checkout Warning]",
Self::PasteImageError => "[Paste Image Error]",
Self::QueueError => "[Queue Error]",
Self::Rebase => "[Sync]",
Self::RebaseAssist => "[Sync Assist]",
Self::RebaseError => "[Sync Error]",
Self::ReplyError => "[Reply Error]",
Self::ReviewRequest => "[Review Request]",
Self::ReviewComments => "[Review Comments]",
Self::ReviewCommentsWarning => "[Review Comments Warning]",
Self::ReviewRequestSyncWarning => "[Review Request Sync Warning]",
Self::ReviewWatch => "[Review Watch]",
Self::Sandbox => "[Sandbox]",
Self::SandboxWarning => "[Sandbox Warning]",
Self::StartError => "[Start Error]",
Self::TurnMetadataError => "[Turn Metadata Error]",
}
}
/// Formats one transcript notice as a newline-delimited paragraph.
pub fn format(self, detail: impl fmt::Display) -> String {
format!("\n{}\n", self.format_line(detail))
}
/// Formats one transcript notice as a single display line without
/// paragraph separators.
pub fn format_line(self, detail: impl fmt::Display) -> String {
format!("{} {}", self.prefix(), detail)
}
}
#[cfg(test)]
#[path = "transcript_notice_test.rs"]
mod tests;