agent-control-plane 0.3.0 → 0.6.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.
Files changed (106) hide show
  1. package/README.md +141 -28
  2. package/assets/workflow-catalog.json +1 -1
  3. package/bin/pr-risk.sh +22 -7
  4. package/bin/sync-pr-labels.sh +1 -1
  5. package/hooks/heartbeat-hooks.sh +125 -12
  6. package/hooks/issue-reconcile-hooks.sh +1 -1
  7. package/hooks/pr-reconcile-hooks.sh +1 -1
  8. package/npm/bin/agent-control-plane.js +257 -59
  9. package/package.json +39 -32
  10. package/tools/bin/debug-session.sh +106 -0
  11. package/tools/bin/flow-config-lib.sh +1203 -60
  12. package/tools/bin/flow-runtime-doctor-linux.sh +136 -0
  13. package/tools/bin/flow-runtime-doctor.sh +5 -1
  14. package/tools/bin/flow-shell-lib.sh +32 -0
  15. package/tools/bin/github-core-rate-limit-state.sh +77 -0
  16. package/tools/bin/github-write-outbox.sh +470 -0
  17. package/tools/bin/heartbeat-loop-scheduling-lib.sh +7 -7
  18. package/tools/bin/heartbeat-safe-auto.sh +42 -0
  19. package/tools/bin/install-project-launchd.sh +17 -2
  20. package/tools/bin/install-project-systemd.sh +255 -0
  21. package/tools/bin/project-init.sh +21 -1
  22. package/tools/bin/project-launchd-bootstrap.sh +5 -1
  23. package/tools/bin/project-runtimectl.sh +91 -2
  24. package/tools/bin/project-systemd-bootstrap.sh +74 -0
  25. package/tools/bin/scaffold-profile.sh +61 -3
  26. package/tools/bin/uninstall-project-systemd.sh +87 -0
  27. package/tools/dashboard/app.js +228 -6
  28. package/tools/dashboard/dashboard_snapshot.py +55 -0
  29. package/tools/dashboard/issue_queue_state.py +101 -0
  30. package/tools/dashboard/server.py +123 -1
  31. package/tools/dashboard/styles.css +526 -455
  32. package/tools/templates/pr-fix-template.md +3 -1
  33. package/tools/templates/pr-merge-repair-template.md +2 -1
  34. package/references/architecture.md +0 -217
  35. package/references/commands.md +0 -128
  36. package/references/control-plane-map.md +0 -124
  37. package/references/docs-map.md +0 -73
  38. package/references/release-checklist.md +0 -65
  39. package/references/repo-map.md +0 -36
  40. package/tools/bin/agent-cleanup-worktree +0 -247
  41. package/tools/bin/agent-github-update-labels +0 -71
  42. package/tools/bin/agent-init-worktree +0 -216
  43. package/tools/bin/agent-project-archive-run +0 -52
  44. package/tools/bin/agent-project-capture-worker +0 -46
  45. package/tools/bin/agent-project-catch-up-issue-pr-links +0 -118
  46. package/tools/bin/agent-project-catch-up-merged-prs +0 -194
  47. package/tools/bin/agent-project-catch-up-scheduled-issue-retries +0 -123
  48. package/tools/bin/agent-project-cleanup-session +0 -513
  49. package/tools/bin/agent-project-detached-launch +0 -127
  50. package/tools/bin/agent-project-heartbeat-loop +0 -1029
  51. package/tools/bin/agent-project-open-issue-worktree +0 -89
  52. package/tools/bin/agent-project-open-pr-worktree +0 -80
  53. package/tools/bin/agent-project-publish-issue-pr +0 -465
  54. package/tools/bin/agent-project-reconcile-issue-session +0 -1398
  55. package/tools/bin/agent-project-reconcile-pr-session +0 -1230
  56. package/tools/bin/agent-project-retry-state +0 -147
  57. package/tools/bin/agent-project-run-claude-session +0 -805
  58. package/tools/bin/agent-project-run-codex-resilient +0 -955
  59. package/tools/bin/agent-project-run-codex-session +0 -435
  60. package/tools/bin/agent-project-run-kilo-session +0 -369
  61. package/tools/bin/agent-project-run-ollama-session +0 -658
  62. package/tools/bin/agent-project-run-openclaw-session +0 -1309
  63. package/tools/bin/agent-project-run-opencode-session +0 -377
  64. package/tools/bin/agent-project-run-pi-session +0 -479
  65. package/tools/bin/agent-project-sync-anchor-repo +0 -139
  66. package/tools/bin/agent-project-worker-status +0 -188
  67. package/tools/bin/branch-verification-guard.sh +0 -364
  68. package/tools/bin/capture-worker.sh +0 -18
  69. package/tools/bin/cleanup-worktree.sh +0 -52
  70. package/tools/bin/codex-quota +0 -31
  71. package/tools/bin/create-follow-up-issue.sh +0 -114
  72. package/tools/bin/dashboard-launchd-bootstrap.sh +0 -50
  73. package/tools/bin/issue-publish-localization-guard.sh +0 -142
  74. package/tools/bin/issue-publish-scope-guard.sh +0 -242
  75. package/tools/bin/issue-requires-local-workspace-install.sh +0 -31
  76. package/tools/bin/issue-resource-class.sh +0 -12
  77. package/tools/bin/kick-scheduler.sh +0 -75
  78. package/tools/bin/label-follow-up-issues.sh +0 -14
  79. package/tools/bin/new-pr-worktree.sh +0 -50
  80. package/tools/bin/new-worktree.sh +0 -49
  81. package/tools/bin/pr-risk.sh +0 -12
  82. package/tools/bin/prepare-worktree.sh +0 -142
  83. package/tools/bin/provider-cooldown-state.sh +0 -204
  84. package/tools/bin/publish-issue-worker.sh +0 -31
  85. package/tools/bin/reconcile-bootstrap-lib.sh +0 -113
  86. package/tools/bin/reconcile-issue-worker.sh +0 -34
  87. package/tools/bin/reconcile-pr-worker.sh +0 -34
  88. package/tools/bin/record-verification.sh +0 -71
  89. package/tools/bin/render-flow-config.sh +0 -98
  90. package/tools/bin/resident-issue-controller-lib.sh +0 -448
  91. package/tools/bin/resident-issue-queue-status.py +0 -35
  92. package/tools/bin/retry-state.sh +0 -31
  93. package/tools/bin/reuse-issue-worktree.sh +0 -121
  94. package/tools/bin/run-codex-bypass.sh +0 -3
  95. package/tools/bin/run-codex-safe.sh +0 -3
  96. package/tools/bin/run-codex-task.sh +0 -280
  97. package/tools/bin/serve-dashboard.sh +0 -5
  98. package/tools/bin/split-retained-slice.sh +0 -124
  99. package/tools/bin/start-issue-worker.sh +0 -943
  100. package/tools/bin/start-pr-fix-worker.sh +0 -491
  101. package/tools/bin/start-pr-merge-repair-worker.sh +0 -8
  102. package/tools/bin/start-pr-review-worker.sh +0 -261
  103. package/tools/bin/start-resident-issue-loop.sh +0 -499
  104. package/tools/bin/update-github-labels.sh +0 -14
  105. package/tools/bin/worker-status.sh +0 -19
  106. package/tools/bin/workflow-catalog.sh +0 -77
