"""Docker entrypoint: receive kwargs as JSON via argv[1], run executor, print envelope.
Reads a JSON file path from argv[1] containing the execute_request kwargs dict.
Runs execute_request, prints the envelope JSON to stdout. Exit code 0 on success.
The script's directory (/executor/) is on sys.path by default, so the executor
package is importable directly.
"""
import json
import sys
from executor import execute_request
def main():
if len(sys.argv) < 2:
print(json.dumps({"ok": False, "error": "usage: executor_main.py <kwargs.json>"}))
sys.exit(1)
with open(sys.argv[1], "r") as f:
kwargs = json.load(f)
envelope = execute_request(**kwargs)
print(json.dumps(envelope))
sys.exit(0)
if __name__ == "__main__":
main()