liminal 0.17.1 → 0.17.3

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 (109) hide show
  1. package/Accumulator.ts +16 -10
  2. package/Actor.ts +35 -29
  3. package/Audition.ts +17 -12
  4. package/CHANGELOG.md +12 -0
  5. package/Client.ts +260 -295
  6. package/ClientHandle.ts +17 -6
  7. package/F.ts +3 -9
  8. package/LICENSE +202 -0
  9. package/Method.ts +11 -13
  10. package/Protocol.ts +104 -126
  11. package/Send.ts +9 -5
  12. package/_util/Diagnostic.ts +16 -0
  13. package/_util/Mutex.ts +5 -5
  14. package/dist/Accumulator.d.ts +2 -2
  15. package/dist/Accumulator.js +12 -8
  16. package/dist/Accumulator.js.map +1 -1
  17. package/dist/Actor.d.ts +9 -10
  18. package/dist/Actor.js +6 -15
  19. package/dist/Actor.js.map +1 -1
  20. package/dist/Audition.d.ts +3 -4
  21. package/dist/Audition.js +7 -5
  22. package/dist/Audition.js.map +1 -1
  23. package/dist/Client.d.ts +20 -39
  24. package/dist/Client.js +119 -139
  25. package/dist/Client.js.map +1 -1
  26. package/dist/ClientHandle.d.ts +5 -6
  27. package/dist/ClientHandle.js +1 -1
  28. package/dist/ClientHandle.js.map +1 -1
  29. package/dist/F.d.ts +3 -12
  30. package/dist/F.js +1 -3
  31. package/dist/F.js.map +1 -1
  32. package/dist/Method.d.ts +11 -12
  33. package/dist/Method.js.map +1 -1
  34. package/dist/Protocol.d.ts +46 -89
  35. package/dist/Protocol.js +35 -11
  36. package/dist/Protocol.js.map +1 -1
  37. package/dist/Send.d.ts +2 -3
  38. package/dist/Send.js +1 -1
  39. package/dist/Send.js.map +1 -1
  40. package/dist/_util/Diagnostic.d.ts +5 -0
  41. package/dist/_util/Diagnostic.js +10 -0
  42. package/dist/_util/Diagnostic.js.map +1 -0
  43. package/dist/_util/Mutex.d.ts +2 -2
  44. package/dist/_util/Mutex.js +4 -4
  45. package/dist/_util/Mutex.js.map +1 -1
  46. package/dist/errors.d.ts +15 -12
  47. package/dist/errors.js +6 -4
  48. package/dist/errors.js.map +1 -1
  49. package/dist/experimental/BranchLive.d.ts +1 -1
  50. package/dist/experimental/BranchLive.js +1 -1
  51. package/dist/experimental/BranchLive.js.map +1 -1
  52. package/dist/experimental/L/append.d.ts +1 -1
  53. package/dist/experimental/L/append.js +2 -2
  54. package/dist/experimental/L/append.js.map +1 -1
  55. package/dist/experimental/L/assistant.d.ts +2 -2
  56. package/dist/experimental/L/assistant.js +1 -1
  57. package/dist/experimental/L/assistant.js.map +1 -1
  58. package/dist/experimental/L/assistantSchema.d.ts +2 -2
  59. package/dist/experimental/L/assistantSchema.js +1 -1
  60. package/dist/experimental/L/assistantSchema.js.map +1 -1
  61. package/dist/experimental/L/assistantStream.d.ts +2 -2
  62. package/dist/experimental/L/assistantStream.js +1 -1
  63. package/dist/experimental/L/assistantStream.js.map +1 -1
  64. package/dist/experimental/L/branch.d.ts +1 -1
  65. package/dist/experimental/L/clear.d.ts +1 -1
  66. package/dist/experimental/L/clear.js +1 -1
  67. package/dist/experimental/L/clear.js.map +1 -1
  68. package/dist/experimental/L/history.d.ts +2 -2
  69. package/dist/experimental/L/history.js +2 -2
  70. package/dist/experimental/L/history.js.map +1 -1
  71. package/dist/experimental/L/init.d.ts +1 -1
  72. package/dist/experimental/L/init.js +1 -1
  73. package/dist/experimental/L/init.js.map +1 -1
  74. package/dist/experimental/L/matrix.d.ts +2 -2
  75. package/dist/experimental/L/system.d.ts +1 -1
  76. package/dist/experimental/L/system.js +1 -1
  77. package/dist/experimental/L/system.js.map +1 -1
  78. package/dist/experimental/L/user.d.ts +1 -1
  79. package/dist/experimental/L/user.js +1 -1
  80. package/dist/experimental/L/user.js.map +1 -1
  81. package/dist/experimental/Loader.d.ts +3 -3
  82. package/dist/experimental/Loader.js +2 -2
  83. package/dist/experimental/Loader.js.map +1 -1
  84. package/dist/experimental/TaggedTemplateFunction.d.ts +2 -2
  85. package/dist/experimental/Template.d.ts +8 -12
  86. package/dist/experimental/Template.js +53 -51
  87. package/dist/experimental/Template.js.map +1 -1
  88. package/dist/tsconfig.tsbuildinfo +1 -1
  89. package/errors.ts +12 -4
  90. package/experimental/BranchLive.ts +1 -1
  91. package/experimental/L/append.ts +2 -2
  92. package/experimental/L/assistant.ts +1 -1
  93. package/experimental/L/assistantSchema.ts +3 -3
  94. package/experimental/L/assistantStream.ts +1 -1
  95. package/experimental/L/clear.ts +1 -1
  96. package/experimental/L/history.ts +2 -2
  97. package/experimental/L/init.ts +1 -1
  98. package/experimental/L/matrix.ts +3 -3
  99. package/experimental/L/system.ts +1 -1
  100. package/experimental/L/user.ts +1 -1
  101. package/experimental/Loader.ts +3 -3
  102. package/experimental/TaggedTemplateFunction.ts +2 -2
  103. package/experimental/Template.ts +62 -70
  104. package/package.json +2 -6
  105. package/tsconfig.json +1 -1
  106. package/_types.ts +0 -27
  107. package/dist/_types.d.ts +0 -22
  108. package/dist/_types.js +0 -2
  109. package/dist/_types.js.map +0 -1
