liminal 0.11.1 → 0.13.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 (123) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/L.ts +5 -4
  3. package/{pretty.ts → LPretty.ts} +3 -3
  4. package/Strand.ts +24 -4
  5. package/append.ts +1 -1
  6. package/assistant.ts +3 -1
  7. package/assistantSchema.ts +60 -0
  8. package/assistantStream.ts +25 -0
  9. package/branch.ts +3 -3
  10. package/clear.ts +1 -1
  11. package/disable.ts +5 -0
  12. package/dist/L.d.ts +5 -4
  13. package/dist/L.js +5 -4
  14. package/dist/L.js.map +1 -1
  15. package/dist/LPretty.d.ts +4 -0
  16. package/dist/{pretty.js → LPretty.js} +4 -4
  17. package/dist/LPretty.js.map +1 -0
  18. package/dist/Strand.d.ts +9 -3
  19. package/dist/Strand.js +11 -1
  20. package/dist/Strand.js.map +1 -1
  21. package/dist/append.d.ts +1 -1
  22. package/dist/append.js +0 -1
  23. package/dist/append.js.map +1 -1
  24. package/dist/assistant.js +3 -1
  25. package/dist/assistant.js.map +1 -1
  26. package/dist/{assistantStruct.d.ts → assistantSchema.d.ts} +3 -2
  27. package/dist/assistantSchema.js +44 -0
  28. package/dist/assistantSchema.js.map +1 -0
  29. package/dist/assistantStream.d.ts +7 -0
  30. package/dist/assistantStream.js +17 -0
  31. package/dist/assistantStream.js.map +1 -0
  32. package/dist/branch.d.ts +1 -1
  33. package/dist/branch.js +2 -2
  34. package/dist/branch.js.map +1 -1
  35. package/dist/clear.d.ts +1 -1
  36. package/dist/clear.js +0 -1
  37. package/dist/clear.js.map +1 -1
  38. package/dist/disable.d.ts +4 -0
  39. package/dist/disable.js +3 -0
  40. package/dist/disable.js.map +1 -0
  41. package/dist/enable.d.ts +5 -0
  42. package/dist/enable.js +3 -0
  43. package/dist/enable.js.map +1 -0
  44. package/dist/events.d.ts +2 -2
  45. package/dist/events.js +2 -2
  46. package/dist/events.js.map +1 -1
  47. package/dist/handle.d.ts +7 -0
  48. package/dist/handle.js +14 -0
  49. package/dist/handle.js.map +1 -0
  50. package/dist/index.d.ts +1 -1
  51. package/dist/index.js +1 -1
  52. package/dist/index.js.map +1 -1
  53. package/dist/sequence.d.ts +2 -0
  54. package/dist/{sequence_.js → sequence.js} +1 -1
  55. package/dist/sequence.js.map +1 -0
  56. package/dist/strand_.d.ts +1 -1
  57. package/dist/strand_.js +3 -13
  58. package/dist/strand_.js.map +1 -1
  59. package/dist/system.d.ts +3 -3
  60. package/dist/system.js +3 -2
  61. package/dist/system.js.map +1 -1
  62. package/dist/tsconfig.tsbuildinfo +1 -1
  63. package/dist/user.d.ts +3 -4
  64. package/dist/user.js +8 -9
  65. package/dist/user.js.map +1 -1
  66. package/dist/user.test.js.map +1 -0
  67. package/dist/userJson.d.ts +4 -4
  68. package/dist/userJson.js +5 -4
  69. package/dist/userJson.js.map +1 -1
  70. package/dist/{internal → util}/JsonValue.d.ts +3 -0
  71. package/dist/util/JsonValue.js +109 -0
  72. package/dist/util/JsonValue.js.map +1 -0
  73. package/dist/util/Sequence.d.ts +2 -0
  74. package/dist/util/Sequence.js +2 -0
  75. package/dist/util/Sequence.js.map +1 -0
  76. package/dist/util/Taggable.d.ts +6 -0
  77. package/dist/util/Taggable.js +24 -0
  78. package/dist/util/Taggable.js.map +1 -0
  79. package/dist/util/fixRaw.d.ts +4 -0
  80. package/dist/util/fixRaw.js +75 -0
  81. package/dist/util/fixRaw.js.map +1 -0
  82. package/enable.ts +8 -0
  83. package/events.ts +5 -4
  84. package/handle.ts +25 -0
  85. package/index.ts +1 -1
  86. package/package.json +4 -4
  87. package/{sequence_.ts → sequence.ts} +1 -1
  88. package/strand_.ts +3 -17
  89. package/system.ts +8 -9
  90. package/user.test.ts +30 -0
  91. package/user.ts +15 -11
  92. package/userJson.ts +9 -7
  93. package/util/JsonValue.ts +144 -0
  94. package/util/Sequence.ts +9 -0
  95. package/util/Taggable.ts +52 -0
  96. package/util/fixRaw.ts +93 -0
  97. package/Sequence.ts +0 -14
  98. package/assistantStruct.ts +0 -34
  99. package/dist/Sequence.d.ts +0 -2
  100. package/dist/Sequence.js +0 -2
  101. package/dist/Sequence.js.map +0 -1
  102. package/dist/assistantStruct.js +0 -22
  103. package/dist/assistantStruct.js.map +0 -1
  104. package/dist/internal/JsonValue.js +0 -2
  105. package/dist/internal/JsonValue.js.map +0 -1
  106. package/dist/internal/Taggable.d.ts +0 -11
  107. package/dist/internal/Taggable.js +0 -2
  108. package/dist/internal/Taggable.js.map +0 -1
  109. package/dist/pretty.d.ts +0 -2
  110. package/dist/pretty.js.map +0 -1
  111. package/dist/reduce.d.ts +0 -4
  112. package/dist/reduce.js +0 -20
  113. package/dist/reduce.js.map +0 -1
  114. package/dist/sequence_.d.ts +0 -2
  115. package/dist/sequence_.js.map +0 -1
  116. package/dist/todo.test.js +0 -3
  117. package/dist/todo.test.js.map +0 -1
  118. package/internal/JsonValue.ts +0 -5
  119. package/internal/Taggable.ts +0 -17
  120. package/reduce.ts +0 -32
  121. package/todo.test.ts +0 -3
  122. package/tsconfig.json +0 -18
  123. /package/dist/{todo.test.d.ts → user.test.d.ts} +0 -0
