Module: AgUi::Server::Info

Defined in:
lib/ag_ui/server/info.rb

Overview

Builds the GET /info payload — the envelope the CopilotKit client fetches on mount to discover agents and feature-detect capabilities. Shape extracted verbatim from @copilotkit/runtime's get-runtime-info.mjs (docs/09-ground-truth-host-app.md §1).

The client feature-detects A2UI from the TOP-LEVEL a2uiEnabled flag; when enabled, the optional a2ui: {enabled: true} detail object rides along.

Constant Summary collapse

VERSION_PARITY =

The runtime version the client was built against; advertise the same so version-gated client behaviour matches the Node sidecar.

"1.62.2"

Class Method Summary collapse

Class Method Details

.payload(agent_id: "default", description: nil, a2ui_enabled: false, overrides: {}) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/ag_ui/server/info.rb', line 22

def payload(agent_id: "default", description: nil, a2ui_enabled: false, overrides: {})
  agent = { "name" => agent_id, "className" => "BuiltInAgent" }
  unless description.nil?
    agent["description"] = description
  end

  base = {
    "version" => VERSION_PARITY,
    "agents" => { agent_id => agent },
    "audioFileTranscriptionEnabled" => false,
    "mode" => "sse",
    "threadEndpoints" => {
      "list" => false,
      "inspect" => false,
      "mutations" => false,
      "realtimeMetadata" => false,
    },
    "a2uiEnabled" => a2ui_enabled,
    "openGenerativeUIEnabled" => false,
    "telemetryDisabled" => true,
  }

  if a2ui_enabled
    base["a2ui"] = { "enabled" => true }
  end

  base.merge(overrides)
end