Merge branch 'worktree-agent-a7f96a1eb9a56587d'

# Conflicts:
#	cmd/pipelines-server/main.go
#	internal/server/websocket.go
#	scripts/manage.py
#	scripts/setup-native.py
#	web/serve.mjs
#	web/src/peerRelay.js
This commit is contained in:
2026-11-10 01:25:04 +00:00
60 changed files with 3994 additions and 157 deletions
+39
View File
@@ -0,0 +1,39 @@
package protocol
// Step-up re-authentication. A signed-in web session can read everything, but
// running shell commands, typing into a shell, changing or uploading files and
// opening a terminal additionally need a recent password confirmation on the
// same connection. The server verifies the password against the web sign-in
// password file; the elevation lasts for a bounded time (15 minutes by
// default) and ends with the connection.
const (
// Elevate confirms the sign-in password (Message.Password). The reply is
// Elevated, or Error with Code ErrorElevationFailed or
// ErrorElevationUnavailable.
Elevate = "elevate"
// Elevated carries Elevation: when it ends and the upload token.
Elevated = "elevated"
// ErrorElevationRequired types the refusal of a gated request on a
// connection that is not (or no longer) elevated. Clients confirm the
// password with Elevate and retry.
ErrorElevationRequired = "elevation_required"
// ErrorElevationFailed types a wrong password or a rate-limited attempt.
ErrorElevationFailed = "elevation_failed"
// ErrorElevationUnavailable types an elevate on a server without a web
// sign-in password file (nothing is gated there).
ErrorElevationUnavailable = "elevation_unavailable"
// ElevationHeader carries Elevation.Token on POST /files. A refused upload
// answers 403 with a JSON body {"code":"elevation_required","error":...}.
ElevationHeader = "X-Pipelines-Elevation"
)
// Elevation is the elevated reply body.
type Elevation struct {
// ExpiresAt is RFC 3339 UTC; Seconds is the remaining lifetime, for
// clients whose clock differs from the server's.
ExpiresAt string `json:"expires_at"`
Seconds int `json:"seconds"`
// Token authorises HTTP uploads for as long as this connection stays
// elevated. It is random, held only in memory and never logged.
Token string `json:"token,omitempty"`
}
+6
View File
@@ -302,6 +302,12 @@ type Message struct {
MovePath *MovePathRequest `json:"move_path,omitempty"`
DeletePath *DeletePathRequest `json:"delete_path,omitempty"`
PathMutated *PathMutatedResult `json:"path_mutated,omitempty"`
// Step-up re-authentication (see elevation.go): Code types an error,
// Password is the elevate body (never logged or echoed) and Elevation the
// elevated reply.
Code string `json:"code,omitempty"`
Password string `json:"password,omitempty"`
Elevation *Elevation `json:"elevation,omitempty"`
// ChatAttachmentImageRequest is the chat_attachment_image body and
// ChatAttachmentImage its reply.
ChatAttachmentImageRequest *ChatAttachmentImageRequest `json:"chat_attachment_image_request,omitempty"`