@opencode-ai/schema 0.0.0-next-14798 → 0.0.0-next-14801

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.
Files changed (75) hide show
  1. package/dist/agent.d.ts +6 -28
  2. package/dist/agent.js +2 -2
  3. package/dist/catalog.d.ts +6 -28
  4. package/dist/catalog.js +2 -2
  5. package/dist/command.d.ts +6 -28
  6. package/dist/command.js +2 -2
  7. package/dist/durable-event-manifest.d.ts +254 -8301
  8. package/dist/durable-event-manifest.js +2 -5
  9. package/dist/event-manifest.d.ts +994 -2747
  10. package/dist/event-manifest.js +2 -2
  11. package/dist/event.d.ts +65 -19
  12. package/dist/event.js +24 -5
  13. package/dist/filesystem-watcher.d.ts +6 -28
  14. package/dist/filesystem-watcher.js +2 -2
  15. package/dist/filesystem.d.ts +6 -28
  16. package/dist/filesystem.js +2 -2
  17. package/dist/form.d.ts +18 -84
  18. package/dist/form.js +4 -4
  19. package/dist/ide-event.d.ts +6 -28
  20. package/dist/ide-event.js +1 -1
  21. package/dist/installation-event.d.ts +12 -56
  22. package/dist/installation-event.js +2 -2
  23. package/dist/integration.d.ts +12 -56
  24. package/dist/integration.js +3 -3
  25. package/dist/lsp-event.d.ts +6 -28
  26. package/dist/lsp-event.js +1 -1
  27. package/dist/mcp-event.d.ts +18 -84
  28. package/dist/mcp-event.js +3 -3
  29. package/dist/models-dev.d.ts +6 -28
  30. package/dist/models-dev.js +2 -2
  31. package/dist/permission.d.ts +12 -56
  32. package/dist/permission.js +3 -3
  33. package/dist/plugin.d.ts +6 -28
  34. package/dist/plugin.js +2 -2
  35. package/dist/project-directories.d.ts +6 -28
  36. package/dist/project-directories.js +2 -2
  37. package/dist/project.d.ts +6 -28
  38. package/dist/project.js +2 -2
  39. package/dist/pty.d.ts +24 -112
  40. package/dist/pty.js +5 -5
  41. package/dist/question.d.ts +18 -84
  42. package/dist/question.js +4 -4
  43. package/dist/reference.d.ts +6 -28
  44. package/dist/reference.js +2 -2
  45. package/dist/server-event.d.ts +12 -56
  46. package/dist/server-event.js +2 -2
  47. package/dist/session-compaction-event.d.ts +6 -28
  48. package/dist/session-compaction-event.js +1 -1
  49. package/dist/session-event.d.ts +1900 -2530
  50. package/dist/session-event.js +37 -37
  51. package/dist/session-status-event.d.ts +12 -56
  52. package/dist/session-status-event.js +2 -2
  53. package/dist/session-todo.d.ts +6 -28
  54. package/dist/session-todo.js +2 -2
  55. package/dist/shell.d.ts +18 -84
  56. package/dist/shell.js +4 -4
  57. package/dist/skill.d.ts +6 -28
  58. package/dist/skill.js +2 -2
  59. package/dist/tui-event.d.ts +24 -112
  60. package/dist/tui-event.js +4 -4
  61. package/dist/v1/legacy-event.d.ts +6 -28
  62. package/dist/v1/legacy-event.js +2 -2
  63. package/dist/v1/permission.d.ts +12 -56
  64. package/dist/v1/permission.js +3 -3
  65. package/dist/v1/question.d.ts +18 -84
  66. package/dist/v1/question.js +4 -4
  67. package/dist/v1/session.d.ts +139 -280
  68. package/dist/v1/session.js +11 -11
  69. package/dist/vcs-event.d.ts +6 -28
  70. package/dist/vcs-event.js +1 -1
  71. package/dist/workspace-event.d.ts +18 -84
  72. package/dist/workspace-event.js +3 -3
  73. package/dist/worktree-event.d.ts +12 -56
  74. package/dist/worktree-event.js +2 -2
  75. package/package.json +1 -1
@@ -34,8 +34,8 @@ import { TuiEvent } from "./tui-event.js";
34
34
  import { VcsEvent } from "./vcs-event.js";
35
35
  import { WorkspaceEvent } from "./workspace-event.js";
36
36
  import { WorktreeEvent } from "./worktree-event.js";
