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
+11 -1
View File
@@ -69,6 +69,11 @@ type Options struct {
// AccessToken, when set, is required on every request (servertoken.Header)
// except the chat-tools MCP endpoint and /healthz (request_boundary.go).
AccessToken string
// WebAuthFile is the web sign-in password file step-up re-authentication
// verifies against (see elevation.go); empty disables the gate.
// ElevationTTL is how long one confirmation lasts (default 15 minutes).
WebAuthFile string
ElevationTTL time.Duration
}
// Handler serves the persistent connection with default options. Canceling ctx
@@ -182,7 +187,8 @@ func HandlerWithOptions(ctx context.Context, options Options, stores ...*pipelin
}
mux.HandleFunc("GET /discovery", serveServerDiscovery)
mux.HandleFunc("GET /files", serveHomeFile)
mux.HandleFunc("POST /files", serveHomeFileUpload)
elevation := newElevationGate(options.WebAuthFile, options.ElevationTTL)
mux.HandleFunc("POST /files", elevation.requireElevationHTTP(serveHomeFileUpload))
mux.HandleFunc("POST /chat-uploads", serveChatUpload)
mux.HandleFunc("GET /healthz", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
@@ -227,6 +233,7 @@ func HandlerWithOptions(ctx context.Context, options Options, stores ...*pipelin
// clientID is this connection's identity for chat session claims: a
// second client is refused a session another connection holds.
clientID := chatClientToken()
defer elevation.forget(clientID)
// Drop every run subscription this connection holds when the read loop
// returns, so no subscriber, goroutine or timer outlives the connection.
defer events.unsubscribeClient(clientID)
@@ -277,6 +284,9 @@ func HandlerWithOptions(ctx context.Context, options Options, stores ...*pipelin
_ = write(protocol.Message{Type: protocol.Error, ID: request.ID, Error: "pipeline authoring is disabled on this execution server; ask the operator to publish through an explicitly enabled authoring server"})
continue
}
if elevation.handle(request, clientID, write) || elevation.refuse(request, clientID, write) {
continue
}
if isChatSearch(request) {
cancelChatSearch()
searchCtx, cancel := context.WithCancel(connCtx)