Skip to content

Commit

Permalink
Generate GQL schema (#640)
Browse files Browse the repository at this point in the history
Having GQL types for the protos is required for downstream usage. Making
them available for now.
  • Loading branch information
sourishkrout authored Jul 30, 2024
1 parent 19af228 commit c10c99a
Show file tree
Hide file tree
Showing 9 changed files with 1,809 additions and 4 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ install/dev:
go install honnef.co/go/tools/cmd/[email protected]
go install mvdan.cc/[email protected]
go install github.com/icholy/[email protected]
go install github.com/stateful/go-proto-gql/protoc-gen-gql@latest

.PHONY: install/goreleaser
install/goreleaser:
Expand Down
12 changes: 8 additions & 4 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
version: v1
version: v2
plugins:
# Remote plugin. You can switch to a local one by using "go".
- plugin: buf.build/protocolbuffers/go
- remote: buf.build/protocolbuffers/go
out: pkg/api/gen/proto/go
opt: paths=source_relative

# Remote plugin. You can switch to a local one by using "go-grpc".
- plugin: buf.build/grpc/go
- remote: buf.build/grpc/go
out: pkg/api/gen/proto/go
opt: paths=source_relative

# Remote plugin. You can switch to a local one by using "timostamm-protobuf-ts".
- plugin: buf.build/community/timostamm-protobuf-ts
- remote: buf.build/community/timostamm-protobuf-ts
out: pkg/api/gen/proto/ts
opt: output_javascript,optimize_code_size,long_type_string,add_pb_suffix,ts_nocheck,eslint_disable

# Local plugin to generate GQL schema
- local: protoc-gen-gql
out: pkg/api/gen/proto/gql
230 changes: 230 additions & 0 deletions pkg/api/gen/proto/gql/runme/ai/v1alpha1/ai.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
"""
The AIService service is used to provide assistant capabilities to Runme.
"""
directive @AIService on FIELD_DEFINITION
"""
Wrapper message for `bool`.
The JSON representation for `BoolValue` is JSON `true` and `false`.
"""
type BoolValue {
"""
The bool value.
"""
value: Boolean
}
"""
Wrapper message for `bool`.
The JSON representation for `BoolValue` is JSON `true` and `false`.
"""
input BoolValueInput {
"""
The bool value.
"""
value: Boolean
}
scalar Bytes
type Cell {
kind: CellKind
value: String
languageId: String
metadata: [Cell_MetadataEntry!]
textRange: TextRange
outputs: [CellOutput!]
executionSummary: CellExecutionSummary
}
type CellExecutionSummary {
executionOrder: UInt32Value
success: BoolValue
timing: ExecutionSummaryTiming
}
input CellExecutionSummaryInput {
executionOrder: UInt32ValueInput
success: BoolValueInput
timing: ExecutionSummaryTimingInput
}
input CellInput {
kind: CellKind
value: String
languageId: String
metadata: [Cell_MetadataEntryInput!]
textRange: TextRangeInput
outputs: [CellOutputInput!]
executionSummary: CellExecutionSummaryInput
}
enum CellKind {
CELL_KIND_UNSPECIFIED
CELL_KIND_MARKUP
CELL_KIND_CODE
}
type CellOutput {
items: [CellOutputItem!]
metadata: [CellOutput_MetadataEntry!]
processInfo: CellOutputProcessInfo
}
input CellOutputInput {
items: [CellOutputItemInput!]
metadata: [CellOutput_MetadataEntryInput!]
processInfo: CellOutputProcessInfoInput
}
type CellOutputItem {
data: Bytes
type: String
mime: String
}
input CellOutputItemInput {
data: Bytes
type: String
mime: String
}
type CellOutputProcessInfo {
exitReason: ProcessInfoExitReason
pid: Int64Value
}
input CellOutputProcessInfoInput {
exitReason: ProcessInfoExitReasonInput
pid: Int64ValueInput
}
type CellOutput_MetadataEntry {
key: String
value: String
}
input CellOutput_MetadataEntryInput {
key: String
value: String
}
type Cell_MetadataEntry {
key: String
value: String
}
input Cell_MetadataEntryInput {
key: String
value: String
}
type ExecutionSummaryTiming {
startTime: Int64Value
endTime: Int64Value
}
input ExecutionSummaryTimingInput {
startTime: Int64ValueInput
endTime: Int64ValueInput
}
input FrontmatterInput {
shell: String
cwd: String
skipPrompts: Boolean
runme: FrontmatterRunmeInput
category: String
terminalRows: String
}
input FrontmatterRunmeInput {
id: String
version: String
session: RunmeSessionInput
}
input GenerateCellsRequestInput {
notebook: NotebookInput
}
type GenerateCellsResponse {
cells: [Cell!]
}
"""
Wrapper message for `int64`.
The JSON representation for `Int64Value` is JSON string.
"""
type Int64Value {
"""
The int64 value.
"""
value: Int
}
"""
Wrapper message for `int64`.
The JSON representation for `Int64Value` is JSON string.
"""
input Int64ValueInput {
"""
The int64 value.
"""
value: Int
}
type Mutation {
"""
GenerateCells uses the AI to generate cells to insert into the notebook.
"""
aIServiceGenerateCells(in: GenerateCellsRequestInput): GenerateCellsResponse
}
input NotebookInput {
cells: [CellInput!]
metadata: [Notebook_MetadataEntryInput!]
frontmatter: FrontmatterInput
}
input Notebook_MetadataEntryInput {
key: String
value: String
}
type ProcessInfoExitReason {
type: String
code: UInt32Value
}
input ProcessInfoExitReasonInput {
type: String
code: UInt32ValueInput
}
type Query {
dummy: Boolean
}
input RunmeSessionDocumentInput {
relativePath: String
}
input RunmeSessionInput {
id: String
document: RunmeSessionDocumentInput
}
type TextRange {
start: Int
end: Int
}
input TextRangeInput {
start: Int
end: Int
}
"""
Wrapper message for `uint32`.
The JSON representation for `UInt32Value` is JSON number.
"""
type UInt32Value {
"""
The uint32 value.
"""
value: Int
}
"""
Wrapper message for `uint32`.
The JSON representation for `UInt32Value` is JSON number.
"""
input UInt32ValueInput {
"""
The uint32 value.
"""
value: Int
}
3 changes: 3 additions & 0 deletions pkg/api/gen/proto/gql/runme/config/v1alpha1/config.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
type Query {
dummy: Boolean
}
Loading

0 comments on commit c10c99a

Please sign in to comment.