@wenathlan/saddle 2.0.153 → 2.0.155

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 (307) hide show
  1. package/Dockerfile +139 -55
  2. package/README.md +58 -59
  3. package/browser.ts +482 -0
  4. package/cli.ts +274 -0
  5. package/distribution.ts +731 -0
  6. package/docker.config +29 -8
  7. package/docs/artifactavailability.md +2 -2
  8. package/docs/browser.md +18 -1
  9. package/docs/{containerplatforms.2.1.0.md → containerplatforms210.md} +1 -1
  10. package/docs/{documentmap.1.8.12.md → documentmap1812.md} +1 -1
  11. package/docs/extension.md +13 -2
  12. package/docs/libraryapi.md +1 -1
  13. package/docs/{ninety.modalities.md → ninetymodalities.md} +87 -4
  14. package/docs/{planning.ninety.md → planningninety.md} +6 -6
  15. package/docs/{releasenotes.1.8.13.md → releasenotes1813.md} +2 -2
  16. package/docs/{releasenotes.1.8.14.md → releasenotes1814.md} +1 -1
  17. package/docs/{repo.synthesis.1.8.16.md → reposynthesis1816.md} +1 -1
  18. package/docs/todo.md +2 -2
  19. package/docs/{todo.1.8.15.md → todo1815.md} +1 -1
  20. package/docs/{todo.1.8.16.md → todo1816.md} +5 -5
  21. package/execution.ts +677 -0
  22. package/foundation.ts +314 -0
  23. package/index.ts +35 -27
  24. package/isolation.ts +84 -0
  25. package/modes.ts +170 -0
  26. package/mttg.config +1 -1
  27. package/orchestrator.ts +49 -15
  28. package/package.json +90 -75
  29. package/qemu.config +2 -2
  30. package/sandbox.ts +2094 -0
  31. package/scheduler.ts +1 -1
  32. package/server.ts +52 -0
  33. package/tsconfig.json +11 -12
  34. package/virtual.ts +1105 -0
  35. package/virtualgpu.ts +1 -1
  36. package/virtualization.ts +1 -1
  37. package/workloadlaw.ts +293 -0
  38. package/dist/App.d.ts +0 -5
  39. package/dist/App.js +0 -52
  40. package/dist/Sol/Sol.d.ts +0 -3
  41. package/dist/Sol/Sol.js +0 -46
  42. package/dist/Sol/agentbrowser/agentbrowser.d.ts +0 -9
  43. package/dist/Sol/agentbrowser/agentbrowser.js +0 -121
  44. package/dist/Sol/architecture/architecture.d.ts +0 -9
  45. package/dist/Sol/architecture/architecture.js +0 -93
  46. package/dist/Sol/compute/compute.d.ts +0 -9
  47. package/dist/Sol/compute/compute.js +0 -22
  48. package/dist/Sol/console/console.d.ts +0 -15
  49. package/dist/Sol/console/console.js +0 -292
  50. package/dist/Sol/dashboard/dashboard.d.ts +0 -10
  51. package/dist/Sol/dashboard/dashboard.js +0 -181
  52. package/dist/Sol/docs/docs.d.ts +0 -9
  53. package/dist/Sol/docs/docs.js +0 -28
  54. package/dist/Sol/home/home.d.ts +0 -35
  55. package/dist/Sol/home/home.js +0 -239
  56. package/dist/Sol/integrations/integrations.d.ts +0 -9
  57. package/dist/Sol/integrations/integrations.js +0 -83
  58. package/dist/Sol/intro/intro.d.ts +0 -7
  59. package/dist/Sol/intro/intro.js +0 -102
  60. package/dist/Sol/login/login.d.ts +0 -16
  61. package/dist/Sol/login/login.js +0 -49
  62. package/dist/Sol/notfound/notfound.d.ts +0 -9
  63. package/dist/Sol/notfound/notfound.js +0 -15
  64. package/dist/Sol/onboarding/onboarding.d.ts +0 -25
  65. package/dist/Sol/onboarding/onboarding.js +0 -60
  66. package/dist/Sol/playground/playground.d.ts +0 -9
  67. package/dist/Sol/playground/playground.js +0 -127
  68. package/dist/Sol/register/register.d.ts +0 -16
  69. package/dist/Sol/register/register.js +0 -193
  70. package/dist/Sol/shell/Shell.d.ts +0 -124
  71. package/dist/Sol/shell/Shell.js +0 -335
  72. package/dist/Sol/wingets/ComputeBootladder.d.ts +0 -6
  73. package/dist/Sol/wingets/ComputeBootladder.js +0 -71
  74. package/dist/Sol/wingets/ComputeModalitycatalog.d.ts +0 -7
  75. package/dist/Sol/wingets/ComputeModalitycatalog.js +0 -71
  76. package/dist/Sol/wingets/ConsoleApibadge.d.ts +0 -7
  77. package/dist/Sol/wingets/ConsoleApibadge.js +0 -5
  78. package/dist/Sol/wingets/ConsoleEdgelaw.d.ts +0 -6
  79. package/dist/Sol/wingets/ConsoleEdgelaw.js +0 -36
  80. package/dist/Sol/wingets/ConsoleEventstimeline.d.ts +0 -19
  81. package/dist/Sol/wingets/ConsoleEventstimeline.js +0 -12
  82. package/dist/Sol/wingets/ConsoleSnapshotcontrols.d.ts +0 -8
  83. package/dist/Sol/wingets/ConsoleSnapshotcontrols.js +0 -8
  84. package/dist/Sol/wingets/ConsoleSpecpanel.d.ts +0 -21
  85. package/dist/Sol/wingets/ConsoleSpecpanel.js +0 -75
  86. package/dist/Sol/wingets/ConsoleTerminal.d.ts +0 -22
  87. package/dist/Sol/wingets/ConsoleTerminal.js +0 -77
  88. package/dist/Sol/wingets/DashboardAccountpanel.d.ts +0 -18
  89. package/dist/Sol/wingets/DashboardAccountpanel.js +0 -65
  90. package/dist/Sol/wingets/DashboardAdminpanel.d.ts +0 -6
  91. package/dist/Sol/wingets/DashboardAdminpanel.js +0 -90
  92. package/dist/Sol/wingets/DashboardAuditlog.d.ts +0 -8
  93. package/dist/Sol/wingets/DashboardAuditlog.js +0 -50
  94. package/dist/Sol/wingets/DashboardCreatesandboxform.d.ts +0 -10
  95. package/dist/Sol/wingets/DashboardCreatesandboxform.js +0 -71
  96. package/dist/Sol/wingets/DashboardEventstimeline.d.ts +0 -8
  97. package/dist/Sol/wingets/DashboardEventstimeline.js +0 -83
  98. package/dist/Sol/wingets/DashboardGlobalsandboxestable.d.ts +0 -8
  99. package/dist/Sol/wingets/DashboardGlobalsandboxestable.js +0 -57
  100. package/dist/Sol/wingets/DashboardMeshnodestable.d.ts +0 -8
  101. package/dist/Sol/wingets/DashboardMeshnodestable.js +0 -103
  102. package/dist/Sol/wingets/DashboardSandboxlist.d.ts +0 -10
  103. package/dist/Sol/wingets/DashboardSandboxlist.js +0 -163
  104. package/dist/Sol/wingets/DashboardUserstable.d.ts +0 -8
  105. package/dist/Sol/wingets/DashboardUserstable.js +0 -78
  106. package/dist/Sol/wingets/HomeEntrygate.d.ts +0 -23
  107. package/dist/Sol/wingets/HomeEntrygate.js +0 -73
  108. package/dist/Sol/wingets/HomeMetricstrip.d.ts +0 -9
  109. package/dist/Sol/wingets/HomeMetricstrip.js +0 -4
  110. package/dist/Sol/wingets/HomeRuntimediagram.d.ts +0 -1
  111. package/dist/Sol/wingets/HomeRuntimediagram.js +0 -22
  112. package/dist/Sol/wingets/LoginForm.d.ts +0 -19
  113. package/dist/Sol/wingets/LoginForm.js +0 -141
  114. package/dist/Sol/wingets/RegisterPasswordconfirm.d.ts +0 -13
  115. package/dist/Sol/wingets/RegisterPasswordconfirm.js +0 -16
  116. package/dist/Sol/wingets/RegisterPasswordmeter.d.ts +0 -19
  117. package/dist/Sol/wingets/RegisterPasswordmeter.js +0 -65
  118. package/dist/Sol/wingets/RegisterUsernamerules.d.ts +0 -11
  119. package/dist/Sol/wingets/RegisterUsernamerules.js +0 -16
  120. package/dist/Sol/wingets/index.d.ts +0 -39
  121. package/dist/Sol/wingets/index.js +0 -39
  122. package/dist/alternatives.d.ts +0 -508
  123. package/dist/alternatives.js +0 -950
  124. package/dist/api.d.ts +0 -154
  125. package/dist/api.js +0 -174
  126. package/dist/auth.d.ts +0 -268
  127. package/dist/auth.js +0 -476
  128. package/dist/automation.d.ts +0 -425
  129. package/dist/automation.js +0 -566
  130. package/dist/browser.d.ts +0 -561
  131. package/dist/browser.js +0 -1058
  132. package/dist/capacitor.config.d.ts +0 -45
  133. package/dist/capacitor.config.js +0 -48
  134. package/dist/catalog.d.ts +0 -43
  135. package/dist/catalog.js +0 -44
  136. package/dist/cli.d.ts +0 -16
  137. package/dist/cli.js +0 -168
  138. package/dist/communication.d.ts +0 -181
  139. package/dist/communication.js +0 -376
  140. package/dist/compute.d.ts +0 -1160
  141. package/dist/compute.js +0 -2272
  142. package/dist/dashboardlib.d.ts +0 -58
  143. package/dist/dashboardlib.js +0 -161
  144. package/dist/db.d.ts +0 -569
  145. package/dist/db.js +0 -1080
  146. package/dist/distribution.d.ts +0 -528
  147. package/dist/distribution.js +0 -810
  148. package/dist/drizzle.config.d.ts +0 -20
  149. package/dist/drizzle.config.js +0 -18
  150. package/dist/edgelandes.d.ts +0 -70
  151. package/dist/edgelandes.host.d.ts +0 -26
  152. package/dist/edgelandes.host.js +0 -1089
  153. package/dist/edgelandes.inproc.d.ts +0 -27
  154. package/dist/edgelandes.inproc.js +0 -952
  155. package/dist/edgelandes.js +0 -1133
  156. package/dist/edgelandes.ninety.d.ts +0 -31
  157. package/dist/edgelandes.ninety.js +0 -174
  158. package/dist/edgelandes.virtual.d.ts +0 -25
  159. package/dist/edgelandes.virtual.js +0 -629
  160. package/dist/edgeplane.d.ts +0 -114
  161. package/dist/edgeplane.js +0 -305
  162. package/dist/examplelocaljob.d.ts +0 -1
  163. package/dist/examplelocaljob.js +0 -14
  164. package/dist/execution.d.ts +0 -529
  165. package/dist/execution.js +0 -760
  166. package/dist/family.d.ts +0 -16
  167. package/dist/family.js +0 -42
  168. package/dist/familyurl.d.ts +0 -21
  169. package/dist/familyurl.js +0 -24
  170. package/dist/format.d.ts +0 -18
  171. package/dist/format.js +0 -59
  172. package/dist/foundation.d.ts +0 -172
  173. package/dist/foundation.js +0 -312
  174. package/dist/index.d.ts +0 -735
  175. package/dist/index.js +0 -1020
  176. package/dist/integration.d.ts +0 -235
  177. package/dist/integration.js +0 -228
  178. package/dist/intelligence.d.ts +0 -93
  179. package/dist/intelligence.js +0 -144
  180. package/dist/isolation.d.ts +0 -128
  181. package/dist/isolation.js +0 -95
  182. package/dist/labels.d.ts +0 -665
  183. package/dist/labels.js +0 -751
  184. package/dist/localauth.d.ts +0 -127
  185. package/dist/localauth.js +0 -413
  186. package/dist/media.d.ts +0 -343
  187. package/dist/media.js +0 -985
  188. package/dist/mesh.d.ts +0 -177
  189. package/dist/mesh.js +0 -468
  190. package/dist/modalityregistry.d.ts +0 -109
  191. package/dist/modalityregistry.js +0 -1386
  192. package/dist/modes.d.ts +0 -358
  193. package/dist/modes.js +0 -133
  194. package/dist/onboardingstate.d.ts +0 -79
  195. package/dist/onboardingstate.js +0 -282
  196. package/dist/orchestrator.d.ts +0 -1338
  197. package/dist/orchestrator.js +0 -4310
  198. package/dist/packager/targetcli.js +0 -4
  199. package/dist/paths.d.ts +0 -2
  200. package/dist/paths.js +0 -14
  201. package/dist/performance.d.ts +0 -415
  202. package/dist/performance.js +0 -826
  203. package/dist/quantum.d.ts +0 -809
  204. package/dist/quantum.js +0 -2072
  205. package/dist/render.d.ts +0 -380
  206. package/dist/render.js +0 -1072
  207. package/dist/runall.d.ts +0 -2
  208. package/dist/runall.js +0 -39
  209. package/dist/runtimeprobe.d.ts +0 -4
  210. package/dist/runtimeprobe.js +0 -8
  211. package/dist/sandbox.d.ts +0 -355
  212. package/dist/sandbox.js +0 -1721
  213. package/dist/sandboxenvprofile.d.ts +0 -29
  214. package/dist/sandboxenvprofile.js +0 -89
  215. package/dist/sandboxprofile.d.ts +0 -137
  216. package/dist/sandboxprofile.js +0 -241
  217. package/dist/sandboxqueue.d.ts +0 -108
  218. package/dist/sandboxqueue.js +0 -201
  219. package/dist/sandboxquota.d.ts +0 -121
  220. package/dist/sandboxquota.js +0 -236
  221. package/dist/scheduler.d.ts +0 -595
  222. package/dist/scheduler.js +0 -1258
  223. package/dist/scriptlanes.d.ts +0 -182
  224. package/dist/scriptlanes.js +0 -660
  225. package/dist/scripts.buildengine.d.ts +0 -1
  226. package/dist/scripts.buildengine.js +0 -39
  227. package/dist/scripts.securitygate.d.ts +0 -1
  228. package/dist/scripts.securitygate.js +0 -68
  229. package/dist/scripts.validateflatnative.d.ts +0 -1
  230. package/dist/scripts.validateflatnative.js +0 -72
  231. package/dist/security.d.ts +0 -500
  232. package/dist/security.js +0 -1169
  233. package/dist/seedcatalog.d.ts +0 -13
  234. package/dist/seedcatalog.js +0 -46
  235. package/dist/server.d.ts +0 -20
  236. package/dist/server.js +0 -53
  237. package/dist/speccatalog.d.ts +0 -31
  238. package/dist/speccatalog.js +0 -163
  239. package/dist/tiers.d.ts +0 -1001
  240. package/dist/tiers.js +0 -2169
  241. package/dist/utils.d.ts +0 -2
  242. package/dist/utils.js +0 -5
  243. package/dist/vaulthandoff.d.ts +0 -141
  244. package/dist/vaulthandoff.js +0 -444
  245. package/dist/virtual.d.ts +0 -640
  246. package/dist/virtual.js +0 -1284
  247. package/dist/virtualcpu.d.ts +0 -315
  248. package/dist/virtualcpu.js +0 -1180
  249. package/dist/virtualgpu.d.ts +0 -344
  250. package/dist/virtualgpu.js +0 -1000
  251. package/dist/virtualization.d.ts +0 -606
  252. package/dist/virtualization.js +0 -1186
  253. package/dist/virtualmemory.d.ts +0 -817
  254. package/dist/virtualmemory.js +0 -1795
  255. package/dist/vite.config.d.ts +0 -3
  256. package/dist/vite.config.js +0 -43
  257. package/dist/vitest.config.d.ts +0 -2
  258. package/dist/vitest.config.js +0 -25
  259. package/dist/webserver.d.ts +0 -166
  260. package/dist/webserver.js +0 -2226
  261. package/dist/workloadlaw.d.ts +0 -133
  262. package/dist/workloadlaw.js +0 -193
  263. package/manifest.json +0 -20
  264. package/media.ts +0 -1337
  265. /package/docs/{architecture.1.8.19.md → architecture1819.md} +0 -0
  266. /package/docs/{architecture.1.8.19.mmd → architecture1819.mmd} +0 -0
  267. /package/docs/{artifactresearch.1.8.9.md → artifactresearch189.md} +0 -0
  268. /package/docs/{batches.1816.to.1820.md → batches1816to1820.md} +0 -0
  269. /package/docs/{brancharchive.2026.08.18.md → brancharchive20260818.md} +0 -0
  270. /package/docs/{containerplatforms.1.8.17.md → containerplatforms1817.md} +0 -0
  271. /package/docs/{e2ugh.engine.md → e2ughengine.md} +0 -0
  272. /package/docs/{flatbuildresearch.1.8.11.md → flatbuildresearch1811.md} +0 -0
  273. /package/docs/{licenseaudit.1.8.12.md → licenseaudit1812.md} +0 -0
  274. /package/docs/{mobileconversionresearch.1.8.10.md → mobileconversionresearch1810.md} +0 -0
  275. /package/docs/{nativeidentityresearch.1.8.11.md → nativeidentityresearch1811.md} +0 -0
  276. /package/docs/{native.wrappers.md → nativewrappers.md} +0 -0
  277. /package/docs/{planning.1.8.18.md → planning1818.md} +0 -0
  278. /package/docs/{planning.1.8.19.md → planning1819.md} +0 -0
  279. /package/docs/{planning.engine.md → planningengine.md} +0 -0
  280. /package/docs/{releasenotes.1.8.12.md → releasenotes1812.md} +0 -0
  281. /package/docs/{releasenotes.1.8.15.md → releasenotes1815.md} +0 -0
  282. /package/docs/{releasenotes.1.8.16.md → releasenotes1816.md} +0 -0
  283. /package/docs/{releasenotes.1.8.17.md → releasenotes1817.md} +0 -0
  284. /package/docs/{releasenotes.1.8.18.md → releasenotes1818.md} +0 -0
  285. /package/docs/{releasenotes.1.8.19.md → releasenotes1819.md} +0 -0
  286. /package/docs/{reorganization.1.8.8.md → reorganization188.md} +0 -0
  287. /package/docs/{reorganization.1.8.9.md → reorganization189.md} +0 -0
  288. /package/docs/{repo.analysis.1.8.21.json → repoanalysis1821.json} +0 -0
  289. /package/docs/{repo.candidates.1.8.21.jsonl → repocandidates1821.jsonl} +0 -0
  290. /package/docs/{repo.research.1.8.16.md → reporesearch1816.md} +0 -0
  291. /package/docs/{repo.research.1.8.21.md → reporesearch1821.md} +0 -0
  292. /package/docs/{repo.selected.1.8.21.json → reposelected1821.json} +0 -0
  293. /package/docs/{repo.synthesis.1.8.21.md → reposynthesis1821.md} +0 -0
  294. /package/docs/{research.1.8.18.isolation.md → research1818isolation.md} +0 -0
  295. /package/docs/{research.1.8.19.virtual.browser.md → research1819virtualbrowser.md} +0 -0
  296. /package/docs/{scanningresearch.1.8.11.md → scanningresearch1811.md} +0 -0
  297. /package/docs/{securityaudit.1.8.7.md → securityaudit187.md} +0 -0
  298. /package/docs/{securityreferences.1.8.11.md → securityreferences1811.md} +0 -0
  299. /package/docs/{securityresearch.1.8.11.md → securityresearch1811.md} +0 -0
  300. /package/docs/{signingresearch.1.8.12.md → signingresearch1812.md} +0 -0
  301. /package/docs/{tauri.glib.risk.1.8.11.md → tauriglibrisk1811.md} +0 -0
  302. /package/docs/{todo.1.8.18.md → todo1818.md} +0 -0
  303. /package/docs/{todo.1.8.19.md → todo1819.md} +0 -0
  304. /package/docs/{toolchainresearch.1.8.9.md → toolchainresearch189.md} +0 -0
  305. /package/docs/{web.duplicatecleanup.md → webduplicatecleanup.md} +0 -0
  306. /package/docs/{web.ideas.md → webideas.md} +0 -0
  307. /package/docs/{workflowimprovements.2026.08.19.md → workflowimprovements20260819.md} +0 -0
