directive @ProgramConfigSource on INPUT_FIELD_DEFINITION
"""
 use script for unnormalized cell content
 whereas commands is for normalized shell commands

"""
directive @ResolveProgramRequestSource on INPUT_FIELD_DEFINITION
directive @RunnerService on FIELD_DEFINITION
scalar Bytes
enum CommandMode {
	COMMAND_MODE_UNSPECIFIED
	"""
	 COMMAND_MODE_INLINE indicates that the command should be executed inline.
	 For example: bash -c "echo 'Hello, World'"

	"""
	COMMAND_MODE_INLINE
	"""
	 COMMAND_MODE_FILE indicates that the command should be executed as a file.
	 For example: bash /tmp/script.sh

	"""
	COMMAND_MODE_FILE
	"""
	 COMMAND_MODE_TERMINAL indicates that the command should be executed as a Runme Terminal.
	 This is used by the VS Code extension.

	"""
	COMMAND_MODE_TERMINAL
	"""
	 COMMAND_MODE_CLI indicates that the command is executed via runme CLI.
	 It is executed as a native command.

	"""
	COMMAND_MODE_CLI
}
input CreateSessionRequestInput {
	"""
	 metadata is a map of client specific metadata.

	"""
	metadata: [CreateSessionRequest_MetadataEntryInput!]
	"""
	 env field provides an initial set of environment variables
	 for a newly created session.

	"""
	env: [String!]
	"""
	 project from which to load environment variables.
	 They will be appended to the list from the env field.
	 The env field has a higher priority.

	"""
	project: ProjectInput
	"""
	 Deprecated use config instead. optional selection
	 of which env store implementation to use.

	"""
	envStoreType: SessionEnvStoreType
	config: CreateSessionRequest_ConfigInput
}
input CreateSessionRequest_ConfigInput {
	"""
	 optional selection of which env store implementation to use.

	"""
	envStoreType: SessionEnvStoreType
	"""
	 how to seed initial ENV

	"""
	envStoreSeeding: CreateSessionRequest_Config_SessionEnvStoreSeeding
}
enum CreateSessionRequest_Config_SessionEnvStoreSeeding {
	"""
	 default seeding; ignore system

	"""
	SESSION_ENV_STORE_SEEDING_UNSPECIFIED
	"""
	 enable seeding from system

	"""
	SESSION_ENV_STORE_SEEDING_SYSTEM
}
input CreateSessionRequest_MetadataEntryInput {
	key: String
	value: String
}
type CreateSessionResponse {
	session: Session
}
input DeleteSessionRequestInput {
	id: String
}
input ExecuteRequestInput {
	config: ProgramConfigInput
	"""
	 input_data is a byte array that will be send as input
	 to the program.

	"""
	inputData: Bytes
	"""
	 stop requests the running process to be stopped.
	 It is allowed only in the consecutive calls.

	"""
	stop: ExecuteStop
	"""
	 sets pty winsize
	 has no effect in non-interactive mode

	"""
	winsize: WinsizeInput
	"""
	 session_id indicates in which Session the program should execute.
	 Executing in a Session might provide additional context like
	 environment variables.

	"""
	sessionId: String
	"""
	 session_strategy is a strategy for selecting the session.

	"""
	sessionStrategy: SessionStrategy
	"""
	 project used to load environment variables from .env files.

	"""
	project: ProjectInput
	"""
	 store_stdout_in_env, if true, will store the stdout under well known name
	 and the last ran block in the environment variable `__`.

	"""
	storeStdoutInEnv: Boolean
}
type ExecuteResponse {
	"""
	 exit_code is sent only in the final message.

	"""
	exitCode: UInt32Value
	"""
	 stdout_data contains bytes from stdout since the last response.

	"""
	stdoutData: Bytes
	"""
	 stderr_data contains bytes from stderr since the last response.

	"""
	stderrData: Bytes
	"""
	 pid contains the process' PID.

	 This is only sent once in an initial response for background processes.

	"""
	pid: UInt32Value
	"""
	 mime_type is a detected MIME type of the stdout_data.

	 This is only sent once in the first response containing stdout_data.

	"""
	mimeType: String
}
enum ExecuteStop {
	EXECUTE_STOP_UNSPECIFIED
	EXECUTE_STOP_INTERRUPT
	EXECUTE_STOP_KILL
}
input GetSessionRequestInput {
	id: String
}
type GetSessionResponse {
	session: Session
}
type ListSessionsResponse {
	sessions: [Session!]
}
input MonitorEnvStoreRequestInput {
	session: SessionInput
}
type MonitorEnvStoreResponse {
	type: MonitorEnvStoreType
	data: MonitorEnvStoreResponseData
}
union MonitorEnvStoreResponseData = MonitorEnvStoreResponse_Snapshot
type MonitorEnvStoreResponseSnapshot {
	envs: [MonitorEnvStoreResponseSnapshot_SnapshotEnv!]
}
type MonitorEnvStoreResponseSnapshot_Error {
	code: Int
	message: String
}
type MonitorEnvStoreResponseSnapshot_SnapshotEnv {
	status: MonitorEnvStoreResponseSnapshot_Status
	name: String
	description: String
	spec: String
	isRequired: Boolean
	origin: String
	originalValue: String
	resolvedValue: String
	createTime: String
	updateTime: String
	errors: [MonitorEnvStoreResponseSnapshot_Error!]
}
enum MonitorEnvStoreResponseSnapshot_Status {
	STATUS_UNSPECIFIED
	STATUS_LITERAL
	STATUS_HIDDEN
	STATUS_MASKED
}
type MonitorEnvStoreResponse_Snapshot {
	snapshot: MonitorEnvStoreResponseSnapshot
}
enum MonitorEnvStoreType {
	MONITOR_ENV_STORE_TYPE_UNSPECIFIED
	"""
	 possible expansion to have a "timeline" view
	 MONITOR_ENV_STORE_TYPE_TIMELINE = 2;

	"""
	MONITOR_ENV_STORE_TYPE_SNAPSHOT
}
type Mutation {
	runnerServiceCreateSession(in: CreateSessionRequestInput): CreateSessionResponse
	runnerServiceGetSession(in: GetSessionRequestInput): GetSessionResponse
	runnerServiceListSessions: ListSessionsResponse
	runnerServiceUpdateSession(in: UpdateSessionRequestInput): UpdateSessionResponse
	runnerServiceDeleteSession(in: DeleteSessionRequestInput): Boolean
	"""
	 Execute executes a program. Examine "ExecuteRequest" to explore
	 configuration options.

	 It's a bidirectional stream RPC method. It expects the first
	 "ExecuteRequest" to contain details of a program to execute.
	 Subsequent "ExecuteRequest" should only contain "input_data" as
	 other fields will be ignored.

	"""
	runnerServiceExecute(in: ExecuteRequestInput): ExecuteResponse
	"""
	 ResolveProgram resolves variables from a script or a list of commands
	 using the provided sources, which can be a list of environment variables,
	 a session, or a project.
	 For now, the resolved variables are only the exported ones using `export`.

	"""
	runnerServiceResolveProgram(in: ResolveProgramRequestInput): ResolveProgramResponse
}
"""
 ProgramConfig is a configuration for a program to execute.
 From this configuration, any program can be built.

"""
input ProgramConfigInput {
	"""
	 program_name is a name of the program to execute.
	 If it's not a path (relative or absolute), the runner
	 will try to resolve the name.
	 For example: "sh", "/bin/bash".

	"""
	programName: String
	"""
	 arguments is a list of arguments passed to the program.

	"""
	arguments: [String!]
	"""
	 directory to execute the program in.

	"""
	directory: String
	"""
	 language_id associated with script to allow interpreter
	 detection if no specific interpreter program is provided.

	"""
	languageId: String
	"""
	 background indicates a background process
	 required to handle running background tasks via CLI in C/I

	"""
	background: Boolean
	"""
	 file_extension associated with script. Some interpreters are strict
	 about file extensions, such as tsc which requires "ts" extension.

	"""
	fileExtension: String
	"""
	 env is a list of additional environment variables
	 that will be injected to the executed program.

	"""
	env: [String!]
	"""
	 commands are commands to be executed by the program.
	 The commands are joined and executed as a script.

	"""
	commands: ProgramConfig_CommandListInput @ProgramConfigSource
	"""
	 script is code to be executed by the program.
	 Individual lines are joined with the new line character.

	"""
	script: String @ProgramConfigSource
	"""
	 interactive, if true, uses a pseudo-tty to execute the program.
	 Otherwise, the program is executed using in-memory buffers for I/O.

	"""
	interactive: Boolean
	"""
	 TODO(adamb): understand motivation for this. In theory, source
	 should tell whether to execute it inline or as a file.

	"""
	mode: CommandMode
	"""
	 optional well known id for cell/block

	"""
	knownId: String
	"""
	 optional well known name for cell/block

	"""
	knownName: String
	"""
	 optional run ID to track the execution of the program

	"""
	runId: String
}
input ProgramConfig_CommandListInput {
	"""
	 commands are commands to be executed by the program.
	 The commands are joined and executed as a script.
	 For example: ["echo 'Hello, World'", "ls -l /etc"].

	"""
	items: [String!]
}
input ProjectInput {
	"""
	 root is a root directory of the project.
	 The semantic is the same as for the "--project"
	 flag in "runme".

	"""
	root: String
	"""
	 env_load_order is list of environment files
	 to try and load env from.

	"""
	envLoadOrder: [String!]
}
type Query {
	dummy: Boolean
}
type ResolveProgramCommandList {
	"""
	 commands are commands to be executed by the program.
	 The commands are joined and executed as a script.
	 For example: ["echo 'Hello, World'", "ls -l /etc"].

	"""
	lines: [String!]
}
input ResolveProgramCommandListInput {
	"""
	 commands are commands to be executed by the program.
	 The commands are joined and executed as a script.
	 For example: ["echo 'Hello, World'", "ls -l /etc"].

	"""
	lines: [String!]
}
input ResolveProgramRequestInput {
	"""
	 commands are commands to be executed by the program.
	 The commands are joined and executed as a script.

	"""
	commands: ResolveProgramCommandListInput @ResolveProgramRequestSource
	"""
	 script is code to be executed by the program.
	 Individual lines are joined with the new line character.

	"""
	script: String @ResolveProgramRequestSource
	"""
	 mode determines how variables resolution occurs.
	 It is usually based on document or cell annotation config.

	"""
	mode: ResolveProgramRequest_Mode
	"""
	 env is a list of explicit environment variables that will be used
	 to resolve the environment variables found in the source.

	"""
	env: [String!]
	"""
	 session_id indicates which session is the source of
	 environment variables. If not provided, the most recent
	 session can be used using session_strategy.

	"""
	sessionId: String
	"""
	 session_strategy is a strategy for selecting the session.

	"""
	sessionStrategy: SessionStrategy
	"""
	 project used to load environment variables from .env files.

	"""
	project: ProjectInput
	"""
	 language id associated with script.

	"""
	languageId: String
	"""
	 retention determines how variables are retained once resolved.

	"""
	retention: ResolveProgramRequest_Retention
}
enum ResolveProgramRequest_Mode {
	"""
	 unspecified is auto (default) which prompts for all
	 unresolved environment variables.
	 Subsequent runs will likely resolve via the session.

	"""
	MODE_UNSPECIFIED
	"""
	 prompt always means to prompt for all environment variables.

	"""
	MODE_PROMPT_ALL
	"""
	 skip means to not prompt for any environment variables.
	 All variables will be marked as resolved.

	"""
	MODE_SKIP_ALL
}
enum ResolveProgramRequest_Retention {
	RETENTION_UNSPECIFIED
	"""
	 first run means to always retain the first resolved value.

	"""
	RETENTION_FIRST_RUN
	"""
	 last run means to always retain the last resolved value.

	"""
	RETENTION_LAST_RUN
}
type ResolveProgramResponse {
	script: String
	"""
	 use script until commands normalization is implemented

	"""
	commands: ResolveProgramCommandList
	vars: [ResolveProgramResponse_VarResult!]
}
enum ResolveProgramResponse_Status {
	"""
	 unspecified is the default value and it means unresolved.

	"""
	STATUS_UNSPECIFIED
	"""
	 resolved means that the variable is resolved.

	"""
	STATUS_RESOLVED
	"""
	 unresolved with message means that the variable is unresolved
	 but it contains a message. E.g. FOO=this is message.

	"""
	STATUS_UNRESOLVED_WITH_MESSAGE
	"""
	 unresolved with placeholder means that the variable is unresolved
	 but it contains a placeholder. E.g. FOO="this is placeholder".

	"""
	STATUS_UNRESOLVED_WITH_PLACEHOLDER
	"""
	 unresolved with secret means that the variable is unresolved
	 and it requires treatment as a secret.

	"""
	STATUS_UNRESOLVED_WITH_SECRET
}
type ResolveProgramResponse_VarResult {
	"""
	 prompt indicates the resolution status of the env variable.

	"""
	status: ResolveProgramResponse_Status
	"""
	 name is the name of the environment variable.

	"""
	name: String
	"""
	 original_value is a default value of the environment variable.
	 It might be a value that is assigned to the variable in the script,
	 like FOO=bar or FOO=${FOO:-bar}.
	 If the variable is not assigned, it is an empty string.

	"""
	originalValue: String
	"""
	 resolved_value is a value of the environment variable resolved from a source.
	 If it is an empty string, it means that the environment variable is not resolved.

	"""
	resolvedValue: String
}
type Session {
	id: String
	"""
	 env keeps track of session environment variables.
	 They can be modified by executing programs which
	 alter them through "export" and "unset" commands.

	"""
	env: [String!]
	"""
	 metadata is a map of client specific metadata.

	"""
	metadata: [Session_MetadataEntry!]
}
"""
 env store implementation

"""
enum SessionEnvStoreType {
	"""
	 uses default env store

	"""
	SESSION_ENV_STORE_TYPE_UNSPECIFIED
	"""
	 uses owl store

	"""
	SESSION_ENV_STORE_TYPE_OWL
}
input SessionInput {
	id: String
	"""
	 env keeps track of session environment variables.
	 They can be modified by executing programs which
	 alter them through "export" and "unset" commands.

	"""
	env: [String!]
	"""
	 metadata is a map of client specific metadata.

	"""
	metadata: [Session_MetadataEntryInput!]
}
"""
 SessionStrategy determines a session selection in
 an initial execute request.

"""
enum SessionStrategy {
	"""
	 Uses the session_id field to determine the session.
	 If none is present, a new session is created.

	"""
	SESSION_STRATEGY_UNSPECIFIED
	"""
	 Uses the most recent session on the server.
	 If there is none, a new one is created.

	"""
	SESSION_STRATEGY_MOST_RECENT
}
type Session_MetadataEntry {
	key: String
	value: String
}
input Session_MetadataEntryInput {
	key: String
	value: String
}
type Subscription {
	runnerServiceMonitorEnvStore(in: MonitorEnvStoreRequestInput): MonitorEnvStoreResponse
	"""
	 Execute executes a program. Examine "ExecuteRequest" to explore
	 configuration options.

	 It's a bidirectional stream RPC method. It expects the first
	 "ExecuteRequest" to contain details of a program to execute.
	 Subsequent "ExecuteRequest" should only contain "input_data" as
	 other fields will be ignored.

	"""
	runnerServiceExecute(in: ExecuteRequestInput): ExecuteResponse
}
"""
 Wrapper message for `uint32`.

 The JSON representation for `UInt32Value` is JSON number.

 Not recommended for use in new APIs, but still useful for legacy APIs and
 has no plan to be removed.

"""
type UInt32Value {
	"""
	 The uint32 value.

	"""
	value: Int
}
input UpdateSessionRequestInput {
	id: String
	"""
	 metadata is a map of client specific metadata.

	"""
	metadata: [UpdateSessionRequest_MetadataEntryInput!]
	"""
	 env field provides an initial set of environment variables
	 for a newly created session.

	"""
	env: [String!]
	"""
	 project from which to load environment variables.
	 They will be appended to the list from the env field.
	 The env field has a higher priority.

	"""
	project: ProjectInput
}
input UpdateSessionRequest_MetadataEntryInput {
	key: String
	value: String
}
type UpdateSessionResponse {
	session: Session
}
input WinsizeInput {
	rows: Int
	cols: Int
	x: Int
	y: Int
}
