( eventGroup: Group, locationMiddleware: Context.Key<LocationId, LocationService>, sessionLocationMiddleware: Context.Key<SessionLocationId, SessionLocationService>, )
| 24 | |
| 25 | // Protocol owns middleware placement, while Server injects concrete keys so Core service identities stay downstream. |
| 26 | const makeApiFromGroup = < |
| 27 | const Group extends HttpApiGroup.Any, |
| 28 | LocationId extends HttpApiMiddleware.AnyId, |
| 29 | LocationService, |
| 30 | SessionLocationId extends HttpApiMiddleware.AnyId, |
| 31 | SessionLocationService, |
| 32 | >( |
| 33 | eventGroup: Group, |
| 34 | locationMiddleware: Context.Key<LocationId, LocationService>, |
| 35 | sessionLocationMiddleware: Context.Key<SessionLocationId, SessionLocationService>, |
| 36 | ) => |
| 37 | HttpApi.make("server") |
| 38 | .add(HealthGroup) |
| 39 | .add(LocationGroup.middleware(locationMiddleware)) |
| 40 | .add(AgentGroup.middleware(locationMiddleware)) |
| 41 | .add(makeSessionGroup(sessionLocationMiddleware)) |
| 42 | .add(MessageGroup.middleware(sessionLocationMiddleware)) |
| 43 | .add(ModelGroup.middleware(locationMiddleware)) |
| 44 | .add(ProviderGroup.middleware(locationMiddleware)) |
| 45 | .add(IntegrationGroup.middleware(locationMiddleware)) |
| 46 | .add(CredentialGroup.middleware(locationMiddleware)) |
| 47 | .add(makePermissionGroup(locationMiddleware, sessionLocationMiddleware)) |
| 48 | .add(FileSystemGroup.middleware(locationMiddleware)) |
| 49 | .add(CommandGroup.middleware(locationMiddleware)) |
| 50 | .add(SkillGroup.middleware(locationMiddleware)) |
| 51 | .add(eventGroup) |
| 52 | .add(PtyGroup.middleware(locationMiddleware)) |
| 53 | .add(makeQuestionGroup(locationMiddleware, sessionLocationMiddleware)) |
| 54 | .add(ReferenceGroup.middleware(locationMiddleware)) |
| 55 | .add(ProjectCopyGroup.middleware(locationMiddleware)) |
| 56 | .annotateMerge( |
| 57 | OpenApi.annotations({ |
| 58 | title: "opencode HttpApi", |
| 59 | version: "0.0.1", |
| 60 | description: "Experimental HttpApi surface for selected instance routes.", |
| 61 | }), |
| 62 | ) |
| 63 | .middleware(Authorization) |
| 64 | .middleware(SchemaErrorMiddleware) |
| 65 | |
| 66 | export const makeApi = < |
| 67 | LocationId extends HttpApiMiddleware.AnyId, |
no test coverage detected