Documentation
¶
Overview ¶
Package grok is the Grok Build adapter. Its argv, decoder, session lookup and reviewer evidence moved here from internal/git and internal/jobs with no behaviour change (criterion 1); the field names and values are the ones verified against Grok Build 1.0.40 (2026-09-22).
Index ¶
- Constants
- func LatestSession(home, cwd string) (id string, ok bool)
- func SessionsDir(home, cwd string) (string, error)
- func TextPayload(raw []byte) string
- func ToolDenied(events [][]byte) (string, bool)
- type Adapter
- func (a *Adapter) Bin() string
- func (a *Adapter) Command(t aa.Task) (aa.Command, error)
- func (a *Adapter) CredentialEnv() []string
- func (a *Adapter) Denied(events [][]byte, _ aa.End) (string, bool)
- func (a *Adapter) FilterStderr(line string) string
- func (a *Adapter) LogSource() string
- func (a *Adapter) MinVersion() string
- func (a *Adapter) Name() aa.Name
- func (a *Adapter) NewDecoder() aa.Decoder
- func (a *Adapter) Prepare(aa.Task) error
- func (a *Adapter) Ready(context.Context, aa.Task) error
- func (a *Adapter) ResumeID(handoff, _ string) (string, bool)
- func (a *Adapter) ResumesByID() bool
- func (a *Adapter) ReviewEvidence(events [][]byte, worktrees []string) bool
- func (a *Adapter) SupportsSimulator() bool
- func (a *Adapter) VersionArgs() []string
- type Config
- type Decoder
Constants ¶
const MinVersion = "1.0.40"
MinVersion is the version the stream decoder was verified against.
Variables ¶
This section is empty.
Functions ¶
func LatestSession ¶
LatestSession returns the newest session for cwd that has a chat history, which is what `grok -c` would continue. ok is false when there is none, including when Grok's layout has moved: Resume then fails closed.
func SessionsDir ¶
SessionsDir is where Grok Build keeps the sessions for one cwd: <home>/sessions/<url-escaped absolute cwd>/<uuid>/ (verified on 1.0.40).
func TextPayload ¶
TextPayload is the operator-visible body of a text event. Grok 1.0.40 sends `data`. Older shapes use text, then message, then content. Each key is read on its own so a sibling that is not a string (content:[] or text:1) does not drop a string sitting next to it. Absent, null, non-string, and empty values are skipped. No string payload logs nothing.
func ToolDenied ¶
ToolDenied is Denied without the adapter.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter is Grok Build.
func (*Adapter) Command ¶
Command builds the implementer or reviewer argv. The implementer argv is identical across iterations except for -c / -r and the prompt, so the sandbox and turn budget cannot drift.
func (*Adapter) CredentialEnv ¶
func (*Adapter) Denied ¶
Denied reports a permission-gate refusal. Grok ends the run cancelled and puts "User cancelled the execution for tool `<name>`" in the tool_call_update content, which is an array, so the raw event is scanned.
func (*Adapter) FilterStderr ¶
FilterStderr forwards grok's stderr unchanged.
func (*Adapter) MinVersion ¶
func (*Adapter) NewDecoder ¶
NewDecoder returns grok's streaming-json decoder.
func (*Adapter) Prepare ¶
Prepare is a no-op: the job-scoped sandbox profile is written and byte-checked by the jobs package, which owns the Simulator lease.
func (*Adapter) Ready ¶
Ready keeps today's behaviour: grok's login is `grok login` by the owner, and a signed-out run fails at run time.
func (*Adapter) ResumeID ¶
ResumeID ignores the stored id: grok resumes what `grok -c` would continue, the newest session for the handoff cwd.
func (*Adapter) ResumesByID ¶
func (*Adapter) ReviewEvidence ¶
ReviewEvidence reports whether the stream shows a completed git diff of one of worktrees. read_file and grep do not count.