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
@@ -1,26 +1,29 @@
1
1
  import { Action } from "../Action.js";
2
2
  import { isPropertyKey } from "../util/isPropertyKey.js";
3
- export function* setMessages(setterOrKey, maybeSetter) {
3
+ import { scope } from "./scope.js";
4
+ export const messages = Object.assign(messages_, {
5
+ *[Symbol.iterator]() {
6
+ const scope_ = yield* scope;
7
+ return scope_.messages;
8
+ },
9
+ });
10
+ function* messages_(setterOrKey, maybeSetter) {
4
11
  return yield Action("set_messages", async (scope) => {
5
12
  if (isPropertyKey(setterOrKey)) {
6
13
  const setterScope = scope.fork("set_messages", [setterOrKey]);
7
14
  const reduced = await setterScope.reduce(maybeSetter([...scope.messages]));
8
- const { value } = reduced;
9
- setterScope.event({
10
- type: "returned",
11
- value,
12
- });
15
+ const { messages } = reduced;
13
16
  setterScope.event({
14
17
  type: "messages_set",
15
- messages: value,
18
+ messages: [...messages],
16
19
  });
17
20
  return {
18
21
  ...scope,
19
- messages: value,
22
+ messages,
20
23
  nextArg: scope.messages,
21
24
  };
22
25
  }
23
- const messages = await setterOrKey([...scope.messages]);
26
+ const messages = new Set(Array.isArray(setterOrKey) ? setterOrKey : await setterOrKey([...scope.messages]));
24
27
  return {
25
28
  ...scope,
26
29
  messages,
@@ -28,4 +31,5 @@ export function* setMessages(setterOrKey, maybeSetter) {
28
31
  };
29
32
  });
30
33
  }
31
- //# sourceMappingURL=setMessages.js.map
34
+ Object.defineProperty(messages_, "name", { value: "messages" });
35
+ //# sourceMappingURL=messages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.js","sourceRoot":"","sources":["../../actions/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAKrC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAGxD,OAAO,EAAiB,KAAK,EAAE,MAAM,YAAY,CAAA;AAmBjD,MAAM,CAAC,MAAM,QAAQ,GAAa,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE;IACzD,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC;QAChB,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,KAAK,CAAA;QAC3B,OAAO,MAAM,CAAC,QAAQ,CAAA;IACxB,CAAC;CACF,CAAU,CAAA;AAEX,QAAQ,CAAC,CAAC,SAAS,CACjB,WAAgF,EAChF,WAA+D;IAE/D,OAAO,MAAM,MAAM,CAAC,cAAc,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;QAClD,IAAI,aAAa,CAAC,WAAW,CAAC,EAAE,CAAC;YAC/B,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,WAAW,CAAC,CAAC,CAAA;YAC7D,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC,MAAM,CAAC,WAAY,CAAC,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;YAC3E,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAA;YAC5B,WAAW,CAAC,KAAK,CAAC;gBAChB,IAAI,EAAE,cAAc;gBACpB,QAAQ,EAAE,CAAC,GAAG,QAAQ,CAAC;aACxB,CAAC,CAAA;YACF,OAAO;gBACL,GAAG,KAAK;gBACR,QAAQ;gBACR,OAAO,EAAE,KAAK,CAAC,QAAQ;aACxB,CAAA;QACH,CAAC;QACD,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,WAAW,CAAC,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;QAC3G,OAAO;YACL,GAAG,KAAK;YACR,QAAQ;YACR,OAAO,EAAE,KAAK,CAAC,QAAQ;SACxB,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC;AACD,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAA"}
@@ -1,11 +1,15 @@
1
1
  import { Action } from "../Action.ts";
2
2
  import type { ModelPushed } from "../events/ModelPushed.ts";
3
+ import type { ModelRemoved } from "../events/ModelRemoved.ts";
3
4
  import type { Model, ModelType } from "../Model.ts";
4
5
  import type { Spec } from "../Spec.ts";
5
6
  import type { JSONKey } from "../util/JSONKey.ts";
6
- import { removeModel } from "./removeModel.ts";
7
7
  export interface pushModel<K extends JSONKey, M extends ModelType> extends Action<"remove_model", Spec.Make<{
8
8
  Event: ModelPushed<K, M>;
9
9
  }>> {
10
10
  }
11
+ export interface removeModel<K extends JSONKey, M extends ModelType> extends Action<"remove_model", Spec.Make<{
12
+ Event: ModelRemoved<K, M>;
13
+ }>> {
14
+ }
11
15
  export declare function pushModel<K extends JSONKey, M extends Model>(modelKey: K, model: M): Generator<pushModel<K, M["type"]>, Generator<removeModel<K, M["type"]>, void>>;
@@ -1,6 +1,5 @@
1
1
  import { Action } from "../Action.js";
2
2
  import { applyToModels } from "./actions_common/updateModels.js";
3
- import { removeModel } from "./removeModel.js";
4
3
  export function* pushModel(modelKey, model) {
5
4
  return yield Action("remove_model", (scope) => {
6
5
  scope.event({
@@ -14,7 +13,23 @@ export function* pushModel(modelKey, model) {
14
13
  models.add(model);
15
14
  return models;
16
15
  }),
17
- nextArg: removeModel(modelKey, model),
16
+ nextArg: (function* () {
17
+ yield Action("remove_model", (scope) => {
18
+ scope.event({
19
+ type: "model_removed",
20
+ modelKey,
21
+ modelType: model.type,
22
+ });
23
+ return {
24
+ ...scope,
25
+ ...applyToModels(scope, model, (models) => {
26
+ models.delete(model);
27
+ return models;
28
+ }),
29
+ nextArg: undefined,
30
+ };
31
+ });
32
+ })(),
18
33
  };
19
34
  });
20
35
  }
@@ -1 +1 @@
1
- {"version":3,"file":"pushModel.js","sourceRoot":"","sources":["../../actions/pushModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAKrC,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAA;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAM9C,MAAM,SAAS,CAAC,CAAC,SAAS,CACxB,QAAW,EACX,KAAQ;IAER,OAAO,MAAM,MAAM,CAAC,cAAc,EAAE,CAAC,KAAK,EAAE,EAAE;QAC5C,KAAK,CAAC,KAAK,CAAC;YACV,IAAI,EAAE,cAAc;YACpB,QAAQ;YACR,SAAS,EAAE,KAAK,CAAC,IAAI;SACtB,CAAC,CAAA;QACF,OAAO;YACL,GAAG,KAAK;YACR,GAAG,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,EAAE;gBACxC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;gBACjB,OAAO,MAAM,CAAA;YACf,CAAC,CAAC;YACF,OAAO,EAAE,WAAW,CAAC,QAAQ,EAAE,KAAK,CAAC;SACtC,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
1
+ {"version":3,"file":"pushModel.js","sourceRoot":"","sources":["../../actions/pushModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAMrC,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAA;AAUhE,MAAM,SAAS,CAAC,CAAC,SAAS,CACxB,QAAW,EACX,KAAQ;IAER,OAAO,MAAM,MAAM,CAAC,cAAc,EAAE,CAAC,KAAK,EAAE,EAAE;QAC5C,KAAK,CAAC,KAAK,CAAC;YACV,IAAI,EAAE,cAAc;YACpB,QAAQ;YACR,SAAS,EAAE,KAAK,CAAC,IAAI;SACtB,CAAC,CAAA;QACF,OAAO;YACL,GAAG,KAAK;YACR,GAAG,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,EAAE;gBACxC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;gBACjB,OAAO,MAAM,CAAA;YACf,CAAC,CAAC;YACF,OAAO,EAAE,CAAC,QAAQ,CAAC;gBACjB,MAAM,MAAM,CAAC,cAAc,EAAE,CAAC,KAAK,EAAE,EAAE;oBACrC,KAAK,CAAC,KAAK,CAAC;wBACV,IAAI,EAAE,eAAe;wBACrB,QAAQ;wBACR,SAAS,EAAE,KAAK,CAAC,IAAI;qBACtB,CAAC,CAAA;oBACF,OAAO;wBACL,GAAG,KAAK;wBACR,GAAG,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,EAAE;4BACxC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;4BACpB,OAAO,MAAM,CAAA;wBACf,CAAC,CAAC;wBACF,OAAO,EAAE,SAAS;qBACnB,CAAA;gBACH,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,EAAE;SACL,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
@@ -2,4 +2,6 @@ import { Action } from "../Action.ts";
2
2
  import type { Scope } from "../Scope.ts";
3
3
  export interface getScope extends Action<"get_scope", never> {
4
4
  }
5
- export declare function getScope(): Generator<getScope, Scope>;
5
+ export declare const scope: {
6
+ [Symbol.iterator](): Iterator<getScope, Scope>;
7
+ };
@@ -0,0 +1,10 @@
1
+ import { Action } from "../Action.js";
2
+ export const scope = {
3
+ *[Symbol.iterator]() {
4
+ return yield Action("get_scope", (scope) => ({
5
+ ...scope,
6
+ nextArg: scope,
7
+ }));
8
+ },
9
+ };
10
+ //# sourceMappingURL=scope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scope.js","sourceRoot":"","sources":["../../actions/scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAKrC,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC;QAChB,OAAO,MAAM,MAAM,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAC3C,GAAG,KAAK;YACR,OAAO,EAAE,KAAK;SACf,CAAC,CAAC,CAAA;IACL,CAAC;CACF,CAAA"}
@@ -0,0 +1,23 @@
1
+ import { Action } from "../Action.ts";
2
+ import type { AgentLike } from "../Agent.ts";
3
+ import type { SectionCleared } from "../events/SectionCleared.ts";
4
+ import type { Sectioned } from "../events/Sectioned.ts";
5
+ import type { Message } from "../Message.ts";
6
+ import type { Spec } from "../Spec.ts";
7
+ import type { JSONKey } from "../util/JSONKey.ts";
8
+ export interface section<K extends JSONKey> extends Action<"section", Spec.Make<{
9
+ Event: Sectioned<K>;
10
+ }>> {
11
+ }
12
+ export interface SectionHandle<K extends JSONKey> {
13
+ clear: Generator<Action<"clear_section", Spec.Make<{
14
+ Event: SectionCleared<K>;
15
+ }>>, void>;
16
+ getMessages: () => Generator<Action<"get_section_messages", never>, Set<Message>>;
17
+ <L extends JSONKey, Y extends Action, T>(key: L, agentLike: AgentLike<Y, T>): Generator<Action<"run_section", Spec.Make<{
18
+ Child: [L, Y[""]];
19
+ Entry: Y[""]["Entry"];
20
+ Value: T;
21
+ }>>, T>;
22
+ }
23
+ export declare function section<K extends JSONKey>(sectionKey: K): Generator<section<K>, SectionHandle<K>>;
@@ -0,0 +1,64 @@
1
+ import { Action } from "../Action.js";
2
+ import { unwrapDeferred } from "../util/unwrapDeferred.js";
3
+ export function* section(sectionKey) {
4
+ return yield Action("section", (scope) => {
5
+ scope.event({
6
+ type: "sectioned",
7
+ sectionKey,
8
+ });
9
+ const section = {
10
+ sectionKey,
11
+ messages: new Set(),
12
+ };
13
+ scope.sections.add(section);
14
+ return {
15
+ ...scope,
16
+ nextArg: Object.assign(function* (key, agentLike) {
17
+ return yield Action("run_section", async (scope) => {
18
+ const sectionScope = scope.fork("run_section", [key], {
19
+ messages: new Set(section.messages),
20
+ });
21
+ const reduced = await sectionScope.reduce(unwrapDeferred(agentLike));
22
+ const { value } = reduced;
23
+ sectionScope.event({
24
+ type: "returned",
25
+ value,
26
+ });
27
+ return {
28
+ ...scope,
29
+ nextArg: value,
30
+ };
31
+ });
32
+ }, {
33
+ getMessages: (function* () {
34
+ return yield Action("get_section_messages", (scope) => ({
35
+ ...scope,
36
+ nextArg: new Set(section.messages),
37
+ }));
38
+ })(),
39
+ }, {
40
+ clear: (function* () {
41
+ return yield Action("clear_section", (scope) => {
42
+ const sections = new Set(scope.sections);
43
+ sections.delete(section);
44
+ const messages = new Set(scope.messages);
45
+ section.messages.forEach((message) => {
46
+ messages.delete(message);
47
+ });
48
+ scope.event({
49
+ type: "section_cleared",
50
+ sectionKey,
51
+ });
52
+ return {
53
+ ...scope,
54
+ nextArg: messages,
55
+ sections,
56
+ messages,
57
+ };
58
+ });
59
+ })(),
60
+ }),
61
+ };
62
+ });
63
+ }
64
+ //# sourceMappingURL=section.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"section.js","sourceRoot":"","sources":["../../actions/section.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAQrC,OAAO,EA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AG,CAAC,OAAO,CAAC,QAAQ,CAAC;qBACnC,CAAC,CAAC,CAAA;gBACL,CAAC,CAAC,EAAE;aACL,EACD;gBACE,KAAK,EACH,CAAC,QAAQ,CAAC;oBACR,OAAO,MAAM,MAAM,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,EAAE;wBAC7C,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;wBACxC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;wBACxB,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;wBACxC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;4BACnC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;wBAC1B,CAAC,CAAC,CAAA;wBACF,KAAK,CAAC,KAAK,CAAC;4BACV,IAAI,EAAE,iBAAiB;4BACvB,UAAU;yBACX,CAAC,CAAA;wBACF,OAAO;4BACL,GAAG,KAAK;4BACR,OAAO,EAAE,QAAQ;4BACjB,QAAQ;4BACR,QAAQ;yBACT,CAAA;oBACH,CAAC,CAAC,CAAA;gBACJ,CAAC,CAAC,EAAE;aACP,CACF;SACF,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export interface CliCtx {
2
2
  ctl: AbortController;
3
+ error(message: string): never;
3
4
  }
package/dist/cli/main.js CHANGED
@@ -5,7 +5,12 @@ import { runExec } from "./runExec.js";
5
5
  const args = process.argv.slice(2);
6
6
  const command = L.enum("exec").assert(args.shift());
7
7
  const ctl = new AbortController();
8
- const cliCtx = { ctl };
8
+ const cliCtx = {
9
+ ctl,
10
+ error(message) {
11
+ throw new Error(message);
12
+ },
13
+ };
9
14
  switch (command) {
10
15
  case "exec": {
11
16
  await runExec(cliCtx, args);
@@ -1 +1 @@
1
- {"version":3,"file":"main.js","sourceRoot":"","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M,CAAC,CAAC,CAAC;QACZ,MAAM,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;QAC3B,MAAK;IACP,CAAC;AACH,CAAC"}
@@ -8,7 +8,7 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
8
8
  };
9
9
  import { dirname, isAbsolute, parse, resolve } from "node:path";
10
10
  import { parseArgs } from "node:util";
11
- import { Exec, L } from "../index.js";
11
+ import { exec, L } from "../index.js";
12
12
  import { WriteHandler } from "./WriteHandler.js";
13
13
  const options = {
14
14
  config: {
@@ -31,19 +31,25 @@ export async function runExec(ctx, args) {
31
31
  const configPathResolved = resolve(configPath);
32
32
  const configDir = dirname(configPathResolved);
33
33
  const config = await import(__rewriteRelativeImportExtension(configPathResolved)).then(({ default: default_ }) => default_);
34
- const actorPathInitial = L.string.assert(positionals[0]);
35
- let actorPathResolved;
36
- if (isAbsolute(actorPathInitial)) {
37
- actorPathResolved = actorPathInitial;
34
+ const agentPathInitial = L.string.assert(positionals[0]);
35
+ let agentPathResolved;
36
+ if (isAbsolute(agentPathInitial)) {
37
+ agentPathResolved = agentPathInitial;
38
38
  }
39
39
  else {
40
- actorPathResolved = resolve(configDir, ...config.actors ? [config.actors] : [], actorPathInitial);
40
+ agentPathResolved = resolve(configDir, ...config.agents ? [config.agents] : [], agentPathInitial);
41
41
  }
42
- if (!actorPathResolved.endsWith(".ts")) {
43
- actorPathResolved = `${actorPathResolved}.ts`;
42
+ if (!agentPathResolved.endsWith(".ts")) {
43
+ agentPathResolved = `${agentPathResolved}.ts`;
44
+ }
45
+ const parsedPath = parse(agentPathResolved);
46
+ let agentLike;
47
+ try {
48
+ agentLike = await import(__rewriteRelativeImportExtension(agentPathResolved)).then(({ default: default_ }) => default_);
49
+ }
50
+ catch (_e) {
51
+ ctx.error(`Could not fine agent file at "${agentPathResolved}".`);
44
52
  }
45
- const parsedPath = parse(actorPathResolved);
46
- const actorLike = await import(__rewriteRelativeImportExtension(actorPathResolved)).then(({ default: default_ }) => default_);
47
53
  const startTime = Date.now();
48
54
  const writeHandlerOrNoop = config.write
49
55
  ? await WriteHandler({
@@ -55,14 +61,13 @@ export async function runExec(ctx, args) {
55
61
  })
56
62
  : undefined;
57
63
  const printHandlerOrNoop = config.silent ? undefined : (event) => console.log(event);
58
- const exec = Exec(actorLike, {
64
+ await exec(agentLike, {
59
65
  default: config.default,
60
66
  args: config.args,
61
- });
62
- await exec((event) => {
63
- printHandlerOrNoop?.(event);
64
- writeHandlerOrNoop?.(event);
65
- }, {
67
+ handler(event) {
68
+ printHandlerOrNoop?.(event);
69
+ writeHandlerOrNoop?.(event);
70
+ },
66
71
  signal: ctx.ctl.signal,
67
72
  });
68
73
  }
@@ -1 +1 @@
1
- {"version":3,"file":"runExec.js","sourceRoot":"","sources":["../../cli/runExec.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAC/D,OAAO,EAAE,SAAS,EAAwB,MAAM,WAAW,CAAA;AAC3D,OAAO,EAAkC,IAAI,EAAE,CAAC,EAAmC,MAAM,aAAa,CAAA;AAEtG,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,MAAM,OAAO,GAAG;IACd,MAAM,EAAE;QACN,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,YAAY;QACrB,KAAK,EAAE,GAAG;KACX;IACD,MAAM,EAAE;QACN,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,GAAG;KACX;CACmC,CAAA;AAEtC,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,GAAW,EAAE,IAAmB;IAC5D,IAAI,EACF,MAAM,EAAE,EACN,MAAM,EAAE,UAAU,EAClB,MAAM,GACP,EACD,WAAW,GACZ,GAAG,SAAS,CAAC;QACZ,IAAI;QACJ,MAAM,EAAE,IAAI;QACZ,gBAAgB,EAAE,IAAI;QACtB,OAAO;KACR,CAAC,CA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,EAAE,CAAC,QAAuB,CAAC,CAAA;IACtG,CAAC;IAAC,OAAO,EAAW,EAAE,CAAC;QACrB,GAAG,CAAC,KAAK,CAAC,iCAAiC,iBAAiB,IAAI,CAAC,CAAA;IACnE,CAAC;IACD,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;IAC5B,MAAM,kBAAkB,GAAG,MAAM,CAAC,KAAK;QACrC,CAAC,CAAC,MAAM,YAAY,CAAC;YACnB,SAAS;YACT,UAAU;YACV,MAAM;YACN,SAAS;YACT,QAAQ,EAAE,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU;SACvE,CAAC;QACF,CAAC,CAAC,SAAS,CAAA;IACb,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAoB,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IACnG,MAAM,IAAI,CAAC,SAAS,EAAE;QACpB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,IAAI,EAAE,MAAM,CAAC,IAAK;QAClB,OAAO,CAAC,KAAK;YACX,kBAAkB,EAAE,CAAC,KAAK,CAAC,CAAA;YAC3B,kBAAkB,EAAE,CAAC,KAAK,CAAC,CAAA;QAC7B,CAAC;QACD,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,MAAM;KACvB,CAAC,CAAA;AACJ,CAAC"}
@@ -11,8 +11,10 @@ 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";
17
19
  import type { ToolEnabled } from "./ToolEnabled.ts";
18
- export type LEvent = Embedded | EmbeddingRequested | Emitted | Inferred | InferenceRequested | MessageAppended | MessagesSet | Returned | Threw | ToolCalled | ToolDisabled | ToolEnabled | Aborted | MessageRemoved | Forked | ModelPushed | ModelRemoved;
20
+ export type LEvent = Embedded | EmbeddingRequested | Emitted | Inferred | InferenceRequested | MessageAppended | MessagesSet | Returned | Threw | ToolCalled | ToolDisabled | ToolEnabled | Aborted | MessageRemoved | Forked | ModelPushed | ModelRemoved | Sectioned | SectionCleared;
@@ -0,0 +1,5 @@
1
+ import type { JSONKey } from "../util/JSONKey.ts";
2
+ import type { EventBase } from "./EventBase.ts";
3
+ export interface SectionCleared<K extends JSONKey = JSONKey> extends EventBase<"section_cleared"> {
4
+ sectionKey: K;
5
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=SectionCleared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SectionCleared.js","sourceRoot":"","sources":["../../events/SectionCleared.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import type { JSONKey } from "../util/JSONKey.ts";
2
+ import type { EventBase } from "./EventBase.ts";
3
+ export interface Sectioned<K extends JSONKey = JSONKey> extends EventBase<"sectioned"> {
4
+ sectionKey: K;
5
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Sectioned.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sectioned.js","sourceRoot":"","sources":["../../events/Sectioned.ts"],"names":[],"mappings":""}
package/dist/index.d.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/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export * from "./Action.js";
2
2
  export * from "./actions/appendMessage.js";
3
- export * from "./Actor.js";
3
+ export * from "./Agent.js";
4
4
  export * from "./events/Aborted.js";
5
5
  export * from "./events/Embedded.js";
6
6
  export * from "./events/EmbeddingRequested.js";
@@ -1,9 +1,9 @@
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
- export interface ActorAssertions<S extends Spec> {
6
+ export interface AgentAssertions<S extends Spec> {
7
7
  assertSpec<A extends Spec>(...[passes]: IsExact<S, Expand<A>> extends true ? [passes?: true] : [passes: false]): void;
8
8
  }
9
- export declare function ActorAssertions<Y extends Action, R>(_actorLike: ActorLike<Y, R>): ActorAssertions<Y[""]>;
9
+ export declare function AgentAssertions<Y extends Action, R>(_agentLike: AgentLike<Y, R>): AgentAssertions<Y[""]>;
@@ -0,0 +1,6 @@
1
+ export function AgentAssertions(_agentLike) {
2
+ return {
3
+ assertSpec: () => { },
4
+ };
5
+ }
6
+ //# sourceMappingURL=AgentAssertions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentAssertions.js","sourceRoot":"","sources":["../../testing/AgentAssertions.ts"],"names":[],"mappings":"AAYA,MAAM,UAAU,eAAe,CAAsB,UAA2B;IAC9E,OAAO;QACL,UAAU,EAAE,GAAG,EAAE,GAAE,CAAC;KACrB,CAAA;AACH,CAAC"}
@@ -4,6 +4,7 @@ export const defaultTestingEmbeddingModelConfig = {
4
4
  export function TestEmbeddingModel({ getEmbedding, } = defaultTestingEmbeddingModelConfig) {
5
5
  return {
6
6
  type: "embedding",
7
+ vendor: "liminal_testing",
7
8
  embed: getEmbedding,
8
9
  };
9
10
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TestEmbeddingModel.js","sourceRoot":"","sources":["../../testing/TestEmbeddingModel.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,kCAAkC,GAA6B;IAC1E,YAAY,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;CACxC,CAAA;AAED,MAAM,UAAU,kBAAkB,CAAC,EACjC,YAAY,MACgB,kCAAkC;IAC9D,OAAO;QACL,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE,YAAY;KACpB,CAAA;AACH,CAAC"}
1
+ {"version":3,"file":"TestEmbeddingModel.js","sourceRoot":"","sources":["../../testing/TestEmbeddingModel.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,kCAAkC,GAA6B;IAC1E,YAAY,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;CACxC,CAAA;AAED,MAAM,UAAU,kBAAkB,CAAC,EACjC,YAAY,MACgB,kCAAkC;IAC9D,OAAO;QACL,IAAI,EAAE,WAAW;QACjB,MAAM,EAAE,iBAAiB;QACzB,KAAK,EAAE,YAAY;KACpB,CAAA;AACH,CAAC"}
@@ -6,6 +6,7 @@ export const defaultTestLanguageModelConfig = {
6
6
  export function TestLanguageModel({ getObject, getText, } = defaultTestLanguageModelConfig) {
7
7
  return {
8
8
  type: "language",
9
+ vendor: "liminal_testing",
9
10
  async *infer(type) {
10
11
  if (type) {
11
12
  const object = getObject();
@@ -1 +1 @@
1
- {"version":3,"file":"TestLanguageModel.js","sourceRoot":"","sources":["../../testing/TestLanguageModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAA;AASlE,MAAM,CAAC,MAAM,8BAA8B,GAA4B;IACrE,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;IACrB,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE;CAClB,CAAA;AAED,MAAM,UAAU,iBAAiB,CAAC,EAChC,SAAS,EACT,OAAO,MACoB,8BAA8B;I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AA;AACH,CAAC"}
@@ -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,4 +1,4 @@
1
- export * from "./ActorAssertions.js";
1
+ export * from "./AgentAssertions.js";
2
2
  export * from "./takeFirstAction.js";
3
3
  export * from "./TestEmbeddingModel.js";
4
4
  export * from "./TestLanguageModel.js";
@@ -1,3 +1,3 @@
1
1
  import type { Action } from "../Action.ts";
2
- import type { ActorLike } from "../Actor.ts";
3
- export declare function takeFirstAction<Y extends Action>(f: ActorLike<Y>): Promise<Y | undefined>;
2
+ import type { AgentLike } from "../Agent.ts";
3
+ export declare function takeFirstAction<Y extends Action>(f: AgentLike<Y>): Promise<Y | undefined>;