From e0feb53437e6aec0f30e3e6437c5fe4defb14b3b Mon Sep 17 00:00:00 2001 From: indifferentketchup Date: Mon, 8 Jun 2026 01:11:00 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20omo-paseo-bridge=20=E2=80=94=20auto-reg?= =?UTF-8?q?ister=20OMO=20subagents=20as=20Paseo=20agents?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bridge script that calls paseo import --provider opencode --label omo=true on task() child sessions. Supports import, archive, ls commands with --dry-run verification. Skill at .opencode/skills/ is gitignored (user-level) — copy from scripts/ on setup. --- scripts/omo-paseo-bridge.sh | 160 ++++++++++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100755 scripts/omo-paseo-bridge.sh diff --git a/scripts/omo-paseo-bridge.sh b/scripts/omo-paseo-bridge.sh new file mode 100755 index 0000000..00a8165 --- /dev/null +++ b/scripts/omo-paseo-bridge.sh @@ -0,0 +1,160 @@ +#!/usr/bin/env bash +set -euo pipefail + +# ============================================================================= +# omo-paseo-bridge.sh — Import OMO task() child sessions as Paseo agents +# +# Automates calling `paseo import` on child session IDs so OMO subagents +# appear in `paseo ls` alongside native Paseo agents. +# +# Usage: +# omo-paseo-bridge.sh import [--type ] ... +# Import session(s) as Paseo agents with omo=true labels +# +# omo-paseo-bridge.sh archive ... +# Archive (soft-delete) agent(s) imported by this bridge +# +# omo-paseo-bridge.sh ls [--all] +# List agents tagged omo=true via paseo ls +# +# omo-paseo-bridge.sh --dry-run ... +# Print what would be done without executing +# +# Examples: +# omo-paseo-bridge.sh import ses_abc123 ses_def456 +# omo-paseo-bridge.sh import --type research ses_abc123 +# omo-paseo-bridge.sh archive agt_789 +# omo-paseo-bridge.sh ls +# omo-paseo-bridge.sh --dry-run import ses_abc123 +# ============================================================================= + +SCRIPT_NAME="$(basename "$0")" +PASEO="$(which paseo 2>/dev/null || echo "paseo")" +DRY_RUN=false + +# ── helpers ────────────────────────────────────────────────────────────────── + +log() { printf "[%s] %s\n" "$SCRIPT_NAME" "$*"; } +warn() { printf "[%s] WARNING: %s\n" "$SCRIPT_NAME" "$*" >&2; } +err() { printf "[%s] ERROR: %s\n" "$SCRIPT_NAME" "$*" >&2; exit 1; } + +paseo_cmd() { + if $DRY_RUN; then + log "[DRY-RUN] would run: $PASEO $*" + return 0 + fi + "$PASEO" "$@" 2>&1 || warn "'paseo $*' exited with code $?" +} + +paseo_import() { + local session_id="$1" + shift + local type_label="${1:-}" + local labels=("--label" "omo=true") + + # Add parent session label if OMO_SESSION_ID is set (injected by agent) + if [[ -n "${OMO_SESSION_ID:-}" ]]; then + labels+=("--label" "parent=${OMO_SESSION_ID}") + fi + + if [[ -n "$type_label" ]]; then + labels+=("--label" "type=${type_label}") + fi + + log "Importing session ${session_id} as Paseo agent ..." + paseo_cmd import "$session_id" --provider opencode "${labels[@]}" +} + +paseo_archive() { + local agent_id="$1" + log "Archiving agent ${agent_id} ..." + paseo_cmd archive "$agent_id" --force +} + +paseo_list() { + local all_flag="${1:-}" + if [[ "$all_flag" == "--all" ]]; then + paseo_cmd ls --label "omo=true" --all + else + paseo_cmd ls --label "omo=true" + fi +} + +# ── usage ──────────────────────────────────────────────────────────────────── + +usage() { + cat < [options] [args...] + +Commands: + import [--type ] ... + Import OMO child session(s) as Paseo agents + archive ... + Archive Paseo agent(s) (soft-delete) + ls [--all] + List agents tagged omo=true + +Options: + --dry-run Print actions without executing them + -h, --help Show this help + +Examples: + $SCRIPT_NAME import --type research ses_abc123 + $SCRIPT_NAME archive agt_789 + $SCRIPT_NAME ls --all +EOF + exit 0 +} + +# ── main ───────────────────────────────────────────────────────────────────── + +# Peel off global flags +while [[ $# -gt 0 ]]; do + case "$1" in + --dry-run) DRY_RUN=true; shift ;; + -h|--help) usage ;; + *) break ;; + esac +done + +[[ $# -eq 0 ]] && usage + +COMMAND="$1" +shift + +case "$COMMAND" in + import) + TYPE_LABEL="" + SESSION_IDS=() + + while [[ $# -gt 0 ]]; do + case "$1" in + --type) TYPE_LABEL="$2"; shift 2 ;; + --type=*) TYPE_LABEL="${1#*=}"; shift ;; + -*) err "Unknown option for import: $1" ;; + *) SESSION_IDS+=("$1"); shift ;; + esac + done + + [[ ${#SESSION_IDS[@]} -eq 0 ]] && err "import requires at least one session-id" + + for sid in "${SESSION_IDS[@]}"; do + paseo_import "$sid" "$TYPE_LABEL" + done + ;; + + archive) + [[ $# -eq 0 ]] && err "archive requires at least one agent-id" + for aid in "$@"; do + paseo_archive "$aid" + done + ;; + + ls) + paseo_list "${1:-}" + ;; + + *) + err "Unknown command: $COMMAND\n$(usage)" + ;; +esac