Skip to main content

OpenMIA webhook-based observability collectors for local agent integrations.

Project description

OpenMIA Webhooker

OpenMIA Webhooker is a small Python package for converting local agent events into OpenMIA Runtime JSON v1 payloads and uploading them through the existing OpenMIA custom_json webhook endpoint.

Current adapters:

  • Codex hooks
  • Claude Code stream-json, non-interactive wrapper and local JSONL watcher

Runtime JSON v1

Webhooker owns source-specific semantics. It turns Codex, Claude Code and future local agent/webhook events into a stable runtime shape:

{
  "schemaVersion": "openmia.runtime.v1",
  "source": { "type": "codex", "adapter": "codex_hooks" },
  "session": { "id": "local-session" },
  "trace": { "id": "codex_custom_abc", "name": "Codex session" },
  "spans": [
    { "id": "codex_custom_abc_chat_turn_1", "parentId": null, "roundId": "turn_1", "type": "chat" }
  ]
}

Each local session maps to one stable trace. New user prompts or Claude Code runs in that session append a top-level chat span with a stable roundId under the same trace. The SDK does not emit empty round or session-summary spans; OpenMIA can derive round grouping from roundId while the trace itself represents the session.

The OpenMIA app server then performs raw-first storage, validation, tenant isolation and normalized trace/span writes. This keeps Codex/Claude semantics in the SDK layer and prevents the server from growing one adapter per local tool.

For compatibility, the payload is still sent to the custom_json webhook.

Install

pip install openmia-webhooker

For local development:

python3 -m pip install -e .

CLI

openmia-webhooker doctor
openmia-webhooker codex self_test --dry-run
openmia-webhooker codex user_prompt_submit
openmia-webhooker claude-code --dry-run
openmia-webhooker claude-code-run --dry-run -- -p "hello"
openmia-webhooker claude-code-watch --once --dry-run
openmia-webhooker claude-code-watch --follow

Claude Code support has three modes:

  • claude-code: reads Claude Code stream-json from stdin for pipes, CI and debugging.
  • claude-code-run: wraps non-interactive claude -p/--print, forces --verbose --output-format stream-json, uploads the trace, then prints Claude's final result. Use --claude-command or OPENMIA_CLAUDE_COMMAND if the executable is not named claude.
  • claude-code-watch: reads Claude Code project JSONL files and uploads completed local rounds without wrapping the claude command. The default is ~/.claude/projects/**/*.jsonl; use --projects-dir or OPENMIA_CLAUDE_PROJECTS_DIR to override it. In --follow mode, status is written to stderr; TTYs use an inline one-line refresh by default, while logs/CI fall back to line output.

Status display controls:

openmia-webhooker claude-code-watch --follow --status-style auto
openmia-webhooker claude-code-watch --follow --status-style inline
openmia-webhooker claude-code-watch --follow --status-style line
openmia-webhooker claude-code-watch --follow --status-style off
openmia-webhooker claude-code-watch --follow --no-status

Deployment Guide

See docs/OPENMIA_CUSTOM_JSON_DEPLOYMENT.md for Linux/macOS and Windows deployment steps, Codex hook configuration, Claude Code wrapper/watcher setup, privacy settings and troubleshooting. For more OpenMIA trace tutorials and product concepts, see https://docs.openmia.ai/app/observation/traces.

Configuration Paths

Webhooker keeps the existing local file contract:

  • env file: ~/.codex/openmia-custom-json.env
  • state: ~/.codex/openmia-custom-json/state
  • log: ~/.codex/openmia-custom-json/collector.log

OPENMIA_CAPTURE_TEXT defaults to true, so prompt text, tool input/output and assistant output are uploaded to OpenMIA traces unless explicitly disabled. Set OPENMIA_CAPTURE_TEXT=false in the env file to upload only length and sha256 summaries. The local collector log records upload status and server responses only; it does not store raw prompt or tool text.

Path resolution is cross-platform and configurable. Explicit code config wins, then OPENMIA_HOME, then compatible CODEX_HOME, then Path.home() / ".codex". Advanced overrides are available through OPENMIA_CUSTOM_JSON_ENV_FILE, OPENMIA_STATE_DIR and OPENMIA_LOG_PATH.

Test

python3 -m unittest discover tests

License

Apache-2.0. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openmia_webhooker-0.1.0.tar.gz (36.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openmia_webhooker-0.1.0-py3-none-any.whl (31.6 kB view details)

Uploaded Python 3

File details

Details for the file openmia_webhooker-0.1.0.tar.gz.

File metadata

  • Download URL: openmia_webhooker-0.1.0.tar.gz
  • Upload date:
  • Size: 36.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.1

File hashes

Hashes for openmia_webhooker-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7276eaf60b005c8847d04ffc365592325b7c711771a44883589890133af018c0
MD5 20cdb6142343f33e1e61e20dbc42c6b0
BLAKE2b-256 3cfc528f5982bbaa74b691b634cb07d3c68184f738eacdfefabecb1e0879d001

See more details on using hashes here.

File details

Details for the file openmia_webhooker-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for openmia_webhooker-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e856b65d8f97d664b326be95479fd35a6f4d03d2ae45edb1326070c16f0065ac
MD5 846206230c1c89cbfe0fe07f054ecf04
BLAKE2b-256 8577dc1895cac970998afcc3de02b8c6c712e7c1b7f891bb11af0f1089c6d0f5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page