Files
coder/coderd/x/chatd/attempt.go
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

68 lines
1.8 KiB
Go
Raw Normal View History

2026-06-12 13:33:12 +02:00
package chatd
import (
"database/sql"
"time"
"charm.land/fantasy"
"github.com/coder/coder/v2/coderd/x/chatd/chatloop"
2026-06-12 13:33:12 +02:00
)
type runnerActionKind string
const (
runnerActionKindEnterRequiresAction runnerActionKind = "enter_requires_action"
runnerActionKindFinishTurn runnerActionKind = "finish_turn"
runnerActionKindFinishError runnerActionKind = "finish_error"
runnerActionKindFinishInterruption runnerActionKind = "finish_interruption"
)
// stepData is the durable content produced by one provider attempt.
type stepData struct {
2026-07-06 11:57:12 +01:00
Content []fantasy.Content
Usage fantasy.Usage
ContextLimit sql.NullInt64
Runtime time.Duration
2026-06-12 13:33:12 +02:00
// BatchRuntime is the local-tool batch window. Model steps use Runtime.
BatchRuntime time.Duration
// BatchBilledCalls counts the calls whose intervals produced
// BatchRuntime. Audit metadata for the batch usage record.
BatchBilledCalls int
2026-06-12 13:33:12 +02:00
ToolCallCreatedAt map[string]time.Time
ToolResultCreatedAt map[string]time.Time
ReasoningStartedAt []time.Time
ReasoningCompletedAt []time.Time
}
// pendingDynamicToolCall describes a dynamic tool call parked for a user.
type pendingDynamicToolCall struct {
ToolCallID string
ToolName string
Args string
}
// compactionOutcome contains a generated context summary. It must stay
// field-compatible with chatloop.CompactionResult; generateCompaction
// converts between the two directly.
2026-06-12 13:33:12 +02:00
type compactionOutcome struct {
SystemSummary string
SummaryReport string
Source chatloop.CompactionSource
2026-06-12 13:33:12 +02:00
ThresholdPercent int32
UsagePercent float64
ContextTokens int64
ContextLimit int64
Runtime time.Duration
2026-06-12 13:33:12 +02:00
}
type compactionStatus int
const (
compactionStatusNotNeeded compactionStatus = iota
compactionStatusNeeded
compactionStatusAfterCompaction
compactionStatusStillOverLimit
)