mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-08-16 01:52:30 +02:00
nobuild
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
## 0.144.3-3 (14-07-2026)
|
||||
- Minor bugs fixed
|
||||
## 0.144.3-2 (14-07-2026)
|
||||
|
||||
- Initial ChatGPT Codex add-on.
|
||||
- Added a persistent, administrator-only Home Assistant ingress terminal backed by tmux.
|
||||
- Made `headroom wrap codex` the default launch path.
|
||||
- Configured Docker builds to install the latest stable Codex, Headroom, RTK, ttyd, and Rust toolchain versions without hard-coded tool version pins.
|
||||
- Added RTK native Codex initialization and savings reporting.
|
||||
- Added device-code authentication and direct Codex fallback helpers.
|
||||
- Added persistent configuration, GitHub CLI integration, mount support, and safe defaults.
|
||||
- Made the default workspace follow a custom `data_location`.
|
||||
@@ -1,157 +0,0 @@
|
||||
#============================#
|
||||
# ALEXBELGIUM'S DOCKERFILE #
|
||||
#============================#
|
||||
#=== Home Assistant Addon ===#
|
||||
|
||||
#################
|
||||
# 1 Build Image #
|
||||
#################
|
||||
|
||||
ARG BUILD_FROM
|
||||
ARG BUILD_VERSION
|
||||
|
||||
FROM rust:bookworm AS rtk-builder
|
||||
RUN set -eux; \
|
||||
rtk_version="$(git ls-remote --tags --refs --sort=-v:refname \
|
||||
https://github.com/rtk-ai/rtk.git 'refs/tags/v*' \
|
||||
| awk -F/ '$3 ~ /^v[0-9]+\.[0-9]+\.[0-9]+$/ { print $3; exit }')"; \
|
||||
test -n "$rtk_version"; \
|
||||
git clone --depth 1 --branch "$rtk_version" https://github.com/rtk-ai/rtk.git /src/rtk; \
|
||||
cd /src/rtk; \
|
||||
cargo build --release --locked; \
|
||||
install -D -m 0755 target/release/rtk /out/rtk; \
|
||||
/out/rtk --version
|
||||
|
||||
FROM ${BUILD_FROM}
|
||||
|
||||
##################
|
||||
# 2 Modify Image #
|
||||
##################
|
||||
|
||||
ENV S6_CMD_WAIT_FOR_SERVICES=1 \
|
||||
S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 \
|
||||
S6_SERVICES_GRACETIME=0 \
|
||||
HEADROOM_CONTEXT_TOOL=rtk
|
||||
|
||||
USER root
|
||||
VOLUME [ "/sys/fs/cgroup" ]
|
||||
|
||||
ARG TEMPLATE_BASE_URL="https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates"
|
||||
|
||||
##################
|
||||
# 3 Install apps #
|
||||
##################
|
||||
|
||||
COPY rootfs/ /
|
||||
RUN find /etc/cont-init.d /etc/s6-overlay /usr/local/bin \
|
||||
-type f \( -name "*.sh" -o -name "run" -o -name "finish" -o -path "/usr/local/bin/*" \) \
|
||||
-print -exec chmod +x {} \;
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
curl \
|
||||
git \
|
||||
gh \
|
||||
jq \
|
||||
less \
|
||||
nano \
|
||||
openssh-client \
|
||||
python3-pip \
|
||||
ripgrep \
|
||||
tmux && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install the latest stable official Codex static binary for the target architecture.
|
||||
RUN set -eux; \
|
||||
case "$(dpkg --print-architecture)" in \
|
||||
amd64) codex_arch="x86_64" ;; \
|
||||
arm64) codex_arch="aarch64" ;; \
|
||||
*) echo "Unsupported architecture: $(dpkg --print-architecture)" >&2; exit 1 ;; \
|
||||
esac; \
|
||||
archive="/tmp/codex.tar.gz"; \
|
||||
curl -fsSL --retry 3 --retry-delay 2 \
|
||||
-o "$archive" \
|
||||
"https://github.com/openai/codex/releases/latest/download/codex-${codex_arch}-unknown-linux-musl.tar.gz"; \
|
||||
tar -xzf "$archive" -C /tmp; \
|
||||
install -m 0755 "/tmp/codex-${codex_arch}-unknown-linux-musl" /usr/local/bin/codex; \
|
||||
rm -f "$archive" "/tmp/codex-${codex_arch}-unknown-linux-musl"; \
|
||||
codex --version
|
||||
|
||||
# Install the latest stable ttyd binary for the Home Assistant ingress terminal.
|
||||
RUN set -eux; \
|
||||
case "$(dpkg --print-architecture)" in \
|
||||
amd64) ttyd_arch="x86_64" ;; \
|
||||
arm64) ttyd_arch="aarch64" ;; \
|
||||
*) echo "Unsupported architecture: $(dpkg --print-architecture)" >&2; exit 1 ;; \
|
||||
esac; \
|
||||
curl -fsSL --retry 3 --retry-delay 2 \
|
||||
-o /usr/local/bin/ttyd \
|
||||
"https://github.com/tsl0922/ttyd/releases/latest/download/ttyd.${ttyd_arch}"; \
|
||||
chmod 0755 /usr/local/bin/ttyd; \
|
||||
ttyd --version
|
||||
|
||||
COPY --from=rtk-builder /out/rtk /usr/local/bin/rtk
|
||||
RUN rtk --version && \
|
||||
pip3 install --upgrade --break-system-packages --no-cache-dir "headroom-ai[proxy,code,mcp]" && \
|
||||
headroom --version
|
||||
|
||||
ARG MODULES="00-banner.sh 00-global_var.sh 01-custom_script.sh 00-local_mounts.sh 00-smb_mounts.sh 90-dns_set.sh"
|
||||
RUN curl -fsSL --retry 3 --retry-delay 2 \
|
||||
-o /ha_automodules.sh "${TEMPLATE_BASE_URL}/ha_automodules.sh" && \
|
||||
chmod 744 /ha_automodules.sh && \
|
||||
/ha_automodules.sh "$MODULES" && \
|
||||
rm /ha_automodules.sh
|
||||
|
||||
################
|
||||
# 4 Entrypoint #
|
||||
################
|
||||
|
||||
RUN curl -fsSL --retry 3 --retry-delay 2 \
|
||||
-o /ha_entrypoint.sh "${TEMPLATE_BASE_URL}/ha_entrypoint.sh" && \
|
||||
curl -fsSL --retry 3 --retry-delay 2 \
|
||||
-o /usr/local/lib/bashio-standalone.sh "${TEMPLATE_BASE_URL}/bashio-standalone.sh" && \
|
||||
chmod 0777 /ha_entrypoint.sh && \
|
||||
chmod 0755 /usr/local/lib/bashio-standalone.sh
|
||||
|
||||
ENTRYPOINT [ "/usr/bin/env" ]
|
||||
CMD [ "/ha_entrypoint.sh" ]
|
||||
|
||||
############
|
||||
# 5 Labels #
|
||||
############
|
||||
|
||||
ARG BUILD_ARCH
|
||||
ARG BUILD_DATE
|
||||
ARG BUILD_DESCRIPTION
|
||||
ARG BUILD_NAME
|
||||
ARG BUILD_REF
|
||||
ARG BUILD_REPOSITORY
|
||||
ARG BUILD_VERSION
|
||||
ENV BUILD_VERSION="${BUILD_VERSION}"
|
||||
LABEL \
|
||||
io.hass.name="${BUILD_NAME}" \
|
||||
io.hass.description="${BUILD_DESCRIPTION}" \
|
||||
io.hass.arch="${BUILD_ARCH}" \
|
||||
io.hass.type="addon" \
|
||||
io.hass.version=${BUILD_VERSION} \
|
||||
maintainer="alexbelgium (https://github.com/alexbelgium)" \
|
||||
org.opencontainers.image.title="${BUILD_NAME}" \
|
||||
org.opencontainers.image.description="${BUILD_DESCRIPTION}" \
|
||||
org.opencontainers.image.vendor="Home Assistant Add-ons" \
|
||||
org.opencontainers.image.authors="alexbelgium (https://github.com/alexbelgium)" \
|
||||
org.opencontainers.image.licenses="MIT" \
|
||||
org.opencontainers.image.url="https://github.com/alexbelgium" \
|
||||
org.opencontainers.image.source="https://github.com/${BUILD_REPOSITORY}" \
|
||||
org.opencontainers.image.documentation="https://github.com/${BUILD_REPOSITORY}/blob/master/chatgpt_codex/README.md" \
|
||||
org.opencontainers.image.created=${BUILD_DATE} \
|
||||
org.opencontainers.image.revision=${BUILD_REF} \
|
||||
org.opencontainers.image.version=${BUILD_VERSION}
|
||||
|
||||
#################
|
||||
# 6 Healthcheck #
|
||||
#################
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s \
|
||||
CMD curl -fsS http://127.0.0.1:7681/ > /dev/null || exit 1
|
||||
@@ -1,112 +0,0 @@
|
||||
# Home Assistant add-on: ChatGPT Codex
|
||||
|
||||
![Supports aarch64 Architecture][aarch64-shield]
|
||||
![Supports amd64 Architecture][amd64-shield]
|
||||
![Project Maintenance][maintenance-shield]
|
||||
|
||||
Run the official OpenAI Codex CLI in a persistent Home Assistant ingress terminal. The optimized path uses `headroom wrap codex`, with RTK handling command-output compression before results reach Codex.
|
||||
|
||||
> The repository already contains an unrelated add-on named **Codex** for comic archives. This coding-agent add-on therefore uses the slug `chatgpt_codex`.
|
||||
|
||||
## Features
|
||||
|
||||
- Latest stable Codex, Headroom, RTK, ttyd, and Rust toolchain versions are resolved during every Docker build; tool versions are not pinned in the Dockerfile.
|
||||
- Official Codex CLI static binary for `amd64` and `aarch64`.
|
||||
- Home Assistant authenticated, administrator-only ingress; no unauthenticated terminal port is exposed.
|
||||
- Persistent `$HOME`, Codex authentication, settings, sessions, Headroom state, and RTK statistics.
|
||||
- Persistent `tmux` session that survives browser disconnects.
|
||||
- `headroom wrap codex` as the default launch path.
|
||||
- Baked-in RTK with native Codex initialization.
|
||||
- Optional Headroom output shaping and code-aware compression.
|
||||
- Direct Codex fallback for troubleshooting.
|
||||
- Device-code login helper designed for a remote or headless container.
|
||||
- Baked-in Git, GitHub CLI, ripgrep, jq, SSH client, and common terminal tools.
|
||||
- Optional GitHub CLI authentication and Git author configuration.
|
||||
- Optional extra apt and pip packages.
|
||||
- Local and SMB mount support through the repository standard modules.
|
||||
|
||||
## Installation and first login
|
||||
|
||||
1. Install **ChatGPT Codex** from this add-on repository.
|
||||
2. Keep the default `data_location` and `workspace`, or select writable mounted paths.
|
||||
3. Start the add-on and open its web UI.
|
||||
4. Codex starts automatically through Headroom.
|
||||
5. When prompted to authenticate, follow the device-code instructions. You can also exit Codex and run:
|
||||
|
||||
```shell
|
||||
codex-login
|
||||
```
|
||||
|
||||
Codex supports ChatGPT sign-in and API-key authentication. The device-code flow is the recommended option for this headless add-on.
|
||||
|
||||
## Launch commands
|
||||
|
||||
Optimized default:
|
||||
|
||||
```shell
|
||||
codex-headroom
|
||||
```
|
||||
|
||||
This runs:
|
||||
|
||||
```shell
|
||||
headroom wrap codex
|
||||
```
|
||||
|
||||
Headroom starts its local proxy, configures Codex routing and MCP support, and uses RTK as the CLI context tool.
|
||||
|
||||
Direct troubleshooting path:
|
||||
|
||||
```shell
|
||||
codex-direct
|
||||
```
|
||||
|
||||
Check optimization status and measured savings:
|
||||
|
||||
```shell
|
||||
headroom doctor
|
||||
headroom perf
|
||||
rtk gain
|
||||
```
|
||||
|
||||
## Persistence
|
||||
|
||||
The terminal attaches every browser connection to the same `tmux` session. Closing the browser detaches the client but does not stop Codex or commands running in the session.
|
||||
|
||||
Persistent data is stored below `data_location`:
|
||||
|
||||
- Codex state: `~/.codex`
|
||||
- Headroom state and metrics: `~/.headroom`
|
||||
- RTK state: its normal paths below the persistent home
|
||||
- Default workspace: `~/workspace`
|
||||
|
||||
## Options
|
||||
|
||||
| Option | Default | Description |
|
||||
| --- | --- | --- |
|
||||
| `data_location` | `/data/data` | Persistent home. Must be below `/data`, `/share`, `/media`, `/config`, or `/mnt`. |
|
||||
| `workspace` | `<data_location>/workspace` | Initial project directory. Leave empty to follow `data_location`. |
|
||||
| `PUID` / `PGID` | `0` / `0` | Runtime user and group used by the LinuxServer `abc` account. |
|
||||
| `TZ` | | Optional timezone, for example `Europe/Brussels`. |
|
||||
| `auto_start_codex` | `true` | Start Codex automatically when the tmux session is first created. |
|
||||
| `use_headroom` | `true` | Use `headroom wrap codex`; disabling this starts Codex directly. |
|
||||
| `headroom_output_shaper` | `true` | Enable Headroom output-token shaping. |
|
||||
| `headroom_code_aware` | `true` | Enable Headroom AST-aware code compression. |
|
||||
| `github_token` | | Authenticate GitHub CLI and Git operations. |
|
||||
| `github_username` / `github_email` | | Configure the global Git author. |
|
||||
| `additional_apps` | | Comma-separated Debian packages installed at startup. |
|
||||
| `additional_pip` | | Comma-separated Python packages installed at startup. |
|
||||
| `localdisks` / `networkdisks` | | Optional local-disk and SMB mounts supported by the repository modules. |
|
||||
| `env_vars` | `[]` | Additional environment variables exported in the container. |
|
||||
|
||||
Configuration changes affecting the launch command apply to a newly created tmux session. To recreate it, exit Codex and run `tmux kill-session -t codex`, then reopen the add-on web UI.
|
||||
|
||||
## Security
|
||||
|
||||
The add-on deliberately does not enable Codex approval or sandbox bypass flags. Codex can execute commands and edit files available inside the configured workspace, so only mount locations you intend it to access.
|
||||
|
||||
The terminal is exposed only through Home Assistant administrator-only ingress. Do not add an unauthenticated direct port mapping. Treat `github_token`, Codex authentication data, and the persistent home as secrets and include them only in trusted backups.
|
||||
|
||||
[aarch64-shield]: https://img.shields.io/badge/aarch64-yes-green.svg
|
||||
[amd64-shield]: https://img.shields.io/badge/amd64-yes-green.svg
|
||||
[maintenance-shield]: https://img.shields.io/maintenance/yes/2026.svg
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"build_from": {
|
||||
"aarch64": "ghcr.io/linuxserver/baseimage-debian:arm64v8-bookworm",
|
||||
"amd64": "ghcr.io/linuxserver/baseimage-debian:amd64-bookworm"
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
arch:
|
||||
- aarch64
|
||||
- amd64
|
||||
description: "Persistent OpenAI Codex web terminal optimized with Headroom and RTK"
|
||||
devices:
|
||||
- /dev/fuse
|
||||
environment:
|
||||
HOME: /data/data
|
||||
PGID: "0"
|
||||
PUID: "0"
|
||||
TERM: xterm-256color
|
||||
image: ghcr.io/alexbelgium/chatgpt_codex-{arch}
|
||||
ingress: true
|
||||
ingress_port: 7681
|
||||
ingress_stream: true
|
||||
init: false
|
||||
map:
|
||||
- addon_config:rw
|
||||
- share:rw
|
||||
- media:rw
|
||||
- ssl
|
||||
name: ChatGPT Codex
|
||||
options:
|
||||
env_vars: []
|
||||
DNS_server: 8.8.8.8
|
||||
data_location: /data/data
|
||||
workspace: ""
|
||||
PUID: 0
|
||||
PGID: 0
|
||||
auto_start_codex: true
|
||||
use_headroom: true
|
||||
headroom_output_shaper: true
|
||||
headroom_code_aware: true
|
||||
github_token: ""
|
||||
github_username: ""
|
||||
github_email: ""
|
||||
additional_apps: ""
|
||||
additional_pip: ""
|
||||
panel_icon: mdi:code-braces-box
|
||||
privileged:
|
||||
- SYS_ADMIN
|
||||
- DAC_READ_SEARCH
|
||||
schema:
|
||||
env_vars:
|
||||
- name: match(^[A-Za-z0-9_]+$)
|
||||
value: str?
|
||||
DNS_server: str?
|
||||
data_location: str?
|
||||
workspace: str?
|
||||
PUID: int
|
||||
PGID: int
|
||||
TZ: match([A-Z][a-z]*./[A-Z][a-z]*.)?
|
||||
auto_start_codex: bool
|
||||
use_headroom: bool
|
||||
headroom_output_shaper: bool
|
||||
headroom_code_aware: bool
|
||||
github_token: password?
|
||||
github_username: str?
|
||||
github_email: str?
|
||||
additional_apps: str?
|
||||
additional_pip: str?
|
||||
localdisks: str?
|
||||
networkdisks: str?
|
||||
slug: chatgpt_codex
|
||||
tmpfs: true
|
||||
udev: true
|
||||
url: https://github.com/alexbelgium/hassio-addons
|
||||
version: "0.144.3-3"
|
||||
@@ -1,46 +0,0 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
PUID="$(bashio::config 'PUID')"
|
||||
PGID="$(bashio::config 'PGID')"
|
||||
LOCATION="$(bashio::config 'data_location')"
|
||||
|
||||
if [ -z "$LOCATION" ] || [ "$LOCATION" = "null" ]; then
|
||||
LOCATION="/data/data"
|
||||
fi
|
||||
|
||||
case "$LOCATION" in
|
||||
/data/* | /share/* | /media/* | /config/* | /mnt/*)
|
||||
;;
|
||||
*)
|
||||
bashio::log.fatal "data_location must be below /data, /share, /media, /config, or /mnt"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -L "$LOCATION" ]; then
|
||||
bashio::log.fatal "data_location must not be a symbolic link"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
bashio::log.info "Using persistent home: $LOCATION"
|
||||
install -d -m 0750 -o "$PUID" -g "$PGID" "$LOCATION"
|
||||
install -d -m 0750 -o "$PUID" -g "$PGID" "$LOCATION/.codex" "$LOCATION/.headroom"
|
||||
install -d -m 0755 /tmp/cache /run/s6/container_environment
|
||||
|
||||
sed -i "s|^\(abc:[^:]*:[^:]*:[^:]*:[^:]*:\)[^:]*|\1$LOCATION|" /etc/passwd
|
||||
|
||||
for variable in HOME CODEX_HOME HEADROOM_WORKSPACE_DIR XDG_CACHE_HOME; do
|
||||
case "$variable" in
|
||||
HOME) value="$LOCATION" ;;
|
||||
CODEX_HOME) value="$LOCATION/.codex" ;;
|
||||
HEADROOM_WORKSPACE_DIR) value="$LOCATION/.headroom" ;;
|
||||
XDG_CACHE_HOME) value="/tmp/cache" ;;
|
||||
esac
|
||||
printf '%s' "$value" > "/run/s6/container_environment/$variable"
|
||||
done
|
||||
|
||||
chown -R "$PUID:$PGID" "$LOCATION/.codex" "$LOCATION/.headroom"
|
||||
chown "$PUID:$PGID" "$LOCATION"
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
if bashio::config.has_value 'additional_apps'; then
|
||||
packages="$(bashio::config 'additional_apps')"
|
||||
apt-get update -o Acquire::http::Timeout=10 -o Acquire::https::Timeout=10
|
||||
for package in ${packages//,/ }; do
|
||||
bashio::log.info "Installing apt package: $package"
|
||||
apt-get install -y --no-install-recommends "$package"
|
||||
done
|
||||
apt-get clean
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
fi
|
||||
|
||||
if bashio::config.has_value 'additional_pip'; then
|
||||
packages="$(bashio::config 'additional_pip')"
|
||||
for package in ${packages//,/ }; do
|
||||
bashio::log.info "Installing pip package: $package"
|
||||
pip3 install --break-system-packages "$package"
|
||||
done
|
||||
fi
|
||||
|
||||
if bashio::config.has_value 'TZ'; then
|
||||
timezone="$(bashio::config 'TZ')"
|
||||
if [ ! -e "/usr/share/zoneinfo/$timezone" ]; then
|
||||
bashio::log.fatal "Invalid timezone: $timezone"
|
||||
exit 1
|
||||
fi
|
||||
ln -snf "/usr/share/zoneinfo/$timezone" /etc/localtime
|
||||
printf '%s\n' "$timezone" > /etc/timezone
|
||||
fi
|
||||
@@ -1,55 +0,0 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
PUID="$(bashio::config 'PUID')"
|
||||
PGID="$(bashio::config 'PGID')"
|
||||
|
||||
if ! command -v codex > /dev/null 2>&1; then
|
||||
bashio::log.fatal "Codex CLI is not available"
|
||||
exit 1
|
||||
fi
|
||||
if ! command -v headroom > /dev/null 2>&1; then
|
||||
bashio::log.fatal "Headroom is not available"
|
||||
exit 1
|
||||
fi
|
||||
if ! command -v rtk > /dev/null 2>&1; then
|
||||
bashio::log.fatal "RTK is not available"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
bashio::log.info "Codex: $(codex --version 2>&1 | head -n 1)"
|
||||
bashio::log.info "Headroom: $(headroom --version 2>&1 | head -n 1)"
|
||||
bashio::log.info "RTK: $(rtk --version 2>&1 | head -n 1)"
|
||||
|
||||
# Configure RTK's native Codex integration ahead of the first wrapped session.
|
||||
if ! s6-setuidgid abc env \
|
||||
HOME="$HOME" \
|
||||
CODEX_HOME="${CODEX_HOME:-$HOME/.codex}" \
|
||||
PATH="$HOME/.local/bin:/usr/local/bin:/usr/bin:/bin" \
|
||||
RTK_NONINTERACTIVE=1 \
|
||||
rtk init -g --codex; then
|
||||
bashio::log.warning "RTK Codex initialization failed; Headroom will retry when wrapping Codex"
|
||||
fi
|
||||
|
||||
for key in CODEX_AUTO_START CODEX_USE_HEADROOM HEADROOM_OUTPUT_SHAPER HEADROOM_CODE_AWARE_ENABLED; do
|
||||
case "$key" in
|
||||
CODEX_AUTO_START)
|
||||
bashio::config.true 'auto_start_codex' && value="1" || value="0"
|
||||
;;
|
||||
CODEX_USE_HEADROOM)
|
||||
bashio::config.true 'use_headroom' && value="1" || value="0"
|
||||
;;
|
||||
HEADROOM_OUTPUT_SHAPER)
|
||||
bashio::config.true 'headroom_output_shaper' && value="1" || value="0"
|
||||
;;
|
||||
HEADROOM_CODE_AWARE_ENABLED)
|
||||
bashio::config.true 'headroom_code_aware' && value="1" || value="0"
|
||||
;;
|
||||
esac
|
||||
printf '%s' "$value" > "/run/s6/container_environment/$key"
|
||||
done
|
||||
printf '%s' 'rtk' > /run/s6/container_environment/HEADROOM_CONTEXT_TOOL
|
||||
|
||||
chown -R "$PUID:$PGID" "$HOME/.codex" "$HOME/.headroom"
|
||||
@@ -1,29 +0,0 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
if bashio::config.has_value 'github_username'; then
|
||||
s6-setuidgid abc git config --global user.name "$(bashio::config 'github_username')"
|
||||
fi
|
||||
|
||||
if bashio::config.has_value 'github_email'; then
|
||||
s6-setuidgid abc git config --global user.email "$(bashio::config 'github_email')"
|
||||
fi
|
||||
|
||||
if bashio::config.has_value 'github_token'; then
|
||||
token="$(bashio::config 'github_token')"
|
||||
if s6-setuidgid abc env -u GH_TOKEN -u GITHUB_TOKEN gh auth status --hostname github.com > /dev/null 2>&1; then
|
||||
bashio::log.info "GitHub CLI is already authenticated"
|
||||
else
|
||||
bashio::log.info "Authenticating GitHub CLI"
|
||||
printf '%s\n' "$token" | s6-setuidgid abc env -u GH_TOKEN -u GITHUB_TOKEN \
|
||||
gh auth login --hostname github.com --with-token || \
|
||||
bashio::log.warning "GitHub CLI authentication failed"
|
||||
fi
|
||||
s6-setuidgid abc env -u GH_TOKEN -u GITHUB_TOKEN \
|
||||
gh auth setup-git --hostname github.com || \
|
||||
bashio::log.warning "GitHub CLI git credential setup failed"
|
||||
else
|
||||
bashio::log.info "Set github_token to authenticate gh and Git operations"
|
||||
fi
|
||||
@@ -1,54 +0,0 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
port=7681
|
||||
workspace="$(bashio::config 'workspace')"
|
||||
|
||||
if [ -z "$workspace" ] || [ "$workspace" = "null" ]; then
|
||||
workspace="$HOME/workspace"
|
||||
fi
|
||||
|
||||
if [[ "$workspace" != /* ]]; then
|
||||
bashio::log.fatal "workspace must be an absolute path"
|
||||
exec sleep infinity
|
||||
fi
|
||||
if [ -L "$workspace" ]; then
|
||||
bashio::log.fatal "workspace must not be a symbolic link"
|
||||
exec sleep infinity
|
||||
fi
|
||||
|
||||
workspace="$(realpath -m -- "$workspace")"
|
||||
case "$workspace" in
|
||||
"$HOME" | "$HOME"/* | /share/* | /media/* | /mnt/* | /data/* | /config/*)
|
||||
;;
|
||||
*)
|
||||
bashio::log.fatal "workspace must be below the persistent home, /share, /media, /mnt, /data, or /config"
|
||||
exec sleep infinity
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ ! -e "$workspace" ]; then
|
||||
install -d -m 0750 -o abc -g abc "$workspace"
|
||||
elif [ ! -d "$workspace" ]; then
|
||||
bashio::log.fatal "workspace is not a directory: $workspace"
|
||||
exec sleep infinity
|
||||
fi
|
||||
|
||||
if ! s6-setuidgid abc test -r "$workspace" || \
|
||||
! s6-setuidgid abc test -w "$workspace" || \
|
||||
! s6-setuidgid abc test -x "$workspace"; then
|
||||
bashio::log.fatal "workspace must be readable, writable, and searchable by user abc: $workspace"
|
||||
exec sleep infinity
|
||||
fi
|
||||
|
||||
export CODEX_TERMINAL_WORKSPACE="$workspace"
|
||||
bashio::log.info "Starting persistent Codex terminal on Home Assistant ingress port $port"
|
||||
exec s6-setuidgid abc ttyd \
|
||||
-p "$port" \
|
||||
-W \
|
||||
-O \
|
||||
-t disableLeaveAlert=true \
|
||||
-t fontSize=14 \
|
||||
/usr/local/bin/codex-terminal-shell
|
||||
@@ -1 +0,0 @@
|
||||
longrun
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
export PATH="${HOME}/.local/bin:/usr/local/bin:/usr/bin:/bin:${PATH:-}"
|
||||
exec codex "$@"
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
export PATH="${HOME}/.local/bin:/usr/local/bin:/usr/bin:/bin:${PATH:-}"
|
||||
export HEADROOM_CONTEXT_TOOL="rtk"
|
||||
|
||||
if ! command -v headroom > /dev/null 2>&1; then
|
||||
echo "Headroom is unavailable; launching Codex directly." >&2
|
||||
exec codex "$@"
|
||||
fi
|
||||
|
||||
if [ "$#" -eq 0 ]; then
|
||||
exec headroom wrap codex
|
||||
fi
|
||||
exec headroom wrap codex -- "$@"
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
export PATH="${HOME}/.local/bin:/usr/local/bin:/usr/bin:/bin:${PATH:-}"
|
||||
exec codex login --device-auth "$@"
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
export SHELL="/bin/bash"
|
||||
export PATH="${HOME}/.local/bin:/usr/local/bin:/usr/bin:/bin:${PATH:-}"
|
||||
|
||||
workspace="${CODEX_TERMINAL_WORKSPACE:-${HOME}/workspace}"
|
||||
session_name="${CODEX_TMUX_SESSION:-codex}"
|
||||
|
||||
if [ ! -d "$workspace" ]; then
|
||||
echo "Codex workspace does not exist: $workspace" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
new_session=0
|
||||
if ! tmux has-session -t "$session_name" 2> /dev/null; then
|
||||
tmux new-session -d -s "$session_name" -c "$workspace" /bin/bash -l
|
||||
new_session=1
|
||||
fi
|
||||
|
||||
if [ "$new_session" -eq 1 ]; then
|
||||
tmux send-keys -t "$session_name" \
|
||||
"printf '\\nChatGPT Codex add-on\\n login: codex-login\\n optimized: codex-headroom\\n direct: codex-direct\\n savings: rtk gain && headroom perf\\n\\n'" C-m
|
||||
if [ "${CODEX_AUTO_START:-1}" = "1" ]; then
|
||||
if [ "${CODEX_USE_HEADROOM:-1}" = "1" ]; then
|
||||
tmux send-keys -t "$session_name" "codex-headroom" C-m
|
||||
else
|
||||
tmux send-keys -t "$session_name" "codex-direct" C-m
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
exec tmux attach-session -t "$session_name"
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"github_beta": false,
|
||||
"github_fulltag": false,
|
||||
"github_havingasset": true,
|
||||
"github_tagfilter": "rust-v",
|
||||
"last_update": "2026-07-14",
|
||||
"repository": "alexbelgium/hassio-addons",
|
||||
"slug": "chatgpt_codex",
|
||||
"source": "github",
|
||||
"upstream_repo": "openai/codex",
|
||||
"upstream_version": "0.144.3"
|
||||
}
|
||||
Reference in New Issue
Block a user