Files
alan 05ae530442 Make Pipelines Docker-only with OpenCode and Pi
Install current verified harness releases inside Docker, preserve persistent accounts and settings, and provide separate interactive and pipeline model defaults with terminal onboarding and fuzzy pickers.

Add Docker-aware authoring transport, Pi stage execution, bounded workflow controls, reliable final-result readback and usage settlement, and finite short-lived CLI pipe draining. Keep dated installation evidence and packaged authoring guidance consistent.

Verified with a real Docker installation, both harness stages and interactive authors, the built-in plan/implement/review starter, independent host race/vet checks, installer tests, and packaged skill tests. Generated release receipts stay ignored in clean checkouts.
2026-10-11 23:00:25 +01:00

66 lines
2.9 KiB
Python

#!/usr/bin/env python3
"""Check installed Pi policy/RPC/idle lease cleanup without credentials or inference."""
import json
import os
from pathlib import Path
import queue
import subprocess
import tempfile
import threading
import time
def main():
with tempfile.TemporaryDirectory(prefix="pipelines-pi-rpc-") as directory:
root = Path(directory)
(root / "policy.json").write_text(json.dumps({"directory": directory, "tools": [], "paths": [], "edit": None, "shell": None}))
(root / "lease").write_text("owned")
(root / "policy.js").write_bytes((Path(__file__).resolve().parents[1] / "internal/stage/pi_policy.mjs").read_bytes())
env = dict(os.environ, PI_OFFLINE="1", PI_CODING_AGENT_DIR=str(root / "config"),
PIPELINES_PI_POLICY=str(root / "policy.json"), PIPELINES_PI_LEASE=str(root / "lease"),
PIPELINES_PI_STOPPED=str(root / "quiescent"))
process = subprocess.Popen(["pi", "--mode", "rpc", "--no-extensions", "--no-skills", "--no-context-files",
"--no-prompt-templates", "--no-tools", "--extension", str(root / "policy.js")],
stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, env=env, cwd=root)
output = queue.Queue()
def read():
for line in process.stdout:
output.put(line)
thread = threading.Thread(target=read, daemon=True)
thread.start()
try:
for command in ["get_state", "set_auto_retry", "set_auto_compaction", "get_session_stats", "get_messages"]:
process.stdin.write(json.dumps({"id": command, "type": command, "enabled": False}) + "\n")
process.stdin.flush()
reply = None
deadline = time.monotonic() + 15
while time.monotonic() < deadline:
try:
record = json.loads(output.get(timeout=.5))
except queue.Empty:
continue
if record.get("id") == command:
reply = record
break
assert reply and reply["success"], reply
assert (root / "ready").read_text() == "ready"
os.utime(root / "lease", (0, 0))
process.wait(timeout=10)
assert process.returncode == 0
assert (root / "quiescent").read_text() == "quiescent"
print("PASS: installed Pi policy readiness, RPC commands, idle lease expiry/exit. No prompt, credentials or inference. Active-tool cleanup not tested.")
finally:
if process.poll() is None:
process.terminate()
process.wait(timeout=10)
thread.join(timeout=2)
process.stdin.close()
process.stdout.close()
process.stderr.close()
if __name__ == "__main__":
main()