@opencode-ai/protocol
Advanced tools
| import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi"; | ||
| import { UnknownError } from "../errors.js"; | ||
| export declare const WorkspaceGroup: HttpApiGroup.HttpApiGroup<"server.workspace", HttpApiEndpoint.HttpApiEndpoint<"workspace.destroy", "DELETE", "/api/workspace/:workspaceID", import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{ | ||
| workspaceID: import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & { | ||
| ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">; | ||
| create: () => string & import("effect/Brand").Brand<"Workspace.ID">; | ||
| }; | ||
| }>>, never, never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{ | ||
| readonly destroyed: import("effect/Schema").Boolean; | ||
| }>>, import("effect/Schema").toCodecJson<typeof UnknownError>, never, never>, false>; |
| import { Workspace } from "@opencode-ai/schema/workspace"; | ||
| import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/unstable/httpapi"; | ||
| import { UnknownError } from "../errors.js"; | ||
| export const WorkspaceGroup = HttpApiGroup.make("server.workspace") | ||
| .add(HttpApiEndpoint.delete("workspace.destroy", "/api/workspace/:workspaceID", { | ||
| params: { workspaceID: Workspace.ID }, | ||
| success: Workspace.DestroyResult, | ||
| error: UnknownError, | ||
| }).annotateMerge(OpenApi.annotations({ | ||
| identifier: "v2.workspace.destroy", | ||
| summary: "Destroy workspace", | ||
| description: "Make a workspace not exist. This operation is idempotent: an already-missing workspace succeeds with `destroyed: false`, while a workspace removed by this request returns `destroyed: true`.", | ||
| }))) | ||
| .annotateMerge(OpenApi.annotations({ title: "workspace", description: "Workspace lifecycle routes." })); |
+3
-2
@@ -35,7 +35,8 @@ import { Context } from "effect"; | ||
| import { ConfigGroup } from "./groups/config.js"; | ||
| type LocationGroups<LocationId extends HttpApiMiddleware.AnyId> = HttpApiGroup.AddMiddleware<typeof LocationGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof AgentGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof PluginGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ModelGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof GenerateGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ProviderGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof IntegrationGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof WebSearchGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof McpGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof CredentialGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ProjectGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof FileSystemGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof CommandGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof SkillGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof PtyGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ShellGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ReferenceGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof VcsGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ConfigGroup, LocationId>; | ||
| import { WorkspaceGroup } from "./groups/workspace.js"; | ||
| type LocationGroups<LocationId extends HttpApiMiddleware.AnyId> = HttpApiGroup.AddMiddleware<typeof LocationGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof AgentGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof PluginGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ModelGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ProviderGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof IntegrationGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof WebSearchGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof McpGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof CredentialGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ProjectGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof FileSystemGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof CommandGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof SkillGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof PtyGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ShellGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ReferenceGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof VcsGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof ConfigGroup, LocationId>; | ||
| type SessionGroups<SessionLocationId extends HttpApiMiddleware.AnyId, SessionLocationService> = ReturnType<typeof makeSessionGroup<SessionLocationId, SessionLocationService>> | typeof MessageGroup; | ||
| type FormGroups<LocationId extends HttpApiMiddleware.AnyId, LocationService, FormLocationId extends HttpApiMiddleware.AnyId, FormLocationService> = ReturnType<typeof makeFormGroup<LocationId, LocationService, FormLocationId, FormLocationService>>; | ||
| type MixedMiddlewareGroups<LocationId extends HttpApiMiddleware.AnyId, LocationService, SessionLocationId extends HttpApiMiddleware.AnyId, SessionLocationService> = ReturnType<typeof makePermissionGroup<LocationId, LocationService, SessionLocationId, SessionLocationService>>; | ||
| type ApiGroups<LocationId extends HttpApiMiddleware.AnyId, LocationService, FormLocationId extends HttpApiMiddleware.AnyId, FormLocationService, SessionLocationId extends HttpApiMiddleware.AnyId, SessionLocationService, Event extends HttpApiGroup.Constraint> = typeof HealthGroup | typeof ServerGroup | typeof DebugGroup | typeof MigrationGroup | typeof WorktreeGroup | LocationGroups<LocationId> | FormGroups<LocationId, LocationService, FormLocationId, FormLocationService> | SessionGroups<SessionLocationId, SessionLocationService> | MixedMiddlewareGroups<LocationId, LocationService, SessionLocationId, SessionLocationService> | Event; | ||
| type ApiGroups<LocationId extends HttpApiMiddleware.AnyId, LocationService, FormLocationId extends HttpApiMiddleware.AnyId, FormLocationService, SessionLocationId extends HttpApiMiddleware.AnyId, SessionLocationService, Event extends HttpApiGroup.Constraint> = typeof HealthGroup | typeof ServerGroup | typeof DebugGroup | typeof MigrationGroup | typeof WorktreeGroup | typeof WorkspaceGroup | typeof GenerateGroup | LocationGroups<LocationId> | FormGroups<LocationId, LocationService, FormLocationId, FormLocationService> | SessionGroups<SessionLocationId, SessionLocationService> | MixedMiddlewareGroups<LocationId, LocationService, SessionLocationId, SessionLocationService> | Event; | ||
| type EventGroupFor<Definitions extends ReadonlyArray<Definition>> = ReturnType<typeof makeEventGroup<Definitions>>; | ||
@@ -42,0 +43,0 @@ export type Api<LocationId extends HttpApiMiddleware.AnyId, LocationService, FormLocationId extends HttpApiMiddleware.AnyId, FormLocationService, SessionLocationId extends HttpApiMiddleware.AnyId, SessionLocationService, Event extends HttpApiGroup.Constraint> = HttpApi.HttpApi<"server", HttpApiGroup.AddMiddleware<HttpApiGroup.AddMiddleware<ApiGroups<LocationId, LocationService, FormLocationId, FormLocationService, SessionLocationId, SessionLocationService, Event>, Authorization>, SchemaErrorMiddleware>>; |
+3
-1
@@ -34,2 +34,3 @@ import { Context } from "effect"; | ||
| import { ConfigGroup } from "./groups/config.js"; | ||
| import { WorkspaceGroup } from "./groups/workspace.js"; | ||
| // Protocol owns middleware placement, while Server injects concrete keys so Core service identities stay downstream. | ||
@@ -45,3 +46,3 @@ const makeApiFromGroup = (eventGroup, locationMiddleware, formLocationMiddleware, sessionLocationMiddleware) => HttpApi.make("server") | ||
| .add(ModelGroup.middleware(locationMiddleware)) | ||
| .add(GenerateGroup.middleware(locationMiddleware)) | ||
| .add(GenerateGroup) | ||
| .add(ProviderGroup.middleware(locationMiddleware)) | ||
@@ -62,2 +63,3 @@ .add(IntegrationGroup.middleware(locationMiddleware)) | ||
| .add(WorktreeGroup) | ||
| .add(WorkspaceGroup) | ||
| .add(VcsGroup.middleware(locationMiddleware)) | ||
@@ -64,0 +66,0 @@ .add(DebugGroup) |
+1
-0
@@ -56,2 +56,3 @@ import { InvalidRequestError, SessionNotFoundError } from "./errors.js"; | ||
| readonly "server.worktree": "worktree"; | ||
| readonly "server.workspace": "workspace"; | ||
| readonly "server.vcs": "vcs"; | ||
@@ -58,0 +59,0 @@ readonly "server.config": "config"; |
+1
-0
@@ -43,2 +43,3 @@ import { InvalidRequestError, SessionNotFoundError } from "./errors.js"; | ||
| "server.worktree": "worktree", | ||
| "server.workspace": "workspace", | ||
| "server.vcs": "vcs", | ||
@@ -45,0 +46,0 @@ "server.config": "config", |
| import { Schema } from "effect"; | ||
| import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi"; | ||
| import { InvalidRequestError, ServiceUnavailableError } from "../errors.js"; | ||
| export declare const GenerateGroup: HttpApiGroup.HttpApiGroup<"server.generate", HttpApiEndpoint.HttpApiEndpoint<"generate.text", "POST", "/api/generate", never, Schema.toCodecStringTree<Schema.Struct<{ | ||
| readonly location: Schema.optional<Schema.Struct<{ | ||
| readonly directory: Schema.optional<Schema.String>; | ||
| readonly workspace: Schema.optional<Schema.String>; | ||
| }>>; | ||
| }>>, Schema.toCodecJson<Schema.Struct<{ | ||
| export declare const GenerateGroup: HttpApiGroup.HttpApiGroup<"server.generate", HttpApiEndpoint.HttpApiEndpoint<"generate.text", "POST", "/api/generate", never, never, Schema.toCodecJson<Schema.Struct<{ | ||
| readonly prompt: Schema.String; | ||
@@ -11,0 +6,0 @@ readonly model: Schema.optional<Schema.Struct<{ |
@@ -5,6 +5,4 @@ import { Model } from "@opencode-ai/schema/model"; | ||
| import { InvalidRequestError, ServiceUnavailableError } from "../errors.js"; | ||
| import { LocationQuery, locationQueryOpenApi } from "./location.js"; | ||
| export const GenerateGroup = HttpApiGroup.make("server.generate") | ||
| .add(HttpApiEndpoint.post("generate.text", "/api/generate", { | ||
| query: LocationQuery, | ||
| payload: Schema.Struct({ | ||
@@ -18,8 +16,6 @@ prompt: Schema.String, | ||
| error: [InvalidRequestError, ServiceUnavailableError], | ||
| }) | ||
| .annotateMerge(locationQueryOpenApi) | ||
| .annotateMerge(OpenApi.annotations({ | ||
| }).annotateMerge(OpenApi.annotations({ | ||
| identifier: "v2.generate.text", | ||
| summary: "Generate text", | ||
| description: "Run one stateless model generation at the requested location and return the assistant text. Uses the location's default model when none is specified.", | ||
| description: "Run one stateless model generation using the server's base configuration and return the assistant text. Uses the base configuration's default model when none is specified.", | ||
| }))) | ||
@@ -26,0 +22,0 @@ .annotateMerge(OpenApi.annotations({ |
@@ -492,3 +492,7 @@ import { SessionMessage } from "@opencode-ai/schema/session-message"; | ||
| query: { continue: BooleanFromString.pipe(Schema.optional) }, | ||
| success: HttpApiSchema.NoContent, | ||
| success: Schema.Struct({ | ||
| interrupted: Schema.Boolean.annotate({ | ||
| description: "Whether an active execution owned by this OpenCode process was interrupted.", | ||
| }), | ||
| }).annotate({ identifier: "SessionInterruptResponse" }), | ||
| error: SessionNotFoundError, | ||
@@ -500,3 +504,3 @@ }) | ||
| summary: "Interrupt session execution", | ||
| description: "Interrupt active execution owned by this OpenCode process. Idle interruption is a no-op. When continue=true, execution resumes pending steering input and next-in-line control items (manual compaction, moves) while queued prompts remain parked.", | ||
| description: "Interrupt active execution owned by this OpenCode process. Returns interrupted=true when an active execution was interrupted and false for the idle no-op. When continue=true, execution resumes pending steering input and next-in-line control items (manual compaction, moves) while queued prompts remain parked.", | ||
| }))) | ||
@@ -503,0 +507,0 @@ .add(HttpApiEndpoint.post("session.background", "/api/session/:sessionID/background", { |
+2
-2
| { | ||
| "$schema": "https://json.schemastore.org/package.json", | ||
| "name": "@opencode-ai/protocol", | ||
| "version": "0.0.0-dev-18115", | ||
| "version": "0.0.0-dev-18122", | ||
| "type": "module", | ||
@@ -35,3 +35,3 @@ "license": "MIT", | ||
| "dependencies": { | ||
| "@opencode-ai/schema": "0.0.0-dev-18115", | ||
| "@opencode-ai/schema": "0.0.0-dev-18122", | ||
| "effect": "4.0.0-rc.111" | ||
@@ -38,0 +38,0 @@ }, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
1912682
0.1%73
2.82%30872
0.08%+ Added
- Removed