@opencode-ai/schema 0.0.0-next-17403 → 0.0.0-next-17430

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.
@@ -1,9 +1,9 @@
1
1
  export * as DurableEventManifest from "./durable-event-manifest.js";
2
2
  import { Event } from "./event.js";
3
- import { ProjectDirectories } from "./project-directories.js";
3
+ import { Worktree } from "./worktree.js";
4
4
  import { SessionEvent } from "./session-event.js";
5
5
  export const SessionDurable = {
6
6
  definitions: Event.durableMap(SessionEvent.DurableDefinitions),
7
7
  schema: SessionEvent.Durable,
8
8
  };
9
- export const Durable = Event.durableMap([...SessionEvent.DurableDefinitions, ProjectDirectories.Event.Resolved]);
9
+ export const Durable = Event.durableMap([...SessionEvent.DurableDefinitions, Worktree.Event.Resolved]);
@@ -3839,6 +3839,7 @@ export declare const ServerDefinitions: readonly [Schema.Struct<{
3839
3839
  readonly action: Schema.String;
3840
3840
  readonly resources: Schema.$Array<Schema.String>;
3841
3841
  readonly save: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.String>>>, Schema.optionalKey<Schema.$Array<Schema.String>>, never, never>;
3842
+ readonly opaque: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
3842
3843
  readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
3843
3844
  readonly source: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
3844
3845
  readonly type: Schema.Literal<"tool">;
@@ -3865,6 +3866,7 @@ export declare const ServerDefinitions: readonly [Schema.Struct<{
3865
3866
  readonly action: Schema.String;
3866
3867
  readonly resources: Schema.$Array<Schema.String>;
3867
3868
  readonly save: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.String>>>, Schema.optionalKey<Schema.$Array<Schema.String>>, never, never>;
3869
+ readonly opaque: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
3868
3870
  readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
3869
3871
  readonly source: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
3870
3872
  readonly type: Schema.Literal<"tool">;
@@ -4003,7 +4005,7 @@ export declare const ServerDefinitions: readonly [Schema.Struct<{
4003
4005
  };
4004
4006
  readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
4005
4007
  readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
4006
- readonly type: Schema.Literal<"project.directories.updated">;
4008
+ readonly type: Schema.Literal<"worktree.updated">;
4007
4009
  readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
4008
4010
  readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
4009
4011
  readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
@@ -4029,7 +4031,7 @@ export declare const ServerDefinitions: readonly [Schema.Struct<{
4029
4031
  };
4030
4032
  }>;
4031
4033
  }> & {
4032
- type: "project.directories.updated";
4034
+ type: "worktree.updated";
4033
4035
  durability: "ephemeral";
4034
4036
  durable: undefined;
4035
4037
  data: Schema.Struct<{
@@ -4043,7 +4045,7 @@ export declare const ServerDefinitions: readonly [Schema.Struct<{
4043
4045
  };
4044
4046
  readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
4045
4047
  readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
4046
- readonly type: Schema.Literal<"project.directory.resolved">;
4048
+ readonly type: Schema.Literal<"worktree.resolved">;
4047
4049
  readonly durable: Schema.Struct<{
4048
4050
  readonly aggregateID: Schema.String;
4049
4051
  readonly seq: Schema.brand<Schema.Int, "Event.Seq">;
@@ -4078,7 +4080,7 @@ export declare const ServerDefinitions: readonly [Schema.Struct<{
4078
4080
  };
4079
4081
  }>;
4080
4082
  }> & {
4081
- type: "project.directory.resolved";
4083
+ type: "worktree.resolved";
4082
4084
  durability: "durable";
4083
4085
  durable: {
4084
4086
  readonly version: number;
@@ -9513,6 +9515,7 @@ export declare const Definitions: readonly [Schema.Struct<{
9513
9515
  readonly action: Schema.String;
9514
9516
  readonly resources: Schema.$Array<Schema.String>;
9515
9517
  readonly save: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.String>>>, Schema.optionalKey<Schema.$Array<Schema.String>>, never, never>;
9518
+ readonly opaque: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
9516
9519
  readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
9517
9520
  readonly source: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
9518
9521
  readonly type: Schema.Literal<"tool">;
@@ -9539,6 +9542,7 @@ export declare const Definitions: readonly [Schema.Struct<{
9539
9542
  readonly action: Schema.String;
9540
9543
  readonly resources: Schema.$Array<Schema.String>;
9541
9544
  readonly save: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.String>>>, Schema.optionalKey<Schema.$Array<Schema.String>>, never, never>;
9545
+ readonly opaque: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
9542
9546
  readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
9543
9547
  readonly source: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
9544
9548
  readonly type: Schema.Literal<"tool">;
@@ -9677,7 +9681,7 @@ export declare const Definitions: readonly [Schema.Struct<{
9677
9681
  };
9678
9682
  readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
9679
9683
  readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
9680
- readonly type: Schema.Literal<"project.directories.updated">;
9684
+ readonly type: Schema.Literal<"worktree.updated">;
9681
9685
  readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
9682
9686
  readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
9683
9687
  readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
@@ -9703,7 +9707,7 @@ export declare const Definitions: readonly [Schema.Struct<{
9703
9707
  };
9704
9708
  }>;
9705
9709
  }> & {
9706
- type: "project.directories.updated";
9710
+ type: "worktree.updated";
9707
9711
  durability: "ephemeral";
9708
9712
  durable: undefined;
9709
9713
  data: Schema.Struct<{
@@ -9717,7 +9721,7 @@ export declare const Definitions: readonly [Schema.Struct<{
9717
9721
  };
9718
9722
  readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
9719
9723
  readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
9720
- readonly type: Schema.Literal<"project.directory.resolved">;
9724
+ readonly type: Schema.Literal<"worktree.resolved">;
9721
9725
  readonly durable: Schema.Struct<{
9722
9726
  readonly aggregateID: Schema.String;
9723
9727
  readonly seq: Schema.brand<Schema.Int, "Event.Seq">;
@@ -9752,7 +9756,7 @@ export declare const Definitions: readonly [Schema.Struct<{
9752
9756
  };
9753
9757
  }>;
9754
9758
  }> & {
9755
- type: "project.directory.resolved";
9759
+ type: "worktree.resolved";
9756
9760
  durability: "durable";
9757
9761
  durable: {
9758
9762
  readonly version: number;
@@ -18,7 +18,7 @@ import { ModelsDev } from "./models-dev.js";
18
18
  import { Permission } from "./permission.js";
19
19
  import { Plugin } from "./plugin.js";
20
20
  import { Project } from "./project.js";
21
- import { ProjectDirectories } from "./project-directories.js";
21
+ import { Worktree } from "./worktree.js";
22
22
  import { Pty } from "./pty.js";
23
23
  import { Question } from "./question.js";
24
24
  import { Reference } from "./reference.js";
@@ -35,7 +35,7 @@ import { WorktreeEvent } from "./worktree-event.js";
35
35
  import { WebSearch } from "./websearch.js";
36
36
  const coreDefinitions = Event.inventory(...SessionEvent.Definitions);
37
37
  const foundationDefinitions = Event.inventory(...ModelsDev.Event.Definitions, ...Integration.Event.Definitions, ...Catalog.Event.Definitions, ...Agent.Event.Definitions, ...coreDefinitions);
38
- const featureDefinitions = Event.inventory(...FileSystem.Event.Definitions, ...Reference.Event.Definitions, ...Permission.Event.Definitions, ...Plugin.Event.Definitions, ...ProjectDirectories.Event.Definitions, ...Command.Event.Definitions, ...Config.Event.Definitions, ...Skill.Event.Definitions, ...Pty.Event.Definitions, ...Shell.Event.Definitions, ...Question.Event.Definitions, ...Form.Event.Definitions, ...WebSearch.Event.Definitions);
38
+ const featureDefinitions = Event.inventory(...FileSystem.Event.Definitions, ...Reference.Event.Definitions, ...Permission.Event.Definitions, ...Plugin.Event.Definitions, ...Worktree.Event.Definitions, ...Command.Event.Definitions, ...Config.Event.Definitions, ...Skill.Event.Definitions, ...Pty.Event.Definitions, ...Shell.Event.Definitions, ...Question.Event.Definitions, ...Form.Event.Definitions, ...WebSearch.Event.Definitions);
39
39
  export const ServerDefinitions = Event.inventory(...foundationDefinitions, ...featureDefinitions,
40
40
  // Current events the TUI consumes from the public stream.
41
41
  ...SessionStatusEvent.Definitions, ...TuiEvent.Definitions, ...InstallationEvent.Definitions, ...VcsEvent.Definitions, McpEvent.StatusChanged, McpEvent.ResourcesChanged);
package/dist/index.d.ts CHANGED
@@ -16,7 +16,7 @@ export { Money } from "./money.js";
16
16
  export { Permission } from "./permission.js";
17
17
  export { PermissionSaved } from "./permission-saved.js";
18
18
  export { Project } from "./project.js";
19
- export { ProjectCopy } from "./project-copy.js";
19
+ export { Worktree } from "./worktree.js";
20
20
  export { Provider } from "./provider.js";
21
21
  export { Reference } from "./reference.js";
22
22
  export { WebSearch } from "./websearch.js";
package/dist/index.js CHANGED
@@ -16,7 +16,7 @@ export { Money } from "./money.js";
16
16
  export { Permission } from "./permission.js";
17
17
  export { PermissionSaved } from "./permission-saved.js";
18
18
  export { Project } from "./project.js";
19
- export { ProjectCopy } from "./project-copy.js";
19
+ export { Worktree } from "./worktree.js";
20
20
  export { Provider } from "./provider.js";
21
21
  export { Reference } from "./reference.js";
22
22
  export { WebSearch } from "./websearch.js";
@@ -18,6 +18,7 @@ export declare const Request: Schema.Struct<{
18
18
  readonly action: Schema.String;
19
19
  readonly resources: Schema.$Array<Schema.String>;
20
20
  readonly save: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.String>>>, Schema.optionalKey<Schema.$Array<Schema.String>>, never, never>;
21
+ readonly opaque: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
21
22
  readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
22
23
  readonly source: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
23
24
  readonly type: Schema.Literal<"tool">;
@@ -71,6 +72,7 @@ export declare const Event: {
71
72
  readonly action: Schema.String;
72
73
  readonly resources: Schema.$Array<Schema.String>;
73
74
  readonly save: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.String>>>, Schema.optionalKey<Schema.$Array<Schema.String>>, never, never>;
75
+ readonly opaque: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
74
76
  readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
75
77
  readonly source: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
76
78
  readonly type: Schema.Literal<"tool">;
@@ -97,6 +99,7 @@ export declare const Event: {
97
99
  readonly action: Schema.String;
98
100
  readonly resources: Schema.$Array<Schema.String>;
99
101
  readonly save: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.String>>>, Schema.optionalKey<Schema.$Array<Schema.String>>, never, never>;
102
+ readonly opaque: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
100
103
  readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
101
104
  readonly source: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
102
105
  readonly type: Schema.Literal<"tool">;
@@ -197,6 +200,7 @@ export declare const Event: {
197
200
  readonly action: Schema.String;
198
201
  readonly resources: Schema.$Array<Schema.String>;
199
202
  readonly save: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.String>>>, Schema.optionalKey<Schema.$Array<Schema.String>>, never, never>;
203
+ readonly opaque: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
200
204
  readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
201
205
  readonly source: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
202
206
  readonly type: Schema.Literal<"tool">;
@@ -223,6 +227,7 @@ export declare const Event: {
223
227
  readonly action: Schema.String;
224
228
  readonly resources: Schema.$Array<Schema.String>;
225
229
  readonly save: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.String>>>, Schema.optionalKey<Schema.$Array<Schema.String>>, never, never>;
230
+ readonly opaque: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
226
231
  readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
227
232
  readonly source: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
228
233
  readonly type: Schema.Literal<"tool">;
@@ -18,6 +18,7 @@ const RequestFields = {
18
18
  action: Schema.String,
19
19
  resources: Schema.Array(Schema.String),
20
20
  save: Schema.Array(Schema.String).pipe(optional),
21
+ opaque: Schema.Boolean.pipe(optional),
21
22
  metadata: Schema.Record(Schema.String, Schema.Unknown).pipe(optional),
22
23
  source: Source.pipe(optional),
23
24
  };
package/dist/project.d.ts CHANGED
@@ -14,24 +14,6 @@ export declare const Current: Schema.Struct<{
14
14
  }>;
15
15
  export interface Current extends Schema.Schema.Type<typeof Current> {
16
16
  }
17
- export declare const Directory: Schema.Struct<{
18
- readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
19
- readonly strategy: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
20
- }>;
21
- export interface Directory extends Schema.Schema.Type<typeof Directory> {
22
- }
23
- export declare const DirectoriesInput: Schema.Struct<{
24
- readonly projectID: Schema.brand<Schema.String, "Project.ID"> & {
25
- global: string & import("effect/Brand").Brand<"Project.ID">;
26
- };
27
- }>;
28
- export interface DirectoriesInput extends Schema.Schema.Type<typeof DirectoriesInput> {
29
- }
30
- export declare const Directories: Schema.$Array<Schema.Struct<{
31
- readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
32
- readonly strategy: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
33
- }>>;
34
- export type Directories = typeof Directories.Type;
35
17
  export declare const Icon: Schema.Struct<{
36
18
  readonly url: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
37
19
  readonly override: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
package/dist/project.js CHANGED
@@ -10,14 +10,6 @@ export const Current = Schema.Struct({
10
10
  directory: AbsolutePath,
11
11
  canonical: AbsolutePath,
12
12
  }).annotate({ identifier: "Project.Current" });
13
- export const Directory = Schema.Struct({
14
- directory: AbsolutePath,
15
- strategy: optional(Schema.String),
16
- }).annotate({ identifier: "Project.Directory" });
17
- export const DirectoriesInput = Schema.Struct({
18
- projectID: ID,
19
- }).annotate({ identifier: "Project.DirectoriesInput" });
20
- export const Directories = Schema.Array(Directory).annotate({ identifier: "Project.Directories" });
21
13
  export const Icon = Schema.Struct({
22
14
  url: optional(Schema.String),
23
15
  override: optional(Schema.String),
@@ -0,0 +1,255 @@
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 projectID: Schema.brand<Schema.String, "Project.ID"> & {
7
+ global: string & import("effect/Brand").Brand<"Project.ID">;
8
+ };
9
+ readonly strategy: Schema.brand<Schema.Trim, "Worktree.StrategyID">;
10
+ readonly from: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "AbsolutePath">>>, Schema.optionalKey<Schema.brand<Schema.String, "AbsolutePath">>, never, never>;
11
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
12
+ readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
13
+ }>;
14
+ export interface CreateInput extends Schema.Schema.Type<typeof CreateInput> {
15
+ }
16
+ export declare const RemoveInput: Schema.Struct<{
17
+ readonly projectID: Schema.brand<Schema.String, "Project.ID"> & {
18
+ global: string & import("effect/Brand").Brand<"Project.ID">;
19
+ };
20
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
21
+ readonly force: Schema.Boolean;
22
+ }>;
23
+ export interface RemoveInput extends Schema.Schema.Type<typeof RemoveInput> {
24
+ }
25
+ export declare const Info: Schema.Struct<{
26
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
27
+ }>;
28
+ export interface Info extends Schema.Schema.Type<typeof Info> {
29
+ }
30
+ export declare const Directory: Schema.Struct<{
31
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
32
+ readonly strategy: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
33
+ }>;
34
+ export interface Directory extends Schema.Schema.Type<typeof Directory> {
35
+ }
36
+ export declare const ListInput: Schema.Struct<{
37
+ readonly projectID: Schema.brand<Schema.String, "Project.ID"> & {
38
+ global: string & import("effect/Brand").Brand<"Project.ID">;
39
+ };
40
+ }>;
41
+ export interface ListInput extends Schema.Schema.Type<typeof ListInput> {
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.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
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.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
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
+ }>;
130
+ }> & {
131
+ type: "worktree.resolved";
132
+ durability: "durable";
133
+ durable: {
134
+ readonly version: number;
135
+ readonly aggregate: string;
136
+ };
137
+ data: Schema.Struct<{
138
+ readonly projectID: Schema.brand<Schema.String, "Project.ID"> & {
139
+ global: string & import("effect/Brand").Brand<"Project.ID">;
140
+ };
141
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
142
+ readonly previous: Schema.brand<Schema.String, "Project.ID"> & {
143
+ global: string & import("effect/Brand").Brand<"Project.ID">;
144
+ };
145
+ }>;
146
+ };
147
+ Definitions: readonly [Schema.Struct<{
148
+ readonly id: Schema.brand<Schema.String, "Event.ID"> & {
149
+ create: () => string & import("effect/Brand").Brand<"Event.ID">;
150
+ };
151
+ readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
152
+ readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
153
+ readonly type: Schema.Literal<"worktree.updated">;
154
+ readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
155
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
156
+ readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
157
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
158
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
159
+ }>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
160
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
161
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
162
+ }>, never, never>;
163
+ }>>>, Schema.optionalKey<Schema.Struct<{
164
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
165
+ readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
166
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
167
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
168
+ }>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
169
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
170
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
171
+ }>, never, never>;
172
+ }>>, never, never>;
173
+ readonly data: Schema.Struct<{
174
+ readonly projectID: Schema.brand<Schema.String, "Project.ID"> & {
175
+ global: string & import("effect/Brand").Brand<"Project.ID">;
176
+ };
177
+ }>;
178
+ }> & {
179
+ type: "worktree.updated";
180
+ durability: "ephemeral";
181
+ durable: undefined;
182
+ data: Schema.Struct<{
183
+ readonly projectID: Schema.brand<Schema.String, "Project.ID"> & {
184
+ global: string & import("effect/Brand").Brand<"Project.ID">;
185
+ };
186
+ }>;
187
+ }, Schema.Struct<{
188
+ readonly id: Schema.brand<Schema.String, "Event.ID"> & {
189
+ create: () => string & import("effect/Brand").Brand<"Event.ID">;
190
+ };
191
+ readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
192
+ readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
193
+ readonly type: Schema.Literal<"worktree.resolved">;
194
+ readonly durable: Schema.Struct<{
195
+ readonly aggregateID: Schema.String;
196
+ readonly seq: Schema.brand<Schema.Int, "Event.Seq">;
197
+ readonly version: Schema.decodeTo<Schema.toType<Schema.brand<Schema.Int, "Event.Version">>, Schema.Literal<number>, never, never>;
198
+ }>;
199
+ readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
200
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
201
+ readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
202
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
203
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
204
+ }>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
205
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
206
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
207
+ }>, never, never>;
208
+ }>>>, Schema.optionalKey<Schema.Struct<{
209
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
210
+ readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
211
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
212
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
213
+ }>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
214
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
215
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
216
+ }>, never, never>;
217
+ }>>, never, never>;
218
+ readonly data: Schema.Struct<{
219
+ readonly projectID: Schema.brand<Schema.String, "Project.ID"> & {
220
+ global: string & import("effect/Brand").Brand<"Project.ID">;
221
+ };
222
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
223
+ readonly previous: Schema.brand<Schema.String, "Project.ID"> & {
224
+ global: string & import("effect/Brand").Brand<"Project.ID">;
225
+ };
226
+ }>;
227
+ }> & {
228
+ type: "worktree.resolved";
229
+ durability: "durable";
230
+ durable: {
231
+ readonly version: number;
232
+ readonly aggregate: string;
233
+ };
234
+ data: Schema.Struct<{
235
+ readonly projectID: Schema.brand<Schema.String, "Project.ID"> & {
236
+ global: string & import("effect/Brand").Brand<"Project.ID">;
237
+ };
238
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
239
+ readonly previous: Schema.brand<Schema.String, "Project.ID"> & {
240
+ global: string & import("effect/Brand").Brand<"Project.ID">;
241
+ };
242
+ }>;
243
+ }];
244
+ };
245
+ export declare function adopt(session: {
246
+ readonly projectID: string;
247
+ readonly directory: string;
248
+ }, event: {
249
+ readonly projectID: string;
250
+ readonly directory: string;
251
+ readonly previous: string;
252
+ }): {
253
+ projectID: string;
254
+ subpath: string | undefined;
255
+ } | undefined;
@@ -0,0 +1,61 @@
1
+ export * as Worktree from "./worktree.js";
2
+ import { Schema } from "effect";
3
+ import { durable, ephemeral, inventory } from "./event.js";
4
+ import { ProjectID } from "./project-id.js";
5
+ import { AbsolutePath, optional } from "./schema.js";
6
+ import { Project } from "./project.js";
7
+ export const StrategyID = Schema.Trim.pipe(Schema.check(Schema.isNonEmpty()), Schema.brand("Worktree.StrategyID"));
8
+ export const CreateInput = Schema.Struct({
9
+ projectID: ProjectID,
10
+ strategy: StrategyID,
11
+ from: optional(AbsolutePath),
12
+ directory: AbsolutePath,
13
+ name: optional(Schema.String),
14
+ }).annotate({ identifier: "Worktree.CreateInput" });
15
+ export const RemoveInput = Schema.Struct({
16
+ projectID: ProjectID,
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 ListInput = Schema.Struct({
28
+ projectID: ProjectID,
29
+ }).annotate({ identifier: "Worktree.ListInput" });
30
+ export const List = Schema.Array(Directory).annotate({ identifier: "Worktree.List" });
31
+ const Updated = ephemeral({
32
+ type: "worktree.updated",
33
+ schema: { projectID: Project.ID },
34
+ });
35
+ const Resolved = durable({
36
+ type: "worktree.resolved",
37
+ durable: { aggregate: "projectID", version: 1 },
38
+ schema: {
39
+ projectID: Project.ID,
40
+ directory: AbsolutePath,
41
+ previous: Project.ID,
42
+ },
43
+ });
44
+ export const Event = { Updated, Resolved, Definitions: inventory(Updated, Resolved) };
45
+ export function adopt(session, event) {
46
+ if (session.projectID !== event.previous && session.projectID !== Project.ID.global)
47
+ return;
48
+ if (session.projectID === event.projectID)
49
+ return;
50
+ const inside = session.directory === event.directory ||
51
+ session.directory.startsWith(event.directory + "/") ||
52
+ session.directory.startsWith(event.directory + "\\");
53
+ if (!inside)
54
+ return;
55
+ return {
56
+ projectID: event.projectID,
57
+ subpath: session.directory === event.directory
58
+ ? undefined
59
+ : session.directory.slice(event.directory.length + 1).replaceAll("\\", "/"),
60
+ };
61
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@opencode-ai/schema",
4
- "version": "0.0.0-next-17403",
4
+ "version": "0.0.0-next-17430",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -1,29 +0,0 @@
1
- export * as ProjectCopy from "./project-copy.js";
2
- import { Schema } from "effect";
3
- export declare const StrategyID: Schema.brand<Schema.Trim, "ProjectCopy.StrategyID">;
4
- export type StrategyID = typeof StrategyID.Type;
5
- export declare const CreateInput: Schema.Struct<{
6
- readonly projectID: Schema.brand<Schema.String, "Project.ID"> & {
7
- global: string & import("effect/Brand").Brand<"Project.ID">;
8
- };
9
- readonly strategy: Schema.brand<Schema.Trim, "ProjectCopy.StrategyID">;
10
- readonly sourceDirectory: Schema.brand<Schema.String, "AbsolutePath">;
11
- readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
12
- readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
13
- }>;
14
- export interface CreateInput extends Schema.Schema.Type<typeof CreateInput> {
15
- }
16
- export declare const RemoveInput: Schema.Struct<{
17
- readonly projectID: Schema.brand<Schema.String, "Project.ID"> & {
18
- global: string & import("effect/Brand").Brand<"Project.ID">;
19
- };
20
- readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
21
- readonly force: Schema.Boolean;
22
- }>;
23
- export interface RemoveInput extends Schema.Schema.Type<typeof RemoveInput> {
24
- }
25
- export declare const Copy: Schema.Struct<{
26
- readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
27
- }>;
28
- export interface Copy extends Schema.Schema.Type<typeof Copy> {
29
- }
@@ -1,21 +0,0 @@
1
- export * as ProjectCopy from "./project-copy.js";
2
- import { Schema } from "effect";
3
- import { optional } from "./schema.js";
4
- import { ProjectID } from "./project-id.js";
5
- import { AbsolutePath } from "./schema.js";
6
- export const StrategyID = Schema.Trim.pipe(Schema.check(Schema.isNonEmpty()), Schema.brand("ProjectCopy.StrategyID"));
7
- export const CreateInput = Schema.Struct({
8
- projectID: ProjectID,
9
- strategy: StrategyID,
10
- sourceDirectory: AbsolutePath,
11
- directory: AbsolutePath,
12
- name: optional(Schema.String),
13
- }).annotate({ identifier: "ProjectCopy.CreateInput" });
14
- export const RemoveInput = Schema.Struct({
15
- projectID: ProjectID,
16
- directory: AbsolutePath,
17
- force: Schema.Boolean,
18
- }).annotate({ identifier: "ProjectCopy.RemoveInput" });
19
- export const Copy = Schema.Struct({
20
- directory: AbsolutePath,
21
- }).annotate({ identifier: "ProjectCopy.Copy" });
@@ -1,215 +0,0 @@
1
- export * as ProjectDirectories from "./project-directories.js";
2
- export declare const Event: {
3
- Updated: import("effect/Schema").Struct<{
4
- readonly id: import("effect/Schema").brand<import("effect/Schema").String, "Event.ID"> & {
5
- create: () => string & import("effect/Brand").Brand<"Event.ID">;
6
- };
7
- readonly created: import("effect/Schema").decodeTo<import("effect/Schema").DateTimeUtc, import("effect/Schema").Finite, never, never>;
8
- readonly metadata: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Unknown>>>, import("effect/Schema").optionalKey<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Unknown>>, never, never>;
9
- readonly type: import("effect/Schema").Literal<"project.directories.updated">;
10
- readonly location: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Struct<{
11
- readonly directory: import("effect/Schema").brand<import("effect/Schema").String, "AbsolutePath">;
12
- readonly workspaceID: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
13
- ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
14
- create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
15
- }>>, import("effect/Schema").optionalKey<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
16
- ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
17
- create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
18
- }>, never, never>;
19
- }>>>, import("effect/Schema").optionalKey<import("effect/Schema").Struct<{
20
- readonly directory: import("effect/Schema").brand<import("effect/Schema").String, "AbsolutePath">;
21
- readonly workspaceID: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
22
- ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
23
- create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
24
- }>>, import("effect/Schema").optionalKey<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
25
- ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
26
- create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
27
- }>, never, never>;
28
- }>>, never, never>;
29
- readonly data: import("effect/Schema").Struct<{
30
- readonly projectID: import("effect/Schema").brand<import("effect/Schema").String, "Project.ID"> & {
31
- global: string & import("effect/Brand").Brand<"Project.ID">;
32
- };
33
- }>;
34
- }> & {
35
- type: "project.directories.updated";
36
- durability: "ephemeral";
37
- durable: undefined;
38
- data: import("effect/Schema").Struct<{
39
- readonly projectID: import("effect/Schema").brand<import("effect/Schema").String, "Project.ID"> & {
40
- global: string & import("effect/Brand").Brand<"Project.ID">;
41
- };
42
- }>;
43
- };
44
- Resolved: import("effect/Schema").Struct<{
45
- readonly id: import("effect/Schema").brand<import("effect/Schema").String, "Event.ID"> & {
46
- create: () => string & import("effect/Brand").Brand<"Event.ID">;
47
- };
48
- readonly created: import("effect/Schema").decodeTo<import("effect/Schema").DateTimeUtc, import("effect/Schema").Finite, never, never>;
49
- readonly metadata: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Unknown>>>, import("effect/Schema").optionalKey<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Unknown>>, never, never>;
50
- readonly type: import("effect/Schema").Literal<"project.directory.resolved">;
51
- readonly durable: import("effect/Schema").Struct<{
52
- readonly aggregateID: import("effect/Schema").String;
53
- readonly seq: import("effect/Schema").brand<import("effect/Schema").Int, "Event.Seq">;
54
- readonly version: import("effect/Schema").decodeTo<import("effect/Schema").toType<import("effect/Schema").brand<import("effect/Schema").Int, "Event.Version">>, import("effect/Schema").Literal<number>, never, never>;
55
- }>;
56
- readonly location: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Struct<{
57
- readonly directory: import("effect/Schema").brand<import("effect/Schema").String, "AbsolutePath">;
58
- readonly workspaceID: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").brand<import("effect/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
- }>>, import("effect/Schema").optionalKey<import("effect/Schema").brand<import("effect/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
- }>>>, import("effect/Schema").optionalKey<import("effect/Schema").Struct<{
66
- readonly directory: import("effect/Schema").brand<import("effect/Schema").String, "AbsolutePath">;
67
- readonly workspaceID: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").brand<import("effect/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
- }>>, import("effect/Schema").optionalKey<import("effect/Schema").brand<import("effect/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: import("effect/Schema").Struct<{
76
- readonly projectID: import("effect/Schema").brand<import("effect/Schema").String, "Project.ID"> & {
77
- global: string & import("effect/Brand").Brand<"Project.ID">;
78
- };
79
- readonly directory: import("effect/Schema").brand<import("effect/Schema").String, "AbsolutePath">;
80
- readonly previous: import("effect/Schema").brand<import("effect/Schema").String, "Project.ID"> & {
81
- global: string & import("effect/Brand").Brand<"Project.ID">;
82
- };
83
- }>;
84
- }> & {
85
- type: "project.directory.resolved";
86
- durability: "durable";
87
- durable: {
88
- readonly version: number;
89
- readonly aggregate: string;
90
- };
91
- data: import("effect/Schema").Struct<{
92
- readonly projectID: import("effect/Schema").brand<import("effect/Schema").String, "Project.ID"> & {
93
- global: string & import("effect/Brand").Brand<"Project.ID">;
94
- };
95
- readonly directory: import("effect/Schema").brand<import("effect/Schema").String, "AbsolutePath">;
96
- readonly previous: import("effect/Schema").brand<import("effect/Schema").String, "Project.ID"> & {
97
- global: string & import("effect/Brand").Brand<"Project.ID">;
98
- };
99
- }>;
100
- };
101
- Definitions: readonly [import("effect/Schema").Struct<{
102
- readonly id: import("effect/Schema").brand<import("effect/Schema").String, "Event.ID"> & {
103
- create: () => string & import("effect/Brand").Brand<"Event.ID">;
104
- };
105
- readonly created: import("effect/Schema").decodeTo<import("effect/Schema").DateTimeUtc, import("effect/Schema").Finite, never, never>;
106
- readonly metadata: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Unknown>>>, import("effect/Schema").optionalKey<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Unknown>>, never, never>;
107
- readonly type: import("effect/Schema").Literal<"project.directories.updated">;
108
- readonly location: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Struct<{
109
- readonly directory: import("effect/Schema").brand<import("effect/Schema").String, "AbsolutePath">;
110
- readonly workspaceID: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
111
- ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
112
- create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
113
- }>>, import("effect/Schema").optionalKey<import("effect/Schema").brand<import("effect/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
- }>, never, never>;
117
- }>>>, import("effect/Schema").optionalKey<import("effect/Schema").Struct<{
118
- readonly directory: import("effect/Schema").brand<import("effect/Schema").String, "AbsolutePath">;
119
- readonly workspaceID: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
120
- ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
121
- create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
122
- }>>, import("effect/Schema").optionalKey<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
123
- ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
124
- create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
125
- }>, never, never>;
126
- }>>, never, never>;
127
- readonly data: import("effect/Schema").Struct<{
128
- readonly projectID: import("effect/Schema").brand<import("effect/Schema").String, "Project.ID"> & {
129
- global: string & import("effect/Brand").Brand<"Project.ID">;
130
- };
131
- }>;
132
- }> & {
133
- type: "project.directories.updated";
134
- durability: "ephemeral";
135
- durable: undefined;
136
- data: import("effect/Schema").Struct<{
137
- readonly projectID: import("effect/Schema").brand<import("effect/Schema").String, "Project.ID"> & {
138
- global: string & import("effect/Brand").Brand<"Project.ID">;
139
- };
140
- }>;
141
- }, import("effect/Schema").Struct<{
142
- readonly id: import("effect/Schema").brand<import("effect/Schema").String, "Event.ID"> & {
143
- create: () => string & import("effect/Brand").Brand<"Event.ID">;
144
- };
145
- readonly created: import("effect/Schema").decodeTo<import("effect/Schema").DateTimeUtc, import("effect/Schema").Finite, never, never>;
146
- readonly metadata: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Unknown>>>, import("effect/Schema").optionalKey<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Unknown>>, never, never>;
147
- readonly type: import("effect/Schema").Literal<"project.directory.resolved">;
148
- readonly durable: import("effect/Schema").Struct<{
149
- readonly aggregateID: import("effect/Schema").String;
150
- readonly seq: import("effect/Schema").brand<import("effect/Schema").Int, "Event.Seq">;
151
- readonly version: import("effect/Schema").decodeTo<import("effect/Schema").toType<import("effect/Schema").brand<import("effect/Schema").Int, "Event.Version">>, import("effect/Schema").Literal<number>, never, never>;
152
- }>;
153
- readonly location: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Struct<{
154
- readonly directory: import("effect/Schema").brand<import("effect/Schema").String, "AbsolutePath">;
155
- readonly workspaceID: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
156
- ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
157
- create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
158
- }>>, import("effect/Schema").optionalKey<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
159
- ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
160
- create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
161
- }>, never, never>;
162
- }>>>, import("effect/Schema").optionalKey<import("effect/Schema").Struct<{
163
- readonly directory: import("effect/Schema").brand<import("effect/Schema").String, "AbsolutePath">;
164
- readonly workspaceID: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
165
- ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
166
- create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
167
- }>>, import("effect/Schema").optionalKey<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
168
- ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
169
- create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
170
- }>, never, never>;
171
- }>>, never, never>;
172
- readonly data: import("effect/Schema").Struct<{
173
- readonly projectID: import("effect/Schema").brand<import("effect/Schema").String, "Project.ID"> & {
174
- global: string & import("effect/Brand").Brand<"Project.ID">;
175
- };
176
- readonly directory: import("effect/Schema").brand<import("effect/Schema").String, "AbsolutePath">;
177
- readonly previous: import("effect/Schema").brand<import("effect/Schema").String, "Project.ID"> & {
178
- global: string & import("effect/Brand").Brand<"Project.ID">;
179
- };
180
- }>;
181
- }> & {
182
- type: "project.directory.resolved";
183
- durability: "durable";
184
- durable: {
185
- readonly version: number;
186
- readonly aggregate: string;
187
- };
188
- data: import("effect/Schema").Struct<{
189
- readonly projectID: import("effect/Schema").brand<import("effect/Schema").String, "Project.ID"> & {
190
- global: string & import("effect/Brand").Brand<"Project.ID">;
191
- };
192
- readonly directory: import("effect/Schema").brand<import("effect/Schema").String, "AbsolutePath">;
193
- readonly previous: import("effect/Schema").brand<import("effect/Schema").String, "Project.ID"> & {
194
- global: string & import("effect/Brand").Brand<"Project.ID">;
195
- };
196
- }>;
197
- }];
198
- };
199
- /**
200
- * Client-side mirror of the server's `project.directory.resolved` session fold.
201
- * Returns the ownership update for a cached session, or undefined when the
202
- * session does not follow the resolution. Plain strings: callers hold
203
- * generated client types, and the server projection remains authoritative.
204
- */
205
- export declare function adopt(session: {
206
- readonly projectID: string;
207
- readonly directory: string;
208
- }, event: {
209
- readonly projectID: string;
210
- readonly directory: string;
211
- readonly previous: string;
212
- }): {
213
- projectID: string;
214
- subpath: string | undefined;
215
- } | undefined;
@@ -1,47 +0,0 @@
1
- export * as ProjectDirectories from "./project-directories.js";
2
- import { durable, ephemeral, inventory } from "./event.js";
3
- import { AbsolutePath } from "./schema.js";
4
- import { Project } from "./project.js";
5
- const Updated = ephemeral({
6
- type: "project.directories.updated",
7
- schema: { projectID: Project.ID },
8
- });
9
- /**
10
- * A directory's resolution changed: it now resolves to `projectID` where it
11
- * previously resolved to `previous` (`global` when the directory had no
12
- * stable identity yet, e.g. before `git init`). Sessions whose ownership
13
- * came from the previous resolution follow the new identity by projection.
14
- */
15
- const Resolved = durable({
16
- type: "project.directory.resolved",
17
- durable: { aggregate: "projectID", version: 1 },
18
- schema: {
19
- projectID: Project.ID,
20
- directory: AbsolutePath,
21
- previous: Project.ID,
22
- },
23
- });
24
- export const Event = { Updated, Resolved, Definitions: inventory(Updated, Resolved) };
25
- /**
26
- * Client-side mirror of the server's `project.directory.resolved` session fold.
27
- * Returns the ownership update for a cached session, or undefined when the
28
- * session does not follow the resolution. Plain strings: callers hold
29
- * generated client types, and the server projection remains authoritative.
30
- */
31
- export function adopt(session, event) {
32
- if (session.projectID !== event.previous && session.projectID !== Project.ID.global)
33
- return;
34
- if (session.projectID === event.projectID)
35
- return;
36
- const inside = session.directory === event.directory ||
37
- session.directory.startsWith(event.directory + "/") ||
38
- session.directory.startsWith(event.directory + "\\");
39
- if (!inside)
40
- return;
41
- return {
42
- projectID: event.projectID,
43
- subpath: session.directory === event.directory
44
- ? undefined
45
- : session.directory.slice(event.directory.length + 1).replaceAll("\\", "/"),
46
- };
47
- }