A service in front of a hub needs four things: start a flow, follow it, read what a detached run produced, and decide approvals. This is that surface, plus the part a gateway cannot test without: a fake hub that speaks the same service from the same .proto files and can be scripted into every failure a real hub produces. Errors carry the hub's own class (chain-error-kind), a coarse family, and reachedHub, which separates a refused connection from a hub that reports a dependency as down. Both arrive as gRPC UNAVAILABLE, and a gateway that shows 'service not reachable' for the second one lies to its users. The .proto files are carried verbatim and loaded at runtime, so no generated code can drift from the contract; two guards hold the copies in place, and a skew suite runs the same client against a real hub binary. 32 hermetic tests plus 4 against a real hub. Signed-off-by: Dr. Stefan Flemming <sf@flemming.it>
59 lines
1.1 KiB
Protocol Buffer
59 lines
1.1 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package chain.v1;
|
|
|
|
import "google/protobuf/struct.proto";
|
|
import "google/protobuf/timestamp.proto";
|
|
|
|
// A unique identifier for a flow invocation (UUIDv7).
|
|
message InvocationId {
|
|
string value = 1;
|
|
}
|
|
|
|
// A reference to a capability requested by a flow step.
|
|
//
|
|
// Example: namespace="text", name="extract", version_req="^1"
|
|
message CapabilityRef {
|
|
string namespace = 1;
|
|
string name = 2;
|
|
string version_req = 3;
|
|
}
|
|
|
|
// A typed value passed between flow steps.
|
|
message Payload {
|
|
oneof kind {
|
|
string text = 1;
|
|
google.protobuf.Struct json = 2;
|
|
Bytes bytes = 3;
|
|
FileRef file = 4;
|
|
}
|
|
}
|
|
|
|
message Bytes {
|
|
string mime_type = 1;
|
|
bytes data = 2;
|
|
}
|
|
|
|
message FileRef {
|
|
string uri = 1; // file://, s3://, etc.
|
|
string mime_type = 2;
|
|
uint64 size_bytes = 3;
|
|
string sha256 = 4;
|
|
}
|
|
|
|
// Standard error shape for hub and module responses.
|
|
message ChainError {
|
|
Code code = 1;
|
|
string message = 2;
|
|
string details = 3;
|
|
|
|
enum Code {
|
|
UNKNOWN = 0;
|
|
INVALID_INPUT = 1;
|
|
CAPABILITY_NOT_SUPPORTED = 2;
|
|
PERMISSION_DENIED = 3;
|
|
RESOURCE_EXHAUSTED = 4;
|
|
DEADLINE_EXCEEDED = 5;
|
|
INTERNAL = 6;
|
|
}
|
|
}
|