@opencode-ai/schema 0.0.0-dev-18262 → 0.0.0-dev-18266
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/event-manifest.d.ts +20 -0
- package/dist/worktree.d.ts +22 -0
- package/dist/worktree.js +23 -8
- package/package.json +1 -1
package/dist/event-manifest.d.ts
CHANGED
|
@@ -4282,6 +4282,11 @@ export declare const ServerDefinitions: readonly [Schema.Struct<{
|
|
|
4282
4282
|
readonly previous: Schema.brand<Schema.String, "Project.ID"> & {
|
|
4283
4283
|
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
4284
4284
|
};
|
|
4285
|
+
readonly adopted: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.brand<Schema.String, "Project.ID"> & {
|
|
4286
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
4287
|
+
}>>>, Schema.optionalKey<Schema.$Array<Schema.brand<Schema.String, "Project.ID"> & {
|
|
4288
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
4289
|
+
}>>, never, never>;
|
|
4285
4290
|
}>;
|
|
4286
4291
|
}> & {
|
|
4287
4292
|
type: "worktree.resolved";
|
|
@@ -4298,6 +4303,11 @@ export declare const ServerDefinitions: readonly [Schema.Struct<{
|
|
|
4298
4303
|
readonly previous: Schema.brand<Schema.String, "Project.ID"> & {
|
|
4299
4304
|
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
4300
4305
|
};
|
|
4306
|
+
readonly adopted: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.brand<Schema.String, "Project.ID"> & {
|
|
4307
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
4308
|
+
}>>>, Schema.optionalKey<Schema.$Array<Schema.brand<Schema.String, "Project.ID"> & {
|
|
4309
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
4310
|
+
}>>, never, never>;
|
|
4301
4311
|
}>;
|
|
4302
4312
|
}, Schema.Struct<{
|
|
4303
4313
|
readonly id: Schema.brand<Schema.String, "Event.ID"> & {
|
|
@@ -10120,6 +10130,11 @@ export declare const Definitions: readonly [Schema.Struct<{
|
|
|
10120
10130
|
readonly previous: Schema.brand<Schema.String, "Project.ID"> & {
|
|
10121
10131
|
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
10122
10132
|
};
|
|
10133
|
+
readonly adopted: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.brand<Schema.String, "Project.ID"> & {
|
|
10134
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
10135
|
+
}>>>, Schema.optionalKey<Schema.$Array<Schema.brand<Schema.String, "Project.ID"> & {
|
|
10136
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
10137
|
+
}>>, never, never>;
|
|
10123
10138
|
}>;
|
|
10124
10139
|
}> & {
|
|
10125
10140
|
type: "worktree.resolved";
|
|
@@ -10136,6 +10151,11 @@ export declare const Definitions: readonly [Schema.Struct<{
|
|
|
10136
10151
|
readonly previous: Schema.brand<Schema.String, "Project.ID"> & {
|
|
10137
10152
|
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
10138
10153
|
};
|
|
10154
|
+
readonly adopted: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.brand<Schema.String, "Project.ID"> & {
|
|
10155
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
10156
|
+
}>>>, Schema.optionalKey<Schema.$Array<Schema.brand<Schema.String, "Project.ID"> & {
|
|
10157
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
10158
|
+
}>>, never, never>;
|
|
10139
10159
|
}>;
|
|
10140
10160
|
}, Schema.Struct<{
|
|
10141
10161
|
readonly id: Schema.brand<Schema.String, "Event.ID"> & {
|
package/dist/worktree.d.ts
CHANGED
|
@@ -127,6 +127,11 @@ export declare const Event: {
|
|
|
127
127
|
readonly previous: Schema.brand<Schema.String, "Project.ID"> & {
|
|
128
128
|
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
129
129
|
};
|
|
130
|
+
readonly adopted: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.brand<Schema.String, "Project.ID"> & {
|
|
131
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
132
|
+
}>>>, Schema.optionalKey<Schema.$Array<Schema.brand<Schema.String, "Project.ID"> & {
|
|
133
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
134
|
+
}>>, never, never>;
|
|
130
135
|
}>;
|
|
131
136
|
}> & {
|
|
132
137
|
type: "worktree.resolved";
|
|
@@ -143,6 +148,11 @@ export declare const Event: {
|
|
|
143
148
|
readonly previous: Schema.brand<Schema.String, "Project.ID"> & {
|
|
144
149
|
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
145
150
|
};
|
|
151
|
+
readonly adopted: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.brand<Schema.String, "Project.ID"> & {
|
|
152
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
153
|
+
}>>>, Schema.optionalKey<Schema.$Array<Schema.brand<Schema.String, "Project.ID"> & {
|
|
154
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
155
|
+
}>>, never, never>;
|
|
146
156
|
}>;
|
|
147
157
|
};
|
|
148
158
|
Definitions: readonly [Schema.Struct<{
|
|
@@ -224,6 +234,11 @@ export declare const Event: {
|
|
|
224
234
|
readonly previous: Schema.brand<Schema.String, "Project.ID"> & {
|
|
225
235
|
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
226
236
|
};
|
|
237
|
+
readonly adopted: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.brand<Schema.String, "Project.ID"> & {
|
|
238
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
239
|
+
}>>>, Schema.optionalKey<Schema.$Array<Schema.brand<Schema.String, "Project.ID"> & {
|
|
240
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
241
|
+
}>>, never, never>;
|
|
227
242
|
}>;
|
|
228
243
|
}> & {
|
|
229
244
|
type: "worktree.resolved";
|
|
@@ -240,16 +255,23 @@ export declare const Event: {
|
|
|
240
255
|
readonly previous: Schema.brand<Schema.String, "Project.ID"> & {
|
|
241
256
|
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
242
257
|
};
|
|
258
|
+
readonly adopted: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.brand<Schema.String, "Project.ID"> & {
|
|
259
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
260
|
+
}>>>, Schema.optionalKey<Schema.$Array<Schema.brand<Schema.String, "Project.ID"> & {
|
|
261
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
262
|
+
}>>, never, never>;
|
|
243
263
|
}>;
|
|
244
264
|
}];
|
|
245
265
|
};
|
|
246
266
|
export declare function adopt(session: {
|
|
247
267
|
readonly projectID: string;
|
|
248
268
|
readonly directory: string;
|
|
269
|
+
readonly workspaceID?: string;
|
|
249
270
|
}, event: {
|
|
250
271
|
readonly projectID: string;
|
|
251
272
|
readonly directory: string;
|
|
252
273
|
readonly previous: string;
|
|
274
|
+
readonly adopted?: ReadonlyArray<string>;
|
|
253
275
|
}): {
|
|
254
276
|
projectID: string;
|
|
255
277
|
subpath: string | undefined;
|
package/dist/worktree.js
CHANGED
|
@@ -40,23 +40,38 @@ const Resolved = durable({
|
|
|
40
40
|
projectID: Project.ID,
|
|
41
41
|
directory: AbsolutePath,
|
|
42
42
|
previous: Project.ID,
|
|
43
|
+
adopted: optional(Schema.Array(Project.ID)),
|
|
43
44
|
},
|
|
44
45
|
});
|
|
45
46
|
export const Event = { Updated, Resolved, Definitions: inventory(Updated, Resolved) };
|
|
46
47
|
export function adopt(session, event) {
|
|
47
|
-
if (session.
|
|
48
|
+
if (session.workspaceID)
|
|
49
|
+
return;
|
|
50
|
+
if (session.projectID !== event.previous &&
|
|
51
|
+
session.projectID !== Project.ID.global &&
|
|
52
|
+
!event.adopted?.includes(session.projectID))
|
|
48
53
|
return;
|
|
49
54
|
if (session.projectID === event.projectID)
|
|
50
55
|
return;
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
const normalize = (value) => value
|
|
57
|
+
.replaceAll("\\", "/")
|
|
58
|
+
.split("/")
|
|
59
|
+
.reduce((result, segment) => {
|
|
60
|
+
if (!segment || segment === ".")
|
|
61
|
+
return result;
|
|
62
|
+
if (segment === "..")
|
|
63
|
+
return result.slice(0, result.lastIndexOf("/"));
|
|
64
|
+
return `${result}/${segment}`;
|
|
65
|
+
}, "");
|
|
66
|
+
const directory = normalize(session.directory);
|
|
67
|
+
const root = normalize(event.directory);
|
|
68
|
+
const windows = /^\/[a-z]:/i.test(root);
|
|
69
|
+
const key = windows ? directory.toLowerCase() : directory;
|
|
70
|
+
const parent = windows ? root.toLowerCase() : root;
|
|
71
|
+
if (key !== parent && !key.startsWith(parent + "/"))
|
|
55
72
|
return;
|
|
56
73
|
return {
|
|
57
74
|
projectID: event.projectID,
|
|
58
|
-
subpath:
|
|
59
|
-
? undefined
|
|
60
|
-
: session.directory.slice(event.directory.length + 1).replaceAll("\\", "/"),
|
|
75
|
+
subpath: key === parent ? undefined : directory.slice(root.length + 1),
|
|
61
76
|
};
|
|
62
77
|
}
|