liminal 0.5.1 → 0.5.2

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 (196) hide show
  1. package/Agent.ts +10 -0
  2. package/CHANGELOG.md +6 -0
  3. package/Exec.ts +19 -31
  4. package/L.ts +4 -7
  5. package/LiminalConfig.ts +1 -1
  6. package/Model.ts +8 -2
  7. package/PathLike.ts +8 -10
  8. package/Scope.ts +33 -14
  9. package/Tool.ts +3 -3
  10. package/actions/actions_derived/clear.ts +2 -2
  11. package/actions/actions_derived/declareModel.test.ts +10 -7
  12. package/actions/actions_derived/declareModel.ts +3 -3
  13. package/actions/actions_derived/messages.ts +0 -1
  14. package/actions/actions_derived/readers_derived.ts +15 -0
  15. package/actions/appendMessage.ts +27 -3
  16. package/actions/branch.ts +31 -33
  17. package/actions/catch.ts +3 -3
  18. package/actions/embed.ts +2 -1
  19. package/actions/enableTool.ts +2 -2
  20. package/actions/enableTool.type-test.ts +7 -7
  21. package/actions/infer.ts +15 -3
  22. package/actions/messages.ts +62 -0
  23. package/actions/pushModel.ts +22 -2
  24. package/actions/scope.ts +13 -0
  25. package/actions/section.ts +105 -0
  26. package/cli/cli_common.ts +1 -0
  27. package/cli/main.ts +6 -1
  28. package/cli/runExec.ts +20 -16
  29. package/dist/Agent.d.ts +7 -0
  30. package/dist/Agent.js +2 -0
  31. package/dist/Agent.js.map +1 -0
  32. package/dist/Exec.d.ts +5 -7
  33. package/dist/Exec.js +14 -17
  34. package/dist/Exec.js.map +1 -1
  35. package/dist/L.d.ts +4 -7
  36. package/dist/L.js +4 -7
  37. package/dist/L.js.map +1 -1
  38. package/dist/LiminalConfig.d.ts +1 -1
  39. package/dist/Model.d.ts +7 -2
  40. package/dist/PathLike.d.ts +4 -7
  41. package/dist/Scope.d.ts +11 -5
  42. package/dist/Scope.js +8 -5
  43. package/dist/Scope.js.map +1 -1
  44. package/dist/Tool.d.ts +2 -2
  45. package/dist/actions/actions_derived/clear.js +2 -2
  46. package/dist/actions/actions_derived/clear.js.map +1 -1
  47. package/dist/actions/actions_derived/declareModel.d.ts +2 -2
  48. package/dist/actions/actions_derived/declareModel.js +1 -1
  49. package/dist/actions/actions_derived/declareModel.js.map +1 -1
  50. package/dist/actions/actions_derived/declareModel.test.js +10 -7
  51. package/dist/actions/actions_derived/declareModel.test.js.map +1 -1
  52. package/dist/actions/actions_derived/messages.d.ts +3 -3
  53. package/dist/actions/actions_derived/messages.js.map +1 -1
  54. package/dist/actions/actions_derived/readers_derived.d.ts +6 -0
  55. package/dist/actions/actions_derived/readers_derived.js +14 -0
  56. package/dist/actions/actions_derived/readers_derived.js.map +1 -0
  57. package/dist/actions/appendMessage.d.ts +6 -2
  58. package/dist/actions/appendMessage.js +23 -2
  59. package/dist/actions/appendMessage.js.map +1 -1
  60. package/dist/actions/branch.d.ts +18 -14
  61. package/dist/actions/branch.js +10 -10
  62. package/dist/actions/branch.js.map +1 -1
  63. package/dist/actions/catch.d.ts +2 -2
  64. package/dist/actions/catch.js +2 -2
  65. package/dist/actions/embed.js +2 -1
  66. package/dist/actions/embed.js.map +1 -1
  67. package/dist/actions/enableTool.d.ts +2 -2
  68. package/dist/actions/enableTool.type-test.js +5 -5
  69. package/dist/actions/infer.d.ts +3 -1
  70. package/dist/actions/infer.js +11 -3
  71. package/dist/actions/infer.js.map +1 -1
  72. package/dist/actions/messages.d.ts +24 -0
  73. package/dist/actions/{setMessages.js → messages.js} +14 -10
  74. package/dist/actions/messages.js.map +1 -0
  75. package/dist/actions/pushModel.d.ts +5 -1
  76. package/dist/actions/pushModel.js +17 -2
  77. package/dist/actions/pushModel.js.map +1 -1
  78. package/dist/actions/{getScope.d.ts → scope.d.ts} +3 -1
  79. package/dist/actions/scope.js +10 -0
  80. package/dist/actions/scope.js.map +1 -0
  81. package/dist/actions/section.d.ts +23 -0
  82. package/dist/actions/section.js +64 -0
  83. package/dist/actions/section.js.map +1 -0
  84. package/dist/cli/cli_common.d.ts +1 -0
  85. package/dist/cli/main.js +6 -1
  86. package/dist/cli/main.js.map +1 -1
  87. package/dist/cli/runExec.js +21 -16
  88. package/dist/cli/runExec.js.map +1 -1
  89. package/dist/events/LEvent.d.ts +3 -1
  90. package/dist/events/SectionCleared.d.ts +5 -0
  91. package/dist/events/SectionCleared.js +2 -0
  92. package/dist/events/SectionCleared.js.map +1 -0
  93. package/dist/events/Sectioned.d.ts +5 -0
  94. package/dist/events/Sectioned.js +2 -0
  95. package/dist/events/Sectioned.js.map +1 -0
  96. package/dist/index.d.ts +1 -1
  97. package/dist/index.js +1 -1
  98. package/dist/testing/{ActorAssertions.d.ts → AgentAssertions.d.ts} +3 -3
  99. package/dist/testing/AgentAssertions.js +6 -0
  100. package/dist/testing/AgentAssertions.js.map +1 -0
  101. package/dist/testing/TestEmbeddingModel.js +1 -0
  102. package/dist/testing/TestEmbeddingModel.js.map +1 -1
  103. package/dist/testing/TestLanguageModel.js +1 -0
  104. package/dist/testing/TestLanguageModel.js.map +1 -1
  105. package/dist/testing/index.d.ts +1 -1
  106. package/dist/testing/index.js +1 -1
  107. package/dist/testing/takeFirstAction.d.ts +2 -2
  108. package/dist/tsconfig.tsbuildinfo +1 -1
  109. package/dist/types/Type.d.ts +1 -0
  110. package/dist/types/Type.js.map +1 -1
  111. package/dist/types/array.js +2 -2
  112. package/dist/types/array.js.map +1 -1
  113. package/dist/types/boolean.js +2 -2
  114. package/dist/types/boolean.js.map +1 -1
  115. package/dist/types/const.js +2 -2
  116. package/dist/types/const.js.map +1 -1
  117. package/dist/types/enum.js +2 -2
  118. package/dist/types/enum.js.map +1 -1
  119. package/dist/types/integer.js +2 -2
  120. package/dist/types/integer.js.map +1 -1
  121. package/dist/types/makeType.d.ts +2 -0
  122. package/dist/types/{declareType.js → makeType.js} +4 -3
  123. package/dist/types/makeType.js.map +1 -0
  124. package/dist/types/null.js +2 -2
  125. package/dist/types/null.js.map +1 -1
  126. package/dist/types/number.js +2 -2
  127. package/dist/types/number.js.map +1 -1
  128. package/dist/types/object.js +2 -2
  129. package/dist/types/object.js.map +1 -1
  130. package/dist/types/ref.js +2 -2
  131. package/dist/types/ref.js.map +1 -1
  132. package/dist/types/string.js +2 -2
  133. package/dist/types/string.js.map +1 -1
  134. package/dist/types/union.js +2 -2
  135. package/dist/types/union.js.map +1 -1
  136. package/dist/util/peekLast.d.ts +1 -0
  137. package/dist/util/peekLast.js +4 -0
  138. package/dist/util/peekLast.js.map +1 -0
  139. package/events/LEvent.ts +4 -0
  140. package/events/SectionCleared.ts +6 -0
  141. package/events/Sectioned.ts +6 -0
  142. package/index.ts +1 -1
  143. package/package.json +1 -1
  144. package/testing/{ActorAssertions.ts → AgentAssertions.ts} +3 -5
  145. package/testing/TestEmbeddingModel.ts +1 -0
  146. package/testing/TestLanguageModel.ts +1 -0
  147. package/testing/index.ts +1 -1
  148. package/testing/takeFirstAction.ts +2 -2
  149. package/types/Type.ts +1 -0
  150. package/types/array.ts +2 -2
  151. package/types/boolean.ts +2 -2
  152. package/types/const.ts +2 -2
  153. package/types/enum.ts +2 -2
  154. package/types/integer.ts +2 -2
  155. package/types/{declareType.ts → makeType.ts} +3 -2
  156. package/types/null.ts +2 -2
  157. package/types/number.ts +2 -2
  158. package/types/object.ts +2 -2
  159. package/types/ref.ts +2 -2
  160. package/types/string.ts +2 -2
  161. package/types/union.ts +2 -2
  162. package/util/peekLast.ts +3 -0
  163. package/Actor.ts +0 -20
  164. package/actions/actions_derived/getMessages.ts +0 -9
  165. package/actions/getScope.ts +0 -11
  166. package/actions/getSignal.ts +0 -10
  167. package/actions/getTools.ts +0 -11
  168. package/actions/removeMessage.ts +0 -22
  169. package/actions/removeModel.ts +0 -31
  170. package/actions/setMessages.ts +0 -66
  171. package/dist/Actor.d.ts +0 -14
  172. package/dist/Actor.js +0 -2
  173. package/dist/Actor.js.map +0 -1
  174. package/dist/actions/actions_derived/getMessages.d.ts +0 -3
  175. package/dist/actions/actions_derived/getMessages.js +0 -8
  176. package/dist/actions/actions_derived/getMessages.js.map +0 -1
  177. package/dist/actions/getScope.js +0 -8
  178. package/dist/actions/getScope.js.map +0 -1
  179. package/dist/actions/getSignal.d.ts +0 -4
  180. package/dist/actions/getSignal.js +0 -8
  181. package/dist/actions/getSignal.js.map +0 -1
  182. package/dist/actions/getTools.d.ts +0 -5
  183. package/dist/actions/getTools.js +0 -8
  184. package/dist/actions/getTools.js.map +0 -1
  185. package/dist/actions/removeMessage.d.ts +0 -9
  186. package/dist/actions/removeMessage.js +0 -17
  187. package/dist/actions/removeMessage.js.map +0 -1
  188. package/dist/actions/removeModel.d.ts +0 -10
  189. package/dist/actions/removeModel.js +0 -20
  190. package/dist/actions/removeModel.js.map +0 -1
  191. package/dist/actions/setMessages.d.ts +0 -16
  192. package/dist/actions/setMessages.js.map +0 -1
  193. package/dist/testing/ActorAssertions.js +0 -6
  194. package/dist/testing/ActorAssertions.js.map +0 -1
  195. package/dist/types/declareType.d.ts +0 -2
  196. package/dist/types/declareType.js.map +0 -1