37
- const sessionV1DurableDefinitions = SessionV1.Event.Definitions.filter((definition) => definition.durable !== undefined);
38
- const sessionV1LiveDefinitions = SessionV1.Event.Definitions.filter((definition) => definition.durable === undefined);
37
+ const sessionV1DurableDefinitions = SessionV1.Event.Definitions.filter((definition) => definition.durability === "durable");
38
+ const sessionV1LiveDefinitions = SessionV1.Event.Definitions.filter((definition) => definition.durability === "ephemeral");
39
39
  const coreDefinitions = Event.inventory(...sessionV1DurableDefinitions, ...SessionEvent.Definitions);
40
40
  const foundationDefinitions = Event.inventory(...ModelsDev.Event.Definitions, ...Integration.Event.Definitions, ...Catalog.Event.Definitions, ...Agent.Event.Definitions, ...coreDefinitions);
41
41
  const featureDefinitions = Event.inventory(...FileSystem.Event.Definitions, ...Reference.Event.Definitions, ...Permission.Event.Definitions, ...Plugin.Event.Definitions, ...ProjectDirectories.Event.Definitions, ...Command.Event.Definitions, ...Skill.Event.Definitions, ...FileSystemWatcher.Event.Definitions, ...Pty.Event.Definitions, ...Shell.Event.Definitions, ...Question.Event.Definitions, ...Form.Event.Definitions);
package/dist/event.d.ts CHANGED
@@ -15,49 +15,62 @@ export type Seq = typeof Seq.Type;
15
15
  /** Durable schema version of one event type, from the event definition that committed it. */
16
16
  export declare const Version: Schema.brand<Schema.Int, "Event.Version">;
17
17
  export type Version = typeof Version.Type;
