@opencode/protocol 0.0.0-dev-19707 → 0.0.0-dev-19708
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.d.ts +4 -3
- package/dist/api.js +2 -2
- package/dist/groups/event.d.ts +76 -0
- package/dist/groups/location.d.ts +6 -5
- package/dist/groups/location.js +15 -3
- package/package.json +2 -2
package/dist/api.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ import { PersistentPtyGroup } from "./groups/persistent-pty.js";
|
|
|
23
23
|
import { ShellGroup } from "./groups/shell.js";
|
|
24
24
|
import { ReferenceGroup } from "./groups/reference.js";
|
|
25
25
|
import { Authorization } from "./middleware/authorization.js";
|
|
26
|
-
import {
|
|
26
|
+
import { makeLocationGroup } from "./groups/location.js";
|
|
27
27
|
import { IntegrationGroup } from "./groups/integration.js";
|
|
28
28
|
import { WebSearchGroup } from "./groups/websearch.js";
|
|
29
29
|
import { McpGroup } from "./groups/mcp.js";
|
|
@@ -33,11 +33,12 @@ import { WorktreeGroup } from "./groups/worktree.js";
|
|
|
33
33
|
import { VcsGroup } from "./groups/vcs.js";
|
|
34
34
|
import { MigrationGroup } from "./groups/migration.js";
|
|
35
35
|
import { ConfigGroup } from "./groups/config.js";
|
|
36
|
-
type LocationGroups<LocationId extends HttpApiMiddleware.AnyId> = HttpApiGroup.AddMiddleware<typeof
|
|
36
|
+
type LocationGroups<LocationId extends HttpApiMiddleware.AnyId> = 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 ProjectGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof FileSystemGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof CommandGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof SkillGroup, LocationId> | HttpApiGroup.AddMiddleware<typeof RpcGroup, 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>;
|
|
37
37
|
type SessionGroups<SessionLocationId extends HttpApiMiddleware.AnyId, SessionLocationService, FormLocationId extends HttpApiMiddleware.AnyId, FormLocationService> = ReturnType<typeof makeSessionGroup<SessionLocationId, SessionLocationService, FormLocationId, FormLocationService>> | typeof MessageGroup;
|
|
38
38
|
type FormGroups<LocationId extends HttpApiMiddleware.AnyId, LocationService> = ReturnType<typeof makeFormGroup<LocationId, LocationService>>;
|
|
39
|
+
type LocationGroup<LocationId extends HttpApiMiddleware.AnyId, LocationService> = ReturnType<typeof makeLocationGroup<LocationId, LocationService>>;
|
|
39
40
|
type MixedMiddlewareGroups<LocationId extends HttpApiMiddleware.AnyId, LocationService, SessionLocationId extends HttpApiMiddleware.AnyId, SessionLocationService> = ReturnType<typeof makePermissionGroup<LocationId, LocationService, SessionLocationId, SessionLocationService>>;
|
|
40
|
-
type ApiGroups<LocationId extends HttpApiMiddleware.AnyId, LocationService, FormLocationId extends HttpApiMiddleware.AnyId, FormLocationService, SessionLocationId extends HttpApiMiddleware.AnyId, SessionLocationService, Event extends HttpApiGroup.Constraint> = typeof ServerGroup | typeof DebugGroup | typeof MigrationGroup | typeof WorktreeGroup | typeof GenerateGroup | typeof PersistentPtyGroup | typeof CredentialGroup | LocationGroups<LocationId> | FormGroups<LocationId, LocationService> | SessionGroups<SessionLocationId, SessionLocationService, FormLocationId, FormLocationService> | MixedMiddlewareGroups<LocationId, LocationService, SessionLocationId, SessionLocationService> | Event;
|
|
41
|
+
type ApiGroups<LocationId extends HttpApiMiddleware.AnyId, LocationService, FormLocationId extends HttpApiMiddleware.AnyId, FormLocationService, SessionLocationId extends HttpApiMiddleware.AnyId, SessionLocationService, Event extends HttpApiGroup.Constraint> = typeof ServerGroup | typeof DebugGroup | typeof MigrationGroup | typeof WorktreeGroup | typeof GenerateGroup | typeof PersistentPtyGroup | typeof CredentialGroup | LocationGroups<LocationId> | LocationGroup<LocationId, LocationService> | FormGroups<LocationId, LocationService> | SessionGroups<SessionLocationId, SessionLocationService, FormLocationId, FormLocationService> | MixedMiddlewareGroups<LocationId, LocationService, SessionLocationId, SessionLocationService> | Event;
|
|
41
42
|
type EventGroupFor<Definitions extends ReadonlyArray<Definition>> = ReturnType<typeof makeEventGroup<Definitions>>;
|
|
42
43
|
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>>;
|
|
43
44
|
export declare const makeApi: <const Definitions extends ReadonlyArray<Definition>, LocationId extends HttpApiMiddleware.AnyId, LocationService, FormLocationId extends HttpApiMiddleware.AnyId, FormLocationService, SessionLocationId extends HttpApiMiddleware.AnyId, SessionLocationService>(options: {
|
package/dist/api.js
CHANGED
|
@@ -22,7 +22,7 @@ import { PersistentPtyGroup } from "./groups/persistent-pty.js";
|
|
|
22
22
|
import { ShellGroup } from "./groups/shell.js";
|
|
23
23
|
import { ReferenceGroup } from "./groups/reference.js";
|
|
24
24
|
import { Authorization } from "./middleware/authorization.js";
|
|
25
|
-
import {
|
|
25
|
+
import { makeLocationGroup } from "./groups/location.js";
|
|
26
26
|
import { IntegrationGroup } from "./groups/integration.js";
|
|
27
27
|
import { WebSearchGroup } from "./groups/websearch.js";
|
|
28
28
|
import { McpGroup } from "./groups/mcp.js";
|
|
@@ -35,7 +35,7 @@ import { ConfigGroup } from "./groups/config.js";
|
|
|
35
35
|
// Protocol owns middleware placement, while Server injects concrete keys so Core service identities stay downstream.
|
|
36
36
|
const makeApiFromGroup = (eventGroup, locationMiddleware, formLocationMiddleware, sessionLocationMiddleware) => HttpApi.make("server")
|
|
37
37
|
.add(ServerGroup)
|
|
38
|
-
.add(
|
|
38
|
+
.add(makeLocationGroup(locationMiddleware))
|
|
39
39
|
.add(AgentGroup.middleware(locationMiddleware))
|
|
40
40
|
.add(PluginGroup.middleware(locationMiddleware))
|
|
41
41
|
.add(makeSessionGroup(sessionLocationMiddleware, formLocationMiddleware))
|
package/dist/groups/event.d.ts
CHANGED
|
@@ -48,6 +48,38 @@ export declare const makeEventGroup: <const Definitions extends ReadonlyArray<De
|
|
|
48
48
|
} | undefined;
|
|
49
49
|
}[]])[number]>, never, never, never>, false>;
|
|
50
50
|
export declare const EventGroup: HttpApiGroup.HttpApiGroup<"server.event", HttpApiEndpoint.HttpApiEndpoint<"event.subscribe", "GET", "/api/event", never, never, never, never, HttpApiSchema.StreamSse<HttpApiSchema.SseEventFromData<Schema.Union<readonly [Schema.Struct<{
|
|
51
|
+
readonly id: Schema.brand<Schema.String, "Event.ID"> & {
|
|
52
|
+
create: () => string & import("effect/Brand").Brand<"Event.ID">;
|
|
53
|
+
};
|
|
54
|
+
readonly created: Schema.Finite;
|
|
55
|
+
readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
|
|
56
|
+
readonly type: Schema.Literal<"location.shutdown">;
|
|
57
|
+
readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
58
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
59
|
+
readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
60
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
61
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
62
|
+
}>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
63
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
64
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
65
|
+
}>, never, never>;
|
|
66
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
67
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
68
|
+
readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
69
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
70
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
71
|
+
}>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
72
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
73
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
74
|
+
}>, never, never>;
|
|
75
|
+
}>>, never, never>;
|
|
76
|
+
readonly data: Schema.Struct<{}>;
|
|
77
|
+
}> & {
|
|
78
|
+
type: "location.shutdown";
|
|
79
|
+
durability: "ephemeral";
|
|
80
|
+
durable: undefined;
|
|
81
|
+
data: Schema.Struct<{}>;
|
|
82
|
+
}, Schema.Struct<{
|
|
51
83
|
readonly id: Schema.brand<Schema.String, "Event.ID"> & {
|
|
52
84
|
create: () => string & import("effect/Brand").Brand<"Event.ID">;
|
|
53
85
|
};
|
|
@@ -8132,6 +8164,18 @@ export declare const EventGroup: HttpApiGroup.HttpApiGroup<"server.event", HttpA
|
|
|
8132
8164
|
readonly metadata?: {
|
|
8133
8165
|
readonly [x: string]: unknown;
|
|
8134
8166
|
} | undefined;
|
|
8167
|
+
} | {
|
|
8168
|
+
readonly id: string & import("effect/Brand").Brand<"Event.ID">;
|
|
8169
|
+
readonly data: {};
|
|
8170
|
+
readonly type: "location.shutdown";
|
|
8171
|
+
readonly created: number;
|
|
8172
|
+
readonly location?: {
|
|
8173
|
+
readonly directory: string & import("effect/Brand").Brand<"AbsolutePath">;
|
|
8174
|
+
readonly workspaceID?: (string & import("effect/Brand").Brand<"Workspace.ID">) | undefined;
|
|
8175
|
+
} | undefined;
|
|
8176
|
+
readonly metadata?: {
|
|
8177
|
+
readonly [x: string]: unknown;
|
|
8178
|
+
} | undefined;
|
|
8135
8179
|
} | {
|
|
8136
8180
|
readonly id: string & import("effect/Brand").Brand<"Event.ID">;
|
|
8137
8181
|
readonly data: {
|
|
@@ -8464,6 +8508,38 @@ export declare const EventGroup: HttpApiGroup.HttpApiGroup<"server.event", HttpA
|
|
|
8464
8508
|
} | undefined;
|
|
8465
8509
|
}>, never, never, never>, false>;
|
|
8466
8510
|
export declare const OpenCodeEvent: Schema.Union<readonly [Schema.Struct<{
|
|
8511
|
+
readonly id: Schema.brand<Schema.String, "Event.ID"> & {
|
|
8512
|
+
create: () => string & import("effect/Brand").Brand<"Event.ID">;
|
|
8513
|
+
};
|
|
8514
|
+
readonly created: Schema.Finite;
|
|
8515
|
+
readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
|
|
8516
|
+
readonly type: Schema.Literal<"location.shutdown">;
|
|
8517
|
+
readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
8518
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
8519
|
+
readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
8520
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
8521
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
8522
|
+
}>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
8523
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
8524
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
8525
|
+
}>, never, never>;
|
|
8526
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
8527
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
8528
|
+
readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
8529
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
8530
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
8531
|
+
}>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
8532
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
8533
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
8534
|
+
}>, never, never>;
|
|
8535
|
+
}>>, never, never>;
|
|
8536
|
+
readonly data: Schema.Struct<{}>;
|
|
8537
|
+
}> & {
|
|
8538
|
+
type: "location.shutdown";
|
|
8539
|
+
durability: "ephemeral";
|
|
8540
|
+
durable: undefined;
|
|
8541
|
+
data: Schema.Struct<{}>;
|
|
8542
|
+
}, Schema.Struct<{
|
|
8467
8543
|
readonly id: Schema.brand<Schema.String, "Event.ID"> & {
|
|
8468
8544
|
create: () => string & import("effect/Brand").Brand<"Event.ID">;
|
|
8469
8545
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { Schema } from "effect";
|
|
2
|
-
import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
|
|
1
|
+
import { Context, Schema } from "effect";
|
|
2
|
+
import { HttpApiEndpoint, HttpApiGroup, HttpApiMiddleware, HttpApiSchema } from "effect/unstable/httpapi";
|
|
3
|
+
import { ServiceUnavailableError } from "../errors.js";
|
|
3
4
|
export declare const LocationQuery: Schema.Struct<{
|
|
4
5
|
readonly location: Schema.optional<Schema.Struct<{
|
|
5
6
|
readonly directory: Schema.optional<Schema.String>;
|
|
6
7
|
}>>;
|
|
7
8
|
}>;
|
|
8
|
-
export declare const locationQueryOpenApi:
|
|
9
|
-
export declare const
|
|
9
|
+
export declare const locationQueryOpenApi: Context.Context<never>;
|
|
10
|
+
export declare const makeLocationGroup: <LocationId extends HttpApiMiddleware.AnyId, LocationService>(locationMiddleware: Context.Key<LocationId, LocationService>) => HttpApiGroup.HttpApiGroup<"server.location", HttpApiEndpoint.HttpApiEndpoint<"location.get", "GET", "/api/location", never, Schema.toCodecStringTree<Schema.Struct<{
|
|
10
11
|
readonly location: Schema.optional<Schema.Struct<{
|
|
11
12
|
readonly directory: Schema.optional<Schema.String>;
|
|
12
13
|
}>>;
|
|
@@ -19,4 +20,4 @@ export declare const LocationGroup: HttpApiGroup.HttpApiGroup<"server.location",
|
|
|
19
20
|
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
20
21
|
readonly canonical: Schema.brand<Schema.String, "AbsolutePath">;
|
|
21
22
|
}>;
|
|
22
|
-
}>>, never, never, never>, false>;
|
|
23
|
+
}>>, never, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"location.reload", "POST", "/api/location/reload", never, never, never, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof ServiceUnavailableError>, never, never>, false>;
|
package/dist/groups/location.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Location } from "@opencode/schema/location";
|
|
2
|
-
import { Schema } from "effect";
|
|
3
|
-
import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/unstable/httpapi";
|
|
2
|
+
import { Context, Schema } from "effect";
|
|
3
|
+
import { HttpApiEndpoint, HttpApiGroup, HttpApiMiddleware, HttpApiSchema, OpenApi } from "effect/unstable/httpapi";
|
|
4
|
+
import { ServiceUnavailableError } from "../errors.js";
|
|
4
5
|
export const LocationQuery = Schema.Struct({
|
|
5
6
|
location: Schema.optional(Schema.Struct({
|
|
6
7
|
directory: Schema.optional(Schema.String),
|
|
@@ -19,15 +20,26 @@ export const locationQueryOpenApi = OpenApi.annotations({
|
|
|
19
20
|
};
|
|
20
21
|
},
|
|
21
22
|
});
|
|
22
|
-
|
|
23
|
+
// Middleware is applied per endpoint: reload acts on every loaded location and
|
|
24
|
+
// must not boot the caller's location first.
|
|
25
|
+
export const makeLocationGroup = (locationMiddleware) => HttpApiGroup.make("server.location")
|
|
23
26
|
.add(HttpApiEndpoint.get("location.get", "/api/location", {
|
|
24
27
|
query: LocationQuery,
|
|
25
28
|
success: Location.PublicInfo,
|
|
26
29
|
})
|
|
30
|
+
.middleware(locationMiddleware)
|
|
27
31
|
.annotateMerge(locationQueryOpenApi)
|
|
28
32
|
.annotateMerge(OpenApi.annotations({
|
|
29
33
|
identifier: "location.get",
|
|
30
34
|
summary: "Get location",
|
|
31
35
|
description: "Resolve the requested location or the server default location.",
|
|
36
|
+
})))
|
|
37
|
+
.add(HttpApiEndpoint.post("location.reload", "/api/location/reload", {
|
|
38
|
+
success: HttpApiSchema.NoContent,
|
|
39
|
+
error: ServiceUnavailableError,
|
|
40
|
+
}).annotateMerge(OpenApi.annotations({
|
|
41
|
+
identifier: "location.reload",
|
|
42
|
+
summary: "Reload locations",
|
|
43
|
+
description: "Shut down and rebuild every loaded location. Pending permissions and forms are cancelled; running sessions continue with fresh services at the next step boundary. Emits location.shutdown for client recovery and responds once all replacement builds settle.",
|
|
32
44
|
})))
|
|
33
45
|
.annotateMerge(OpenApi.annotations({ title: "location" }));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@opencode/protocol",
|
|
4
|
-
"version": "0.0.0-dev-
|
|
4
|
+
"version": "0.0.0-dev-19708",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"typecheck": "tsgo --noEmit"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@opencode/schema": "0.0.0-dev-
|
|
35
|
+
"@opencode/schema": "0.0.0-dev-19708",
|
|
36
36
|
"effect": "4.0.0-rc.112"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|