@@ -21,6 +21,7 @@ export interface TypeMembers<T extends JSONValue, J extends JSONType> extends St
21
21
  declaration: () => Type<T, J> | ((...args: any) => Type<T, J>);
22
22
  args?: Array<any>;
23
23
  descriptions: Array<string>;
24
+ trace: string | undefined;
24
25
  description(): string;
25
26
  toJSON(): JSONRootType<J>;
26
27
  assert(value: unknown): T;
@@ -1 +1 @@
1
- {"version":3,"file":"Type.js","sourceRoot":"","sources":["../../types/Type.ts"],"names":[],"mappings":"AAyCA,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;AAEjD,MAAM,UAAU,MAAM,CAAC,KAAc;IACnC,OAAO,OAAO,KAAK,KAAK,UAAU,IAAI,OAAO,IAAI,KAAK,CAAA;AACxD,CAAC"}
1
+ {"version":3,"file":"Type.js","sourceRoot":"","sources":["../../types/Type.ts"],"names":[],"mappings":"AA0CA,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;AAEjD,MAAM,UAAU,MAAM,CAAC,KAAc;IACnC,OAAO,OAAO,KAAK,KAAK,UAAU,IAAI,OAAO,IAAI,KAAK,CAAA;AACxD,CAAC"}
@@ -1,9 +1,9 @@
1
- import { declareType } from "./declareType.js";
1
+ import { makeType } from "./makeType.js";
2
2
  import { normalizeTypeLike } from "./TypeLike.js";
