| 1 |
package clnkr |
| 2 |
|
| 3 |
// Event is a sealed interface for agent events. |
| 4 |
type Event interface{ event() } |
| 5 |
|
| 6 |
// EventResponse fires when the model returns a valid structured turn. |
| 7 |
type EventResponse struct { |
| 8 |
Turn Turn |
| 9 |
Usage Usage |
| 10 |
Raw string // original provider text for debugging only |
| 11 |
} |
| 12 |
|
| 13 |
// EventCommandStart fires before running a command. |
| 14 |
type EventCommandStart struct { |
| 15 |
Command string |
| 16 |
Dir string |
| 17 |
} |
| 18 |
|
| 19 |
// EventCommandDone fires after a command finishes. |
| 20 |
type EventCommandDone struct { |
| 21 |
Command string |
| 22 |
Stdout string |
| 23 |
Stderr string |
| 24 |
ExitCode int |
| 25 |
Feedback CommandFeedback |
| 26 |
Err error |
| 27 |
} |
| 28 |
|
| 29 |
// EventProtocolFailure fires when the model response fails protocol parsing. |
| 30 |
type EventProtocolFailure struct { |
| 31 |
Reason string // machine-readable reason from errorToReason() |
| 32 |
Raw string // model's original response text |
| 33 |
} |
| 34 |
|
| 35 |
// EventCompletionGate fires when unattended completion policy accepts, rejects, |
| 36 |
// or challenges a done turn. |
| 37 |
type EventCompletionGate struct { |
| 38 |
Decision string |
| 39 |
Reasons []string |
| 40 |
Summary string |
| 41 |
} |
| 42 |
|
| 43 |
// EventDebug carries internal diagnostic messages. |
| 44 |
type EventDebug struct{ Message string } |
| 45 |
|
| 46 |
const ContextLengthBackstopCompactingDebug = "context_length_backstop: compacting after provider context limit" |
| 47 |
|
| 48 |
const ContextLengthBackstopRetryingDebug = "context_length_backstop: retrying failed model step once" |
| 49 |
|
| 50 |
func (EventResponse) event() {} |
| 51 |
func (EventCommandStart) event() {} |
| 52 |
func (EventCommandDone) event() {} |
| 53 |
func (EventProtocolFailure) event() {} |
| 54 |
func (EventCompletionGate) event() {} |
| 55 |
func (EventDebug) event() {} |
| 56 |
|
| 57 |
// StepResult is the outcome of one agent operation. |
| 58 |
type StepResult struct { |
| 59 |
Response Response |
| 60 |
Turn Turn |
| 61 |
ParseErr error |
| 62 |
Output string |
| 63 |
ExecErr error |
| 64 |
ExecCount int |
| 65 |
} |