Documentation
¶
Overview ¶
Package slack is the Slack source: ingestion, rows, cards and the plugin's capabilities.
Package slack is the Slack source plugin: it reads the conversations the user takes part in through Socket Mode, polling and search, keeps them in its own store, extracts their items through the host's agent, reports each thread and DM segment to the host as a snapshot, posts the drafts the user approves and serves the Slack tools of a session.
Index ¶
- Constants
- func Card(r slackrows.Row) (src.Card, error)
- func DraftOf(d src.Draft) draft.Draft
- func FollowUnit(ctx context.Context, c *slackapi.Client, team, message string) (unit.Unit, error)
- func KnownOver(db *store.DB, log func(string, ...any)) send.Known
- func StoredOver(db *store.DB, log func(string, ...any)) send.Stored
- func WireDraft(d draft.Draft) src.Draft
- type Clock
- type Env
- type Every
- type Heat
- type HeatReader
- type HeatScheduler
- type Kit
- type Landing
- type LedgerHeat
- type Metrics
- func (m *Metrics) Admitted(v dslack.Via)
- func (m *Metrics) Backfill(conversations, threads, deltas int, done bool)
- func (m *Metrics) BackfillDraining(objects int)
- func (m *Metrics) CatchUp(reason string, deltas, missedWhileConnected int)
- func (m *Metrics) RateLimited(method string)
- func (m *Metrics) Received()
- func (m *Metrics) Socket(s socket.State)
- func (m *Metrics) Warn(source string, fn func() []string)
- type Payloads
- type Places
- type Plugin
- func (s *Plugin) Action(ctx context.Context, req src.ActionRequest) (json.RawMessage, error)
- func (s *Plugin) ApplyEffect(ctx context.Context, req src.EffectRequest) error
- func (s *Plugin) Basis(context.Context, sdk.Unit, string) (string, error)
- func (s *Plugin) BriefDescribe(ctx context.Context, in src.BriefInput) (string, error)
- func (s *Plugin) BriefInput(ctx context.Context, u sdk.Unit) (src.BriefInput, error)
- func (s *Plugin) BriefRevision(ctx context.Context, u sdk.Unit) (src.BriefRevision, error)
- func (s *Plugin) BriefStale(ctx context.Context, req src.BriefStaleRequest) (bool, error)
- func (s *Plugin) BriefWant(_ context.Context, u sdk.Unit) (bool, error)
- func (s *Plugin) CallTool(ctx context.Context, call src.ToolCall) (src.ToolResult, error)
- func (s *Plugin) Checkout(context.Context, sdk.Unit) (src.Checkout, bool, error)
- func (s *Plugin) Health(ctx context.Context) (sdk.Health, error)
- func (s *Plugin) Identity(ctx context.Context) (src.Identity, error)
- func (s *Plugin) Ingest(ctx context.Context, req src.IngestRequest) (src.IngestResult, error)
- func (s *Plugin) Landed(ctx context.Context, d src.Draft) (sdk.Unit, bool, error)
- func (s *Plugin) Locate(context.Context, string) (sdk.Unit, bool, error)
- func (s *Plugin) Notify(_ context.Context, units []sdk.Unit, _ []sdk.Topic) error
- func (s *Plugin) Payload(ctx context.Context, req src.PayloadRequest) (src.PayloadResult, error)
- func (s *Plugin) Place(ctx context.Context, d src.Draft) (src.Placed, error)
- func (s *Plugin) Placement(ctx context.Context, u sdk.Unit, item string) (src.Placements, error)
- func (s *Plugin) Plan(context.Context, sdk.Unit, src.RoundState) (src.Plan, error)
- func (s *Plugin) Proposals(context.Context, time.Time) (src.Proposed, error)
- func (s *Plugin) Publish(ctx context.Context, d src.Draft) (src.Evidence, error)
- func (s *Plugin) Resolve(ctx context.Context, address string) (sdk.Unit, bool, error)
- func (s *Plugin) RunCLI(ctx context.Context, req src.CLIRequest, stdout, stderr io.Writer) (int, error)
- func (s *Plugin) Start(ctx context.Context, req src.StartRequest) error
- func (s *Plugin) Stop(context.Context) error
- func (s *Plugin) Track(ctx context.Context, req src.TrackRequest) (src.Tracked, error)
- func (s *Plugin) Untrack(ctx context.Context, w sdk.Unit) error
- func (s *Plugin) Validate(ctx context.Context, d src.Draft) error
- func (s *Plugin) Verify(ctx context.Context, d src.Draft, startedAt time.Time) (src.Evidence, bool, error)
- func (s *Plugin) View(ctx context.Context, req src.ViewRequest) (json.RawMessage, error)
- func (s *Plugin) Where(ctx context.Context, d src.Draft) (string, error)
- func (s *Plugin) Within(ctx context.Context, u sdk.Unit, target string) (bool, error)
- func (s *Plugin) WriteState(context.Context, src.StateWrite) (src.Evidence, error)
- type Problem
- type Publisher
- func (p *Publisher) Landed(_ context.Context, d draft.Draft) (unit.Unit, bool, error)
- func (p *Publisher) Place(ctx context.Context, d draft.Draft) (draft.Placed, error)
- func (p *Publisher) Publish(ctx context.Context, d draft.Draft) (draft.Evidence, error)
- func (p *Publisher) Takes(target string) bool
- func (p *Publisher) Validate(ctx context.Context, d draft.Draft) error
- func (p *Publisher) Verify(ctx context.Context, d draft.Draft, startedAt time.Time) (draft.Evidence, bool, error)
- func (p *Publisher) Where(ctx context.Context, d draft.Draft) (string, error)
- type Reader
- type SearchQuery
- type Segments
- type SendArgs
- type SendResult
- type Slack
- type Source
- func (s *Source) Discover(ctx context.Context, cursor string) ([]ingest.Stub, string, error)
- func (s *Source) Provider() unit.ProviderID
- func (s *Source) Read(ctx context.Context, objects []string) (ingest.Facts, error)
- func (s *Source) Stubs(ctx context.Context, objects []string) ([]ingest.Stub, error)
- func (s *Source) Viewer(context.Context) (string, error)
- type SourceHealth
- type Store
- func (s *Store) Changes(ctx context.Context, afterSeq int64, limit int) ([]dslack.Change, error)
- func (s *Store) Conversation(ctx context.Context, id string) (dslack.Conversation, error)
- func (s *Store) Cursor(ctx context.Context) (string, error)
- func (s *Store) Messages(ctx context.Context, u unit.Unit, after string, limit int) ([]dslack.Message, error)
- func (s *Store) MessagesBefore(ctx context.Context, conv, before string, n int) ([]dslack.Message, error)
- func (s *Store) Save(ctx context.Context, light []ingest.Facts, read ingest.Facts, cursor string, ...) error
- func (s *Store) See(ctx context.Context, objects []string, at time.Time) error
- func (s *Store) UserByEmail(ctx context.Context, email string) (dslack.User, bool, error)
- func (s *Store) Users(ctx context.Context, ids []string) (map[string]dslack.User, error)
- func (s *Store) Versions(ctx context.Context, objects []string) (map[string]string, error)
- func (s *Store) Viewer(ctx context.Context) (team, user string, err error)
- func (s *Store) Watched(ctx context.Context) ([]ingest.Stub, error)
- type ThreadArgs
- type Watches
Constants ¶
const ( // ActionSend posts a message as the user, or says where it would post. ActionSend = "send" // ActionThread names the thread unit of a message: the parent's thread // when it names a reply. ActionThread = "thread" )
The actions the plugin runs for the host's CLI, with no unit.
const ( RuleMention = "mention" RuleTerm = "term" RuleRepliedTo = "replied-to-viewer" RuleWroteIn = "viewer-in-thread" RuleDM = "dm" RuleFollowed = "followed" RuleWatched = "watched" )
Admission rules (Slack spec 5.1), named in logs and tests.
const ( SignalItems = "items" SignalReplies = "replies" SignalLastActivity = "last_activity" ItemsNone = "none" ItemsOpen = "open" RepliesCount = "count" )
The keys of a card's signals and the codes of their values, which the plugin's ui.toml [signals] words.
const ( // StartOverlap is how far before the high-water mark the start's // catch-up reads: a stop drops envelopes acked but still queued and // deltas still in the inbox, while later messages moved the mark. StartOverlap = 10 * time.Minute // DMSearch is the search.messages modifier for direct and group messages. DMSearch = "is:dm" // DMThreadWindow is how far before a DM's high-water mark the catch-up // probes stored threads for replies: history carries no replies. DMThreadWindow = 7 * 24 * time.Hour )
const ( CommandLogin = "login" CommandLogout = "logout" CommandStatus = "status" )
The commands the plugin binary serves in CLI mode.
const ( ReasonStart = "start" ReasonReconnect = "reconnect" ReasonOverflow = "overflow" ReasonClockJump = "clock_jump" ReasonDown = "down_5m" ReasonDropped = "touch_failed" )
Catch-up reasons, as health reports them in last_catchup.
const ( // GapTick is how often the gap detector compares the clocks. GapTick = 30 * time.Second // ClockJump is how far the wall clock must outrun the monotonic one to // count as a wake from sleep: on macOS the monotonic clock stops asleep. ClockJump = 20 * time.Minute // DownGap is how long the socket may stay down before a catch-up runs // without waiting for the reconnect; Slack redelivers for about 6 min. DownGap = 5 * time.Minute )
const ( SocketDownWarnAfter = 5 * time.Minute MissedWarnAt = 5 GrantWarnDays = 25 // LoginRecheck is how long a found login is trusted before the Keychain // is read again; a call that finds the login gone forgets it at once. LoginRecheck = 5 * time.Minute )
Health thresholds (#slack-health).
const ( JobIngest = "ingest" JobExtract = "extract" )
The jobs of the plugin's manifest, which the host runs through Ingest.
const ( SkipNotConfigured = "slack: not configured" SkipNotLoggedIn = "slack: not logged in" SkipNoStore = "slack: no store" )
Skip texts of the ingestion job.
const ( PollActive = 5 * time.Minute PollWarm = 30 * time.Minute PollCold = 60 * time.Minute // RecentFor keeps an object active after its last activity. RecentFor = 24 * time.Hour )
Poll intervals by heat; polling never stops.
const ( CursorViewerTeam = "viewer_team" CursorViewerUser = "viewer_user" )
Cursor names of slack_cursors.
const ( ToolSend = "slack_send_message" ToolRead = "slack_read" ToolSearch = "slack_search" ToolDraft = "slack_draft" ToolReact = "slack_react" ToolEdit = "slack_edit" ToolDelete = "slack_delete" )
The tools of the plugin's manifest.
const CommandEval = "eval"
CommandEval is the command the running plugin serves, through the daemon: it reads the plugin's store and asks the host's agent.
const CursorBackfill = "backfill"
CursorBackfill is set once the first start's backfill finished.
const Debounce = 2 * time.Second
Debounce is how long the inbox gathers an object's deltas before one Touch.
const DefaultPoll = 5 * time.Minute
DefaultPoll is the default Scheduler's interval.
const DefaultSince = 7 * 24 * time.Hour
DefaultSince is how far back the backfill reads without plugins.slack.ingest.since.
const DraftsFile = "drafts.toml"
DraftsFile is the plugin's profile file of draft defaults.
const ( // DropEvery spaces the catch-ups that recover what the inbox dropped. DropEvery = 5 * time.Minute )
const EffectUnitClosed = "unit.closed"
EffectUnitClosed is the draft effect that marks a unit's closure, which no extraction pass clears.
const EventWindow = 10 * time.Minute
EventWindow is how long the stream remembers an event_id: Slack redelivers events whose ack it missed, even on a live connection.
const IngestEvery = time.Minute
IngestEvery is the Slack ingestion job's interval.
const RestartAfter = 30 * time.Second
RestartAfter is how long the plugin waits before it streams again after the socket failed.
const SearchEvery = 5 * time.Minute
SearchEvery is how often Discover runs the mention search; a catch-up runs it whatever its age.
const SkipBudget = "slack: budget low for "
SkipBudget prefixes the job's skip text while a probe method's budget is spent.
const SkipSearchLimited = "slack: search.messages budget is low"
SkipSearchLimited is why a search did not run: search.messages is inside its Retry-After window or spent its budget for the minute.
const UserTTL = 24 * time.Hour
UserTTL is how long a user read from Slack is served from slack_users.
const ViewHealth = "health"
ViewHealth is the plugin's view of its own health.
Variables ¶
This section is empty.
Functions ¶
func FollowUnit ¶
FollowUnit is the thread unit a message ref or permalink names in team: the parent's thread when it names a reply. A name that does not say the thread (a ref, a permalink without thread_ts) costs one conversations.replies call to find the parent.
func KnownOver ¶
KnownOver finds a conversation as db holds it: a channel with its name and membership, a DM with the other party's handle; one db does not hold, or a channel it holds without a name, is left to Slack.
func StoredOver ¶
StoredOver is the send.Stored over the messages the Slack module stores in db. A deleted message, or one search stored with no thread (its permalink may just not say it), is left to Slack; a store error is logged and left to Slack too.
Types ¶
type Env ¶
type Env struct {
// Keychain nil is the login Keychain through security.
Keychain auth.Keychain
// BaseURL "" is slack.com.
BaseURL string
// LockPath "" is the token store's default.
LockPath string
// LoginPort nil is the config's plugins.slack.redirect_port.
LoginPort *int
// Open nil opens the URL in the default browser.
Open func(ctx context.Context, url string) error
// Now nil is the wall clock.
Now func() time.Time
}
Env is how the plugin reaches the Keychain, Slack and the browser; tests replace each.
type HeatReader ¶
type HeatReader interface {
Heat(ctx context.Context, units []unit.Unit) (map[unit.Unit]Heat, error)
}
HeatReader reads the heat of units; a unit absent is cold.
type HeatScheduler ¶
type HeatScheduler struct {
DB *store.SlackStore
Heat HeatReader
Segments dslack.Segments
Log func(format string, args ...any)
}
HeatScheduler is the dslack.Scheduler that checks an object again by the heat of its units and its last activity: active or active in the last RecentFor every PollActive, warm every PollWarm, cold every PollCold. An object the store lacks yet is active, and so is every object when the heat cannot be read.
type Landing ¶
type Landing struct {
Facts dslack.FactsReader
Segments dslack.Segments
// Messages finds the thread of a stored message; nil asks Slack.
Messages send.Stored
}
Landing finds the tracked unit a post outside the outbox landed in.
func LandingOver ¶
LandingOver reads the facts and segments the Slack module stores in db.
func (Landing) MessageUnit ¶
func (l Landing) MessageUnit(ctx context.Context, c *slackapi.Client, team, message string) (unit.Unit, error)
MessageUnit is the unit holding the message a ref or permalink names in team: the tracked DM segment or thread it lands in, else its thread, which the store says when it holds the message and Slack otherwise.
func (Landing) UnitOf ¶
func (l Landing) UnitOf(ctx context.Context, team, channel, ts, threadTS string) (unit.Unit, bool, error)
UnitOf is the unit of a post in team at ts in channel, in the thread threadTS ("" when none): the DM segment covering its anchor, or its channel thread when the facts store it. It reads only the store; false when untracked.
type LedgerHeat ¶
type LedgerHeat struct {
Items func(ctx context.Context, units []unit.Unit) (map[unit.Unit][]items.Item, error)
WarmFor func() time.Duration
Now func() time.Time
}
LedgerHeat reads heat from the host's items: active while a unit has an open item, warm for WarmFor after its last item resolved, cold otherwise.
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
Metrics are the Slack source's in-memory counters, safe for concurrent use; the zero value is ready.
func (*Metrics) BackfillDraining ¶
func (*Metrics) RateLimited ¶
RateLimited is wired to slack.Client.OnRateLimited.
type Payloads ¶
type Payloads struct {
Facts dslack.FactsReader
// MaxChars zero is the config's default.
MaxChars int
}
Payloads reads a Slack unit's turn payload from the stored facts: its messages rendered as slack_read renders them, within MaxChars.
func (Payloads) Payload ¶
func (r Payloads) Payload(ctx context.Context, req src.PayloadRequest) (src.PayloadResult, error)
Payload is a Slack unit as a turn reads it: its argument, its wording and its messages.
type Places ¶
type Places struct {
Hints interface {
Hints(ctx context.Context, u unit.Unit) (map[string]extract.Hint, error)
}
// Conversation fails with dslack.ErrUnknownUnit for a conversation not stored.
Conversation func(ctx context.Context, id string) (dslack.Conversation, error)
Contexts func() []config.PlacementRule
}
Places are Slack's placement hints and defaults. The hint is the contexts rule the extraction suggested for the unit's items; the default is the first "slack:#<channel name>" rule that matches the unit's channel.
func (Places) Default ¶
Default is the first "slack:#<name>" rule matching the unit's channel; a direct message has none.
type Plugin ¶
type Plugin struct {
Env Env
// Slack, when set, replaces the handles Start builds over the
// configuration: tests give a fake Slack.
Slack func(cfg config.Config, kit *Kit) Slack
// Logger nil is the SDK's.
Logger hclog.Logger
// contains filtered or unexported fields
}
Plugin is the Slack source plugin as the SDK serves it.
func (*Plugin) Action ¶
func (s *Plugin) Action(ctx context.Context, req src.ActionRequest) (json.RawMessage, error)
Action runs one of the plugin's actions.
func (*Plugin) ApplyEffect ¶
func (*Plugin) BriefDescribe ¶
func (*Plugin) BriefInput ¶
func (*Plugin) BriefRevision ¶
func (*Plugin) BriefStale ¶
func (*Plugin) BriefWant ¶
BriefWant asks the extraction to read u now, past its quiet time: true when u has changes left to read, so a brief of u is coming through Recorder.PutBrief.
func (*Plugin) Ingest ¶
func (s *Plugin) Ingest(ctx context.Context, req src.IngestRequest) (src.IngestResult, error)
Ingest runs a job of the manifest.
func (*Plugin) Payload ¶
func (s *Plugin) Payload(ctx context.Context, req src.PayloadRequest) (src.PayloadResult, error)
func (*Plugin) Proposals ¶
Proposals are none: the plugin's drafts come from the profile's workflows.
func (*Plugin) RunCLI ¶
func (s *Plugin) RunCLI(ctx context.Context, req src.CLIRequest, stdout, stderr io.Writer) (int, error)
RunCLI runs login, logout or status with no daemon and no store: they read and write only the Keychain and call Slack. The running plugin runs eval instead, and only it.
func (*Plugin) Start ¶
Start opens the plugin's store in its state directory, importing what the host exported once, and starts the socket stream and the reports.
func (*Plugin) View ¶
func (s *Plugin) View(ctx context.Context, req src.ViewRequest) (json.RawMessage, error)
func (*Plugin) Within ¶ added in v0.5.0
Within says whether target, a message ref or permalink, is a message of u; "" is u itself.
func (*Plugin) WriteState ¶
type Problem ¶
type Problem struct {
Answer string `json:"answer"`
Fields fields `json:"fields,omitempty"`
}
Problem is one problem of a fix_these answer: an answer of the tool, which the host words, and its fields.
type Publisher ¶
type Publisher struct {
Send *send.Service
// Token is the stored user token: its user and granted scopes.
Token func() (auth.Token, error)
Segments interface {
Range(ctx context.Context, u unit.Unit) (conv, fromTS, toTS string, err error)
}
// People are the persons the unit's items name, for mentions of other providers.
People func(ctx context.Context, u unit.Unit) ([]items.Person, error)
// Items are the unit's items, whose anchors place a draft on a DM segment.
Items func(ctx context.Context, u unit.Unit) ([]items.Item, error)
// Profile reads a file of the plugin's profile layer, DraftsFile among them.
Profile func(ctx context.Context, path string) ([]byte, error)
Now func() time.Time
Log func(format string, args ...any)
}
Publisher posts Slack drafts as the user: messages through send's resolution and post allowlist, reactions with reactions.add and reactions.remove, edits and deletions of the user's own messages with chat.update and chat.delete.
func PublisherOver ¶
func PublisherOver(db *store.DB, s *send.Service, token func() (auth.Token, error), load func(ctx context.Context, u unit.Unit) ([]items.Item, error), now func() time.Time, log func(string, ...any)) *Publisher
PublisherOver publishes through s, with the segments db stores and the host's items of a unit, load.
func (*Publisher) Landed ¶
Landed is the thread the post of d, a draft on a unit of another provider sent to a Slack target, started or replied in, read from its permalink.
func (*Publisher) Place ¶
Place names where a draft with no target posts. A thread unit's draft posts in that thread (""). A DM segment has no thread of its own: a message answers the newest message its items anchor on, in that message's thread, which a top-level message starts; a reaction goes on the newest message an item started at, the counterpart's request. A message the user writes with no items goes to the conversation, as typing in the DM does.
A message that replies in a thread keeps the broadcast its proposer asked for; asked none, it takes the one DraftsFile gives a reply the person writes, else the kind of conversation it is in.
func (*Publisher) Publish ¶
Publish posts d once. An error after the request may have reached Slack starts "may have been posted".
func (*Publisher) Takes ¶
Takes says whether target names a place a draft posts to in Slack: a message permalink, a conversation or a person.
type Reader ¶
type Reader struct {
Facts dslack.FactsReader
Segments interface {
UnitsFor(ctx context.Context, conv, ts string) ([]unit.Unit, error)
}
// Messages finds the thread of a stored message a ref names; nil asks Slack.
Messages send.Stored
Client *slackapi.Client
// Location is the time zone Search shows times in; nil is the local one.
Location *time.Location
// Log takes what a read leaves out on a Slack error; nil drops it.
Log func(format string, args ...any)
}
Reader renders the messages of a unit, or of the thread a message ref or permalink names, for slack_read. It reads the stored facts and calls Slack only for a channel thread that is not stored; a direct message is read from its stored segments only. It never stores or admits what it reads.
func ReaderOver ¶
ReaderOver reads the facts the Slack module stores in db.
func (*Reader) Read ¶
Read renders target, a unit ("slack:<key>"), or the thread of a message ref or permalink, keeping the first message and the newest up to limit in all.
type SearchQuery ¶
type SearchQuery struct {
Query string
// Channel is a #name or a channel id.
Channel string
// From is an @handle, a user id or an email.
From string
// After and Before are dates, YYYY-MM-DD, both exclusive.
After, Before string
Limit int
}
SearchQuery is what slack_search looks for: Query as Slack's search reads it, narrowed by the filters set.
type Segments ¶
type Segments struct {
Store *store.SegmentStore
Clock Clock
}
Segments is the DM segment map in the store, as units.
type SendArgs ¶
type SendArgs struct {
Target string `json:"target"`
Text string `json:"text"`
Thread *bool `json:"thread,omitempty"`
Broadcast bool `json:"broadcast,omitempty"`
DryRun bool `json:"dry_run,omitempty"`
}
SendArgs are ActionSend's arguments; DryRun posts nothing and says where the message would go and what it would say.
type SendResult ¶
type SendResult struct {
Conversation string `json:"conversation"`
Parent string `json:"parent,omitempty"`
Text string `json:"text"`
Permalink string `json:"permalink,omitempty"`
}
SendResult is where a message went, or would go, and its text as Slack shows it.
type Slack ¶
type Slack struct {
Tokens *auth.Store
Client *slackapi.Client
// Open is apps.connections.open; nil calls Client.ConnectionsOpen with the app token.
Open func(ctx context.Context) (string, error)
// Dial nil is coder/websocket.
Dial func(ctx context.Context, url string) (socket.Socket, error)
Metrics *Metrics
// Now nil is the wall clock.
Now func() time.Time
// Debounce zero is Debounce.
Debounce time.Duration
// Recheck is how often an idle Run looks for a login; zero is IngestEvery.
Recheck time.Duration
}
Slack are the handles the plugin builds over its configuration: the token store and the client that calls Slack with the user token. Tests set the others.
type Source ¶
type Source struct {
// contains filtered or unexported fields
}
Source is the Slack ingest.Source. Read builds facts from the inbox and calls Slack only for an object the store cannot complete: a thread whose parent is unknown, or an object with no waiting delta.
func (*Source) Discover ¶
Discover runs the mention search every SearchEvery and returns the objects of the matches it admits; the next cursor is the newest match's ts, saved with the pass's facts. A failed search is logged and the pass goes on with the watched objects.
func (*Source) Provider ¶
func (s *Source) Provider() unit.ProviderID
type SourceHealth ¶
type SourceHealth struct {
Warnings []string `json:"warnings"`
Detail json.RawMessage `json:"detail,omitempty"`
}
SourceHealth is the plugin's health as the host's health shows it: its warnings and the detail of its socket, catch-up and login.
type Store ¶
type Store struct {
DB *store.SlackStore
Segments dslack.Segments
Scheduler dslack.Scheduler
Now func() time.Time
}
Store is the Slack source's ingest.SourceStore and FactsReader over the slack_* tables. Segments may be nil until the segment map exists; a nil Scheduler is Every(DefaultPoll), a nil Now is time.Now.
func (*Store) Conversation ¶
func (*Store) Messages ¶
func (s *Store) Messages(ctx context.Context, u unit.Unit, after string, limit int) ([]dslack.Message, error)
Messages are u's messages after the ts after, ascending, at most limit.
func (*Store) MessagesBefore ¶
func (s *Store) MessagesBefore(ctx context.Context, conv, before string, n int) ([]dslack.Message, error)
MessagesBefore are the newest n messages of conv anchored before ts, ascending.
func (*Store) Save ¶
func (s *Store) Save(ctx context.Context, light []ingest.Facts, read ingest.Facts, cursor string, at time.Time) error
Save stores the light facts, then the read facts (the read wins for one object), then the cursor; every stored object gets its next check from the Scheduler.
func (*Store) See ¶
See stamps every object the pass returned and moves each to the Scheduler's next check, changed or not.
func (*Store) UserByEmail ¶
type ThreadArgs ¶
type ThreadArgs struct {
Message string `json:"message"`
}
ThreadArgs are ActionThread's arguments.
type Watches ¶
type Watches struct{ DB *store.SlackStore }
Watches is the dslack.Watcher over slack_objects: a watched object the store lacks is read on the next pass.
Source Files
¶
- actions.go
- admit.go
- backfill.go
- card.go
- catchup.go
- cli.go
- evalcmd.go
- extraction.go
- facts.go
- find.go
- follow.go
- gap.go
- health.go
- identity.go
- inbox.go
- kit.go
- members.go
- metrics.go
- names.go
- payload.go
- place.go
- plugin.go
- poller.go
- publisher.go
- read.go
- report.go
- schedule.go
- sdk.go
- search.go
- segments.go
- signals.go
- source.go
- store.go
- stream.go
- tools.go
- users.go
- wake.go
- watch.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package auth keeps the Slack tokens: login, refresh and the Keychain.
|
Package auth keeps the Slack tokens: login, refresh and the Keychain. |
|
cmd
|
|
|
wloop-plugin-slack
command
Command wloop-plugin-slack is the Slack source plugin's binary, which the host runs as a child process.
|
Command wloop-plugin-slack is the Slack source plugin's binary, which the host runs as a child process. |
|
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.
|
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. |
|
Package slack is the Slack plugin's domain: messages, deltas and the facts the source stores.
|
Package slack is the Slack plugin's domain: messages, deltas and the facts the source stores. |
|
Package draft holds the Outbox drafts: posts the loop proposes and the user approves before they reach a provider.
|
Package draft holds the Outbox drafts: posts the loop proposes and the user approves before they reach a provider. |
|
Package eval measures the Slack extractor: an oracle reads a conversation and writes the viewer's briefing, a blind reader writes the same briefing from the extractor's ledger alone, and a judge with the conversation compares them.
|
Package eval measures the Slack extractor: an oracle reads a conversation and writes the viewer's briefing, a blind reader writes the same briefing from the extractor's ledger alone, and a judge with the conversation compares them. |
|
Package extract turns a Slack conversation window into items ledger ops through one agent call.
|
Package extract turns a Slack conversation window into items ledger ops through one agent call. |
|
Package host is the host's broker as the Slack plugin calls it, in the plugin's own types: the items ledger, the agent and the profile layer.
|
Package host is the host's broker as the Slack plugin calls it, in the plugin's own types: the items ledger, the agent and the profile layer. |
|
hosttest
Package hosttest is an in-memory host broker for the Slack plugin's tests: it records what the plugin reports, proposes and writes, applies item ops with the host ledger's rules, and answers asks from a script.
|
Package hosttest is an in-memory host broker for the Slack plugin's tests: it records what the plugin reports, proposes and writes, applies item ops with the host ledger's rules, and answers asks from a script. |
|
Package ingest drives the Slack source: discovery, change detection by object version, detail reads of what moved, and saves through the source's store.
|
Package ingest drives the Slack source: discovery, change detection by object version, detail reads of what moved, and saves through the source's store. |
|
Package items holds the cross-source items ledger's types.
|
Package items holds the cross-source items ledger's types. |
|
Package jsonschema validates structured agent answers against the subset of JSON Schema the profile's schemas may use: type, properties, required, additionalProperties, enum, minLength, maxLength, minItems, maxItems, items, pattern (RE2) and description.
|
Package jsonschema validates structured agent answers against the subset of JSON Schema the profile's schemas may use: type, properties, required, additionalProperties, enum, minLength, maxLength, minItems, maxItems, items, pattern (RE2) and description. |
|
Package language tells the language a Slack thread's people write in.
|
Package language tells the language a Slack thread's people write in. |
|
Package link holds the cross-source links between units.
|
Package link holds the cross-source links between units. |
|
Package slackrows serves Slack units as read model rows: threads and DM segments with their extraction verdict and open items.
|
Package slackrows serves Slack units as read model rows: threads and DM segments with their extraction verdict and open items. |
|
Package send posts a message to Slack as the user.
|
Package send posts a message to Slack as the user. |
|
Package slack is a thin client for the Slack Web API.
|
Package slack is a thin client for the Slack Web API. |
|
Package slacktest is a fake Slack Web API for tests.
|
Package slacktest is a fake Slack Web API for tests. |
|
Package socket keeps a Slack Socket Mode connection.
|
Package socket keeps a Slack Socket Mode connection. |
|
sockettest
Package sockettest is a fake Slack Socket Mode server for tests.
|
Package sockettest is a fake Slack Socket Mode server for tests. |
|
Package store is the Slack plugin's own database, in the state directory the host gives it: the conversations, threads, messages and users it read, the DM segment map and what the extraction keeps per unit.
|
Package store is the Slack plugin's own database, in the state directory the host gives it: the conversations, threads, messages and users it read, the DM segment map and what the extraction keeps per unit. |
|
Package tag names what a pull request touches with key:value tags, a matching system and nothing more: nine fixed keys, each value normalized to one spelling.
|
Package tag names what a pull request touches with key:value tags, a matching system and nothing more: nine fixed keys, each value normalized to one spelling. |
|
Package unit names the units of work the Slack plugin and the host share: a provider and the provider's key, as the host's units are.
|
Package unit names the units of work the Slack plugin and the host share: a provider and the provider's key, as the host's units are. |