liminal 0.16.0 → 0.17.0

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 (145) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/Digest.ts +30 -0
  3. package/Envelope.ts +15 -47
  4. package/F/F.ts +1 -0
  5. package/L/L.ts +6 -7
  6. package/L/append.ts +4 -4
  7. package/L/assistant.ts +2 -2
  8. package/L/assistantSchema.ts +2 -2
  9. package/L/assistantStream.ts +2 -2
  10. package/L/branch.ts +4 -17
  11. package/L/clear.ts +4 -4
  12. package/L/disable.ts +2 -2
  13. package/L/enable.ts +2 -2
  14. package/L/events.ts +2 -2
  15. package/L/{userJson.ts → json.ts} +3 -5
  16. package/L/line.ts +22 -0
  17. package/L/{handle.ts → listen.ts} +2 -2
  18. package/L/messages.ts +2 -2
  19. package/L/prev.ts +4 -0
  20. package/L/provide.ts +10 -0
  21. package/L/{Self.ts → self.ts} +1 -1
  22. package/L/send.ts +56 -0
  23. package/L/system.ts +18 -7
  24. package/L/thread.ts +5 -17
  25. package/L/toolkit.ts +2 -2
  26. package/L/user.test.ts +4 -1
  27. package/L/user.ts +15 -5
  28. package/LEvent.ts +23 -13
  29. package/Thread.ts +19 -21
  30. package/dist/Digest.d.ts +17 -0
  31. package/dist/Digest.js +7 -0
  32. package/dist/Digest.js.map +1 -0
  33. package/dist/Envelope.d.ts +13 -15
  34. package/dist/Envelope.js +1 -29
  35. package/dist/Envelope.js.map +1 -1
  36. package/dist/F/F.d.ts +1 -0
  37. package/dist/F/F.js +2 -0
  38. package/dist/F/F.js.map +1 -0
  39. package/dist/L/L.d.ts +6 -7
  40. package/dist/L/L.js +6 -7
  41. package/dist/L/L.js.map +1 -1
  42. package/dist/L/append.js +4 -4
  43. package/dist/L/append.js.map +1 -1
  44. package/dist/L/assistant.js +2 -2
  45. package/dist/L/assistantSchema.js +2 -2
  46. package/dist/L/assistantStream.js +2 -2
  47. package/dist/L/branch.d.ts +1 -4
  48. package/dist/L/branch.js +4 -7
  49. package/dist/L/branch.js.map +1 -1
  50. package/dist/L/clear.js +4 -4
  51. package/dist/L/clear.js.map +1 -1
  52. package/dist/L/disable.js +2 -2
  53. package/dist/L/enable.js +2 -2
  54. package/dist/L/events.js +2 -2
  55. package/dist/L/{userJson.d.ts → json.d.ts} +1 -2
  56. package/dist/L/{userJson.js → json.js} +3 -4
  57. package/dist/L/json.js.map +1 -0
  58. package/dist/L/line.d.ts +5 -0
  59. package/dist/L/line.js +11 -0
  60. package/dist/L/line.js.map +1 -0
  61. package/dist/L/{handle.js → listen.js} +3 -3
  62. package/dist/L/{handle.js.map → listen.js.map} +1 -1
  63. package/dist/L/messages.js +2 -2
  64. package/dist/L/prev.d.ts +5 -0
  65. package/dist/L/prev.js +5 -0
  66. package/dist/L/prev.js.map +1 -0
  67. package/dist/L/provide.d.ts +3 -0
  68. package/dist/L/provide.js +4 -0
  69. package/dist/L/provide.js.map +1 -0
  70. package/dist/L/{Self.d.ts → self.d.ts} +1 -1
  71. package/dist/L/self.js +4 -0
  72. package/dist/L/self.js.map +1 -0
  73. package/dist/L/send.d.ts +6 -0
  74. package/dist/L/send.js +34 -0
  75. package/dist/L/send.js.map +1 -0
  76. package/dist/L/system.d.ts +3 -3
  77. package/dist/L/system.js +6 -4
  78. package/dist/L/system.js.map +1 -1
  79. package/dist/L/thread.d.ts +1 -4
  80. package/dist/L/thread.js +5 -7
  81. package/dist/L/thread.js.map +1 -1
  82. package/dist/L/toolkit.js +2 -2
  83. package/dist/L/user.d.ts +5 -3
  84. package/dist/L/user.js +3 -3
  85. package/dist/L/user.js.map +1 -1
  86. package/dist/L/user.test.js.map +1 -1
  87. package/dist/LEvent.d.ts +143 -15
  88. package/dist/LEvent.js +12 -9
  89. package/dist/LEvent.js.map +1 -1
  90. package/dist/Thread.d.ts +15 -18
  91. package/dist/Thread.js +7 -13
  92. package/dist/Thread.js.map +1 -1
  93. package/dist/index.d.ts +4 -2
  94. package/dist/index.js +4 -2
  95. package/dist/index.js.map +1 -1
  96. package/dist/patterns/Route.js +2 -2
  97. package/dist/patterns/Route.js.map +1 -1
  98. package/dist/tsconfig.tsbuildinfo +1 -1
  99. package/dist/util/Taggable.d.ts +5 -4
  100. package/dist/util/Taggable.js +11 -0
  101. package/dist/util/Taggable.js.map +1 -1
  102. package/dist/util/extract.d.ts +3 -0
  103. package/dist/util/extract.js +2 -0
  104. package/dist/util/extract.js.map +1 -0
  105. package/dist/util/messageCodec.d.ts +98 -0
  106. package/dist/util/messageCodec.js +5 -0
  107. package/dist/util/messageCodec.js.map +1 -0
  108. package/dist/util/raw.d.ts +6 -0
  109. package/dist/util/raw.js +5 -0
  110. package/dist/util/raw.js.map +1 -0
  111. package/index.ts +4 -2
  112. package/package.json +22 -10
  113. package/patterns/Route.ts +5 -1
  114. package/util/Taggable.ts +30 -11
  115. package/util/extract.ts +7 -0
  116. package/util/messageCodec.ts +5 -0
  117. package/util/raw.ts +27 -0
  118. package/L/fqn.ts +0 -9
  119. package/L/raw.ts +0 -30
  120. package/L/sequence.ts +0 -9
  121. package/L/to.ts +0 -4
  122. package/LPretty.ts +0 -41
  123. package/dist/L/Self.js +0 -4
  124. package/dist/L/Self.js.map +0 -1
  125. package/dist/L/fqn.d.ts +0 -3
  126. package/dist/L/fqn.js +0 -8
  127. package/dist/L/fqn.js.map +0 -1
  128. package/dist/L/raw.d.ts +0 -3
  129. package/dist/L/raw.js +0 -18
  130. package/dist/L/raw.js.map +0 -1
  131. package/dist/L/sequence.d.ts +0 -2
  132. package/dist/L/sequence.js +0 -5
  133. package/dist/L/sequence.js.map +0 -1
  134. package/dist/L/to.d.ts +0 -3
  135. package/dist/L/to.js +0 -3
  136. package/dist/L/to.js.map +0 -1
  137. package/dist/L/userJson.js.map +0 -1
  138. package/dist/LPretty.d.ts +0 -4
  139. package/dist/LPretty.js +0 -37
  140. package/dist/LPretty.js.map +0 -1
  141. package/dist/util/Sequencer.d.ts +0 -4
  142. package/dist/util/Sequencer.js +0 -2
  143. package/dist/util/Sequencer.js.map +0 -1
  144. package/util/Sequencer.ts +0 -13
  145. /package/dist/L/{handle.d.ts → listen.d.ts} +0 -0
