engine_handle.h

src/facade/engine_handle.h

@file engine_handle.h @brief Private definition of the entropic_engine struct.

Owners: @tvanfossen

claim

bool entropic::HandleTurnGuard::claim()

Claim the turn.

src/facade/engine_handle.h:490

Source · 6 lines
    bool claim() {
        if (!claimed_ && engine_ != nullptr) {
            claimed_ = engine_->try_begin_turn(key_);
        }
        return claimed_;
    }
Activity · 3 steps
lines 491–491◇ if (!claimed_ && engine_ != nullptr)lines 492–492claimed_ = engine_->try_begin_turn(key_);lines 494–494return claimed_;

Requirements

REQ-API-009

claim_exclusive

bool entropic::HandleTurnGuard::claim_exclusive()

Claim the WHOLE engine: no run on any session, none may start.

src/facade/engine_handle.h:508

Source · 6 lines
    bool claim_exclusive() {
        if (!claimed_ && engine_ != nullptr) {
            claimed_ = engine_->try_begin_turn(key_, /*exclusive=*/true);
        }
        return claimed_;
    }
Activity · 3 steps
lines 509–509◇ if (!claimed_ && engine_ != nullptr)lines 510–510claimed_ = engine_->try_begin_turn(key_, /*exclusive=*/true);lines 512–512return claimed_;

Requirements

REQ-API-009

workspace_for

EntropicWorkspace * entropic::workspace_for(entropic_handle_t h, const std::string &key)

The workspace a session is bound to, or nullptr for the default.

src/facade/engine_handle.h:237

Show on the map →

Called by SCENARIO, workspace_servers

Calls none

Source · 9 lines
inline EntropicWorkspace* workspace_for(entropic_handle_t h,
                                        const std::string& key) {
    if (h == nullptr) { return nullptr; }
    std::lock_guard<std::mutex> lock(h->workspace_mutex);
    auto bound = h->session_workspace.find(key);
    if (bound == h->session_workspace.end()) { return nullptr; }
    auto ws = h->workspaces.find(bound->second);
    return ws == h->workspaces.end() ? nullptr : ws->second.get();
}
Activity · 8 steps
lines 239–239◇ if (h == nullptr)lines 239–239return nullptr;lines 240–240std::lock_guard<std::mutex> lock(h->workspace_mutex);lines 241–241auto bound = h->session_workspace.find(key);lines 242–242◇ if (bound == h->session_workspace.end())lines 242–242return nullptr;lines 243–243auto ws = h->workspaces.find(bound->second);lines 244–244return ws == h->workspaces.end() ? nullptr : ws->second.get();

Requirements

REQ-MCP-027

workspace_servers

entropic::ServerManager * entropic::workspace_servers(entropic_handle_t h, const std::string &key)

The MCP servers a session's tools must run against (gh#166).

src/facade/engine_handle.h:255

Show on the map →

Called by SCENARIO, facade_get_tool_prompt, facade_session_root, facade_unsafe_external_tools, session_tool_names, swap_session_tool_dir, turn_outcome, wire_tool_executor

Calls workspace_for

Source · 6 lines
inline entropic::ServerManager* workspace_servers(entropic_handle_t h,
                                                  const std::string& key) {
    auto* ws = workspace_for(h, key);
    if (ws != nullptr && ws->servers) { return ws->servers.get(); }
    return h != nullptr ? h->server_manager.get() : nullptr;
}
Activity · 5 steps
lines 257–257autolines 257–257* ws = workspace_for(h, key);lines 258–258◇ if (ws != nullptr && ws->servers)lines 258–258return ws->servers.get();lines 259–259return h != nullptr ? h->server_manager.get() : nullptr;

Requirements

REQ-MCP-027