@@ -1,96 +1,53 @@
1
1
  import { Schema as S } from "effect";
2
- import type { FieldsRecord } from "./_types.ts";
3
2
  import type { MethodDefinition } from "./Method.ts";
4
- export declare namespace Call {
5
- namespace Payload {
6
- type Type<MethodDefinitions extends Record<string, MethodDefinition.Any>> = {
7
- readonly _tag: "Call.Payload";
8
- readonly id: number;
9
- readonly payload: {
10
- [K in keyof MethodDefinitions]: {
11
- readonly _tag: K;
12
- readonly value: S.Struct<MethodDefinitions[K]["payload"]>["Type"];
13
- };
14
- }[keyof MethodDefinitions];
15
- };
16
- type Encoded<MethodDefinitions extends Record<string, MethodDefinition.Any>> = {
17
- readonly _tag: "Call.Payload";
18
- readonly id: number;
19
- readonly payload: {
20
- [K in keyof MethodDefinitions]: {
21
- readonly _tag: K;
22
- readonly value: S.Struct<MethodDefinitions[K]["payload"]>["Encoded"];
23
- };
24
- }[keyof MethodDefinitions];
25
- };
26
- }
27
- namespace Success {
28
- type Type<MethodDefinitions extends Record<string, MethodDefinition.Any>> = {
29
- readonly _tag: "Call.Success";
30
- readonly id: number;
31
- readonly value: {
32
- readonly [K in keyof MethodDefinitions]: {
33
- readonly _tag: K;
34
- readonly value: MethodDefinitions[K]["success"]["Type"];
35
- };
36
- }[keyof MethodDefinitions];
37
- };
38
- type Encoded<MethodDefinitions extends Record<string, MethodDefinition.Any>> = {
39
- readonly _tag: "Call.Success";
40
- readonly id: number;
41
- readonly value: {
42
- readonly [K in keyof MethodDefinitions]: {
43
- readonly _tag: K;
44
- readonly value: MethodDefinitions[K]["success"]["Encoded"];
45
- };
46
- }[keyof MethodDefinitions];
47
- };
48
- }
49
- namespace Failure {
50
- type Type<MethodDefinitions extends Record<string, MethodDefinition.Any>> = {
51
- readonly _tag: "Call.Failure";
52
- readonly id: number;
53
- readonly cause: {
54
- readonly [K in keyof MethodDefinitions]: {
55
- readonly _tag: K;
56
- readonly value: MethodDefinitions[K]["failure"]["Type"];
57
- };
58
- }[keyof MethodDefinitions];
59
- };
60
- type Encoded<MethodDefinitions extends Record<string, MethodDefinition.Any>> = {
61
- readonly _tag: "Call.Failure";
62
- readonly id: number;
63
- readonly cause: {
64
- readonly [K in keyof MethodDefinitions]: {
65
- readonly _tag: K;
66
- readonly value: MethodDefinitions[K]["failure"]["Encoded"];
67
- };
68
- }[keyof MethodDefinitions];
69
- };
70
- }
71
- }
72
- export declare namespace Event {
73
- type Type<EventDefinitions extends FieldsRecord> = {
74
- readonly _tag: "Event";
75
- readonly event: FieldsRecord.TaggedMember.Type<EventDefinitions>;
76
- };
77
- type Encoded<EventDefinitions extends FieldsRecord> = {
78
- readonly _tag: "Event";
79
- readonly event: FieldsRecord.TaggedMember.Encoded<EventDefinitions>;
3
+ export declare const AuditionSuccess: S.TaggedStruct<"AuditionSuccess", {}>;
4
+ export declare const AuditionFailure: S.TaggedStruct<"AuditionFailure", {
5
+ readonly client: S.String;
6
+ readonly routed: S.String;
7
+ }>;
8
+ export interface ProtocolSchemas<MethodDefinitions extends Record<string, MethodDefinition.Any>, EventDefinitions extends Record<string, S.Struct.Fields>> {
9
+ readonly f: {
10
+ readonly payload: S.TaggedStruct<"FPayload", {
11
+ readonly id: S.Int;
12
+ readonly payload: S.TaggedUnion<{
13
+ readonly [K in keyof MethodDefinitions & string]: S.TaggedStruct<K, {
14
+ readonly value: MethodDefinitions[K]["payload"];
15
+ }>;
16
+ }>;
17
+ }>;
18
+ readonly success: S.TaggedStruct<"FSuccess", {
19
+ readonly id: S.Int;
20
+ readonly success: S.TaggedUnion<{
21
+ readonly [K in keyof MethodDefinitions & string]: S.TaggedStruct<K, {
22
+ readonly value: MethodDefinitions[K]["success"];
23
+ }>;
24
+ }>;
25
+ }>;
26
+ readonly failure: S.TaggedStruct<"FFailure", {
27
+ readonly id: S.Int;
28
+ readonly failure: S.TaggedUnion<{
29
+ readonly [K in keyof MethodDefinitions & string]: S.TaggedStruct<K, {
30
+ readonly value: MethodDefinitions[K]["failure"];
31
+ }>;
32
+ }>;
33
+ }>;
80
34
  };
81
- }
82
- export declare const Audition: {
83
- Success: S.TaggedStruct<"Audition.Success", {}>;
84
- Failure: S.TaggedStruct<"Audition.Failure", {
85
- expected: typeof S.String;
86
- actual: typeof S.String;
35
+ readonly event: S.TaggedStruct<"Event", {
36
+ readonly event: S.TaggedUnion<{
37
+ readonly [K in keyof EventDefinitions & string]: S.TaggedStruct<K, EventDefinitions[K]>;
38
+ }>;
87
39
  }>;
88
- };
40
+ readonly actor: S.Union<[
41
+ typeof AuditionSuccess,
42
+ typeof AuditionFailure,
43
+ this["f"]["success"],
44
+ this["f"]["failure"],
45
+ this["event"],
46
+ typeof Disconnect
47
+ ]>;
48
+ }
89
49
  export declare const Disconnect: S.TaggedStruct<"Disconnect", {}>;
90
50
  export declare const TransportFailure: S.TaggedStruct<"TransportFailure", {
91
- cause: typeof S.Unknown;
51
+ readonly cause: S.Unknown;
92
52
  }>;
93
- export declare namespace Actor {
94
- type Type<MethodDefinitions extends Record<string, MethodDefinition.Any>, EventDefinitions extends FieldsRecord> = typeof Audition.Success.Type | typeof Audition.Failure.Type | Call.Success.Type<MethodDefinitions> | Call.Failure.Type<MethodDefinitions> | Event.Type<EventDefinitions> | typeof Disconnect.Type;
95
- type Encoded<MethodDefinitions extends Record<string, MethodDefinition.Any>, EventDefinitions extends FieldsRecord> = typeof Audition.Success.Encoded | typeof Audition.Failure.Encoded | Call.Success.Encoded<MethodDefinitions> | Call.Failure.Encoded<MethodDefinitions> | Event.Encoded<EventDefinitions> | typeof Disconnect.Encoded;
96
- }
53
+ export declare const ProtocolSchemas: <MethodDefinitions extends Record<string, MethodDefinition.Any>, EventDefinitions extends Record<string, S.Struct.Fields>>(methods: MethodDefinitions, events: EventDefinitions) => ProtocolSchemas<MethodDefinitions, EventDefinitions>;
package/dist/Protocol.js CHANGED
@@ -1,13 +1,37 @@
1
- import { Schema as S } from "effect";
2
- export const Audition = {
3
- Success: S.TaggedStruct("Audition.Success", {}),
4
- Failure: S.TaggedStruct("Audition.Failure", {
5
- expected: S.String,
6
- actual: S.String,
7
- }),
8
- };
9
- export const Disconnect = S.TaggedStruct("Disconnect", {});
10
- export const TransportFailure = S.TaggedStruct("TransportFailure", {
11
- cause: S.Unknown,
1
+ import { Schema as S, Record } from "effect";
2
+ export const AuditionSuccess = S.TaggedStruct("AuditionSuccess", {});
3
+ export const AuditionFailure = S.TaggedStruct("AuditionFailure", {
4
+ client: S.String,
5
+ routed: S.String,
12
6
  });
7
+ export const Disconnect = S.TaggedStruct("Disconnect", {});
8
+ export const TransportFailure = S.TaggedStruct("TransportFailure", { cause: S.Unknown });
9
+ export const ProtocolSchemas = (methods, events) => {
10
+ const f = {
11
+ payload: S.TaggedStruct("FPayload", {
12
+ id: S.Int,
13
+ payload: S.TaggedUnion(Record.map(methods, ({ payload: value }) => ({ value }))),
14
+ }),
15
+ success: S.TaggedStruct("FSuccess", {
16
+ id: S.Int,
17
+ success: S.TaggedUnion(Record.map(methods, ({ success: value }) => ({ value }))),
18
+ }),
19
+ failure: S.TaggedStruct("FFailure", {
20
+ id: S.Int,
21
+ failure: S.TaggedUnion(Record.map(methods, ({ failure: value }) => ({ value }))),
22
+ }),
23
+ };
24
+ const event = S.TaggedStruct("Event", {
25
+ event: S.TaggedUnion(events),
26
+ });
27
+ const actor = S.Union([
28
+ AuditionSuccess,
29
+ AuditionFailure,
30
+ f.success,
31
+ f.failure,
32
+ event,
33
+ Disconnect,
34
+ ]);
35
+ return { f, event, actor };
36
+ };
13
37
  //# sourceMappingURL=Protocol.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Protocol.js","sourceRoot":"","sources":["../Protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAyGpC,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,OAAO,EAAE,CAAC,CAAC,YAAY,CAAC,kBAAkB,EAAE,EAAE,CAAC;IAC/C,OAAO,EAAE,CAAC,CAAC,YAAY,CAAC,kBAAkB,EAAE;QAC1C,QAAQ,EAAE,CAAC,CAAC,MAAM;QAClB,MAAM,EAAE,CAAC,CAAC,MAAM;KACjB,CAAC;CACH,CAAA;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,YAAY,CAAC,YAAY,EAAE,EAAE,CAAC,CAAA;AAE1D,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,YAAY,CAAC,kBAAkB,EAAE;IACjE,KAAK,EAAE,CAAC,CAAC,OAAO;CACjB,CAAC,CAAA"}
1
+ {"version":3,"file":"Protocol.js","sourceRoot":"","sources":["../Protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAI5C,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,YAAY,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAA;AAEpE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,YAAY,CAAC,iBAAiB,EAAE;IAC/D,MAAM,EAAE,CAAC,CAAC,MAAM;IAChB,MAAM,EAAE,CAAC,CAAC,MAAM;CACjB,CAAC,CAAA;AAoEF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,YAAY,CAAC,YAAY,EAAE,EAAE,CAAC,CAAA;AAE1D,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,YAAY,CAAC,kBAAkB,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAA;AAExF,MAAM,CAAC,MAAM,eAAe,GAAG,CAI7B,OAA0B,EAC1B,MAAwB,EAC8B,EAAE;IAGxD,MAAM,CAAC,GAAW;QAChB,OAAO,EAAE,CAAC,CAAC,YAAY,CAAC,UAAU,EAAE;YAClC,EAAE,EAAE,CAAC,CAAC,GAAG;YACT,OAAO,EAAE,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;SACjF,CAAU;QACX,OAAO,EAAE,CAAC,CAAC,YAAY,CAAC,UAAU,EAAE;YAClC,EAAE,EAAE,CAAC,CAAC,GAAG;YACT,OAAO,EAAE,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;SACjF,CAAU;QACX,OAAO,EAAE,CAAC,CAAC,YAAY,CAAC,UAAU,EAAE;YAClC,EAAE,EAAE,CAAC,CAAC,GAAG;YACT,OAAO,EAAE,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;SACjF,CAAU;KACZ,CAAA;IAED,MAAM,KAAK,GAAe,CAAC,CAAC,YAAY,CAAC,OAAO,EAAE;QAChD,KAAK,EAAE,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC;KAC7B,CAAU,CAAA;IAEX,MAAM,KAAK,GAAe,CAAC,CAAC,KAAK,CAAC;QAChC,eAAe;QACf,eAAe;QACf,CAAC,CAAC,OAAO;QACT,CAAC,CAAC,OAAO;QACT,KAAK;QACL,UAAU;KACX,CAAU,CAAA;IAEX,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;AAC5B,CAAC,CAAA"}
package/dist/Send.d.ts CHANGED
@@ -1,3 +1,2 @@
1
- import { Schema as S, ParseResult, Effect } from "effect";
2
- import type { FieldsRecord } from "./_types.ts";
3
- export type Send<ActorSelf, EventDefinitions extends FieldsRecord> = <K extends keyof EventDefinitions>(tag: K, payload: S.Struct<EventDefinitions[K]>["Type"]) => Effect.Effect<void, ParseResult.ParseError, ActorSelf>;
1
+ import { Schema as S, Effect } from "effect";
2
+ export type Send<ActorSelf, EventDefinitions extends Record<string, S.Struct.Fields>> = <K extends keyof EventDefinitions>(tag: K, payload: S.Struct<EventDefinitions[K]>["Type"]) => Effect.Effect<void, S.SchemaError, ActorSelf | ReturnType<typeof S.TaggedUnion<EventDefinitions>>["EncodingServices"]>;
package/dist/Send.js CHANGED
@@ -1,2 +1,2 @@
1
- import { Schema as S, ParseResult, Effect } from "effect";
1
+ import { Schema as S, Effect } from "effect";
2
2
  //# sourceMappingURL=Send.js.map
package/dist/Send.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Send.js","sourceRoot":"","sources":["../Send.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA"}
1
+ {"version":3,"file":"Send.js","sourceRoot":"","sources":["../Send.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA"}
@@ -0,0 +1,5 @@
1
+ import { Effect, Tracer } from "effect";
2
+ export declare const module: (module: string) => {
3
+ debug: (event: string, annotations?: Record<string, unknown>) => Effect.Effect<void, never, never>;
4
+ span: (operation: string, options?: Tracer.SpanOptions | undefined) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Tracer.ParentSpan>>;
5
+ };
@@ -0,0 +1,10 @@
1
+ import { Effect, Tracer } from "effect";
2
+ export const module = (module) => ({
3
+ debug: (event, annotations) => Effect.logDebug(event).pipe(Effect.annotateLogs({
4
+ package: "liminal",
5
+ module,
6
+ ...annotations,
7
+ })),
8
+ span: (operation, options) => (effect) => Effect.withSpan(effect, `liminal.${module}.${operation}`, options),
9
+ });
10
+ //# sourceMappingURL=Diagnostic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Diagnostic.js","sourceRoot":"","sources":["../../_util/Diagnostic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEvC,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC,CAAC;IACzC,KAAK,EAAE,CAAC,KAAa,EAAE,WAAqC,EAAE,EAAE,CAC9D,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CACzB,MAAM,CAAC,YAAY,CAAC;QAClB,OAAO,EAAE,SAAS;QAClB,MAAM;QACN,GAAG,WAAW;KACf,CAAC,CACH;IACH,IAAI,EACF,CAAC,SAAiB,EAAE,OAAwC,EAAE,EAAE,CAChE,CAAU,MAA8B,EAAE,EAAE,CAC1C,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,WAAW,MAAM,IAAI,SAAS,EAAE,EAAE,OAAO,CAAC;CACvE,CAAC,CAAA"}
@@ -1,7 +1,7 @@
1
1
  import { Context, Effect, Layer } from "effect";
2
- declare const Mutex_base: Context.TagClass<Mutex, "liminal/Mutex", <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>>;
2
+ declare const Mutex_base: Context.ServiceClass<Mutex, "liminal/Mutex", <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>>;
3
3
  export declare class Mutex extends Mutex_base {
4
4
  }
5
5
  export declare const layer: Layer.Layer<Mutex, never, never>;
6
- export declare const task: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Mutex | R>;
6
+ export declare const task: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R | Mutex>;
7
7
  export {};
@@ -1,9 +1,9 @@
1
- import { Context, Effect, Layer } from "effect";
2
- export class Mutex extends Context.Tag("liminal/Mutex")() {
1
+ import { Context, Effect, Layer, Semaphore } from "effect";
2
+ export class Mutex extends Context.Service()("liminal/Mutex") {
3
3
  }
4
4
  export const layer = Effect.gen(function* () {
5
- const mutex = yield* Effect.makeSemaphore(1);
5
+ const mutex = yield* Semaphore.make(1);
6
6
  return mutex.withPermits(1);
7
7
  }).pipe(Layer.effect(Mutex));
8
- export const task = (effect) => Mutex.pipe(Effect.flatMap((f) => f(effect)));
8
+ export const task = (effect) => Mutex.asEffect().pipe(Effect.flatMap((f) => f(effect)));
9
9
  //# sourceMappingURL=Mutex.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Mutex.js","sourceRoot":"","sources":["../../_util/Mutex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAE/C,MAAM,OAAO,KAAM,SAAQ,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,EAGpD;CAAG;AAEN,MAAM,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IACvC,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,CAAA;IAC5C,OAAO,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAA;AAC7B,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;AAE5B,MAAM,CAAC,MAAM,IAAI,GAAG,CAAU,MAA8B,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA"}
1
+ {"version":3,"file":"Mutex.js","sourceRoot":"","sources":["../../_util/Mutex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAE1D,MAAM,OAAO,KAAM,SAAQ,OAAO,CAAC,OAAO,EAGvC,CAAC,eAAe,CAAC;CAAG;AAEvB,MAAM,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IACvC,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACtC,OAAO,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAA;AAC7B,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;AAE5B,MAAM,CAAC,MAAM,IAAI,GAAG,CAAU,MAA8B,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA"}
package/dist/errors.d.ts CHANGED
@@ -1,20 +1,23 @@
1
1
  import { Schema as S } from "effect";
2
- declare const AuditionError_base: S.TaggedErrorClass<AuditionError, "AuditionError", {
3
- readonly _tag: S.tag<"AuditionError">;
4
- } & {
5
- value: S.optional<S.Struct<{
6
- actual: typeof S.String;
7
- expected: typeof S.String;
2
+ import type { MethodDefinition } from "./Method.ts";
3
+ declare const AuditionError_base: S.Class<AuditionError, S.TaggedStruct<"AuditionError", {
4
+ readonly value: S.optional<S.Struct<{
5
+ readonly client: S.String;
6
+ readonly routed: S.String;
8
7
  }>>;
9
- }>;
8
+ }>, import("effect/Cause").YieldableError>;
10
9
  export declare class AuditionError extends AuditionError_base {
11
10
  }
12
- declare const ConnectionError_base: S.TaggedErrorClass<ConnectionError, "ConnectionError", {
13
- readonly _tag: S.tag<"ConnectionError">;
14
- } & {
15
- cause: typeof S.Unknown;
16
- }>;
11
+ declare const ConnectionError_base: S.Class<ConnectionError, S.TaggedStruct<"ConnectionError", {
12
+ readonly cause: S.Unknown;
13
+ }>, import("effect/Cause").YieldableError>;
17
14
  export declare class ConnectionError extends ConnectionError_base {
18
15
  }
19
16
  export type ClientError = AuditionError | ConnectionError;
17
+ declare const UnresolvedError_base: S.Class<UnresolvedError, S.TaggedStruct<"UnresolvedError", {}>, import("effect/Cause").YieldableError>;
18
+ export declare class UnresolvedError extends UnresolvedError_base {
19
+ }
20
+ export type FError<MethodDefinitions extends Record<string, MethodDefinition.Any>> = [
21
+ MethodDefinitions[keyof MethodDefinitions]["failure"]["Type"] | ClientError | UnresolvedError
22
+ ][0];
20
23
  export {};
package/dist/errors.js CHANGED
@@ -1,13 +1,15 @@
1
1
  import { Schema as S } from "effect";
2
- export class AuditionError extends S.TaggedError()("AuditionError", {
2
+ export class AuditionError extends S.TaggedErrorClass()("AuditionError", {
3
3
  value: S.Struct({
4
- actual: S.String,
5
- expected: S.String,
4
+ client: S.String,
5
+ routed: S.String,
6
6
  }).pipe(S.optional),
7
7
  }) {
8
8
  }
9
- export class ConnectionError extends S.TaggedError()("ConnectionError", {
9
+ export class ConnectionError extends S.TaggedErrorClass()("ConnectionError", {
10
10
  cause: S.Unknown,
11
11
  }) {
12
12
  }
13
+ export class UnresolvedError extends S.TaggedErrorClass()("UnresolvedError", {}) {
14
+ }
13
15
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAEpC,MAAM,OAAO,aAAc,SAAQ,CAAC,CAAC,WAAW,EAAiB,CAAC,eAAe,EAAE;IACjF,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,QAAQ,EAAE,CAAC,CAAC,MAAM;KACnB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;CACpB,CAAC;CAAG;AAEL,MAAM,OAAO,eAAgB,SAAQ,CAAC,CAAC,WAAW,EAAmB,CAAC,iBAAiB,EAAE;IACvF,KAAK,EAAE,CAAC,CAAC,OAAO;CACjB,CAAC;CAAG"}
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAIpC,MAAM,OAAO,aAAc,SAAQ,CAAC,CAAC,gBAAgB,EAAiB,CAAC,eAAe,EAAE;IACtF,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,MAAM,EAAE,CAAC,CAAC,MAAM;KACjB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;CACpB,CAAC;CAAG;AAEL,MAAM,OAAO,eAAgB,SAAQ,CAAC,CAAC,gBAAgB,EAAmB,CAAC,iBAAiB,EAAE;IAC5F,KAAK,EAAE,CAAC,CAAC,OAAO;CACjB,CAAC;CAAG;AAIL,MAAM,OAAO,eAAgB,SAAQ,CAAC,CAAC,gBAAgB,EAAmB,CAAC,iBAAiB,EAAE,EAAE,CAAC;CAAG"}
@@ -1,3 +1,3 @@
1
- import { Chat } from "@effect/ai";
2
1
  import { Layer } from "effect";
2
+ import { Chat } from "effect/unstable/ai";
3
3
  export declare const BranchLive: Layer.Layer<Chat.Chat, never, Chat.Chat>;
@@ -1,5 +1,5 @@
1
- import { Chat } from "@effect/ai";
2
1
  import { Effect, Layer } from "effect";
2
+ import { Chat } from "effect/unstable/ai";
3
3
  import { history } from "./L/history.js";
4
4
  export const BranchLive = Layer.effect(Chat.Chat, history.pipe(Effect.flatMap(Chat.fromPrompt)));
5
5
  //# sourceMappingURL=BranchLive.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BranchLive.js","sourceRoot":"","sources":["../../experimental/BranchLive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACjC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAEtC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAExC,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA"}
1
+ {"version":3,"file":"BranchLive.js","sourceRoot":"","sources":["../../experimental/BranchLive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAEzC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAExC,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA"}
@@ -1,3 +1,3 @@
1
- import { Prompt, Chat } from "@effect/ai";
2
1
  import { Effect } from "effect";
2
+ import { Prompt, Chat } from "effect/unstable/ai";
3
3
  export declare const append: (message: Prompt.Message) => Effect.Effect<void, never, Chat.Chat>;
@@ -1,4 +1,4 @@
1
- import { Prompt, Chat } from "@effect/ai";
2
1
  import { Effect, flow, Ref } from "effect";
3
- export const append = (message) => Chat.Chat.pipe(Effect.flatMap(flow(({ history }) => history, Ref.update(({ content }) => Prompt.fromMessages([...content, message])))));
2
+ import { Prompt, Chat } from "effect/unstable/ai";
3
+ export const append = (message) => Chat.Chat.asEffect().pipe(Effect.flatMap(flow(({ history }) => history, Ref.update(({ content }) => Prompt.fromMessages([...content, message])))));
4
4
  //# sourceMappingURL=append.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"append.js","sourceRoot":"","sources":["../../../experimental/L/append.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAE1C,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,OAAuB,EAAE,EAAE,CAChD,IAAI,CAAC,IAAI,CAAC,IAAI,CACZ,MAAM,CAAC,OAAO,CACZ,IAAI,CACF,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,EACxB,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,GAAG,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CACxE,CACF,CACF,CAAA"}
1
+ {"version":3,"file":"append.js","sourceRoot":"","sources":["../../../experimental/L/append.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAC1C,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAEjD,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,OAAuB,EAAE,EAAE,CAChD,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAI,CACvB,MAAM,CAAC,OAAO,CACZ,IAAI,CACF,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,EACxB,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,GAAG,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CACxE,CACF,CACF,CAAA"}
@@ -1,3 +1,3 @@
1
- import { LanguageModel } from "@effect/ai";
2
1
  import { Effect } from "effect";
3
- export declare const assistant: Effect.Effect<string, import("@effect/ai/AiError").AiError, import("@effect/ai/Chat").Chat | LanguageModel.LanguageModel>;
2
+ import { LanguageModel } from "effect/unstable/ai";
3
+ export declare const assistant: Effect.Effect<string, import("effect/unstable/ai/AiError").AiError, import("effect/unstable/ai/Chat").Chat | LanguageModel.LanguageModel>;
@@ -1,5 +1,5 @@
1
- import { Prompt, LanguageModel } from "@effect/ai";
2
1
  import { Effect } from "effect";
2
+ import { Prompt, LanguageModel } from "effect/unstable/ai";
3
3
  import { append } from "./append.js";
4
4
  import { history } from "./history.js";
5
5
  export const assistant = Effect.gen(function* () {
@@ -1 +1 @@
1
- {"version":3,"file":"assistant.js","sourceRoot":"","sources":["../../../experimental/L/assistant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAC3C,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,OAAO,CAAA;IAC7B,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,CAAC,aAAa,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC,CAAA;IAC9D,KAAK,CAAC,CAAC,MAAM,CACX,MAAM,CAAC,gBAAgB,CAAC;QACtB,OAAO,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;KACrC,CAAC,CACH,CAAA;IACD,OAAO,IAAI,CAAA;AACb,CAAC,CAAC,CAAA"}
1
+ {"version":3,"file":"assistant.js","sourceRoot":"","sources":["../../../experimental/L/assistant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAE1D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAC3C,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,OAAO,CAAA;IAC7B,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,CAAC,aAAa,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC,CAAA;IAC9D,KAAK,CAAC,CAAC,MAAM,CACX,MAAM,CAAC,gBAAgB,CAAC;QACtB,OAAO,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;KACrC,CAAC,CACH,CAAA;IACD,OAAO,IAAI,CAAA;AACb,CAAC,CAAC,CAAA"}
@@ -1,3 +1,3 @@
1
- import { LanguageModel } from "@effect/ai";
2
1
  import { Effect, Schema as S } from "effect";
3
- export declare const assistantSchema: <A, I extends Record<string, unknown>, R>(schema: S.Schema<A, I, R>) => Effect.Effect<A, import("@effect/ai/AiError").AiError, import("@effect/ai/Chat").Chat | LanguageModel.LanguageModel | R>;
2
+ import { LanguageModel } from "effect/unstable/ai";
3
+ export declare const assistantSchema: <A, I extends Record<string, unknown>>(schema: S.Codec<A, I, never, never>) => Effect.Effect<A, import("effect/unstable/ai/AiError").AiError, import("effect/unstable/ai/Chat").Chat | LanguageModel.LanguageModel>;
@@ -1,5 +1,5 @@
1
- import { Prompt, LanguageModel } from "@effect/ai";
2
1
  import { Effect, Schema as S } from "effect";
2
+ import { Prompt, LanguageModel } from "effect/unstable/ai";
3
3
  import { append } from "./append.js";
4
4
  import { history } from "./history.js";
5
5
  export const assistantSchema = Effect.fnUntraced(function* (schema) {
@@ -1 +1 @@
1
- {"version":3,"file":"assistantSchema.js","sourceRoot":"","sources":["../../../experimental/L/assistantSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAE5C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,EACxD,MAAyB;IAEzB,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,OAAO,CAAA;IAC7B,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC,CAAC,aAAa,CAAC,cAAc,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;IAC/E,KAAK,CAAC,CAAC,MAAM,CACX,MAAM,CAAC,gBAAgB,CAAC;QACtB,OAAO,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;KACrC,CAAC,CACH,CAAA;IACD,OAAO,KAAK,CAAA;AACd,CAAC,CAAC,CAAA"}
1
+ {"version":3,"file":"assistantSchema.js","sourceRoot":"","sources":["../../../experimental/L/assistantSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAC5C,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAE1D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,EACxD,MAAqB;IAErB,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,OAAO,CAAA;IAC7B,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC,CAAC,aAAa,CAAC,cAAc,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;IAC/E,KAAK,CAAC,CAAC,MAAM,CACX,MAAM,CAAC,gBAAgB,CAAC;QACtB,OAAO,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;KACrC,CAAC,CACH,CAAA;IACD,OAAO,KAAK,CAAA;AACd,CAAC,CAAC,CAAA"}
@@ -1,3 +1,3 @@
1
- import { LanguageModel } from "@effect/ai";
2
1
  import { Stream } from "effect";
3
- export declare const assistantStream: Stream.Stream<import("@effect/ai/Response").StreamPart<{}>, import("@effect/ai/AiError").AiError, import("@effect/ai/Chat").Chat | LanguageModel.LanguageModel>;
2
+ import { LanguageModel } from "effect/unstable/ai";
3
+ export declare const assistantStream: Stream.Stream<import("effect/unstable/ai/Response").StreamPart<{}>, import("effect/unstable/ai/AiError").AiError, import("effect/unstable/ai/Chat").Chat | LanguageModel.LanguageModel>;
@@ -1,5 +1,5 @@
1
- import { LanguageModel } from "@effect/ai";
2
1
  import { Effect, Stream } from "effect";
2
+ import { LanguageModel } from "effect/unstable/ai";
3
3
  import { history } from "./history.js";
4
4
  export const assistantStream = history.pipe(Effect.map((prompt) => LanguageModel.streamText({ prompt })), Stream.unwrap);
5
5
  //# sourceMappingURL=assistantStream.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"assistantStream.js","sourceRoot":"","sources":["../../../experimental/L/assistantStream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,MAAM,CAAC,MAAM,eAAe,GAAG,OAAO,CAAC,IAAI,CACzC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAC5D,MAAM,CAAC,MAAM,CACd,CAAA"}
1
+ {"version":3,"file":"assistantStream.js","sourceRoot":"","sources":["../../../experimental/L/assistantStream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAElD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,MAAM,CAAC,MAAM,eAAe,GAAG,OAAO,CAAC,IAAI,CACzC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAC5D,MAAM,CAAC,MAAM,CACd,CAAA"}
@@ -1,2 +1,2 @@
1
1
  import { Effect } from "effect";
2
- export declare const branch: <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, import("@effect/ai/Chat").Chat | Exclude<R, import("@effect/ai/Chat").Chat>>;
2
+ export declare const branch: <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, import("effect/unstable/ai/Chat").Chat | Exclude<R, import("effect/unstable/ai/Chat").Chat>>;
@@ -1,3 +1,3 @@
1
- import { Chat } from "@effect/ai";
2
1
  import { Effect } from "effect";
2
+ import { Chat } from "effect/unstable/ai";
3
3
  export declare const clear: Effect.Effect<void, never, Chat.Chat>;
@@ -1,5 +1,5 @@
1
- import { Chat, Prompt } from "@effect/ai";
2
1
  import { Ref, Effect } from "effect";
2
+ import { Chat, Prompt } from "effect/unstable/ai";
3
3
  export const clear = Effect.gen(function* () {
4
4
  const { history } = yield* Chat.Chat;
5
5
  yield* Ref.update(history, () => Prompt.empty);
@@ -1 +1 @@
1
- {"version":3,"file":"clear.js","sourceRoot":"","sources":["../../../experimental/L/clear.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEpC,MAAM,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IACvC,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAA;IACpC,KAAK,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAChD,CAAC,CAAC,CAAA"}
1
+ {"version":3,"file":"clear.js","sourceRoot":"","sources":["../../../experimental/L/clear.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAEjD,MAAM,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IACvC,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAA;IACpC,KAAK,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAChD,CAAC,CAAC,CAAA"}
@@ -1,3 +1,3 @@
1
- import { Chat } from "@effect/ai";
2
1
  import { Effect } from "effect";
3
- export declare const history: Effect.Effect<import("@effect/ai/Prompt").Prompt, never, Chat.Chat>;
2
+ import { Chat } from "effect/unstable/ai";
3
+ export declare const history: Effect.Effect<import("effect/unstable/ai/Prompt").Prompt, never, Chat.Chat>;
@@ -1,4 +1,4 @@
1
- import { Chat } from "@effect/ai";
2
1
  import { flow, Effect, Ref } from "effect";
3
- export const history = Chat.Chat.pipe(Effect.flatMap(flow(({ history }) => history, Ref.get)));
2
+ import { Chat } from "effect/unstable/ai";
3
+ export const history = Chat.Chat.asEffect().pipe(Effect.flatMap(flow(({ history }) => history, Ref.get)));
4
4
  //# sourceMappingURL=history.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"history.js","sourceRoot":"","sources":["../../../experimental/L/history.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAE1C,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA"}
1
+ {"version":3,"file":"history.js","sourceRoot":"","sources":["../../../experimental/L/history.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAEzC,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA"}
@@ -1,3 +1,3 @@
1
- import { Chat } from "@effect/ai";
2
1
  import { Effect } from "effect";
2
+ import { Chat } from "effect/unstable/ai";
3
3
  export declare const init: <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Chat.Chat>>;
@@ -1,4 +1,4 @@
1
- import { Chat } from "@effect/ai";
2
1
  import { Effect } from "effect";
2
+ import { Chat } from "effect/unstable/ai";
3
3
  export const init = Effect.provideServiceEffect(Chat.Chat, Chat.empty);
4
4
  //# sourceMappingURL=init.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../experimental/L/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAA"}
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../experimental/L/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAEzC,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAA"}
@@ -1,8 +1,8 @@
1
1
  import { Effect, Layer } from "effect";
2
- type LayerRecord = Record<string, Layer.Layer.Any>;
2
+ type LayerRecord = Record<string, Layer.Any>;
3
3
  export type MatrixEffect<A, E, R, Layers extends LayerRecord> = Effect.Effect<{
4
4
  readonly [K in keyof Layers]: A;
5
- }, E | Layer.Layer.Error<Layers[keyof Layers]>, R | Layer.Layer.Context<Layers[keyof Layers]>>;
5
+ }, E | Layer.Error<Layers[keyof Layers]>, R | Layer.Services<Layers[keyof Layers]>>;
6
6
  export declare const matrix: {
7
7
  <Layers extends LayerRecord>(layers: Layers): <A, E, R>(effect: Effect.Effect<A, E, R>) => MatrixEffect<A, E, R, Layers>;
8
8
  <Layers extends LayerRecord, A, E, R>(effect: Effect.Effect<A, E, R>, layers: Layers): MatrixEffect<A, E, R, Layers>;
@@ -1 +1 @@
1
- export declare const system: (text: string) => import("effect/Effect").Effect<void, never, import("@effect/ai/Chat").Chat>;
1
+ export declare const system: (text: string) => import("effect/Effect").Effect<void, never, import("effect/unstable/ai/Chat").Chat>;
@@ -1,4 +1,4 @@
1
- import { Prompt } from "@effect/ai";
1
+ import { Prompt } from "effect/unstable/ai";
2
2
  import { append } from "./append.js";
3
3
  export const system = (text) => append(Prompt.systemMessage({ content: text }));
4
4
  //# sourceMappingURL=system.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"system.js","sourceRoot":"","sources":["../../../experimental/L/system.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAEnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA"}
1
+ {"version":3,"file":"system.js","sourceRoot":"","sources":["../../../experimental/L/system.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAE3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA"}
@@ -1 +1 @@
1
- export declare const user: (text: string) => import("effect/Effect").Effect<void, never, import("@effect/ai/Chat").Chat>;
1
+ export declare const user: (text: string) => import("effect/Effect").Effect<void, never, import("effect/unstable/ai/Chat").Chat>;
@@ -1,4 +1,4 @@
1
- import { Prompt } from "@effect/ai";
1
+ import { Prompt } from "effect/unstable/ai";
2
2
  import { append } from "./append.js";
3
3
  export const user = (text) => append(Prompt.userMessage({
4
4
  content: [Prompt.textPart({ text })],
@@ -1 +1 @@
1
- {"version":3,"file":"user.js","sourceRoot":"","sources":["../../../experimental/L/user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAEnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,IAAY,EAAE,EAAE,CACnC,MAAM,CACJ,MAAM,CAAC,WAAW,CAAC;IACjB,OAAO,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;CACrC,CAAC,CACH,CAAA"}
1
+ {"version":3,"file":"user.js","sourceRoot":"","sources":["../../../experimental/L/user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAE3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,IAAY,EAAE,EAAE,CACnC,MAAM,CACJ,MAAM,CAAC,WAAW,CAAC;IACjB,OAAO,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;CACrC,CAAC,CACH,CAAA"}
@@ -1,13 +1,13 @@
1
- import { Path, FileSystem } from "@effect/platform";
1
+ import { Path, FileSystem } from "effect";
2
2
  import { Option, Layer, Effect, Context } from "effect";
3
- declare const LoaderError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
3
+ declare const LoaderError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
4
4
  readonly _tag: "LoaderError";
5
5
  } & Readonly<A>;
6
6
  export declare class LoaderError extends LoaderError_base<{
7
7
  readonly url: string;
8
8
  }> {
9
9
  }
10
- declare const Loader_base: Context.TagClass<Loader, "liminal/Loader", {
10
+ declare const Loader_base: Context.ServiceClass<Loader, "liminal/Loader", {
11
11
  readonly load: (key: string) => Effect.Effect<Option.Option<string>, LoaderError>;
12
12
  }>;
13
13
  export declare class Loader extends Loader_base {
@@ -1,8 +1,8 @@
1
- import { Path, FileSystem } from "@effect/platform";
1
+ import { Path, FileSystem } from "effect";
2
2
  import { Option, Layer, Effect, Data, Context } from "effect";
3
3
  export class LoaderError extends Data.TaggedError("LoaderError") {
4
4
  }
5
- export class Loader extends Context.Tag("liminal/Loader")() {
5
+ export class Loader extends Context.Service()("liminal/Loader") {
6
6
  }
7
7
  export const layerFs = Layer.effect(Loader, Effect.gen(function* () {
8
8
  const path = yield* Path.Path;