@pushpalsdev/cli 1.0.17 → 1.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pushpals-cli.js +542 -23
- package/package.json +1 -1
- package/runtime/sandbox/apps/workerpals/.python-version +1 -0
- package/runtime/sandbox/apps/workerpals/Dockerfile.sandbox +71 -0
- package/runtime/sandbox/apps/workerpals/package.json +25 -0
- package/runtime/sandbox/apps/workerpals/pyproject.toml +8 -0
- package/runtime/sandbox/apps/workerpals/src/backends/backend_config.ts +111 -0
- package/runtime/sandbox/apps/workerpals/src/backends/miniswe/miniswe_executor.py +2029 -0
- package/runtime/sandbox/apps/workerpals/src/backends/miniswe_backend.ts +48 -0
- package/runtime/sandbox/apps/workerpals/src/backends/openai_codex/openai_codex_executor.py +1259 -0
- package/runtime/sandbox/apps/workerpals/src/backends/openai_codex/test_openai_codex_runtime_config.py +110 -0
- package/runtime/sandbox/apps/workerpals/src/backends/openai_codex_backend.ts +67 -0
- package/runtime/sandbox/apps/workerpals/src/backends/openhands/openhands_executor.py +563 -0
- package/runtime/sandbox/apps/workerpals/src/backends/openhands_backend.ts +161 -0
- package/runtime/sandbox/apps/workerpals/src/backends/openhands_task_execute.ts +536 -0
- package/runtime/sandbox/apps/workerpals/src/backends/shared/executor_base.py +746 -0
- package/runtime/sandbox/apps/workerpals/src/backends/shared/test_settings_resolver.py +60 -0
- package/runtime/sandbox/apps/workerpals/src/backends/task_execute_registry.ts +21 -0
- package/runtime/sandbox/apps/workerpals/src/backends/types.ts +52 -0
- package/runtime/sandbox/apps/workerpals/src/common/execution_utils.ts +149 -0
- package/runtime/sandbox/apps/workerpals/src/common/executor_backend.ts +15 -0
- package/runtime/sandbox/apps/workerpals/src/common/generic_python_executor.ts +210 -0
- package/runtime/sandbox/apps/workerpals/src/common/logger.ts +65 -0
- package/runtime/sandbox/apps/workerpals/src/common/types.ts +9 -0
- package/runtime/sandbox/apps/workerpals/src/common/worktree_cleanup.ts +66 -0
- package/runtime/sandbox/apps/workerpals/src/context_manager.ts +45 -0
- package/runtime/sandbox/apps/workerpals/src/docker_executor.ts +1842 -0
- package/runtime/sandbox/apps/workerpals/src/execute_job.ts +3063 -0
- package/runtime/sandbox/apps/workerpals/src/job_runner.ts +194 -0
- package/runtime/sandbox/apps/workerpals/src/shell_manager.ts +210 -0
- package/runtime/sandbox/apps/workerpals/src/timeout_policy.ts +24 -0
- package/runtime/sandbox/apps/workerpals/src/workerpals_main.ts +1436 -0
- package/runtime/sandbox/apps/workerpals/tsconfig.json +15 -0
- package/runtime/sandbox/apps/workerpals/uv.lock +2014 -0
- package/runtime/sandbox/bun.lock +2591 -0
- package/runtime/sandbox/configs/backend.toml +79 -0
- package/runtime/sandbox/configs/default.toml +260 -0
- package/runtime/sandbox/configs/dev.toml +2 -0
- package/runtime/sandbox/configs/local.example.toml +129 -0
- package/runtime/sandbox/package.json +65 -0
- package/runtime/sandbox/packages/protocol/README.md +168 -0
- package/runtime/sandbox/packages/protocol/package.json +37 -0
- package/runtime/sandbox/packages/protocol/scripts/copy-schemas.js +17 -0
- package/runtime/sandbox/packages/protocol/src/a2a/README.md +52 -0
- package/runtime/sandbox/packages/protocol/src/a2a/mapping.ts +55 -0
- package/runtime/sandbox/packages/protocol/src/index.browser.ts +25 -0
- package/runtime/sandbox/packages/protocol/src/index.ts +25 -0
- package/runtime/sandbox/packages/protocol/src/schemas/approvals.schema.json +6 -0
- package/runtime/sandbox/packages/protocol/src/schemas/envelope.schema.json +96 -0
- package/runtime/sandbox/packages/protocol/src/schemas/events.schema.json +679 -0
- package/runtime/sandbox/packages/protocol/src/schemas/http.schema.json +50 -0
- package/runtime/sandbox/packages/protocol/src/types.ts +267 -0
- package/runtime/sandbox/packages/protocol/src/validate.browser.ts +154 -0
- package/runtime/sandbox/packages/protocol/src/validate.ts +233 -0
- package/runtime/sandbox/packages/protocol/src/version.ts +1 -0
- package/runtime/sandbox/packages/protocol/tsconfig.json +20 -0
- package/runtime/sandbox/packages/shared/package.json +19 -0
- package/runtime/sandbox/packages/shared/src/autonomy_policy.ts +400 -0
- package/runtime/sandbox/packages/shared/src/client_preflight.ts +297 -0
- package/runtime/sandbox/packages/shared/src/communication.ts +313 -0
- package/runtime/sandbox/packages/shared/src/config.ts +2201 -0
- package/runtime/sandbox/packages/shared/src/config_template_parity.ts +70 -0
- package/runtime/sandbox/packages/shared/src/git_backend.ts +205 -0
- package/runtime/sandbox/packages/shared/src/index.ts +100 -0
- package/runtime/sandbox/packages/shared/src/local_network.ts +101 -0
- package/runtime/sandbox/packages/shared/src/localbuddy_runtime.ts +329 -0
- package/runtime/sandbox/packages/shared/src/prompts.ts +64 -0
- package/runtime/sandbox/packages/shared/src/repo.ts +134 -0
- package/runtime/sandbox/packages/shared/src/session_event_visibility.ts +25 -0
- package/runtime/sandbox/packages/shared/src/vision.ts +247 -0
- package/runtime/sandbox/packages/shared/tsconfig.json +16 -0
- package/runtime/sandbox/prompts/workerpals/codex_quality_critic_instruction_prompt.md +14 -0
- package/runtime/sandbox/prompts/workerpals/commit_message_prompt.md +36 -0
- package/runtime/sandbox/prompts/workerpals/commit_message_user_prompt.md +7 -0
- package/runtime/sandbox/prompts/workerpals/miniswe_broker_system_prompt.md +33 -0
- package/runtime/sandbox/prompts/workerpals/miniswe_broker_task_prompt.md +5 -0
- package/runtime/sandbox/prompts/workerpals/miniswe_completion_requirement.md +1 -0
- package/runtime/sandbox/prompts/workerpals/miniswe_context_compaction_retry_prompt.md +1 -0
- package/runtime/sandbox/prompts/workerpals/miniswe_explicit_targets_block.md +2 -0
- package/runtime/sandbox/prompts/workerpals/miniswe_recovery_guidance_base.md +4 -0
- package/runtime/sandbox/prompts/workerpals/miniswe_recovery_guidance_blocker_line.md +1 -0
- package/runtime/sandbox/prompts/workerpals/miniswe_strict_tool_use_guidance.md +6 -0
- package/runtime/sandbox/prompts/workerpals/miniswe_supplemental_guidance_section.md +2 -0
- package/runtime/sandbox/prompts/workerpals/miniswe_timeout_note.md +1 -0
- package/runtime/sandbox/prompts/workerpals/miniswe_toolcall_retry_guidance.md +1 -0
- package/runtime/sandbox/prompts/workerpals/openai_codex_default_system_prompt.md +4 -0
- package/runtime/sandbox/prompts/workerpals/openai_codex_instruction_wrapper.md +5 -0
- package/runtime/sandbox/prompts/workerpals/openai_codex_runtime_policy_appendix.md +5 -0
- package/runtime/sandbox/prompts/workerpals/openai_codex_supplemental_guidance_section.md +2 -0
- package/runtime/sandbox/prompts/workerpals/openai_codex_task_execute_system_prompt.md +12 -0
- package/runtime/sandbox/prompts/workerpals/openhands_minimal_security_policy.j2 +8 -0
- package/runtime/sandbox/prompts/workerpals/openhands_minimal_system_prompt.j2 +20 -0
- package/runtime/sandbox/prompts/workerpals/openhands_strict_tool_use_message.md +1 -0
- package/runtime/sandbox/prompts/workerpals/openhands_supplemental_guidance_message.md +2 -0
- package/runtime/sandbox/prompts/workerpals/openhands_task_execute_fallback_system_prompt.md +1 -0
- package/runtime/sandbox/prompts/workerpals/openhands_task_execute_system_prompt.md +21 -0
- package/runtime/sandbox/prompts/workerpals/openhands_task_user_prompt.md +6 -0
- package/runtime/sandbox/prompts/workerpals/openhands_timeout_note.md +1 -0
- package/runtime/sandbox/prompts/workerpals/pr_description.md +42 -0
- package/runtime/sandbox/prompts/workerpals/task_quality_critic_system_prompt.md +9 -0
- package/runtime/sandbox/prompts/workerpals/task_quality_critic_user_prompt.md +17 -0
- package/runtime/sandbox/prompts/workerpals/workerpals_system_prompt.md +115 -0
- package/runtime/sandbox/protocol/schemas/approvals.schema.json +6 -0
- package/runtime/sandbox/protocol/schemas/envelope.schema.json +96 -0
- package/runtime/sandbox/protocol/schemas/events.schema.json +679 -0
- package/runtime/sandbox/protocol/schemas/http.schema.json +50 -0
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.12
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# PushPals Worker Sandbox Dockerfile
|
|
2
|
+
# This image provides an isolated environment for job execution
|
|
3
|
+
# The entire monorepo is available in the container for job execution
|
|
4
|
+
|
|
5
|
+
FROM oven/bun:1-debian AS base
|
|
6
|
+
|
|
7
|
+
# Install git and other essential tools
|
|
8
|
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
9
|
+
git \
|
|
10
|
+
curl \
|
|
11
|
+
ca-certificates \
|
|
12
|
+
openssh-client \
|
|
13
|
+
grep \
|
|
14
|
+
jq \
|
|
15
|
+
ripgrep \
|
|
16
|
+
fd-find \
|
|
17
|
+
less \
|
|
18
|
+
unzip \
|
|
19
|
+
zip \
|
|
20
|
+
procps \
|
|
21
|
+
dnsutils \
|
|
22
|
+
iputils-ping \
|
|
23
|
+
python3 \
|
|
24
|
+
python3-venv \
|
|
25
|
+
python3-pip \
|
|
26
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
27
|
+
|
|
28
|
+
# Worker runtime in one shared venv (uv default layout).
|
|
29
|
+
# Keep the venv at /workspace/.venv so all backends use the same Python runtime.
|
|
30
|
+
RUN mkdir -p /workspace \
|
|
31
|
+
&& python3 -m venv /workspace/.venv \
|
|
32
|
+
&& /workspace/.venv/bin/pip install --no-cache-dir --upgrade pip \
|
|
33
|
+
&& /workspace/.venv/bin/pip install --no-cache-dir \
|
|
34
|
+
openhands-sdk \
|
|
35
|
+
openhands-agent-server \
|
|
36
|
+
openhands-workspace \
|
|
37
|
+
openhands-tools \
|
|
38
|
+
mini-swe-agent \
|
|
39
|
+
playwright \
|
|
40
|
+
&& bun add -g @openai/codex \
|
|
41
|
+
&& /workspace/.venv/bin/playwright install --with-deps chromium
|
|
42
|
+
|
|
43
|
+
ENV PATH="/workspace/.venv/bin:/root/.bun/bin:${PATH}"
|
|
44
|
+
ENV WORKERPALS_OPENHANDS_PYTHON="/workspace/.venv/bin/python"
|
|
45
|
+
ENV WORKERPALS_OPENHANDS_WORKSPACE_PYTHON="/workspace/.venv/bin/python"
|
|
46
|
+
ENV WORKERPALS_MINISWE_PYTHON="/workspace/.venv/bin/python"
|
|
47
|
+
ENV PUSHPALS_OPENAI_CODEX_PYTHON="/workspace/.venv/bin/python"
|
|
48
|
+
|
|
49
|
+
# Configure git for the worker
|
|
50
|
+
RUN git config --global user.name "PushPals Worker" \
|
|
51
|
+
&& git config --global user.email "worker@pushpals.local" \
|
|
52
|
+
&& git config --global safe.directory '*' \
|
|
53
|
+
&& git config --global core.autocrlf input
|
|
54
|
+
|
|
55
|
+
# Set up the full monorepo structure
|
|
56
|
+
WORKDIR /workspace
|
|
57
|
+
|
|
58
|
+
# Copy entire repository (build context should be repo root)
|
|
59
|
+
COPY . .
|
|
60
|
+
|
|
61
|
+
# Install workspace dependencies (including devDeps needed for protocol build)
|
|
62
|
+
RUN bun install
|
|
63
|
+
|
|
64
|
+
# Build protocol package (needed by worker)
|
|
65
|
+
RUN cd packages/protocol && bun run build
|
|
66
|
+
|
|
67
|
+
# Set working directory for job execution
|
|
68
|
+
WORKDIR /workspace
|
|
69
|
+
|
|
70
|
+
# Default entrypoint runs the job runner with base64-encoded job spec
|
|
71
|
+
ENTRYPOINT ["bun", "run", "/workspace/apps/workerpals/src/job_runner.ts"]
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "workerpals",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "bun --watch --no-clear-screen src/workerpals_main.ts",
|
|
7
|
+
"start": "bun run src/workerpals_main.ts",
|
|
8
|
+
"build:sandbox": "docker build -f Dockerfile.sandbox -t pushpals-worker-sandbox:latest ../..",
|
|
9
|
+
"docker:build": "docker build -f Dockerfile.sandbox -t pushpals-worker-sandbox:latest ../..",
|
|
10
|
+
"docker:build:local": "docker build -f Dockerfile.sandbox -t pushpals-worker-sandbox:local ../..",
|
|
11
|
+
"docker:run": "docker run --rm -it pushpals-worker-sandbox:latest",
|
|
12
|
+
"dev:docker": "bun run src/workerpals_main.ts --docker",
|
|
13
|
+
"workerpals:docker": "bun run src/workerpals_main.ts --docker",
|
|
14
|
+
"workerpals:docker:local": "bun run src/workerpals_main.ts --docker --docker-image pushpals-worker-sandbox:local"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"protocol": "workspace:*",
|
|
18
|
+
"shared": "workspace:*"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"typescript": "~5.9.2",
|
|
22
|
+
"@types/bun": "latest"
|
|
23
|
+
},
|
|
24
|
+
"private": true
|
|
25
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { readFileSync } from "fs";
|
|
2
|
+
import { resolve } from "path";
|
|
3
|
+
import { loadPushPalsConfig } from "shared";
|
|
4
|
+
import type { ExecutorBackend } from "../common/types.js";
|
|
5
|
+
import { MINISWE_BACKEND } from "./miniswe_backend.js";
|
|
6
|
+
import { OPENAI_CODEX_BACKEND } from "./openai_codex_backend.js";
|
|
7
|
+
import { OPENHANDS_BACKEND } from "./openhands_backend.js";
|
|
8
|
+
import type { BackendTaskExecutor, DockerBackendSpec } from "./types.js";
|
|
9
|
+
import { registerBackendTaskExecutor } from "./task_execute_registry.js";
|
|
10
|
+
|
|
11
|
+
const FALLBACK_DEFAULT_EXECUTOR: ExecutorBackend = "miniswe";
|
|
12
|
+
|
|
13
|
+
interface BackendTomlShape {
|
|
14
|
+
default_backend?: string;
|
|
15
|
+
env?: { shared_passthrough?: unknown };
|
|
16
|
+
backends?: Record<
|
|
17
|
+
string,
|
|
18
|
+
{
|
|
19
|
+
script_segments?: unknown;
|
|
20
|
+
passthrough_env?: unknown;
|
|
21
|
+
python_config_key?: string;
|
|
22
|
+
timeout_config_key?: string;
|
|
23
|
+
}
|
|
24
|
+
>;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function toStrings(value: unknown): string[] {
|
|
28
|
+
if (!Array.isArray(value)) return [];
|
|
29
|
+
return value
|
|
30
|
+
.filter((item): item is string => typeof item === "string")
|
|
31
|
+
.map((item) => item.trim())
|
|
32
|
+
.filter(Boolean);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function loadBackendToml(): BackendTomlShape {
|
|
36
|
+
const projectRoot = loadPushPalsConfig().projectRoot;
|
|
37
|
+
const path = resolve(projectRoot, "configs", "backend.toml");
|
|
38
|
+
try {
|
|
39
|
+
const parsed = Bun.TOML.parse(readFileSync(path, "utf-8")) as unknown;
|
|
40
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {};
|
|
41
|
+
return parsed as BackendTomlShape;
|
|
42
|
+
} catch {
|
|
43
|
+
return {};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const config = loadBackendToml();
|
|
48
|
+
const backendEntries = Object.entries(config.backends ?? {});
|
|
49
|
+
|
|
50
|
+
export const BACKEND_EXECUTOR_SCRIPT_SEGMENTS: Record<string, readonly string[]> =
|
|
51
|
+
Object.fromEntries(
|
|
52
|
+
backendEntries.map(([name, spec]) => [name, toStrings(spec?.script_segments)]),
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
export const EXECUTOR_BACKENDS = Object.keys(BACKEND_EXECUTOR_SCRIPT_SEGMENTS) as ExecutorBackend[];
|
|
56
|
+
|
|
57
|
+
export const DEFAULT_EXECUTOR = (
|
|
58
|
+
typeof config.default_backend === "string" &&
|
|
59
|
+
EXECUTOR_BACKENDS.includes(config.default_backend as ExecutorBackend)
|
|
60
|
+
? config.default_backend
|
|
61
|
+
: (EXECUTOR_BACKENDS[0] ?? FALLBACK_DEFAULT_EXECUTOR)
|
|
62
|
+
) as ExecutorBackend;
|
|
63
|
+
|
|
64
|
+
export const SHARED_DOCKER_PASSTHROUGH_ENV = toStrings(config.env?.shared_passthrough);
|
|
65
|
+
|
|
66
|
+
export const BACKEND_DOCKER_PASSTHROUGH_ENV: Record<string, readonly string[]> = Object.fromEntries(
|
|
67
|
+
backendEntries.map(([name, spec]) => [name, toStrings(spec?.passthrough_env)]),
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
export const BACKEND_RUNTIME_CONFIG_KEYS: Record<
|
|
71
|
+
string,
|
|
72
|
+
{ pythonKey: string; timeoutKey: string }
|
|
73
|
+
> = Object.fromEntries(
|
|
74
|
+
backendEntries.map(([name, spec]) => [
|
|
75
|
+
name,
|
|
76
|
+
{
|
|
77
|
+
pythonKey: spec?.python_config_key?.trim() || `${name}Python`,
|
|
78
|
+
timeoutKey: spec?.timeout_config_key?.trim() || `${name}TimeoutMs`,
|
|
79
|
+
},
|
|
80
|
+
]),
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
export const DOCKER_BACKENDS: readonly DockerBackendSpec[] = [
|
|
84
|
+
OPENHANDS_BACKEND,
|
|
85
|
+
MINISWE_BACKEND,
|
|
86
|
+
OPENAI_CODEX_BACKEND,
|
|
87
|
+
];
|
|
88
|
+
|
|
89
|
+
export function getDockerBackendSpec(name: ExecutorBackend): DockerBackendSpec {
|
|
90
|
+
const spec = DOCKER_BACKENDS.find((entry) => entry.name === name);
|
|
91
|
+
if (!spec) {
|
|
92
|
+
throw new Error(`Unknown docker backend: ${name}`);
|
|
93
|
+
}
|
|
94
|
+
return spec;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// ---- Auto-register task executors from backend modules ----------------------
|
|
98
|
+
// Each DockerBackendSpec provides a taskExecute hook. Register them so that
|
|
99
|
+
// execute_job.ts can discover executors via the registry without hardcoding
|
|
100
|
+
// backend names.
|
|
101
|
+
|
|
102
|
+
for (const backend of DOCKER_BACKENDS) {
|
|
103
|
+
registerBackendTaskExecutor(backend.name, backend.taskExecute);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export function getBackendTaskExecutorFromSpec(
|
|
107
|
+
name: ExecutorBackend,
|
|
108
|
+
): BackendTaskExecutor | undefined {
|
|
109
|
+
const spec = DOCKER_BACKENDS.find((entry) => entry.name === name);
|
|
110
|
+
return spec?.taskExecute ?? undefined;
|
|
111
|
+
}
|