@opencode/schema 0.0.0-reserved → 2.0.1
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/agent.d.ts +164 -0
- package/dist/agent.js +46 -0
- package/dist/catalog.d.ts +69 -0
- package/dist/catalog.js +4 -0
- package/dist/command.d.ts +76 -0
- package/dist/command.js +13 -0
- package/dist/config/agent.d.ts +42 -0
- package/dist/config/agent.js +20 -0
- package/dist/config/command.d.ts +28 -0
- package/dist/config/command.js +13 -0
- package/dist/config/compaction.d.ts +14 -0
- package/dist/config/compaction.js +13 -0
- package/dist/config/experimental.d.ts +17 -0
- package/dist/config/experimental.js +16 -0
- package/dist/config/formatter.d.ts +11 -0
- package/dist/config/formatter.js +11 -0
- package/dist/config/lsp.d.ts +20 -0
- package/dist/config/lsp.js +16 -0
- package/dist/config/mcp.d.ts +18 -0
- package/dist/config/mcp.js +14 -0
- package/dist/config/media.d.ts +15 -0
- package/dist/config/media.js +14 -0
- package/dist/config/model.d.ts +18 -0
- package/dist/config/model.js +28 -0
- package/dist/config/plugin.d.ts +11 -0
- package/dist/config/plugin.js +10 -0
- package/dist/config/policy.d.ts +10 -0
- package/dist/config/policy.js +8 -0
- package/dist/config/provider.d.ts +173 -0
- package/dist/config/provider.js +72 -0
- package/dist/config/reference.d.ts +21 -0
- package/dist/config/reference.js +18 -0
- package/dist/config/tool-output.d.ts +8 -0
- package/dist/config/tool-output.js +8 -0
- package/dist/config/warming.d.ts +10 -0
- package/dist/config/warming.js +16 -0
- package/dist/config/watcher.d.ts +7 -0
- package/dist/config/watcher.js +7 -0
- package/dist/config/websearch.d.ts +9 -0
- package/dist/config/websearch.js +13 -0
- package/dist/config/worktree.d.ts +7 -0
- package/dist/config/worktree.js +7 -0
- package/dist/config.d.ts +180 -0
- package/dist/config.js +138 -0
- package/dist/connection.d.ts +28 -0
- package/dist/connection.js +15 -0
- package/dist/credential.d.ts +191 -0
- package/dist/credential.js +39 -0
- package/dist/durable-event-manifest.d.ts +3 -0
- package/dist/durable-event-manifest.js +5 -0
- package/dist/event-log.d.ts +14 -0
- package/dist/event-log.js +17 -0
- package/dist/event-manifest.d.ts +12758 -0
- package/dist/event-manifest.js +47 -0
- package/dist/event.d.ts +142 -0
- package/dist/event.js +110 -0
- package/dist/file-diff.d.ts +21 -0
- package/dist/file-diff.js +18 -0
- package/dist/filesystem-v1.d.ts +1 -0
- package/dist/filesystem-v1.js +1 -0
- package/dist/filesystem.d.ts +118 -0
- package/dist/filesystem.js +35 -0
- package/dist/form.d.ts +1259 -0
- package/dist/form.js +120 -0
- package/dist/ide-event.d.ts +76 -0
- package/dist/ide-event.js +10 -0
- package/dist/identifier.d.ts +3 -0
- package/dist/identifier.js +24 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.js +41 -0
- package/dist/installation-event.d.ts +149 -0
- package/dist/installation-event.js +16 -0
- package/dist/instruction-entry.d.ts +29 -0
- package/dist/instruction-entry.js +26 -0
- package/dist/instruction.d.ts +13 -0
- package/dist/instruction.js +8 -0
- package/dist/integration-id.d.ts +5 -0
- package/dist/integration-id.js +3 -0
- package/dist/integration.d.ts +1604 -0
- package/dist/integration.js +85 -0
- package/dist/legacy-event.d.ts +1 -0
- package/dist/legacy-event.js +1 -0
- package/dist/llm.d.ts +4 -0
- package/dist/llm.js +3 -0
- package/dist/location.d.ts +37 -0
- package/dist/location.js +22 -0
- package/dist/lsp-event.d.ts +67 -0
- package/dist/lsp-event.js +4 -0
- package/dist/mcp-event.d.ts +222 -0
- package/dist/mcp-event.js +24 -0
- package/dist/mcp.d.ts +138 -0
- package/dist/mcp.js +111 -0
- package/dist/model.d.ts +247 -0
- package/dist/model.js +116 -0
- package/dist/models-dev.d.ts +69 -0
- package/dist/models-dev.js +7 -0
- package/dist/money.d.ts +10 -0
- package/dist/money.js +5 -0
- package/dist/permission-saved.d.ts +18 -0
- package/dist/permission-saved.js +12 -0
- package/dist/permission-v1.d.ts +1 -0
- package/dist/permission-v1.js +1 -0
- package/dist/permission.d.ts +311 -0
- package/dist/permission.js +46 -0
- package/dist/persistent-pty.d.ts +559 -0
- package/dist/persistent-pty.js +55 -0
- package/dist/plugin.d.ts +132 -0
- package/dist/plugin.js +37 -0
- package/dist/project-id.d.ts +5 -0
- package/dist/project-id.js +3 -0
- package/dist/project.d.ts +264 -0
- package/dist/project.js +46 -0
- package/dist/prompt-input.d.ts +143 -0
- package/dist/prompt-input.js +25 -0
- package/dist/prompt.d.ts +297 -0
- package/dist/prompt.js +61 -0
- package/dist/provider.d.ts +105 -0
- package/dist/provider.js +50 -0
- package/dist/pty-ticket.d.ts +8 -0
- package/dist/pty-ticket.js +7 -0
- package/dist/pty.d.ts +462 -0
- package/dist/pty.js +43 -0
- package/dist/question-v1.d.ts +1 -0
- package/dist/question-v1.js +1 -0
- package/dist/question.d.ts +15 -0
- package/dist/question.js +15 -0
- package/dist/reference.d.ts +120 -0
- package/dist/reference.js +30 -0
- package/dist/rpc.d.ts +111 -0
- package/dist/rpc.js +9 -0
- package/dist/schema.d.ts +10 -0
- package/dist/schema.js +14 -0
- package/dist/server-event.d.ts +132 -0
- package/dist/server-event.js +5 -0
- package/dist/session-compaction-event.d.ts +87 -0
- package/dist/session-compaction-event.js +10 -0
- package/dist/session-error.d.ts +9 -0
- package/dist/session-error.js +8 -0
- package/dist/session-event.d.ts +21315 -0
- package/dist/session-event.js +557 -0
- package/dist/session-fork.d.ts +26 -0
- package/dist/session-fork.js +11 -0
- package/dist/session-id.d.ts +6 -0
- package/dist/session-id.js +10 -0
- package/dist/session-inbox.d.ts +748 -0
- package/dist/session-inbox.js +47 -0
- package/dist/session-message.d.ts +2007 -0
- package/dist/session-message.js +227 -0
- package/dist/session-metadata.d.ts +8 -0
- package/dist/session-metadata.js +9 -0
- package/dist/session-provider-context.d.ts +54 -0
- package/dist/session-provider-context.js +17 -0
- package/dist/session-revert.d.ts +672 -0
- package/dist/session-revert.js +63 -0
- package/dist/session-stats.d.ts +186 -0
- package/dist/session-stats.js +53 -0
- package/dist/session-status-event.d.ts +299 -0
- package/dist/session-status-event.js +45 -0
- package/dist/session-transfer.d.ts +897 -0
- package/dist/session-transfer.js +8 -0
- package/dist/session-v1.d.ts +1 -0
- package/dist/session-v1.js +1 -0
- package/dist/session.d.ts +236 -0
- package/dist/session.js +55 -0
- package/dist/shell.d.ts +381 -0
- package/dist/shell.js +58 -0
- package/dist/skill.d.ts +133 -0
- package/dist/skill.js +48 -0
- package/dist/snapshot.d.ts +4 -0
- package/dist/snapshot.js +3 -0
- package/dist/token-usage.d.ts +14 -0
- package/dist/token-usage.js +14 -0
- package/dist/tool.d.ts +78 -0
- package/dist/tool.js +22 -0
- package/dist/tui-event.d.ts +307 -0
- package/dist/tui-event.js +53 -0
- package/dist/v1/filesystem.d.ts +78 -0
- package/dist/v1/filesystem.js +8 -0
- package/dist/v1/legacy-event.d.ts +108 -0
- package/dist/v1/legacy-event.js +15 -0
- package/dist/v1/permission.d.ts +316 -0
- package/dist/v1/permission.js +41 -0
- package/dist/v1/question.d.ts +444 -0
- package/dist/v1/question.js +57 -0
- package/dist/v1/session.d.ts +7657 -0
- package/dist/v1/session.js +535 -0
- package/dist/vcs-event.d.ts +76 -0
- package/dist/vcs-event.js +11 -0
- package/dist/vcs.d.ts +35 -0
- package/dist/vcs.js +23 -0
- package/dist/websearch.d.ts +108 -0
- package/dist/websearch.js +31 -0
- package/dist/workspace-event.d.ts +247 -0
- package/dist/workspace-event.js +25 -0
- package/dist/workspace-id.d.ts +6 -0
- package/dist/workspace-id.js +16 -0
- package/dist/workspace.d.ts +15 -0
- package/dist/workspace.js +14 -0
- package/dist/worktree-event.d.ts +153 -0
- package/dist/worktree-event.js +18 -0
- package/dist/worktree.d.ts +277 -0
- package/dist/worktree.js +82 -0
- package/package.json +33 -6
- package/README.md +0 -5
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export * as WorktreeEvent from "./worktree-event.js";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
import { optional } from "./schema.js";
|
|
4
|
+
import { Event } from "./event.js";
|
|
5
|
+
export const Ready = Event.ephemeral({
|
|
6
|
+
type: "worktree.ready",
|
|
7
|
+
schema: {
|
|
8
|
+
name: Schema.String,
|
|
9
|
+
branch: optional(Schema.String),
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
export const Failed = Event.ephemeral({
|
|
13
|
+
type: "worktree.failed",
|
|
14
|
+
schema: {
|
|
15
|
+
message: Schema.String,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
export const Definitions = Event.inventory(Ready, Failed);
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
export * as Worktree from "./worktree.js";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
export declare const StrategyID: Schema.brand<Schema.Trim, "Worktree.StrategyID">;
|
|
4
|
+
export type StrategyID = typeof StrategyID.Type;
|
|
5
|
+
export declare const CreateInput: Schema.Struct<{
|
|
6
|
+
readonly strategy: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.Trim, "Worktree.StrategyID">>>, Schema.optionalKey<Schema.brand<Schema.Trim, "Worktree.StrategyID">>, never, never>;
|
|
7
|
+
readonly from: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "AbsolutePath">>>, Schema.optionalKey<Schema.brand<Schema.String, "AbsolutePath">>, never, never>;
|
|
8
|
+
readonly branch: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Trim>>, Schema.optionalKey<Schema.Trim>, never, never>;
|
|
9
|
+
readonly directory: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "AbsolutePath">>>, Schema.optionalKey<Schema.brand<Schema.String, "AbsolutePath">>, never, never>;
|
|
10
|
+
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
11
|
+
}>;
|
|
12
|
+
export interface CreateInput extends Schema.Schema.Type<typeof CreateInput> {
|
|
13
|
+
}
|
|
14
|
+
export declare const RemoveInput: Schema.Struct<{
|
|
15
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
16
|
+
readonly force: Schema.Boolean;
|
|
17
|
+
}>;
|
|
18
|
+
export interface RemoveInput extends Schema.Schema.Type<typeof RemoveInput> {
|
|
19
|
+
}
|
|
20
|
+
export declare const Info: Schema.Struct<{
|
|
21
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
22
|
+
}>;
|
|
23
|
+
export interface Info extends Schema.Schema.Type<typeof Info> {
|
|
24
|
+
}
|
|
25
|
+
export declare const Directory: Schema.Struct<{
|
|
26
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
27
|
+
readonly strategy: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
28
|
+
}>;
|
|
29
|
+
export interface Directory extends Schema.Schema.Type<typeof Directory> {
|
|
30
|
+
}
|
|
31
|
+
export declare const ListEntry: Schema.Struct<{
|
|
32
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
33
|
+
readonly type: Schema.Literals<readonly ["root", "worktree"]>;
|
|
34
|
+
}>;
|
|
35
|
+
export interface ListEntry extends Schema.Schema.Type<typeof ListEntry> {
|
|
36
|
+
}
|
|
37
|
+
declare const OperationError_base: Schema.Class<OperationError, Schema.TaggedStruct<"Worktree.OperationError", {
|
|
38
|
+
readonly message: Schema.String;
|
|
39
|
+
readonly forceRequired: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
40
|
+
}>, import("effect/Cause").YieldableError>;
|
|
41
|
+
export declare class OperationError extends OperationError_base {
|
|
42
|
+
}
|
|
43
|
+
export declare const List: Schema.$Array<Schema.Struct<{
|
|
44
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
45
|
+
readonly strategy: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
46
|
+
}>>;
|
|
47
|
+
export type List = typeof List.Type;
|
|
48
|
+
export declare const Event: {
|
|
49
|
+
Updated: Schema.Struct<{
|
|
50
|
+
readonly id: Schema.brand<Schema.String, "Event.ID"> & {
|
|
51
|
+
create: () => string & import("effect/Brand").Brand<"Event.ID">;
|
|
52
|
+
};
|
|
53
|
+
readonly created: Schema.Finite;
|
|
54
|
+
readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
|
|
55
|
+
readonly type: Schema.Literal<"worktree.updated">;
|
|
56
|
+
readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
57
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
58
|
+
readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
59
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
60
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
61
|
+
}>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
62
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
63
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
64
|
+
}>, never, never>;
|
|
65
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
66
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
67
|
+
readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
68
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
69
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
70
|
+
}>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
71
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
72
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
73
|
+
}>, never, never>;
|
|
74
|
+
}>>, never, never>;
|
|
75
|
+
readonly data: Schema.Struct<{
|
|
76
|
+
readonly projectID: Schema.brand<Schema.String, "Project.ID"> & {
|
|
77
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
78
|
+
};
|
|
79
|
+
}>;
|
|
80
|
+
}> & {
|
|
81
|
+
type: "worktree.updated";
|
|
82
|
+
durability: "ephemeral";
|
|
83
|
+
durable: undefined;
|
|
84
|
+
data: Schema.Struct<{
|
|
85
|
+
readonly projectID: Schema.brand<Schema.String, "Project.ID"> & {
|
|
86
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
87
|
+
};
|
|
88
|
+
}>;
|
|
89
|
+
};
|
|
90
|
+
Resolved: Schema.Struct<{
|
|
91
|
+
readonly id: Schema.brand<Schema.String, "Event.ID"> & {
|
|
92
|
+
create: () => string & import("effect/Brand").Brand<"Event.ID">;
|
|
93
|
+
};
|
|
94
|
+
readonly created: Schema.Finite;
|
|
95
|
+
readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
|
|
96
|
+
readonly type: Schema.Literal<"worktree.resolved">;
|
|
97
|
+
readonly durable: Schema.Struct<{
|
|
98
|
+
readonly aggregateID: Schema.String;
|
|
99
|
+
readonly seq: Schema.brand<Schema.Int, "Event.Seq">;
|
|
100
|
+
readonly version: Schema.decodeTo<Schema.toType<Schema.brand<Schema.Int, "Event.Version">>, Schema.Literal<number>, never, never>;
|
|
101
|
+
}>;
|
|
102
|
+
readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
103
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
104
|
+
readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
105
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
106
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
107
|
+
}>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
108
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
109
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
110
|
+
}>, never, never>;
|
|
111
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
112
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
113
|
+
readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
114
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
115
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
116
|
+
}>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
117
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
118
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
119
|
+
}>, never, never>;
|
|
120
|
+
}>>, never, never>;
|
|
121
|
+
readonly data: Schema.Struct<{
|
|
122
|
+
readonly projectID: Schema.brand<Schema.String, "Project.ID"> & {
|
|
123
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
124
|
+
};
|
|
125
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
126
|
+
readonly previous: Schema.brand<Schema.String, "Project.ID"> & {
|
|
127
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
128
|
+
};
|
|
129
|
+
readonly adopted: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.brand<Schema.String, "Project.ID"> & {
|
|
130
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
131
|
+
}>>>, Schema.optionalKey<Schema.$Array<Schema.brand<Schema.String, "Project.ID"> & {
|
|
132
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
133
|
+
}>>, never, never>;
|
|
134
|
+
}>;
|
|
135
|
+
}> & {
|
|
136
|
+
type: "worktree.resolved";
|
|
137
|
+
durability: "durable";
|
|
138
|
+
durable: {
|
|
139
|
+
readonly version: number;
|
|
140
|
+
readonly aggregate: string;
|
|
141
|
+
};
|
|
142
|
+
data: Schema.Struct<{
|
|
143
|
+
readonly projectID: Schema.brand<Schema.String, "Project.ID"> & {
|
|
144
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
145
|
+
};
|
|
146
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
147
|
+
readonly previous: Schema.brand<Schema.String, "Project.ID"> & {
|
|
148
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
149
|
+
};
|
|
150
|
+
readonly adopted: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.brand<Schema.String, "Project.ID"> & {
|
|
151
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
152
|
+
}>>>, Schema.optionalKey<Schema.$Array<Schema.brand<Schema.String, "Project.ID"> & {
|
|
153
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
154
|
+
}>>, never, never>;
|
|
155
|
+
}>;
|
|
156
|
+
};
|
|
157
|
+
Definitions: readonly [Schema.Struct<{
|
|
158
|
+
readonly id: Schema.brand<Schema.String, "Event.ID"> & {
|
|
159
|
+
create: () => string & import("effect/Brand").Brand<"Event.ID">;
|
|
160
|
+
};
|
|
161
|
+
readonly created: Schema.Finite;
|
|
162
|
+
readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
|
|
163
|
+
readonly type: Schema.Literal<"worktree.updated">;
|
|
164
|
+
readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
165
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
166
|
+
readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
167
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
168
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
169
|
+
}>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
170
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
171
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
172
|
+
}>, never, never>;
|
|
173
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
174
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
175
|
+
readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
176
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
177
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
178
|
+
}>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
179
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
180
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
181
|
+
}>, never, never>;
|
|
182
|
+
}>>, never, never>;
|
|
183
|
+
readonly data: Schema.Struct<{
|
|
184
|
+
readonly projectID: Schema.brand<Schema.String, "Project.ID"> & {
|
|
185
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
186
|
+
};
|
|
187
|
+
}>;
|
|
188
|
+
}> & {
|
|
189
|
+
type: "worktree.updated";
|
|
190
|
+
durability: "ephemeral";
|
|
191
|
+
durable: undefined;
|
|
192
|
+
data: Schema.Struct<{
|
|
193
|
+
readonly projectID: Schema.brand<Schema.String, "Project.ID"> & {
|
|
194
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
195
|
+
};
|
|
196
|
+
}>;
|
|
197
|
+
}, Schema.Struct<{
|
|
198
|
+
readonly id: Schema.brand<Schema.String, "Event.ID"> & {
|
|
199
|
+
create: () => string & import("effect/Brand").Brand<"Event.ID">;
|
|
200
|
+
};
|
|
201
|
+
readonly created: Schema.Finite;
|
|
202
|
+
readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
|
|
203
|
+
readonly type: Schema.Literal<"worktree.resolved">;
|
|
204
|
+
readonly durable: Schema.Struct<{
|
|
205
|
+
readonly aggregateID: Schema.String;
|
|
206
|
+
readonly seq: Schema.brand<Schema.Int, "Event.Seq">;
|
|
207
|
+
readonly version: Schema.decodeTo<Schema.toType<Schema.brand<Schema.Int, "Event.Version">>, Schema.Literal<number>, never, never>;
|
|
208
|
+
}>;
|
|
209
|
+
readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
210
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
211
|
+
readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
212
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
213
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
214
|
+
}>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
215
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
216
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
217
|
+
}>, never, never>;
|
|
218
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
219
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
220
|
+
readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
221
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
222
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
223
|
+
}>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
224
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
225
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
226
|
+
}>, never, never>;
|
|
227
|
+
}>>, never, never>;
|
|
228
|
+
readonly data: Schema.Struct<{
|
|
229
|
+
readonly projectID: Schema.brand<Schema.String, "Project.ID"> & {
|
|
230
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
231
|
+
};
|
|
232
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
233
|
+
readonly previous: Schema.brand<Schema.String, "Project.ID"> & {
|
|
234
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
235
|
+
};
|
|
236
|
+
readonly adopted: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.brand<Schema.String, "Project.ID"> & {
|
|
237
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
238
|
+
}>>>, Schema.optionalKey<Schema.$Array<Schema.brand<Schema.String, "Project.ID"> & {
|
|
239
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
240
|
+
}>>, never, never>;
|
|
241
|
+
}>;
|
|
242
|
+
}> & {
|
|
243
|
+
type: "worktree.resolved";
|
|
244
|
+
durability: "durable";
|
|
245
|
+
durable: {
|
|
246
|
+
readonly version: number;
|
|
247
|
+
readonly aggregate: string;
|
|
248
|
+
};
|
|
249
|
+
data: Schema.Struct<{
|
|
250
|
+
readonly projectID: Schema.brand<Schema.String, "Project.ID"> & {
|
|
251
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
252
|
+
};
|
|
253
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
254
|
+
readonly previous: Schema.brand<Schema.String, "Project.ID"> & {
|
|
255
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
256
|
+
};
|
|
257
|
+
readonly adopted: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.brand<Schema.String, "Project.ID"> & {
|
|
258
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
259
|
+
}>>>, Schema.optionalKey<Schema.$Array<Schema.brand<Schema.String, "Project.ID"> & {
|
|
260
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
261
|
+
}>>, never, never>;
|
|
262
|
+
}>;
|
|
263
|
+
}];
|
|
264
|
+
};
|
|
265
|
+
export declare function adopt(session: {
|
|
266
|
+
readonly projectID: string;
|
|
267
|
+
readonly directory: string;
|
|
268
|
+
readonly workspaceID?: string;
|
|
269
|
+
}, event: {
|
|
270
|
+
readonly projectID: string;
|
|
271
|
+
readonly directory: string;
|
|
272
|
+
readonly previous: string;
|
|
273
|
+
readonly adopted?: ReadonlyArray<string>;
|
|
274
|
+
}): {
|
|
275
|
+
projectID: string;
|
|
276
|
+
subpath: string | undefined;
|
|
277
|
+
} | undefined;
|
package/dist/worktree.js
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export * as Worktree from "./worktree.js";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
import { durable, ephemeral, inventory } from "./event.js";
|
|
4
|
+
import { AbsolutePath, optional } from "./schema.js";
|
|
5
|
+
import { Project } from "./project.js";
|
|
6
|
+
export const StrategyID = Schema.Trim.pipe(Schema.check(Schema.isNonEmpty()), Schema.brand("Worktree.StrategyID"));
|
|
7
|
+
export const CreateInput = Schema.Struct({
|
|
8
|
+
strategy: optional(StrategyID),
|
|
9
|
+
from: optional(AbsolutePath),
|
|
10
|
+
branch: optional(Schema.Trim.pipe(Schema.check(Schema.isNonEmpty()))),
|
|
11
|
+
directory: optional(AbsolutePath).annotate({
|
|
12
|
+
description: "Parent directory for the new worktree. Uses the location's configuration, then defaults to the server's data directory under worktree/<first six project ID characters>.",
|
|
13
|
+
}),
|
|
14
|
+
name: optional(Schema.String),
|
|
15
|
+
}).annotate({ identifier: "Worktree.CreateInput" });
|
|
16
|
+
export const RemoveInput = Schema.Struct({
|
|
17
|
+
directory: AbsolutePath,
|
|
18
|
+
force: Schema.Boolean,
|
|
19
|
+
}).annotate({ identifier: "Worktree.RemoveInput" });
|
|
20
|
+
export const Info = Schema.Struct({
|
|
21
|
+
directory: AbsolutePath,
|
|
22
|
+
}).annotate({ identifier: "Worktree.Info" });
|
|
23
|
+
export const Directory = Schema.Struct({
|
|
24
|
+
directory: AbsolutePath,
|
|
25
|
+
strategy: optional(Schema.String),
|
|
26
|
+
}).annotate({ identifier: "Worktree.Directory" });
|
|
27
|
+
export const ListEntry = Schema.Struct({
|
|
28
|
+
directory: AbsolutePath,
|
|
29
|
+
type: Schema.Literals(["root", "worktree"]),
|
|
30
|
+
}).annotate({ identifier: "Worktree.ListEntry" });
|
|
31
|
+
export class OperationError extends Schema.TaggedError()("Worktree.OperationError", {
|
|
32
|
+
message: Schema.String,
|
|
33
|
+
forceRequired: optional(Schema.Boolean),
|
|
34
|
+
}) {
|
|
35
|
+
}
|
|
36
|
+
export const List = Schema.Array(Directory).annotate({ identifier: "Worktree.List" });
|
|
37
|
+
const Updated = ephemeral({
|
|
38
|
+
type: "worktree.updated",
|
|
39
|
+
schema: { projectID: Project.ID },
|
|
40
|
+
});
|
|
41
|
+
const Resolved = durable({
|
|
42
|
+
type: "worktree.resolved",
|
|
43
|
+
durable: { aggregate: "projectID", version: 1 },
|
|
44
|
+
schema: {
|
|
45
|
+
projectID: Project.ID,
|
|
46
|
+
directory: AbsolutePath,
|
|
47
|
+
previous: Project.ID,
|
|
48
|
+
adopted: optional(Schema.Array(Project.ID)),
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
export const Event = { Updated, Resolved, Definitions: inventory(Updated, Resolved) };
|
|
52
|
+
export function adopt(session, event) {
|
|
53
|
+
if (session.workspaceID)
|
|
54
|
+
return;
|
|
55
|
+
if (session.projectID !== event.previous &&
|
|
56
|
+
session.projectID !== Project.ID.global &&
|
|
57
|
+
!event.adopted?.includes(session.projectID))
|
|
58
|
+
return;
|
|
59
|
+
if (session.projectID === event.projectID)
|
|
60
|
+
return;
|
|
61
|
+
const normalize = (value) => value
|
|
62
|
+
.replaceAll("\\", "/")
|
|
63
|
+
.split("/")
|
|
64
|
+
.reduce((result, segment) => {
|
|
65
|
+
if (!segment || segment === ".")
|
|
66
|
+
return result;
|
|
67
|
+
if (segment === "..")
|
|
68
|
+
return result.slice(0, result.lastIndexOf("/"));
|
|
69
|
+
return `${result}/${segment}`;
|
|
70
|
+
}, "");
|
|
71
|
+
const directory = normalize(session.directory);
|
|
72
|
+
const root = normalize(event.directory);
|
|
73
|
+
const windows = /^\/[a-z]:/i.test(root);
|
|
74
|
+
const key = windows ? directory.toLowerCase() : directory;
|
|
75
|
+
const parent = windows ? root.toLowerCase() : root;
|
|
76
|
+
if (key !== parent && !key.startsWith(parent + "/"))
|
|
77
|
+
return;
|
|
78
|
+
return {
|
|
79
|
+
projectID: event.projectID,
|
|
80
|
+
subpath: key === parent ? undefined : directory.slice(root.length + 1),
|
|
81
|
+
};
|
|
82
|
+
}
|
package/package.json
CHANGED
|
@@ -1,15 +1,42 @@
|
|
|
1
1
|
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/package.json",
|
|
2
3
|
"name": "@opencode/schema",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
4
|
+
"version": "2.0.1",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"license": "MIT",
|
|
6
7
|
"repository": {
|
|
7
8
|
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/anomalyco/opencode.git"
|
|
9
|
+
"url": "git+https://github.com/anomalyco/opencode.git",
|
|
10
|
+
"directory": "packages/schema"
|
|
9
11
|
},
|
|
10
12
|
"publishConfig": {
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"import": "./dist/index.js",
|
|
21
|
+
"types": "./dist/index.d.ts"
|
|
22
|
+
},
|
|
23
|
+
"./*": {
|
|
24
|
+
"import": "./dist/*.js",
|
|
25
|
+
"types": "./dist/*.d.ts"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "bun run script/build.ts",
|
|
30
|
+
"typecheck": "tsgo --noEmit"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@standard-schema/spec": "1.1.0",
|
|
34
|
+
"effect": "4.0.0-rc.112"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@tsconfig/bun": "1.0.9",
|
|
38
|
+
"@types/bun": "1.4.0",
|
|
39
|
+
"@typescript/native-preview": "7.0.0-dev.20251207.1",
|
|
40
|
+
"typescript": "5.8.2"
|
|
14
41
|
}
|
|
15
42
|
}
|