@@ -1,50 +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
- FLOW_SKILL_DIR="$(resolve_flow_skill_dir "${BASH_SOURCE[0]}")"
9
- if ! flow_require_explicit_profile_selection "${FLOW_SKILL_DIR}" "new-pr-worktree.sh"; then
10
- exit 64
11
- fi
12
- FLOW_TOOLS_DIR="${FLOW_SKILL_DIR}/tools/bin"
13
- flow_export_project_env_aliases
14
- CONFIG_YAML="$(resolve_flow_config_yaml "${BASH_SOURCE[0]}")"
15
- AGENT_REPO_ROOT="$(flow_resolve_agent_repo_root "${CONFIG_YAML}")"
16
- AUTOMATION_REPO_ROOT="$(flow_resolve_repo_root "${CONFIG_YAML}")"
17
- WORKTREE_ROOT="$(flow_resolve_worktree_root "${CONFIG_YAML}")"
18
- RETAINED_REPO_ROOT="$(flow_resolve_retained_repo_root "${CONFIG_YAML}")"
19
- VSCODE_WORKSPACE_FILE="$(flow_resolve_vscode_workspace_file "${CONFIG_YAML}")"
20
- PR_WORKTREE_BRANCH_PREFIX="$(flow_resolve_pr_worktree_branch_prefix "${CONFIG_YAML}")"
21
-
22
- PR_NUMBER="${1:?usage: new-pr-worktree.sh PR_NUMBER HEAD_REF}"
23
- HEAD_REF="${2:?usage: new-pr-worktree.sh PR_NUMBER HEAD_REF}"
24
-
25
- ACP_AGENT_REPO_ROOT="$AGENT_REPO_ROOT" \
26
- F_LOSNING_AGENT_REPO_ROOT="$AGENT_REPO_ROOT" \
27
- "${SCRIPT_DIR}/sync-agent-repo.sh" >/dev/null
28
-
29
- export ACP_REPO_ROOT="$AUTOMATION_REPO_ROOT"
30
- export F_LOSNING_REPO_ROOT="$AUTOMATION_REPO_ROOT"
31
-
32
- WORKTREE_OUT="$(
33
- bash "${FLOW_TOOLS_DIR}/agent-project-open-pr-worktree" \
34
- --repo-root "$AGENT_REPO_ROOT" \
35
- --worktree-root "$WORKTREE_ROOT" \
36
- --pr-number "$PR_NUMBER" \
37
- --head-ref "$HEAD_REF" \
38
- --local-branch-prefix "$PR_WORKTREE_BRANCH_PREFIX" \
39
- --prepare-script "${SCRIPT_DIR}/prepare-worktree.sh"
40
- )"
41
-
42
- ACP_AGENT_REPO_ROOT="$AGENT_REPO_ROOT" \
43
- ACP_RETAINED_REPO_ROOT="$RETAINED_REPO_ROOT" \
44
- ACP_VSCODE_WORKSPACE_FILE="$VSCODE_WORKSPACE_FILE" \
45
- F_LOSNING_AGENT_REPO_ROOT="$AGENT_REPO_ROOT" \
46
- F_LOSNING_RETAINED_REPO_ROOT="$RETAINED_REPO_ROOT" \
47
- F_LOSNING_VSCODE_WORKSPACE_FILE="$VSCODE_WORKSPACE_FILE" \
48
- "${SCRIPT_DIR}/sync-vscode-workspace.sh" >/dev/null 2>&1 || true
49
-
50
- printf '%s\n' "$WORKTREE_OUT"
@@ -1,49 +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
- FLOW_SKILL_DIR="$(resolve_flow_skill_dir "${BASH_SOURCE[0]}")"
9
- if ! flow_require_explicit_profile_selection "${FLOW_SKILL_DIR}" "new-worktree.sh"; then
10
- exit 64
11
- fi
12
- CONFIG_YAML="$(resolve_flow_config_yaml "${BASH_SOURCE[0]}")"
13
- AGENT_REPO_ROOT="$(flow_resolve_agent_repo_root "${CONFIG_YAML}")"
14
- AUTOMATION_REPO_ROOT="$(flow_resolve_repo_root "${CONFIG_YAML}")"
15
- WORKTREE_ROOT="$(flow_resolve_worktree_root "${CONFIG_YAML}")"
16
- RETAINED_REPO_ROOT="$(flow_resolve_retained_repo_root "${CONFIG_YAML}")"
17
- VSCODE_WORKSPACE_FILE="$(flow_resolve_vscode_workspace_file "${CONFIG_YAML}")"
18
- FLOW_TOOLS_DIR="${FLOW_SKILL_DIR}/tools/bin"
19
- ISSUE_BRANCH_PREFIX="$(flow_resolve_issue_branch_prefix "${CONFIG_YAML}")"
20
-
21
- ISSUE_ID="${1:?usage: new-worktree.sh ISSUE_ID [SLUG]}"
22
- SLUG_INPUT="${2:-task}"
23
-
24
- ACP_AGENT_REPO_ROOT="$AGENT_REPO_ROOT" \
25
- F_LOSNING_AGENT_REPO_ROOT="$AGENT_REPO_ROOT" \
26
- "${SCRIPT_DIR}/sync-agent-repo.sh" >/dev/null
27
-
28
- export ACP_REPO_ROOT="$AUTOMATION_REPO_ROOT"
29
- export F_LOSNING_REPO_ROOT="$AUTOMATION_REPO_ROOT"
30
-
31
- WORKTREE_OUT="$(
32
- bash "${FLOW_TOOLS_DIR}/agent-project-open-issue-worktree" \
33
- --repo-root "$AGENT_REPO_ROOT" \
34
- --worktree-root "$WORKTREE_ROOT" \
35
- --issue-id "$ISSUE_ID" \
36
- --slug "$SLUG_INPUT" \
37
- --branch-prefix "$ISSUE_BRANCH_PREFIX" \
38
- --prepare-script "${SCRIPT_DIR}/prepare-worktree.sh"
39
- )"
40
-
41
- ACP_AGENT_REPO_ROOT="$AGENT_REPO_ROOT" \
42
- ACP_RETAINED_REPO_ROOT="$RETAINED_REPO_ROOT" \
43
- ACP_VSCODE_WORKSPACE_FILE="$VSCODE_WORKSPACE_FILE" \
44
- F_LOSNING_AGENT_REPO_ROOT="$AGENT_REPO_ROOT" \
45
- F_LOSNING_RETAINED_REPO_ROOT="$RETAINED_REPO_ROOT" \
46
- F_LOSNING_VSCODE_WORKSPACE_FILE="$VSCODE_WORKSPACE_FILE" \
47
- "${SCRIPT_DIR}/sync-vscode-workspace.sh" >/dev/null 2>&1 || true
48
-
49
- printf '%s\n' "$WORKTREE_OUT"
@@ -1,12 +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
-
8
- PR_NUMBER="${1:?usage: pr-risk.sh PR_NUMBER}"
9
- FLOW_SKILL_DIR="$(resolve_flow_skill_dir "${BASH_SOURCE[0]}")"
10
- ADAPTER_BIN_DIR="${FLOW_SKILL_DIR}/bin"
11
-
12
- "${ADAPTER_BIN_DIR}/pr-risk.sh" "$PR_NUMBER"
@@ -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"