Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,10 @@ public data class CloudSetup(
val start: List<String> = emptyList(),
)

/** The agent a cloud session starts; `shell` is a plain shell, to prepare a workspace or debug an image. */
/**
* The agents a cloud session is known to start, the values of [CreateCloudSessionRequest.agent] and [CloudSession.agent]
* this version names; `shell` is a plain shell, to prepare a workspace or debug an image. The list is open.
*/
@Serializable(with = CloudAgentKind.Serializer::class)
public enum class CloudAgentKind(
/** The JSON value. */
Expand Down Expand Up @@ -223,6 +226,8 @@ public enum class CloudAgentKind(
* The cloud session to start (`POST /api/v1/cloud/sessions`). Give either the legacy single [repo] (with [ref]) or an
* [environment] recipe, which a server without `runners.cloud.environment.v1` ignores.
*
* @property agent The agent to start: a [CloudAgentKind] value, or another agent the server knows. The list is open, so
* any name is sent as is and the server decides.
* @property prompt The agent's first message, up to 20,000 characters; an interactive agent when null.
* @property profileId The organization's cloud profile (`runners.cloud.profiles.v1`, planned).
* @property image An image instead of the profile's (planned).
Expand All @@ -245,7 +250,7 @@ public enum class CloudAgentKind(
*/
@Serializable
public data class CreateCloudSessionRequest(
val agent: CloudAgentKind,
val agent: String,
val model: String? = null,
val repo: String? = null,
val ref: String? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,22 @@ class RemoteModelsTest {
assertNull(session.host)
val device = OstromJson.decodeFromString(Device.serializer(), """{"id":"d1","name":"Laptop"}""")
assertNull(device.daemon)
val request = CreateCloudSessionRequest(CloudAgentKind.CLAUDE)
val request = CreateCloudSessionRequest(CloudAgentKind.CLAUDE.value)
val create = OstromJson.encodeToString(CreateCloudSessionRequest.serializer(), request)
assertEquals("""{"agent":"claude"}""", create)
}

@Test
fun anAgentThisVersionDoesNotNameIsSentAsIs() {
val request = CreateCloudSessionRequest("grok", kind = CloudSessionKinds.LOCAL)
val create = OstromJson.encodeToString(CreateCloudSessionRequest.serializer(), request)
assertEquals("""{"agent":"grok","kind":"local"}""", create)
}

@Test
fun aLocalSessionCarriesItsLaunch() {
val request = CreateCloudSessionRequest(CloudAgentKind.CODEX, kind = CloudSessionKinds.LOCAL, launchId = "l1")
val request =
CreateCloudSessionRequest(CloudAgentKind.CODEX.value, kind = CloudSessionKinds.LOCAL, launchId = "l1")
val create = OstromJson.encodeToString(CreateCloudSessionRequest.serializer(), request)
assertEquals("""{"agent":"codex","kind":"local","launchId":"l1"}""", create)
val session = OstromJson.decodeFromString(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class CloudSessionCreateTest {
val server = ScriptedServer {
json(cloudSession, HttpStatusCode.Accepted, listOf(Idempotency.REPLAYED_HEADER to "true"))
}
val request = CreateCloudSessionRequest(CloudAgentKind.CLAUDE, prompt = "Fix it")
val request = CreateCloudSessionRequest(CloudAgentKind.CLAUDE.value, prompt = "Fix it")
server.client().use { client ->
val key = Idempotency.newKey()
assertEquals("cs_1", client.cloudSessions.create(request, idempotencyKey = key).id)
Expand All @@ -45,7 +45,7 @@ class CloudSessionCreateTest {
@Test
fun aWriteOnBehalfOfAMemberNamesThemAndAMalformedNameIsRefusedBeforeAnyRequest() = runTest {
val server = ScriptedServer { json(cloudSession, HttpStatusCode.Created) }
val request = CreateCloudSessionRequest(CloudAgentKind.CLAUDE)
val request = CreateCloudSessionRequest(CloudAgentKind.CLAUDE.value)
server.client().use { client ->
client.cloudSessions.create(request, onBehalfOf = "ada")
client.cloudSessions.pause("cs_1", onBehalfOf = "ada")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ class ResourceClientsTest {
server.client().use { client ->
client.cloudSessions.create(
CreateCloudSessionRequest(
agent = CloudAgentKind.CLAUDE,
agent = CloudAgentKind.CLAUDE.value,
prompt = "Fix it",
environment = CloudEnvironment(
repositories = listOf(
Expand All @@ -615,7 +615,7 @@ class ResourceClientsTest {
),
)
client.cloudSessions.create(
CreateCloudSessionRequest(CloudAgentKind.SHELL, repo = "https://github.com/o/r", ref = "dev"),
CreateCloudSessionRequest(CloudAgentKind.SHELL.value, repo = "https://github.com/o/r", ref = "dev"),
)
client.cloudSessions.pause("cs_1")
client.cloudSessions.resume("cs_1")
Expand Down
Loading