Files
weichenandCursor b85a1e1ca3 Add immutable layered Python environments for the sandbox.
Why: The sandbox hides the host home directory and has no network, so pip install --user cannot supply python-docx, and the service PATH resolved python3 to a linuxbrew path that does not exist inside the sandbox.
Evidence: SELF go test of execenv, tools, store, app, server, runmgr, config, and cmd/agent-system on this worktree. CI has not run.
Impact: Sessions inherit a read-only base layer. Extra packages are requested through python_env, auto-approved only from the allowlist, and mounted per conversation. Schema 35 adds the request and binding tables.
Refs: .task/feature-layered-python-env.md
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-15 13:52:48 +00:00

21 lines
472 B
Go

package execenv
import (
"crypto/sha256"
"encoding/hex"
"hash"
"io"
)
type shaWriter struct{ h hash.Hash }
func sha256New() shaWriter { return shaWriter{h: sha256.New()} }
func (s shaWriter) Sum() string { return hex.EncodeToString(s.h.Sum(nil)) }
// Write 满足 io.Writer,便于 fileSHA256 之外的流式哈希。
func (s shaWriter) Write(p []byte) (int, error) { return s.h.Write(p) }
// 确认 shaWriter 可传给 io.Copy。
var _ io.Writer = shaWriter{}