Documentation
¶
Overview ¶
Package config is the configuration the Slack plugin reads: its [plugins.slack] table and the host keys its manifest's config_reads names, as the host passes them.
Index ¶
- Constants
- func ParseDuration(s string) (time.Duration, error)
- type Config
- type Days
- type Items
- type ItemsHeat
- type PlacementRule
- type Slack
- type SlackExtraction
- func (e SlackExtraction) ContextBudget() int
- func (e SlackExtraction) ContextN() int
- func (e SlackExtraction) EscalateOver() int
- func (e SlackExtraction) GiveUpAfter() int
- func (e SlackExtraction) LanguageName() string
- func (e SlackExtraction) MaxCallUSD() float64
- func (e SlackExtraction) MaxDayCalls() int
- func (e SlackExtraction) MaxDayUSD() float64
- func (e SlackExtraction) MaxWaitFor() time.Duration
- func (e SlackExtraction) On() bool
- func (e SlackExtraction) QuietFor() time.Duration
- func (e SlackExtraction) TierName() string
- func (e SlackExtraction) Window() int
- type SlackIngest
- type SlackTurns
Constants ¶
const Day = 24 * time.Hour
Day is what d means: 24 hours.
const DefaultSlackEndedAfter = 7 * 24 * time.Hour
DefaultSlackEndedAfter is plugins.slack.ended_after's default.
const DefaultSlackRedirectPort = 53682
DefaultSlackRedirectPort is the login callback port registered in the Slack app.
const DefaultWarmFor = 72 * time.Hour
DefaultWarmFor is items.heat.warm_for when unset.
const MinSlackTurnChars = 2000
MinSlackTurnChars is the smallest cap Chars returns, which holds a parent and a reply.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Slack Slack
// Placement are the host's placement rules.
Placement []PlacementRule
Items Items
// Brand is the host's name, which names the default Keychain service.
Brand string
}
Config is what the plugin reads of the host's configuration.
type Days ¶
Days is a duration written as a Go duration or a whole number of days: "2d", "36h", "90m".
func (*Days) UnmarshalJSON ¶
type Items ¶
type Items struct {
Heat ItemsHeat `json:"heat"`
}
Items holds the host's items ledger settings the plugin reads.
type ItemsHeat ¶
type ItemsHeat struct {
// WarmFor is how long a unit stays warm after its last item resolved; zero is DefaultWarmFor.
WarmFor Days `json:"warm_for,omitempty"`
}
type PlacementRule ¶
type PlacementRule struct {
Match string `json:"match"`
Repo string `json:"repo,omitempty"`
Checkout string `json:"checkout,omitempty"`
Role string `json:"role,omitempty"`
}
PlacementRule places the work of what matches Match.
type Slack ¶
type Slack struct {
// ClientID is the Slack app's client id; empty leaves Slack unconfigured.
ClientID string `json:"client_id"`
RedirectPort int `json:"redirect_port"`
// KeychainService names the Keychain items; empty is the brand's name plus "-slack".
KeychainService string `json:"keychain_service"`
// PostAllowlist, when not empty, holds the only channel ids, or user ids naming
// the DM with that user, a post may go to.
PostAllowlist []string `json:"post_allowlist"`
// RequestLog logs one line per Slack call: method and HTTP status.
RequestLog bool `json:"request_log"`
Ingest SlackIngest `json:"ingest"`
Extraction SlackExtraction `json:"extraction"`
Turns SlackTurns `json:"turns"`
// EndedAfter is how long a unit stays quiet before it has ended; zero is DefaultSlackEndedAfter.
EndedAfter Days `json:"ended_after,omitempty"`
}
Slack holds the Slack source's settings; no secret lives here.
func (Slack) Configured ¶
func (Slack) EndedAfterFor ¶
EndedAfterFor is how long a Slack unit stays quiet before it has ended.
type SlackExtraction ¶
type SlackExtraction struct {
// Enabled nil is on.
Enabled *bool `json:"enabled,omitempty"`
// Tier is fast, balanced or frontier; empty is fast.
Tier string `json:"tier,omitempty"`
Language string `json:"language,omitempty"`
PerCallUSD float64 `json:"per_call_usd,omitempty"`
PerDayUSD float64 `json:"per_day_usd,omitempty"`
PerDay int `json:"per_day,omitempty"`
// Quiet is how long a unit stays unchanged before it runs; MaxWait bounds the delay of its oldest change.
Quiet Days `json:"quiet,omitempty"`
MaxWait Days `json:"max_wait,omitempty"`
WindowChars int `json:"window_chars,omitempty"`
// MaxFailures failed calls in a row make the job give up on a unit until its next change.
MaxFailures int `json:"max_failures,omitempty"`
// ContextMessages and ContextChars bound the read-only messages shown before a DM's window; -1 turns either off.
ContextMessages int `json:"context_messages,omitempty"`
ContextChars int `json:"context_chars,omitempty"`
// EscalateOverChars sends a unit whose rendered conversation is longer to the frontier tier; 0 or -1 is off.
EscalateOverChars int `json:"escalate_over_chars,omitempty"`
}
SlackExtraction sets the extraction job; a zero value keeps its default.
func (SlackExtraction) ContextBudget ¶
func (e SlackExtraction) ContextBudget() int
func (SlackExtraction) ContextN ¶
func (e SlackExtraction) ContextN() int
func (SlackExtraction) EscalateOver ¶
func (e SlackExtraction) EscalateOver() int
func (SlackExtraction) GiveUpAfter ¶
func (e SlackExtraction) GiveUpAfter() int
func (SlackExtraction) LanguageName ¶
func (e SlackExtraction) LanguageName() string
func (SlackExtraction) MaxCallUSD ¶
func (e SlackExtraction) MaxCallUSD() float64
func (SlackExtraction) MaxDayCalls ¶
func (e SlackExtraction) MaxDayCalls() int
func (SlackExtraction) MaxDayUSD ¶
func (e SlackExtraction) MaxDayUSD() float64
func (SlackExtraction) MaxWaitFor ¶
func (e SlackExtraction) MaxWaitFor() time.Duration
func (SlackExtraction) On ¶
func (e SlackExtraction) On() bool
func (SlackExtraction) QuietFor ¶
func (e SlackExtraction) QuietFor() time.Duration
func (SlackExtraction) TierName ¶
func (e SlackExtraction) TierName() string
func (SlackExtraction) Window ¶
func (e SlackExtraction) Window() int
type SlackIngest ¶
type SlackIngest struct {
// Terms admit a message that holds one of them as a word, in any case.
Terms []string `json:"terms"`
// AllowApps and DenyApps hold bot ids (B...) or app ids (A...).
AllowApps []string `json:"allow_apps"`
DenyApps []string `json:"deny_apps"`
// Socket nil is on.
Socket *bool `json:"socket"`
// Since is the first start's backfill date, YYYY-MM-DD; empty is 7 days back.
Since string `json:"since"`
}
SlackIngest is what the Slack source admits and how it listens.
func (SlackIngest) SocketOn ¶
func (i SlackIngest) SocketOn() bool
type SlackTurns ¶
type SlackTurns struct {
// MaxChars bounds the unit's messages rendered into the instructions; zero is 30000, and less than MinSlackTurnChars reads as it.
MaxChars int `json:"max_chars,omitempty"`
}
SlackTurns sets what a turn on a Slack unit reads.
func (SlackTurns) Chars ¶
func (t SlackTurns) Chars() int