@@ -1,5 +1,5 @@
1
+ import * as Effect from "effect/Effect";
1
2
  import * as Option from "effect/Option";
2
- import type { Thread } from "../Thread.ts";
3
- import type { Taggable } from "../util/Taggable.ts";
3
+ import { type TaggableArg0, type TaggableArgRest } from "../util/Taggable.ts";
4
4
  /** Set the thread's system instruction. */
5
- export declare const system: Taggable<Option.Option<string>, never, Thread>;
5
+ export declare const system: <A0 extends TaggableArg0, ARest extends TaggableArgRest<A0>>(a0: A0, ...aRest: ARest) => Effect.Effect<Option.Option<string>, import("../util/extract.ts").ExtractE<A0 | ARest[number]>, import("../Thread.ts").Thread | import("../util/extract.ts").ExtractR<A0 | ARest[number]>>;
package/dist/L/system.js CHANGED
@@ -1,12 +1,14 @@
1
1
  import * as Effect from "effect/Effect";
2
2
  import * as Option from "effect/Option";
3
- import { raw } from "./raw.js";
4
- import { Self } from "./Self.js";
3
+ import { SystemSetEvent } from "../LEvent.js";
4
+ import { normalize } from "../util/Taggable.js";
5
+ import { self } from "./self.js";
5
6
  /** Set the thread's system instruction. */