package/dist/db.d.ts DELETED
@@ -1,569 +0,0 @@
1
- /**
2
- * db.ts — node:sqlite data layer for the saddle web node (v7-BACK).
3
- *
4
- * the whole persistence surface of a node (main or clone) lives in this
5
- * module: one sqlite database opened through the native node:sqlite
6
- * DatabaseSync driver, the embedded migrations (executeschema), prepared
7
- * statements memoized once per process and one small function api per
8
- * table. the file is created with mode 0o600 right after open because it
9
- * carries password hashes and session token hashes.
10
- *
11
- * contexts (13): dbopen, filemode, rowtypes, executeschema, users,
12
- * sessions, nodes, sandboxes, sandboxfiles, events, audit, labels, counts.
13
- *
14
- * rules: lowercase identifiers, english jsdoc in third person, no emoji,
15
- * try/catch on every fallible path with the standardized {code,message}
16
- * error shape, node:* modules only, zero dependencies.
17
- */
18
- import { DatabaseSync } from 'node:sqlite';
19
- /** one users row: the password hash and salt never leave the server. */
20
- export type UserRow = {
21
- id: string;
22
- username: string;
23
- passwordhash: string;
24
- salt: string;
25
- role: string;
26
- createdat: string;
27
- lastlogin: string | null;
28
- };
29
- /** one sessions row (only the sha256 token hash is persisted). */
30
- export type SessionRow = {
31
- tokenhash: string;
32
- userid: string;
33
- createdat: string;
34
- expiresat: string;
35
- ip: string | null;
36
- useragent: string | null;
37
- };
38
- /** one mesh registry nodes row. */
39
- export type NodeRow = {
40
- id: string;
41
- url: string;
42
- rolename: string | null;
43
- region: string | null;
44
- lastheartbeat: string | null;
45
- status: string | null;
46
- registeredat: string;
47
- meta: string | null;
48
- };
49
- /** one sandboxes lifecycle row: the identity columns are always written
50
- * non-null by createsandboxrecord; the usage counters and the optional
51
- * per-sandbox quota stay nullable until their first stamp. */
52
- export type SandboxRow = {
53
- id: string;
54
- userid: string | null;
55
- model: string;
56
- vcpus: number;
57
- ramgb: number;
58
- gpu: string;
59
- state: string;
60
- createdat: string;
61
- expiresat: string | null;
62
- files: number | null;
63
- bytes: number | null;
64
- quotabytes: number | null;
65
- };
66
- /** one sandboxfiles row projection (contents stay out of listfiles). */
67
- export type SandboxFileRow = {
68
- path: string;
69
- size: number;
70
- updatedat: string;
71
- };
72
- /** one stored workspace file document (content decoded from the blob cell). */
73
- export type SandboxFileDoc = {
74
- path: string;
75
- content: string;
76
- size: number;
77
- updatedat: string;
78
- };
79
- /** the workspace usage counters of one sandbox. */
80
- export type WorkspaceUsage = {
81
- files: number;
82
- bytes: number;
83
- };
84
- /** one events row: the payload stays the raw json text cell until the
85
- * events poll parses it into the view document. */
86
- export type EventRow = {
87
- id: number;
88
- topic: string | null;
89
- payload: string | null;
90
- nodeid: string | null;
91
- createdat: string;
92
- };
93
- /** one audit row (register, login, logout, sandbox lifecycle, mesh
94
- * registration). */
95
- export type AuditRow = {
96
- id: number;
97
- userid: string | null;
98
- action: string | null;
99
- detail: string | null;
100
- ip: string | null;
101
- createdat: string;
102
- };
103
- /** one onboarding_states row (the entry-flow gates of a visitor). */
104
- export type OnboardingStateRow = {
105
- id: number;
106
- visitor: string;
107
- introseen: number;
108
- onboardingseen: number;
109
- updatedAt: string;
110
- };
111
- /** the boolean projection of the onboarding flags the gateway serves. */
112
- export type OnboardingFlags = {
113
- introseen: boolean;
114
- onboardingseen: boolean;
115
- };
116
- /** one labels row: the interface copy store. the id is the page.widget.key
117
- * path, the text rides the english source of truth (labels.ts), and the
118
- * translated flag protects a runtime translation from the seed overwrite.
119
- * the shape mirrors the browser seed rows in labels.ts one to one. */
120
- export type LabelRow = {
121
- id: string;
122
- text: string;
123
- revision: number;
124
- updatedAt: string;
125
- translated?: boolean;
126
- };
127
- /** the standardized database error: the machine readable code plus the
128
- * non-enumerable internal and publicmessage properties set by dberror. */
129
- export type DbError = Error & {
130
- code: string;
131
- internal?: string;
132
- publicMessage?: string;
133
- };
134
- /** users row attributes accepted by createuser; the id and createdat are
135
- * optional so the mesh forward path can pin the main node's values. */
136
- export type UserFields = {
137
- id?: string;
138
- username: string;
139
- passwordhash: string;
140
- salt: string;
141
- role?: string;
142
- createdat?: string;
143
- };
144
- /** the stored user projection returned by createuser. */
145
- export type UserProjection = {
146
- id: string;
147
- username: string;
148
- role: string;
149
- createdat: string;
150
- };
151
- /** sessions row attributes accepted by createsession. */
152
- export type SessionFields = {
153
- tokenhash: string;
154
- userid: string;
155
- expiresat: string;
156
- ip?: string;
157
- useragent?: string;
158
- createdat?: string;
159
- };
160
- /** node announcement accepted by registernode. */
161
- export type NodeAnnouncement = {
162
- url: string;
163
- rolename?: string;
164
- region?: string;
165
- meta?: string;
166
- };
167
- /** sandbox projection accepted by createsandboxrecord. */
168
- export type SandboxRecordFields = {
169
- id: string;
170
- userid?: string;
171
- model?: string;
172
- vcpus?: number;
173
- ramgb?: number;
174
- gpu?: string;
175
- state: string;
176
- createdat?: string;
177
- expiresat?: string;
178
- quotabytes?: number | null;
179
- };
180
- /** event envelope accepted by addevent. */
181
- export type EventFields = {
182
- topic: string;
183
- payload?: unknown;
184
- nodeid?: string;
185
- createdat?: string;
186
- };
187
- /** audit envelope accepted by addaudit. */
188
- export type AuditFields = {
189
- userid?: string | null;
190
- action: string;
191
- detail?: string;
192
- ip?: string;
193
- createdat?: string;
194
- };
195
- /** write receipt returned by writefile. */
196
- export type WriteReceipt = {
197
- path: string;
198
- size: number;
199
- updatedat: string;
200
- };
201
- /** the database file path resolved once at module load. */
202
- export declare const dbpath: string;
203
- /**
204
- * resolves the per-sandbox workspace quota in bytes once per call: the
205
- * saddle_sandbox_quota_bytes environment variable wins (any positive
206
- * integer), otherwise the 16 mib default documented in the readme.
207
- *
208
- * @returns the quota in bytes.
209
- */
210
- export declare function sandboxquota(): number;
211
- /**
212
- * creates one user row; the id is a fresh uuid unless the caller pins
213
- * one (the mesh forward path caches the main node's user rows with
214
- * their original ids so clone sessions resolve).
215
- *
216
- * @param fields the user attributes.
217
- * @returns the stored user projection.
218
- */
219
- export declare function createuser(fields: UserFields): UserProjection;
220
- /**
221
- * finds one user by username.
222
- *
223
- * @param username the exact username.
224
- * @returns the full row or null when absent.
225
- */
226
- export declare function finduserbyname(username: string): UserRow | null;
227
- /**
228
- * finds one user by id.
229
- *
230
- * @param id the user id.
231
- * @returns the full row or null when absent.
232
- */
233
- export declare function finduserbyid(id: string): UserRow | null;
234
- /**
235
- * lists every user ordered by creation time; the route layer projects
236
- * out the password hash and salt columns.
237
- *
238
- * @returns the full user rows.
239
- */
240
- export declare function listusers(): UserRow[];
241
- /**
242
- * stamps the last login column with the given timestamp.
243
- *
244
- * @param id the user id.
245
- * @param isotime the iso timestamp.
246
- * @returns void.
247
- */
248
- export declare function updatelastlogin(id: string, isotime: string): void;
249
- /**
250
- * persists one session; only the sha256 token hash is stored, never the
251
- * bearer token itself.
252
- *
253
- * @param fields the session attributes.
254
- * @returns void.
255
- */
256
- export declare function createsession(fields: SessionFields): void;
257
- /**
258
- * finds one session row by token hash; expiry is enforced by the caller
259
- * (auth.ts) so clones can forward remote sessions verbatim.
260
- *
261
- * @param tokenhash the sha256 hex of the bearer token.
262
- * @returns the session row or null.
263
- */
264
- export declare function findsession(tokenhash: string): SessionRow | null;
265
- /**
266
- * deletes one session by token hash.
267
- *
268
- * @param tokenhash the sha256 hex of the bearer token.
269
- * @returns true when a row was removed.
270
- */
271
- export declare function deletesession(tokenhash: string): boolean;
272
- /**
273
- * removes every expired session (iso strings compare lexicographically).
274
- * the main node schedules this sweep at boot.
275
- *
276
- * @returns the count of removed rows.
277
- */
278
- export declare function cleansessions(): number;
279
- /**
280
- * registers or re-registers one node keyed by its url: an existing row
281
- * for the same url is refreshed (new heartbeat, online status) instead
282
- * of duplicated, so clones can re-register after a restart.
283
- *
284
- * @param fields the node announcement.
285
- * @returns the registry row.
286
- */
287
- export declare function registernode(fields: NodeAnnouncement): {
288
- id: string;
289
- url: string;
290
- status: string;
291
- };
292
- /**
293
- * stamps one node heartbeat.
294
- *
295
- * @param id the node id.
296
- * @param isotime the heartbeat timestamp.
297
- * @returns true when the node id exists.
298
- */
299
- export declare function heartbeatnode(id: string, isotime: string): boolean;
300
- /**
301
- * lists every registered node ordered by registration time.
302
- *
303
- * @returns the node rows.
304
- */
305
- export declare function listnodes(): NodeRow[];
306
- /**
307
- * persists one sandbox lifecycle row mirroring the in-memory record.
308
- *
309
- * @param fields the sandbox projection.
310
- * @returns void.
311
- */
312
- export declare function createsandboxrecord(fields: SandboxRecordFields): void;
313
- /**
314
- * updates the state column of one sandbox row (running, destroyed, ...).
315
- *
316
- * @param id the sandbox id.
317
- * @param state the new state.
318
- * @returns void.
319
- */
320
- export declare function updatesandboxstate(id: string, state: string): void;
321
- /**
322
- * lists every sandbox row, newest first.
323
- *
324
- * @param limit the row cap.
325
- * @returns the sandbox rows.
326
- */
327
- export declare function listsandboxes(limit?: number): SandboxRow[];
328
- /**
329
- * lists the sandbox rows owned by one user, newest first.
330
- *
331
- * @param userid the owner id.
332
- * @param limit the row cap.
333
- * @returns the sandbox rows.
334
- */
335
- export declare function listsandboxesbyuser(userid: string, limit?: number): SandboxRow[];
336
- /**
337
- * finds one sandbox row by id; the files surface resolves ownership
338
- * through this lookup even when the in-memory record is gone (expired
339
- * sandbox or restarted process).
340
- *
341
- * @param id the sandbox id.
342
- * @returns the sandbox row or null.
343
- */
344
- export declare function findsandboxbyid(id: string): SandboxRow | null;
345
- /**
346
- * stamps the workspace usage counters of one sandbox row.
347
- *
348
- * @param id the sandbox id.
349
- * @param files the file count.
350
- * @param bytes the total content bytes.
351
- * @returns void.
352
- */
353
- export declare function updatesandboxusage(id: string, files: number, bytes: number): void;
354
- /**
355
- * writes (or overwrites) one workspace file; the sandbox quota caps the
356
- * summed size of every file of the sandbox and an over-quota write
357
- * throws the standardized "quota exceeded" error without touching the
358
- * stored rows.
359
- *
360
- * @param sandboxid the sandbox id.
361
- * @param path the normalized absolute path.
362
- * @param content the file text (null and undefined write as empty).
363
- * @param customquota the optional per-sandbox quota in bytes, always
364
- * capped by the node maximum.
365
- * @returns the write receipt.
366
- */
367
- export declare function writefile(sandboxid: string, path: string, content: string | null | undefined, customquota?: number): WriteReceipt;
368
- /**
369
- * reads one workspace file.
370
- *
371
- * @param sandboxid the sandbox id.
372
- * @param path the normalized absolute path.
373
- * @returns the file document or null when absent.
374
- */
375
- export declare function readfile(sandboxid: string, path: string): SandboxFileDoc | null;
376
- /**
377
- * lists every workspace file of one sandbox ordered by path; contents
378
- * stay out of the projection.
379
- *
380
- * @param sandboxid the sandbox id.
381
- * @returns the file rows.
382
- */
383
- export declare function listfiles(sandboxid: string): SandboxFileRow[];
384
- /**
385
- * deletes one workspace file.
386
- *
387
- * @param sandboxid the sandbox id.
388
- * @param path the normalized absolute path.
389
- * @returns true when a row was removed.
390
- */
391
- export declare function deletefile(sandboxid: string, path: string): boolean;
392
- /**
393
- * removes every workspace file of one sandbox; the purge path of the
394
- * delete endpoint calls this so a destroyed sandbox leaves nothing
395
- * behind.
396
- *
397
- * @param sandboxid the sandbox id.
398
- * @returns the count of removed rows.
399
- */
400
- export declare function deletesandboxfiles(sandboxid: string): number;
401
- /**
402
- * sums the workspace usage of one sandbox.
403
- *
404
- * @param sandboxid the sandbox id.
405
- * @returns the usage counters.
406
- */
407
- export declare function sandboxusage(sandboxid: string): WorkspaceUsage;
408
- /**
409
- * appends one event row; the payload is stored as a json string.
410
- *
411
- * @param fields the event envelope.
412
- * @returns the inserted event id.
413
- */
414
- export declare function addevent(fields: EventFields): number;
415
- /**
416
- * lists the events with id greater than the cursor, oldest first, so
417
- * the dashboard can poll /api/v1/events?since=<lastid>.
418
- *
419
- * @param since the exclusive id cursor.
420
- * @param limit the row cap.
421
- * @returns the event rows.
422
- */
423
- export declare function listevents(since?: number, limit?: number): EventRow[];
424
- /**
425
- * appends one audit row (register, login, logout, sandbox lifecycle,
426
- * mesh registration).
427
- *
428
- * @param fields the audit envelope.
429
- * @returns the inserted audit id.
430
- */
431
- export declare function addaudit(fields: AuditFields): number;
432
- /**
433
- * lists the audit trail, newest first.
434
- *
435
- * @param limit the row cap.
436
- * @returns the audit rows.
437
- */
438
- export declare function listaudit(limit?: number): AuditRow[];
439
- /**
440
- * reads the onboarding stage flags of one visitor (parameterized; null
441
- * when the visitor never touched the flow). the platform gateway serves
442
- * these over GET /api/v1/onboarding for the browser accessor
443
- * onboardingstate.ts.
444
- *
445
- * @param visitor the stable visitor id.
446
- * @returns the flags, or null when no row exists.
447
- */
448
- export declare function getonboardingstate(visitor: string): OnboardingFlags | null;
449
- /**
450
- * marks one onboarding stage seen for a visitor — idempotent seen-wins
451
- * upsert: the flags only ever move forward, so a replayed stage (or an
452
- * out-of-order gateway write) never unsees an earlier one.
453
- *
454
- * @param visitor the stable visitor id.
455
- * @param stage the stage being marked seen ("intro" or "onboarding"; the
456
- * onboarding stage implies the intro — the flow order).
457
- * @returns the flags as they stand after the write.
458
- */
459
- export declare function setonboardingstage(visitor: string, stage: 'intro' | 'onboarding'): OnboardingFlags;
460
- /**
461
- * writes one label row (idempotent upsert; the caller owns the revision).
462
- *
463
- * @param id the page.widget.key path of the label.
464
- * @param text the surface text.
465
- * @param revision the manifest revision the text carries.
466
- * @param translated true when the row carries a runtime translation.
467
- * @returns the stored label projection.
468
- */
469
- export declare function savelabel(id: string, text: string, revision: number, translated?: boolean): LabelRow;
470
- /**
471
- * reads one label row by its page.widget.key path.
472
- *
473
- * @param id the label id.
474
- * @returns the row or null when absent.
475
- */
476
- export declare function readlabel(id: string): LabelRow | null;
477
- /**
478
- * reads every label row of the store ordered by id.
479
- *
480
- * @returns the label rows.
481
- */
482
- export declare function readalllabels(): LabelRow[];
483
- /**
484
- * ingests the english manifest of labels.ts into the labels table — the
485
- * db-side twin of the browser seedlabels: idempotent, the changed rows
486
- * refresh, and the translated rows stay protected from the overwrite.
487
- *
488
- * @returns the seeded and protected row counts.
489
- */
490
- export declare function seedlabelrows(): Promise<{
491
- seeded: number;
492
- protected: number;
493
- }>;
494
- /**
495
- * the overview counts consumed by get /api/v1/admin/overview.
496
- *
497
- * @returns the counts.
498
- */
499
- export declare function counts(): {
500
- users: number;
501
- sessions: number;
502
- nodes: number;
503
- sandboxes: number;
504
- events: number;
505
- audit: number;
506
- };
507
- /**
508
- * runs the cheapest possible query so /api/v1/health can report whether
509
- * the database connection answers.
510
- *
511
- * @returns true when the round trip succeeds.
512
- */
513
- export declare function healthcheck(): boolean;
514
- /**
515
- * applies the embedded schema migrations; exported for tools and tests
516
- * that want to reset or verify the schema explicitly.
517
- *
518
- * @param target an optional database handle (defaults to the module
519
- * connection).
520
- * @returns void.
521
- */
522
- export declare function executeschema(target?: DatabaseSync): void;
523
- /** the store singleton: every api function plus close and dispose. */
524
- declare const store: {
525
- dbpath: string;
526
- createuser: typeof createuser;
527
- finduserbyname: typeof finduserbyname;
528
- finduserbyid: typeof finduserbyid;
529
- listusers: typeof listusers;
530
- updatelastlogin: typeof updatelastlogin;
531
- createsession: typeof createsession;
532
- findsession: typeof findsession;
533
- deletesession: typeof deletesession;
534
- cleansessions: typeof cleansessions;
535
- registernode: typeof registernode;
536
- heartbeatnode: typeof heartbeatnode;
537
- listnodes: typeof listnodes;
538
- createsandboxrecord: typeof createsandboxrecord;
539
- updatesandboxstate: typeof updatesandboxstate;
540
- updatesandboxusage: typeof updatesandboxusage;
541
- findsandboxbyid: typeof findsandboxbyid;
542
- listsandboxes: typeof listsandboxes;
543
- listsandboxesbyuser: typeof listsandboxesbyuser;
544
- writefile: typeof writefile;
545
- readfile: typeof readfile;
546
- listfiles: typeof listfiles;
547
- deletefile: typeof deletefile;
548
- deletesandboxfiles: typeof deletesandboxfiles;
549
- sandboxusage: typeof sandboxusage;
550
- sandboxquota: typeof sandboxquota;
551
- addevent: typeof addevent;
552
- listevents: typeof listevents;
553
- addaudit: typeof addaudit;
554
- listaudit: typeof listaudit;
555
- getonboardingstate: typeof getonboardingstate;
556
- setonboardingstage: typeof setonboardingstage;
557
- savelabel: typeof savelabel;
558
- readlabel: typeof readlabel;
559
- readalllabels: typeof readalllabels;
560
- seedlabelrows: typeof seedlabelrows;
561
- counts: typeof counts;
562
- healthcheck: typeof healthcheck;
563
- executeschema: typeof executeschema;
564
- /** closes the connection (idempotent). */
565
- close(): void;
566
- /** explicit resource management: `using` support for node >= 24. */
567
- [Symbol.dispose](): void;
568
- };
569
- export default store;