-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
FyS
committed
Nov 17, 2023
1 parent
9add945
commit e5469a6
Showing
12 changed files
with
366 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Dual Licensing Either : | ||
// - AGPL | ||
// or | ||
// - Subscription license for commercial usage (without requirement of licensing propagation). | ||
// please contact [email protected] for additional information about this subscription commercial licensing. | ||
// | ||
// Created by FyS on 13/11/2023. License 2022-2023 | ||
// | ||
// In the case no license has been purchased for the use (modification or distribution in any way) of the software stack | ||
// the APGL license is applying. | ||
// | ||
|
||
#pragma once | ||
|
||
#include <variant> | ||
|
||
#include <protocol/fap_request.hh> | ||
|
||
namespace fabko { | ||
|
||
enum class action_source { | ||
automatic, | ||
manual | ||
}; | ||
|
||
/** | ||
* Represent an action that an agent is doing / going to do. | ||
* This is | ||
*/ | ||
struct agent_action { | ||
|
||
unsigned action_id{}; | ||
|
||
action_source source{action_source::automatic}; | ||
|
||
agent_protocol::request initial_request; | ||
|
||
agent_protocol::status status; | ||
}; | ||
|
||
} // namespace fabko |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Dual Licensing Either : | ||
// - AGPL | ||
// or | ||
// - Subscription license for commercial usage (without requirement of licensing propagation). | ||
// please contact [email protected] for additional information about this subscription commercial licensing. | ||
// | ||
// Created by FyS on 23/04/23. License 2022-2023 | ||
// | ||
// In the case no license has been purchased for the use (modification or distribution in any way) of the software stack | ||
// the APGL license is applying. | ||
// | ||
|
||
#include "boardcom.hh" | ||
|
||
namespace fabko { | ||
|
||
std::string agent_protocol::p2p::instantiate_black_board(const std::string&) { | ||
return {}; | ||
} | ||
|
||
std::string agent_protocol::online::instantiate_black_board(const std::string&) { | ||
return {}; | ||
} | ||
|
||
std::future<agent_protocol::propositions> agent_protocol::online::request_propositions(const std::string&) { | ||
return {}; | ||
} | ||
|
||
agent_protocol::decision_status agent_protocol::online::commit_decision(const std::string&) { | ||
return agent_protocol::decision_status::RETRY; | ||
} | ||
|
||
} // namespace fabko |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// Dual Licensing Either : | ||
// - AGPL | ||
// or | ||
// - Subscription license for commercial usage (without requirement of licensing propagation). | ||
// please contact [email protected] for additional information about this subscription commercial licensing. | ||
// | ||
// Created by FyS on 23/04/23. License 2022-2023 | ||
// | ||
// In the case no license has been purchased for the use (modification or distribution in any way) of the software stack | ||
// the APGL license is applying. | ||
// | ||
|
||
#pragma once | ||
|
||
#include <concepts> | ||
#include <future> | ||
#include <optional> | ||
#include <string> | ||
#include <variant> | ||
#include <vector> | ||
|
||
#include "fap_request.hh" | ||
|
||
namespace fabko::agent_protocol { | ||
|
||
struct proposition { | ||
std::string id; | ||
}; | ||
|
||
struct propositions { | ||
std::optional<std::vector<proposition>> props; | ||
status status{status::awaiting}; | ||
}; | ||
|
||
enum class decision_status { | ||
SUCCESS, | ||
RETRY, | ||
CANCELLED, | ||
}; | ||
|
||
|
||
/** | ||
* | ||
* @tparam T | ||
*/ | ||
template<typename T> | ||
concept c_board_com = | ||
requires(T a) { | ||
{ T::make_board(request{}) } -> std::convertible_to<std::string>; | ||
{ a.propositions(std::string{}) } -> std::convertible_to<std::future<propositions>>; | ||
{ a.commit_decision(std::string{}) } -> std::convertible_to<decision_status>; | ||
} && std::movable<T>; | ||
|
||
class p2p { | ||
public: | ||
static std::string instantiate_black_board(const std::string&); | ||
std::future<propositions> request_propositions(const std::string&); | ||
decision_status commit_decision(const std::string&); | ||
}; | ||
|
||
class online { | ||
public: | ||
static std::string instantiate_black_board(const std::string&); | ||
std::future<propositions> request_propositions(const std::string&); | ||
decision_status commit_decision(const std::string&); | ||
}; | ||
|
||
using board_protocol = std::variant<p2p, online>; | ||
|
||
} // namespace fabko::com |
Oops, something went wrong.