liminal 0.5.16 → 0.6.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 (226) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/Context.ts +11 -47
  3. package/L.ts +4 -0
  4. package/LEvent.ts +20 -53
  5. package/_emit.ts +16 -0
  6. package/assistant.ts +53 -0
  7. package/dist/Context.d.ts +15 -30
  8. package/dist/Context.js +9 -22
  9. package/dist/Context.js.map +1 -1
  10. package/dist/L.d.ts +4 -0
  11. package/dist/L.js +5 -0
  12. package/dist/L.js.map +1 -0
  13. package/dist/LEvent.d.ts +29 -62
  14. package/dist/LEvent.js +14 -46
  15. package/dist/LEvent.js.map +1 -1
  16. package/dist/_emit.d.ts +2 -0
  17. package/dist/_emit.js +16 -0
  18. package/dist/_emit.js.map +1 -0
  19. package/dist/assistant.d.ts +8 -0
  20. package/dist/assistant.js +46 -0
  21. package/dist/assistant.js.map +1 -0
  22. package/dist/index.d.ts +2 -13
  23. package/dist/index.js +2 -13
  24. package/dist/index.js.map +1 -1
  25. package/dist/messages.d.ts +4 -0
  26. package/dist/messages.js +4 -0
  27. package/dist/messages.js.map +1 -0
  28. package/dist/set.d.ts +4 -0
  29. package/dist/set.js +9 -0
  30. package/dist/set.js.map +1 -0
  31. package/dist/strand.d.ts +16 -0
  32. package/dist/strand.js +16 -0
  33. package/dist/strand.js.map +1 -0
  34. package/dist/todo.test.js +3 -0
  35. package/dist/todo.test.js.map +1 -0
  36. package/dist/tsconfig.tsbuildinfo +1 -1
  37. package/dist/user.d.ts +6 -0
  38. package/dist/user.js +18 -0
  39. package/dist/user.js.map +1 -0
  40. package/dist/util/JSONValue.d.ts +0 -3
  41. package/dist/util/JSONValue.js +1 -31
  42. package/dist/util/JSONValue.js.map +1 -1
  43. package/dist/util/fixTemplateStrings.d.ts +11 -0
  44. package/dist/util/fixTemplateStrings.js +83 -0
  45. package/dist/util/fixTemplateStrings.js.map +1 -0
  46. package/index.ts +2 -13
  47. package/messages.ts +5 -0
  48. package/package.json +4 -3
  49. package/set.ts +10 -0
  50. package/strand.ts +38 -0
  51. package/todo.test.ts +3 -0
  52. package/user.ts +24 -0
  53. package/util/JSONValue.ts +0 -30
  54. package/util/fixTemplateStrings.ts +99 -0
  55. package/Adapter.ts +0 -27
  56. package/AdapterRegistry.ts +0 -78
  57. package/Config.ts +0 -13
  58. package/Definition.ts +0 -48
  59. package/EventBase.ts +0 -23
  60. package/Handler.ts +0 -4
  61. package/L/L.ts +0 -24
  62. package/L/all.ts +0 -39
  63. package/L/assistant.ts +0 -28
  64. package/L/catch.ts +0 -38
  65. package/L/continuation.ts +0 -14
  66. package/L/emit.ts +0 -16
  67. package/L/focus.ts +0 -17
  68. package/L/infer.ts +0 -34
  69. package/L/message.ts +0 -16
  70. package/L/reflect.ts +0 -13
  71. package/L/run.ts +0 -30
  72. package/L/schema/_schema_common.ts +0 -29
  73. package/L/schema/anyOf.ts +0 -10
  74. package/L/schema/array.ts +0 -13
  75. package/L/schema/boolean.ts +0 -8
  76. package/L/schema/const.ts +0 -18
  77. package/L/schema/enum.ts +0 -18
  78. package/L/schema/integer.ts +0 -6
  79. package/L/schema/null.ts +0 -8
  80. package/L/schema/number.ts +0 -8
  81. package/L/schema/object.ts +0 -21
  82. package/L/schema/string.ts +0 -11
  83. package/L/strand.ts +0 -22
  84. package/L/stream.ts +0 -16
  85. package/L/system.ts +0 -18
  86. package/L/user.ts +0 -18
  87. package/LiminalAssertionError.ts +0 -19
  88. package/Message.ts +0 -16
  89. package/Rune.test.ts +0 -5
  90. package/Rune.ts +0 -60
  91. package/Schema.ts +0 -185
  92. package/Strand.ts +0 -284
  93. package/Tool.ts +0 -26
  94. package/TypeAdapter.ts +0 -3
  95. package/dist/Adapter.d.ts +0 -18
  96. package/dist/Adapter.js +0 -13
  97. package/dist/Adapter.js.map +0 -1
  98. package/dist/AdapterRegistry.d.ts +0 -27
  99. package/dist/AdapterRegistry.js +0 -62
  100. package/dist/AdapterRegistry.js.map +0 -1
  101. package/dist/Config.d.ts +0 -12
  102. package/dist/Config.js +0 -2
  103. package/dist/Config.js.map +0 -1
  104. package/dist/Definition.d.ts +0 -24
  105. package/dist/Definition.js +0 -29
  106. package/dist/Definition.js.map +0 -1
  107. package/dist/EventBase.d.ts +0 -11
  108. package/dist/EventBase.js +0 -16
  109. package/dist/EventBase.js.map +0 -1
  110. package/dist/Handler.d.ts +0 -3
  111. package/dist/Handler.js +0 -2
  112. package/dist/Handler.js.map +0 -1
  113. package/dist/L/L.d.ts +0 -24
  114. package/dist/L/L.js +0 -25
  115. package/dist/L/L.js.map +0 -1
  116. package/dist/L/all.d.ts +0 -14
  117. package/dist/L/all.js +0 -20
  118. package/dist/L/all.js.map +0 -1
  119. package/dist/L/assistant.d.ts +0 -11
  120. package/dist/L/assistant.js +0 -15
  121. package/dist/L/assistant.js.map +0 -1
  122. package/dist/L/catch.d.ts +0 -16
  123. package/dist/L/catch.js +0 -25
  124. package/dist/L/catch.js.map +0 -1
  125. package/dist/L/continuation.d.ts +0 -4
  126. package/dist/L/continuation.js +0 -13
  127. package/dist/L/continuation.js.map +0 -1
  128. package/dist/L/emit.d.ts +0 -7
  129. package/dist/L/emit.js +0 -15
  130. package/dist/L/emit.js.map +0 -1
  131. package/dist/L/focus.d.ts +0 -8
  132. package/dist/L/focus.js +0 -14
  133. package/dist/L/focus.js.map +0 -1
  134. package/dist/L/infer.d.ts +0 -8
  135. package/dist/L/infer.js +0 -30
  136. package/dist/L/infer.js.map +0 -1
  137. package/dist/L/message.d.ts +0 -8
  138. package/dist/L/message.js +0 -14
  139. package/dist/L/message.js.map +0 -1
  140. package/dist/L/reflect.d.ts +0 -5
  141. package/dist/L/reflect.js +0 -11
  142. package/dist/L/reflect.js.map +0 -1
  143. package/dist/L/run.d.ts +0 -16
  144. package/dist/L/run.js +0 -16
  145. package/dist/L/run.js.map +0 -1
  146. package/dist/L/schema/_schema_common.d.ts +0 -6
  147. package/dist/L/schema/_schema_common.js +0 -19
  148. package/dist/L/schema/_schema_common.js.map +0 -1
  149. package/dist/L/schema/anyOf.d.ts +0 -5
  150. package/dist/L/schema/anyOf.js +0 -5
  151. package/dist/L/schema/anyOf.js.map +0 -1
  152. package/dist/L/schema/array.d.ts +0 -5
  153. package/dist/L/schema/array.js +0 -8
  154. package/dist/L/schema/array.js.map +0 -1
  155. package/dist/L/schema/boolean.d.ts +0 -6
  156. package/dist/L/schema/boolean.js +0 -4
  157. package/dist/L/schema/boolean.js.map +0 -1
  158. package/dist/L/schema/const.d.ts +0 -8
  159. package/dist/L/schema/const.js +0 -10
  160. package/dist/L/schema/const.js.map +0 -1
  161. package/dist/L/schema/enum.d.ts +0 -8
  162. package/dist/L/schema/enum.js +0 -10
  163. package/dist/L/schema/enum.js.map +0 -1
  164. package/dist/L/schema/integer.d.ts +0 -5
  165. package/dist/L/schema/integer.js +0 -3
  166. package/dist/L/schema/integer.js.map +0 -1
  167. package/dist/L/schema/null.d.ts +0 -6
  168. package/dist/L/schema/null.js +0 -4
  169. package/dist/L/schema/null.js.map +0 -1
  170. package/dist/L/schema/number.d.ts +0 -6
  171. package/dist/L/schema/number.js +0 -4
  172. package/dist/L/schema/number.js.map +0 -1
  173. package/dist/L/schema/object.d.ts +0 -9
  174. package/dist/L/schema/object.js +0 -12
  175. package/dist/L/schema/object.js.map +0 -1
  176. package/dist/L/schema/string.d.ts +0 -8
  177. package/dist/L/schema/string.js +0 -4
  178. package/dist/L/schema/string.js.map +0 -1
  179. package/dist/L/strand.d.ts +0 -9
  180. package/dist/L/strand.js +0 -16
  181. package/dist/L/strand.js.map +0 -1
  182. package/dist/L/stream.d.ts +0 -4
  183. package/dist/L/stream.js +0 -15
  184. package/dist/L/stream.js.map +0 -1
  185. package/dist/L/system.d.ts +0 -4
  186. package/dist/L/system.js +0 -8
  187. package/dist/L/system.js.map +0 -1
  188. package/dist/L/user.d.ts +0 -4
  189. package/dist/L/user.js +0 -8
  190. package/dist/L/user.js.map +0 -1
  191. package/dist/LiminalAssertionError.d.ts +0 -8
  192. package/dist/LiminalAssertionError.js +0 -20
  193. package/dist/LiminalAssertionError.js.map +0 -1
  194. package/dist/Message.d.ts +0 -14
  195. package/dist/Message.js +0 -2
  196. package/dist/Message.js.map +0 -1
  197. package/dist/Rune.d.ts +0 -46
  198. package/dist/Rune.js +0 -11
  199. package/dist/Rune.js.map +0 -1
  200. package/dist/Rune.test.js +0 -5
  201. package/dist/Rune.test.js.map +0 -1
  202. package/dist/Schema.d.ts +0 -46
  203. package/dist/Schema.js +0 -130
  204. package/dist/Schema.js.map +0 -1
  205. package/dist/Strand.d.ts +0 -81
  206. package/dist/Strand.js +0 -200
  207. package/dist/Strand.js.map +0 -1
  208. package/dist/Tool.d.ts +0 -10
  209. package/dist/Tool.js +0 -19
  210. package/dist/Tool.js.map +0 -1
  211. package/dist/TypeAdapter.d.ts +0 -1
  212. package/dist/TypeAdapter.js +0 -3
  213. package/dist/TypeAdapter.js.map +0 -1
  214. package/dist/errors.d.ts +0 -9
  215. package/dist/errors.js +0 -11
  216. package/dist/errors.js.map +0 -1
  217. package/dist/util/EnsureNarrow.d.ts +0 -1
  218. package/dist/util/EnsureNarrow.js +0 -2
  219. package/dist/util/EnsureNarrow.js.map +0 -1
  220. package/dist/util/attachCustomInspect.d.ts +0 -1
  221. package/dist/util/attachCustomInspect.js +0 -11
  222. package/dist/util/attachCustomInspect.js.map +0 -1
  223. package/errors.ts +0 -12
  224. package/util/EnsureNarrow.ts +0 -1
  225. package/util/attachCustomInspect.ts +0 -14
  226. /package/dist/{Rune.test.d.ts → todo.test.d.ts} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"enum.js","sourceRoot":"","sources":["../../../L/schema/enum.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAiB,MAAM,qBAAqB,CAAA;AAOzD,SAAS,KAAK,CAAgC,GAAG,MAAS;IACxD,OAAO,IAAI,CAAC;QACV,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,MAAM;KACb,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAA;AAEvD,OAAO,EAAE,KAAK,IAAI,IAAI,EAAE,CAAA"}