3
3
  export function array(element) {
4
4
  return _array(normalizeTypeLike(element));
5
5
  }
6
6
  export function _array(element) {
7
- return declareType(() => _array, [element]);
7
+ return makeType(() => _array, [element]);
8
8
  }
9
9
  //# sourceMappingURL=array.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"array.js","sourceRoot":"","sources":["../../types/array.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAI9C,OAAO,EAAE,iBAAiB,EAAmE,MAAM,eAAe,CAAA;AAElH,MAAM,UAAU,KAAK,CACnB,OAAU;IAEV,OAAO,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAU,CAAA;AACpD,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,OAAa;IAClC,OAAO,WAAW,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,CAAA;AAC7C,CAAC"}
1
+ {"version":3,"file":"array.js","sourceRoot":"","sources":["../../types/array.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,OAAO,EAAE,iBAAiB,EAAmE,MAAM,eAAe,CAAA;AAElH,MAAM,UAAU,KAAK,CACnB,OAAU;IAEV,OAAO,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAU,CAAA;AACpD,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,OAAa;IAClC,OAAO,QAAQ,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,CAAA;AAC1C,CAAC"}
@@ -1,3 +1,3 @@
1
- import { declareType } from "./declareType.js";
2
- export const boolean = declareType(() => boolean);
1
+ import { makeType } from "./makeType.js";
2
+ export const boolean = makeType(() => boolean);
3
3
  //# sourceMappingURL=boolean.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"boolean.js","sourceRoot":"","sources":["../../types/boolean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAI9C,MAAM,CAAC,MAAM,OAAO,GAAmC,WAAW,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,CAAA"}
1
+ {"version":3,"file":"boolean.js","sourceRoot":"","sources":["../../types/boolean.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGxC,MAAM,CAAC,MAAM,OAAO,GAAmC,QAAQ,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,CAAA"}
@@ -1,6 +1,6 @@
1
- import { declareType } from "./declareType.js";
1
+ import { makeType } from "./makeType.js";
2
2
  function const_(type, value) {
3
- return declareType(() => const_, [type, value]);
3
+ return makeType(() => const_, [type, value]);
4
4
  }
5
5
  Object.defineProperty(const_, "name", { value: "const" });
6
6
  export { const_ as const };
@@ -1 +1 @@
1
- {"version":3,"file":"const.js","sourceRoot":"","sources":["../../types/const.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAI9C,SAAS,MAAM,CACb,IAAgB,EAChB,KAAQ;IAER,OAAO,WAAW,CAAC,GAAG,EAAE,CAAC,MAAe,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAA;AAC1D,CAAC;AACD,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAA;AACzD,OAAO,EAAE,MAAM,IAAI,KAAK,EAAE,CAAA"}
1
+ {"version":3,"file":"const.js","sourceRoot":"","sources":["../../types/const.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGxC,SAAS,MAAM,CACb,IAAgB,EAChB,KAAQ;IAER,OAAO,QAAQ,CAAC,GAAG,EAAE,CAAC,MAAe,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAA;AACvD,CAAC;AACD,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAA;AACzD,OAAO,EAAE,MAAM,IAAI,KAAK,EAAE,CAAA"}
@@ -1,7 +1,7 @@
1
- import { declareType } from "./declareType.js";
1
+ import { makeType } from "./makeType.js";
2
2
  export { enum_ as enum };
3
3
  function enum_(...values) {
4
- return declareType(() => enum_, values);
4
+ return makeType(() => enum_, values);
5
5
  }
6
6
  Object.defineProperty(enum_, "name", { value: "enum" });
7
7
  //# sourceMappingURL=enum.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"enum.js","sourceRoot":"","sources":["../../types/enum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAI9C,OAAO,EAAE,KAAK,IAAI,IAAI,EAAE,CAAA;AACxB,SAAS,KAAK,CAA0B,GAAG,MAAS;IAClD,OAAO,WAAW,CAAC,GAAG,EAAE,CAAC,KAAQ,EAAE,MAAM,CAAC,CAAA;AAC5C,CAAC;AACD,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAA"}
1
+ {"version":3,"file":"enum.js","sourceRoot":"","sources":["../../types/enum.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGxC,OAAO,EAAE,KAAK,IAAI,IAAI,EAAE,CAAA;AACxB,SAAS,KAAK,CAA0B,GAAG,MAAS;IAClD,OAAO,QAAQ,CAAC,GAAG,EAAE,CAAC,KAAQ,EAAE,MAAM,CAAC,CAAA;AACzC,CAAC;AACD,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAA"}
@@ -1,3 +1,3 @@
1
- import { declareType } from "./declareType.js";
2
- export const integer = declareType(() => integer);
1
+ import { makeType } from "./makeType.js";
2
+ export const integer = makeType(() => integer);
3
3
  //# sourceMappingURL=integer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"integer.js","sourceRoot":"","sources":["../../types/integer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAI9C,MAAM,CAAC,MAAM,OAAO,GAAkC,WAAW,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,CAAA"}
1
+ {"version":3,"file":"integer.js","sourceRoot":"","sources":["../../types/integer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGxC,MAAM,CAAC,MAAM,OAAO,GAAkC,QAAQ,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ import { type Type } from "./Type.ts";
2
+ export declare function makeType<X extends Type>(declaration: () => X | ((...args: any) => X), args?: Array<unknown>, descriptions?: Array<string>): X;
@@ -5,12 +5,13 @@ import { isTemplateStringsArray } from "../util/isTemplateStringsArray.js";
5
5
  import { AssertDiagnostics, formatAssertDiagnostics } from "./AssertDiagnostics.js";
6
6
  import { toJSON } from "./toJSON.js";
7
7
  import { TypeKey } from "./Type.js";
8
- export function declareType(declaration, args, descriptions = []) {
8
+ export function makeType(declaration, args, descriptions = []) {
9
9
  const type = Object.assign(Type, {
10
10
  [TypeKey]: true,
11
11
  declaration,
12
12
  args,
13
13
  descriptions,
14
+ trace: new Error().stack,
14
15
  description() {
15
16
  return descriptions.join("\n");
16
17
  },
@@ -46,7 +47,7 @@ export function declareType(declaration, args, descriptions = []) {
46
47
  });
47
48
  return type;
48
49
  function Type(e0, ...eRest) {
49
- return declareType(declaration, args, [
50
+ return makeType(declaration, args, [
50
51
  ...descriptions,
51
52
  ...isTemplateStringsArray(e0)
52
53
  ? [applyTemplateWithIndentation(e0, ...eRest)]
@@ -54,4 +55,4 @@ export function declareType(declaration, args, descriptions = []) {
54
55
  ]);
55
56
  }
56
57
  }
57
- //# sourceMappingURL=declareType.js.map
58
+ //# sourceMappingURL=makeType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"makeType.js","sourceRoot":"","sources":["../../types/makeType.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AAEnE,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAA;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAA;AAE1E,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAA;AAEnF,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAa,OAAO,EAAoB,MAAM,WAAW,CAAA;AAEhE,MAAM,UAAU,QAAQ,CACtB,WAA4C,EAC5C,IAAqB,EACrB,eAA8B,EAAE;IAEhC,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CACxB,IAAI,EACJ;QACE,CAAC,OAAO,CAAC,EAAE,IAAI;QACf,WAAW;QACX,IAAI;QACJ,YAAY;QACZ,KAAK,EAAE,IAAI,KAAK,EAAE,CAAC,KAAK;QACxB,WAAW;YACT,OAAO,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAChC,CAAC;QACD,WAAW,EAAE;YACX,MAAM,EAAE,SAAS;YACjB,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;gBAClB,MAAM,WAAW,GAAG,iBAAiB,CAAC,EAAE,EAAE,IAAa,EAAE,KAAK,CAAC,CAAA;gBAC/D,IAAI,WAAW,CAAC,MAAM,EAAE,CAAC;oBACvB,OAAO;wBACL,MAAM,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAA0B,EAAE,CAAC,CAAC;4BACpE,IAAI;4BACJ,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;yBAC/B,CAAC,CAAC;qBACJ,CAAA;gBACH,CAAC;gBACD,OAAO,EAAE,KAAK,EAAE,KAAe,EAAE,CAAA;YACnC,CAAC;SACF;QACD,MAAM;QACN,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;YAChB,MAAM,WAAW,GAAG,iBAAiB,CAAC,EAAE,EAAE,IAAa,EAAE,KAAK,CAAC,CAAA;YAC/D,IAAI,WAAW,CAAC,MAAM,EAAE,CAAC;gBACvB,MAAM,IAAI,qBAAqB,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC,CAAA;YACvE,CAAC;YACD,OAAO,KAAc,CAAA;QACvB,CAAC;QACD,GAAG;YACD,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC;gBAChB,OAAO,KAAK,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;YAC3B,CAAC;SACF;KACoC,CAC1B,CAAA;IACf,OAAO,IAAI,CAAA;IAIX,SAAS,IAAI,CAAC,EAAyC,EAAE,GAAG,KAA4B;QACtF,OAAO,QAAQ,CAAC,WAAW,EAAE,IAAI,EAAE;YACjC,GAAG,YAAY;YACf,GAAG,sBAAsB,CAAC,EAAE,CAAC;gBAC3B,CAAC,CAAC,CAAC,4BAA4B,CAAC,EAAE,EAAE,GAAG,KAAK,CAAC,CAAC;gBAC9C,CAAC,CAAC,CAAC,EAAE,EAAE,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;SACnD,CAAC,CAAA;IACJ,CAAC;AACH,CAAC"}
@@ -1,4 +1,4 @@
1
- import { declareType } from "./declareType.js";
2
- const null_ = declareType(() => null_);
1
+ import { makeType } from "./makeType.js";
2
+ const null_ = makeType(() => null_);
3
3
  export { null_ as null };
4
4
  //# sourceMappingURL=null.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"null.js","sourceRoot":"","sources":["../../types/null.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAI9C,MAAM,KAAK,GAA6B,WAAW,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAA;AAChE,OAAO,EAAE,KAAK,IAAI,IAAI,EAAE,CAAA"}
1
+ {"version":3,"file":"null.js","sourceRoot":"","sources":["../../types/null.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGxC,MAAM,KAAK,GAA6B,QAAQ,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAA;AAC7D,OAAO,EAAE,KAAK,IAAI,IAAI,EAAE,CAAA"}
@@ -1,3 +1,3 @@
1
- import { declareType } from "./declareType.js";
2
- export const number = declareType(() => number);
1
+ import { makeType } from "./makeType.js";
2
+ export const number = makeType(() => number);
3
3
  //# sourceMappingURL=number.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"number.js","sourceRoot":"","sources":["../../types/number.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAI9C,MAAM,CAAC,MAAM,MAAM,GAAiC,WAAW,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,CAAA"}
1
+ {"version":3,"file":"number.js","sourceRoot":"","sources":["../../types/number.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGxC,MAAM,CAAC,MAAM,MAAM,GAAiC,QAAQ,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,CAAA"}
@@ -1,10 +1,10 @@
1
- import { declareType } from "./declareType.js";
1
+ import { makeType } from "./makeType.js";
2
2
  import {} from "./Type.js";
3
3
  import { normalizeTypeLikes } from "./TypeLike.js";
4
4
  export function object(fields) {
5
5
  return normalizeTypeLikes(fields);
6
6
  }
7
7
  export function _object(fields) {
8
- return declareType(() => _object, [fields]);
8
+ return makeType(() => _object, [fields]);
9
9
  }
10
10
  //# sourceMappingURL=object.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"object.js","sourceRoot":"","sources":["../../types/object.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAG9C,OAAO,EAAa,MAAM,WAAW,CAAA;AACrC,OAAO,EAAE,kBAAkB,EAAsE,MAAM,eAAe,CAAA;AAEtH,MAAM,UAAU,MAAM,CACpB,MAAS;IAET,OAAO,kBAAkB,CAAC,MAAM,CAAU,CAAA;AAC5C,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,MAAoB;IAC1C,OAAO,WAAW,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC,CAAA;AAC7C,CAAC"}
1
+ {"version":3,"file":"object.js","sourceRoot":"","sources":["../../types/object.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAa,MAAM,WAAW,CAAA;AACrC,OAAO,EAAE,kBAAkB,EAAsE,MAAM,eAAe,CAAA;AAEtH,MAAM,UAAU,MAAM,CACpB,MAAS;IAET,OAAO,kBAAkB,CAAC,MAAM,CAAU,CAAA;AAC5C,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,MAAoB;IAC1C,OAAO,QAAQ,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC,CAAA;AAC1C,CAAC"}
package/dist/types/ref.js CHANGED
@@ -1,5 +1,5 @@
1
- import { declareType } from "./declareType.js";
1
+ import { makeType } from "./makeType.js";
2
2
  export function ref(getType) {
3
- return declareType(() => ref, [getType]);
3
+ return makeType(() => ref, [getType]);
4
4
  }
5
5
  //# sourceMappingURL=ref.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ref.js","sourceRoot":"","sources":["../../types/ref.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAI9C,MAAM,UAAU,GAAG,CAA+C,OAAyB;IACzF,OAAO,WAAW,CAAC,GAAG,EAAE,CAAC,GAAS,EAAE,CAAC,OAAO,CAAC,CAAC,CAAA;AAChD,CAAC"}
1
+ {"version":3,"file":"ref.js","sourceRoot":"","sources":["../../types/ref.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGxC,MAAM,UAAU,GAAG,CAA+C,OAAyB;IACzF,OAAO,QAAQ,CAAC,GAAG,EAAE,CAAC,GAAS,EAAE,CAAC,OAAO,CAAC,CAAC,CAAA;AAC7C,CAAC"}
@@ -1,3 +1,3 @@
1
- import { declareType } from "./declareType.js";
2
- export const string = declareType(() => string);
1
+ import { makeType } from "./makeType.js";
2
+ export const string = makeType(() => string);
3
3
  //# sourceMappingURL=string.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"string.js","sourceRoot":"","sources":["../../types/string.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAI9C,MAAM,CAAC,MAAM,MAAM,GAAiC,WAAW,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,CAAA"}
1
+ {"version":3,"file":"string.js","sourceRoot":"","sources":["../../types/string.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGxC,MAAM,CAAC,MAAM,MAAM,GAAiC,QAAQ,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,CAAA"}
@@ -1,9 +1,9 @@
1
- import { declareType } from "./declareType.js";
1
+ import { makeType } from "./makeType.js";
2
2
  import { normalizeTypeLike } from "./TypeLike.js";
3
3
  export function union(...members) {
4
4
  return _union(...members.map(normalizeTypeLike));
5
5
  }
6
6
  export function _union(...members) {
7
- return declareType(() => _union, members);
7
+ return makeType(() => _union, members);
8
8
  }
9
9
  //# sourceMappingURL=union.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"union.js","sourceRoot":"","sources":["../../types/union.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAI9C,OAAO,EAAE,iBAAiB,EAAmE,MAAM,eAAe,CAAA;AAElH,MAAM,UAAU,KAAK,CACnB,GAAG,OAAU;IAEb,OAAO,MAAM,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAU,CAAA;AAC3D,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,GAAG,OAAoB;IAC5C,OAAO,WAAW,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAC3C,CAAC"}
1
+ {"version":3,"file":"union.js","sourceRoot":"","sources":["../../types/union.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,OAAO,EAAE,iBAAiB,EAAmE,MAAM,eAAe,CAAA;AAElH,MAAM,UAAU,KAAK,CACnB,GAAG,OAAU;IAEb,OAAO,MAAM,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAU,CAAA;AAC3D,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,GAAG,OAAoB;IAC5C,OAAO,QAAQ,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AACxC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function peekLast<T>(set: Set<T>): T | undefined;
@@ -0,0 +1,4 @@
1
+ export function peekLast(set) {
2
+ return [...set][set.size - 1];
3
+ }
4
+ //# sourceMappingURL=peekLast.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"peekLast.js","sourceRoot":"","sources":["../../util/peekLast.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,QAAQ,CAAI,GAAW;IACrC,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,CAAA;AAC/B,CAAC"}
package/events/LEvent.ts CHANGED
@@ -11,6 +11,8 @@ import type { MessagesSet } from "./MessagesSet.ts"
11
11
  import type { ModelPushed } from "./ModelPushed.ts"
12
12
  import type { ModelRemoved } from "./ModelRemoved.ts"
13
13
  import type { Returned } from "./Returned.ts"
14
+ import type { SectionCleared } from "./SectionCleared.ts"
15
+ import type { Sectioned } from "./Sectioned.ts"
14
16
  import type { Threw } from "./Threw.ts"
15
17
  import type { ToolCalled } from "./ToolCalled.ts"
16
18
  import type { ToolDisabled } from "./ToolDisabled.ts"
@@ -34,3 +36,5 @@ export type LEvent =
34
36
  | Forked
35
37
  | ModelPushed
36
38
  | ModelRemoved
39
+ | Sectioned
40
+ | SectionCleared
@@ -0,0 +1,6 @@
1
+ import type { JSONKey } from "../util/JSONKey.ts"
2
+ import type { EventBase } from "./EventBase.ts"
3
+
4
+ export interface SectionCleared<K extends JSONKey = JSONKey> extends EventBase<"section_cleared"> {
5
+ sectionKey: K
6
+ }
@@ -0,0 +1,6 @@
1
+ import type { JSONKey } from "../util/JSONKey.ts"
2
+ import type { EventBase } from "./EventBase.ts"
3
+
4
+ export interface Sectioned<K extends JSONKey = JSONKey> extends EventBase<"sectioned"> {
5
+ sectionKey: K
6
+ }
package/index.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export * from "./Action.ts"
2
2
  export * from "./actions/appendMessage.ts"
3
- export * from "./Actor.ts"
3
+ export * from "./Agent.ts"
4
4
  export * from "./events/Aborted.ts"
5
5
  export * from "./events/Embedded.ts"
6
6
  export * from "./events/EmbeddingRequested.ts"
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.5.1",
6
+ "version": "0.5.2",
7
7
  "license": "Apache-2.0",
8
8
  "repository": {
9
9
  "type": "git",
@@ -1,18 +1,16 @@
1
1
  import type { IsExact } from "conditional-type-checks"
2
2
  import type { Action } from "../Action.ts"
3
- import type { ActorLike } from "../Actor.ts"
3
+ import type { AgentLike } from "../Agent.ts"
4
4
  import type { Spec } from "../Spec.ts"
5
5
  import type { Expand } from "../util/Expand.ts"
6
6
 
7
- export interface ActorAssertions<S extends Spec> {
7
+ export interface AgentAssertions<S extends Spec> {
8
8
  assertSpec<A extends Spec>(
9
9
  ...[passes]: IsExact<S, Expand<A>> extends true ? [passes?: true] : [passes: false]
10
10
  ): void
11
11
  }
12
12
 
13
- export function ActorAssertions<Y extends Action, R>(
14
- _actorLike: ActorLike<Y, R>,
15
- ): ActorAssertions<Y[""]> {
13
+ export function AgentAssertions<Y extends Action, R>(_agentLike: AgentLike<Y, R>): AgentAssertions<Y[""]> {
16
14
  return {
17
15
  assertSpec: () => {},
18
16
  }
@@ -13,6 +13,7 @@ export function TestEmbeddingModel({
13
13
  }: TestEmbeddingModelConfig = defaultTestingEmbeddingModelConfig): EmbeddingModel {
14
14
  return {
15
15
  type: "embedding",
16
+ vendor: "liminal_testing",
16
17
  embed: getEmbedding,
17
18
  }
18
19
  }
@@ -18,6 +18,7 @@ export function TestLanguageModel({
18
18
  }: TestLanguageModelConfig = defaultTestLanguageModelConfig): LanguageModel {
19
19
  return {
20
20
  type: "language",
21
+ vendor: "liminal_testing",
21
22
  async *infer(type) {
22
23
  if (type) {
23
24
  const object = getObject()
package/testing/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- export * from "./ActorAssertions.ts"
1
+ export * from "./AgentAssertions.ts"
2
2
  export * from "./takeFirstAction.ts"
3
3
  export * from "./TestEmbeddingModel.ts"
4
4
  export * from "./TestLanguageModel.ts"
@@ -1,8 +1,8 @@
1
1
  import type { Action } from "../Action.ts"
2
- import type { ActorLike } from "../Actor.ts"
2
+ import type { AgentLike } from "../Agent.ts"
3
3
  import { unwrapDeferred } from "../util/unwrapDeferred.ts"
4
4
 
5
- export async function takeFirstAction<Y extends Action>(f: ActorLike<Y>): Promise<Y | undefined> {
5
+ export async function takeFirstAction<Y extends Action>(f: AgentLike<Y>): Promise<Y | undefined> {
6
6
  const { value } = await unwrapDeferred(f).next()
7
7
  return value
8
8
  }
package/types/Type.ts CHANGED
@@ -33,6 +33,7 @@ export interface TypeMembers<T extends JSONValue, J extends JSONType> extends St
33
33
  declaration: () => Type<T, J> | ((...args: any) => Type<T, J>)
34
34
  args?: Array<any>
35
35
  descriptions: Array<string>
36
+ trace: string | undefined
36
37
  description(): string
37
38
  toJSON(): JSONRootType<J>
38
39
  assert(value: unknown): T
package/types/array.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { declareType } from "./declareType.ts"
2
1
  import type { JSONType } from "./JSONType.ts"
3
2
  import type { JSONTypeBase } from "./JSONTypeBase.ts"
3
+ import { makeType } from "./makeType.ts"
4
4
  import type { Type } from "./Type.ts"
5
5
  import { normalizeTypeLike, type NormalizeTypeLikeJ, type NormalizeTypeLikeT, type TypeLike } from "./TypeLike.ts"
6
6
 
@@ -11,7 +11,7 @@ export function array<const F extends TypeLike>(
11
11
  }
12
12
 
13
13
  export function _array(element: Type): Type {
14
- return declareType(() => _array, [element])
14
+ return makeType(() => _array, [element])
15
15
  }
16
16
 
17
17
  export interface JSONArrayType<E extends JSONType = any> extends JSONTypeBase {
package/types/boolean.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { declareType } from "./declareType.ts"
2
1
  import type { JSONTypeBase } from "./JSONTypeBase.ts"
2
+ import { makeType } from "./makeType.ts"
3
3
  import type { Type } from "./Type.ts"
4
4
 
5
- export const boolean: Type<boolean, JSONBooleanType> = declareType(() => boolean)
5
+ export const boolean: Type<boolean, JSONBooleanType> = makeType(() => boolean)
6
6
 
7
7
  export interface JSONBooleanType extends JSONTypeBase {
8
8
  type: "boolean"
package/types/const.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import type { JSONValue } from "../util/JSONValue.ts"
2
- import { declareType } from "./declareType.ts"
3
2
  import type { ConstableType } from "./JSONType.ts"
3
+ import { makeType } from "./makeType.ts"
4
4
  import type { Type } from "./Type.ts"
5
5
 
6
6
  function const_<T extends JSONValue, J extends ConstableType, const V extends T>(
7
7
  type: Type<T, J>,
8
8
  value: V,
9
9
  ): Type<V, JSONConstType<J, V>> {
10
- return declareType(() => const_<T, J, V>, [type, value])
10
+ return makeType(() => const_<T, J, V>, [type, value])
11
11
  }
12
12
  Object.defineProperty(const_, "name", { value: "const" })
13
13
  export { const_ as const }
package/types/enum.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { declareType } from "./declareType.ts"
2
1
  import type { JSONTypeBase } from "./JSONTypeBase.ts"
2
+ import { makeType } from "./makeType.ts"
3
3
  import type { Type } from "./Type.ts"
4
4
 
5
5
  export { enum_ as enum }
6
6
  function enum_<A extends Array<string>>(...values: A): Type<A[number], JSONEnumType<A[number]>> {
7
- return declareType(() => enum_<A>, values)
7
+ return makeType(() => enum_<A>, values)
8
8
  }
9
9
  Object.defineProperty(enum_, "name", { value: "enum" })
10
10
 
package/types/integer.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { declareType } from "./declareType.ts"
2
1
  import type { JSONTypeBase } from "./JSONTypeBase.ts"
2
+ import { makeType } from "./makeType.ts"
3
3
  import type { Type } from "./Type.ts"
4
4
 
5
- export const integer: Type<number, JSONIntegerType> = declareType(() => integer)
5
+ export const integer: Type<number, JSONIntegerType> = makeType(() => integer)
6
6
 
7
7
  export interface JSONIntegerType extends JSONTypeBase {
8
8
  type: "integer"
@@ -10,7 +10,7 @@ import type { JSONObjectType } from "./object.ts"
10
10
  import { toJSON } from "./toJSON.ts"
11
11
  import { type Type, TypeKey, type TypeMembers } from "./Type.ts"
12
12
 
13
- export function declareType<X extends Type>(
13
+ export function makeType<X extends Type>(
14
14
  declaration: () => X | ((...args: any) => X),
15
15
  args?: Array<unknown>,
16
16
  descriptions: Array<string> = [],
@@ -22,6 +22,7 @@ export function declareType<X extends Type>(
22
22
  declaration,
23
23
  args,
24
24
  descriptions,
25
+ trace: new Error().stack,
25
26
  description() {
26
27
  return descriptions.join("\n")
27
28
  },
@@ -61,7 +62,7 @@ export function declareType<X extends Type>(
61
62
  function Type(template: TemplateStringsArray, ...substitutions: Array<string>): X
62
63
  function Type(...values: Array<Falsy | string>): X
63
64
  function Type(e0: TemplateStringsArray | Falsy | string, ...eRest: Array<Falsy | string>): X {
64
- return declareType(declaration, args, [
65
+ return makeType(declaration, args, [
65
66
  ...descriptions,
66
67
  ...isTemplateStringsArray(e0)
67
68
  ? [applyTemplateWithIndentation(e0, ...eRest)]
package/types/null.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { declareType } from "./declareType.ts"
2
1
  import type { JSONTypeBase } from "./JSONTypeBase.ts"
2
+ import { makeType } from "./makeType.ts"
3
3
  import type { Type } from "./Type.ts"
4
4
 
5
- const null_: Type<null, JSONNullType> = declareType(() => null_)
5
+ const null_: Type<null, JSONNullType> = makeType(() => null_)
6
6
  export { null_ as null }
7
7
 
8
8
  export interface JSONNullType extends JSONTypeBase {
package/types/number.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { declareType } from "./declareType.ts"
2
1
  import type { JSONTypeBase } from "./JSONTypeBase.ts"
2
+ import { makeType } from "./makeType.ts"
3
3
  import type { Type } from "./Type.ts"
4
4
 
5
- export const number: Type<number, JSONNumberType> = declareType(() => number)
5
+ export const number: Type<number, JSONNumberType> = makeType(() => number)
6
6
 
7
7
  export interface JSONNumberType extends JSONTypeBase {
8
8
  type: "number"
package/types/object.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { JSONKey } from "../util/JSONKey.ts"
2
- import { declareType } from "./declareType.ts"
3
2
  import type { JSONType } from "./JSONType.ts"
4
3
  import type { JSONTypeBase } from "./JSONTypeBase.ts"
4
+ import { makeType } from "./makeType.ts"
5
5
  import { type Type } from "./Type.ts"
6
6
  import { normalizeTypeLikes, type NormalizeTypeLikesJ, type NormalizeTypeLikesT, type TypeLikes } from "./TypeLike.ts"
7
7
 
@@ -12,7 +12,7 @@ export function object<const F extends TypeLikes>(
12
12
  }
13
13
 
14
14
  export function _object(fields: ObjectFields): Type {
15
- return declareType(() => _object, [fields])
15
+ return makeType(() => _object, [fields])
16
16
  }
17
17
 
18
18
  export interface JSONObjectType<F extends Record<JSONKey, JSONType> = any> extends JSONTypeBase {
package/types/ref.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import type { JSONValue } from "../util/JSONValue.ts"
2
- import { declareType } from "./declareType.ts"
3
2
  import type { ConstableType } from "./JSONType.ts"
3
+ import { makeType } from "./makeType.ts"
4
4
  import type { Type } from "./Type.ts"
5
5
 
6
6
  export function ref<T extends JSONValue, J extends ConstableType>(getType: () => Type<T, J>): Type<T, JSONRefType> {
7
- return declareType(() => ref<T, J>, [getType])
7
+ return makeType(() => ref<T, J>, [getType])
8
8
  }
9
9
 
10
10
  export interface JSONRefType {
package/types/string.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { declareType } from "./declareType.ts"
2
1
  import type { JSONTypeBase } from "./JSONTypeBase.ts"
2
+ import { makeType } from "./makeType.ts"
3
3
  import type { Type } from "./Type.ts"
4
4
 
5
- export const string: Type<string, JSONStringType> = declareType(() => string)
5
+ export const string: Type<string, JSONStringType> = makeType(() => string)
6
6
 
7
7
  export interface JSONStringType extends JSONTypeBase {
8
8
  type: "string"
package/types/union.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { declareType } from "./declareType.ts"
2
1
  import type { JSONType } from "./JSONType.ts"
3
2
  import type { JSONTypeBase } from "./JSONTypeBase.ts"
3
+ import { makeType } from "./makeType.ts"
4
4
  import type { Type } from "./Type.ts"
5
5
  import { normalizeTypeLike, type NormalizeTypeLikeJ, type NormalizeTypeLikeT, type TypeLike } from "./TypeLike.ts"
6
6
 
@@ -11,7 +11,7 @@ export function union<const M extends Array<TypeLike>>(
11
11
  }
12
12
 
13
13
  export function _union(...members: Array<Type>): Type {
14
- return declareType(() => _union, members)
14
+ return makeType(() => _union, members)
15
15
  }
16
16
 
17
17
  export interface JSONUnionType<M extends JSONType = any> extends JSONTypeBase {
@@ -0,0 +1,3 @@
1
+ export function peekLast<T>(set: Set<T>): T | undefined {
2
+ return [...set][set.size - 1]
3
+ }
package/Actor.ts DELETED
@@ -1,20 +0,0 @@
1
- import type { Action } from "./Action.ts"
2
- import type { DeferredOr } from "./util/DeferredOr.ts"
3
- import type { IteratorLike } from "./util/IteratorLike.ts"
4
- import type { JSONKey } from "./util/JSONKey.ts"
5
-
6
- export type Actor<Y extends Action = Action, R = any> = IteratorLike<Y, R>
7
-
8
- export type ActorLike<Y extends Action = Action, R = any> = DeferredOr<Actor<Y, R>>
9
- export type ActorLikeY<A extends ActorLike> = A extends ActorLike<infer Y> ? Y : never
10
- export type ActorLikeT<A extends ActorLike> = A extends ActorLike<Action, infer T> ? T : never
11
-
12
- export type ActorLikes = ActorLikeArray | ActorLikeRecord
13
- export type ActorLikeArray = Array<ActorLike>
14
- export type ActorLikeRecord = Record<JSONKey, ActorLike>
15
-
16
- export type ActorLikesT<A extends ActorLikes> =
17
- & {
18
- -readonly [K in keyof A]: A[K] extends ActorLike<Action, infer T> ? T : never
19
- }
20
- & {}
@@ -1,9 +0,0 @@
1
- import { Action } from "../../Action.ts"
2
- import type { Message } from "../../Message.ts"
3
-
4
- export function* getMessages(): Generator<Action<"get_messages">, Array<Message>> {
5
- return yield Action("get_messages", (scope) => ({
6
- ...scope,
7
- nextArg: [...scope.messages],
8
- }))
9
- }
@@ -1,11 +0,0 @@
1
- import { Action } from "../Action.ts"
2
- import type { Scope } from "../Scope.ts"
3
-
4
- export interface getScope extends Action<"get_scope", never> {}
5
-
6
- export function* getScope(): Generator<getScope, Scope> {
7
- return yield Action("get_scope", (scope) => ({
8
- ...scope,
9
- nextArg: scope,
10
- }))
11
- }
@@ -1,10 +0,0 @@
1
- import { Action } from "../Action.ts"
2
-
3
- export interface getSignal extends Action<"get_signal", never> {}
4
-
5
- export function* getSignal(): Generator<getSignal, AbortSignal> {
6
- return yield (Action("get_signal", (scope) => ({
7
- ...scope,
8
- nextArg: scope.controller.signal,
9
- })))
10
- }