Spaces:
Runtime error
Runtime error
| set -euo pipefail | |
| ROOT="$(cd "$(dirname "$0")/.." && pwd)" | |
| PROVIDER_SCRIPT="$ROOT/scripts/continuity_provider.sh" | |
| VERSION_ID="${1:-hv-continuity-control-plane-v1}" | |
| OPERATOR_CONFIG_PATH="$ROOT/build/system/continuity_operator.json" | |
| if [ ! -x "$PROVIDER_SCRIPT" ]; then | |
| echo "continuity provider script not available: $PROVIDER_SCRIPT" >&2 | |
| exit 1 | |
| fi | |
| STATUS_JSON="$("$PROVIDER_SCRIPT" status)" | |
| SURFACES_JSON="$("$PROVIDER_SCRIPT" surfaces)" | |
| LINEAGE_JSON="$("$PROVIDER_SCRIPT" lineage "$VERSION_ID")" | |
| if [ -f "$OPERATOR_CONFIG_PATH" ]; then | |
| OPERATOR_JSON="$(cat "$OPERATOR_CONFIG_PATH")" | |
| else | |
| OPERATOR_JSON='{"active_cut":{"max_nodes":18,"preferred_surface_order":["provider_status","provider_lineage","provider_surfaces","local_fallback_pointer"]},"resume_defaults":{"preferred_active_surface":"history_navigation_surface_v1","next_packet_shape":["route","context","action","receipt"]},"invariants":[]}' | |
| fi | |
| jq -n \ | |
| --arg version_id "$VERSION_ID" \ | |
| --argjson status "$STATUS_JSON" \ | |
| --argjson surfaces "$SURFACES_JSON" \ | |
| --argjson lineage "$LINEAGE_JSON" \ | |
| --argjson operator "$OPERATOR_JSON" \ | |
| '{ | |
| route:{ | |
| lane:"memory", | |
| objective:"resume and operate continuity runtime through the smallest owned surfaces first", | |
| provider:($status.provider // "unknown"), | |
| continuity_version_id:($lineage.version_id // $status.items[0].version_id // $status.continuity_version_id // $version_id), | |
| active_cut:{ | |
| max_nodes:($operator.active_cut.max_nodes // 18), | |
| preferred_surface_order:($operator.active_cut.preferred_surface_order // []), | |
| surfaces_used:[ | |
| "provider_status", | |
| "provider_lineage", | |
| "provider_surfaces" | |
| ] | |
| } | |
| }, | |
| context:{ | |
| verified:($lineage.verified // $status.items[0].verified // false), | |
| promoted:($lineage.promoted // $status.items[0].promoted // false), | |
| predecessor:($lineage.predecessor // $status.items[0].predecessor // $status.predecessor_id // null), | |
| surfaces:($surfaces.items // []), | |
| graph_id:($lineage.graph_id // $status.items[0].graph_id // null), | |
| active_surface:( | |
| ($surfaces.items // []) | |
| | map(select(.activated == true))[0].surface_id | |
| // (($surfaces.items // []) | |
| | map(select(.surface_id == ($operator.resume_defaults.preferred_active_surface // "")))[0].surface_id) | |
| // (($surfaces.items // [])[0].surface_id) | |
| // null | |
| ), | |
| resume_rule:"resume from state, not raw history replay" | |
| }, | |
| action:{ | |
| next_step:"resume or activate one continuity surface", | |
| recommended_surface:( | |
| ($surfaces.items // []) | |
| | map(select(.activated == true))[0].surface_id | |
| // (($surfaces.items // []) | |
| | map(select(.surface_id == ($operator.resume_defaults.preferred_active_surface // "")))[0].surface_id) | |
| // (($surfaces.items // [])[0].surface_id) | |
| // null | |
| ), | |
| activate_command:( | |
| (($surfaces.items // []) | |
| | map(select(.activated == true))[0].surface_id | |
| // (($surfaces.items // [])[0].surface_id) | |
| // empty) as $surface | |
| | if $surface == "" then null | |
| else "./bin/bvtctl continuity-activate " + $surface + " " + ($lineage.version_id // $status.items[0].version_id // $status.continuity_version_id // $version_id) | |
| end | |
| ), | |
| resume_packet:{ | |
| command:("./bin/bvtctl continuity-resume " + ($lineage.version_id // $status.items[0].version_id // $status.continuity_version_id // $version_id)), | |
| shape:($operator.resume_defaults.next_packet_shape // ["route","context","action","receipt"]) | |
| } | |
| }, | |
| receipt:{ | |
| proof_surface:"continuity provider", | |
| lineage_verified:($lineage.verified // false), | |
| promotion_state:( | |
| if ($lineage.promoted // false) then "promoted" | |
| elif ($lineage.verified // false) then "verified" | |
| else "unverified" | |
| end | |
| ), | |
| evidence:[ | |
| ($lineage.provider // $status.provider // "unknown"), | |
| ($lineage.graph_id // $status.items[0].graph_id // null), | |
| (($surfaces.items // []) | length) | |
| ] | |
| } | |
| }' | |