Class: GDKBox::Harness
- Inherits:
-
Object
- Object
- GDKBox::Harness
- Defined in:
- lib/gdkbox/harness.rb
Overview
An agent CLI ("harness") that can be installed into a box and dispatched to
run tasks headlessly. gdkbox ships a small registry of harnesses; each box
runs exactly one, chosen at gdkbox up --harness.
The npm-installable harnesses reuse the same mise-aware install path as Claude Code (install into ~/.local, symlink the binary + node into /usr/local/bin). A harness declares the env var its provider reads for credentials and the config.yml key gdkbox looks under for a default.
Instance Attribute Summary collapse
-
#bin ⇒ Object
readonly
Returns the value of attribute bin.
-
#config_key ⇒ Object
readonly
Returns the value of attribute config_key.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#key_env ⇒ Object
readonly
Returns the value of attribute key_env.
-
#npm_flags ⇒ Object
readonly
Returns the value of attribute npm_flags.
-
#npm_package ⇒ Object
readonly
Returns the value of attribute npm_package.
-
#skills_subdir ⇒ Object
readonly
Returns the value of attribute skills_subdir.
-
#summary ⇒ Object
readonly
Returns the value of attribute summary.
Class Method Summary collapse
- .[](id) ⇒ Object
- .all ⇒ Object
-
.default ⇒ Object
The harness used when none is specified.
- .ids ⇒ Object
- .register(**kwargs) ⇒ Object
Instance Method Summary collapse
-
#agent_command(json:, yolo:) ⇒ Object
The in-box shell snippet that runs the agent against $GDKBOX_TASK.
-
#initialize(id:, bin:, key_env:, config_key:, summary:, run:, skills_subdir:, npm_package: nil, npm_flags: nil) ⇒ Harness
constructor
A new instance of Harness.
-
#installable? ⇒ Boolean
True when gdkbox knows how to install this harness automatically.
Constructor Details
#initialize(id:, bin:, key_env:, config_key:, summary:, run:, skills_subdir:, npm_package: nil, npm_flags: nil) ⇒ Harness
Returns a new instance of Harness.
45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/gdkbox/harness.rb', line 45 def initialize(id:, bin:, key_env:, config_key:, summary:, run:, skills_subdir:, npm_package: nil, npm_flags: nil) @id = id @npm_package = npm_package @npm_flags = npm_flags @bin = bin @key_env = key_env @config_key = config_key @summary = summary @run = run @skills_subdir = skills_subdir end |
Instance Attribute Details
#bin ⇒ Object (readonly)
Returns the value of attribute bin.
42 43 44 |
# File 'lib/gdkbox/harness.rb', line 42 def bin @bin end |
#config_key ⇒ Object (readonly)
Returns the value of attribute config_key.
42 43 44 |
# File 'lib/gdkbox/harness.rb', line 42 def config_key @config_key end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
42 43 44 |
# File 'lib/gdkbox/harness.rb', line 42 def id @id end |
#key_env ⇒ Object (readonly)
Returns the value of attribute key_env.
42 43 44 |
# File 'lib/gdkbox/harness.rb', line 42 def key_env @key_env end |
#npm_flags ⇒ Object (readonly)
Returns the value of attribute npm_flags.
42 43 44 |
# File 'lib/gdkbox/harness.rb', line 42 def npm_flags @npm_flags end |
#npm_package ⇒ Object (readonly)
Returns the value of attribute npm_package.
42 43 44 |
# File 'lib/gdkbox/harness.rb', line 42 def npm_package @npm_package end |
#skills_subdir ⇒ Object (readonly)
Returns the value of attribute skills_subdir.
42 43 44 |
# File 'lib/gdkbox/harness.rb', line 42 def skills_subdir @skills_subdir end |
#summary ⇒ Object (readonly)
Returns the value of attribute summary.
42 43 44 |
# File 'lib/gdkbox/harness.rb', line 42 def summary @summary end |
Class Method Details
.[](id) ⇒ Object
22 23 24 25 26 |
# File 'lib/gdkbox/harness.rb', line 22 def [](id) @registry.fetch(id.to_s) do raise Error, "Unknown harness '#{id}'. Available: #{ids.join(', ')}." end end |
.all ⇒ Object
28 29 30 |
# File 'lib/gdkbox/harness.rb', line 28 def all @registry.values end |
.default ⇒ Object
The harness used when none is specified.
37 38 39 |
# File 'lib/gdkbox/harness.rb', line 37 def default "claude" end |
.ids ⇒ Object
32 33 34 |
# File 'lib/gdkbox/harness.rb', line 32 def ids @registry.keys end |
.register(**kwargs) ⇒ Object
16 17 18 19 20 |
# File 'lib/gdkbox/harness.rb', line 16 def register(**kwargs) harness = new(**kwargs) @registry[harness.id] = harness harness end |
Instance Method Details
#agent_command(json:, yolo:) ⇒ Object
The in-box shell snippet that runs the agent against $GDKBOX_TASK. The caller wraps it with a timeout and sources the seeded API key.
65 66 67 |
# File 'lib/gdkbox/harness.rb', line 65 def agent_command(json:, yolo:) @run.call(json: json, yolo: yolo) end |
#installable? ⇒ Boolean
True when gdkbox knows how to install this harness automatically.
59 60 61 |
# File 'lib/gdkbox/harness.rb', line 59 def installable? !@npm_package.nil? end |