- Add console emitter interface for event-driven console output - Implement persistent cancel reason and explicit completion tracking - Add profile proto message definitions - Update edge and node transport layers with adapter execution terminology - Add new packages/events module - Update architecture documentation and README files
191 lines
5.2 KiB
Protocol Buffer
191 lines
5.2 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package iop;
|
|
|
|
import "google/protobuf/struct.proto";
|
|
|
|
option go_package = "iop/proto/gen/iop";
|
|
|
|
enum RunSessionMode {
|
|
RUN_SESSION_MODE_UNSPECIFIED = 0; // default: create if missing
|
|
RUN_SESSION_MODE_CREATE_IF_MISSING = 1;
|
|
RUN_SESSION_MODE_REQUIRE_EXISTING = 2;
|
|
}
|
|
|
|
enum CancelAction {
|
|
CANCEL_ACTION_UNSPECIFIED = 0; // default: cancel run only
|
|
CANCEL_ACTION_CANCEL_RUN = 1;
|
|
CANCEL_ACTION_TERMINATE_SESSION = 2;
|
|
}
|
|
|
|
// RunRequest initiates an adapter execution on a node.
|
|
message RunRequest {
|
|
string run_id = 1;
|
|
string adapter = 2;
|
|
string target = 3;
|
|
string workspace = 4;
|
|
google.protobuf.Struct policy = 5;
|
|
google.protobuf.Struct input = 6;
|
|
int32 timeout_sec = 7;
|
|
map<string, string> metadata = 8;
|
|
string session_id = 9;
|
|
RunSessionMode session_mode = 10;
|
|
bool background = 11;
|
|
}
|
|
|
|
// RunEvent is a streaming execution event.
|
|
message RunEvent {
|
|
string run_id = 1;
|
|
string type = 2; // start | delta | complete | error | cancelled
|
|
string delta = 3;
|
|
string message = 4;
|
|
string error = 5;
|
|
Usage usage = 6;
|
|
map<string, string> metadata = 7;
|
|
int64 timestamp = 8; // unix nano
|
|
string session_id = 9;
|
|
bool background = 10;
|
|
string node_id = 11;
|
|
}
|
|
|
|
// EdgeNodeEvent is a general edge-node lifecycle/control event envelope.
|
|
// It is separate from RunEvent, which is reserved for adapter execution streams.
|
|
message EdgeNodeEvent {
|
|
string event_id = 1;
|
|
string type = 2; // node.connected | node.disconnected | edge.disconnected | ...
|
|
string source = 3; // edge | node
|
|
string node_id = 4;
|
|
string alias = 5;
|
|
string reason = 6;
|
|
map<string, string> metadata = 7;
|
|
int64 timestamp = 8; // unix nano
|
|
}
|
|
|
|
message Usage {
|
|
int32 input_tokens = 1;
|
|
int32 output_tokens = 2;
|
|
}
|
|
|
|
// Heartbeat is sent by both sides to keep the connection alive.
|
|
message Heartbeat {
|
|
int64 timestamp = 1;
|
|
}
|
|
|
|
// CancelRequest asks the node to cancel a running execution.
|
|
message CancelRequest {
|
|
string run_id = 1;
|
|
string adapter = 2;
|
|
string target = 3;
|
|
string session_id = 4;
|
|
CancelAction action = 5;
|
|
}
|
|
|
|
enum NodeCommandType {
|
|
NODE_COMMAND_TYPE_UNSPECIFIED = 0;
|
|
NODE_COMMAND_TYPE_USAGE_STATUS = 1;
|
|
}
|
|
|
|
message NodeCommandRequest {
|
|
string request_id = 1;
|
|
NodeCommandType type = 2;
|
|
string adapter = 3;
|
|
string target = 4;
|
|
string session_id = 5;
|
|
int32 timeout_sec = 6;
|
|
map<string, string> metadata = 7;
|
|
}
|
|
|
|
message NodeCommandResponse {
|
|
string request_id = 1;
|
|
NodeCommandType type = 2;
|
|
string adapter = 3;
|
|
string target = 4;
|
|
string session_id = 5;
|
|
AgentUsageStatus usage_status = 6;
|
|
string error = 7;
|
|
}
|
|
|
|
message AgentUsageStatus {
|
|
string raw_output = 1;
|
|
string daily_limit = 2;
|
|
string daily_reset_time = 3;
|
|
string weekly_limit = 4;
|
|
string weekly_reset_time = 5;
|
|
map<string, string> metadata = 6;
|
|
}
|
|
|
|
|
|
// Error is returned when a request fails at the transport layer.
|
|
message Error {
|
|
string code = 1;
|
|
string message = 2;
|
|
}
|
|
|
|
// RegisterRequest is sent by node to edge immediately on connect.
|
|
message RegisterRequest {
|
|
string token = 1;
|
|
}
|
|
|
|
// RegisterResponse is sent by edge to node in response to RegisterRequest.
|
|
message RegisterResponse {
|
|
bool accepted = 1;
|
|
string node_id = 2;
|
|
string alias = 3;
|
|
string reason = 4; // rejection reason
|
|
NodeConfigPayload config = 5;
|
|
}
|
|
|
|
// NodeConfigPayload carries all configuration edge pushes to the node.
|
|
message NodeConfigPayload {
|
|
repeated AdapterConfig adapters = 1;
|
|
NodeRuntimeConfig runtime = 2;
|
|
}
|
|
|
|
// AdapterConfig describes one adapter to enable on the node.
|
|
message AdapterConfig {
|
|
string type = 1; // "mock" | "ollama" | "vllm" | "cli"
|
|
bool enabled = 2;
|
|
google.protobuf.Struct settings = 3; // legacy/compat path; new adapters use oneof
|
|
oneof config {
|
|
CLIAdapterConfig cli = 4;
|
|
OllamaAdapterConfig ollama = 5;
|
|
VllmAdapterConfig vllm = 6;
|
|
}
|
|
}
|
|
|
|
message CLIAdapterConfig {
|
|
map<string, CLIProfileConfig> profiles = 1;
|
|
}
|
|
|
|
message CLIProfileConfig {
|
|
string command = 1;
|
|
repeated string args = 2;
|
|
repeated string env = 3;
|
|
bool persistent = 4;
|
|
bool terminal = 5;
|
|
int32 response_idle_timeout_ms = 6;
|
|
int32 startup_idle_timeout_ms = 7;
|
|
string output_format = 8;
|
|
CLICompletionMarker completion_marker = 9;
|
|
string mode = 10;
|
|
repeated string resume_args = 11;
|
|
}
|
|
|
|
message CLICompletionMarker {
|
|
string line = 1;
|
|
string regex = 2;
|
|
}
|
|
|
|
message OllamaAdapterConfig {
|
|
string base_url = 1;
|
|
}
|
|
|
|
message VllmAdapterConfig {
|
|
string endpoint = 1;
|
|
}
|
|
|
|
// NodeRuntimeConfig is the runtime tuning pushed to the node.
|
|
message NodeRuntimeConfig {
|
|
int32 concurrency = 1;
|
|
string workspace_root = 2;
|
|
}
|