6
7
  export const system = Effect.fnUntraced(function* (a0, ...aRest) {
7
- const { state } = yield* Self;
8
+ const { state, events } = yield* self;
8
9
  const { system } = state;
9
- state.system = a0 ? Option.some(yield* raw(a0, ...aRest)) : Option.none();
10
+ state.system = a0 ? Option.some(yield* normalize(a0, ...aRest)) : Option.none();
11
+ yield* events.publish(new SystemSetEvent({ system: state.system }));
10
12
  return system;
11
13
  });
12
14
  //# sourceMappingURL=system.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"system.js","sourceRoot":"","sources":["../../L/system.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAGvC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAA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CAAC,MAAM,CAAC,IAAI,EAAE,CAAA;IAC/E,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,cAAc,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;IACnE,OAAO,MAAM,CAAA;AACf,CAAC,CAAC,CAAA"}
@@ -1,6 +1,3 @@
1
1
  import * as Effect from "effect/Effect";
2
2
  import { Thread } from "../Thread.ts";
3
- import type { Sequencer } from "../util/Sequencer.ts";
4
- export interface thread extends Sequencer<Thread>, Effect.Effect<Thread> {
5
- }
6
- export declare const thread: thread;
3
+ export declare const thread: Effect.Effect<Thread>;
package/dist/L/thread.js CHANGED
@@ -1,17 +1,15 @@
1
1
  import * as Effect from "effect/Effect";
2
- import { flow } from "effect/Function";
3
2
  import * as Option from "effect/Option";
4
3
  import * as PubSub from "effect/PubSub";
