@opencode/protocol 0.0.0-dev-19625 → 0.0.0-dev-19627
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 +2 -2
- package/dist/api.js +1 -1
- package/dist/groups/worktree.d.ts +17 -19
- package/dist/groups/worktree.js +17 -26
- package/package.json +2 -2
package/dist/api.d.ts
CHANGED
|
@@ -33,11 +33,11 @@ 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 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 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
|
|
36
|
+
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 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> = ReturnType<typeof makeSessionGroup<SessionLocationId, SessionLocationService>> | typeof MessageGroup;
|
|
38
38
|
type FormGroups<LocationId extends HttpApiMiddleware.AnyId, LocationService, FormLocationId extends HttpApiMiddleware.AnyId, FormLocationService> = ReturnType<typeof makeFormGroup<LocationId, LocationService, FormLocationId, FormLocationService>>;
|
|
39
39
|
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 GenerateGroup | typeof PersistentPtyGroup | typeof CredentialGroup | LocationGroups<LocationId> | FormGroups<LocationId, LocationService, FormLocationId, FormLocationService> | SessionGroups<SessionLocationId, SessionLocationService> | MixedMiddlewareGroups<LocationId, LocationService, SessionLocationId, SessionLocationService> | Event;
|
|
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, FormLocationId, FormLocationService> | SessionGroups<SessionLocationId, SessionLocationService> | MixedMiddlewareGroups<LocationId, LocationService, SessionLocationId, SessionLocationService> | Event;
|
|
41
41
|
type EventGroupFor<Definitions extends ReadonlyArray<Definition>> = ReturnType<typeof makeEventGroup<Definitions>>;
|
|
42
42
|
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
43
|
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
|
@@ -58,7 +58,7 @@ const makeApiFromGroup = (eventGroup, locationMiddleware, formLocationMiddleware
|
|
|
58
58
|
.add(PersistentPtyGroup)
|
|
59
59
|
.add(ShellGroup.middleware(locationMiddleware))
|
|
60
60
|
.add(ReferenceGroup.middleware(locationMiddleware))
|
|
61
|
-
.add(WorktreeGroup
|
|
61
|
+
.add(WorktreeGroup)
|
|
62
62
|
.add(VcsGroup.middleware(locationMiddleware))
|
|
63
63
|
.add(DebugGroup)
|
|
64
64
|
.add(MigrationGroup)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "effect/unstable/httpapi";
|
|
3
|
+
import { ProjectNotFoundError } from "../errors.js";
|
|
3
4
|
declare const WorktreeError_base: Schema.Class<WorktreeError, Schema.Struct<{
|
|
4
5
|
readonly name: Schema.Literal<"WorktreeError">;
|
|
5
6
|
readonly data: Schema.Struct<{
|
|
@@ -10,34 +11,31 @@ declare const WorktreeError_base: Schema.Class<WorktreeError, Schema.Struct<{
|
|
|
10
11
|
export declare class WorktreeError extends WorktreeError_base {
|
|
11
12
|
}
|
|
12
13
|
export declare const WorktreeGroup: HttpApiGroup.HttpApiGroup<"server.worktree", HttpApiEndpoint.HttpApiEndpoint<"worktree.list", "GET", "/api/worktree", never, Schema.toCodecStringTree<Schema.Struct<{
|
|
13
|
-
readonly
|
|
14
|
-
|
|
15
|
-
}
|
|
14
|
+
readonly projectID: Schema.brand<Schema.String, "Project.ID"> & {
|
|
15
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
16
|
+
};
|
|
16
17
|
}>>, never, never, Schema.toCodecJson<Schema.$Array<Schema.Struct<{
|
|
17
18
|
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
18
19
|
readonly strategy: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
19
|
-
}>>>, Schema.toCodecJson<typeof
|
|
20
|
-
readonly
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
}>>, Schema.toCodecJson<Schema.Struct<{
|
|
24
|
-
readonly strategy: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.Trim, "Worktree.StrategyID">>>, Schema.optionalKey<Schema.brand<Schema.Trim, "Worktree.StrategyID">>, never, never>;
|
|
20
|
+
}>>>, Schema.toCodecJson<typeof ProjectNotFoundError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"worktree.create", "POST", "/api/worktree", never, never, Schema.toCodecJson<Schema.Struct<{
|
|
21
|
+
readonly projectID: Schema.brand<Schema.String, "Project.ID"> & {
|
|
22
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
23
|
+
};
|
|
25
24
|
readonly from: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "AbsolutePath">>>, Schema.optionalKey<Schema.brand<Schema.String, "AbsolutePath">>, never, never>;
|
|
26
25
|
readonly branch: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Trim>>, Schema.optionalKey<Schema.Trim>, never, never>;
|
|
27
26
|
readonly directory: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "AbsolutePath">>>, Schema.optionalKey<Schema.brand<Schema.String, "AbsolutePath">>, never, never>;
|
|
28
27
|
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
29
28
|
}>>, never, Schema.toCodecJson<Schema.Struct<{
|
|
30
29
|
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
31
|
-
}>>, Schema.toCodecJson<typeof WorktreeError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"worktree.remove", "DELETE", "/api/worktree", never, Schema.
|
|
32
|
-
readonly
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
}>>, Schema.toCodecJson<Schema.Struct<{
|
|
30
|
+
}>>, Schema.toCodecJson<typeof ProjectNotFoundError | typeof WorktreeError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"worktree.remove", "DELETE", "/api/worktree", never, never, Schema.toCodecJson<Schema.Struct<{
|
|
31
|
+
readonly projectID: Schema.brand<Schema.String, "Project.ID"> & {
|
|
32
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
33
|
+
};
|
|
36
34
|
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
37
35
|
readonly force: Schema.Boolean;
|
|
38
|
-
}>>, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof WorktreeError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"worktree.refresh", "POST", "/api/worktree/refresh", never, Schema.
|
|
39
|
-
readonly
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
}>>, never,
|
|
36
|
+
}>>, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof ProjectNotFoundError | typeof WorktreeError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"worktree.refresh", "POST", "/api/worktree/refresh", never, never, Schema.toCodecJson<Schema.Struct<{
|
|
37
|
+
readonly projectID: Schema.brand<Schema.String, "Project.ID"> & {
|
|
38
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
39
|
+
};
|
|
40
|
+
}>>, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof ProjectNotFoundError | typeof WorktreeError>, never, never>, false>;
|
|
43
41
|
export {};
|
package/dist/groups/worktree.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Worktree } from "@opencode/schema/worktree";
|
|
2
2
|
import { Schema } from "effect";
|
|
3
3
|
import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/unstable/httpapi";
|
|
4
|
-
import {
|
|
4
|
+
import { Project } from "@opencode/schema/project";
|
|
5
|
+
import { ProjectNotFoundError } from "../errors.js";
|
|
5
6
|
const root = "/api/worktree";
|
|
6
7
|
export class WorktreeError extends Schema.Error("WorktreeError")({
|
|
7
8
|
name: Schema.Literal("WorktreeError"),
|
|
@@ -13,49 +14,39 @@ export class WorktreeError extends Schema.Error("WorktreeError")({
|
|
|
13
14
|
}
|
|
14
15
|
export const WorktreeGroup = HttpApiGroup.make("server.worktree")
|
|
15
16
|
.add(HttpApiEndpoint.get("worktree.list", root, {
|
|
16
|
-
query:
|
|
17
|
+
query: Schema.Struct({ projectID: Project.ID }),
|
|
17
18
|
success: Worktree.List,
|
|
18
|
-
error:
|
|
19
|
-
})
|
|
20
|
-
.annotateMerge(locationQueryOpenApi)
|
|
21
|
-
.annotateMerge(OpenApi.annotations({
|
|
19
|
+
error: ProjectNotFoundError,
|
|
20
|
+
}).annotateMerge(OpenApi.annotations({
|
|
22
21
|
identifier: "worktree.list",
|
|
23
22
|
summary: "List worktrees",
|
|
24
|
-
description: "
|
|
23
|
+
description: "Return the project's saved worktree inventory without loading configuration or running discovery.",
|
|
25
24
|
})))
|
|
26
25
|
.add(HttpApiEndpoint.post("worktree.create", root, {
|
|
27
|
-
query: LocationQuery,
|
|
28
26
|
payload: Worktree.CreateInput,
|
|
29
27
|
success: Worktree.Info,
|
|
30
|
-
error: WorktreeError,
|
|
31
|
-
})
|
|
32
|
-
.annotateMerge(locationQueryOpenApi)
|
|
33
|
-
.annotateMerge(OpenApi.annotations({
|
|
28
|
+
error: [WorktreeError, ProjectNotFoundError],
|
|
29
|
+
}).annotateMerge(OpenApi.annotations({
|
|
34
30
|
identifier: "worktree.create",
|
|
35
31
|
summary: "Create worktree",
|
|
36
|
-
description: "
|
|
32
|
+
description: "Load the project's canonical configuration, create a local worktree using its selected strategy, then run the project's setup script.",
|
|
37
33
|
})))
|
|
38
34
|
.add(HttpApiEndpoint.delete("worktree.remove", root, {
|
|
39
|
-
query: LocationQuery,
|
|
40
35
|
payload: Worktree.RemoveInput,
|
|
41
36
|
success: HttpApiSchema.NoContent,
|
|
42
|
-
error: WorktreeError,
|
|
43
|
-
})
|
|
44
|
-
.annotateMerge(locationQueryOpenApi)
|
|
45
|
-
.annotateMerge(OpenApi.annotations({
|
|
37
|
+
error: [WorktreeError, ProjectNotFoundError],
|
|
38
|
+
}).annotateMerge(OpenApi.annotations({
|
|
46
39
|
identifier: "worktree.remove",
|
|
47
40
|
summary: "Remove worktree",
|
|
48
|
-
description: "
|
|
41
|
+
description: "Load the project's canonical configuration and remove a saved worktree using its recorded strategy.",
|
|
49
42
|
})))
|
|
50
43
|
.add(HttpApiEndpoint.post("worktree.refresh", `${root}/refresh`, {
|
|
51
|
-
|
|
44
|
+
payload: Schema.Struct({ projectID: Project.ID }),
|
|
52
45
|
success: HttpApiSchema.NoContent,
|
|
53
|
-
error: WorktreeError,
|
|
54
|
-
})
|
|
55
|
-
.annotateMerge(locationQueryOpenApi)
|
|
56
|
-
.annotateMerge(OpenApi.annotations({
|
|
46
|
+
error: [WorktreeError, ProjectNotFoundError],
|
|
47
|
+
}).annotateMerge(OpenApi.annotations({
|
|
57
48
|
identifier: "worktree.refresh",
|
|
58
49
|
summary: "Refresh worktrees",
|
|
59
|
-
description: "
|
|
50
|
+
description: "Load the project's canonical configuration, discover worktrees across known checkout roots using all available strategies, and reconcile saved state.",
|
|
60
51
|
})))
|
|
61
|
-
.annotateMerge(OpenApi.annotations({ title: "worktree", description: "
|
|
52
|
+
.annotateMerge(OpenApi.annotations({ title: "worktree", description: "Project-based worktree management routes." }));
|
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-19627",
|
|
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-19627",
|
|
36
36
|
"effect": "4.0.0-rc.112"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|