Class: HermesAgent::Client::Entities::Job
- Inherits:
-
HermesAgent::Client::Entity
- Object
- HermesAgent::Client::Entity
- HermesAgent::Client::Entities::Job
- Defined in:
- lib/hermes_agent/client/entities/job.rb
Overview
A scheduled background job from the Jobs API (/api/jobs): a cron-like
recurring task, a one-shot deferred task, or a watchdog script. The same
object is returned by create, get, list, update, pause, resume, and
trigger.
Note the timestamp fields (#created_at / #next_run_at / #last_run_at / #paused_at) are ISO-8601 strings with an offset, not the epoch floats the runs and responses APIs use; they are exposed verbatim with no Time parsing. The override slots (#model / #provider / #base_url / #workdir / #profile / #context_from) are read-only here — the HTTP API ignores them on create/update, so they are surfaced as readers but are not create/update parameters.
Field readers are best-effort; HermesAgent::Client::Entity#to_h remains the source of truth.
Instance Method Summary collapse
-
#base_url ⇒ String?
The per-job base URL override.
-
#context_from ⇒ String?
The source to pull run context from.
-
#created_at ⇒ String?
When the job was created, as an ISO-8601 string with offset.
-
#deliver ⇒ String?
The delivery target, e.g.
-
#enabled? ⇒ boolean?
Whether the job is enabled (
falsewhile paused). -
#enabled_toolsets ⇒ Object?
The toolset allowlist, passed through raw;
nil= the default set. -
#id ⇒ String?
The job id: 12 lowercase hex characters (no
run_-style prefix). -
#last_delivery_error ⇒ String?
The error detail from the last delivery attempt, or
nilon success. -
#last_error ⇒ String?
The error detail from the last execution when #last_status is
"error", ornilon success. -
#last_run_at ⇒ String?
When the job last ran, as an ISO-8601 string with offset;
niluntil the first execution. -
#last_status ⇒ String?
The outcome of the most recent run:
"ok"on success or"error"when the run failed;nilbefore the first run. -
#model ⇒ String?
The per-job model override.
-
#name ⇒ String?
The human-friendly job name (required on create).
-
#next_run_at ⇒ String?
When the job is next scheduled to run, as an ISO-8601 string with offset.
-
#no_agent? ⇒ boolean
Whether the LLM is skipped entirely: the #script runs and its stdout is delivered verbatim (the watchdog pattern).
-
#origin ⇒ Object?
The originating channel info (for
deliver: "origin"), passed through raw;nilfor locally created jobs. -
#paused_at ⇒ String?
When the job was paused, as an ISO-8601 string;
nilwhen not paused. -
#paused_reason ⇒ String?
The optional reason the job was paused;
nilfor a manual pause. -
#profile ⇒ String?
The Hermes profile the job runs under.
-
#prompt ⇒ String?
The task instruction given to the agent each run.
-
#provider ⇒ String?
The per-job provider override.
-
#repeat ⇒ JobRepeat?
The repeat policy, wrapped in a JobRepeat.
-
#schedule ⇒ JobSchedule?
The schedule, wrapped in a JobSchedule.
-
#schedule_display ⇒ String?
A human-readable rendering of the schedule (mirrors HermesAgent::Client::Entities::JobSchedule#display).
-
#script ⇒ String?
The path of a script (under
~/.hermes/scripts/) run each execution; by default its stdout is injected into the agent prompt. -
#skill ⇒ String?
The single attached skill (a scalar slot separate from #skills);
nilwhen unused. -
#skills ⇒ Array<String>?
The attached skill names.
-
#state ⇒ String?
The lifecycle state, e.g.
-
#workdir ⇒ String?
The absolute working directory for the run.
Methods inherited from HermesAgent::Client::Entity
Instance Method Details
#base_url ⇒ String?
The per-job base URL override. Read-only via this API; nil =
the profile's configured base URL.
200 201 202 |
# File 'lib/hermes_agent/client/entities/job.rb', line 200 def base_url self["base_url"] end |
#context_from ⇒ String?
The source to pull run context from. Read-only via this API.
227 228 229 |
# File 'lib/hermes_agent/client/entities/job.rb', line 227 def context_from self["context_from"] end |
#created_at ⇒ String?
When the job was created, as an ISO-8601 string with offset.
296 297 298 |
# File 'lib/hermes_agent/client/entities/job.rb', line 296 def created_at self["created_at"] end |
#deliver ⇒ String?
The delivery target, e.g. "local", "origin", "telegram", or
"platform:chat_id". Defaults to "local".
350 351 352 |
# File 'lib/hermes_agent/client/entities/job.rb', line 350 def deliver self["deliver"] end |
#enabled? ⇒ boolean?
Whether the job is enabled (false while paused).
262 263 264 |
# File 'lib/hermes_agent/client/entities/job.rb', line 262 def enabled? self["enabled"] end |
#enabled_toolsets ⇒ Object?
The toolset allowlist, passed through raw; nil = the default set.
Expected to be a plain array of names if populated (never observed), so
it is not wrapped.
370 371 372 |
# File 'lib/hermes_agent/client/entities/job.rb', line 370 def enabled_toolsets self["enabled_toolsets"] end |
#id ⇒ String?
The job id: 12 lowercase hex characters (no run_-style prefix).
138 139 140 |
# File 'lib/hermes_agent/client/entities/job.rb', line 138 def id self["id"] end |
#last_delivery_error ⇒ String?
The error detail from the last delivery attempt, or nil on success.
341 342 343 |
# File 'lib/hermes_agent/client/entities/job.rb', line 341 def last_delivery_error self["last_delivery_error"] end |
#last_error ⇒ String?
The error detail from the last execution when #last_status is
"error", or nil on success. The message is prefixed with the
failing exception class, e.g. "RuntimeError: Gemini HTTP 400 …".
333 334 335 |
# File 'lib/hermes_agent/client/entities/job.rb', line 333 def last_error self["last_error"] end |
#last_run_at ⇒ String?
When the job last ran, as an ISO-8601 string with offset; nil until
the first execution.
314 315 316 |
# File 'lib/hermes_agent/client/entities/job.rb', line 314 def last_run_at self["last_run_at"] end |
#last_status ⇒ String?
The outcome of the most recent run: "ok" on success or "error"
when the run failed; nil before the first run.
323 324 325 |
# File 'lib/hermes_agent/client/entities/job.rb', line 323 def last_status self["last_status"] end |
#model ⇒ String?
The per-job model override. Read-only via this API (ignored on
create/update); nil means the profile's configured model is used.
182 183 184 |
# File 'lib/hermes_agent/client/entities/job.rb', line 182 def model self["model"] end |
#name ⇒ String?
The human-friendly job name (required on create).
146 147 148 |
# File 'lib/hermes_agent/client/entities/job.rb', line 146 def name self["name"] end |
#next_run_at ⇒ String?
When the job is next scheduled to run, as an ISO-8601 string with offset.
305 306 307 |
# File 'lib/hermes_agent/client/entities/job.rb', line 305 def next_run_at self["next_run_at"] end |
#no_agent? ⇒ boolean
Whether the LLM is skipped entirely: the #script runs and its stdout
is delivered verbatim (the watchdog pattern). Defaults to false (the
agent runs) when the field is absent.
219 220 221 |
# File 'lib/hermes_agent/client/entities/job.rb', line 219 def no_agent? !!self["no_agent"] end |
#origin ⇒ Object?
The originating channel info (for deliver: "origin"), passed through
raw; nil for locally created jobs. Its populated shape was never
observed, so it is not wrapped — use HermesAgent::Client::Entity#to_h / HermesAgent::Client::Entity#[] if a shape appears.
360 361 362 |
# File 'lib/hermes_agent/client/entities/job.rb', line 360 def origin self["origin"] end |
#paused_at ⇒ String?
When the job was paused, as an ISO-8601 string; nil when not paused.
280 281 282 |
# File 'lib/hermes_agent/client/entities/job.rb', line 280 def paused_at self["paused_at"] end |
#paused_reason ⇒ String?
The optional reason the job was paused; nil for a manual pause.
288 289 290 |
# File 'lib/hermes_agent/client/entities/job.rb', line 288 def paused_reason self["paused_reason"] end |
#profile ⇒ String?
The Hermes profile the job runs under. Read-only via this API;
nil = the scheduler's existing profile.
388 389 390 |
# File 'lib/hermes_agent/client/entities/job.rb', line 388 def profile self["profile"] end |
#prompt ⇒ String?
The task instruction given to the agent each run. nil for a
no_agent script job, which needs none.
155 156 157 |
# File 'lib/hermes_agent/client/entities/job.rb', line 155 def prompt self["prompt"] end |
#provider ⇒ String?
The per-job provider override. Read-only via this API; nil =
the profile's configured provider.
191 192 193 |
# File 'lib/hermes_agent/client/entities/job.rb', line 191 def provider self["provider"] end |
#repeat ⇒ JobRepeat?
The repeat policy, wrapped in a HermesAgent::Client::Entities::JobRepeat. Returns nil when absent.
253 254 255 256 |
# File 'lib/hermes_agent/client/entities/job.rb', line 253 def repeat raw = self["repeat"] raw.is_a?(::Hash) ? JobRepeat.new(raw) : nil end |
#schedule ⇒ JobSchedule?
The schedule, wrapped in a HermesAgent::Client::Entities::JobSchedule. Returns nil when absent.
235 236 237 238 |
# File 'lib/hermes_agent/client/entities/job.rb', line 235 def schedule raw = self["schedule"] raw.is_a?(::Hash) ? JobSchedule.new(raw) : nil end |
#schedule_display ⇒ String?
A human-readable rendering of the schedule (mirrors HermesAgent::Client::Entities::JobSchedule#display).
245 246 247 |
# File 'lib/hermes_agent/client/entities/job.rb', line 245 def schedule_display self["schedule_display"] end |
#script ⇒ String?
The path of a script (under ~/.hermes/scripts/) run each execution;
by default its stdout is injected into the agent prompt.
209 210 211 |
# File 'lib/hermes_agent/client/entities/job.rb', line 209 def script self["script"] end |
#skill ⇒ String?
The single attached skill (a scalar slot separate from #skills);
nil when unused.
173 174 175 |
# File 'lib/hermes_agent/client/entities/job.rb', line 173 def skill self["skill"] end |
#skills ⇒ Array<String>?
The attached skill names. The singular #skill is a separate scalar slot.
164 165 166 |
# File 'lib/hermes_agent/client/entities/job.rb', line 164 def skills self["skills"] end |
#state ⇒ String?
The lifecycle state, e.g. "scheduled" or "paused". (There is no
terminal state — an exhausted one-shot or capped job is deleted by the
server.)
272 273 274 |
# File 'lib/hermes_agent/client/entities/job.rb', line 272 def state self["state"] end |
#workdir ⇒ String?
The absolute working directory for the run. Read-only via this API;
nil = no project context.
379 380 381 |
# File 'lib/hermes_agent/client/entities/job.rb', line 379 def workdir self["workdir"] end |