18
- export type Definition<Type extends string = string, DataSchema extends Schema.Codec<unknown, unknown> = Schema.Codec<unknown, unknown>> = Schema.Top & {
18
+ declare const DurableEnvelope: Schema.Struct<{
19
+ readonly aggregateID: Schema.String;
20
+ readonly seq: Schema.brand<Schema.Int, "Event.Seq">;
21
+ readonly version: Schema.brand<Schema.Int, "Event.Version">;
22
+ }>;
23
+ export type DurableEnvelope = typeof DurableEnvelope.Type;
24
+ export type DurableDefinition<Type extends string = string, DataSchema extends Schema.Codec<unknown, unknown> = Schema.Codec<unknown, unknown>> = Schema.Top & {
19
25
  readonly type: Type;
20
- readonly durable?: {
26
+ readonly durability: "durable";
27
+ readonly durable: {
21
28
  readonly version: number;
22
29
  readonly aggregate: string;
23
30
  };
24
31
  readonly data: DataSchema;
25
32
  };
33
+ export type EphemeralDefinition<Type extends string = string, DataSchema extends Schema.Codec<unknown, unknown> = Schema.Codec<unknown, unknown>> = Schema.Top & {
34
+ readonly type: Type;
35
+ readonly durability: "ephemeral";
36
+ readonly durable?: never;
37
+ readonly data: DataSchema;
38
+ };
39
+ export type Definition<Type extends string = string, DataSchema extends Schema.Codec<unknown, unknown> = Schema.Codec<unknown, unknown>> = DurableDefinition<Type, DataSchema> | EphemeralDefinition<Type, DataSchema>;
26
40
  export type Data<D extends Definition> = Schema.Schema.Type<D["data"]>;
27
- export type Payload<D extends Definition = Definition> = {
41
+ type PayloadBase<D extends Definition> = {
28
42
  readonly id: ID;
29
43
  readonly type: D["type"];
30
44
  readonly data: Data<D>;
31
- readonly durable?: {
32
- readonly aggregateID: string;
33
- readonly seq: Seq;
34
- readonly version: Version;
35
- };
36
45
  readonly location?: Location.Ref;
37
46
  readonly metadata?: Record<string, unknown>;
38
47
  };
39
- export declare function define<const Type extends string, const Fields extends Readonly<Record<PropertyKey, Schema.Codec<unknown, unknown>>>>(input: {
48
+ export type Payload<D extends Definition = Definition> = D extends DurableDefinition ? PayloadBase<D> & {
49
+ readonly durable: DurableEnvelope;
50
+ } : PayloadBase<D> & {
51
+ readonly durable?: never;
52
+ };
53
+ type Input<Type extends string, Fields extends Readonly<Record<PropertyKey, Schema.Codec<unknown, unknown>>>> = {
40
54
  readonly type: Type;
41
55
  readonly durable?: {
42
56
  readonly version: number;
43
57
  readonly aggregate: string;
44
58
  };
45
59
  readonly schema: Fields;
60
+ };
61
+ export declare function durable<const Type extends string, const Fields extends Readonly<Record<PropertyKey, Schema.Codec<unknown, unknown>>>>(input: Input<Type, Fields> & {
62
+ readonly durable: NonNullable<Input<Type, Fields>["durable"]>;
46
63
  }): Schema.Struct<{
47
64
  readonly id: Schema.brand<Schema.String, "Event.ID"> & {
48
65
  create: () => string & import("effect/Brand").Brand<"Event.ID">;
49
66
  };
50
67
  readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
51
68
  readonly type: Schema.Literal<Type>;
52
- readonly durable: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
53
- readonly aggregateID: Schema.String;
54
- readonly seq: Schema.brand<Schema.Int, "Event.Seq">;
55
- readonly version: Schema.brand<Schema.Int, "Event.Version">;
56
- }>>>, Schema.optionalKey<Schema.Struct<{
69
+ readonly durable: Schema.Struct<{
57
70
  readonly aggregateID: Schema.String;
58
71
  readonly seq: Schema.brand<Schema.Int, "Event.Seq">;
59
72
  readonly version: Schema.brand<Schema.Int, "Event.Version">;
60
- }>>, never, never>;
73
+ }>;
61
74
  readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
62
75
  readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
63
76
  readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "WorkspaceV2.ID"> & {
@@ -79,14 +92,47 @@ export declare function define<const Type extends string, const Fields extends R
79
92
  }>>, never, never>;
80
93
  readonly data: Schema.Struct<Fields>;
81
94
  }> & {
82
- data: Schema.Struct<Fields>;
83
- durable?: {
95
+ type: Type;
96
+ durability: "durable";
97
+ durable: {
84
98
  readonly version: number;
85
99
  readonly aggregate: string;
86
- } | undefined;
100
+ };
101
+ data: Schema.Struct<Fields>;
102
+ };
103
+ export declare function ephemeral<const Type extends string, const Fields extends Readonly<Record<PropertyKey, Schema.Codec<unknown, unknown>>>>(input: Omit<Input<Type, Fields>, "durable">): Schema.Struct<{
104
+ readonly id: Schema.brand<Schema.String, "Event.ID"> & {
105
+ create: () => string & import("effect/Brand").Brand<"Event.ID">;
106
+ };
107
+ readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
108
+ readonly type: Schema.Literal<Type>;
109
+ readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
110
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
111
+ readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "WorkspaceV2.ID"> & {
112
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"WorkspaceV2.ID">;
113
+ create: () => string & import("effect/Brand").Brand<"WorkspaceV2.ID">;
114
+ }>>, Schema.optionalKey<Schema.brand<Schema.String, "WorkspaceV2.ID"> & {
115
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"WorkspaceV2.ID">;
116
+ create: () => string & import("effect/Brand").Brand<"WorkspaceV2.ID">;
117
+ }>, never, never>;
118
+ }>>>, Schema.optionalKey<Schema.Struct<{
119
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
120
+ readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "WorkspaceV2.ID"> & {
121
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"WorkspaceV2.ID">;
122
+ create: () => string & import("effect/Brand").Brand<"WorkspaceV2.ID">;
123
+ }>>, Schema.optionalKey<Schema.brand<Schema.String, "WorkspaceV2.ID"> & {
124
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"WorkspaceV2.ID">;
125
+ create: () => string & import("effect/Brand").Brand<"WorkspaceV2.ID">;
126
+ }>, never, never>;
127
+ }>>, never, never>;
128
+ readonly data: Schema.Struct<Fields>;
129
+ }> & {
87
130
  type: Type;
131
+ durability: "ephemeral";
132
+ durable: undefined;
133
+ data: Schema.Struct<Fields>;
88
134
  };
89
135
  export declare function inventory<const Definitions extends ReadonlyArray<Definition>>(...definitions: Definitions): Readonly<Definitions>;
90
136
  export declare function latest(definitions: ReadonlyArray<Definition>): ReadonlyMap<string, Definition<string, Schema.Codec<unknown, unknown, never, never>>>;
91
137
  export declare function versionedType(type: string, version: number): string;
92
- export declare function durable<const Definitions extends ReadonlyArray<Definition>>(definitions: Definitions): ReadonlyMap<string, Definitions[number]>;
138
+ export declare function durableMap<const Definitions extends ReadonlyArray<Definition>>(definitions: Definitions): ReadonlyMap<string, DurableDefinition<string, Schema.Codec<unknown, unknown, never, never>>>;
package/dist/event.js CHANGED
@@ -13,20 +13,39 @@ export const ID = Schema.String.check(Schema.isStartsWith("evt_")).pipe(Schema.b
13
13
  export const Seq = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)).pipe(Schema.brand("Event.Seq"));
14
14
  /** Durable schema version of one event type, from the event definition that committed it. */
15
15
  export const Version = Schema.Int.check(Schema.isGreaterThanOrEqualTo(1)).pipe(Schema.brand("Event.Version"));
16
- export function define(input) {
16
+ const DurableEnvelope = Schema.Struct({ aggregateID: Schema.String, seq: Seq, version: Version });
17
+ export function durable(input) {
17
18
  const data = Schema.Struct(input.schema);
18
19
  return Schema.Struct({
19
20
  id: ID,
20
21
  metadata: optional(Schema.Record(Schema.String, Schema.Unknown)),
21
22
  type: Schema.Literal(input.type),
22
- durable: optional(Schema.Struct({ aggregateID: Schema.String, seq: Seq, version: Version })),
23
+ durable: DurableEnvelope,
23
24
  location: optional(Location.Ref),
24
25
  data,
25
26
  })
26
27
  .annotate({ identifier: input.type })
27
28
  .pipe(statics(() => ({
28
29
  type: input.type,
29
- ...(input.durable === undefined ? {} : { durable: input.durable }),
30
+ durability: "durable",
31
+ durable: input.durable,
32
+ data,
33
+ })));
34
+ }
35
+ export function ephemeral(input) {
36
+ const data = Schema.Struct(input.schema);
37
+ return Schema.Struct({
38
+ id: ID,
39
+ metadata: optional(Schema.Record(Schema.String, Schema.Unknown)),
40
+ type: Schema.Literal(input.type),
41
+ location: optional(Location.Ref),
42
+ data,
43
+ })
44
+ .annotate({ identifier: input.type })
45
+ .pipe(statics(() => ({
46
+ type: input.type,
47
+ durability: "ephemeral",
48
+ durable: undefined,
30
49
  data,
31
50
  })));
32
51
  }
@@ -53,9 +72,9 @@ export function latest(definitions) {
53
72
  export function versionedType(type, version) {
54
73
  return `${type}.${version}`;
55
74
  }
56
- export function durable(definitions) {
75
+ export function durableMap(definitions) {
57
76
  return readonlyMap(definitions.reduce((result, definition) => {
58
- if (!definition.durable)
77
+ if (definition.durability !== "durable")
59
78
  return result;
60
79
  const key = versionedType(definition.type, definition.durable.version);
61
80
  if (result.has(key))
@@ -7,15 +7,6 @@ export declare const Event: {
7
7
  };
8
8
  readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
9
9
  readonly type: Schema.Literal<"file.watcher.updated">;
10
- readonly durable: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
11
- readonly aggregateID: Schema.String;
12
- readonly seq: Schema.brand<Schema.Int, "Event.Seq">;
13
- readonly version: Schema.brand<Schema.Int, "Event.Version">;
14
- }>>>, Schema.optionalKey<Schema.Struct<{
15
- readonly aggregateID: Schema.String;
16
- readonly seq: Schema.brand<Schema.Int, "Event.Seq">;
17
- readonly version: Schema.brand<Schema.Int, "Event.Version">;
18
- }>>, never, never>;
19
10
  readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
20
11
  readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
21
12
  readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "WorkspaceV2.ID"> & {
@@ -40,15 +31,13 @@ export declare const Event: {
40
31
  readonly event: Schema.Literals<readonly ["add", "change", "unlink"]>;
41
32
  }>;
42
33
  }> & {
34
+ type: "file.watcher.updated";
35
+ durability: "ephemeral";
36
+ durable: undefined;
43
37
  data: Schema.Struct<{
44
38
  readonly file: Schema.String;
45
39
  readonly event: Schema.Literals<readonly ["add", "change", "unlink"]>;
46
40
  }>;
47
- durable?: {
48
- readonly version: number;
49
- readonly aggregate: string;
50
- } | undefined;
51
- type: "file.watcher.updated";
52
41
  };
53
42
  Definitions: readonly [Schema.Struct<{
54
43
  readonly id: Schema.brand<Schema.String, "Event.ID"> & {
@@ -56,15 +45,6 @@ export declare const Event: {
56
45
  };
57
46
  readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
58
47
  readonly type: Schema.Literal<"file.watcher.updated">;
59
- readonly durable: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
60
- readonly aggregateID: Schema.String;
61
- readonly seq: Schema.brand<Schema.Int, "Event.Seq">;
62
- readonly version: Schema.brand<Schema.Int, "Event.Version">;
63
- }>>>, Schema.optionalKey<Schema.Struct<{
64
- readonly aggregateID: Schema.String;
65
- readonly seq: Schema.brand<Schema.Int, "Event.Seq">;
66
- readonly version: Schema.brand<Schema.Int, "Event.Version">;
67
- }>>, never, never>;
68
48
  readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
69
49
  readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
70
50
  readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "WorkspaceV2.ID"> & {
@@ -89,14 +69,12 @@ export declare const Event: {
89
69
  readonly event: Schema.Literals<readonly ["add", "change", "unlink"]>;
90
70
  }>;
91
71
  }> & {
72
+ type: "file.watcher.updated";
73
+ durability: "ephemeral";
74
+ durable: undefined;
92
75
  data: Schema.Struct<{
93
76
  readonly file: Schema.String;
94
77
  readonly event: Schema.Literals<readonly ["add", "change", "unlink"]>;
95
78
  }>;
96
- durable?: {
97
- readonly version: number;
98
- readonly aggregate: string;
99
- } | undefined;
100
- type: "file.watcher.updated";
101
79
  }];
102
80
  };
@@ -1,7 +1,7 @@
1
1
  export * as FileSystemWatcher from "./filesystem-watcher.js";
2
2
  import { Schema } from "effect";
3
- import { define, inventory } from "./event.js";
4
- const Updated = define({
3
+ import { ephemeral, inventory } from "./event.js";
4
+ const Updated = ephemeral({
5
5
  type: "file.watcher.updated",
6
6
  schema: {
7
7
  file: Schema.String,
@@ -7,15 +7,6 @@ export declare const Event: {
7
7
  };
8
8
  readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
9
9
  readonly type: Schema.Literal<"file.edited">;
10
- readonly durable: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
11
- readonly aggregateID: Schema.String;
12
- readonly seq: Schema.brand<Schema.Int, "Event.Seq">;
13
- readonly version: Schema.brand<Schema.Int, "Event.Version">;
14
- }>>>, Schema.optionalKey<Schema.Struct<{
15
- readonly aggregateID: Schema.String;
16
- readonly seq: Schema.brand<Schema.Int, "Event.Seq">;
17
- readonly version: Schema.brand<Schema.Int, "Event.Version">;
18
- }>>, never, never>;
19
10
  readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
20
11
  readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
21
12
  readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "WorkspaceV2.ID"> & {
@@ -39,14 +30,12 @@ export declare const Event: {
39
30
  readonly file: Schema.String;
40
31
  }>;
41
32
  }> & {
33
+ type: "file.edited";
34
+ durability: "ephemeral";
35
+ durable: undefined;
42
36
  data: Schema.Struct<{
43
37
  readonly file: Schema.String;
44
38
  }>;
45
- durable?: {
46
- readonly version: number;
47
- readonly aggregate: string;
48
- } | undefined;
49
- type: "file.edited";
50
39
  };
51
40
  Definitions: readonly [Schema.Struct<{
52
41
  readonly id: Schema.brand<Schema.String, "Event.ID"> & {
@@ -54,15 +43,6 @@ export declare const Event: {
54
43
  };
55
44
  readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
56
45
  readonly type: Schema.Literal<"file.edited">;
57
- readonly durable: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
58
- readonly aggregateID: Schema.String;
59
- readonly seq: Schema.brand<Schema.Int, "Event.Seq">;
60
- readonly version: Schema.brand<Schema.Int, "Event.Version">;
61
- }>>>, Schema.optionalKey<Schema.Struct<{
62
- readonly aggregateID: Schema.String;
63
- readonly seq: Schema.brand<Schema.Int, "Event.Seq">;
64
- readonly version: Schema.brand<Schema.Int, "Event.Version">;
65
- }>>, never, never>;
66
46
  readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
67
47
  readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
68
48
  readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "WorkspaceV2.ID"> & {
@@ -86,14 +66,12 @@ export declare const Event: {
86
66
  readonly file: Schema.String;
87
67
  }>;
88
68
  }> & {
69
+ type: "file.edited";
70
+ durability: "ephemeral";
71
+ durable: undefined;
89
72
  data: Schema.Struct<{
90
73
  readonly file: Schema.String;
91
74
  }>;
92
- durable?: {
93
- readonly version: number;
94
- readonly aggregate: string;
95
- } | undefined;
96
- type: "file.edited";
97
75
  }];
98
76
  };
99
77
  export interface Entry extends Schema.Schema.Type<typeof Entry> {
@@ -1,9 +1,9 @@
1
1
  export * as FileSystem from "./filesystem.js";
2
2
  import { Schema } from "effect";
3
3
  import { optional } from "./schema.js";
4
- import { define, inventory } from "./event.js";
4
+ import { ephemeral, inventory } from "./event.js";
5
5
  import { NonNegativeInt, PositiveInt, RelativePath } from "./schema.js";
6
- const Edited = define({
6
+ const Edited = ephemeral({
7
7
  type: "file.edited",
8
8
  schema: { file: Schema.String },
9
9
  });
package/dist/form.d.ts CHANGED
@@ -534,15 +534,6 @@ export declare const Event: {
534
534
  };
535
535
  readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
536
536
  readonly type: Schema.Literal<"form.created">;
537
- readonly durable: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
538
- readonly aggregateID: Schema.String;
539
- readonly seq: Schema.brand<Schema.Int, "Event.Seq">;
540
- readonly version: Schema.brand<Schema.Int, "Event.Version">;
541
- }>>>, Schema.optionalKey<Schema.Struct<{
542
- readonly aggregateID: Schema.String;
543
- readonly seq: Schema.brand<Schema.Int, "Event.Seq">;
544
- readonly version: Schema.brand<Schema.Int, "Event.Version">;
545
- }>>, never, never>;
546
537
  readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
547
538
  readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
548
539
  readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "WorkspaceV2.ID"> & {
@@ -691,6 +682,9 @@ export declare const Event: {
691
682
  }>]>;
692
683
  }>;
693
684
  }> & {
685
+ type: "form.created";
686
+ durability: "ephemeral";
687
+ durable: undefined;
694
688
  data: Schema.Struct<{
695
689
  readonly form: Schema.toTaggedUnion<"mode", readonly [Schema.Struct<{
696
690
  readonly mode: Schema.Literal<"form">;
@@ -819,11 +813,6 @@ export declare const Event: {
819
813
  readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
820
814
  }>]>;
821
815
  }>;
822
- durable?: {
823
- readonly version: number;
824
- readonly aggregate: string;
825
- } | undefined;
826
- type: "form.created";
827
816
  };
828
817
  Replied: Schema.Struct<{
829
818
  readonly id: Schema.brand<Schema.String, "Event.ID"> & {
@@ -831,15 +820,6 @@ export declare const Event: {
831
820
  };
832
821
  readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
833
822
  readonly type: Schema.Literal<"form.replied">;
834
- readonly durable: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
835
- readonly aggregateID: Schema.String;
836
- readonly seq: Schema.brand<Schema.Int, "Event.Seq">;
837
- readonly version: Schema.brand<Schema.Int, "Event.Version">;
838
- }>>>, Schema.optionalKey<Schema.Struct<{
839
- readonly aggregateID: Schema.String;
840
- readonly seq: Schema.brand<Schema.Int, "Event.Seq">;
841
- readonly version: Schema.brand<Schema.Int, "Event.Version">;
842
- }>>, never, never>;
843
823
  readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
844
824
  readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
845
825
  readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "WorkspaceV2.ID"> & {
@@ -867,6 +847,9 @@ export declare const Event: {
867
847
  readonly answer: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean, Schema.$Array<Schema.String>]>>;
868
848
  }>;
869
849
  }> & {
850
+ type: "form.replied";
851
+ durability: "ephemeral";
852
+ durable: undefined;
870
853
  data: Schema.Struct<{
871
854
  readonly id: Schema.brand<Schema.String, "Form.ID"> & {
872
855
  create: (id?: string) => string & import("effect/Brand").Brand<"Form.ID">;
@@ -874,11 +857,6 @@ export declare const Event: {
874
857
  readonly sessionID: Schema.String;
875
858
  readonly answer: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean, Schema.$Array<Schema.String>]>>;
876
859
  }>;
877
- durable?: {
878
- readonly version: number;
879
- readonly aggregate: string;
880
- } | undefined;
881
- type: "form.replied";
882
860
  };
883
861
  Cancelled: Schema.Struct<{
884
862
  readonly id: Schema.brand<Schema.String, "Event.ID"> & {
@@ -886,15 +864,6 @@ export declare const Event: {
886
864
  };
887
865
  readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
888
866
  readonly type: Schema.Literal<"form.cancelled">;
889
- readonly durable: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
890
- readonly aggregateID: Schema.String;
891
- readonly seq: Schema.brand<Schema.Int, "Event.Seq">;
892
- readonly version: Schema.brand<Schema.Int, "Event.Version">;
893
- }>>>, Schema.optionalKey<Schema.Struct<{
894
- readonly aggregateID: Schema.String;
895
- readonly seq: Schema.brand<Schema.Int, "Event.Seq">;
896
- readonly version: Schema.brand<Schema.Int, "Event.Version">;
897
- }>>, never, never>;
898
867
  readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
899
868
  readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
900
869
  readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "WorkspaceV2.ID"> & {
@@ -921,17 +890,15 @@ export declare const Event: {
921
890
  readonly sessionID: Schema.String;
922
891
  }>;
923
892
  }> & {
893
+ type: "form.cancelled";
894
+ durability: "ephemeral";
895
+ durable: undefined;
924
896
  data: Schema.Struct<{
925
897
  readonly id: Schema.brand<Schema.String, "Form.ID"> & {
926
898
  create: (id?: string) => string & import("effect/Brand").Brand<"Form.ID">;
927
899
  };
928
900
  readonly sessionID: Schema.String;
929
901
  }>;
930
- durable?: {
931
- readonly version: number;
932
- readonly aggregate: string;
933
- } | undefined;
934
- type: "form.cancelled";
935
902
  };
936
903
  Definitions: readonly [Schema.Struct<{
937
904
  readonly id: Schema.brand<Schema.String, "Event.ID"> & {
@@ -939,15 +906,6 @@ export declare const Event: {
939
906
  };
940
907
  readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
941
908
  readonly type: Schema.Literal<"form.created">;
942
- readonly durable: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
943
- readonly aggregateID: Schema.String;
944
- readonly seq: Schema.brand<Schema.Int, "Event.Seq">;
945
- readonly version: Schema.brand<Schema.Int, "Event.Version">;
946
- }>>>, Schema.optionalKey<Schema.Struct<{
947
- readonly aggregateID: Schema.String;
948
- readonly seq: Schema.brand<Schema.Int, "Event.Seq">;
949
- readonly version: Schema.brand<Schema.Int, "Event.Version">;
950
- }>>, never, never>;
951
909
  readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
952
910
  readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
953
911
  readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "WorkspaceV2.ID"> & {
@@ -1096,6 +1054,9 @@ export declare const Event: {
1096
1054
  }>]>;
1097
1055
  }>;
1098
1056
  }> & {
1057
+ type: "form.created";
1058
+ durability: "ephemeral";
1059
+ durable: undefined;
1099
1060
  data: Schema.Struct<{
1100
1061
  readonly form: Schema.toTaggedUnion<"mode", readonly [Schema.Struct<{
1101
1062
  readonly mode: Schema.Literal<"form">;
@@ -1224,26 +1185,12 @@ export declare const Event: {
1224
1185
  readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
1225
1186
  }>]>;
1226
1187
  }>;
1227
- durable?: {
1228
- readonly version: number;
1229
- readonly aggregate: string;
1230
- } | undefined;
1231
- type: "form.created";
1232
1188
  }, Schema.Struct<{
1233
1189
  readonly id: Schema.brand<Schema.String, "Event.ID"> & {
1234
1190
  create: () => string & import("effect/Brand").Brand<"Event.ID">;
1235
1191
  };
1236
1192
  readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
1237
1193
  readonly type: Schema.Literal<"form.replied">;
1238
- readonly durable: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
1239
- readonly aggregateID: Schema.String;
1240
- readonly seq: Schema.brand<Schema.Int, "Event.Seq">;
1241
- readonly version: Schema.brand<Schema.Int, "Event.Version">;
1242
- }>>>, Schema.optionalKey<Schema.Struct<{
1243
- readonly aggregateID: Schema.String;
1244
- readonly seq: Schema.brand<Schema.Int, "Event.Seq">;
1245
- readonly version: Schema.brand<Schema.Int, "Event.Version">;
1246
- }>>, never, never>;
1247
1194
  readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
1248
1195
  readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
1249
1196
  readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "WorkspaceV2.ID"> & {
@@ -1271,6 +1218,9 @@ export declare const Event: {
1271
1218
  readonly answer: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean, Schema.$Array<Schema.String>]>>;
1272
1219
  }>;
1273
1220
  }> & {
1221
+ type: "form.replied";
1222
+ durability: "ephemeral";
1223
+ durable: undefined;
1274
1224
  data: Schema.Struct<{
1275
1225
  readonly id: Schema.brand<Schema.String, "Form.ID"> & {
1276
1226
  create: (id?: string) => string & import("effect/Brand").Brand<"Form.ID">;
@@ -1278,26 +1228,12 @@ export declare const Event: {
1278
1228
  readonly sessionID: Schema.String;
1279
1229
  readonly answer: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean, Schema.$Array<Schema.String>]>>;
1280
1230
  }>;
1281
- durable?: {
1282
- readonly version: number;
1283
- readonly aggregate: string;
1284
- } | undefined;
1285
- type: "form.replied";
1286
1231
  }, Schema.Struct<{
1287
1232
  readonly id: Schema.brand<Schema.String, "Event.ID"> & {
1288
1233
  create: () => string & import("effect/Brand").Brand<"Event.ID">;
1289
1234
  };
1290
1235
  readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
1291
1236
  readonly type: Schema.Literal<"form.cancelled">;
1292
- readonly durable: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
1293
- readonly aggregateID: Schema.String;
1294
- readonly seq: Schema.brand<Schema.Int, "Event.Seq">;
1295
- readonly version: Schema.brand<Schema.Int, "Event.Version">;
1296
- }>>>, Schema.optionalKey<Schema.Struct<{
1297
- readonly aggregateID: Schema.String;
1298
- readonly seq: Schema.brand<Schema.Int, "Event.Seq">;
1299
- readonly version: Schema.brand<Schema.Int, "Event.Version">;
1300
- }>>, never, never>;
1301
1237
  readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
1302
1238
  readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
1303
1239
  readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "WorkspaceV2.ID"> & {
@@ -1324,16 +1260,14 @@ export declare const Event: {
1324
1260
  readonly sessionID: Schema.String;
1325
1261
  }>;
1326
1262
  }> & {
1263
+ type: "form.cancelled";
1264
+ durability: "ephemeral";
1265
+ durable: undefined;
1327
1266
  data: Schema.Struct<{
1328
1267
  readonly id: Schema.brand<Schema.String, "Form.ID"> & {
1329
1268
  create: (id?: string) => string & import("effect/Brand").Brand<"Form.ID">;
1330
1269
  };
1331
1270
  readonly sessionID: Schema.String;
1332
1271
  }>;
1333
- durable?: {
1334
- readonly version: number;
1335
- readonly aggregate: string;
1336
- } | undefined;
1337
- type: "form.cancelled";
1338
1272
  }];
1339
1273
  };
package/dist/form.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export * as Form from "./form.js";
2
2
  import { Schema } from "effect";
3
- import { define, inventory } from "./event.js";
3
+ import { ephemeral, inventory } from "./event.js";
4
4
  import { ascending } from "./identifier.js";
5
5
  import { NonNegativeInt, optional, statics } from "./schema.js";
6
6
  const IDSchema = Schema.String.check(Schema.isStartsWith("frm_")).pipe(Schema.brand("Form.ID"));
@@ -106,7 +106,7 @@ export const State = Schema.Union([
106
106
  export const Reply = Schema.Struct({
107
107
  answer: Answer,
108
108
  }).annotate({ identifier: "Form.Reply" });
109
- const Created = define({ type: "form.created", schema: { form: Info } });
110
- const Replied = define({ type: "form.replied", schema: { id: ID, sessionID: Schema.String, answer: Answer } });
111
- const Cancelled = define({ type: "form.cancelled", schema: { id: ID, sessionID: Schema.String } });
109
+ const Created = ephemeral({ type: "form.created", schema: { form: Info } });
110
+ const Replied = ephemeral({ type: "form.replied", schema: { id: ID, sessionID: Schema.String, answer: Answer } });
111
+ const Cancelled = ephemeral({ type: "form.cancelled", schema: { id: ID, sessionID: Schema.String } });
112
112
  export const Event = { Created, Replied, Cancelled, Definitions: inventory(Created, Replied, Cancelled) };