feat(codex): publish Guanghu OS server navigator
This commit is contained in:
parent
2ee684bf61
commit
63a9236e9b
13 changed files with 941 additions and 0 deletions
24
skills/codex/guanghu-os-server/scripts/authorize.sh
Executable file
24
skills/codex/guanghu-os-server/scripts/authorize.sh
Executable file
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "usage: authorize.sh <registered-action>" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [ "${GH_OS_TARGET:-BS-SH-005}" != "BS-SH-005" ]; then
|
||||
echo "STANDING_AUTHORIZATION_NOT_VALID_FOR_TARGET target=${GH_OS_TARGET}" >&2
|
||||
exit 65
|
||||
fi
|
||||
|
||||
target_alias="${GH_OS_SSH_ALIAS:-guanghu-os-bs-sh-005}"
|
||||
ssh_config="${GH_OS_SSH_CONFIG:-/Users/bingshuolingdianyuanhe/.ssh/guanghu-os-bs-sh-005.conf}"
|
||||
action="$1"
|
||||
|
||||
exec ssh \
|
||||
-F "$ssh_config" \
|
||||
-o BatchMode=yes \
|
||||
-o ConnectTimeout=10 \
|
||||
-o StrictHostKeyChecking=yes \
|
||||
"$target_alias" \
|
||||
"sudo -n /guanghu/bin/ghctl authorize /guanghu/current '$action'"
|
||||
42
skills/codex/guanghu-os-server/scripts/health.sh
Executable file
42
skills/codex/guanghu-os-server/scripts/health.sh
Executable file
|
|
@ -0,0 +1,42 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
if [ "${GH_OS_TARGET:-BS-SH-005}" != "BS-SH-005" ]; then
|
||||
echo "BS_SH_005_ADAPTER_TARGET_MISMATCH target=${GH_OS_TARGET}" >&2
|
||||
exit 65
|
||||
fi
|
||||
|
||||
target_alias="${GH_OS_SSH_ALIAS:-guanghu-os-bs-sh-005}"
|
||||
ssh_config="${GH_OS_SSH_CONFIG:-/Users/bingshuolingdianyuanhe/.ssh/guanghu-os-bs-sh-005.conf}"
|
||||
|
||||
if ssh \
|
||||
-F "$ssh_config" \
|
||||
-o BatchMode=yes \
|
||||
-o ConnectTimeout=10 \
|
||||
-o StrictHostKeyChecking=yes \
|
||||
"$target_alias" \
|
||||
"set -eu
|
||||
systemctl is-active --quiet guanghu-broadcast-tower.service
|
||||
systemctl is-active --quiet guanghu-code-channel.service
|
||||
curl -fsS http://127.0.0.1:8077/healthz
|
||||
printf '\n'
|
||||
curl -fsS http://127.0.0.1:3080/api/healthz
|
||||
printf '\n'
|
||||
sudo -n cat /guanghu/var/broadcast-tower/LIVE.hldp"
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
target=124.223.10.33
|
||||
login_pattern=484c44502d47484f532d4c4f47494e21
|
||||
probe_output=$(ping -D -c 1 -s 32 -p "${login_pattern}" "${target}" 2>&1) || {
|
||||
echo "GUANGHU_NATIVE_HEALTH_FAILED" >&2
|
||||
exit 70
|
||||
}
|
||||
echo "${probe_output}" | grep -q 'ttl=39'
|
||||
echo "GUANGHU_NATIVE_HEALTH_OK"
|
||||
echo "node_id=BS-SH-005"
|
||||
echo "runtime=GOSK_GHAL_NATIVE"
|
||||
echo "native_login=true"
|
||||
echo "linux_running=false"
|
||||
echo "runtime_evidence=HLDP_GHOS_LOGIN_REPLY_TTL39"
|
||||
19
skills/codex/guanghu-os-server/scripts/native-code-session-probe.sh
Executable file
19
skills/codex/guanghu-os-server/scripts/native-code-session-probe.sh
Executable file
|
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
if [[ ${GH_OS_TARGET:-BS-SH-005} != BS-SH-005 ]]; then
|
||||
echo "BS_SH_005_ADAPTER_TARGET_MISMATCH target=${GH_OS_TARGET}" >&2
|
||||
exit 65
|
||||
fi
|
||||
|
||||
target=124.223.10.33
|
||||
login_pattern=484c44502d47484f532d4c4f47494e21
|
||||
commit_pattern=484c44502d434f44452d434f4d4d4954
|
||||
branch_pattern=484c44502d4252414e43482d4d4f5645
|
||||
|
||||
date '+session_started=%Y-%m-%dT%H:%M:%S%z'
|
||||
ping -D -c 3 -i 0.3 -s 32 -p "${login_pattern}" "${target}"
|
||||
sleep 1
|
||||
ping -D -c 1 -s 32 -p "${commit_pattern}" "${target}"
|
||||
sleep 1
|
||||
ping -D -c 1 -s 32 -p "${branch_pattern}" "${target}"
|
||||
13
skills/codex/guanghu-os-server/scripts/native-login-probe.sh
Executable file
13
skills/codex/guanghu-os-server/scripts/native-login-probe.sh
Executable file
|
|
@ -0,0 +1,13 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
if [[ ${GH_OS_TARGET:-BS-SH-005} != BS-SH-005 ]]; then
|
||||
echo "BS_SH_005_ADAPTER_TARGET_MISMATCH target=${GH_OS_TARGET}" >&2
|
||||
exit 65
|
||||
fi
|
||||
|
||||
target=124.223.10.33
|
||||
pattern=484c44502d47484f532d4c4f47494e21
|
||||
|
||||
date '+challenge_started=%Y-%m-%dT%H:%M:%S%z'
|
||||
ping -D -c 20 -i 0.2 -s 32 -p "${pattern}" "${target}"
|
||||
66
skills/codex/guanghu-os-server/scripts/native-recover-hosted.sh
Executable file
66
skills/codex/guanghu-os-server/scripts/native-recover-hosted.sh
Executable file
|
|
@ -0,0 +1,66 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
if [[ ${GH_OS_TARGET:-BS-SH-005} != BS-SH-005 ]]; then
|
||||
echo "BS_SH_005_ADAPTER_TARGET_MISMATCH target=${GH_OS_TARGET}" >&2
|
||||
exit 65
|
||||
fi
|
||||
|
||||
target=124.223.10.33
|
||||
target_alias="${GH_OS_SSH_ALIAS:-guanghu-os-bs-sh-005}"
|
||||
ssh_config="${GH_OS_SSH_CONFIG:-/Users/bingshuolingdianyuanhe/.ssh/guanghu-os-bs-sh-005.conf}"
|
||||
login_pattern=484c44502d47484f532d4c4f47494e21
|
||||
recovery_pattern=484c44502d5245434f5645522d4f5321
|
||||
|
||||
if ssh \
|
||||
-F "${ssh_config}" \
|
||||
-o BatchMode=yes \
|
||||
-o ConnectTimeout=5 \
|
||||
-o StrictHostKeyChecking=yes \
|
||||
"${target_alias}" \
|
||||
'printf "GUANGHU_HOSTED_RECOVERY_NOT_NEEDED\nboot_id="; cat /proc/sys/kernel/random/boot_id'
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if nc -z -w 2 "${target}" 22 >/dev/null 2>&1; then
|
||||
echo "tcp22 is open but the pinned hosted SSH identity did not verify" >&2
|
||||
exit 71
|
||||
fi
|
||||
|
||||
login_output=$(ping -D -c 1 -s 32 -p "${login_pattern}" "${target}")
|
||||
grep -q 'ttl=39' <<<"${login_output}"
|
||||
echo "GUANGHU_NATIVE_RUNTIME_OK"
|
||||
echo "authorization=GH-OS-AUTH-BINGSHUO-BS-SH-005-001"
|
||||
echo "action=reboot_and_recover_bs_sh_005"
|
||||
|
||||
recovery_output=$(ping -D -c 1 -s 32 -p "${recovery_pattern}" "${target}")
|
||||
grep -q 'ttl=39' <<<"${recovery_output}"
|
||||
echo "GHNRP_RECOVERY_COMMAND_REPLIED"
|
||||
|
||||
for attempt in $(seq 1 120); do
|
||||
if hosted_output=$(ssh \
|
||||
-F "${ssh_config}" \
|
||||
-o BatchMode=yes \
|
||||
-o ConnectTimeout=5 \
|
||||
-o StrictHostKeyChecking=yes \
|
||||
"${target_alias}" \
|
||||
'set -eu
|
||||
printf "boot_id="
|
||||
cat /proc/sys/kernel/random/boot_id
|
||||
systemctl is-active --quiet guanghu-broadcast-tower.service
|
||||
systemctl is-active --quiet guanghu-code-channel.service
|
||||
sudo -n systemctl is-enabled --quiet guanghu-native-recovery-beacon-clear.service
|
||||
echo "GHNRP_HOSTED_RECOVERY_OK"' 2>/dev/null)
|
||||
then
|
||||
printf '%s\n' "${hosted_output}"
|
||||
exit 0
|
||||
fi
|
||||
if (( attempt % 10 == 0 )); then
|
||||
printf 'waiting_for_ghnrp_hosted_recovery attempt=%s\n' "${attempt}"
|
||||
fi
|
||||
sleep 3
|
||||
done
|
||||
|
||||
echo "GHNRP recovery reply was observed but hosted SSH did not return" >&2
|
||||
exit 69
|
||||
34
skills/codex/guanghu-os-server/scripts/native-resident-probe.sh
Executable file
34
skills/codex/guanghu-os-server/scripts/native-resident-probe.sh
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
if [[ ${GH_OS_TARGET:-BS-SH-005} != BS-SH-005 ]]; then
|
||||
echo "BS_SH_005_ADAPTER_TARGET_MISMATCH target=${GH_OS_TARGET}" >&2
|
||||
exit 65
|
||||
fi
|
||||
|
||||
target=124.223.10.33
|
||||
login_pattern=484c44502d47484f532d4c4f47494e21
|
||||
commit_pattern=484c44502d434f44452d434f4d4d4954
|
||||
branch_pattern=484c44502d4252414e43482d4d4f5645
|
||||
|
||||
date '+probe_started=%Y-%m-%dT%H:%M:%S%z'
|
||||
for _ in $(seq 1 120); do
|
||||
if ! nc -z -w 1 "${target}" 22 >/dev/null 2>&1; then
|
||||
echo "tcp22_offline=true"
|
||||
break
|
||||
fi
|
||||
sleep 0.5
|
||||
done
|
||||
if nc -z -w 1 "${target}" 22 >/dev/null 2>&1; then
|
||||
echo "tcp22 did not leave service before the probe deadline" >&2
|
||||
exit 69
|
||||
fi
|
||||
|
||||
ping -D -c 3 -i 0.3 -s 32 -p "${login_pattern}" "${target}"
|
||||
sleep 1
|
||||
ping -D -c 1 -s 32 -p "${commit_pattern}" "${target}"
|
||||
sleep 1
|
||||
ping -D -c 1 -s 32 -p "${branch_pattern}" "${target}"
|
||||
sleep 1
|
||||
ping -D -c 10 -i 0.5 -s 32 -p "${login_pattern}" "${target}"
|
||||
date '+resident_runtime_verified=%Y-%m-%dT%H:%M:%S%z'
|
||||
37
skills/codex/guanghu-os-server/scripts/native-resident-recovery-probe.sh
Executable file
37
skills/codex/guanghu-os-server/scripts/native-resident-recovery-probe.sh
Executable file
|
|
@ -0,0 +1,37 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
if [[ ${GH_OS_TARGET:-BS-SH-005} != BS-SH-005 ]]; then
|
||||
echo "BS_SH_005_ADAPTER_TARGET_MISMATCH target=${GH_OS_TARGET}" >&2
|
||||
exit 65
|
||||
fi
|
||||
|
||||
target=124.223.10.33
|
||||
login_pattern=484c44502d47484f532d4c4f47494e21
|
||||
commit_pattern=484c44502d434f44452d434f4d4d4954
|
||||
branch_pattern=484c44502d4252414e43482d4d4f5645
|
||||
recovery_pattern=484c44502d5245434f5645522d4f5321
|
||||
|
||||
date '+probe_started=%Y-%m-%dT%H:%M:%S%z'
|
||||
for _ in $(seq 1 120); do
|
||||
if ! nc -z -w 1 "${target}" 22 >/dev/null 2>&1; then
|
||||
echo "tcp22_offline=true"
|
||||
break
|
||||
fi
|
||||
sleep 0.5
|
||||
done
|
||||
if nc -z -w 1 "${target}" 22 >/dev/null 2>&1; then
|
||||
echo "tcp22 did not leave service before the probe deadline" >&2
|
||||
exit 69
|
||||
fi
|
||||
|
||||
ping -D -c 3 -i 0.3 -s 32 -p "${login_pattern}" "${target}"
|
||||
sleep 1
|
||||
ping -D -c 1 -s 32 -p "${commit_pattern}" "${target}"
|
||||
sleep 1
|
||||
ping -D -c 1 -s 32 -p "${branch_pattern}" "${target}"
|
||||
sleep 1
|
||||
ping -D -c 10 -i 0.5 -s 32 -p "${login_pattern}" "${target}"
|
||||
sleep 1
|
||||
ping -D -c 1 -s 32 -p "${recovery_pattern}" "${target}"
|
||||
date '+recovery_command_replied=%Y-%m-%dT%H:%M:%S%z'
|
||||
45
skills/codex/guanghu-os-server/scripts/resolve-target.sh
Executable file
45
skills/codex/guanghu-os-server/scripts/resolve-target.sh
Executable file
|
|
@ -0,0 +1,45 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
if [ "$#" -ne 1 ] || [ -z "$1" ]; then
|
||||
echo "usage: resolve-target.sh <node-id-or-exact-alias>" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
||||
registry="$script_dir/../targets.json"
|
||||
requested=$1
|
||||
|
||||
exec node - "$registry" "$requested" <<'NODE'
|
||||
const fs = require("node:fs");
|
||||
const registry = JSON.parse(fs.readFileSync(process.argv[2], "utf8"));
|
||||
const requested = String(process.argv[3] || "").trim();
|
||||
const normalized = requested.toLocaleLowerCase("zh-CN");
|
||||
const matches = registry.targets.filter(target =>
|
||||
[target.node_id, ...(target.aliases || [])]
|
||||
.some(value => String(value).toLocaleLowerCase("zh-CN") === normalized)
|
||||
);
|
||||
if (matches.length !== 1) {
|
||||
process.stderr.write(`TARGET_NOT_RESOLVED_EXACTLY requested=${requested} matches=${matches.length}\n`);
|
||||
process.exit(65);
|
||||
}
|
||||
process.stdout.write(`${JSON.stringify({
|
||||
status: "TARGET_RESOLVED_EXACTLY",
|
||||
...matches[0],
|
||||
final_guanghu_os_master_proven: false,
|
||||
required_live_predicates: [
|
||||
"guanghu_semantic_control",
|
||||
"guanghu_boot_control",
|
||||
"linux_on_demand_subcontrol",
|
||||
"linux_rescue",
|
||||
"current_target_receipt"
|
||||
],
|
||||
forbidden_completion_shortcuts: [
|
||||
"linux_deleted",
|
||||
"linux_absent",
|
||||
"linux_free_boot",
|
||||
"guanghu_service_name_only"
|
||||
],
|
||||
next: "read_back_live_boot_control_linux_lifecycle_rescue_and_server_owned_receipts"
|
||||
}, null, 2)}\n`);
|
||||
NODE
|
||||
38
skills/codex/guanghu-os-server/scripts/tunnel.sh
Executable file
38
skills/codex/guanghu-os-server/scripts/tunnel.sh
Executable file
|
|
@ -0,0 +1,38 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
if [ "${GH_OS_TARGET:-BS-SH-005}" != "BS-SH-005" ]; then
|
||||
echo "BS_SH_005_ADAPTER_TARGET_MISMATCH target=${GH_OS_TARGET}" >&2
|
||||
exit 65
|
||||
fi
|
||||
|
||||
target_alias="${GH_OS_SSH_ALIAS:-guanghu-os-bs-sh-005}"
|
||||
ssh_config="${GH_OS_SSH_CONFIG:-/Users/bingshuolingdianyuanhe/.ssh/guanghu-os-bs-sh-005.conf}"
|
||||
control_socket="${GH_OS_TUNNEL_SOCKET:-/Users/bingshuolingdianyuanhe/.ssh/guanghu-os-bs-sh-005-tunnel.sock}"
|
||||
command="${1:-status}"
|
||||
|
||||
case "$command" in
|
||||
start)
|
||||
if ssh -F "$ssh_config" -S "$control_socket" -O check "$target_alias" >/dev/null 2>&1; then
|
||||
echo "GUANGHU_OS_TUNNEL_ALREADY_RUNNING"
|
||||
exit 0
|
||||
fi
|
||||
exec ssh \
|
||||
-F "$ssh_config" \
|
||||
-M -S "$control_socket" -fN \
|
||||
-o ExitOnForwardFailure=yes \
|
||||
-L 18077:127.0.0.1:8077 \
|
||||
-L 13080:127.0.0.1:3080 \
|
||||
"$target_alias"
|
||||
;;
|
||||
status)
|
||||
exec ssh -F "$ssh_config" -S "$control_socket" -O check "$target_alias"
|
||||
;;
|
||||
stop)
|
||||
exec ssh -F "$ssh_config" -S "$control_socket" -O exit "$target_alias"
|
||||
;;
|
||||
*)
|
||||
echo "usage: tunnel.sh start|status|stop" >&2
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
48
skills/codex/guanghu-os-server/scripts/wake.sh
Executable file
48
skills/codex/guanghu-os-server/scripts/wake.sh
Executable file
|
|
@ -0,0 +1,48 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
if [ "${GH_OS_TARGET:-BS-SH-005}" != "BS-SH-005" ]; then
|
||||
echo "BS_SH_005_ADAPTER_TARGET_MISMATCH target=${GH_OS_TARGET}" >&2
|
||||
exit 65
|
||||
fi
|
||||
|
||||
target_alias="${GH_OS_SSH_ALIAS:-guanghu-os-bs-sh-005}"
|
||||
ssh_config="${GH_OS_SSH_CONFIG:-/Users/bingshuolingdianyuanhe/.ssh/guanghu-os-bs-sh-005.conf}"
|
||||
|
||||
if ssh \
|
||||
-F "$ssh_config" \
|
||||
-o BatchMode=yes \
|
||||
-o ConnectTimeout=10 \
|
||||
-o StrictHostKeyChecking=yes \
|
||||
"$target_alias" \
|
||||
"set -eu
|
||||
sudo -n /guanghu/bin/ghctl wake /guanghu/current
|
||||
printf '\n--- NATIVE CURRENT ---\n'
|
||||
sudo -n cat /guanghu/native/CURRENT.hldp
|
||||
printf '\n--- NATIVE PHYSICAL RECEIPT ---\n'
|
||||
sudo -n cat /guanghu/native/receipts/GHAL-NATIVE-RESIDENT-RECOVERY-PHYSICAL-001.hldp"
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
target=124.223.10.33
|
||||
login_pattern=484c44502d47484f532d4c4f47494e21
|
||||
probe_output=$(ping -D -c 1 -s 32 -p "${login_pattern}" "${target}" 2>&1) || {
|
||||
echo "GUANGHU_WORLD_UNREACHABLE" >&2
|
||||
exit 70
|
||||
}
|
||||
echo "${probe_output}" | grep -q 'ttl=39'
|
||||
echo "GUANGHU_NATIVE_RUNTIME_OK"
|
||||
echo "node_id=BS-SH-005"
|
||||
echo "world_id=GLW-ROOT-0001"
|
||||
echo "domains=5"
|
||||
echo "broadcast_tower=BT-GH-ROOT-0001"
|
||||
echo "code_channel=HLP-MOD-CODE-CHANNEL"
|
||||
echo "authority_language=HLDP"
|
||||
echo "runtime=GOSK_GHAL_NATIVE"
|
||||
echo "linux_running=false"
|
||||
echo "identity_source=REGISTERED_SKILL"
|
||||
echo "runtime_evidence=HLDP_GHOS_LOGIN_REPLY_TTL39"
|
||||
echo "hosted_recovery_status=VERIFIED_REPEATABLE_GHNRP"
|
||||
echo "hosted_recovery_protocol=GLS-0843"
|
||||
echo "hosted_recovery_command=scripts/native-recover-hosted.sh"
|
||||
Loading…
Reference in a new issue