@@ -1,5 +0,0 @@
1
- import type { SchemaInteger } from "../../Schema.ts";
2
- import { type TypeBase } from "./_schema_common.ts";
3
- export interface integer extends SchemaInteger<number>, TypeBase {
4
- }
5
- export declare const integer: integer;
@@ -1,3 +0,0 @@
1
- import { make } from "./_schema_common.js";
2
- export const integer = make({ type: "integer" });
3
- //# sourceMappingURL=integer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"integer.js","sourceRoot":"","sources":["../../../L/schema/integer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAiB,MAAM,qBAAqB,CAAA;AAIzD,MAAM,CAAC,MAAM,OAAO,GAAY,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAA"}
@@ -1,6 +0,0 @@
1
- import type { SchemaNull } from "../../Schema.ts";
2
- import { type TypeBase } from "./_schema_common.ts";
3
- export interface null_ extends SchemaNull<null>, TypeBase {
4
- }
5
- declare const null_: null_;
6
- export { null_ as null };
@@ -1,4 +0,0 @@
1
- import { make } from "./_schema_common.js";
2
- const null_ = make({ type: "null" });
3
- export { null_ as null };
4
- //# sourceMappingURL=null.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"null.js","sourceRoot":"","sources":["../../../L/schema/null.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAiB,MAAM,qBAAqB,CAAA;AAIzD,MAAM,KAAK,GAAU,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAA;AAE3C,OAAO,EAAE,KAAK,IAAI,IAAI,EAAE,CAAA"}
@@ -1,6 +0,0 @@
1
- import type { SchemaNumber } from "../../Schema.ts";
2
- import { type TypeBase } from "./_schema_common.ts";
3
- interface number_ extends SchemaNumber<number>, TypeBase {
4
- }
5
- declare const number_: number_;
6
- export { number_ as number };
@@ -1,4 +0,0 @@
1
- import { make } from "./_schema_common.js";
2
- const number_ = make({ type: "number" });
3
- export { number_ as number };
4
- //# sourceMappingURL=number.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"number.js","sourceRoot":"","sources":["../../../L/schema/number.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAiB,MAAM,qBAAqB,CAAA;AAIzD,MAAM,OAAO,GAAY,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAA;AAEjD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,CAAA"}
@@ -1,9 +0,0 @@
1
- import type { Schema, SchemaObject } from "../../Schema.ts";
2
- interface object_<F extends Record<string, Schema> = Record<string, Schema>> extends SchemaObject<{
3
- [K in keyof F]: F[K]["T"];
4
- }> {
5
- properties: F;
6
- required: Array<Extract<keyof F, string>>;
7
- }
8
- declare function object_<XR extends Record<string, Schema>>(properties: XR): object_<XR>;
9
- export { object_ as object };
@@ -1,12 +0,0 @@
1
- import { make } from "./_schema_common.js";
2
- function object_(properties) {
3
- return make({
4
- type: "object",
5
- properties,
6
- additionalProperties: false,
7
- required: Object.keys(properties),
8
- });
9
- }
10
- Object.defineProperty(object_, "name", { value: "object" });
11
- export { object_ as object };
12
- //# sourceMappingURL=object.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"object.js","sourceRoot":"","sources":["../../../L/schema/object.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAS1C,SAAS,OAAO,CAAoC,UAAc;IAChE,OAAO,IAAI,CAAC;QACV,IAAI,EAAE,QAAQ;QACd,UAAU;QACV,oBAAoB,EAAE,KAAK;QAC3B,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAU;KAC3C,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAA;AAC3D,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,CAAA"}
@@ -1,8 +0,0 @@
1
- import type { SchemaString } from "../../Schema.ts";
2
- import { type TypeBase } from "./_schema_common.ts";
3
- interface string_ extends SchemaString<string>, TypeBase {
4
- enum?: never;
5
- const?: never;
6
- }
7
- declare const string_: string_;
8
- export { string_ as string };
@@ -1,4 +0,0 @@
1
- import { make } from "./_schema_common.js";
2
- const string_ = make({ type: "string" });
3
- export { string_ as string };
4
- //# sourceMappingURL=string.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"string.js","sourceRoot":"","sources":["../../../L/schema/string.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAiB,MAAM,qBAAqB,CAAA;AAOzD,MAAM,OAAO,GAAY,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAA;AAEjD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,CAAA"}
@@ -1,9 +0,0 @@
1
- import type { Context } from "../Context.ts";
2
- import type { Definition } from "../Definition.ts";
3
- import type { LEvent } from "../LEvent.ts";
4
- import { type Rune } from "../Rune.ts";
5
- /**
6
- * Creates a child strand that executes a definition.
7
- * Optionally specify the context. Otherwise the current context is inherited.
8
- */
9
- export declare function strand<Y extends Rune<any>, T>(definition: Definition<Y, T>, context?: Context): Generator<Rune<LEvent>, T>;
package/dist/L/strand.js DELETED
@@ -1,16 +0,0 @@
1
- import { RuneKey } from "../Rune.js";
2
- /**
3
- * Creates a child strand that executes a definition.
4
- * Optionally specify the context. Otherwise the current context is inherited.
5
- */
6
- export function* strand(definition, context) {
7
- return yield {
8
- [RuneKey]: true,
9
- instruction: {
10
- kind: "create_child",
11
- definition,
12
- context,
13
- },
14
- };
15
- }
16
- //# sourceMappingURL=strand.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"strand.js","sourceRoot":"","sources":["../../L/strand.ts"],"names":[],"mappings":"AAGA,OAAO,EAAa,OAAO,EAAE,MAAM,YAAY,CAAA;AAE/C;;;GAGG;AACH,MAAM,SAAS,CAAC,CAAC,MAAM,CACrB,UAA4B,EAC5B,OAAiB;IAEjB,OAAO,MAAM;QACX,CAAC,OAAO,CAAC,EAAE,IAAI;QACf,WAAW,EAAE;YACX,IAAI,EAAE,cAAc;YACpB,UAAU;YACV,OAAO;SACR;KACF,CAAA;AACH,CAAC"}
@@ -1,4 +0,0 @@
1
- import { type LEvent } from "../LEvent.ts";
2
- import type { Rune } from "../Rune.ts";
3
- /** Creates a readable stream of content from the current model. */
4
- export declare const stream: Iterable<Rune<LEvent>, ReadableStream<string>>;
package/dist/L/stream.js DELETED
@@ -1,15 +0,0 @@
1
- import { InferenceRequested } from "../LEvent.js";
2
- import { continuation } from "./continuation.js";
3
- import { emit } from "./emit.js";
4
- import { reflect } from "./reflect.js";
5
- /** Creates a readable stream of content from the current model. */
6
- export const stream = {
7
- *[Symbol.iterator]() {
8
- const { context: { adapters, messages }, signal } = yield* reflect;
9
- const adapter = adapters.ensure();
10
- const requestId = crypto.randomUUID();
11
- yield* emit(new InferenceRequested(requestId));
12
- return yield* continuation("stream", adapter.seal({ messages, signal }).stream);
13
- },
14
- };
15
- //# sourceMappingURL=stream.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stream.js","sourceRoot":"","sources":["../../L/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAe,MAAM,cAAc,CAAA;AAE9D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,mEAAmE;AACnE,MAAM,CAAC,MAAM,MAAM,GAAmD;IACpE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC;QAChB,MAAM,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,OAAO,CAAA;QAClE,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAA;QACjC,MAAM,SAAS,GAAG,MAAM,CAAC,UAAU,EAAE,CAAA;QACrC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,kBAAkB,CAAC,SAAS,CAAC,CAAC,CAAA;QAC9C,OAAO,KAAK,CAAC,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAA;IACjF,CAAC;CACF,CAAA"}
@@ -1,4 +0,0 @@
1
- import type { LEvent } from "../LEvent.ts";
2
- import type { Rune } from "../Rune.ts";
3
- export declare function system(template: TemplateStringsArray, ...substitutions: Array<number | string>): Generator<Rune<LEvent>, void>;
4
- export declare function system(value: string): Generator<Rune<LEvent>, void>;
package/dist/L/system.js DELETED
@@ -1,8 +0,0 @@
1
- import { isTemplateStringsArray } from "../util/isTemplateStringsArray.js";
2
- import { message } from "./message.js";
3
- export function system(e0, ...rest) {
4
- return message("system", [{
5
- part: isTemplateStringsArray(e0) ? String.raw(e0, ...rest) : e0,
6
- }]);
7
- }
8
- //# sourceMappingURL=system.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"system.js","sourceRoot":"","sources":["../../L/system.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAA;AAC1E,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAOtC,MAAM,UAAU,MAAM,CACpB,EAAiC,EACjC,GAAG,IAA4B;IAE/B,OAAO,OAAO,CAAC,QAAQ,EAAE,CAAC;YACxB,IAAI,EAAE,sBAAsB,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE;SAChE,CAAC,CAAC,CAAA;AACL,CAAC"}
package/dist/L/user.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import type { LEvent } from "../LEvent.ts";
2
- import type { Rune } from "../Rune.ts";
3
- export declare function user(template: TemplateStringsArray, ...substitutions: Array<number | string>): Generator<Rune<LEvent>, void>;
4
- export declare function user(value: string): Generator<Rune<LEvent>, void>;
package/dist/L/user.js DELETED
@@ -1,8 +0,0 @@
1
- import { isTemplateStringsArray } from "../util/isTemplateStringsArray.js";
2
- import { message } from "./message.js";
3
- export function user(e0, ...rest) {
4
- return message("user", [{
5
- part: isTemplateStringsArray(e0) ? String.raw(e0, ...rest) : e0,
6
- }]);
7
- }
8
- //# sourceMappingURL=user.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"user.js","sourceRoot":"","sources":["../../L/user.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAA;AAC1E,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAOtC,MAAM,UAAU,IAAI,CAClB,EAAiC,EACjC,GAAG,IAA4B;IAE/B,OAAO,OAAO,CAAC,MAAM,EAAE,CAAC;YACtB,IAAI,EAAE,sBAAsB,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE;SAChE,CAAC,CAAC,CAAA;AACL,CAAC"}
@@ -1,8 +0,0 @@
1
- export declare class LiminalAssertionError extends Error {
2
- readonly name = "LiminalAssertionError";
3
- }
4
- export declare namespace LiminalAssertionError {
5
- function assert(expr: unknown, msg?: string): asserts expr;
6
- function unimplemented(): never;
7
- function unreachable(): never;
8
- }
@@ -1,20 +0,0 @@
1
- export class LiminalAssertionError extends Error {
2
- name = "LiminalAssertionError";
3
- }
4
- (function (LiminalAssertionError) {
5
- function assert(expr, msg = "") {
6
- if (!expr) {
7
- throw new LiminalAssertionError(msg);
8
- }
9
- }
10
- LiminalAssertionError.assert = assert;
11
- function unimplemented() {
12
- throw new LiminalAssertionError();
13
- }
14
- LiminalAssertionError.unimplemented = unimplemented;
15
- function unreachable() {
16
- throw new LiminalAssertionError();
17
- }
18
- LiminalAssertionError.unreachable = unreachable;
19
- })(LiminalAssertionError || (LiminalAssertionError = {}));
20
- //# sourceMappingURL=LiminalAssertionError.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LiminalAssertionError.js","sourceRoot":"","sources":["../LiminalAssertionError.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAC5B,IAAI,GAAG,uBAAuB,CAAA;CACjD;AAED,WAAiB,qBAAqB;IACpC,SAAgB,MAAM,CAAC,IAAa,EAAE,GAAG,GAAG,EAAE;QAC5C,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,MAAM,IAAI,qBAAqB,CAAC,GAAG,CAAC,CAAA;QACtC,CAAC;IACH,CAAC;IAJe,4BAAM,SAIrB,CAAA;IAED,SAAgB,aAAa;QAC3B,MAAM,IAAI,qBAAqB,EAAE,CAAA;IACnC,CAAC;IAFe,mCAAa,gBAE5B,CAAA;IAED,SAAgB,WAAW;QACzB,MAAM,IAAI,qBAAqB,EAAE,CAAA;IACnC,CAAC;IAFe,iCAAW,cAE1B,CAAA;AACH,CAAC,EAdgB,qBAAqB,KAArB,qBAAqB,QAcrC"}
package/dist/Message.d.ts DELETED
@@ -1,14 +0,0 @@
1
- export interface Message {
2
- readonly role: MessageRole;
3
- readonly parts: Array<Content>;
4
- }
5
- export type MessageRole = "system" | "user" | "assistant";
6
- export type Content = {
7
- readonly part: string;
8
- readonly alt?: never;
9
- readonly mime?: never;
10
- } | {
11
- readonly part: URL;
12
- readonly alt: string;
13
- readonly mime?: string;
14
- };
package/dist/Message.js DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=Message.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Message.js","sourceRoot":"","sources":["../Message.ts"],"names":[],"mappings":""}
package/dist/Rune.d.ts DELETED
@@ -1,46 +0,0 @@
1
- import type { Context } from "./Context.ts";
2
- import type { Definition } from "./Definition.ts";
3
- /**
4
- * `Rune` represents a computational unit within a Strand execution.
5
- * It is a specialized protocol for expressing different kinds of operations
6
- * that can be yielded from generator functions to control message state
7
- * and concurrency within the Liminal runtime.
8
- * @template E The event type this Rune can handle
9
- */
10
- export interface Rune<E> {
11
- [RuneKey]: true;
12
- instruction: RuneInstruction<E>;
13
- }
14
- export type RuneInstruction<E> = RuneInstruction.Continue | RuneInstruction.Emit<E> | RuneInstruction.Reflect | RuneInstruction.CreateChild;
15
- export declare namespace RuneInstruction {
16
- /** Tells the runtime to call this function and and pass the result to the next iteration. */
17
- interface Continue {
18
- kind: "continue";
19
- debug: string;
20
- f: () => any;
21
- }
22
- /** Dispatch an event to the registered handler. */
23
- interface Emit<E> {
24
- kind: "emit";
25
- event: E;
26
- }
27
- /** Tells the runtime to provide a reference to the current strand */
28
- interface Reflect {
29
- kind: "reflect";
30
- }
31
- /** Creates a nested execution context with its own definition. */
32
- interface CreateChild {
33
- kind: "create_child";
34
- definition: Definition;
35
- context?: Context | undefined;
36
- }
37
- }
38
- export declare namespace Rune {
39
- /** Extract the event type from a Rune type. */
40
- type E<X extends Rune<any>> = X extends Rune<infer E> ? E : never;
41
- /** Type guard to check if a value is a Rune. */
42
- function is(value: unknown): value is Rune<any>;
43
- }
44
- /** Symbol used to identify Rune objects. */
45
- export declare const RuneKey: unique symbol;
46
- export type RuneKey = typeof RuneKey;
package/dist/Rune.js DELETED
@@ -1,11 +0,0 @@
1
- export var Rune;
2
- (function (Rune) {
3
- /** Type guard to check if a value is a Rune. */
4
- function is(value) {
5
- return typeof value === "object" && value !== null && RuneKey in value;
6
- }
7
- Rune.is = is;
8
- })(Rune || (Rune = {}));
9
- /** Symbol used to identify Rune objects. */
10
- export const RuneKey = Symbol.for("liminal/RuneKey");
11
- //# sourceMappingURL=Rune.js.map
package/dist/Rune.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"Rune.js","sourceRoot":"","sources":["../Rune.ts"],"names":[],"mappings":"AA+CA,MAAM,KAAW,IAAI,CAQpB;AARD,WAAiB,IAAI;IAInB,gDAAgD;IAChD,SAAgB,EAAE,CAAC,KAAc;QAC/B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK,CAAA;IACxE,CAAC;IAFe,OAAE,KAEjB,CAAA;AACH,CAAC,EARgB,IAAI,KAAJ,IAAI,QAQpB;AAED,4CAA4C;AAC5C,MAAM,CAAC,MAAM,OAAO,GAAkB,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAA"}
package/dist/Rune.test.js DELETED
@@ -1,5 +0,0 @@
1
- import { expect, test } from "vitest";
2
- test("adds 1 + 2 to equal 3", () => {
3
- expect(1 + 2).toBe(3);
4
- });
5
- //# sourceMappingURL=Rune.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Rune.test.js","sourceRoot":"","sources":["../Rune.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAErC,IAAI,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACjC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACvB,CAAC,CAAC,CAAA"}
package/dist/Schema.d.ts DELETED
@@ -1,46 +0,0 @@
1
- export type Schema<T = any> = SchemaType<T> | SchemaAnyOf<T>;
2
- export type SchemaType<T = any> = SchemaNull<T> | SchemaBoolean<T> | SchemaInteger<T> | SchemaNumber<T> | SchemaString<T> | SchemaArray<T> | SchemaObject<T>;
3
- export interface SchemaNull<T = any> extends SchemaTypeBase<"null", T> {
4
- }
5
- export interface SchemaBoolean<T = any> extends SchemaTypeBase<"boolean", T> {
6
- }
7
- export interface SchemaInteger<T = any> extends SchemaTypeBase<"integer", T> {
8
- }
9
- export interface SchemaNumber<T = any> extends SchemaTypeBase<"number", T> {
10
- }
11
- export interface SchemaString<T = any> extends SchemaTypeBase<"string", T> {
12
- enum?: Array<string>;
13
- const?: string;
14
- }
15
- export interface SchemaArray<T = any> extends SchemaTypeBase<"array", T> {
16
- items: Schema;
17
- }
18
- export interface SchemaObject<T = any> extends SchemaTypeBase<"object", T> {
19
- properties: Record<string, Schema>;
20
- required: Array<string>;
21
- additionalProperties: false;
22
- }
23
- interface SchemaTypeBase<K extends SchemaTypeName, T> extends SchemaBase<T> {
24
- type: K;
25
- anyOf?: never;
26
- }
27
- export type SchemaTypeName = "null" | "boolean" | "integer" | "number" | "string" | "array" | "object";
28
- export interface SchemaAnyOf<T = any> extends SchemaBase<T> {
29
- type?: never;
30
- anyOf: Array<Schema>;
31
- }
32
- export interface SchemaBase<T> {
33
- T: T;
34
- description?: string;
35
- }
36
- export declare namespace Schema {
37
- function compile<T>(key: WeakKey, { schema: schema_, validate, }: {
38
- schema(): unknown;
39
- validate(value: unknown): T;
40
- }): Schema<any>;
41
- function validateValue<T>(schema: Schema<T>, value: unknown): T;
42
- function id(schema: Schema, description?: string): Promise<string>;
43
- function wrap(schema: Schema): SchemaObject;
44
- function validate(value: unknown): Schema;
45
- }
46
- export {};
package/dist/Schema.js DELETED
@@ -1,130 +0,0 @@
1
- import { subtle } from "node:crypto";
2
- import { LiminalAssertionError as LE } from "./LiminalAssertionError.js";
3
- export var Schema;
4
- (function (Schema) {
5
- const ids = new WeakMap();
6
- const schemas = new WeakMap();
7
- const validators = new WeakMap();
8
- function compile(key, { schema: schema_, validate, }) {
9
- let schema = schemas.get(key);
10
- if (!schema) {
11
- schema = Schema.validate(schema_());
12
- schemas.set(key, schema);
13
- }
14
- validators.set(schema, validate);
15
- return schema;
16
- }
17
- Schema.compile = compile;
18
- function validateValue(schema, value) {
19
- const validator = validators.get(schema);
20
- LE.assert(validator);
21
- return validator(value);
22
- }
23
- Schema.validateValue = validateValue;
24
- async function id(schema, description) {
25
- description = description ?? "";
26
- if (!ids.has(schema)) {
27
- ids.set(schema, {});
28
- }
29
- const schemaIds = ids.get(schema);
30
- let id = schemaIds[description];
31
- if (!id) {
32
- const content = `${description}_${JSON.stringify(schema)}`;
33
- const bytes = new Uint8Array(await subtle.digest("SHA-256", new TextEncoder().encode(content)));
34
- let binary = "";
35
- for (const b of bytes)
36
- binary += String.fromCharCode(b);
37
- id = btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
38
- schemaIds[description] = id;
39
- }
40
- return id;
41
- }
42
- Schema.id = id;
43
- function wrap(schema) {
44
- return {
45
- type: "object",
46
- properties: { value: schema },
47
- additionalProperties: false,
48
- required: ["value"],
49
- };
50
- }
51
- Schema.wrap = wrap;
52
- function validate(value) {
53
- LE.assert(typeof value === "object");
54
- LE.assert(value !== null);
55
- if ("anyOf" in value) {
56
- LE.assert(Array.isArray(value.anyOf));
57
- return {
58
- anyOf: value.anyOf.map(validate),
59
- };
60
- }
61
- else {
62
- if ("enum" in value) {
63
- LE.assert(Array.isArray(value.enum));
64
- LE.assert(!("const" in value));
65
- value.enum.forEach((v) => LE.assert(typeof v === "string"));
66
- return {
67
- type: "string",
68
- enum: value.enum,
69
- };
70
- }
71
- else if ("const" in value) {
72
- LE.assert(typeof value.const === "string");
73
- return {
74
- type: "string",
75
- const: value.const,
76
- };
77
- }
78
- else if ("type" in value) {
79
- LE.assert("type" in value);
80
- LE.assert(typeof value.type === "string");
81
- LE.assert(SCHEMA_TYPE_NAMES[value.type]);
82
- switch (value.type) {
83
- case "null":
84
- case "boolean":
85
- case "integer":
86
- case "number": {
87
- break;
88
- }
89
- case "string": {
90
- if ("const" in value) {
91
- LE.assert(typeof value.const === "string");
92
- }
93
- break;
94
- }
95
- case "array": {
96
- LE.assert("items" in value);
97
- return {
98
- type: "array",
99
- items: validate(value.items),
100
- };
101
- }
102
- case "object": {
103
- LE.assert("properties" in value);
104
- LE.assert(typeof value.properties === "object");
105
- const { properties } = value;
106
- LE.assert(properties !== null);
107
- return {
108
- type: "object",
109
- properties: Object.fromEntries(Object.entries(properties).map(([key, value]) => [key, validate(value)])),
110
- required: Object.keys(properties),
111
- additionalProperties: false,
112
- };
113
- }
114
- }
115
- }
116
- }
117
- return value;
118
- }
119
- Schema.validate = validate;
120
- })(Schema || (Schema = {}));
121
- const SCHEMA_TYPE_NAMES = {
122
- null: true,
123
- boolean: true,
124
- integer: true,
125
- number: true,
126
- string: true,
127
- array: true,
128
- object: true,
129
- };
130
- //# sourceMappingURL=Schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Schema.js","sourceRoot":"","sources":["../Schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,qBAAqB,IAAI,EAAE,EAAE,MAAM,4BAA4B,CAAA;AAqDxE,MAAM,KAAW,MAAM,CAwHtB;AAxHD,WAAiB,MAAM;IACrB,MAAM,GAAG,GAAG,IAAI,OAAO,EAAkC,CAAA;IACzD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAmB,CAAA;IAC9C,MAAM,UAAU,GAAG,IAAI,OAAO,EAAuC,CAAA;IAErE,SAAgB,OAAO,CAAI,GAAY,EAAE,EACvC,MAAM,EAAE,OAAO,EACf,QAAQ,GAIT;QACC,IAAI,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QAC7B,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAA;YACnC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;QAC1B,CAAC;QACD,UAAU,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;QAChC,OAAO,MAAM,CAAA;IACf,CAAC;IAde,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,EAAE,UAAU,EAAE,GAAG,KAAK,CAAA;wBAC5B,EAAE,CAAC,MAAM,CAAC,UAAU,KAAK,IAAI,CAAC,CAAA;wBAC9B,OAAO;4BACL,IAAI,EAAE,QAAQ;4BACd,UAAU,EAAE,MAAM,CAAC,WAAW,CAC5B,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CACzE;4BACD,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;4BACjC,oBAAoB,EAAE,KAAK;yBACe,CAAA;oBAC9C,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,KAAe,CAAA;IACxB,CAAC;IAjEe,eAAQ,WAiEvB,CAAA;AACH,CAAC,EAxHgB,MAAM,KAAN,MAAM,QAwHtB;AAED,MAAM,iBAAiB,GAA4B;IACjD,IAAI,EAAE,IAAI;IACV,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,IAAI;IACb,MAAM,EAAE,IAAI;IACZ,MAAM,EAAE,IAAI;IACZ,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,IAAI;CAC0B,CAAA"}
package/dist/Strand.d.ts DELETED
@@ -1,81 +0,0 @@
1
- import { Context } from "./Context.ts";
2
- import { Definition } from "./Definition.ts";
3
- import type { Rune } from "./Rune.ts";
4
- /** Configuration options for creating a new Strand. */
5
- export interface StrandConfig {
6
- /** Optional parent strand that this strand will be a child of */
7
- parent?: Strand | undefined;
8
- /** Optional context for the strand execution */
9
- context?: Context | undefined;
10
- /** Optional abort signal that can be used to cancel strand execution */
11
- signal?: AbortSignal | undefined;
12
- }
13
- /**
14
- * A "Strand" is the core unit of execution in Liminal.
15
- *
16
- * It represents a suspendable computation that can yield Runes to control conversation state.
17
- * Strands implement both the Iterable and PromiseLike interfaces to enable both
18
- * running (via awaiting) and joining to parent strands (via yielding).
19
- *
20
- * Strands maintain their own state and can be hierarchically organized with parent-child
21
- * relationships. Child strands are bound to their parents, ensuring consistent
22
- * cancellation behavior.
23
- *
24
- * @template Y The type of Runes this Strand can yield.
25
- * @template T The result type of the Strand.
26
- */
27
- export declare class Strand<Y extends Rune<any> = Rune<any>, T = any> implements Iterable<Y, T>, PromiseLike<T> {
28
- #private;
29
- T: T;
30
- Y: Y;
31
- /** Signal that can be used to detect when this strand is aborted. */
32
- readonly signal: AbortSignal;
33
- /** Current status of the strand (untouched, pending, resolved, rejected) */
34
- status: StrandStatus<T>;
35
- /** Unique identifier for this strand. */
36
- readonly index: number;
37
- /** Nesting depth in the strand hierarchy. */
38
- readonly depth: number;
39
- /** The parent strand or undefined. */
40
- readonly parent?: Strand;
41
- /** The conversation state with which the strand operates. */
42
- readonly context: Context;
43
- constructor(definition: Definition<Y, T>, config: StrandConfig);
44
- then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): PromiseLike<TResult1 | TResult2>;
45
- [Symbol.iterator](): Generator<Y, T>;
46
- }
47
- export type StrandStatus<T = any> = StrandStatus.Untouched | StrandStatus.Pending<T> | StrandStatus.Resolved<T> | StrandStatus.Rejected;
48
- export declare namespace StrandStatus {
49
- interface Untouched {
50
- type: "untouched";
51
- }
52
- interface Pending<T> {
53
- type: "pending";
54
- promise: Promise<T>;
55
- resolve: (value: T) => void;
56
- reject: (reason?: unknown) => void;
57
- }
58
- interface Resolved<T> {
59
- type: "resolved";
60
- value: T;
61
- }
62
- type Rejected = Rejected.ConfigSignalAborted | Rejected.ParentAborted | Rejected.ContinuationExceptionThrown | Rejected.HandlerExceptionThrown;
63
- namespace Rejected {
64
- interface ConfigSignalAborted {
65
- type: "config_signal_aborted";
66
- reason: unknown;
67
- }
68
- interface ParentAborted {
69
- type: "parent_aborted";
70
- reason: unknown;
71
- }
72
- interface ContinuationExceptionThrown {
73
- type: "continuation_exception_thrown";
74
- exception: unknown;
75
- }
76
- interface HandlerExceptionThrown {
77
- type: "handler_exception_thrown";
78
- exception: unknown;
79
- }
80
- }
81
- }