Merge branch 'main' into chat-cross-client-echo-order
This commit is contained in:
@@ -54,6 +54,10 @@ const (
|
||||
// load the choices without first listing sessions and chat_sessions stays a
|
||||
// pure, fail-closed operator-session list.
|
||||
ChatDirectories = "chat_directories"
|
||||
// ChatShells lists current, verified shells belonging to one operator chat
|
||||
// session. ChatShellOutput reads a bounded page from one such shell.
|
||||
ChatShells = "chat_shells"
|
||||
ChatShellOutput = "chat_shell_output"
|
||||
// ChatEvent and ChatPermission are the server-pushed frames; they are the
|
||||
// only types the server sends without a matching request.
|
||||
ChatEvent = "chat_event"
|
||||
@@ -89,8 +93,10 @@ const (
|
||||
// ChatShell.Status values, mirroring the OpenCode shell events. A running shell
|
||||
// is one whose command has started and not yet exited; exited is final.
|
||||
const (
|
||||
ChatShellRunning = "running"
|
||||
ChatShellExited = "exited"
|
||||
ChatShellRunning = "running"
|
||||
ChatShellExited = "exited"
|
||||
ChatShellOutputLimit = 64 << 10
|
||||
ChatShellOutputMaxCursor = int64(1 << 62)
|
||||
)
|
||||
|
||||
// ChatStep.Status values, mirroring the OpenCode session.step events.
|
||||
@@ -363,6 +369,26 @@ type ChatShell struct {
|
||||
Exit *int `json:"exit,omitempty"`
|
||||
}
|
||||
|
||||
// ChatShellOutputQuery names one selected shell and a bounded absolute-byte
|
||||
// output page. Cursor is decimal so it can be passed directly to OpenCode.
|
||||
type ChatShellOutputQuery struct {
|
||||
SessionID string `json:"session_id"`
|
||||
ShellID string `json:"shell_id"`
|
||||
Cursor int64 `json:"cursor,omitempty"`
|
||||
Limit int `json:"limit,omitempty"`
|
||||
}
|
||||
|
||||
// ChatShellOutputPage is a bounded, lazy output read. Unavailable is explicit when
|
||||
// an exited shell is no longer directly verifiable upstream.
|
||||
type ChatShellOutputPage struct {
|
||||
Shell ChatShell `json:"shell"`
|
||||
Output string `json:"output,omitempty"`
|
||||
Cursor int64 `json:"cursor,omitempty"`
|
||||
Size int64 `json:"size,omitempty"`
|
||||
Truncated bool `json:"truncated,omitempty"`
|
||||
Unavailable bool `json:"unavailable,omitempty"`
|
||||
}
|
||||
|
||||
// ChatPermissionFrame is the server-pushed chat_permission payload: one pending
|
||||
// OpenCode permission request the phone must approve or reject. It is a distinct
|
||||
// Message field (like ChatEvent) rather than a ChatEvent.Kind, so it does not
|
||||
|
||||
@@ -3,19 +3,23 @@ package protocol
|
||||
import "git.a-wan.net/alan/pipelines/internal/buildinfo"
|
||||
|
||||
const (
|
||||
Ping = "ping"
|
||||
Pong = "pong"
|
||||
Error = "error"
|
||||
Submit = "submit"
|
||||
Submitted = "submitted"
|
||||
List = "list_pipelines"
|
||||
PipelineList = "pipelines"
|
||||
GetPipeline = "get_pipeline"
|
||||
Pipeline = "pipeline"
|
||||
ListTemplates = "list_templates"
|
||||
Templates = "templates"
|
||||
Validate = "validate"
|
||||
Validated = "validated"
|
||||
Ping = "ping"
|
||||
Pong = "pong"
|
||||
Error = "error"
|
||||
Submit = "submit"
|
||||
Submitted = "submitted"
|
||||
List = "list_pipelines"
|
||||
PipelineList = "pipelines"
|
||||
GetPipeline = "get_pipeline"
|
||||
Pipeline = "pipeline"
|
||||
ListTemplates = "list_templates"
|
||||
Templates = "templates"
|
||||
Validate = "validate"
|
||||
Validated = "validated"
|
||||
InspectResource = "inspect_resource"
|
||||
ResourceInspectionResult = "resource_inspection"
|
||||
ReconcileResource = "reconcile_resource"
|
||||
ResourceReconciled = "resource_reconciled"
|
||||
)
|
||||
|
||||
type Stage struct {
|
||||
@@ -155,6 +159,10 @@ type Message struct {
|
||||
// them; the same fields are echoed on the run record.
|
||||
Model string `json:"model,omitempty"`
|
||||
StageModels map[string]string `json:"stage_models,omitempty"`
|
||||
// Empty (or "resume") retries the failed visit; "restart" starts at the
|
||||
// entry stage. Older clients omit this field and retain resume behavior.
|
||||
RetryMode string `json:"retry_mode,omitempty"`
|
||||
RetrySource int64 `json:"-"`
|
||||
// Search is the broad, read-only search traffic over pipelines, versions,
|
||||
// runs, steps, field text and artifacts. See search.go for the per-type
|
||||
// payloads and the ranking/kind/bound vocabulary.
|
||||
@@ -187,10 +195,16 @@ type Message struct {
|
||||
// chat_directories response (home first, then recent operator-session
|
||||
// directories, deduplicated and bounded). Additive/omitempty so older peers
|
||||
// ignore it.
|
||||
ChatDirectories []string `json:"chat_directories,omitempty"`
|
||||
ChatDirectories []string `json:"chat_directories,omitempty"`
|
||||
ChatShellOutputQuery *ChatShellOutputQuery `json:"chat_shell_output_query,omitempty"`
|
||||
ChatShells []ChatShell `json:"chat_shells,omitempty"`
|
||||
ChatShellOutput *ChatShellOutputPage `json:"chat_shell_output,omitempty"`
|
||||
// RunEvent is the server-pushed run state delta (see runevents.go) and
|
||||
// RunIDs the optional subscribe scope, so a client asks for the runs it
|
||||
// displays. Both are optional so older peers ignore them.
|
||||
RunEvent *RunEventFrame `json:"run_event,omitempty"`
|
||||
RunIDs []int64 `json:"run_ids,omitempty"`
|
||||
RunEvent *RunEventFrame `json:"run_event,omitempty"`
|
||||
RunIDs []int64 `json:"run_ids,omitempty"`
|
||||
Resource string `json:"resource,omitempty"`
|
||||
ResourceInspection *ResourceInspection `json:"resource_inspection,omitempty"`
|
||||
ResourceRecovery *ResourceRecoveryRequest `json:"resource_recovery,omitempty"`
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package protocol
|
||||
|
||||
type ResourceInspection struct {
|
||||
Resource string `json:"resource"`
|
||||
Owner *ResourceOwner `json:"owner,omitempty"`
|
||||
Waiters []ResourceWaiter `json:"waiters,omitempty"`
|
||||
Audits []ResourceRecoveryAudit `json:"audits,omitempty"`
|
||||
}
|
||||
type ResourceOwner struct {
|
||||
RunID int64 `json:"run_id"`
|
||||
Stage string `json:"stage"`
|
||||
Sequence int `json:"sequence"`
|
||||
CleanupConfirmed bool `json:"cleanup_confirmed"`
|
||||
Quarantined bool `json:"quarantined"`
|
||||
AgentActive bool `json:"agent_active"`
|
||||
}
|
||||
type ResourceWaiter struct {
|
||||
RunID int64 `json:"run_id"`
|
||||
Stage string `json:"stage"`
|
||||
Sequence int `json:"sequence"`
|
||||
QueuedAt string `json:"queued_at"`
|
||||
}
|
||||
type ResourceRecoveryAudit struct {
|
||||
Resource string `json:"resource"`
|
||||
RunID int64 `json:"run_id"`
|
||||
Stage string `json:"stage"`
|
||||
Sequence int `json:"sequence"`
|
||||
Actor string `json:"actor"`
|
||||
Source string `json:"source"`
|
||||
Evidence string `json:"evidence"`
|
||||
Result string `json:"result"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
}
|
||||
type ResourceRecoveryEvidence struct {
|
||||
CleanupConfirmed bool `json:"cleanup_confirmed"`
|
||||
NoMutatingAction bool `json:"no_mutating_action"`
|
||||
Summary string `json:"summary"`
|
||||
}
|
||||
type ResourceRecoveryRequest struct {
|
||||
Resource string `json:"resource"`
|
||||
RunID int64 `json:"run_id"`
|
||||
Stage string `json:"stage"`
|
||||
Sequence int `json:"sequence"`
|
||||
Evidence *ResourceRecoveryEvidence `json:"evidence,omitempty"`
|
||||
Actor string `json:"actor"`
|
||||
}
|
||||
@@ -370,14 +370,16 @@ type NotificationReceipt struct {
|
||||
|
||||
type RunDetail struct {
|
||||
RunSummary
|
||||
Graph Graph `json:"graph"`
|
||||
RetryOf int64 `json:"retry_of,omitempty"`
|
||||
Workspace string `json:"workspace"`
|
||||
AllowTools bool `json:"allow_tools"`
|
||||
WritePaths []string `json:"write_paths"`
|
||||
Input map[string]any `json:"input"`
|
||||
Output map[string]any `json:"output"`
|
||||
Steps []RunStep `json:"steps"`
|
||||
Graph Graph `json:"graph"`
|
||||
RetryOf int64 `json:"retry_of,omitempty"`
|
||||
RetryMode string `json:"retry_mode,omitempty"`
|
||||
RetrySource int64 `json:"retry_source,omitempty"`
|
||||
Workspace string `json:"workspace"`
|
||||
AllowTools bool `json:"allow_tools"`
|
||||
WritePaths []string `json:"write_paths"`
|
||||
Input map[string]any `json:"input"`
|
||||
Output map[string]any `json:"output"`
|
||||
Steps []RunStep `json:"steps"`
|
||||
// Usage is the totalled reported usage of the run's model stages, summed in
|
||||
// one pass over Steps. It is absent for a run with no model usage recorded
|
||||
// (including historical runs).
|
||||
|
||||
Reference in New Issue
Block a user