Module: Ask::CodingHarness

Defined in:
lib/ask-coding-harness.rb,
lib/ask/coding_harness/cli.rb,
lib/ask/coding_harness/store.rb,
lib/ask/coding_harness/config.rb,
lib/ask/coding_harness/runner.rb,
lib/ask/coding_harness/server.rb,
lib/ask/coding_harness/version.rb,
lib/ask/coding_harness/agent_runner.rb,
lib/ask/coding_harness/demo_adapter.rb,
lib/ask/coding_harness/system_prompt.rb,
lib/ask/coding_harness/event_translator.rb

Overview

Ask Coding Harness — a general-purpose coding agent in the browser.

Self-hosted web coding agent for the ask-rb ecosystem. Runs Ask::Agent::Session against any workspace, streams every event to a mobile-first PWA over SSE, and comes with an ach utility CLI for headless runs.

Ask::CodingHarness.configure do |c|
c.workspace = "/path/to/project"
c.model = "deepseek-v4-flash"
end

Ask::CodingHarness.run_server

Defined Under Namespace

Classes: AgentRunner, CLI, Config, DemoAdapter, EventTranslator, Runner, Server, Store, SystemPrompt

Constant Summary collapse

VERSION =
"0.2.1"

Class Method Summary collapse

Class Method Details

.configObject

Global configuration. See Config for available settings.



22
23
24
# File 'lib/ask-coding-harness.rb', line 22

def config
  @config ||= Config.new
end

.configure {|config| ... } ⇒ Object

Configure the harness. Yields the global Config instance.

Yields:



27
28
29
30
# File 'lib/ask-coding-harness.rb', line 27

def configure
  yield config if block_given?
  config
end

.run(prompt, workspace: nil, **opts) ⇒ Ask::CodingHarness::Runner::Result

Run a prompt headlessly against the workspace and return the result.

Parameters:

  • prompt (String)

    the task to run

  • workspace (String, nil) (defaults to: nil)

    overrides config.workspace

Returns:



48
49
50
51
# File 'lib/ask-coding-harness.rb', line 48

def run(prompt, workspace: nil, **opts)
  require_relative "ask/coding_harness/runner"
  Runner.new(config: config).run(prompt, workspace: workspace, **opts)
end

.run_server(host: nil, port: nil) ⇒ Object

Run the web server (blocking). See CLI for the non-blocking path.



33
34
35
36
37
38
39
40
41
# File 'lib/ask-coding-harness.rb', line 33

def run_server(host: nil, port: nil)
  require_relative "ask/coding_harness/server"
  require "rackup"

  store = Store.new(db_path: config.db_path)
  runner = AgentRunner.new(config: config, store: store)
  app = Server.build(config: config, store: store, runner: runner).freeze.app
  Rackup::Server.start(app: app, Host: host || config.host, Port: port || config.port)
end