@eloxiv/client 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +6 -2
  3. package/dist/Account.d.ts +131 -0
  4. package/dist/Account.d.ts.map +1 -0
  5. package/dist/Account.js +169 -0
  6. package/dist/Account.js.map +1 -0
  7. package/dist/Agent.d.ts +496 -0
  8. package/dist/Agent.d.ts.map +1 -0
  9. package/dist/Agent.js +228 -0
  10. package/dist/Agent.js.map +1 -0
  11. package/dist/AgentSync.d.ts +990 -0
  12. package/dist/AgentSync.d.ts.map +1 -0
  13. package/dist/AgentSync.js +46 -0
  14. package/dist/AgentSync.js.map +1 -0
  15. package/dist/AppState.d.ts +127 -0
  16. package/dist/AppState.d.ts.map +1 -0
  17. package/dist/AppState.js +145 -0
  18. package/dist/AppState.js.map +1 -0
  19. package/dist/AppStateSync.d.ts +193 -0
  20. package/dist/AppStateSync.d.ts.map +1 -0
  21. package/dist/AppStateSync.js +23 -0
  22. package/dist/AppStateSync.js.map +1 -0
  23. package/dist/Auth.d.ts +95 -0
  24. package/dist/Auth.d.ts.map +1 -0
  25. package/dist/Auth.js +139 -0
  26. package/dist/Auth.js.map +1 -0
  27. package/dist/Avatars.d.ts +53 -0
  28. package/dist/Avatars.d.ts.map +1 -0
  29. package/dist/Avatars.js +121 -0
  30. package/dist/Avatars.js.map +1 -0
  31. package/dist/BrowserAnalytics.d.ts +56 -0
  32. package/dist/BrowserAnalytics.d.ts.map +1 -0
  33. package/dist/BrowserAnalytics.js +94 -0
  34. package/dist/BrowserAnalytics.js.map +1 -0
  35. package/dist/Chat.d.ts +712 -0
  36. package/dist/Chat.d.ts.map +1 -0
  37. package/dist/Chat.js +883 -0
  38. package/dist/Chat.js.map +1 -0
  39. package/dist/ChatIntegrity.d.ts +63 -0
  40. package/dist/ChatIntegrity.d.ts.map +1 -0
  41. package/dist/ChatIntegrity.js +89 -0
  42. package/dist/ChatIntegrity.js.map +1 -0
  43. package/dist/ChatSends.d.ts +103 -0
  44. package/dist/ChatSends.d.ts.map +1 -0
  45. package/dist/ChatSends.js +157 -0
  46. package/dist/ChatSends.js.map +1 -0
  47. package/dist/Client.d.ts +113 -0
  48. package/dist/Client.d.ts.map +1 -0
  49. package/dist/Client.js +189 -0
  50. package/dist/Client.js.map +1 -0
  51. package/dist/Collab.d.ts +138 -0
  52. package/dist/Collab.d.ts.map +1 -0
  53. package/dist/Collab.js +454 -0
  54. package/dist/Collab.js.map +1 -0
  55. package/dist/CollabTools.d.ts +129 -0
  56. package/dist/CollabTools.d.ts.map +1 -0
  57. package/dist/CollabTools.js +277 -0
  58. package/dist/CollabTools.js.map +1 -0
  59. package/dist/Connections.d.ts +288 -0
  60. package/dist/Connections.d.ts.map +1 -0
  61. package/dist/Connections.js +316 -0
  62. package/dist/Connections.js.map +1 -0
  63. package/dist/Consent.d.ts +338 -0
  64. package/dist/Consent.d.ts.map +1 -0
  65. package/dist/Consent.js +142 -0
  66. package/dist/Consent.js.map +1 -0
  67. package/dist/Desktop.d.ts +61 -0
  68. package/dist/Desktop.d.ts.map +1 -0
  69. package/dist/Desktop.js +101 -0
  70. package/dist/Desktop.js.map +1 -0
  71. package/dist/Directory.d.ts +36 -0
  72. package/dist/Directory.d.ts.map +1 -0
  73. package/dist/Directory.js +42 -0
  74. package/dist/Directory.js.map +1 -0
  75. package/dist/ErrorReporter.d.ts +48 -0
  76. package/dist/ErrorReporter.d.ts.map +1 -0
  77. package/dist/ErrorReporter.js +70 -0
  78. package/dist/ErrorReporter.js.map +1 -0
  79. package/dist/ExpoSqlite.d.ts +7 -0
  80. package/dist/ExpoSqlite.d.ts.map +1 -0
  81. package/dist/ExpoSqlite.js +7 -0
  82. package/dist/ExpoSqlite.js.map +1 -0
  83. package/dist/FileSync.d.ts +265 -0
  84. package/dist/FileSync.d.ts.map +1 -0
  85. package/dist/FileSync.js +29 -0
  86. package/dist/FileSync.js.map +1 -0
  87. package/dist/FileTables.gen.d.ts +109 -0
  88. package/dist/FileTables.gen.d.ts.map +1 -0
  89. package/dist/FileTables.gen.js +23 -0
  90. package/dist/FileTables.gen.js.map +1 -0
  91. package/dist/Foldkit.d.ts +487 -0
  92. package/dist/Foldkit.d.ts.map +1 -0
  93. package/dist/Foldkit.js +617 -0
  94. package/dist/Foldkit.js.map +1 -0
  95. package/dist/History.d.ts +133 -0
  96. package/dist/History.d.ts.map +1 -0
  97. package/dist/History.js +210 -0
  98. package/dist/History.js.map +1 -0
  99. package/dist/InboxSync.d.ts +428 -0
  100. package/dist/InboxSync.d.ts.map +1 -0
  101. package/dist/InboxSync.js +37 -0
  102. package/dist/InboxSync.js.map +1 -0
  103. package/dist/KernelTables.gen.d.ts +1522 -0
  104. package/dist/KernelTables.gen.d.ts.map +1 -0
  105. package/dist/KernelTables.gen.js +307 -0
  106. package/dist/KernelTables.gen.js.map +1 -0
  107. package/dist/Make.d.ts +75 -0
  108. package/dist/Make.d.ts.map +1 -0
  109. package/dist/Make.js +70 -0
  110. package/dist/Make.js.map +1 -0
  111. package/dist/Models.d.ts +88 -0
  112. package/dist/Models.d.ts.map +1 -0
  113. package/dist/Models.js +80 -0
  114. package/dist/Models.js.map +1 -0
  115. package/dist/Optimistic.d.ts +120 -0
  116. package/dist/Optimistic.d.ts.map +1 -0
  117. package/dist/Optimistic.js +231 -0
  118. package/dist/Optimistic.js.map +1 -0
  119. package/dist/PlatformSync.d.ts +273 -0
  120. package/dist/PlatformSync.d.ts.map +1 -0
  121. package/dist/PlatformSync.js +92 -0
  122. package/dist/PlatformSync.js.map +1 -0
  123. package/dist/Poll.d.ts +113 -0
  124. package/dist/Poll.d.ts.map +1 -0
  125. package/dist/Poll.js +179 -0
  126. package/dist/Poll.js.map +1 -0
  127. package/dist/Preferences.d.ts +18 -0
  128. package/dist/Preferences.d.ts.map +1 -0
  129. package/dist/Preferences.js +22 -0
  130. package/dist/Preferences.js.map +1 -0
  131. package/dist/Proposals.d.ts +29 -0
  132. package/dist/Proposals.d.ts.map +1 -0
  133. package/dist/Proposals.js +41 -0
  134. package/dist/Proposals.js.map +1 -0
  135. package/dist/React.d.ts +17 -0
  136. package/dist/React.d.ts.map +1 -0
  137. package/dist/React.js +17 -0
  138. package/dist/React.js.map +1 -0
  139. package/dist/Reader.d.ts +35 -0
  140. package/dist/Reader.d.ts.map +1 -0
  141. package/dist/Reader.js +136 -0
  142. package/dist/Reader.js.map +1 -0
  143. package/dist/Resources.d.ts +98 -0
  144. package/dist/Resources.d.ts.map +1 -0
  145. package/dist/Resources.js +161 -0
  146. package/dist/Resources.js.map +1 -0
  147. package/dist/Rows.d.ts +4 -0
  148. package/dist/Rows.d.ts.map +1 -0
  149. package/dist/Rows.js +16 -0
  150. package/dist/Rows.js.map +1 -0
  151. package/dist/Runtime.d.ts +254 -0
  152. package/dist/Runtime.d.ts.map +1 -0
  153. package/dist/Runtime.js +1249 -0
  154. package/dist/Runtime.js.map +1 -0
  155. package/dist/RuntimeRuns.d.ts +74 -0
  156. package/dist/RuntimeRuns.d.ts.map +1 -0
  157. package/dist/RuntimeRuns.js +118 -0
  158. package/dist/RuntimeRuns.js.map +1 -0
  159. package/dist/ServicesSync.d.ts +286 -0
  160. package/dist/ServicesSync.d.ts.map +1 -0
  161. package/dist/ServicesSync.js +40 -0
  162. package/dist/ServicesSync.js.map +1 -0
  163. package/dist/Session.d.ts +226 -0
  164. package/dist/Session.d.ts.map +1 -0
  165. package/dist/Session.js +763 -0
  166. package/dist/Session.js.map +1 -0
  167. package/dist/ShareGrant.d.ts +47 -0
  168. package/dist/ShareGrant.d.ts.map +1 -0
  169. package/dist/ShareGrant.js +20 -0
  170. package/dist/ShareGrant.js.map +1 -0
  171. package/dist/Sharing.d.ts +203 -0
  172. package/dist/Sharing.d.ts.map +1 -0
  173. package/dist/Sharing.js +520 -0
  174. package/dist/Sharing.js.map +1 -0
  175. package/dist/Skew.d.ts +52 -0
  176. package/dist/Skew.d.ts.map +1 -0
  177. package/dist/Skew.js +77 -0
  178. package/dist/Skew.js.map +1 -0
  179. package/dist/SpacesSync.d.ts +247 -0
  180. package/dist/SpacesSync.d.ts.map +1 -0
  181. package/dist/SpacesSync.js +30 -0
  182. package/dist/SpacesSync.js.map +1 -0
  183. package/dist/Storage.d.ts +51 -0
  184. package/dist/Storage.d.ts.map +1 -0
  185. package/dist/Storage.js +107 -0
  186. package/dist/Storage.js.map +1 -0
  187. package/dist/Sync.d.ts +48 -0
  188. package/dist/Sync.d.ts.map +1 -0
  189. package/dist/Sync.js +48 -0
  190. package/dist/Sync.js.map +1 -0
  191. package/dist/SyncTables.d.ts +13 -0
  192. package/dist/SyncTables.d.ts.map +1 -0
  193. package/dist/SyncTables.js +13 -0
  194. package/dist/SyncTables.js.map +1 -0
  195. package/dist/Tab.d.ts +36 -0
  196. package/dist/Tab.d.ts.map +1 -0
  197. package/dist/Tab.js +44 -0
  198. package/dist/Tab.js.map +1 -0
  199. package/dist/Transport.d.ts +139 -0
  200. package/dist/Transport.d.ts.map +1 -0
  201. package/dist/Transport.js +232 -0
  202. package/dist/Transport.js.map +1 -0
  203. package/dist/Upload.d.ts +41 -0
  204. package/dist/Upload.d.ts.map +1 -0
  205. package/dist/Upload.js +93 -0
  206. package/dist/Upload.js.map +1 -0
  207. package/dist/WebMcp.d.ts +78 -0
  208. package/dist/WebMcp.d.ts.map +1 -0
  209. package/dist/WebMcp.js +204 -0
  210. package/dist/WebMcp.js.map +1 -0
  211. package/dist/index.d.ts +27 -0
  212. package/dist/index.d.ts.map +1 -0
  213. package/dist/index.js +27 -0
  214. package/dist/index.js.map +1 -0
  215. package/package.json +97 -3
  216. package/src/Account.ts +249 -0
  217. package/src/Agent.ts +387 -0
  218. package/src/AgentSync.ts +59 -0
  219. package/src/AppState.ts +222 -0
  220. package/src/AppStateSync.ts +26 -0
  221. package/src/Auth.ts +225 -0
  222. package/src/Avatars.ts +144 -0
  223. package/src/BrowserAnalytics.ts +133 -0
  224. package/src/Chat.ts +1150 -0
  225. package/src/ChatIntegrity.ts +130 -0
  226. package/src/ChatSends.ts +209 -0
  227. package/src/Client.ts +319 -0
  228. package/src/Collab.ts +524 -0
  229. package/src/CollabTools.ts +381 -0
  230. package/src/Connections.ts +517 -0
  231. package/src/Consent.ts +176 -0
  232. package/src/Desktop.ts +139 -0
  233. package/src/Directory.ts +71 -0
  234. package/src/ErrorReporter.ts +112 -0
  235. package/src/ExpoSqlite.ts +6 -0
  236. package/src/FileSync.ts +34 -0
  237. package/src/FileTables.gen.ts +23 -0
  238. package/src/Foldkit.ts +960 -0
  239. package/src/History.ts +337 -0
  240. package/src/InboxSync.ts +47 -0
  241. package/src/KernelTables.gen.ts +329 -0
  242. package/src/Make.ts +120 -0
  243. package/src/Models.ts +134 -0
  244. package/src/Optimistic.ts +364 -0
  245. package/src/PlatformSync.ts +156 -0
  246. package/src/Poll.ts +227 -0
  247. package/src/Preferences.ts +42 -0
  248. package/src/Proposals.ts +57 -0
  249. package/src/React.ts +26 -0
  250. package/src/Reader.ts +180 -0
  251. package/src/Resources.ts +257 -0
  252. package/src/Rows.ts +16 -0
  253. package/src/Runtime.ts +1409 -0
  254. package/src/RuntimeRuns.ts +180 -0
  255. package/src/ServicesSync.ts +58 -0
  256. package/src/Session.ts +814 -0
  257. package/src/ShareGrant.ts +20 -0
  258. package/src/Sharing.ts +696 -0
  259. package/src/Skew.ts +97 -0
  260. package/src/SpacesSync.ts +61 -0
  261. package/src/Storage.ts +167 -0
  262. package/src/Sync.ts +125 -0
  263. package/src/SyncTables.ts +12 -0
  264. package/src/Tab.ts +59 -0
  265. package/src/Transport.ts +321 -0
  266. package/src/Upload.ts +125 -0
  267. package/src/WebMcp.ts +279 -0
  268. package/src/index.ts +26 -0
  269. package/src/web-globals.d.ts +103 -0
