@dxos/assistant-toolkit 0.8.4-main.2c6827d

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 (216) hide show
  1. package/LICENSE +8 -0
  2. package/README.md +3 -0
  3. package/dist/lib/browser/index.mjs +2778 -0
  4. package/dist/lib/browser/index.mjs.map +7 -0
  5. package/dist/lib/browser/meta.json +1 -0
  6. package/dist/lib/node-esm/index.mjs +2779 -0
  7. package/dist/lib/node-esm/index.mjs.map +7 -0
  8. package/dist/lib/node-esm/meta.json +1 -0
  9. package/dist/types/src/blueprints/design/design-blueprint.d.ts +4 -0
  10. package/dist/types/src/blueprints/design/design-blueprint.d.ts.map +1 -0
  11. package/dist/types/src/blueprints/design/design-blueprint.test.d.ts +2 -0
  12. package/dist/types/src/blueprints/design/design-blueprint.test.d.ts.map +1 -0
  13. package/dist/types/src/blueprints/design/index.d.ts +3 -0
  14. package/dist/types/src/blueprints/design/index.d.ts.map +1 -0
  15. package/dist/types/src/blueprints/discord/discord-blueprint.d.ts +18 -0
  16. package/dist/types/src/blueprints/discord/discord-blueprint.d.ts.map +1 -0
  17. package/dist/types/src/blueprints/discord/index.d.ts +3 -0
  18. package/dist/types/src/blueprints/discord/index.d.ts.map +1 -0
  19. package/dist/types/src/blueprints/index.d.ts +7 -0
  20. package/dist/types/src/blueprints/index.d.ts.map +1 -0
  21. package/dist/types/src/blueprints/linear/index.d.ts +3 -0
  22. package/dist/types/src/blueprints/linear/index.d.ts.map +1 -0
  23. package/dist/types/src/blueprints/linear/linear-blueprint.d.ts +18 -0
  24. package/dist/types/src/blueprints/linear/linear-blueprint.d.ts.map +1 -0
  25. package/dist/types/src/blueprints/planning/index.d.ts +3 -0
  26. package/dist/types/src/blueprints/planning/index.d.ts.map +1 -0
  27. package/dist/types/src/blueprints/planning/planning-blueprint.d.ts +4 -0
  28. package/dist/types/src/blueprints/planning/planning-blueprint.d.ts.map +1 -0
  29. package/dist/types/src/blueprints/planning/planning-blueprint.test.d.ts +2 -0
  30. package/dist/types/src/blueprints/planning/planning-blueprint.test.d.ts.map +1 -0
  31. package/dist/types/src/blueprints/research/index.d.ts +3 -0
  32. package/dist/types/src/blueprints/research/index.d.ts.map +1 -0
  33. package/dist/types/src/blueprints/research/research-blueprint.d.ts +4 -0
  34. package/dist/types/src/blueprints/research/research-blueprint.d.ts.map +1 -0
  35. package/dist/types/src/blueprints/research/research-blueprint.test.d.ts +2 -0
  36. package/dist/types/src/blueprints/research/research-blueprint.test.d.ts.map +1 -0
  37. package/dist/types/src/blueprints/testing.d.ts +12 -0
  38. package/dist/types/src/blueprints/testing.d.ts.map +1 -0
  39. package/dist/types/src/blueprints/websearch/index.d.ts +4 -0
  40. package/dist/types/src/blueprints/websearch/index.d.ts.map +1 -0
  41. package/dist/types/src/blueprints/websearch/websearch-blueprint.d.ts +4 -0
  42. package/dist/types/src/blueprints/websearch/websearch-blueprint.d.ts.map +1 -0
  43. package/dist/types/src/blueprints/websearch/websearch-toolkit.d.ts +27 -0
  44. package/dist/types/src/blueprints/websearch/websearch-toolkit.d.ts.map +1 -0
  45. package/dist/types/src/crud/graph.d.ts +64 -0
  46. package/dist/types/src/crud/graph.d.ts.map +1 -0
  47. package/dist/types/src/crud/graph.test.d.ts +2 -0
  48. package/dist/types/src/crud/graph.test.d.ts.map +1 -0
  49. package/dist/types/src/crud/index.d.ts +2 -0
  50. package/dist/types/src/crud/index.d.ts.map +1 -0
  51. package/dist/types/src/experimental/feed.test.d.ts +2 -0
  52. package/dist/types/src/experimental/feed.test.d.ts.map +1 -0
  53. package/dist/types/src/functions/agent/index.d.ts +5 -0
  54. package/dist/types/src/functions/agent/index.d.ts.map +1 -0
  55. package/dist/types/src/functions/agent/prompt.d.ts +9 -0
  56. package/dist/types/src/functions/agent/prompt.d.ts.map +1 -0
  57. package/dist/types/src/functions/discord/fetch-messages.d.ts +11 -0
  58. package/dist/types/src/functions/discord/fetch-messages.d.ts.map +1 -0
  59. package/dist/types/src/functions/discord/fetch-messages.test.d.ts +2 -0
  60. package/dist/types/src/functions/discord/fetch-messages.test.d.ts.map +1 -0
  61. package/dist/types/src/functions/discord/index.d.ts +12 -0
  62. package/dist/types/src/functions/discord/index.d.ts.map +1 -0
  63. package/dist/types/src/functions/document/index.d.ts +13 -0
  64. package/dist/types/src/functions/document/index.d.ts.map +1 -0
  65. package/dist/types/src/functions/document/read.d.ts +7 -0
  66. package/dist/types/src/functions/document/read.d.ts.map +1 -0
  67. package/dist/types/src/functions/document/update.d.ts +6 -0
  68. package/dist/types/src/functions/document/update.d.ts.map +1 -0
  69. package/dist/types/src/functions/entity-extraction/entity-extraction.d.ts +173 -0
  70. package/dist/types/src/functions/entity-extraction/entity-extraction.d.ts.map +1 -0
  71. package/dist/types/src/functions/entity-extraction/entity-extraction.test.d.ts +2 -0
  72. package/dist/types/src/functions/entity-extraction/entity-extraction.test.d.ts.map +1 -0
  73. package/dist/types/src/functions/entity-extraction/index.d.ts +174 -0
  74. package/dist/types/src/functions/entity-extraction/index.d.ts.map +1 -0
  75. package/dist/types/src/functions/exa/exa.d.ts +5 -0
  76. package/dist/types/src/functions/exa/exa.d.ts.map +1 -0
  77. package/dist/types/src/functions/exa/index.d.ts +3 -0
  78. package/dist/types/src/functions/exa/index.d.ts.map +1 -0
  79. package/dist/types/src/functions/exa/mock.d.ts +5 -0
  80. package/dist/types/src/functions/exa/mock.d.ts.map +1 -0
  81. package/dist/types/src/functions/github/fetch-prs.d.ts +6 -0
  82. package/dist/types/src/functions/github/fetch-prs.d.ts.map +1 -0
  83. package/dist/types/src/functions/index.d.ts +8 -0
  84. package/dist/types/src/functions/index.d.ts.map +1 -0
  85. package/dist/types/src/functions/linear/index.d.ts +9 -0
  86. package/dist/types/src/functions/linear/index.d.ts.map +1 -0
  87. package/dist/types/src/functions/linear/linear.test.d.ts +2 -0
  88. package/dist/types/src/functions/linear/linear.test.d.ts.map +1 -0
  89. package/dist/types/src/functions/linear/sync-issues.d.ts +12 -0
  90. package/dist/types/src/functions/linear/sync-issues.d.ts.map +1 -0
  91. package/dist/types/src/functions/research/document-create.d.ts +9 -0
  92. package/dist/types/src/functions/research/document-create.d.ts.map +1 -0
  93. package/dist/types/src/functions/research/index.d.ts +21 -0
  94. package/dist/types/src/functions/research/index.d.ts.map +1 -0
  95. package/dist/types/src/functions/research/research-graph.d.ts +18 -0
  96. package/dist/types/src/functions/research/research-graph.d.ts.map +1 -0
  97. package/dist/types/src/functions/research/research.d.ts +14 -0
  98. package/dist/types/src/functions/research/research.d.ts.map +1 -0
  99. package/dist/types/src/functions/research/research.test.d.ts +2 -0
  100. package/dist/types/src/functions/research/research.test.d.ts.map +1 -0
  101. package/dist/types/src/functions/research/types.d.ts +6 -0
  102. package/dist/types/src/functions/research/types.d.ts.map +1 -0
  103. package/dist/types/src/functions/tasks/index.d.ts +15 -0
  104. package/dist/types/src/functions/tasks/index.d.ts.map +1 -0
  105. package/dist/types/src/functions/tasks/read.d.ts +7 -0
  106. package/dist/types/src/functions/tasks/read.d.ts.map +1 -0
  107. package/dist/types/src/functions/tasks/task-list.d.ts +74 -0
  108. package/dist/types/src/functions/tasks/task-list.d.ts.map +1 -0
  109. package/dist/types/src/functions/tasks/task-list.test.d.ts +2 -0
  110. package/dist/types/src/functions/tasks/task-list.test.d.ts.map +1 -0
  111. package/dist/types/src/functions/tasks/update.d.ts +9 -0
  112. package/dist/types/src/functions/tasks/update.d.ts.map +1 -0
  113. package/dist/types/src/index.d.ts +7 -0
  114. package/dist/types/src/index.d.ts.map +1 -0
  115. package/dist/types/src/plugins.d.ts +19 -0
  116. package/dist/types/src/plugins.d.ts.map +1 -0
  117. package/dist/types/src/sync/index.d.ts +2 -0
  118. package/dist/types/src/sync/index.d.ts.map +1 -0
  119. package/dist/types/src/sync/sync.d.ts +15 -0
  120. package/dist/types/src/sync/sync.d.ts.map +1 -0
  121. package/dist/types/src/testing/data/exa-search-1748337321991.d.ts +38 -0
  122. package/dist/types/src/testing/data/exa-search-1748337321991.d.ts.map +1 -0
  123. package/dist/types/src/testing/data/exa-search-1748337331526.d.ts +37 -0
  124. package/dist/types/src/testing/data/exa-search-1748337331526.d.ts.map +1 -0
  125. package/dist/types/src/testing/data/exa-search-1748337344119.d.ts +58 -0
  126. package/dist/types/src/testing/data/exa-search-1748337344119.d.ts.map +1 -0
  127. package/dist/types/src/testing/data/index.d.ts +3 -0
  128. package/dist/types/src/testing/data/index.d.ts.map +1 -0
  129. package/dist/types/src/testing/index.d.ts +2 -0
  130. package/dist/types/src/testing/index.d.ts.map +1 -0
  131. package/dist/types/src/toolkits/AssistantToolkit.d.ts +17 -0
  132. package/dist/types/src/toolkits/AssistantToolkit.d.ts.map +1 -0
  133. package/dist/types/src/toolkits/AssistantToolkit.test.d.ts +2 -0
  134. package/dist/types/src/toolkits/AssistantToolkit.test.d.ts.map +1 -0
  135. package/dist/types/src/toolkits/SystemToolkit.d.ts +67 -0
  136. package/dist/types/src/toolkits/SystemToolkit.d.ts.map +1 -0
  137. package/dist/types/src/toolkits/index.d.ts +3 -0
  138. package/dist/types/src/toolkits/index.d.ts.map +1 -0
  139. package/dist/types/src/util/graphql.d.ts +22 -0
  140. package/dist/types/src/util/graphql.d.ts.map +1 -0
  141. package/dist/types/src/util/index.d.ts +2 -0
  142. package/dist/types/src/util/index.d.ts.map +1 -0
  143. package/dist/types/tsconfig.tsbuildinfo +1 -0
  144. package/package.json +69 -0
  145. package/src/blueprints/design/design-blueprint.test.ts +103 -0
  146. package/src/blueprints/design/design-blueprint.ts +33 -0
  147. package/src/blueprints/design/index.ts +7 -0
  148. package/src/blueprints/discord/discord-blueprint.ts +34 -0
  149. package/src/blueprints/discord/index.ts +7 -0
  150. package/src/blueprints/index.ts +10 -0
  151. package/src/blueprints/linear/index.ts +7 -0
  152. package/src/blueprints/linear/linear-blueprint.ts +35 -0
  153. package/src/blueprints/planning/index.ts +7 -0
  154. package/src/blueprints/planning/planning-blueprint.test.ts +124 -0
  155. package/src/blueprints/planning/planning-blueprint.ts +98 -0
  156. package/src/blueprints/research/index.ts +7 -0
  157. package/src/blueprints/research/research-blueprint.test.ts +7 -0
  158. package/src/blueprints/research/research-blueprint.ts +53 -0
  159. package/src/blueprints/testing.ts +34 -0
  160. package/src/blueprints/websearch/index.ts +8 -0
  161. package/src/blueprints/websearch/websearch-blueprint.ts +20 -0
  162. package/src/blueprints/websearch/websearch-toolkit.ts +8 -0
  163. package/src/crud/graph.test.ts +69 -0
  164. package/src/crud/graph.ts +388 -0
  165. package/src/crud/index.ts +5 -0
  166. package/src/experimental/feed.test.ts +111 -0
  167. package/src/functions/agent/index.ts +11 -0
  168. package/src/functions/agent/prompt.ts +114 -0
  169. package/src/functions/discord/fetch-messages.test.ts +58 -0
  170. package/src/functions/discord/fetch-messages.ts +252 -0
  171. package/src/functions/discord/index.ts +9 -0
  172. package/src/functions/document/index.ts +12 -0
  173. package/src/functions/document/read.ts +29 -0
  174. package/src/functions/document/update.ts +30 -0
  175. package/src/functions/entity-extraction/entity-extraction.conversations.json +1 -0
  176. package/src/functions/entity-extraction/entity-extraction.test.ts +92 -0
  177. package/src/functions/entity-extraction/entity-extraction.ts +164 -0
  178. package/src/functions/entity-extraction/index.ts +9 -0
  179. package/src/functions/exa/exa.ts +37 -0
  180. package/src/functions/exa/index.ts +6 -0
  181. package/src/functions/exa/mock.ts +71 -0
  182. package/src/functions/github/fetch-prs.ts +30 -0
  183. package/src/functions/index.ts +11 -0
  184. package/src/functions/linear/index.ts +9 -0
  185. package/src/functions/linear/linear.test.ts +83 -0
  186. package/src/functions/linear/sync-issues.ts +189 -0
  187. package/src/functions/research/document-create.ts +75 -0
  188. package/src/functions/research/index.ts +14 -0
  189. package/src/functions/research/research-graph.ts +47 -0
  190. package/src/functions/research/research-instructions.tpl +106 -0
  191. package/src/functions/research/research.conversations.json +1 -0
  192. package/src/functions/research/research.test.ts +179 -0
  193. package/src/functions/research/research.ts +190 -0
  194. package/src/functions/research/types.ts +26 -0
  195. package/src/functions/tasks/index.ts +11 -0
  196. package/src/functions/tasks/read.ts +34 -0
  197. package/src/functions/tasks/task-list.test.ts +99 -0
  198. package/src/functions/tasks/task-list.ts +165 -0
  199. package/src/functions/tasks/update.ts +52 -0
  200. package/src/index.ts +10 -0
  201. package/src/plugins.tsx +68 -0
  202. package/src/sync/index.ts +5 -0
  203. package/src/sync/sync.ts +87 -0
  204. package/src/testing/data/exa-search-1748337321991.ts +131 -0
  205. package/src/testing/data/exa-search-1748337331526.ts +144 -0
  206. package/src/testing/data/exa-search-1748337344119.ts +133 -0
  207. package/src/testing/data/index.ts +11 -0
  208. package/src/testing/index.ts +5 -0
  209. package/src/toolkits/AssistantToolkit.conversations.json +1 -0
  210. package/src/toolkits/AssistantToolkit.test.ts +88 -0
  211. package/src/toolkits/AssistantToolkit.ts +47 -0
  212. package/src/toolkits/SystemToolkit.ts +231 -0
  213. package/src/toolkits/index.ts +6 -0
  214. package/src/typedefs.d.ts +8 -0
  215. package/src/util/graphql.ts +31 -0
  216. package/src/util/index.ts +5 -0
