Remove obsolete root scripts

This commit is contained in:
武阳
2026-05-06 16:24:06 +08:00
parent c46f8ae4f1
commit d5af12bc4a
3 changed files with 0 additions and 146 deletions
-95
View File
@@ -1,95 +0,0 @@
from __future__ import annotations
import os
import shlex
from harbor.agents.installed.base import BaseInstalledAgent, CliFlag, EnvVar, with_prompt_template
from harbor.environments.base import BaseEnvironment
from harbor.models.agent.context import AgentContext
class ClawCodeInstalledAgent(BaseInstalledAgent):
"""
Harbor installed-agent adapter for claw-code-agent.
This installs the published GitHub repo inside the Harbor environment and
runs the CLI in one-shot mode against the task working directory.
"""
CLI_FLAGS = [
CliFlag("max_turns", cli="--max-turns", type="int"),
CliFlag("append_system_prompt", cli="--append-system-prompt", type="str"),
CliFlag("system_prompt", cli="--system-prompt", type="str"),
CliFlag("stream", cli="--stream", type="bool"),
CliFlag("allow_write", cli="--allow-write", type="bool", default=True),
CliFlag("allow_shell", cli="--allow-shell", type="bool", default=True),
]
ENV_VARS = [
EnvVar("openai_api_key", env="OPENAI_API_KEY", type="str", env_fallback="OPENAI_API_KEY"),
EnvVar("openai_base_url", env="OPENAI_BASE_URL", type="str", env_fallback="OPENAI_BASE_URL"),
EnvVar("openai_model", env="OPENAI_MODEL", type="str", env_fallback="OPENAI_MODEL"),
]
@staticmethod
def name() -> str:
return "claw-code-agent"
def get_version_command(self) -> str | None:
return "claw-code-agent --help >/dev/null 2>&1 && echo installed"
async def install(self, environment: BaseEnvironment) -> None:
await self.exec_as_root(
environment,
command=(
"if command -v apk >/dev/null 2>&1; then "
"apk add --no-cache python3 py3-pip bash curl git; "
"elif command -v apt-get >/dev/null 2>&1; then "
"apt-get update && apt-get install -y python3 python3-pip bash curl git; "
"elif command -v yum >/dev/null 2>&1; then "
"yum install -y python3 python3-pip bash curl git; "
"fi"
),
env={"DEBIAN_FRONTEND": "noninteractive"},
)
version_spec = f"@{self._version}" if self._version else ""
repo_spec = (
f"git+https://github.com/HarnessLab/claw-code-agent.git{version_spec}"
if version_spec
else "git+https://github.com/HarnessLab/claw-code-agent.git"
)
await self.exec_as_agent(
environment,
command=(
"set -euo pipefail; "
f"python3 -m pip install --upgrade pip && python3 -m pip install {shlex.quote(repo_spec)} && "
"claw-code-agent --help >/dev/null"
),
)
def populate_context_post_run(self, context: AgentContext) -> None:
del context
@with_prompt_template
async def run(
self,
instruction: str,
environment: BaseEnvironment,
context: AgentContext,
) -> None:
del context
env = self.resolve_env_vars()
if self.model_name and "OPENAI_MODEL" not in env:
env["OPENAI_MODEL"] = self.model_name
cli_flags = self.build_cli_flags()
extra_flags = (cli_flags + " ") if cli_flags else ""
escaped_instruction = shlex.quote(instruction)
# Harbor executes in the task working directory; keep cwd anchored there.
command = (
f"claw-code-agent agent {escaped_instruction} "
f"--cwd $(pwd) {extra_flags}"
"2>&1 | stdbuf -oL tee /logs/agent/claw-code-agent.txt"
)
await self.exec_as_agent(environment, command=command, env=env)
-36
View File
@@ -1,36 +0,0 @@
# everything stays under $SCRATCH
export DROOT="$SCRATCH/docker-rootless"
mkdir -p "$DROOT"/{bin,home,config/docker,run,data}
chmod 700 "$DROOT/run"
# read-only checks; these do not modify the system
command -v newuidmap newgidmap
grep "^$(whoami):" /etc/subuid /etc/subgid
cat /proc/sys/kernel/unprivileged_userns_clone 2>/dev/null || true
cat /proc/sys/user/max_user_namespaces 2>/dev/null || true
df -T "$SCRATCH"
# keep Docker files in $SCRATCH
export HOME="$DROOT/home"
export DOCKER_BIN="$DROOT/bin"
export XDG_CONFIG_HOME="$DROOT/config"
export XDG_RUNTIME_DIR="$DROOT/run"
export PATH="$DOCKER_BIN:$PATH"
export DOCKER_HOST="unix://$XDG_RUNTIME_DIR/docker.sock"
# install rootless Docker binaries into $SCRATCH
curl -fsSL https://get.docker.com/rootless | sh
# store Docker images/layers in $SCRATCH too
cat > "$XDG_CONFIG_HOME/docker/daemon.json" <<EOF
{
"data-root": "$DROOT/data"
}
EOF
# start daemon manually (no systemd)
nohup dockerd-rootless.sh > "$DROOT/dockerd.log" 2>&1 &
sleep 5
docker --version
docker info
-15
View File
@@ -1,15 +0,0 @@
annotated-doc==0.0.4
annotated-types==0.7.0
anyio==4.13.0
-e git+https://github.com/HarnessLab/claw-code-agent.git@30de15b6d52dd4942924e92f3fffdee0063cc9d4#egg=claw_code_agent
click==8.3.2
exceptiongroup==1.3.1
fastapi==0.136.0
h11==0.16.0
idna==3.12
pydantic==2.13.3
pydantic_core==2.46.3
starlette==1.0.0
typing-inspection==0.4.2
typing_extensions==4.15.0
uvicorn==0.45.0