Class: Ask::CodingHarness::Server

Inherits:
Roda
  • Object
show all
Defined in:
lib/ask/coding_harness/server.rb

Overview

HTTP API + static file server for the coding harness.

Endpoints:

GET  /api/config          — models, adapter, workspace, features
GET  /api/workspace       — workspace name, root, git branch
GET  /api/conversations   — list conversations (archived filter)
GET  /api/conversations/:id         — conversation with messages
PATCH /api/conversations/:id        — rename
DELETE /api/conversations/:id       — delete
POST /api/conversations/:id/archive — toggle archive
PATCH/DELETE /api/conversations/:id/messages/:index — edit/trim
POST /api/chat            — send a message, stream events via SSE
POST /api/conversations/:id/approvals/:actionId/approve|reject
POST /api/conversations/:id/approvals/approve-all
POST /api/conversations/:id/plan/approve|reject
POST /api/conversations/:id/abort
GET  /*                   — static frontend (PWA), SPA fallback

Class Method Summary collapse

Class Method Details

.build(config:, store:, runner:) ⇒ Object

Build a server instance wired to the given components. Tests build servers with fakes; the CLI builds with the real store + runner.

Parameters:



54
55
56
57
58
59
60
# File 'lib/ask/coding_harness/server.rb', line 54

def self.build(config:, store:, runner:)
  Class.new(self) do
    define_method(:harness_config) { config }
    define_method(:harness_store) { store }
    define_method(:harness_runner) { runner }
  end
end

.public_dirObject

Built frontend (PWA). Shipped inside the gem.



28
29
30
# File 'lib/ask/coding_harness/server.rb', line 28

def self.public_dir
  File.expand_path("../../../public", __dir__)
end