@elizaos/core 1.0.3 → 1.0.5

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 (35) hide show
  1. package/dist/chunk-2HSL25IJ.js +40 -0
  2. package/dist/{chunk-HRFT5KDK.js → chunk-AU4RQ3C3.js} +184 -402
  3. package/dist/chunk-FEPOSPNK.js +157 -0
  4. package/dist/chunk-JX2SRFHQ.js +59 -0
  5. package/dist/chunk-SIAA4J6H.js +21 -0
  6. package/dist/chunk-U2ADTLZY.js +50 -0
  7. package/dist/chunk-YIBXLDIR.js +42 -0
  8. package/dist/index-BHW44X0A.d.ts +112 -0
  9. package/dist/{index-DVKkCFlY.d.ts → index-S6eSMHDH.d.ts} +8 -9
  10. package/dist/index.d.ts +17 -9
  11. package/dist/index.js +7 -1
  12. package/dist/specs/v1/actionExample.d.ts +41 -0
  13. package/dist/specs/v1/actionExample.js +13 -0
  14. package/dist/specs/v1/index.d.ts +10 -4
  15. package/dist/specs/v1/index.js +30 -19
  16. package/dist/specs/v1/messages.d.ts +31 -0
  17. package/dist/specs/v1/messages.js +18 -0
  18. package/dist/specs/v1/posts.d.ts +10 -0
  19. package/dist/specs/v1/posts.js +12 -0
  20. package/dist/specs/v1/provider.d.ts +21 -0
  21. package/dist/specs/v1/provider.js +10 -0
  22. package/dist/specs/v1/runtime.d.ts +146 -0
  23. package/dist/specs/v1/runtime.js +12 -0
  24. package/dist/specs/v1/state.d.ts +21 -0
  25. package/dist/specs/v1/state.js +9 -0
  26. package/dist/specs/v1/templates.d.ts +42 -0
  27. package/dist/specs/v1/templates.js +11 -0
  28. package/dist/{index-Cy9ZgQIe.d.ts → specs/v1/types.d.ts} +137 -555
  29. package/dist/specs/v1/types.js +33 -0
  30. package/dist/specs/v1/uuid.d.ts +27 -0
  31. package/dist/specs/v1/uuid.js +14 -0
  32. package/dist/specs/v2/index.d.ts +2 -4
  33. package/dist/specs/v2/index.js +7 -1
  34. package/dist/{types-DzoA9aTJ.d.ts → types-D9v-eW3g.d.ts} +4 -7
  35. package/package.json +4 -4
@@ -0,0 +1,40 @@
1
+ // src/specs/v1/templates.ts
2
+ function createTemplateFunction(template) {
3
+ if (typeof template === "string") {
4
+ return () => template;
5
+ } else {
6
+ return (state) => {
7
+ if (!state) {
8
+ return "";
9
+ }
10
+ return template({ state });
11
+ };
12
+ }
13
+ }
14
+ function processTemplate(template, state) {
15
+ if (!template) {
16
+ return "";
17
+ }
18
+ if (!state) {
19
+ return typeof template === "string" ? template : "";
20
+ }
21
+ if (typeof template === "string") {
22
+ return template;
23
+ } else {
24
+ return template({ state });
25
+ }
26
+ }
27
+ function getTemplateValues(state, defaultValues) {
28
+ if (!state || !state.values) {
29
+ return defaultValues || {};
30
+ }
31
+ const stateValues = state.values;
32
+ const defaults = defaultValues || {};
33
+ return { ...defaults, ...stateValues };
34
+ }
35
+
36
+ export {
37
+ createTemplateFunction,
38
+ processTemplate,
39
+ getTemplateValues
40
+ };