This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

superconfig / tools / covibe / pi-shim.sh
1.7 kB 51 lines
1# shellcheck shell=bash 2# Argument translation between omnigent's `pi-native` harness and omp. 3# 4# omnigent builds `--extension <js> [--approve] --session-dir <dir> 5# [--session <id>] <user args>` (omnigent/runner/native/orchestration.py 6# _build_pi_native_args) against the upstream `pi` CLI at 0.79.x. omp 17.x 7# differs in three ways: 8# 9# 1. `--approve` (pi's project-trust override) does not exist; omp exits 10# "unknown flag: --approve". Drop it — a human is attached to the TUI and 11# omp's own approval prompts are what we want. 12# 2. `--session <id>` is spelled `--resume <id>` in omp. 13# 3. omnigent's bridge extension is CommonJS (`module.exports = fn`), while 14# omp dynamic-imports the file and accepts only `module` / 15# `module.default` as the factory — a CJS file fails with "Extension does 16# not export a valid factory function". Point omp at a generated ESM 17# adapter that re-exports the CJS factory as a default export instead. 18# Verified: the status line then reads "· linked", prompts typed in the 19# TUI appear in the dashboard transcript, and messages sent from the 20# dashboard execute in the TUI. 21argv=() 22while [ "$#" -gt 0 ]; do 23 case "$1" in 24 --approve) 25 shift 26 ;; 27 --session) 28 argv+=(--resume "$2") 29 shift 2 30 ;; 31 --extension) 32 ext=$2 33 shift 2 34 adapter="$(dirname "$ext")/omnigent-esm-adapter.mjs" 35 if [ ! -e "$adapter" ]; then 36 cat >"$adapter" <<EOF 37import { createRequire } from "node:module"; 38const require = createRequire(import.meta.url); 39export default require("$ext"); 40EOF 41 fi 42 argv+=(--extension "$adapter") 43 ;; 44 *) 45 argv+=("$1") 46 shift 47 ;; 48 esac 49done 50 51exec "$OMP_BIN" "${argv[@]}"