@@ -7,6 +7,7 @@ import * as Schema from "effect/Schema"
77
88import {
99 ActiveProjectTerminalSessionRequestSchema ,
10+ AgentSessionSchema ,
1011 ApplyAllRequestSchema ,
1112 ApplyProjectRequestSchema ,
1213 AuthMenuRequestSchema ,
@@ -47,7 +48,9 @@ const ScopeIdParam = HttpApiSchema.param("scopeId", Schema.String)
4748const SkillNameParam = HttpApiSchema . param ( "name" , Schema . String )
4849const PidParam = HttpApiSchema . param ( "pid" , Schema . NumberFromString )
4950
50- export const EmptyResponseSchema = Schema . Void
51+ export const OkResponseSchema = Schema . Struct ( {
52+ ok : Schema . Literal ( true )
53+ } )
5154
5255export const HealthResponseSchema = Schema . Struct ( {
5356 cwd : Schema . String ,
@@ -301,8 +304,7 @@ export const ProjectAuthSnapshotSchema = Schema.Struct({
301304 grokAuthEntries : Schema . optionalWith ( Schema . Number , { default : ( ) => 0 } ) ,
302305 grokAuthPath : Schema . optionalWith ( Schema . String , { default : ( ) => "" } ) ,
303306 projectDir : Schema . String ,
304- projectName : Schema . String ,
305- totalEntries : Schema . Number
307+ projectName : Schema . String
306308} )
307309
308310export const ProjectAuthSnapshotResponseSchema = Schema . Struct ( {
@@ -338,6 +340,11 @@ export const ProjectTerminalSessionResponseSchema = Schema.Struct({
338340 session : TerminalSessionSchema
339341} )
340342
343+ export const ActiveProjectTerminalSessionResponseSchema = Schema . Struct ( {
344+ ok : OptionalOkSchema ,
345+ session : TerminalSessionSchema
346+ } )
347+
341348export const TerminalSessionLookupResponseSchema = Schema . Struct ( {
342349 projectDisplayName : Schema . String ,
343350 projectKey : Schema . String ,
@@ -442,11 +449,13 @@ export const ContainerTaskSchema = Schema.Struct({
442449} )
443450
444451export const ContainerTaskSnapshotSchema = Schema . Struct ( {
452+ agents : Schema . Array ( AgentSessionSchema ) ,
445453 containerName : Schema . String ,
446454 generatedAt : Schema . String ,
447455 projectId : Schema . String ,
448456 sshConnections : Schema . Number ,
449- tasks : Schema . Array ( ContainerTaskSchema )
457+ tasks : Schema . Array ( ContainerTaskSchema ) ,
458+ terminalSessions : Schema . Array ( TerminalSessionSchema )
450459} )
451460
452461export const ContainerTaskSnapshotResponseSchema = Schema . Struct ( {
@@ -499,12 +508,12 @@ const ProjectsGroup = HttpApiGroup.make("projects")
499508 . add (
500509 endpoint . post ( "applyAllProjects" , "/projects/apply-all" )
501510 . setPayload ( ApplyAllRequestSchema )
502- . addSuccess ( EmptyResponseSchema )
511+ . addSuccess ( OkResponseSchema )
503512 )
504- . add ( endpoint . post ( "downAllProjects" , "/projects/down-all" ) . addSuccess ( EmptyResponseSchema ) )
513+ . add ( endpoint . post ( "downAllProjects" , "/projects/down-all" ) . addSuccess ( OkResponseSchema ) )
505514 . add ( endpoint . get ( "getProject" ) `/projects/${ ProjectIdParam } ` . addSuccess ( ProjectResponseSchema ) )
506- . add ( endpoint . del ( "deleteProject" ) `/projects/${ ProjectIdParam } ` . addSuccess ( EmptyResponseSchema ) )
507- . add ( endpoint . post ( "downProject" ) `/projects/${ ProjectIdParam } /down` . addSuccess ( EmptyResponseSchema ) )
515+ . add ( endpoint . del ( "deleteProject" ) `/projects/${ ProjectIdParam } ` . addSuccess ( OkResponseSchema ) )
516+ . add ( endpoint . post ( "downProject" ) `/projects/${ ProjectIdParam } /down` . addSuccess ( OkResponseSchema ) )
508517 . add (
509518 endpoint . post ( "applyProject" ) `/projects/${ ProjectIdParam } /apply`
510519 . setPayload ( ApplyProjectRequestSchema )
@@ -529,7 +538,7 @@ const ProjectPortsGroup = HttpApiGroup.make("projectPorts")
529538 )
530539 . add (
531540 endpoint . del ( "deleteProjectPort" ) `/projects/${ ProjectIdParam } /ports/${ TargetPortParam } `
532- . addSuccess ( EmptyResponseSchema )
541+ . addSuccess ( OkResponseSchema )
533542 )
534543
535544const ProjectBrowserGroup = HttpApiGroup . make ( "projectBrowser" )
@@ -551,15 +560,15 @@ const ProjectDatabasesGroup = HttpApiGroup.make("projectDatabases")
551560 )
552561 . add (
553562 endpoint . del ( "deleteDatabaseProfile" ) `/projects/${ ProjectIdParam } /databases/profiles/${ ProfileIdParam } `
554- . addSuccess ( EmptyResponseSchema )
563+ . addSuccess ( OkResponseSchema )
555564 )
556565 . add (
557566 endpoint . post ( "exposeDatabaseProfile" ) `/projects/${ ProjectIdParam } /databases/profiles/${ ProfileIdParam } /expose`
558567 . addSuccess ( ProjectDatabaseForwardResponseSchema , { status : 201 } )
559568 )
560569 . add (
561570 endpoint . del ( "deleteDatabaseForward" ) `/projects/${ ProjectIdParam } /databases/profiles/${ ProfileIdParam } /expose`
562- . addSuccess ( EmptyResponseSchema )
571+ . addSuccess ( OkResponseSchema )
563572 )
564573 . add (
565574 endpoint . get ( "listDatabaseForwards" ) `/projects/${ ProjectIdParam } /databases/forwards`
@@ -677,16 +686,16 @@ const TerminalGroup = HttpApiGroup.make("terminal")
677686 )
678687 . add (
679688 endpoint . del ( "deleteTerminalByKey" ) `/projects/by-key/${ ProjectKeyParam } /terminal-sessions/${ SessionIdParam } `
680- . addSuccess ( EmptyResponseSchema )
689+ . addSuccess ( OkResponseSchema )
681690 )
682691 . add (
683692 endpoint . put ( "setActiveTerminalByKey" ) `/projects/by-key/${ ProjectKeyParam } /terminal-sessions/active`
684693 . setPayload ( ActiveProjectTerminalSessionRequestSchema )
685- . addSuccess ( ProjectTerminalSessionResponseSchema )
694+ . addSuccess ( ActiveProjectTerminalSessionResponseSchema )
686695 )
687696 . add ( endpoint . get ( "lookupTerminal" ) `/terminal-sessions/${ SessionIdParam } ` . addSuccess ( TerminalSessionLookupResponseSchema ) )
688697 . add (
689- endpoint . del ( "deleteAuthTerminal" ) `/auth/terminal-sessions/${ SessionIdParam } ` . addSuccess ( EmptyResponseSchema )
698+ endpoint . del ( "deleteAuthTerminal" ) `/auth/terminal-sessions/${ SessionIdParam } ` . addSuccess ( OkResponseSchema )
690699 )
691700
692701const PromptsGroup = HttpApiGroup . make ( "prompts" )
@@ -719,7 +728,7 @@ const TasksGroup = HttpApiGroup.make("tasks")
719728 . setUrlParams ( QueryIncludeDefaultSchema )
720729 . addSuccess ( ContainerTaskSnapshotResponseSchema )
721730 )
722- . add ( endpoint . post ( "stopTask" ) `/projects/${ ProjectIdParam } /tasks/${ PidParam } /stop` . addSuccess ( EmptyResponseSchema ) )
731+ . add ( endpoint . post ( "stopTask" ) `/projects/${ ProjectIdParam } /tasks/${ PidParam } /stop` . addSuccess ( OkResponseSchema ) )
723732 . add (
724733 endpoint . get ( "taskLogs" ) `/projects/${ ProjectIdParam } /tasks/${ PidParam } /logs`
725734 . setUrlParams ( QueryLinesSchema )
@@ -740,6 +749,10 @@ export const DockerGitApi = HttpApi.make("docker-git")
740749 . annotate ( OpenApi . Version , "1.0.0" )
741750 . annotate ( OpenApi . Description , "Effect contract for docker-git JSON REST endpoints." )
742751 . addError ( ApiErrorResponseSchema , { status : 400 } )
752+ . addError ( ApiErrorResponseSchema , { status : 401 } )
753+ . addError ( ApiErrorResponseSchema , { status : 404 } )
754+ . addError ( ApiErrorResponseSchema , { status : 409 } )
755+ . addError ( ApiErrorResponseSchema , { status : 500 } )
743756 . add ( CoreGroup )
744757 . add ( ProjectsGroup )
745758 . add ( ProjectPortsGroup )
0 commit comments