5
- import { Thread, ThreadState } from "../Thread.js";
6
- import { Self } from "./Self.js";
7
- import { sequence } from "./sequence.js";
8
- const thread_ = Effect.gen(function* () {
4
+ import { Thread, ThreadId, ThreadState } from "../Thread.js";
5
+ import { self } from "./self.js";
6
+ export const thread = Effect.gen(function* () {
9
7
  return Thread({
10
- parent: yield* Effect.serviceOption(Self),
8
+ id: ThreadId.make(crypto.randomUUID()),
9
+ parent: yield* Effect.serviceOption(self),
11
10
  events: yield* PubSub.unbounded(),
12
11
  state: ThreadState.default(),
13
12
  tools: Option.none(),
14
13
  });
15
14
  });
16
- export const thread = Object.assign(flow(sequence, Effect.provideServiceEffect(Self, thread_)), thread_);
17
15
  //# sourceMappingURL=thread.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"thread.js","sourceRoot":"","sources":["../../L/thread.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACtC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,MAAM,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CAAC,IAAI,CAAC;QACzC,MAAM,EAAE,KAAK,CAAC,CAAC,MAAM,CAAC,SAAS,EAAU;QACzC,KAAK,EAAE,WAAW,CAAC,OAAO,EAAE;QAC5B,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE;KACrB,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
package/dist/L/toolkit.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as AiToolkit from "@effect/ai/AiToolkit";
2
2
  import * as Effect from "effect/Effect";
3
3
  import * as Option from "effect/Option";
4
- import { Self } from "./Self.js";
5
- export const toolkit = Self.pipe(Effect.flatMap(({ tools }) => Option.match(tools, {
4
+ import { self } from "./self.js";
5
+ export const toolkit = self.pipe(Effect.flatMap(({ tools }) => Option.match(tools, {
6
6
  onSome: (tools) => AiToolkit.make(...tools),
7
7
  onNone: () => AiToolkit.make(),
8
8
  })));
package/dist/L/user.d.ts CHANGED
@@ -1,4 +1,6 @@
1
+ import * as Effect from "effect/Effect";
1
2
  import type { Thread } from "../Thread.ts";
2
- import type { Taggable } from "../util/Taggable.ts";
3
- /** Append a user message to the conversation. */
4
- export declare const user: Taggable<void, never, Thread>;
3
+ import type { ExtractE, ExtractR } from "../util/extract.ts";
4
+ import { type TaggableArg0, type TaggableArgRest } from "../util/Taggable.ts";
5
+ /** Append a user message to the thread. */
6
+ export declare const user: <A0 extends TaggableArg0, ARest extends TaggableArgRest<A0>>(a0: A0, ...aRest: ARest) => Effect.Effect<void, ExtractE<A0 | ARest[number]>, ExtractR<A0 | ARest[number]> | Thread>;
package/dist/L/user.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { TextPart, UserMessage } from "@effect/ai/AiInput";
2
2
  import * as Effect from "effect/Effect";
3
+ import { normalize } from "../util/Taggable.js";
3
4
  import { append } from "./append.js";
4
- import { raw } from "./raw.js";
5
- /** Append a user message to the conversation. */
6
- export const user = (a0, ...aRest) => raw(a0, ...aRest).pipe(Effect.flatMap((text) => text
5
+ /** Append a user message to the thread. */
6
+ export const user = (a0, ...aRest) => normalize(a0, ...aRest).pipe(Effect.flatMap((text) => text
7
7
  ? append(UserMessage.make({
8
8
  parts: [
9
9
  TextPart.make({ text }),
@@ -1 +1 @@
1
- {"version":3,"file":"user.js","sourceRoot":"","sources":["../../L/user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAGvC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAE9B,iDAAiD;AACjD,MAAM,CAAC,MAAM,IAAI,GAAkC,CAAC,EAAE,EAAE,GAAG,KAAK,EAAE,EAAE,CAClE,GAAG,CAAC,EAAE,EAAE,GAAG,KAAK,CAAC,CAAC,IAAI,CACpB,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CACtB,IAAI;IACF,CAAC,CAAC,MAAM,CACN,WAAW,CAAC,IAAI,CAAC;QACf,KAAK,EAAE;YACL,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC;SACxB;KACF,CAAC,CACH;IACD,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAC9B,CACF,CAAA"}
1
+ {"version":3,"file":"user.js","sourceRoot":"","sources":["../../L/user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAGvC,OAAO,EAAE,SAAS,EAA2C,MAAM,qBAAqB,CAAA;AACxF,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,2CAA2C;AAC3C,MAAM,CAAC,MAAM,IAAI,GAAG,CAIlB,EAAM,EACN,GAAG,KAAY,EAKf,EAAE,CACF,SAAS,CAAC,EAAE,EAAE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SACF,CAAC;KACH,CAAC,CAAA;AACJ,CAAC,CAAC,CAAC,IAAI,CACL,MAAM,CACP,CAAC,CAAA"}
1
+ {"version":3,"file":"user.test.js","sourceRoot":"","sources":["../../L/user.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,EAAE,CAAC,MAAM,CAAC,cAAc,EAAE,GAAG,EAAE,CAC7B,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,KAAK,CAAC,CAAC,IAAI,CAAA,GAAG,CAAA;IACd,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAChB,MAAM,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,aAAa,CAAC;QACpC,WAAW,CAAC,IAAI,CAAC;YACf,KAAK,EAAE;gBACL,QAAQ,CAAC,IAAI,CAAC;oBACZ,IAAI,EAAE,GAAG;iBACV,CAAC;aACH;SACF,CAAC;QACF,WAAW,CAAC,IAAI,CAAC;YACf,KAAK,EAAE;gBACL,QAAQ,CAAC,IAAI,CAAC;oBACZ,IAAI,EAAE,GAAG;iBACV,CAAC;aACH;SACF,CAAC;KACH,CAAC,CAAA;AACJ,CAAC,CAAC,CAAC,IAAI,CACL,OAAO,CACL,MAAM,CACP,CACF,CAAC,CAAA"}
package/dist/LEvent.d.ts CHANGED
@@ -1,26 +1,154 @@
1
1
  import * as Schema from "effect/Schema";
2
- declare const Messages_base: Schema.Array$<Schema.Union<[typeof import("@effect/ai/AiInput").UserMessage, typeof import("@effect/ai/AiInput").AssistantMessage, typeof import("@effect/ai/AiInput").ToolMessage]>>;
3
- export declare class Messages extends Messages_base {
4
- }
5
- declare const MessagesAppended_base: Schema.TaggedClass<MessagesAppended, "MessagesAppended", {
6
- readonly _tag: Schema.tag<"MessagesAppended">;
2
+ declare const SystemSetEvent_base: Schema.TaggedClass<SystemSetEvent, "system_set", {
3
+ readonly _tag: Schema.tag<"system_set">;
7
4
  } & {
8
- messages: typeof Messages;
5
+ system: Schema.Option<typeof Schema.String>;
9
6
  }>;
10
- /** An event in which one or more messages were added to the thread. */
11
- export declare class MessagesAppended extends MessagesAppended_base {
7
+ /** Event in which the thread's system is set to a new string. */
8
+ export declare class SystemSetEvent extends SystemSetEvent_base {
12
9
  }
13
- declare const MessagesCleared_base: Schema.TaggedClass<MessagesCleared, "MessagesCleared", {
14
- readonly _tag: Schema.tag<"MessagesCleared">;
10
+ declare const MessagesAppendedEvent_base: Schema.TaggedClass<MessagesAppendedEvent, "messages_appended", {
11
+ readonly _tag: Schema.tag<"messages_appended">;
15
12
  } & {
16
- cleared: typeof Messages;
13
+ messages: Schema.Array$<Schema.Union<[typeof import("@effect/ai/AiInput").UserMessage, typeof import("@effect/ai/AiInput").AssistantMessage, typeof import("@effect/ai/AiInput").ToolMessage]>>;
14
+ }>;
15
+ /** Event in which one or more messages were added to the thread. */
16
+ export declare class MessagesAppendedEvent extends MessagesAppendedEvent_base {
17
+ }
18
+ declare const ThreadClearedEvent_base: Schema.TaggedClass<ThreadClearedEvent, "messages_cleared", {
19
+ readonly _tag: Schema.tag<"messages_cleared">;
17
20
  }>;
18
- /** An event in which the thread is cleared of messages. */
19
- export declare class MessagesCleared extends MessagesCleared_base {
21
+ /** Event in which the thread is cleared of messages. */
22
+ export declare class ThreadClearedEvent extends ThreadClearedEvent_base {
20
23
  }
21
24
  export type LEvent = typeof LEvent["Type"];
22
25
  export declare const LEvent: Schema.Union<[
23
- typeof MessagesAppended,
24
- typeof MessagesCleared
26
+ typeof SystemSetEvent,
27
+ typeof MessagesAppendedEvent,
28
+ typeof ThreadClearedEvent
25
29
  ]>;
30
+ export declare const encodeLEvent: (a: SystemSetEvent | MessagesAppendedEvent | ThreadClearedEvent, overrideOptions?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<{
31
+ readonly _tag: "system_set";
32
+ readonly system: {
33
+ readonly _tag: "None";
34
+ } | {
35
+ readonly _tag: "Some";
36
+ readonly value: string;
37
+ };
38
+ } | {
39
+ readonly _tag: "messages_appended";
40
+ readonly messages: readonly ({
41
+ readonly _tag: "UserMessage";
42
+ readonly parts: readonly ({
43
+ readonly _tag: "TextPart";
44
+ readonly text: string;
45
+ } | {
46
+ readonly _tag: "ImagePart";
47
+ readonly data: string;
48
+ readonly mediaType?: string | undefined;
49
+ } | {
50
+ readonly _tag: "ImageUrlPart";
51
+ readonly url: string;
52
+ } | {
53
+ readonly _tag: "FilePart";
54
+ readonly data: string;
55
+ readonly name?: string | undefined;
56
+ readonly mediaType?: string | undefined;
57
+ } | {
58
+ readonly _tag: "FileUrlPart";
59
+ readonly url: string;
60
+ })[];
61
+ readonly userName?: string | undefined;
62
+ } | {
63
+ readonly _tag: "AssistantMessage";
64
+ readonly parts: readonly ({
65
+ readonly _tag: "TextPart";
66
+ readonly text: string;
67
+ } | {
68
+ readonly _tag: "ReasoningPart";
69
+ readonly reasoningText: string;
70
+ readonly signature?: string | undefined;
71
+ } | {
72
+ readonly _tag: "RedactedReasoningPart";
73
+ readonly redactedText: string;
74
+ } | {
75
+ readonly _tag: "ToolCallPart";
76
+ readonly name: string;
77
+ readonly id: string;
78
+ readonly params: unknown;
79
+ })[];
80
+ } | {
81
+ readonly _tag: "ToolMessage";
82
+ readonly parts: readonly {
83
+ readonly _tag: "ToolCallResultPart";
84
+ readonly name: string;
85
+ readonly id: string;
86
+ readonly result: unknown;
87
+ }[];
88
+ })[];
89
+ } | {
90
+ readonly _tag: "messages_cleared";
91
+ }, import("effect/ParseResult").ParseError, never>;
92
+ export declare const decodeLEvent: (i: {
93
+ readonly _tag: "system_set";
94
+ readonly system: {
95
+ readonly _tag: "None";
96
+ } | {
97
+ readonly _tag: "Some";
98
+ readonly value: string;
99
+ };
100
+ } | {
101
+ readonly _tag: "messages_appended";
102
+ readonly messages: readonly ({
103
+ readonly _tag: "UserMessage";
104
+ readonly parts: readonly ({
105
+ readonly _tag: "TextPart";
106
+ readonly text: string;
107
+ } | {
108
+ readonly _tag: "ImagePart";
109
+ readonly data: string;
110
+ readonly mediaType?: string | undefined;
111
+ } | {
112
+ readonly _tag: "ImageUrlPart";
113
+ readonly url: string;
114
+ } | {
115
+ readonly _tag: "FilePart";
116
+ readonly data: string;
117
+ readonly name?: string | undefined;
118
+ readonly mediaType?: string | undefined;
119
+ } | {
120
+ readonly _tag: "FileUrlPart";
121
+ readonly url: string;
122
+ })[];
123
+ readonly userName?: string | undefined;
124
+ } | {
125
+ readonly _tag: "AssistantMessage";
126
+ readonly parts: readonly ({
127
+ readonly _tag: "TextPart";
128
+ readonly text: string;
129
+ } | {
130
+ readonly _tag: "ReasoningPart";
131
+ readonly reasoningText: string;
132
+ readonly signature?: string | undefined;
133
+ } | {
134
+ readonly _tag: "RedactedReasoningPart";
135
+ readonly redactedText: string;
136
+ } | {
137
+ readonly _tag: "ToolCallPart";
138
+ readonly name: string;
139
+ readonly id: string;
140
+ readonly params: unknown;
141
+ })[];
142
+ } | {
143
+ readonly _tag: "ToolMessage";
144
+ readonly parts: readonly {
145
+ readonly _tag: "ToolCallResultPart";
146
+ readonly name: string;
147
+ readonly id: string;
148
+ readonly result: unknown;
149
+ }[];
150
+ })[];
151
+ } | {
152
+ readonly _tag: "messages_cleared";
153
+ }, overrideOptions?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<SystemSetEvent | MessagesAppendedEvent | ThreadClearedEvent, import("effect/ParseResult").ParseError, never>;
26
154
  export {};
package/dist/LEvent.js CHANGED
@@ -1,16 +1,19 @@
1
1
  import { Message } from "@effect/ai/AiInput";
2
2
  import * as Schema from "effect/Schema";
3
- export class Messages extends Schema.Array(Message) {
4
- }
5
- /** An event in which one or more messages were added to the thread. */
6
- export class MessagesAppended extends Schema.TaggedClass("MessagesAppended")("MessagesAppended", {
7
- messages: Messages,
3
+ /** Event in which the thread's system is set to a new string. */
4
+ export class SystemSetEvent extends Schema.TaggedClass("SystemSetEvent")("system_set", {
5
+ system: Schema.Option(Schema.String),
8
6
  }) {
9
7
  }
10
- /** An event in which the thread is cleared of messages. */
11
- export class MessagesCleared extends Schema.TaggedClass("MessagesCleared")("MessagesCleared", {
12
- cleared: Messages,
8
+ /** Event in which one or more messages were added to the thread. */
9
+ export class MessagesAppendedEvent extends Schema.TaggedClass("MessagesAppendedEvent")("messages_appended", {
10
+ messages: Schema.Array(Message),
13
11
  }) {
14
12
  }
15
- export const LEvent = Schema.Union(MessagesAppended, MessagesCleared);
13
+ /** Event in which the thread is cleared of messages. */
14
+ export class ThreadClearedEvent extends Schema.TaggedClass("MessagesClearedEvent")("messages_cleared", {}) {
15
+ }
16
+ export const LEvent = Schema.Union(SystemSetEvent, MessagesAppendedEvent, ThreadClearedEvent);
17
+ export const encodeLEvent = Schema.encode(LEvent);
18
+ export const decodeLEvent = Schema.decode(LEvent);
16
19
  //# sourceMappingURL=LEvent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LEvent.js","sourceRoot":"","sources":["../LEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,MAAM,OAAO,QAAS,SAAQ,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC;CAAG;AAEtD,uEAAuE;AACvE,MAAM,OAAO,gBAAiB,SAAQ,MAAM,CAAC,WAAW,CAAmB,kBAAkB,CAAC,CAAC,kBAAkB,EAAE;IACjH,QAAQ,EAAE,QAAQ;CACnB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ect/Brand";
2
+ import * as Effect from "effect/Effect";
1
3
  import * as Option from "effect/Option";
2
- import { type Pipeable } from "effect/Pipeable";
3
4
  import * as PubSub from "effect/PubSub";
4
5
  import * as Schema from "effect/Schema";
5
6
  import type { Mutable } from "effect/Types";
7
+ import { line } from "./L/line.ts";
6
8
  import type { LEvent } from "./LEvent.ts";
7
9
  import type { NeverTool } from "./util/NeverTool.ts";
8
- import type { Sequencer } from "./util/Sequencer.ts";
9
- export declare const ThreadFqnTypeId: unique symbol;
10
- export declare const ThreadFqn: Schema.brand<typeof Schema.String, typeof ThreadFqnTypeId>;
11
- export type ThreadFqn = typeof ThreadFqn["Type"];
10
+ export declare const ThreadIdTypeId: unique symbol;
11
+ export type ThreadId = string & Brand.Brand<typeof ThreadIdTypeId>;
12
+ export declare const ThreadId: Schema.brand<typeof Schema.String, typeof ThreadIdTypeId>;
12
13
  declare const ThreadState_base: Schema.Class<ThreadState, {
13
- /** The key with which the thread is referenced by others. */
14
- fqn: Schema.Option<Schema.brand<typeof Schema.String, typeof ThreadFqnTypeId>>;
15
14
  /** The system prompt to be passed along to the model. */
16
15
  system: Schema.Option<typeof Schema.String>;
17
16
  /** The messages based off of which the model infers the next message. */
18
17
  messages: Schema.mutable<Schema.Array$<Schema.Union<[typeof import("@effect/ai/AiInput").UserMessage, typeof import("@effect/ai/AiInput").AssistantMessage, typeof import("@effect/ai/AiInput").ToolMessage]>>>;
19
18
  }, Schema.Struct.Encoded<{
20
- /** The key with which the thread is referenced by others. */
21
- fqn: Schema.Option<Schema.brand<typeof Schema.String, typeof ThreadFqnTypeId>>;
22
19
  /** The system prompt to be passed along to the model. */
23
20
  system: Schema.Option<typeof Schema.String>;
24
21
  /** The messages based off of which the model infers the next message. */
25
22
  messages: Schema.mutable<Schema.Array$<Schema.Union<[typeof import("@effect/ai/AiInput").UserMessage, typeof import("@effect/ai/AiInput").AssistantMessage, typeof import("@effect/ai/AiInput").ToolMessage]>>>;
26
23
  }>, never, {
27
- readonly messages: (import("@effect/ai/AiInput").UserMessage | import("@effect/ai/AiInput").AssistantMessage | import("@effect/ai/AiInput").ToolMessage)[];
28
- } & {
29
- readonly fqn: Option.Option<string & import("effect/Brand").Brand<typeof ThreadFqnTypeId>>;
30
- } & {
31
24
  readonly system: Option.Option<string>;
25
+ } & {
26
+ readonly messages: (import("@effect/ai/AiInput").UserMessage | import("@effect/ai/AiInput").AssistantMessage | import("@effect/ai/AiInput").ToolMessage)[];
32
27
  }, {}, {}>;
33
28
  export declare class ThreadState extends ThreadState_base {
34
29
  static default: () => ThreadState;
35
30
  }
36
31
  export interface ThreadInit {
32
+ /** The unique id of the thread. */
33
+ readonly id: ThreadId;
37
34
  /** The parent thread. */
38
- parent: Option.Option<Thread>;
35
+ readonly parent: Option.Option<Thread>;
39
36
  /** The pubsub with which thread-specific events are emitted. */
40
- events: PubSub.PubSub<LEvent>;
37
+ readonly events: PubSub.PubSub<LEvent>;
41
38
  /** The state of the current thread. */
42
- state: Mutable<ThreadState>;
39
+ readonly state: Mutable<ThreadState>;
43
40
  /** The tools to be made accessible to the model. */
44
41
  tools: Option.Option<Set<NeverTool>>;
45
42
  }
46
43
  export declare const ThreadTypeId: unique symbol;
47
44
  export type ThreadTypeId = typeof ThreadTypeId;
48
- interface ThreadMembers extends ThreadInit, Pipeable {
45
+ interface ThreadMembers extends ThreadInit {
49
46
  readonly [ThreadTypeId]: ThreadTypeId;
50
47
  }
51
48
  /** A conversation isolate. */
52
- export interface Thread extends Sequencer<Thread>, ThreadMembers {
49
+ export interface Thread extends line<Thread>, ThreadMembers, Effect.Effect<ThreadId> {
53
50
  }
54
51
  export declare const Thread: (init: ThreadInit) => Thread;
55
52
  export {};
package/dist/Thread.js CHANGED
@@ -1,24 +1,21 @@
1
1
  import { Message } from "@effect/ai/AiInput";
2
+ import * as Brand from "effect/Brand";
2
3
  import * as Effect from "effect/Effect";
3
4
  import * as Option from "effect/Option";
4
- import { pipeArguments } from "effect/Pipeable";
5
5
  import * as PubSub from "effect/PubSub";
6
6
  import * as Schema from "effect/Schema";
7
- import { Self } from "./L/Self.js";
8
- import { sequence } from "./L/sequence.js";
7
+ import { line } from "./L/line.js";
8
+ import { self } from "./L/self.js";
9
9
  import { prefix } from "./util/prefix.js";
10
- export const ThreadFqnTypeId = Symbol.for(prefix("ThreadFqn"));
11
- export const ThreadFqn = Schema.String.pipe(Schema.brand(ThreadFqnTypeId));
10
+ export const ThreadIdTypeId = Symbol.for(prefix("ThreadNameTypeId"));
11
+ export const ThreadId = Schema.String.pipe(Schema.brand(ThreadIdTypeId));
12
12
  export class ThreadState extends Schema.Class(prefix("ThreadState"))({
13
- /** The key with which the thread is referenced by others. */
14
- fqn: Schema.Option(ThreadFqn),
15
13
  /** The system prompt to be passed along to the model. */
16
14
  system: Schema.Option(Schema.String),
17
15
  /** The messages based off of which the model infers the next message. */
18
16
  messages: Schema.Array(Message).pipe(Schema.mutable),
19
17
  }) {
20
18
  static default = () => ThreadState.make({
21
- fqn: Option.none(),
22
19
  system: Option.none(),
23
20
  messages: [],
24
21
  });
@@ -28,11 +25,8 @@ export const Thread = (init) => {
28
25
  const members = {
29
26
  [ThreadTypeId]: ThreadTypeId,
30
27
  ...init,
31
- pipe() {
32
- return pipeArguments(self, arguments);
33
- },
34
28
  };
35
- const self = Object.assign(((...args) => sequence(...args).pipe(Effect.provideService(Self, self))), members);
36
- return self;
29
+ const self_ = Object.assign(((...args) => line(...args).pipe(Effect.provideService(self, self_))), Effect.succeed(init.id), members);
30
+ return self_;
37
31
  };
38
32
  //# sourceMappingURL=Thread.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Thread.js","sourceRoot":"","sources":["../Thread.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EAAiB,aAAa,EAAE,MAAM,iBAAiB,CAAA;A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,MAAM,CAAC,MAAM,CAAC;IACpC,yEAAyE;IACzE,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;CACrD,CAAC;IACA,MAAM,CAAC,OAAO,GAAG,GAAgB,EAAE,CACjC,WAAW,CAAC,IAAI,CAAC;QACf,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE;QACrB,QAAQ,EAAE,EAAE;KACb,CAAC,CAAA;;AAgBN,MAAM,CAAC,MAAM,YAAY,GAAkB,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAA;AAUvE,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,IAAgB,EAAU,EAAE;IACjD,MAAM,OAAO,GAAG;QACd,CAAC,YAAY,CAAC,EAAE,YAAY;QAC5B,GAAG,IAAI;KACgB,CAAA;IACzB,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CACzB,CAAC,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAwB,EAC5F,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,EACvB,OAAO,CACE,CAAA;IACX,OAAO,KAAK,CAAA;AACd,CAAC,CAAA"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
+ export * from "./Digest.ts";
1
2
  export * from "./Envelope.ts";
2
- export * as default from "./L/L.ts";
3
+ export * as F from "./F/F.ts";
4
+ export * as L from "./L/L.ts";
3
5
  export * from "./LEvent.ts";
4
- export * as LPretty from "./LPretty.ts";
5
6
  export * from "./Thread.ts";
7
+ export * as messageCodec from "./util/messageCodec.ts";
package/dist/index.js CHANGED
@@ -1,6 +1,8 @@
1
+ export * from "./Digest.js";
1
2
  export * from "./Envelope.js";
2
- export * as default from "./L/L.js";
3
+ export * as F from "./F/F.js";
4
+ export * as L from "./L/L.js";
3
5
  export * from "./LEvent.js";
4
- export * as LPretty from "./LPretty.js";
5
6
  export * from "./Thread.js";
7
+ export * as messageCodec from "./util/messageCodec.js";
6
8
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,OAAO,KAAK,OAAO,MAAM,UAAU,CAAA;AACnC,cAAc,aAAa,CAAA;AAC3B,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,cAAc,aAAa,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,OAAO,KAAK,CAAC,MAAM,UAAU,CAAA;AAC7B,OAAO,KAAK,CAAC,MAAM,UAAU,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,OAAO,KAAK,YAAY,MAAM,wBAAwB,CAAA"}
@@ -4,11 +4,11 @@ import * as L from "../L/L.js";
4
4
  import { Thread } from "../Thread.js";
5
5
  export const byDescription = Effect.fnUntraced(function* (routes) {
6
6
  const descriptions = Object.keys(routes);
7
- const description = yield* L.branch(L.user `
7
+ const description = yield* L.line(L.user `
8
8
  Which of the following descriptions best matches the current conversation?
9
9
 
10
10
  - ${descriptions.join("\n -")}
11
- `, L.assistantSchema(Schema.Literal(...descriptions)));
11
+ `, L.assistantSchema(Schema.Literal(...descriptions))).pipe(L.provide(L.branch));
12
12
  return yield* routes[description];
13
13
  });
14
14
  //# sourceMappingURL=Route.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Route.js","sourceRoot":"","sources":["../../patterns/Route.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,MAA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