diff --git a/sdks/schemas/runner-protocol/v1.bare b/sdks/schemas/runner-protocol/v1.bare index e04ca50e24..37a6fa423b 100644 --- a/sdks/schemas/runner-protocol/v1.bare +++ b/sdks/schemas/runner-protocol/v1.bare @@ -1,19 +1,22 @@ # Runner Protocol v1 +# MARK: Core Primitives + type Id str type Json str -type KvKey data +# MARK: KV +# Basic types +type KvKey data type KvValue data - type KvMetadata struct { version: data createTs: i64 } +# Query types type KvListAllQuery void - type KvListRangeQuery struct { start: KvKey end: KvKey @@ -30,15 +33,87 @@ type KvListQuery union { KvListPrefixQuery } -type ActorName struct { - metadata: Json +# Request types +type KvGetRequest struct { + keys: list +} + +type KvListRequest struct { + query: KvListQuery + reverse: optional + limit: optional +} + +type KvPutRequest struct { + keys: list + values: list +} + +type KvDeleteRequest struct { + keys: list +} + +type KvDropRequest void + +# Response types +type KvErrorResponse struct { + message: str +} + +type KvGetResponse struct { + keys: list + values: list + metadata: list } +type KvListResponse struct { + keys: list + values: list + metadata: list +} + +type KvPutResponse void +type KvDeleteResponse void +type KvDropResponse void + +# Request/Response unions +type KvRequestData union { + KvGetRequest | + KvListRequest | + KvPutRequest | + KvDeleteRequest | + KvDropRequest +} + +type KvResponseData union { + KvErrorResponse | + KvGetResponse | + KvListResponse | + KvPutResponse | + KvDeleteResponse | + KvDropResponse +} + +# MARK: Actor + +# Core type StopCode enum { OK ERROR } +type ActorName struct { + metadata: Json +} + +type ActorConfig struct { + name: str + key: optional + createTs: i64 + input: optional +} + +# Intent type ActorIntentSleep void type ActorIntentStop void @@ -48,6 +123,7 @@ type ActorIntent union { ActorIntentStop } +# State type ActorStateRunning void type ActorStateStopped struct { @@ -60,6 +136,7 @@ type ActorState union { ActorStateStopped } +# MARK: Events type EventActorIntent struct { actorId: Id generation: u32 @@ -89,13 +166,7 @@ type EventWrapper struct { inner: Event } -type ActorConfig struct { - name: str - key: optional - createTs: i64 - input: optional -} - +# MARK: Commands type CommandStartActor struct { actorId: Id generation: u32 @@ -117,6 +188,8 @@ type CommandWrapper struct { inner: Command } +# MARK: To Server + type ToServerInit struct { name: str version: u32 @@ -138,35 +211,6 @@ type ToServerPing struct { ts: i64 } -type KvGetRequest struct { - keys: list -} - -type KvListRequest struct { - query: KvListQuery - reverse: optional - limit: optional -} - -type KvPutRequest struct { - keys: list - values: list -} - -type KvDeleteRequest struct { - keys: list -} - -type KvDropRequest void - -type KvRequestData union { - KvGetRequest | - KvListRequest | - KvPutRequest | - KvDeleteRequest | - KvDropRequest -} - type ToServerKvRequest struct { actorId: Id requestId: u32 @@ -182,6 +226,7 @@ type ToServer union { ToServerKvRequest } +# MARK: To Client type ProtocolMetadata struct { runnerLostThreshold: i64 } @@ -198,37 +243,6 @@ type ToClientAckEvents struct { lastEventIdx: i64 } -type KvErrorResponse struct { - message: str -} - -type KvGetResponse struct { - keys: list - values: list - metadata: list -} - -type KvListResponse struct { - keys: list - values: list - metadata: list -} - -type KvPutResponse void - -type KvDeleteResponse void - -type KvDropResponse void - -type KvResponseData union { - KvErrorResponse | - KvGetResponse | - KvListResponse | - KvPutResponse | - KvDeleteResponse | - KvDropResponse -} - type ToClientKvResponse struct { requestId: u32 data: KvResponseData @@ -240,3 +254,4 @@ type ToClient union { ToClientAckEvents | ToClientKvResponse } +