agent-control-plane 0.4.9 → 0.7.0
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/README.md +109 -13
- package/npm/bin/agent-control-plane.js +1 -1
- package/package.json +39 -33
- package/tools/bin/debug-session.sh +106 -0
- package/tools/bin/flow-config-lib.sh +13 -3508
- package/tools/bin/flow-execution-lib.sh +243 -0
- package/tools/bin/flow-forge-lib.sh +1770 -0
- package/tools/bin/flow-profile-lib.sh +335 -0
- package/tools/bin/flow-provider-lib.sh +981 -0
- package/tools/bin/flow-runtime-doctor-linux.sh +136 -0
- package/tools/bin/flow-runtime-doctor.sh +5 -1
- package/tools/bin/flow-session-lib.sh +317 -0
- package/tools/bin/install-project-systemd.sh +255 -0
- package/tools/bin/project-runtimectl.sh +45 -0
- package/tools/bin/project-systemd-bootstrap.sh +74 -0
- package/tools/bin/uninstall-project-systemd.sh +87 -0
- package/tools/dashboard/app.js +238 -8
- package/tools/dashboard/issue_queue_state.py +101 -0
- package/tools/dashboard/requirements.txt +3 -0
- package/tools/dashboard/server.py +250 -30
- package/tools/dashboard/styles.css +526 -455
- package/tools/bin/agent-cleanup-worktree +0 -247
- package/tools/bin/agent-github-update-labels +0 -105
- package/tools/bin/agent-init-worktree +0 -216
- package/tools/bin/agent-project-archive-run +0 -52
- package/tools/bin/agent-project-capture-worker +0 -46
- package/tools/bin/agent-project-catch-up-issue-pr-links +0 -118
- package/tools/bin/agent-project-catch-up-merged-prs +0 -195
- package/tools/bin/agent-project-catch-up-scheduled-issue-retries +0 -123
- package/tools/bin/agent-project-cleanup-session +0 -513
- package/tools/bin/agent-project-detached-launch +0 -127
- package/tools/bin/agent-project-heartbeat-loop +0 -1029
- package/tools/bin/agent-project-open-issue-worktree +0 -89
- package/tools/bin/agent-project-open-pr-worktree +0 -80
- package/tools/bin/agent-project-publish-issue-pr +0 -468
- package/tools/bin/agent-project-reconcile-issue-session +0 -1409
- package/tools/bin/agent-project-reconcile-pr-session +0 -1288
- package/tools/bin/agent-project-retry-state +0 -158
- package/tools/bin/agent-project-run-claude-session +0 -805
- package/tools/bin/agent-project-run-codex-resilient +0 -963
- package/tools/bin/agent-project-run-codex-session +0 -435
- package/tools/bin/agent-project-run-kilo-session +0 -369
- package/tools/bin/agent-project-run-ollama-session +0 -658
- package/tools/bin/agent-project-run-openclaw-session +0 -1309
- package/tools/bin/agent-project-run-opencode-session +0 -377
- package/tools/bin/agent-project-run-pi-session +0 -479
- package/tools/bin/agent-project-sync-anchor-repo +0 -139
- package/tools/bin/agent-project-sync-source-repo-main +0 -163
- package/tools/bin/agent-project-worker-status +0 -188
- package/tools/bin/branch-verification-guard.sh +0 -364
- package/tools/bin/capture-worker.sh +0 -18
- package/tools/bin/cleanup-worktree.sh +0 -52
- package/tools/bin/codex-quota +0 -31
- package/tools/bin/create-follow-up-issue.sh +0 -114
- package/tools/bin/dashboard-launchd-bootstrap.sh +0 -50
- package/tools/bin/issue-publish-localization-guard.sh +0 -142
- package/tools/bin/issue-publish-scope-guard.sh +0 -242
- package/tools/bin/issue-requires-local-workspace-install.sh +0 -31
- package/tools/bin/issue-resource-class.sh +0 -12
- package/tools/bin/kick-scheduler.sh +0 -75
- package/tools/bin/label-follow-up-issues.sh +0 -14
- package/tools/bin/new-pr-worktree.sh +0 -50
- package/tools/bin/new-worktree.sh +0 -49
- package/tools/bin/pr-risk.sh +0 -12
- package/tools/bin/prepare-worktree.sh +0 -142
- package/tools/bin/provider-cooldown-state.sh +0 -204
- package/tools/bin/publish-issue-worker.sh +0 -31
- package/tools/bin/reconcile-bootstrap-lib.sh +0 -113
- package/tools/bin/reconcile-issue-worker.sh +0 -34
- package/tools/bin/reconcile-pr-worker.sh +0 -34
- package/tools/bin/record-verification.sh +0 -71
- package/tools/bin/render-flow-config.sh +0 -98
- package/tools/bin/resident-issue-controller-lib.sh +0 -448
- package/tools/bin/retry-state.sh +0 -31
- package/tools/bin/reuse-issue-worktree.sh +0 -121
- package/tools/bin/run-codex-bypass.sh +0 -3
- package/tools/bin/run-codex-safe.sh +0 -3
- package/tools/bin/run-codex-task.sh +0 -280
- package/tools/bin/serve-dashboard.sh +0 -5
- package/tools/bin/start-issue-worker.sh +0 -943
- package/tools/bin/start-pr-fix-worker.sh +0 -528
- package/tools/bin/start-pr-merge-repair-worker.sh +0 -8
- package/tools/bin/start-pr-review-worker.sh +0 -261
- package/tools/bin/start-resident-issue-loop.sh +0 -499
- package/tools/bin/update-github-labels.sh +0 -14
- package/tools/bin/worker-status.sh +0 -19
- package/tools/bin/workflow-catalog.sh +0 -77
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
|
|
4
|
-
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
5
|
-
# shellcheck source=/dev/null
|
|
6
|
-
source "${SCRIPT_DIR}/flow-config-lib.sh"
|
|
7
|
-
|
|
8
|
-
CONFIG_YAML="$(resolve_flow_config_yaml "${BASH_SOURCE[0]}")"
|
|
9
|
-
AGENT_REPO_ROOT="$(flow_resolve_agent_repo_root "${CONFIG_YAML}")"
|
|
10
|
-
CANONICAL_REPO_ROOT="$(flow_resolve_repo_root "${CONFIG_YAML}")"
|
|
11
|
-
DEFAULT_DEPENDENCY_SOURCE_ROOT="$CANONICAL_REPO_ROOT"
|
|
12
|
-
DEPENDENCY_SOURCE_ROOT="${ACP_DEPENDENCY_SOURCE_ROOT:-$DEFAULT_DEPENDENCY_SOURCE_ROOT}"
|
|
13
|
-
SYNC_DEPENDENCY_BASELINE_SCRIPT="${ACP_SYNC_DEPENDENCY_BASELINE_SCRIPT:-${SCRIPT_DIR}/sync-dependency-baseline.sh}"
|
|
14
|
-
PACKAGE_MANAGER_BIN="${ACP_PACKAGE_MANAGER_BIN:-pnpm}"
|
|
15
|
-
LOCAL_WORKSPACE_INSTALL="${ACP_WORKTREE_LOCAL_INSTALL:-false}"
|
|
16
|
-
WORKTREE="${1:?usage: prepare-worktree.sh WORKTREE}"
|
|
17
|
-
|
|
18
|
-
realpath_safe() {
|
|
19
|
-
local path="${1:-}"
|
|
20
|
-
[[ -n "$path" ]] || return 1
|
|
21
|
-
if command -v python3 >/dev/null 2>&1; then
|
|
22
|
-
python3 - "$path" <<'PY'
|
|
23
|
-
import os
|
|
24
|
-
import sys
|
|
25
|
-
print(os.path.realpath(sys.argv[1]))
|
|
26
|
-
PY
|
|
27
|
-
return
|
|
28
|
-
fi
|
|
29
|
-
cd "$path" 2>/dev/null && pwd -P
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
link_shared_path() {
|
|
33
|
-
local source_path="${1:?source path required}"
|
|
34
|
-
local target_path="${2:?target path required}"
|
|
35
|
-
|
|
36
|
-
[[ -e "$source_path" ]] || return 0
|
|
37
|
-
if [[ -L "$target_path" ]]; then
|
|
38
|
-
return 0
|
|
39
|
-
fi
|
|
40
|
-
if [[ -e "$target_path" ]]; then
|
|
41
|
-
return 0
|
|
42
|
-
fi
|
|
43
|
-
|
|
44
|
-
mkdir -p "$(dirname "$target_path")"
|
|
45
|
-
ln -s "$source_path" "$target_path"
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
dependency_source_ready() {
|
|
49
|
-
local repo_root="${1:?repo root required}"
|
|
50
|
-
local workspace_dir=""
|
|
51
|
-
|
|
52
|
-
[[ -e "$repo_root/node_modules" ]] || return 1
|
|
53
|
-
|
|
54
|
-
while IFS= read -r workspace_dir; do
|
|
55
|
-
[[ -n "$workspace_dir" ]] || continue
|
|
56
|
-
[[ -d "$workspace_dir" ]] || continue
|
|
57
|
-
[[ -e "$workspace_dir/node_modules" ]] || return 1
|
|
58
|
-
done < <(
|
|
59
|
-
find "$repo_root/apps" -mindepth 1 -maxdepth 1 -type d 2>/dev/null || true
|
|
60
|
-
find "$repo_root/packages" -mindepth 1 -maxdepth 1 -type d 2>/dev/null || true
|
|
61
|
-
)
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
link_workspace_node_modules() {
|
|
65
|
-
local dependency_root="${1:?dependency root required}"
|
|
66
|
-
local worktree_root="${2:?worktree root required}"
|
|
67
|
-
local workspace_dir=""
|
|
68
|
-
local relative_path=""
|
|
69
|
-
|
|
70
|
-
while IFS= read -r workspace_dir; do
|
|
71
|
-
[[ -n "$workspace_dir" ]] || continue
|
|
72
|
-
[[ -d "$workspace_dir/node_modules" ]] || continue
|
|
73
|
-
relative_path="${workspace_dir#${dependency_root}/}"
|
|
74
|
-
link_shared_path "$workspace_dir/node_modules" "$worktree_root/$relative_path/node_modules"
|
|
75
|
-
done < <(
|
|
76
|
-
find "$dependency_root/apps" -mindepth 1 -maxdepth 1 -type d 2>/dev/null || true
|
|
77
|
-
find "$dependency_root/packages" -mindepth 1 -maxdepth 1 -type d 2>/dev/null || true
|
|
78
|
-
)
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
configure_worktree_excludes() {
|
|
82
|
-
local worktree="${1:?worktree required}"
|
|
83
|
-
local exclude_file="${worktree}/.openclaw-artifacts/git-exclude"
|
|
84
|
-
|
|
85
|
-
cat >"$exclude_file" <<'EOF'
|
|
86
|
-
node_modules
|
|
87
|
-
apps/*/node_modules
|
|
88
|
-
packages/*/node_modules
|
|
89
|
-
.openclaw-artifacts
|
|
90
|
-
.openclaw
|
|
91
|
-
SOUL.md
|
|
92
|
-
TOOLS.md
|
|
93
|
-
IDENTITY.md
|
|
94
|
-
USER.md
|
|
95
|
-
HEARTBEAT.md
|
|
96
|
-
BOOTSTRAP.md
|
|
97
|
-
.agent-session.env
|
|
98
|
-
EOF
|
|
99
|
-
|
|
100
|
-
git -C "$worktree" config extensions.worktreeConfig true >/dev/null 2>&1 || true
|
|
101
|
-
git -C "$worktree" config --worktree core.excludesFile "$exclude_file"
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
WORKTREE_REAL="$(realpath_safe "$WORKTREE")"
|
|
105
|
-
CANONICAL_REAL="$(realpath_safe "$CANONICAL_REPO_ROOT")"
|
|
106
|
-
DEPENDENCY_REAL="$(realpath_safe "$DEPENDENCY_SOURCE_ROOT")"
|
|
107
|
-
|
|
108
|
-
if [[ -n "$CANONICAL_REAL" && "$WORKTREE_REAL" == "$CANONICAL_REAL" ]]; then
|
|
109
|
-
echo "refusing to prepare canonical checkout as worker worktree: $WORKTREE" >&2
|
|
110
|
-
exit 1
|
|
111
|
-
fi
|
|
112
|
-
|
|
113
|
-
if [[ -n "$DEPENDENCY_REAL" && "$WORKTREE_REAL" == "$DEPENDENCY_REAL" ]]; then
|
|
114
|
-
echo "refusing to prepare retained checkout as worker worktree: $WORKTREE" >&2
|
|
115
|
-
exit 1
|
|
116
|
-
fi
|
|
117
|
-
|
|
118
|
-
mkdir -p "$WORKTREE/.openclaw-artifacts"
|
|
119
|
-
configure_worktree_excludes "$WORKTREE"
|
|
120
|
-
|
|
121
|
-
if [[ -x "$SYNC_DEPENDENCY_BASELINE_SCRIPT" && "$DEPENDENCY_REAL" == "$CANONICAL_REAL" ]]; then
|
|
122
|
-
# Sync dependency baseline is non-fatal — worker can function without it
|
|
123
|
-
# (especially for repos with zero dependencies or external volume issues)
|
|
124
|
-
"$SYNC_DEPENDENCY_BASELINE_SCRIPT" >/dev/null 2>&1 || true
|
|
125
|
-
fi
|
|
126
|
-
|
|
127
|
-
if [[ "$LOCAL_WORKSPACE_INSTALL" == "true" ]]; then
|
|
128
|
-
(
|
|
129
|
-
cd "$WORKTREE"
|
|
130
|
-
CI=1 "$PACKAGE_MANAGER_BIN" install --frozen-lockfile --prefer-offline
|
|
131
|
-
)
|
|
132
|
-
else
|
|
133
|
-
if ! dependency_source_ready "$DEPENDENCY_SOURCE_ROOT"; then
|
|
134
|
-
echo "dependency source is missing required node_modules or built workspace artifacts: $DEPENDENCY_SOURCE_ROOT" >&2
|
|
135
|
-
exit 1
|
|
136
|
-
fi
|
|
137
|
-
link_shared_path "$DEPENDENCY_SOURCE_ROOT/node_modules" "$WORKTREE/node_modules"
|
|
138
|
-
link_workspace_node_modules "$DEPENDENCY_SOURCE_ROOT" "$WORKTREE"
|
|
139
|
-
fi
|
|
140
|
-
|
|
141
|
-
printf 'WORKTREE=%s\n' "$WORKTREE"
|
|
142
|
-
printf 'SANDBOX_ARTIFACT_DIR=%s\n' "$WORKTREE/.openclaw-artifacts"
|
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
|
|
4
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
5
|
-
# shellcheck source=/dev/null
|
|
6
|
-
source "${SCRIPT_DIR}/flow-config-lib.sh"
|
|
7
|
-
|
|
8
|
-
usage() {
|
|
9
|
-
cat <<'EOF'
|
|
10
|
-
Usage:
|
|
11
|
-
provider-cooldown-state.sh [backend] [model] get|schedule|clear [reason]
|
|
12
|
-
|
|
13
|
-
Examples:
|
|
14
|
-
provider-cooldown-state.sh get
|
|
15
|
-
provider-cooldown-state.sh openclaw openrouter/qwen/qwen3.6-plus-preview:free schedule provider-quota-limit
|
|
16
|
-
EOF
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
backend=""
|
|
20
|
-
model=""
|
|
21
|
-
action=""
|
|
22
|
-
reason=""
|
|
23
|
-
label=""
|
|
24
|
-
|
|
25
|
-
case "$#" in
|
|
26
|
-
1)
|
|
27
|
-
action="${1:-}"
|
|
28
|
-
;;
|
|
29
|
-
2)
|
|
30
|
-
action="${1:-}"
|
|
31
|
-
reason="${2:-}"
|
|
32
|
-
;;
|
|
33
|
-
3)
|
|
34
|
-
backend="${1:-}"
|
|
35
|
-
model="${2:-}"
|
|
36
|
-
action="${3:-}"
|
|
37
|
-
;;
|
|
38
|
-
4)
|
|
39
|
-
backend="${1:-}"
|
|
40
|
-
model="${2:-}"
|
|
41
|
-
action="${3:-}"
|
|
42
|
-
reason="${4:-}"
|
|
43
|
-
;;
|
|
44
|
-
*)
|
|
45
|
-
usage >&2
|
|
46
|
-
exit 1
|
|
47
|
-
;;
|
|
48
|
-
esac
|
|
49
|
-
|
|
50
|
-
CONFIG_YAML="$(resolve_flow_config_yaml "${BASH_SOURCE[0]}")"
|
|
51
|
-
flow_export_execution_env "${CONFIG_YAML}"
|
|
52
|
-
STATE_ROOT="$(flow_resolve_state_root "${CONFIG_YAML}")"
|
|
53
|
-
COOLDOWNS="$(flow_resolve_provider_quota_cooldowns "${CONFIG_YAML}")"
|
|
54
|
-
|
|
55
|
-
resolve_backend() {
|
|
56
|
-
local raw_backend="${1:-}"
|
|
57
|
-
|
|
58
|
-
if [[ -n "${raw_backend}" ]]; then
|
|
59
|
-
printf '%s\n' "${raw_backend}"
|
|
60
|
-
return 0
|
|
61
|
-
fi
|
|
62
|
-
|
|
63
|
-
if [[ -n "${CODING_WORKER:-}" ]]; then
|
|
64
|
-
printf '%s\n' "${CODING_WORKER}"
|
|
65
|
-
return 0
|
|
66
|
-
fi
|
|
67
|
-
|
|
68
|
-
if [[ -n "${ACP_ACTIVE_PROVIDER_BACKEND:-}" ]]; then
|
|
69
|
-
printf '%s\n' "${ACP_ACTIVE_PROVIDER_BACKEND:-}"
|
|
70
|
-
return 0
|
|
71
|
-
fi
|
|
72
|
-
|
|
73
|
-
if [[ -n "${ACP_CODING_WORKER:-}" ]]; then
|
|
74
|
-
printf '%s\n' "${ACP_CODING_WORKER:-}"
|
|
75
|
-
return 0
|
|
76
|
-
fi
|
|
77
|
-
|
|
78
|
-
flow_config_get "${CONFIG_YAML}" "execution.coding_worker"
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
resolve_codex_label() {
|
|
82
|
-
local configured_label="${ACP_ACTIVE_PROVIDER_LABEL:-}"
|
|
83
|
-
local codex_quota_bin=""
|
|
84
|
-
local active_label=""
|
|
85
|
-
|
|
86
|
-
if [[ -n "${configured_label}" ]]; then
|
|
87
|
-
printf '%s\n' "${configured_label}"
|
|
88
|
-
return 0
|
|
89
|
-
fi
|
|
90
|
-
|
|
91
|
-
if [[ -n "${ACP_CODEX_QUOTA_LABEL:-}" ]]; then
|
|
92
|
-
printf '%s\n' "${ACP_CODEX_QUOTA_LABEL:-}"
|
|
93
|
-
return 0
|
|
94
|
-
fi
|
|
95
|
-
|
|
96
|
-
codex_quota_bin="$(flow_resolve_codex_quota_bin "${SCRIPT_DIR}")"
|
|
97
|
-
if [[ -n "${codex_quota_bin}" && -x "${codex_quota_bin}" ]]; then
|
|
98
|
-
active_label="$("${codex_quota_bin}" codex list --json 2>/dev/null | jq -r '.activeInfo.trackedLabel // .activeInfo.activeLabel // empty' 2>/dev/null || true)"
|
|
99
|
-
if [[ -n "${active_label}" ]]; then
|
|
100
|
-
printf '%s\n' "${active_label}"
|
|
101
|
-
return 0
|
|
102
|
-
fi
|
|
103
|
-
fi
|
|
104
|
-
|
|
105
|
-
return 1
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
resolve_model() {
|
|
109
|
-
local resolved_backend="${1:?backend required}"
|
|
110
|
-
local raw_model="${2:-}"
|
|
111
|
-
local active_provider_model="${ACP_ACTIVE_PROVIDER_MODEL:-}"
|
|
112
|
-
|
|
113
|
-
if [[ -n "${raw_model}" ]]; then
|
|
114
|
-
printf '%s\n' "${raw_model}"
|
|
115
|
-
return 0
|
|
116
|
-
fi
|
|
117
|
-
|
|
118
|
-
case "${resolved_backend}" in
|
|
119
|
-
openclaw)
|
|
120
|
-
if [[ -n "${OPENCLAW_MODEL:-}" ]]; then
|
|
121
|
-
printf '%s\n' "${OPENCLAW_MODEL}"
|
|
122
|
-
elif [[ -n "${active_provider_model}" ]]; then
|
|
123
|
-
printf '%s\n' "${active_provider_model}"
|
|
124
|
-
elif [[ -n "${ACP_OPENCLAW_MODEL:-}" ]]; then
|
|
125
|
-
printf '%s\n' "${ACP_OPENCLAW_MODEL:-}"
|
|
126
|
-
else
|
|
127
|
-
flow_config_get "${CONFIG_YAML}" "execution.openclaw.model"
|
|
128
|
-
fi
|
|
129
|
-
;;
|
|
130
|
-
claude)
|
|
131
|
-
if [[ -n "${CLAUDE_MODEL:-}" ]]; then
|
|
132
|
-
printf '%s\n' "${CLAUDE_MODEL}"
|
|
133
|
-
elif [[ -n "${active_provider_model}" ]]; then
|
|
134
|
-
printf '%s\n' "${active_provider_model}"
|
|
135
|
-
elif [[ -n "${ACP_CLAUDE_MODEL:-}" ]]; then
|
|
136
|
-
printf '%s\n' "${ACP_CLAUDE_MODEL:-}"
|
|
137
|
-
else
|
|
138
|
-
flow_config_get "${CONFIG_YAML}" "execution.claude.model"
|
|
139
|
-
fi
|
|
140
|
-
;;
|
|
141
|
-
codex)
|
|
142
|
-
if [[ -n "${CODEX_PROFILE_SAFE:-}" ]]; then
|
|
143
|
-
printf '%s\n' "${CODEX_PROFILE_SAFE}"
|
|
144
|
-
elif [[ -n "${active_provider_model}" ]]; then
|
|
145
|
-
printf '%s\n' "${active_provider_model}"
|
|
146
|
-
elif [[ -n "${ACP_CODEX_PROFILE_SAFE:-}" ]]; then
|
|
147
|
-
printf '%s\n' "${ACP_CODEX_PROFILE_SAFE:-}"
|
|
148
|
-
else
|
|
149
|
-
flow_config_get "${CONFIG_YAML}" "execution.safe_profile"
|
|
150
|
-
fi
|
|
151
|
-
;;
|
|
152
|
-
*)
|
|
153
|
-
printf '\n'
|
|
154
|
-
;;
|
|
155
|
-
esac
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
backend="$(resolve_backend "${backend}")"
|
|
159
|
-
if [[ -z "${backend}" ]]; then
|
|
160
|
-
echo "provider backend is required" >&2
|
|
161
|
-
exit 1
|
|
162
|
-
fi
|
|
163
|
-
|
|
164
|
-
model="$(resolve_model "${backend}" "${model}")"
|
|
165
|
-
if [[ -z "${model}" ]]; then
|
|
166
|
-
echo "provider model/profile is required for backend ${backend}" >&2
|
|
167
|
-
exit 1
|
|
168
|
-
fi
|
|
169
|
-
|
|
170
|
-
case "${action}" in
|
|
171
|
-
get|schedule|clear) ;;
|
|
172
|
-
*)
|
|
173
|
-
usage >&2
|
|
174
|
-
exit 1
|
|
175
|
-
;;
|
|
176
|
-
esac
|
|
177
|
-
|
|
178
|
-
if [[ "${backend}" == "codex" ]]; then
|
|
179
|
-
label="$(resolve_codex_label || true)"
|
|
180
|
-
fi
|
|
181
|
-
|
|
182
|
-
provider_key_source="${backend}-${model}"
|
|
183
|
-
if [[ "${backend}" == "codex" && -n "${label}" ]]; then
|
|
184
|
-
provider_key_source="${provider_key_source}-${label}"
|
|
185
|
-
fi
|
|
186
|
-
|
|
187
|
-
provider_key="$(flow_sanitize_provider_key "${provider_key_source}")"
|
|
188
|
-
out="$(
|
|
189
|
-
ACP_STATE_ROOT="${STATE_ROOT}" \
|
|
190
|
-
ACP_PROVIDER_QUOTA_COOLDOWNS="${COOLDOWNS}" \
|
|
191
|
-
bash "${SCRIPT_DIR}/agent-project-retry-state" \
|
|
192
|
-
--state-root "${STATE_ROOT}" \
|
|
193
|
-
--kind provider \
|
|
194
|
-
--item-id "${provider_key}" \
|
|
195
|
-
--action "${action}" \
|
|
196
|
-
--reason "${reason}" \
|
|
197
|
-
--cooldowns "${COOLDOWNS}"
|
|
198
|
-
)"
|
|
199
|
-
|
|
200
|
-
printf 'BACKEND=%s\n' "${backend}"
|
|
201
|
-
printf 'MODEL=%s\n' "${model}"
|
|
202
|
-
printf 'LABEL=%s\n' "${label}"
|
|
203
|
-
printf 'PROVIDER_KEY=%s\n' "${provider_key}"
|
|
204
|
-
printf '%s\n' "${out}"
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
|
|
4
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
5
|
-
# shellcheck source=/dev/null
|
|
6
|
-
source "${SCRIPT_DIR}/flow-config-lib.sh"
|
|
7
|
-
|
|
8
|
-
SESSION="${1:?usage: publish-issue-worker.sh SESSION [--dry-run]}"
|
|
9
|
-
DRY_RUN="${2:-}"
|
|
10
|
-
FLOW_SKILL_DIR="$(resolve_flow_skill_dir "${BASH_SOURCE[0]}")"
|
|
11
|
-
FLOW_TOOLS_DIR="${FLOW_SKILL_DIR}/tools/bin"
|
|
12
|
-
CONFIG_YAML="$(resolve_flow_config_yaml "${BASH_SOURCE[0]}")"
|
|
13
|
-
AGENT_ROOT="$(flow_resolve_agent_root "${CONFIG_YAML}")"
|
|
14
|
-
RUNS_ROOT="$(flow_resolve_runs_root "${CONFIG_YAML}")"
|
|
15
|
-
HISTORY_ROOT="$(flow_resolve_history_root "${CONFIG_YAML}")"
|
|
16
|
-
REPO_SLUG="$(flow_resolve_repo_slug "${CONFIG_YAML}")"
|
|
17
|
-
BASE_BRANCH="$(flow_resolve_default_branch "${CONFIG_YAML}")"
|
|
18
|
-
|
|
19
|
-
ARGS=(
|
|
20
|
-
--repo-slug "$REPO_SLUG"
|
|
21
|
-
--runs-root "$RUNS_ROOT"
|
|
22
|
-
--history-root "$HISTORY_ROOT"
|
|
23
|
-
--session "$SESSION"
|
|
24
|
-
--base-branch "$BASE_BRANCH"
|
|
25
|
-
--remote "origin"
|
|
26
|
-
)
|
|
27
|
-
if [[ "$DRY_RUN" == "--dry-run" ]]; then
|
|
28
|
-
ARGS+=(--dry-run)
|
|
29
|
-
fi
|
|
30
|
-
|
|
31
|
-
bash "${FLOW_TOOLS_DIR}/agent-project-publish-issue-pr" "${ARGS[@]}"
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# reconcile-bootstrap-lib.sh — shared bootstrap helpers for reconcile scripts.
|
|
3
|
-
# Sourced by both agent-project-reconcile-pr-session and
|
|
4
|
-
# agent-project-reconcile-issue-session to avoid duplicating the bootstrap
|
|
5
|
-
# preamble.
|
|
6
|
-
|
|
7
|
-
bootstrap_flow_shell_lib() {
|
|
8
|
-
local candidate=""
|
|
9
|
-
local skill_name=""
|
|
10
|
-
|
|
11
|
-
for candidate in \
|
|
12
|
-
"${SCRIPT_DIR}/flow-shell-lib.sh" \
|
|
13
|
-
"${AGENT_CONTROL_PLANE_ROOT:-}/tools/bin/flow-shell-lib.sh" \
|
|
14
|
-
"${ACP_ROOT:-}/tools/bin/flow-shell-lib.sh" \
|
|
15
|
-
"${F_LOSNING_FLOW_ROOT:-}/tools/bin/flow-shell-lib.sh" \
|
|
16
|
-
"${AGENT_FLOW_SKILL_ROOT:-}/tools/bin/flow-shell-lib.sh" \
|
|
17
|
-
"${SHARED_AGENT_HOME:-}/tools/bin/flow-shell-lib.sh" \
|
|
18
|
-
"$(pwd)/tools/bin/flow-shell-lib.sh"; do
|
|
19
|
-
if [[ -n "${candidate}" && -f "${candidate}" ]]; then
|
|
20
|
-
printf '%s\n' "${candidate}"
|
|
21
|
-
return 0
|
|
22
|
-
fi
|
|
23
|
-
done
|
|
24
|
-
|
|
25
|
-
if [[ -n "${SHARED_AGENT_HOME:-}" ]]; then
|
|
26
|
-
for skill_name in "${AGENT_CONTROL_PLANE_SKILL_NAME:-agent-control-plane}" "${AGENT_CONTROL_PLANE_COMPAT_ALIAS:-}"; do
|
|
27
|
-
[[ -n "${skill_name}" ]] || continue
|
|
28
|
-
candidate="${SHARED_AGENT_HOME}/skills/openclaw/${skill_name}/tools/bin/flow-shell-lib.sh"
|
|
29
|
-
if [[ -f "${candidate}" ]]; then
|
|
30
|
-
printf '%s\n' "${candidate}"
|
|
31
|
-
return 0
|
|
32
|
-
fi
|
|
33
|
-
done
|
|
34
|
-
fi
|
|
35
|
-
|
|
36
|
-
echo "unable to locate flow-shell-lib.sh for reconcile bootstrap" >&2
|
|
37
|
-
return 1
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
FLOW_SHELL_LIB_PATH="$(bootstrap_flow_shell_lib)"
|
|
41
|
-
BOOTSTRAP_TOOLS_DIR="$(cd "$(dirname "${FLOW_SHELL_LIB_PATH}")" && pwd)"
|
|
42
|
-
# shellcheck source=/dev/null
|
|
43
|
-
source "${FLOW_SHELL_LIB_PATH}"
|
|
44
|
-
|
|
45
|
-
resolve_reconcile_tools_dir() {
|
|
46
|
-
local candidate_root=""
|
|
47
|
-
local skill_name=""
|
|
48
|
-
|
|
49
|
-
for candidate_root in \
|
|
50
|
-
"${AGENT_CONTROL_PLANE_ROOT:-}" \
|
|
51
|
-
"${ACP_ROOT:-}" \
|
|
52
|
-
"${F_LOSNING_FLOW_ROOT:-}" \
|
|
53
|
-
"${AGENT_FLOW_SKILL_ROOT:-}"; do
|
|
54
|
-
if [[ -n "${candidate_root}" && -d "${candidate_root}/tools/bin" ]]; then
|
|
55
|
-
printf '%s/tools/bin\n' "${candidate_root}"
|
|
56
|
-
return 0
|
|
57
|
-
fi
|
|
58
|
-
done
|
|
59
|
-
|
|
60
|
-
if [[ -n "${SHARED_AGENT_HOME:-}" ]]; then
|
|
61
|
-
if [[ -d "${SHARED_AGENT_HOME}/tools/bin" ]]; then
|
|
62
|
-
printf '%s/tools/bin\n' "${SHARED_AGENT_HOME}"
|
|
63
|
-
return 0
|
|
64
|
-
fi
|
|
65
|
-
for skill_name in "${AGENT_CONTROL_PLANE_SKILL_NAME:-agent-control-plane}" "${AGENT_CONTROL_PLANE_COMPAT_ALIAS:-}"; do
|
|
66
|
-
[[ -n "${skill_name}" ]] || continue
|
|
67
|
-
candidate_root="${SHARED_AGENT_HOME}/skills/openclaw/${skill_name}"
|
|
68
|
-
if [[ -d "${candidate_root}/tools/bin" ]]; then
|
|
69
|
-
printf '%s/tools/bin\n' "${candidate_root}"
|
|
70
|
-
return 0
|
|
71
|
-
fi
|
|
72
|
-
done
|
|
73
|
-
fi
|
|
74
|
-
|
|
75
|
-
if [[ -d "${SCRIPT_DIR}" ]]; then
|
|
76
|
-
printf '%s\n' "${SCRIPT_DIR}"
|
|
77
|
-
return 0
|
|
78
|
-
fi
|
|
79
|
-
|
|
80
|
-
printf '%s\n' "${BOOTSTRAP_TOOLS_DIR}"
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
shared_tools_dir="$(resolve_reconcile_tools_dir)"
|
|
84
|
-
resolve_reconcile_helper_path() {
|
|
85
|
-
local helper_name="${1:?helper name required}"
|
|
86
|
-
local candidate=""
|
|
87
|
-
|
|
88
|
-
for candidate in \
|
|
89
|
-
"${SCRIPT_DIR}/${helper_name}" \
|
|
90
|
-
"${BOOTSTRAP_TOOLS_DIR}/${helper_name}" \
|
|
91
|
-
"${shared_tools_dir}/${helper_name}"; do
|
|
92
|
-
if [[ -n "${candidate}" && -f "${candidate}" ]]; then
|
|
93
|
-
printf '%s\n' "${candidate}"
|
|
94
|
-
return 0
|
|
95
|
-
fi
|
|
96
|
-
done
|
|
97
|
-
|
|
98
|
-
echo "unable to locate ${helper_name} for reconcile bootstrap" >&2
|
|
99
|
-
return 1
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
FLOW_CONFIG_LIB_PATH="$(resolve_reconcile_helper_path "flow-config-lib.sh")"
|
|
103
|
-
# shellcheck source=/dev/null
|
|
104
|
-
source "${FLOW_CONFIG_LIB_PATH}"
|
|
105
|
-
|
|
106
|
-
require_transition() {
|
|
107
|
-
local step="${1:?step required}"
|
|
108
|
-
shift
|
|
109
|
-
if ! "$@"; then
|
|
110
|
-
echo "reconcile transition failed: ${step}" >&2
|
|
111
|
-
exit 1
|
|
112
|
-
fi
|
|
113
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
|
|
4
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
5
|
-
# shellcheck source=/dev/null
|
|
6
|
-
source "${SCRIPT_DIR}/flow-shell-lib.sh"
|
|
7
|
-
# shellcheck source=/dev/null
|
|
8
|
-
source "${SCRIPT_DIR}/flow-config-lib.sh"
|
|
9
|
-
|
|
10
|
-
SESSION="${1:?usage: reconcile-issue-worker.sh SESSION}"
|
|
11
|
-
WORKSPACE_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
|
12
|
-
CONFIG_YAML="$(resolve_flow_config_yaml "${BASH_SOURCE[0]}")"
|
|
13
|
-
AGENT_ROOT="$(flow_resolve_agent_root "${CONFIG_YAML}")"
|
|
14
|
-
RUNS_ROOT="$(flow_resolve_runs_root "${CONFIG_YAML}")"
|
|
15
|
-
HISTORY_ROOT="$(flow_resolve_history_root "${CONFIG_YAML}")"
|
|
16
|
-
REPO_SLUG="$(flow_resolve_repo_slug "${CONFIG_YAML}")"
|
|
17
|
-
AGENT_REPO_ROOT="$(flow_resolve_agent_repo_root "${CONFIG_YAML}")"
|
|
18
|
-
FLOW_SKILL_DIR="$(resolve_flow_skill_dir "${BASH_SOURCE[0]}")"
|
|
19
|
-
FLOW_TOOLS_DIR="${FLOW_SKILL_DIR}/tools/bin"
|
|
20
|
-
HOOK_FILE="${FLOW_SKILL_DIR}/hooks/issue-reconcile-hooks.sh"
|
|
21
|
-
|
|
22
|
-
ACP_AGENT_ROOT="$AGENT_ROOT" \
|
|
23
|
-
ACP_RUNS_ROOT="$RUNS_ROOT" \
|
|
24
|
-
ACP_HISTORY_ROOT="$HISTORY_ROOT" \
|
|
25
|
-
ACP_REPO_SLUG="$REPO_SLUG" \
|
|
26
|
-
ACP_AGENT_REPO_ROOT="$AGENT_REPO_ROOT" \
|
|
27
|
-
F_LOSNING_RUNS_ROOT="$RUNS_ROOT" \
|
|
28
|
-
bash "${FLOW_TOOLS_DIR}/agent-project-reconcile-issue-session" \
|
|
29
|
-
--session "$SESSION" \
|
|
30
|
-
--repo-slug "$REPO_SLUG" \
|
|
31
|
-
--repo-root "$AGENT_REPO_ROOT" \
|
|
32
|
-
--runs-root "$RUNS_ROOT" \
|
|
33
|
-
--history-root "$HISTORY_ROOT" \
|
|
34
|
-
--hook-file "$HOOK_FILE"
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
|
|
4
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
5
|
-
# shellcheck source=/dev/null
|
|
6
|
-
source "${SCRIPT_DIR}/flow-shell-lib.sh"
|
|
7
|
-
# shellcheck source=/dev/null
|
|
8
|
-
source "${SCRIPT_DIR}/flow-config-lib.sh"
|
|
9
|
-
|
|
10
|
-
SESSION="${1:?usage: reconcile-pr-worker.sh SESSION}"
|
|
11
|
-
WORKSPACE_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
|
12
|
-
CONFIG_YAML="$(resolve_flow_config_yaml "${BASH_SOURCE[0]}")"
|
|
13
|
-
AGENT_ROOT="$(flow_resolve_agent_root "${CONFIG_YAML}")"
|
|
14
|
-
RUNS_ROOT="$(flow_resolve_runs_root "${CONFIG_YAML}")"
|
|
15
|
-
HISTORY_ROOT="$(flow_resolve_history_root "${CONFIG_YAML}")"
|
|
16
|
-
REPO_SLUG="$(flow_resolve_repo_slug "${CONFIG_YAML}")"
|
|
17
|
-
AGENT_REPO_ROOT="$(flow_resolve_agent_repo_root "${CONFIG_YAML}")"
|
|
18
|
-
FLOW_SKILL_DIR="$(resolve_flow_skill_dir "${BASH_SOURCE[0]}")"
|
|
19
|
-
FLOW_TOOLS_DIR="${FLOW_SKILL_DIR}/tools/bin"
|
|
20
|
-
HOOK_FILE="${FLOW_SKILL_DIR}/hooks/pr-reconcile-hooks.sh"
|
|
21
|
-
|
|
22
|
-
ACP_AGENT_ROOT="$AGENT_ROOT" \
|
|
23
|
-
ACP_RUNS_ROOT="$RUNS_ROOT" \
|
|
24
|
-
ACP_HISTORY_ROOT="$HISTORY_ROOT" \
|
|
25
|
-
ACP_REPO_SLUG="$REPO_SLUG" \
|
|
26
|
-
ACP_AGENT_REPO_ROOT="$AGENT_REPO_ROOT" \
|
|
27
|
-
F_LOSNING_RUNS_ROOT="$RUNS_ROOT" \
|
|
28
|
-
bash "${FLOW_TOOLS_DIR}/agent-project-reconcile-pr-session" \
|
|
29
|
-
--session "$SESSION" \
|
|
30
|
-
--repo-slug "$REPO_SLUG" \
|
|
31
|
-
--repo-root "$AGENT_REPO_ROOT" \
|
|
32
|
-
--runs-root "$RUNS_ROOT" \
|
|
33
|
-
--history-root "$HISTORY_ROOT" \
|
|
34
|
-
--hook-file "$HOOK_FILE"
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
|
|
4
|
-
usage() {
|
|
5
|
-
cat <<'EOF'
|
|
6
|
-
Usage:
|
|
7
|
-
record-verification.sh --command <shell command> [--status pass|fail] [--run-dir <path>] [--note <text>]
|
|
8
|
-
|
|
9
|
-
Append one structured verification entry to verification.jsonl for the current
|
|
10
|
-
worker run. Defaults to the sandbox run directory exposed by the worker env.
|
|
11
|
-
EOF
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
run_dir="${ACP_RUN_DIR:-${F_LOSNING_RUN_DIR:-${AGENT_PROJECT_RUN_DIR:-}}}"
|
|
15
|
-
status="pass"
|
|
16
|
-
command_text=""
|
|
17
|
-
note=""
|
|
18
|
-
|
|
19
|
-
while [[ $# -gt 0 ]]; do
|
|
20
|
-
case "$1" in
|
|
21
|
-
--run-dir) run_dir="${2:-}"; shift 2 ;;
|
|
22
|
-
--status) status="${2:-}"; shift 2 ;;
|
|
23
|
-
--command) command_text="${2:-}"; shift 2 ;;
|
|
24
|
-
--note) note="${2:-}"; shift 2 ;;
|
|
25
|
-
--help|-h) usage; exit 0 ;;
|
|
26
|
-
*)
|
|
27
|
-
echo "Unknown argument: $1" >&2
|
|
28
|
-
usage >&2
|
|
29
|
-
exit 1
|
|
30
|
-
;;
|
|
31
|
-
esac
|
|
32
|
-
done
|
|
33
|
-
|
|
34
|
-
if [[ -z "$run_dir" || -z "$command_text" ]]; then
|
|
35
|
-
usage >&2
|
|
36
|
-
exit 1
|
|
37
|
-
fi
|
|
38
|
-
|
|
39
|
-
case "$status" in
|
|
40
|
-
pass|fail) ;;
|
|
41
|
-
*)
|
|
42
|
-
echo "Unsupported status: $status" >&2
|
|
43
|
-
exit 1
|
|
44
|
-
;;
|
|
45
|
-
esac
|
|
46
|
-
|
|
47
|
-
mkdir -p "$run_dir"
|
|
48
|
-
|
|
49
|
-
RUN_DIR="$run_dir" STATUS="$status" COMMAND_TEXT="$command_text" NOTE="$note" node <<'EOF'
|
|
50
|
-
const fs = require('fs');
|
|
51
|
-
const path = require('path');
|
|
52
|
-
|
|
53
|
-
const runDir = process.env.RUN_DIR;
|
|
54
|
-
const status = process.env.STATUS;
|
|
55
|
-
const command = process.env.COMMAND_TEXT;
|
|
56
|
-
const note = process.env.NOTE || '';
|
|
57
|
-
|
|
58
|
-
const entry = {
|
|
59
|
-
timestamp: new Date().toISOString(),
|
|
60
|
-
status,
|
|
61
|
-
command,
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
if (note) {
|
|
65
|
-
entry.note = note;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const file = path.join(runDir, 'verification.jsonl');
|
|
69
|
-
fs.appendFileSync(file, `${JSON.stringify(entry)}\n`);
|
|
70
|
-
process.stdout.write(`${file}\n`);
|
|
71
|
-
EOF
|