Documentation
¶
Overview ¶
Package botsvc mounts /v1/bot/* — a reverse proxy to the in-cluster bot-gateway (the OpenAI-compatible agent gateway that owns channels, skills, and the agent API). The console Bot module probes /v1/bot/health and links out to the operational surfaces; without this the route 404s "not routed on this host". No bot logic is reimplemented here — bot-gateway owns it.
Path mapping: bot-gateway serves bare paths (/health, /v1/chat/completions), NOT the /v1/bot/* prefix — the edge strips it. So this facade strips /v1/bot too: /v1/bot/<rest> → {bot-gateway}/<rest> (e.g. /v1/bot/health → /health).
Order 143 — binds /v1/bot/* before the AI subsystem's /v1/* catch-all (150).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CodingStep ¶ added in v1.801.23
type CodingStep struct {
Type string `json:"type"`
Step string `json:"step,omitempty"`
Message string `json:"message,omitempty"`
Status string `json:"status,omitempty"`
}
CodingStep is one progress event mirrored into the session. Type is "step" or "log"; Step names the phase (clone|plan|edit|commit|push); Status is ok|error for a completed phase. All fields are safe to surface (no credential).
type CodingTaskRequest ¶ added in v1.801.23
type CodingTaskRequest struct {
CloneURL string `json:"cloneUrl"` // https://<domain>/v1/git/<org>/<repo>.git
BaseBranch string `json:"baseBranch"` // branch to start from (default repo default)
Branch string `json:"branch"` // branch to create + push (e.g. agent/<sessionid>)
Prompt string `json:"prompt"` // the engineering task
SessionID string `json:"sessionId"` // cloud session id (correlation)
RunTimeoutSeconds int `json:"runTimeoutSeconds"` // sandbox run budget
Credential Credential `json:"credential"` // agent git credential (write-only)
}
CodingTaskRequest is the cloud→bot contract for one coding run.
type CodingTaskResult ¶ added in v1.801.23
type CodingTaskResult struct {
Branch string `json:"branch"`
CommitSha string `json:"commitSha"`
Diffstat string `json:"diffstat"`
Changed bool `json:"changed"`
OK bool `json:"ok"`
LogTail string `json:"logTail"`
Error string `json:"error,omitempty"`
}
CodingTaskResult is the terminal outcome bot-gateway reports.
func RunCodingTask ¶ added in v1.801.23
func RunCodingTask(ctx context.Context, org, userID string, req CodingTaskRequest, onStep func(CodingStep)) (CodingTaskResult, error)
RunCodingTask POSTs a coding job to bot-gateway and streams the NDJSON result, invoking onStep for each progress line as it arrives. It returns the terminal result. A non-2xx status, a transport error, or a stream that ends without a terminal line is an error (no partial success is fabricated). org/userID are the gateway-minted tenant context bot-gateway trusts AFTER its own bearer gate.
type Credential ¶ added in v1.801.23
Credential is the per-org agent git credential the sandbox presents to native git. Token is the secret (an hk- key); Username is the basic-auth user label. Marshaled into the request body only — never logged.