Skip to main content

Module orchestrator

Module orchestrator 

Source
Expand description

The orchestrator’s home, its daemon lease, and the service unit the operator verbs print (ORC-7).

supercode does not perform orchestration; the supercode-orchestrator package does (docs/ORCHESTRATOR-IR.md §0.1). This module holds the three facts supercode’s own surfaces need about it:

  • where its state livesSUPERCODE_ORCHESTRATOR_HOME, default ~/.supercode/orchestrator, resolved once in crate::HarnessHomes::orchestrator; the root folder IS the default profile and profiles/<name>/ are the named ones (docs/ORCHESTRATOR-IR.md §6).
  • whether the daemon is up — the lease file <home>/orchestrator.lock, plus a liveness signal on the pid it names. A lock whose process is gone is stale, never “up”.
  • what a service unit for it would say, and whether it is installedservice_unit renders the launchd plist / systemd unit setup writes under <home>/service/; install_service, uninstall_service and service_status drive launchctl / systemctl --user over it.

The lease FILE is written by the daemon itself (bin/orchestrator.mjs), not by this crate: one writer means a service-managed daemon reports the same lease a foreground one does, and a lock left by a process that is gone is the daemon’s own signal to replay (§4.7).

Reading the folder is every existing ORCH reader’s job: jobs, runs, routes, channels, triggers, profiles and session discovery point their Hermes-shaped code paths at these same profile folders.

Structs§

Lease
The lease <home>/orchestrator.lock holds: which process is serving this home, and since when.
ServiceState
What the platform’s service manager says about the orchestrator unit.
ServiceUnit
A rendered service unit: what setup prints and writes.

Enums§

OrchestratorError
Why an operator verb could not do its work.

Constants§

DAEMON_ENTRY
The daemon entry inside the sdk/orchestrator package.
LOCK_FILE
Lease file the daemon writes while it serves a home, relative to the home.
SERVICE_DIR
Directory setup writes the rendered service unit into.
SERVICE_NAME
launchd label / systemd unit name for the orchestrator daemon.

Functions§

absolute_program
launchd and systemd start a unit with a minimal PATH, so the unit names the interpreter absolutely wherever one can be resolved.
clear_lease
Remove the lease file. A missing file is not an error — stop is idempotent by design.
daemon_entry
Locate the Node daemon entry (sdk/orchestrator/bin/orchestrator.mjs).
install_service
Render the unit, hand it to the platform’s service manager, and start it.
live_lease
The lease of a daemon that is actually alive right now.
lock_path
The lease path for one home.
pid_is_live
Whether pid is a live process this user can signal.
read_lease
Read the lease, whether or not its process is still alive.
service_status
Ask the platform’s service manager about the orchestrator unit.
service_unit
Render the per-platform service unit for one home.
stop
Ask the daemon to stop: SIGTERM to the leased pid, then clear the lease.
uninstall_service
Stop and unregister the unit, and remove the rendered file setup wrote.
write_lease
Write the lease for a running daemon.
write_unit
Write a rendered unit under <home>/service/.