@@ -0,0 +1,231 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Tool from '@effect/ai/Tool';
6
+ import * as Toolkit from '@effect/ai/Toolkit';
7
+ import * as Effect from 'effect/Effect';
8
+ import type * as Layer from 'effect/Layer';
9
+ import * as Record from 'effect/Record';
10
+ import * as Schema from 'effect/Schema';
11
+
12
+ import { ArtifactId } from '@dxos/assistant';
13
+ import { DXN, Obj, Relation, Tag, Type } from '@dxos/echo';
14
+ import { DatabaseService } from '@dxos/functions';
15
+ import { trim } from '@dxos/util';
16
+
17
+ export const SystemToolkit = Toolkit.make(
18
+ //
19
+ // Schema
20
+ //
21
+
22
+ Tool.make('schema-list', {
23
+ description: trim`
24
+ Lists schemas definitions.
25
+ `,
26
+ parameters: {
27
+ // TODO(wittjosiah): Remove this once parameter-less tools are fixed.
28
+ limit: Schema.Number,
29
+ },
30
+ // TODO(dmaretskyi): Effect returns ({ result, encodedResult })
31
+ success: Schema.Any,
32
+ failure: Schema.Never,
33
+ dependencies: [DatabaseService],
34
+ }),
35
+
36
+ Tool.make('schema-add', {
37
+ description: trim`
38
+ Adds a schema to the space.
39
+ The name will be used when displayed to the user.
40
+ The typename must be in the format of "example.com/type/Type".
41
+ `,
42
+ parameters: {
43
+ name: Schema.String,
44
+ typename: Schema.String,
45
+ jsonSchema: Schema.Any,
46
+ },
47
+ success: Schema.Any,
48
+ failure: Schema.Never,
49
+ dependencies: [DatabaseService],
50
+ }),
51
+
52
+ //
53
+ // Objects
54
+ //
55
+
56
+ Tool.make('object-create', {
57
+ description: trim`
58
+ Creates a new object and adds it to the current space.
59
+ Get the schema from the schema-list tool and ensure that the data matches the corresponding schema.
60
+ `,
61
+ parameters: {
62
+ typename: Schema.String,
63
+ data: Schema.Any,
64
+ },
65
+ success: Schema.Any,
66
+ failure: Schema.Never,
67
+ dependencies: [DatabaseService],
68
+ }),
69
+
70
+ Tool.make('object-remove', {
71
+ description: trim`
72
+ Removes an object or relation from the database.
73
+ `,
74
+ parameters: {
75
+ id: ArtifactId.annotations({
76
+ description: 'The ID of the object.',
77
+ }),
78
+ },
79
+ success: Schema.Any,
80
+ failure: Schema.Never,
81
+ dependencies: [DatabaseService],
82
+ }),
83
+
84
+ //
85
+ // Relations
86
+ //
87
+
88
+ Tool.make('relation-create', {
89
+ description: trim`
90
+ Creates a new relation and adds it to the current space.
91
+ Get the schema from the schema-list tool and ensure that the data matches the corresponding schema.
92
+ `,
93
+ parameters: {
94
+ typename: Schema.String,
95
+ source: ArtifactId.annotations({
96
+ description: 'The ID of the source object.',
97
+ }),
98
+ target: ArtifactId.annotations({
99
+ description: 'The ID of the target object.',
100
+ }),
101
+ data: Schema.Any.annotations({
102
+ description: 'The data to be stored in the relation.',
103
+ }),
104
+ },
105
+ success: Schema.Any,
106
+ failure: Schema.Never,
107
+ dependencies: [DatabaseService],
108
+ }),
109
+
110
+ //
111
+ // Tags
112
+ //
113
+
114
+ Tool.make('tag-add', {
115
+ description: trim`
116
+ Adds a tag to an object.
117
+ Tags are objects of type ${Tag.Tag.typename}.
118
+ `,
119
+ parameters: {
120
+ tagId: ArtifactId.annotations({
121
+ description: 'The ID of the tag.',
122
+ }),
123
+ objectId: ArtifactId.annotations({
124
+ description: 'The ID of the object.',
125
+ }),
126
+ },
127
+ success: Schema.Any,
128
+ failure: Schema.Never,
129
+ dependencies: [DatabaseService],
130
+ }),
131
+
132
+ Tool.make('tag-remove', {
133
+ description: trim`
134
+ Removes a tag from an object.
135
+ Tags are objects of type ${Tag.Tag.typename}.
136
+ `,
137
+ parameters: {
138
+ tagId: ArtifactId.annotations({
139
+ description: 'The ID of the tag.',
140
+ }),
141
+ objectId: ArtifactId.annotations({
142
+ description: 'The ID of the object.',
143
+ }),
144
+ },
145
+ success: Schema.Any,
146
+ failure: Schema.Never,
147
+ dependencies: [DatabaseService],
148
+ }),
149
+ );
150
+
151
+ export const tools = Record.keys(SystemToolkit.tools);
152
+
153
+ export const layer = (): Layer.Layer<Tool.Handler<any>, never, never> =>
154
+ SystemToolkit.toLayer({
155
+ 'schema-list': Effect.fnUntraced(function* () {
156
+ const { db } = yield* DatabaseService;
157
+ const schema = yield* Effect.promise(() => db.schemaRegistry.query({ location: ['database', 'runtime'] }).run());
158
+
159
+ return schema.map((schema) => {
160
+ const meta = Type.getMeta(schema);
161
+ return {
162
+ typename: Type.getTypename(schema),
163
+ jsonSchema: Type.toJsonSchema(schema),
164
+ kind: meta?.sourceSchema ? 'relation' : 'record',
165
+ };
166
+ });
167
+ }),
168
+
169
+ 'schema-add': Effect.fnUntraced(function* ({ name, typename, jsonSchema }) {
170
+ const { db } = yield* DatabaseService;
171
+
172
+ yield* Effect.promise(() =>
173
+ db.schemaRegistry.register([
174
+ {
175
+ typename,
176
+ version: '0.1.0',
177
+ jsonSchema,
178
+ name,
179
+ },
180
+ ]),
181
+ );
182
+ }),
183
+
184
+ 'object-create': Effect.fnUntraced(function* ({ typename, data }) {
185
+ const { db } = yield* DatabaseService;
186
+ const schema = yield* Effect.promise(() =>
187
+ db.schemaRegistry.query({ typename, location: ['database', 'runtime'] }).first(),
188
+ );
189
+
190
+ // TODO(dmaretskyi): How to add object to a collection?
191
+ const object = db.add(Obj.make(schema, data));
192
+ return object;
193
+ }),
194
+
195
+ 'object-remove': Effect.fnUntraced(function* ({ id }) {
196
+ const { db } = yield* DatabaseService;
197
+ const object = yield* DatabaseService.resolve(DXN.parse(id));
198
+ db.remove(object);
199
+ return object;
200
+ }),
201
+
202
+ 'relation-create': Effect.fnUntraced(function* ({ typename, source, target, data }) {
203
+ const { db } = yield* DatabaseService;
204
+ const schema = yield* Effect.promise(() =>
205
+ db.schemaRegistry.query({ typename, location: ['database', 'runtime'] }).first(),
206
+ );
207
+
208
+ const sourceObj = yield* DatabaseService.resolve(DXN.parse(source));
209
+ const targetObj = yield* DatabaseService.resolve(DXN.parse(target));
210
+ const relation = db.add(
211
+ Relation.make(schema, {
212
+ [Relation.Source]: sourceObj,
213
+ [Relation.Target]: targetObj,
214
+ ...data,
215
+ }),
216
+ );
217
+ return relation;
218
+ }),
219
+
220
+ 'tag-add': Effect.fnUntraced(function* ({ tagId, objectId }) {
221
+ const object = yield* DatabaseService.resolve(DXN.parse(objectId));
222
+ Obj.addTag(object, DXN.parse(tagId).toString());
223
+ return object;
224
+ }),
225
+
226
+ 'tag-remove': Effect.fnUntraced(function* ({ tagId, objectId }) {
227
+ const object = yield* DatabaseService.resolve(DXN.parse(objectId));
228
+ Obj.removeTag(object, DXN.parse(tagId).toString());
229
+ return object;
230
+ }),
231
+ });
@@ -0,0 +1,6 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ export * as AssistantToolkit from './AssistantToolkit';
6
+ export * as SystemToolkit from './SystemToolkit';
@@ -0,0 +1,8 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ declare module '*?raw' {
6
+ const content: string;
7
+ export default content;
8
+ }
@@ -0,0 +1,31 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as HttpBody from '@effect/platform/HttpBody';
6
+
7
+ /**
8
+ * Template tag literal to get syntax highlighting for the query.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * const query = gql`
13
+ * query Team($teamId: String!) {
14
+ * team(id: $teamId) {
15
+ * id
16
+ * name
17
+ * }
18
+ * }
19
+ * `;
20
+ * ```
21
+ */
22
+ export const gql = (query: string) => query;
23
+
24
+ /**
25
+ * @returns JSON body for the graphql request.
26
+ */
27
+ export const graphqlRequestBody = (query: string, variables: Record<string, any> = {}) =>
28
+ HttpBody.json({
29
+ query,
30
+ variables,
31
+ });
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ export * from './graphql';