@@ -0,0 +1,329 @@
1
+ // Generated from the kernel-provided modules' Drizzle tables and entities by packages/testing/scripts/sync-tables.ts (the CLI's
2
+ // sync generator, through drizzle-zero 0.21.0). Do not edit: run `pnpm --filter @eloxiv/testing generate`.
3
+ import { boolean, enumeration, json, number, relationships, string, table } from "@rocicorp/zero"
4
+ import { shareGrant } from "./ShareGrant.ts"
5
+
6
+ export const workItemTable = table("workItem")
7
+ .from("eloxiv_inbox.work_item")
8
+ .columns({
9
+ id: string(),
10
+ orgId: string().from("org_id"),
11
+ module: string(),
12
+ source: string(),
13
+ sourceId: string().from("source_id"),
14
+ state: enumeration<"open" | "in_progress" | "waiting" | "done" | "dismissed">(),
15
+ sourceState: string().from("source_state").optional(),
16
+ assigneeUserId: string().from("assignee_user_id").optional(),
17
+ assigneeGroupId: string().from("assignee_group_id").optional(),
18
+ assignedBy: string().from("assigned_by").optional(),
19
+ title: string(),
20
+ linkModule: string().from("link_module"),
21
+ linkEntity: string().from("link_entity"),
22
+ linkId: string().from("link_id"),
23
+ view: string().optional(),
24
+ dueAt: number().from("due_at").optional(),
25
+ createdAt: number().from("created_at"),
26
+ updatedAt: number().from("updated_at"),
27
+ closedAt: number().from("closed_at").optional(),
28
+ })
29
+ .primaryKey("id")
30
+
31
+ export const notificationTable = table("notification")
32
+ .from("eloxiv_notifications.notification")
33
+ .columns({
34
+ id: string(),
35
+ orgId: string().from("org_id"),
36
+ recipientId: string().from("recipient_id"),
37
+ category: string(),
38
+ title: string(),
39
+ body: string(),
40
+ linkModule: string().from("link_module").optional(),
41
+ linkEntity: string().from("link_entity").optional(),
42
+ linkId: string().from("link_id").optional(),
43
+ createdAt: number().from("created_at"),
44
+ readAt: number().from("read_at").optional(),
45
+ dismissedAt: number().from("dismissed_at").optional(),
46
+ })
47
+ .primaryKey("id")
48
+
49
+ export const approvalRequestTable = table("approvalRequest")
50
+ .from("eloxiv_approvals.request")
51
+ .columns({
52
+ id: string(),
53
+ orgId: string().from("org_id"),
54
+ requesterId: string().from("requester_id"),
55
+ action: string(),
56
+ title: string(),
57
+ input: json(),
58
+ quorum: number(),
59
+ allowSelfApproval: boolean().from("allow_self_approval"),
60
+ status: enumeration<"pending" | "approved" | "rejected" | "expired">(),
61
+ approvals: number(),
62
+ expiresAt: number().from("expires_at").optional(),
63
+ createdAt: number().from("created_at"),
64
+ decidedAt: number().from("decided_at").optional(),
65
+ execution: json().optional(),
66
+ })
67
+ .primaryKey("id")
68
+
69
+ export const settingValueTable = table("settingValue")
70
+ .from("eloxiv_settings.value")
71
+ .columns({
72
+ id: string(),
73
+ key: string(),
74
+ level: enumeration<"user" | "org">(),
75
+ orgId: string().from("org_id"),
76
+ userId: string().from("user_id").optional(),
77
+ value: json().optional(),
78
+ updatedBy: string().from("updated_by"),
79
+ updatedAt: number().from("updated_at"),
80
+ })
81
+ .primaryKey("id")
82
+
83
+ export const flagRuleTable = table("flagRule")
84
+ .from("eloxiv_flags.rule")
85
+ .columns({
86
+ id: string(),
87
+ orgId: string().from("org_id"),
88
+ flag: string(),
89
+ kind: enumeration<"user" | "group" | "role" | "org" | "rollout">(),
90
+ subject: string().optional(),
91
+ userId: string().from("user_id").optional(),
92
+ groupId: string().from("group_id").optional(),
93
+ enabled: boolean(),
94
+ percentage: number().optional(),
95
+ updatedBy: string().from("updated_by"),
96
+ updatedAt: number().from("updated_at"),
97
+ })
98
+ .primaryKey("id")
99
+
100
+ export const agentConversationTable = table("agentConversation")
101
+ .from("eloxiv_agent.conversation")
102
+ .columns({
103
+ id: string(),
104
+ orgId: string().from("org_id"),
105
+ userId: string().from("user_id"),
106
+ title: string(),
107
+ createdAt: number().from("created_at"),
108
+ updatedAt: number().from("updated_at"),
109
+ pinned: boolean(),
110
+ archived: boolean(),
111
+ hidden: boolean(),
112
+ resourceModule: string().from("resource_module").optional(),
113
+ resourceEntity: string().from("resource_entity").optional(),
114
+ resourceId: string().from("resource_id").optional(),
115
+ team: string().optional(),
116
+ })
117
+ .primaryKey("id")
118
+
119
+ export const agentCheckpointTable = table("agentCheckpoint")
120
+ .from("eloxiv_agent.checkpoint")
121
+ .columns({
122
+ id: string(),
123
+ orgId: string().from("org_id"),
124
+ userId: string().from("user_id"),
125
+ conversationId: string().from("conversation_id"),
126
+ label: string(),
127
+ upTo: number().from("up_to"),
128
+ messages: number(),
129
+ createdAt: number().from("created_at"),
130
+ restoredAt: number().from("restored_at").optional(),
131
+ })
132
+ .primaryKey("id")
133
+
134
+ export const agentMessageTable = table("agentMessage")
135
+ .from("eloxiv_agent.message")
136
+ .columns({
137
+ id: string(),
138
+ orgId: string().from("org_id"),
139
+ userId: string().from("user_id"),
140
+ conversationId: string().from("conversation_id"),
141
+ runId: string().from("run_id").optional(),
142
+ seq: number(),
143
+ role: enumeration<"user" | "assistant" | "tool" | "summary">(),
144
+ text: string(),
145
+ coveredBy: string().from("covered_by").optional(),
146
+ createdAt: number().from("created_at"),
147
+ })
148
+ .primaryKey("id")
149
+
150
+ export const agentRunTable = table("agentRun")
151
+ .from("eloxiv_agent.run")
152
+ .columns({
153
+ id: string(),
154
+ orgId: string().from("org_id"),
155
+ userId: string().from("user_id"),
156
+ conversationId: string().from("conversation_id"),
157
+ parentRunId: string().from("parent_run_id").optional(),
158
+ kind: enumeration<"turn" | "subagent" | "job">(),
159
+ status: enumeration<"queued" | "running" | "waiting" | "succeeded" | "stopped" | "failed" | "cancelled">(),
160
+ stopReason: string().from("stop_reason").optional(),
161
+ inputTokens: number().from("input_tokens"),
162
+ outputTokens: number().from("output_tokens"),
163
+ steps: number(),
164
+ result: string().optional(),
165
+ error: string().optional(),
166
+ createdAt: number().from("created_at"),
167
+ finishedAt: number().from("finished_at").optional(),
168
+ })
169
+ .primaryKey("id")
170
+
171
+ export const agentSubmissionTable = table("agentSubmission")
172
+ .from("eloxiv_agent.submission")
173
+ .columns({
174
+ id: string(),
175
+ orgId: string().from("org_id"),
176
+ userId: string().from("user_id"),
177
+ conversationId: string().from("conversation_id"),
178
+ runId: string().from("run_id"),
179
+ messageId: string().from("message_id"),
180
+ seq: number(),
181
+ kind: enumeration<"turn" | "job">(),
182
+ status: enumeration<"queued" | "promoted" | "cancelled" | "expired" | "refused">(),
183
+ text: string(),
184
+ createdAt: number().from("created_at"),
185
+ expiresAt: number().from("expires_at"),
186
+ settledAt: number().from("settled_at").optional(),
187
+ })
188
+ .primaryKey("id")
189
+
190
+ export const spaceGrantTable = table("spaceGrant")
191
+ .from("eloxiv_spaces.space_grant")
192
+ .columns({
193
+ id: string(),
194
+ spaceId: string().from("space_id"),
195
+ orgId: string().from("org_id"),
196
+ audience: string(),
197
+ title: string(),
198
+ description: string().optional(),
199
+ icon: string().optional(),
200
+ entries: json(),
201
+ position: number(),
202
+ withdrawn: boolean(),
203
+ updatedBy: string().from("updated_by"),
204
+ updatedAt: number().from("updated_at"),
205
+ })
206
+ .primaryKey("id")
207
+
208
+ export const spacePreferenceTable = table("spacePreference")
209
+ .from("eloxiv_spaces.preference")
210
+ .columns({
211
+ id: string(),
212
+ orgId: string().from("org_id"),
213
+ userId: string().from("user_id"),
214
+ spaceId: string().from("space_id"),
215
+ grantId: string().from("grant_id"),
216
+ pinned: boolean().optional(),
217
+ hidden: boolean().optional(),
218
+ position: number().optional(),
219
+ entryOrder: json().from("entry_order").optional(),
220
+ hiddenEntries: json().from("hidden_entries").optional(),
221
+ updatedAt: number().from("updated_at"),
222
+ })
223
+ .primaryKey("id")
224
+
225
+ export const appStateEntryTable = table("appStateEntry")
226
+ .from("eloxiv_app_state.entry")
227
+ .columns({
228
+ id: string(),
229
+ orgId: string().from("org_id"),
230
+ userId: string().from("user_id"),
231
+ tabId: string().from("tab_id"),
232
+ key: string(),
233
+ value: json().optional(),
234
+ version: number(),
235
+ writtenBy: string().from("written_by").optional(),
236
+ updatedAt: number().from("updated_at"),
237
+ })
238
+ .primaryKey("id")
239
+
240
+ export const appCommandTable = table("appCommand")
241
+ .from("eloxiv_app_state.command")
242
+ .columns({
243
+ id: string(),
244
+ commandId: string().from("command_id"),
245
+ orgId: string().from("org_id"),
246
+ userId: string().from("user_id"),
247
+ tabId: string().from("tab_id"),
248
+ command: json(),
249
+ issuedBy: string().from("issued_by"),
250
+ issuedAt: number().from("issued_at"),
251
+ acknowledgedAt: number().from("acknowledged_at").optional(),
252
+ acknowledgedBy: string().from("acknowledged_by").optional(),
253
+ outcome: string().optional(),
254
+ detail: string().optional(),
255
+ })
256
+ .primaryKey("id")
257
+
258
+ export const progressTaskTable = table("progressTask")
259
+ .from("eloxiv_progress.task")
260
+ .columns({
261
+ id: string(),
262
+ orgId: string().from("org_id"),
263
+ ownerId: string().from("owner_id"),
264
+ kind: enumeration<"workflow" | "ingestion" | "agent-run" | "import" | "export" | "erasure" | "action">(),
265
+ source: string(),
266
+ title: string(),
267
+ step: string().optional(),
268
+ message: string().optional(),
269
+ percent: number().optional(),
270
+ done: number().optional(),
271
+ total: number().optional(),
272
+ status: enumeration<"running" | "succeeded" | "failed" | "cancelled">(),
273
+ cancelRequested: boolean().from("cancel_requested"),
274
+ error: string().optional(),
275
+ executionId: string().from("execution_id").optional(),
276
+ startedAt: number().from("started_at"),
277
+ updatedAt: number().from("updated_at"),
278
+ finishedAt: number().from("finished_at").optional(),
279
+ })
280
+ .primaryKey("id")
281
+
282
+ export const consentChoiceTable = table("consentChoice")
283
+ .from("eloxiv_privacy.consent")
284
+ .columns({
285
+ id: string(),
286
+ orgId: string().from("org_id"),
287
+ userId: string().from("user_id"),
288
+ category: enumeration<"functional" | "analytics" | "marketing">(),
289
+ granted: boolean(),
290
+ decidedAt: number().from("decided_at"),
291
+ })
292
+ .primaryKey("id")
293
+ .unique("orgId", "userId", "category")
294
+
295
+ export const consentSubjectTable = table("consentSubject")
296
+ .from("eloxiv_privacy.subject")
297
+ .columns({
298
+ id: string(),
299
+ orgId: string().from("org_id"),
300
+ userId: string().from("user_id"),
301
+ region: string().optional(),
302
+ updatedAt: number().from("updated_at"),
303
+ })
304
+ .primaryKey("id")
305
+ .unique("orgId", "userId")
306
+
307
+ export const approvalRequestRelationships = relationships(approvalRequestTable, ({ many }) => ({
308
+ shares: many({ sourceField: ["id"], destSchema: shareGrant, destField: ["resourceId"] }),
309
+ }))
310
+
311
+ export const agentConversationRelationships = relationships(agentConversationTable, ({ many }) => ({
312
+ shares: many({ sourceField: ["id"], destSchema: shareGrant, destField: ["resourceId"] }),
313
+ }))
314
+
315
+ export const agentMessageRelationships = relationships(agentMessageTable, ({ one }) => ({
316
+ conversation: one({ sourceField: ["conversationId"], destSchema: agentConversationTable, destField: ["id"] }),
317
+ }))
318
+
319
+ export const agentRunRelationships = relationships(agentRunTable, ({ one }) => ({
320
+ conversation: one({ sourceField: ["conversationId"], destSchema: agentConversationTable, destField: ["id"] }),
321
+ }))
322
+
323
+ export const spaceGrantRelationships = relationships(spaceGrantTable, ({ many }) => ({
324
+ preferences: many({ sourceField: ["id"], destSchema: spacePreferenceTable, destField: ["grantId"] }),
325
+ }))
326
+
327
+ export const spacePreferenceRelationships = relationships(spacePreferenceTable, ({ one }) => ({
328
+ grant: one({ sourceField: ["grantId"], destSchema: spaceGrantTable, destField: ["id"] }),
329
+ }))
package/src/Make.ts ADDED
@@ -0,0 +1,120 @@
1
+ /**
2
+ * MAKE modules from the client SDK: their actions are installed at runtime, so the typed client (projected from
3
+ * the modules the app was built with) does not know them. `makeClient` calls any installed MAKE module's action
4
+ * through the kernel's invocation path (`POST /make/actions/<module>.<action>`), reads a module's view
5
+ * (`make.view`) and runs its steps (`make.renderView`) for a shell host that draws the tree each returns (the view
6
+ * runtime: the Sandbox contract's `MakeViewNode`, `MakeViewMessage`, `MAKE_VIEW_CSP` and `MAKE_VIEW_SANDBOX`).
7
+ */
8
+ import {
9
+ CLIENT_VERSION_HEADER,
10
+ IDEMPOTENCY_HEADER,
11
+ MAKE_ACTIONS_PATH,
12
+ type MakeViewMessage,
13
+ type MakeViewStep,
14
+ } from "@eloxiv/contracts"
15
+
16
+ export {
17
+ MAKE_ACTIONS_PATH,
18
+ MAKE_MODULE_PREFIX,
19
+ MAKE_VIEW_CSP,
20
+ MAKE_VIEW_INPUT_TYPES,
21
+ MAKE_VIEW_KEY,
22
+ MAKE_VIEW_PROPS,
23
+ MAKE_VIEW_SANDBOX,
24
+ MAKE_VIEW_TAGS,
25
+ MAKE_VIEW_THEME_VARIABLES,
26
+ MakeViewMessage,
27
+ MakeViewNode,
28
+ MakeViewStep,
29
+ } from "@eloxiv/contracts"
30
+ export type { MakeView, MakeViewCall, MakeViewElement } from "@eloxiv/contracts"
31
+
32
+ export interface MakeClientOptions {
33
+ readonly baseUrl: string
34
+ readonly token?: (() => string | undefined) | undefined
35
+ readonly orgId?: string | (() => string | undefined) | undefined
36
+ readonly clientVersion?: string | undefined
37
+ }
38
+
39
+ /** A refused or failed MAKE call: the standard error (`_tag`, `message`, ...) and the HTTP status. */
40
+ export class MakeRequestError extends Error {
41
+ readonly status: number
42
+ readonly error: { readonly _tag: string; readonly [key: string]: unknown }
43
+ constructor(status: number, error: { readonly _tag: string; readonly [key: string]: unknown }) {
44
+ super(`${error._tag}: ${typeof error["message"] === "string" ? error["message"] : String(status)}`)
45
+ this.status = status
46
+ this.error = error
47
+ }
48
+ }
49
+
50
+ export interface InstalledView {
51
+ readonly module: string
52
+ readonly version: string
53
+ /** The view's title; null when the module has no view that renders. */
54
+ readonly view: { readonly title: string } | null
55
+ /** The module's own actions its view may ask the host to call. */
56
+ readonly actions: ReadonlyArray<string>
57
+ }
58
+
59
+ export const makeModuleClient = (options: MakeClientOptions) => {
60
+ const post = async <A>(path: string, body: unknown, idempotencyKey?: string): Promise<A> => {
61
+ const headers: Record<string, string> = { "content-type": "application/json" }
62
+ const token = options.token?.()
63
+ if (token !== undefined) headers["authorization"] = `Bearer ${token}`
64
+ const orgId = typeof options.orgId === "function" ? options.orgId() : options.orgId
65
+ if (orgId !== undefined) headers["x-eloxiv-org"] = orgId
66
+ if (options.clientVersion !== undefined) headers[CLIENT_VERSION_HEADER] = options.clientVersion
67
+ if (idempotencyKey !== undefined) headers[IDEMPOTENCY_HEADER] = idempotencyKey
68
+ const response = await fetch(`${options.baseUrl}${path}`, { method: "POST", headers, body: JSON.stringify(body) })
69
+ const parsed = (await response.json().catch(() => ({}))) as Record<string, unknown>
70
+ if (!response.ok) {
71
+ throw new MakeRequestError(response.status, {
72
+ ...parsed,
73
+ _tag: typeof parsed["_tag"] === "string" ? parsed["_tag"] : `HTTP ${response.status}`,
74
+ })
75
+ }
76
+ return parsed as A
77
+ }
78
+ return {
79
+ /** Call an installed MAKE module's action: the result envelope (`{ kind: "output", output }` or a replay). */
80
+ call: (action: string, input: unknown, call?: { readonly idempotencyKey?: string }) =>
81
+ post<unknown>(`${MAKE_ACTIONS_PATH}/${encodeURIComponent(action)}`, input, call?.idempotencyKey),
82
+ /** A module's view (its title) and the actions it may call. */
83
+ view: async (module: string) =>
84
+ (await post<{ kind: string; output: InstalledView }>(`/api/actions/make.view`, { module })).output,
85
+ /**
86
+ * One step of a module's view: `init` (no state, no message) or `update`, then `render`, in the kernel's sandbox,
87
+ * for the version `view` answered (refused once another is installed: open the view again).
88
+ */
89
+ renderView: async (module: string, version: string, state: unknown, message: MakeViewMessage | null) =>
90
+ (
91
+ await post<{ kind: string; output: MakeViewStep }>(`/api/actions/make.renderView`, {
92
+ module,
93
+ version,
94
+ state: state ?? null,
95
+ message,
96
+ })
97
+ ).output,
98
+ }
99
+ }
100
+
101
+ /** One MAKE view contributed to one of the app's slots (`make.slots`). */
102
+ export interface MakeSlotEntry {
103
+ readonly slot: string
104
+ readonly module: string
105
+ readonly version: string
106
+ readonly title: string
107
+ readonly order: number | null
108
+ }
109
+
110
+ /**
111
+ * The MAKE views in `slot`, in the Slot contract's order: `order` ascending, unordered after, and ties in the order
112
+ * `make.slots` answered (installation order, which only the kernel knows), from `make.slots`' answer. A shell shows each in its view frame (`make.view`, `make.renderView`) after, or among, the
113
+ * slot's built-in contributions.
114
+ */
115
+ export const makeSlot = (contributions: ReadonlyArray<MakeSlotEntry>, slot: string): ReadonlyArray<MakeSlotEntry> =>
116
+ contributions
117
+ .filter((entry) => entry.slot === slot)
118
+ .slice()
119
+ // A stable sort: ties keep the kernel's (installation) order.
120
+ .sort((a, b) => (a.order ?? Infinity) - (b.order ?? Infinity))
package/src/Models.ts ADDED
@@ -0,0 +1,134 @@
1
+ /**
2
+ * Model setup in the headless client SDK (docs/contracts/client-sdk.md, "Model setup"): the kernel's `/agent/models`
3
+ * routes as functions, and a catalogue an app's model picker or settings screen binds to (providers and their models
4
+ * grouped, which are allowed and usable, the person's, the organisation's and the effective choice with its source),
5
+ * with loading and error states. Keys go only to these routes, never through an action. Web-standard only.
6
+ */
7
+ import { AGENT_PATHS } from "@eloxiv/contracts"
8
+
9
+ export interface ModelCatalogue {
10
+ readonly providers: ReadonlyArray<{
11
+ readonly id: string
12
+ readonly models: ReadonlyArray<{ readonly id: string; readonly pricing: unknown; readonly allowed: boolean }>
13
+ /** Where credentials exist for the caller: their own key, the organisation's, the deployment's. */
14
+ readonly credentials: { readonly user: boolean; readonly org: boolean; readonly deployment: boolean }
15
+ /** The provider can check a key (list the models it reaches). */
16
+ readonly canCheck: boolean
17
+ }>
18
+ readonly policy: { readonly personalKeys: boolean; readonly allowedModels: ReadonlyArray<string> | null }
19
+ readonly selection: {
20
+ readonly user: ModelId | null
21
+ readonly org: ModelId | null
22
+ readonly effective: ModelId | null
23
+ readonly source: "user" | "org" | "deployment" | null
24
+ }
25
+ readonly canManage: boolean
26
+ }
27
+
28
+ export interface ModelId {
29
+ readonly provider: string
30
+ readonly model: string
31
+ }
32
+
33
+ /** What a key check found: the models the key reaches, or why it could not tell (a refusal is not a transport failure). */
34
+ export type ModelKeyCheck =
35
+ | { readonly ok: true; readonly models: ReadonlyArray<string> }
36
+ | {
37
+ readonly ok: false
38
+ readonly reason: "refused" | "unreachable" | "missing" | "unsupported"
39
+ readonly message: string
40
+ }
41
+
42
+ /** The models a picker offers: allowed by the policy, from a provider with credentials for the person. */
43
+ export const usableModels = (catalogue: ModelCatalogue): ReadonlyArray<ModelId & { readonly label: string }> =>
44
+ catalogue.providers.flatMap((p) =>
45
+ (catalogue.policy.personalKeys && p.credentials.user) || p.credentials.org || p.credentials.deployment
46
+ ? p.models.filter((m) => m.allowed).map((m) => ({ provider: p.id, model: m.id, label: `${p.id} · ${m.id}` }))
47
+ : [],
48
+ )
49
+
50
+ export interface CatalogueState {
51
+ readonly status: "idle" | "loading" | "ready" | "error"
52
+ readonly catalogue: ModelCatalogue | null
53
+ readonly error: string | null
54
+ }
55
+
56
+ export const modelSetupOf = (
57
+ client: { readonly headers: () => Record<string, string> },
58
+ options: { readonly baseUrl: string },
59
+ ) => {
60
+ const route = async <A>(method: "GET" | "POST", path: string, body?: unknown): Promise<A> => {
61
+ const response = await fetch(`${options.baseUrl}${AGENT_PATHS.models}${path}`, {
62
+ method,
63
+ headers: { ...client.headers(), "content-type": "application/json" },
64
+ ...(body === undefined ? {} : { body: JSON.stringify(body) }),
65
+ })
66
+ const json = (await response.json()) as A
67
+ if (!response.ok) throw json
68
+ return json
69
+ }
70
+
71
+ const api = {
72
+ catalogue: () => route<ModelCatalogue>("GET", ""),
73
+ /** Save a key (checked first unless `check: false`); `setDefault` makes one of its models the organisation's. */
74
+ saveKey: (
75
+ provider: string,
76
+ scope: "user" | "org",
77
+ values: Readonly<Record<string, string>>,
78
+ more: { readonly check?: boolean; readonly setDefault?: string } = {},
79
+ ) => route<{ saved: boolean; check: ModelKeyCheck | null }>("POST", "/keys", { provider, scope, values, ...more }),
80
+ removeKey: (provider: string, scope: "user" | "org") =>
81
+ route<{ removed: number }>("POST", "/keys/remove", { provider, scope }),
82
+ check: (provider: string, scope?: "user" | "org" | "deployment") =>
83
+ route<ModelKeyCheck>("POST", "/check", { provider, ...(scope === undefined ? {} : { scope }) }),
84
+ choose: (choice: ModelId | null) =>
85
+ route<{ choice: ModelId | null }>("POST", "/choose", choice === null ? { clear: true } : choice),
86
+ setPolicy: (policy: { readonly personalKeys: boolean; readonly allowedModels: ReadonlyArray<string> | null }) =>
87
+ route<typeof policy>("POST", "/policy", policy),
88
+ }
89
+
90
+ /** The catalogue as state: loaded on `refresh`, reloaded after a choice, its error kept for the screen. */
91
+ const catalogue = () => {
92
+ let state: CatalogueState = { status: "idle", catalogue: null, error: null }
93
+ const listeners = new Set<(state: CatalogueState) => void>()
94
+ const set = (next: CatalogueState) => {
95
+ state = next
96
+ for (const listener of listeners) listener(state)
97
+ }
98
+ const messageOf = (error: unknown) => {
99
+ const message = (error as { readonly message?: unknown } | null)?.message
100
+ return typeof message === "string" ? message : String(error)
101
+ }
102
+ const refresh = async () => {
103
+ set({ ...state, status: "loading", error: null })
104
+ try {
105
+ set({ status: "ready", catalogue: await api.catalogue(), error: null })
106
+ } catch (error) {
107
+ set({ ...state, status: "error", error: messageOf(error) })
108
+ }
109
+ }
110
+ return {
111
+ get state() {
112
+ return state
113
+ },
114
+ subscribe: (listener: (state: CatalogueState) => void) => {
115
+ listeners.add(listener)
116
+ return () => void listeners.delete(listener)
117
+ },
118
+ refresh,
119
+ /** Remember the person's choice (checked by the kernel), then reload; a refusal is kept as the error. */
120
+ choose: async (choice: ModelId | null) => {
121
+ try {
122
+ await api.choose(choice)
123
+ } catch (error) {
124
+ set({ ...state, status: "error", error: messageOf(error) })
125
+ return false
126
+ }
127
+ await refresh()
128
+ return true
129
+ },
130
+ }
131
+ }
132
+
133
+ return { ...api, catalogueState: catalogue }
134
+ }