@@ -0,0 +1,144 @@
1
+ import * as Effect from "effect/Effect"
2
+ import { pipe } from "effect/Function"
3
+ import * as Option from "effect/Option"
4
+ import * as Schema from "effect/Schema"
5
+ import * as SchemaAST from "effect/SchemaAST"
6
+
7
+ export type JsonValue = null | boolean | number | string | JsonValueArray | JsonValueObject
8
+
9
+ export type JsonValueArray = Array<JsonValue> | ReadonlyArray<JsonValue>
10
+
11
+ export type JsonValueObject = { [key: string]: JsonValue }
12
+
13
+ export const encodeJsonc: <A, I extends JsonValue>(
14
+ schema: Schema.Schema<A, I>,
15
+ ) => (value: A) => Effect.Effect<string> = (schema) => {
16
+ const encoder = encodeAst(SchemaAST.encodedBoundAST(schema.ast))
17
+ return (value) => encoder(value, new EncodeJsoncContext(0))
18
+ }
19
+
20
+ class EncodeJsoncContext {
21
+ readonly depth: number
22
+ readonly indentation: string
23
+ readonly childIndentation: string
24
+ constructor(depth: number) {
25
+ this.depth = depth
26
+ this.indentation = " ".repeat(depth * 2)
27
+ this.childIndentation = " ".repeat((depth + 1) * 2)
28
+ }
29
+
30
+ next = () => new EncodeJsoncContext(this.depth + 1)
31
+
32
+ comment = (type: SchemaAST.AST): string =>
33
+ Option.match(SchemaAST.getDescriptionAnnotation(type), {
34
+ onSome: (v) => {
35
+ v = v.trim()
36
+ if (v) {
37
+ return `// ${v}\n${this.childIndentation}`
38
+ }
39
+ return ""
40
+ },
41
+ onNone: () => "",
42
+ })
43
+ }
44
+
45
+ const encodeAst: (
46
+ ast: SchemaAST.AST,
47
+ refinement?: SchemaAST.Refinement,
48
+ ) => (value: unknown, ctx: EncodeJsoncContext) => Effect.Effect<string> = (ast, refinement) => {
49
+ switch (ast._tag) {
50
+ case "TypeLiteral": {
51
+ return Effect.fnUntraced(function*(value, ctx) {
52
+ const props = yield* Effect.all(
53
+ ast.propertySignatures.map(
54
+ Effect.fnUntraced(function*({ name, type }) {
55
+ if (typeof name === "symbol") throw 0
56
+ const child = yield* encodeAst(type)((value as never)[name], ctx.next())
57
+ return `${ctx.comment(refinement ?? type)}${name}: ${child}`
58
+ }),
59
+ ),
60
+ ).pipe(
61
+ Effect.map((v) => v.join(`,\n${ctx.childIndentation}`)),
62
+ )
63
+ return `{\n${ctx.childIndentation}${props}\n${ctx.indentation}}`
64
+ })
65
+ }
66
+ case "StringKeyword": {
67
+ return (value) => Effect.succeed(`"${value}"`)
68
+ }
69
+ case "BooleanKeyword":
70
+ case "NumberKeyword": {
71
+ return (value) => Effect.succeed(String(value))
72
+ }
73
+ case "Refinement": {
74
+ return encodeAst(ast.from, refinement ?? ast)
75
+ }
76
+ case "UnknownKeyword":
77
+ case "AnyKeyword": {
78
+ return (value, ctx) =>
79
+ Effect.succeed(
80
+ JSON
81
+ .stringify(value, null, 2)
82
+ .split("\n")
83
+ .map((line, i) => i ? ctx.indentation.concat(line) : line)
84
+ .join("\n"),
85
+ )
86
+ }
87
+ case "Union": {
88
+ const { types } = ast
89
+ const guards = types.map((ast) =>
90
+ pipe(
91
+ ast,
92
+ Schema.make,
93
+ Schema.is,
94
+ )
95
+ )
96
+ return (value, ctx) => {
97
+ for (let i = 0; i < types.length; i++) {
98
+ const guard = guards[i]!
99
+ if (guard(value)) {
100
+ return encodeAst(types[i]!)(value, ctx)
101
+ }
102
+ }
103
+ throw 0
104
+ }
105
+ }
106
+ case "Literal": {
107
+ const { literal } = ast
108
+ const v = (() => {
109
+ switch (typeof literal) {
110
+ case "boolean":
111
+ case "number": {
112
+ return String(literal)
113
+ }
114
+ case "string": {
115
+ return `"${literal}"`
116
+ }
117
+ }
118
+ if (literal === null) {
119
+ return "null"
120
+ }
121
+ console.log({ literal })
122
+ throw 0
123
+ })()
124
+ return () => Effect.succeed(v)
125
+ }
126
+ case "TupleType": {
127
+ const { elements, rest } = ast
128
+ return (value, ctx) =>
129
+ Effect.all((elements.length ? elements : rest).map(
130
+ Effect.fnUntraced(function*(element, i) {
131
+ const child = yield* encodeAst(element.type)((value as never)[i]!, ctx.next())
132
+ return `${ctx.comment(refinement ?? element.type)}${child}`
133
+ }),
134
+ )).pipe(
135
+ Effect.map((v) => `[\n${ctx.childIndentation}${v.join(`,\n${ctx.childIndentation}`)}\n${ctx.indentation}]`),
136
+ )
137
+ }
138
+ case "Suspend": {
139
+ return encodeAst(ast.f())
140
+ }
141
+ }
142
+ console.log({ ast })
143
+ throw 0
144
+ }
@@ -0,0 +1,9 @@
1
+ import type { Effect } from "effect/Effect"
2
+
3
+ export type Sequence<I = never, O = never> = <Arg extends Array<Effect<any, any, any>>>(
4
+ ...steps: Arg
5
+ ) => Effect<
6
+ Arg extends [] ? void : Arg extends [...infer _0, infer L extends Effect<any, any, any>] ? Effect.Success<L> : never,
7
+ Effect.Error<Arg[number]>,
8
+ Exclude<Effect.Context<Arg[number]>, I> | O
9
+ >
@@ -0,0 +1,52 @@
1
+ import * as Effect from "effect/Effect"
2
+ import { fixRaw } from "./fixRaw.ts"
3
+
4
+ /** Append a user message to the conversation. */
5
+ export type Taggable<A, E, R> = <L extends Array<unknown>, E1 = never, R1 = never>(
6
+ template?:
7
+ | TemplateStringsArray
8
+ | string
9
+ | Effect.Effect<string | undefined, E1, R1>
10
+ | undefined,
11
+ ...substitutions: L
12
+ ) => Effect.Effect<
13
+ A,
14
+ ([ExtractEffect<L>] extends [never] ? never : Effect.Effect.Error<ExtractEffect<L>>) | E | E1,
15
+ ([ExtractEffect<L>] extends [never] ? never : Effect.Effect.Context<ExtractEffect<L>>) | R | R1
16
+ >
17
+
18
+ type ExtractEffect<T extends Array<unknown>> = Extract<T[number], Effect.All.EffectAny>
19
+
20
+ export const normalize: <
21
+ A0 extends
22
+ | TemplateStringsArray
23
+ | string
24
+ | Effect.Effect<string | undefined, any, any>
25
+ | undefined,
26
+ L extends Array<unknown>,
27
+ >(
28
+ a0: A0,
29
+ aRest: L,
30
+ ) => Effect.Effect<string | (undefined extends A0 ? undefined : never)> = Effect.fnUntraced(function*(a0, aRest) {
31
+ let a0_: TemplateStringsArray | string | undefined
32
+ if (Effect.isEffect(a0)) {
33
+ a0_ = yield* a0 as Effect.Effect<TemplateStringsArray | string | undefined>
34
+ } else {
35
+ a0_ = a0
36
+ }
37
+ if (!a0_) return undefined as never
38
+ const aRest_ = yield* Effect.all(
39
+ aRest.map((v) =>
40
+ Effect.isEffect(v)
41
+ ? v
42
+ : Effect.succeed(v)
43
+ ),
44
+ ) as never as Effect.Effect<Array<unknown>>
45
+ if (typeof a0_ === "string") {
46
+ if (aRest_.length === 0) {
47
+ return a0_
48
+ }
49
+ return [a0_, ...aRest_].join("")
50
+ }
51
+ return fixRaw(a0_, aRest_)
52
+ })
package/util/fixRaw.ts ADDED
@@ -0,0 +1,93 @@
1
+ const LEADING_SPACE_RE = /^([ \t]*)/
2
+ const INDENTATION_RE = /^\n([ \t]+)/
3
+ const ESCAPE_SEQ_RE = /\\([`${\\]|\n)/g
4
+ const LAST_INDENTATION_RE = /\n[ \t]+$/
5
+
6
+ export const fixRaw = (strings: TemplateStringsArray, values: Array<unknown>): string => {
7
+ const fixedStrings = fixTemplateStrings(strings)
8
+ const rawArr = fixedStrings.raw
9
+ const valuesLength = values.length
10
+
11
+ const resultParts = new Array(Math.max(1, rawArr.length * 2 - 1))
12
+ let resultIndex = 0
13
+
14
+ for (let i = 0; i < rawArr.length; i++) {
15
+ const str = rawArr[i] || ""
16
+ resultParts[resultIndex++] = str
17
+
18
+ // Only process values for non-final segments.
19
+ if (i < valuesLength) {
20
+ const value = String(values[i])
21
+
22
+ // If value has line breaks, we should indent it.
23
+ if (value.includes("\n")) {
24
+ const lastNewlineIndex = str.lastIndexOf("\n")
25
+
26
+ if (lastNewlineIndex !== -1) {
27
+ // Extract the indentation after the last newline.
28
+ const textAfterLastNewline = str.substring(lastNewlineIndex + 1)
29
+ const leadingSpaceMatch = LEADING_SPACE_RE.exec(textAfterLastNewline)
30
+ const indentationToApply = leadingSpaceMatch && leadingSpaceMatch[1] ? leadingSpaceMatch[1] : ""
31
+
32
+ if (indentationToApply) {
33
+ // Split the value into lines once.
34
+ const lines = value.split("\n")
35
+ const linesLength = lines.length
36
+
37
+ // First line doesn't need indentation.
38
+ resultParts[resultIndex++] = lines[0]
39
+
40
+ // Apply indentation to subsequent lines.
41
+ for (let j = 1; j < linesLength; j++) {
42
+ resultParts[resultIndex++] = "\n" + indentationToApply + lines[j]
43
+ }
44
+ continue
45
+ }
46
+ }
47
+ }
48
+ // For simple values or when no indentation is needed.
49
+ resultParts[resultIndex++] = value
50
+ }
51
+ }
52
+
53
+ // Combine all parts at once
54
+ return resultParts.slice(0, resultIndex).join("")
55
+ }
56
+
57
+ export const fixTemplateStrings = (template: TemplateStringsArray): {
58
+ readonly raw: readonly string[]
59
+ } => {
60
+ const leadingIndentMatch = INDENTATION_RE.exec(template.raw[0]!)
61
+ const indentation = leadingIndentMatch?.[1]
62
+
63
+ const rawLength = template.raw.length
64
+ const raw = new Array(rawLength)
65
+
66
+ for (let i = 0; i < rawLength; i++) {
67
+ let str = template.raw[i]!
68
+ // Only perform common indentation replacements if needed.
69
+ if (indentation) {
70
+ // Remove leading newline and indentation in the first segment.
71
+ if (i === 0) {
72
+ str = str.slice(indentation.length + 1)
73
+ }
74
+ // Use a simple string replacement with a regular expression for better performance.
75
+ str = str.replaceAll(`\n${indentation}`, "\n")
76
+ }
77
+
78
+ // Replace common escape sequences in a single pass.
79
+ str = str.replace(ESCAPE_SEQ_RE, (_match, char) => {
80
+ // Keep the escaped newline replacement separate for clarity.
81
+ return char === "\n" ? "" : char
82
+ })
83
+
84
+ // Handle trailing spaces only for the last segment.
85
+ if (indentation && i === rawLength - 1) {
86
+ str = str.replace(LAST_INDENTATION_RE, "")
87
+ }
88
+
89
+ raw[i] = str
90
+ }
91
+
92
+ return { raw }
93
+ }
package/Sequence.ts DELETED
@@ -1,14 +0,0 @@
1
- import * as Effect from "effect/Effect"
2
-
3
- export type Sequence<P = never, R1 = never> = <Arg extends Array<Effect.Effect<any, any, any>>>(
4
- ...steps: Arg
5
- ) => Effect.Effect<
6
- Arg extends [] ? void
7
- : [Arg extends [...infer _0, infer L] ? L : never] extends [Effect.Effect<infer A, infer _E, infer _R>] ? A
8
- : never,
9
- Arg[number] extends never ? never : [Arg[number]] extends [Effect.Effect<infer _A, infer E, infer _R>] ? E : never,
10
- Exclude<
11
- Arg[number] extends never ? never : [Arg[number]] extends [Effect.Effect<infer _A, infer _E, infer R>] ? R : never,
12
- P
13
- > | R1
14
- >
@@ -1,34 +0,0 @@
1
- import type { AiError } from "@effect/ai/AiError"
2
- import { AssistantMessage, TextPart } from "@effect/ai/AiInput"
3
- import { AiLanguageModel } from "@effect/ai/AiLanguageModel"
4
- import * as Effect from "effect/Effect"
5
- import * as Option from "effect/Option"
6
- import * as Schema from "effect/Schema"
7
- import { append } from "./append.ts"
8
- import { Strand } from "./Strand.ts"
9
-
10
- /** Infer a structured assistant message and append its JSON representation to the conversation. */
11
- export const assistantStruct: {
12
- <F extends Record<string, Schema.Schema.AnyNoContext>>(
13
- fields: F,
14
- ): Effect.Effect<{ [K in keyof F]: Schema.Schema.Type<F[K]> }, AiError, AiLanguageModel | Strand>
15
- <O, I extends Record<string, unknown>>(
16
- schema: Schema.Schema<O, I, never>,
17
- ): Effect.Effect<O, AiError, AiLanguageModel | Strand>
18
- } = Effect.fnUntraced(
19
- function*(schema) {
20
- const model = yield* AiLanguageModel
21
- const { system, messages } = yield* Strand
22
- const { value, text } = yield* model.generateObject({
23
- system: Option.getOrUndefined(system),
24
- schema: Schema.isSchema(schema) ? schema as Schema.Schema.AnyNoContext : Schema.Struct(schema),
25
- prompt: messages,
26
- })
27
- yield* append(
28
- new AssistantMessage({
29
- parts: [new TextPart({ text })],
30
- }),
31
- )
32
- return value
33
- },
34
- )
@@ -1,2 +0,0 @@
1
- import * as Effect from "effect/Effect";
2
- export type Sequence<P = never, R1 = never> = <Arg extends Array<Effect.Effect<any, any, any>>>(...steps: Arg) => Effect.Effect<Arg extends [] ? void : [Arg extends [...infer _0, infer L] ? L : never] extends [Effect.Effect<infer A, infer _E, infer _R>] ? A : never, Arg[number] extends never ? never : [Arg[number]] extends [Effect.Effect<infer _A, infer E, infer _R>] ? E : never, Exclude<Arg[number] extends never ? never : [Arg[number]] extends [Effect.Effect<infer _A, infer _E, infer R>] ? R : never, P> | R1>;
package/dist/Sequence.js DELETED
@@ -1,2 +0,0 @@
1
- import * as Effect from "effect/Effect";
2
- //# sourceMappingURL=Sequence.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Sequence.js","sourceRoot":"","sources":["../Sequence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA"}
@@ -1,22 +0,0 @@
1
- import { AssistantMessage, TextPart } from "@effect/ai/AiInput";
2
- import { AiLanguageModel } from "@effect/ai/AiLanguageModel";
3
- import * as Effect from "effect/Effect";
4
- import * as Option from "effect/Option";
5
- import * as Schema from "effect/Schema";
6
- import { append } from "./append.js";
7
- import { Strand } from "./Strand.js";
8
- /** Infer a structured assistant message and append its JSON representation to the conversation. */
9
- export const assistantStruct = Effect.fnUntraced(function* (schema) {
10
- const model = yield* AiLanguageModel;
11
- const { system, messages } = yield* Strand;
12
- const { value, text } = yield* model.generateObject({
13
- system: Option.getOrUndefined(system),
14
- schema: Schema.isSchema(schema) ? schema : Schema.Struct(schema),
15
- prompt: messages,
16
- });
17
- yield* append(new AssistantMessage({
18
- parts: [new TextPart({ text })],
19
- }));
20
- return value;
21
- });
22
- //# sourceMappingURL=assistantStruct.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"assistantStruct.js","sourceRoot":"","sources":["../assistantStruct.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAC5D,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,mGAAmG;AACnG,MAAM,CAAC,MAAM,eAAe,GAOxB,MAAM,CAAC,UAAU,CACnB,QAAQ,CAAC,EAAC,MAAM;IACd,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,eAAe,CAAA;IACpC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC,CAAC,MAAM,CAAA;IAC1C,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC;QAClD,MAAM,EAAE,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC;QACrC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAoC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;QAC9F,MAAM,EAAE,QAAQ;KACjB,CAAC,CAAA;IACF,KAAK,CAAC,CAAC,MAAM,CACX,IAAI,gBAAgB,CAAC;QACnB,KAAK,EAAE,CAAC,IAAI,QAAQ,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;KAChC,CAAC,CACH,CAAA;IACD,OAAO,KAAK,CAAA;AACd,CAAC,CACF,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=JsonValue.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"JsonValue.js","sourceRoot":"","sources":["../../internal/JsonValue.ts"],"names":[],"mappings":""}
@@ -1,11 +0,0 @@
1
- export type Taggable<T> = {
2
- (value: string): T;
3
- (template: TemplateStringsArray, ...substitutions: Array<unknown>): T;
4
- (template: string | TemplateStringsArray, ...substitutions: Array<unknown>): T;
5
- };
6
- export type TaggableNullable<T> = {
7
- (value?: string | undefined): T;
8
- (template: TemplateStringsArray, ...substitutions: Array<unknown>): T;
9
- (template?: string | TemplateStringsArray | undefined, ...substitutions: Array<unknown>): T;
10
- };
11
- export declare const normalize: <A0 extends string | TemplateStringsArray | undefined>(a0: A0, aRest?: Array<unknown>) => string | (undefined extends A0 ? undefined : never);
@@ -1,2 +0,0 @@
1
- export const normalize = (a0, aRest = []) => a0 ? typeof a0 === "string" ? a0 : String.raw(a0, aRest) : undefined;
2
- //# sourceMappingURL=Taggable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Taggable.js","sourceRoot":"","sources":["../../internal/Taggable.ts"],"names":[],"mappings":"AAYA,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,EAAM,EACN,QAAwB,EAAE,EAC2B,EAAE,CACvD,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,SAAkB,CAAA"}
package/dist/pretty.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import type { LEvent } from "./LEvent.ts";
2
- export declare const pretty: (event: typeof LEvent["Type"]) => string;
@@ -1 +0,0 @@
1
- {"version":3,"file":"pretty.js","sourceRoot":"","sources":["../pretty.ts"],"names":[],"mappings":"AAGA,MAAM,IAAI,GAAG,UAAU,CAAA;AACvB,MAAM,KAAK,GAAG,SAAS,CAAA;AACvB,MAAM,IAAI,GAAG,SAAS,CAAA;AACtB,MAAM,OAAO,GAAG,UAAU,CAAA;AAE1B,MAAM,CAAC,MAAM,MAAM,GAA6C,CAAC,KAAK,EAAE,EAAE;IACxE,IAAI,IAAI,GAAG,GAAG,IAAI,GAAG,KAAK,CAAC,IAAI,GAAG,KAAK,EAAE,CAAA;IACzC,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,kBAAkB,CAAC,CAAC,CAAC;YACxB,IAAI,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YACpD,MAAK;QACP,CAAC;QACD,KAAK,iBAAiB,CAAC,CAAC,CAAC;YACvB,IAAI,IAAI,KAAK,KAAK,CAAC,OAAO,CAAC,MAAM,oBAAoB,CAAA;YACrD,MAAK;QACP,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,MAAM,aAAa,GAAG,CAAC,EAAE,IAAI,EAAE,KAAK,EAAW,EAAU,EAAE;IACzD,IAAI,KAAK,GAAG,EAAE,CAAA;IACd,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,KAAK,IAAI,KAAK,IAAI,GAAG,IAAI,KAAK,OAAO,EAAE,CAAA;QACvC,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;YAClB,KAAK,UAAU,CAAC,CAAC,CAAC;gBAChB,KAAK,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAA;gBACvB,MAAK;YACP,CAAC;YACD,OAAO,CAAC,CAAC,CAAC;gBACR,KAAK,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAA;gBAC3C,MAAK;YACP,CAAC;QACH,CAAC;QACD,KAAK,IAAI,KAAK,CAAA;IAChB,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC,CAAA"}
package/dist/reduce.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import * as Effect from "effect/Effect";
2
- import { Strand } from "./Strand.ts";
3
- /** Sequentially reduce the current strand's messages in chronological order. */
4
- export declare const reduce: <E, R, E1, R1>(reducer: Effect.Effect<Effect.Effect<void, E1, R1>, E, R>) => Effect.Effect<void, E | E1, R | R1 | Strand>;
package/dist/reduce.js DELETED
@@ -1,20 +0,0 @@
1
- import * as Effect from "effect/Effect";
2
- import { append } from "./append.js";
3
- import { clear } from "./clear.js";
4
- import { Strand } from "./Strand.js";
5
- import { strand } from "./strand_.js";
6
- /** Sequentially reduce the current strand's messages in chronological order. */
7
- export const reduce = Effect.fnUntraced(function* (reducer) {
8
- const parent = yield* Strand;
9
- if (!parent.messages.length || parent.messages.length === 1)
10
- return;
11
- const [m0, m1, ...mRest] = parent.messages;
12
- let acc = yield* strand(append(m0, m1), reducer);
13
- while (mRest.length) {
14
- acc = yield* strand(acc, append(mRest.pop()), reducer);
15
- }
16
- yield* clear;
17
- yield* acc;
18
- return;
19
- });
20
- //# sourceMappingURL=reduce.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"reduce.js","sourceRoot":"","sources":["../reduce.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAErC,gFAAgF;AAChF,MAAM,CAAC,MAAM,MAAM,GAMf,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAC,OAAO;IACrC,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,MAAM,CAAA;IAC5B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAM;IACnE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,KAAK,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAA;IAC1C,IAAI,GAAG,GAAG,KAAK,CAAC,CAAC,MAAM,CACrB,MAAM,CAAC,EAAG,EAAE,EAAG,CAAC,EAChB,OAAO,CACR,CAAA;IACD,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC;QACpB,GAAG,GAAG,KAAK,CAAC,CAAC,MAAM,CACjB,GAAG,EACH,MAAM,CAAC,KAAK,CAAC,GAAG,EAAG,CAAC,EACpB,OAAO,CACR,CAAA;IACH,CAAC;IACD,KAAK,CAAC,CAAC,KAAK,CAAA;IACZ,KAAK,CAAC,CAAC,GAAG,CAAA;IACV,OAAM;AACR,CAAC,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- import type { Sequence } from "./Sequence";
2
- export declare const sequence: Sequence;
@@ -1 +0,0 @@
1
- {"version":3,"file":"sequence_.js","sourceRoot":"","sources":["../sequence_.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAGvC,MAAM,CAAC,MAAM,QAAQ,GAAa,CAAC,GAAG,KAAK,EAAE,EAAE,CAC7C,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE;IAChB,WAAW,EAAE,CAAC;CACf,CAAC,CAAC,IAAI,CACL,MAAM,CAAC,GAAG,CAAC,CAAC,CAAe,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,EAAG,CAAU,CACnD,CAAA"}
package/dist/todo.test.js DELETED
@@ -1,3 +0,0 @@
1
- import { it } from "vitest";
2
- it("works", () => { });
3
- //# sourceMappingURL=todo.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"todo.test.js","sourceRoot":"","sources":["../todo.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAE3B,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA"}
@@ -1,5 +0,0 @@
1
- export type JsonValue = null | boolean | number | string | JsonValueArray | JsonValueObject
2
-
3
- export type JsonValueArray = Array<JsonValue> | ReadonlyArray<JsonValue>
4
-
5
- export type JsonValueObject = { [key: string]: JsonValue }
@@ -1,17 +0,0 @@
1
- export type Taggable<T> = {
2
- (value: string): T
3
- (template: TemplateStringsArray, ...substitutions: Array<unknown>): T
4
- (template: string | TemplateStringsArray, ...substitutions: Array<unknown>): T
5
- }
6
-
7
- export type TaggableNullable<T> = {
8
- (value?: string | undefined): T
9
- (template: TemplateStringsArray, ...substitutions: Array<unknown>): T
10
- (template?: string | TemplateStringsArray | undefined, ...substitutions: Array<unknown>): T
11
- }
12
-
13
- export const normalize = <A0 extends string | TemplateStringsArray | undefined>(
14
- a0: A0,
15
- aRest: Array<unknown> = [],
16
- ): string | (undefined extends A0 ? undefined : never) =>
17
- a0 ? typeof a0 === "string" ? a0 : String.raw(a0, aRest) : undefined as never
package/reduce.ts DELETED
@@ -1,32 +0,0 @@
1
- import * as Effect from "effect/Effect"
2
- import { append } from "./append.ts"
3
- import { clear } from "./clear.ts"
4
- import { Strand } from "./Strand.ts"
5
- import { strand } from "./strand_.ts"
6
-
7
- /** Sequentially reduce the current strand's messages in chronological order. */
8
- export const reduce: <E, R, E1, R1>(
9
- reducer: Effect.Effect<Effect.Effect<void, E1, R1>, E, R>,
10
- ) => Effect.Effect<
11
- void,
12
- E | E1,
13
- R | R1 | Strand
14
- > = Effect.fnUntraced(function*(reducer) {
15
- const parent = yield* Strand
16
- if (!parent.messages.length || parent.messages.length === 1) return
17
- const [m0, m1, ...mRest] = parent.messages
18
- let acc = yield* strand(
19
- append(m0!, m1!),
20
- reducer,
21
- )
22
- while (mRest.length) {
23
- acc = yield* strand(
24
- acc,
25
- append(mRest.pop()!),
26
- reducer,
27
- )
28
- }
29
- yield* clear
30
- yield* acc
31
- return
32
- })
package/todo.test.ts DELETED
@@ -1,3 +0,0 @@
1
- import { it } from "vitest"
2
-
3
- it("works", () => {})
package/tsconfig.json DELETED
@@ -1,18 +0,0 @@
1
- {
2
- "extends": "../tsconfig.base",
3
- "compilerOptions": {
4
- "noEmit": false,
5
- "outDir": "dist",
6
- "plugins": [
7
- {
8
- "name": "@effect/language-service",
9
- "transform": "@effect/language-service/transform",
10
- "namespaceImportPackages": ["effect", "@effect/ai"],
11
- "diagnosticSeverity": {
12
- "importFromBarrel": "error"
13
- }
14
- }
15
- ]
16
- },
17
- "include": ["."]
18
- }
File without changes