rovloom 0.6.0 → 0.6.1

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 (62) hide show
  1. package/README.md +2 -2
  2. package/dist/src/admin/index.js +1 -1
  3. package/dist/src/{chunk-g27b2gmx.js → chunk-0e9gg4sg.js} +2 -2
  4. package/dist/src/chunk-1xer1ent.js +102 -0
  5. package/dist/src/{chunk-863tk45b.js → chunk-41fny9qm.js} +5 -5
  6. package/dist/src/{chunk-zjzrcc59.js → chunk-59h200cr.js} +139 -7
  7. package/dist/src/chunk-5w5srj3b.js +93 -0
  8. package/dist/src/{chunk-d4ejrtjq.js → chunk-6n6b1xpy.js} +1 -1
  9. package/dist/src/{chunk-ez7d5dac.js → chunk-6w4g9fw8.js} +4 -1
  10. package/dist/src/{chunk-0dqx2mmz.js → chunk-73aq2qkz.js} +1 -1
  11. package/dist/src/{chunk-n6wtjyfb.js → chunk-8c9yc0ge.js} +5 -5
  12. package/dist/src/{chunk-57ayxqnb.js → chunk-8fy8w7ds.js} +2 -23
  13. package/dist/src/{chunk-2tn0r64b.js → chunk-9h9x79bx.js} +5 -5
  14. package/dist/src/{chunk-qjh9x872.js → chunk-av31bx1e.js} +1 -1
  15. package/dist/src/{chunk-0xgpxdgc.js → chunk-bbdtsg4b.js} +7 -5
  16. package/dist/src/{chunk-q5pgbwb3.js → chunk-e7jgpxkf.js} +2 -2
  17. package/dist/src/{chunk-zj48jvfe.js → chunk-efty77sb.js} +3 -40
  18. package/dist/src/{chunk-gyvqqnjb.js → chunk-enj7s8cv.js} +49 -29
  19. package/dist/src/{chunk-jka7v3wb.js → chunk-ftpy8xx3.js} +311 -23
  20. package/dist/src/{chunk-zdxww7ms.js → chunk-h3xyq7zk.js} +1 -1
  21. package/dist/src/{chunk-ttsrctxg.js → chunk-hxmq28pg.js} +9 -7
  22. package/dist/src/{chunk-s3ydr65k.js → chunk-j59ac0xs.js} +2 -2
  23. package/dist/src/{chunk-5s2emvww.js → chunk-j6svdqr8.js} +10 -302
  24. package/dist/src/{chunk-9zkq0kc8.js → chunk-jkzfck98.js} +3 -3
  25. package/dist/src/{chunk-ssp57p43.js → chunk-m76cmkfy.js} +7 -5
  26. package/dist/src/{chunk-d2kz25f2.js → chunk-m96mbzcw.js} +674 -308
  27. package/dist/src/{chunk-yv9px0f5.js → chunk-n3z3jaxy.js} +20 -14
  28. package/dist/src/{chunk-jf4r0r44.js → chunk-ndj0ay2p.js} +19 -18
  29. package/dist/src/{chunk-5b8g62kw.js → chunk-pgs9jp6t.js} +61 -179
  30. package/dist/src/chunk-pksaqt9a.js +25 -0
  31. package/dist/src/{chunk-wxqhscsw.js → chunk-pnep7yhj.js} +7 -99
  32. package/dist/src/chunk-qn5xae7g.js +66 -0
  33. package/dist/src/{chunk-0pewfj89.js → chunk-qp8tgms2.js} +1 -1
  34. package/dist/src/{chunk-mg0fd6ph.js → chunk-rmgw8h27.js} +10 -8
  35. package/dist/src/{chunk-gbsbwssz.js → chunk-sf4ztxba.js} +3 -3
  36. package/dist/src/{chunk-x0td5wn4.js → chunk-shez7hkc.js} +1 -1
  37. package/dist/src/chunk-sqz614bh.js +30 -0
  38. package/dist/src/{chunk-09f9q26d.js → chunk-vdwzb63d.js} +2 -2
  39. package/dist/src/chunk-xtvgm6kf.js +48 -0
  40. package/dist/src/chunk-y8zm75jt.js +157 -0
  41. package/dist/src/chunk-yasqw2vj.js +756 -0
  42. package/dist/src/{chunk-srfbjwtk.js → chunk-z0qmfqvd.js} +3 -3
  43. package/dist/src/chunk-zm705snh.js +53 -0
  44. package/dist/src/cli/index.js +29 -28
  45. package/dist/src/cli/main.js +5 -5
  46. package/dist/src/connector/herdr/installation.js +4 -4
  47. package/dist/src/connector/herdr/provider.js +9 -9
  48. package/dist/src/connector/herdr/runtime.js +7 -7
  49. package/dist/src/connector/luvus/index.js +7 -6
  50. package/dist/src/mcp/index.js +16 -15
  51. package/dist/src/runtime/index.js +16 -15
  52. package/dist/src/service/index.js +2 -2
  53. package/dist/src/store.js +4 -4
  54. package/dist/src/transport/index.js +9 -9
  55. package/dist/src/webui/index.js +141 -939
  56. package/package.json +1 -1
  57. package/dist/src/chunk-0qgk7mhz.js +0 -52
  58. package/dist/src/chunk-3dvn33c4.js +0 -1299
  59. package/dist/src/chunk-5j0gj6w2.js +0 -7
  60. package/dist/src/chunk-vwcntax3.js +0 -228
  61. package/dist/src/chunk-ytpfmcp1.js +0 -25
  62. package/dist/src/chunk-zjkjjm81.js +0 -1114
@@ -1,7 +0,0 @@
1
- // @bun
2
- // src/pairing-policy.ts
3
- var DEFAULT_PAIRING_POLICY_REF = "rovloom_setup_v1";
4
-
5
- export { DEFAULT_PAIRING_POLICY_REF };
6
-
7
- //# debugId=C4F08DA3B385473E64756E2164756E21
@@ -1,228 +0,0 @@
1
- // @bun
2
- import {
3
- fail2,
4
- object2,
5
- fields2,
6
- id2,
7
- boundedJson2,
8
- hash2
9
- } from "./chunk-qt9m2kg2.js";
10
- import {
11
- privatePath,
12
- privateFile,
13
- createPrivate,
14
- syncParentDirectory
15
- } from "./chunk-0y5542k8.js";
16
-
17
- // src/transport/pairing.ts
18
- class PairingAdmin2 {
19
- store;
20
- host;
21
- constructor(store, host) {
22
- this.store = store;
23
- this.host = host;
24
- }
25
- register(name) {
26
- if (this.host.authorize("register") !== undefined) {
27
- fail2("pairing_admin_forbidden");
28
- }
29
- return this.store.register(name);
30
- }
31
- issue(machine, ttlMs = 600000) {
32
- if (this.host.authorize("enroll", machine) !== undefined) {
33
- fail2("pairing_admin_forbidden");
34
- }
35
- return this.store.issueEnrollment(machine, ttlMs);
36
- }
37
- }
38
-
39
- // src/transport/credentials.ts
40
- import { constants, closeSync, fstatSync, openSync, readFileSync, renameSync, unlinkSync } from "fs";
41
- import { randomUUID } from "crypto";
42
- function validate(value) {
43
- const v = object2(value);
44
- fields2(v, ["machine_id", "recovery_generation", "credential"]);
45
- id2(v.machine_id);
46
- id2(v.recovery_generation);
47
- if (typeof v.credential !== "string" || !/^[A-Za-z0-9_-]{32,256}$/.test(v.credential)) {
48
- fail2("invalid_device_credential");
49
- }
50
- return v;
51
- }
52
- function saveCredential2(path, input, replace = false) {
53
- privatePath(path);
54
- const raw = boundedJson2(validate(input), 4096);
55
- if (!replace) {
56
- createPrivate(path, raw);
57
- syncParentDirectory(path, true);
58
- return;
59
- }
60
- privateFile(path);
61
- const temporary = path + "." + randomUUID();
62
- try {
63
- createPrivate(temporary, raw);
64
- renameSync(temporary, path);
65
- syncParentDirectory(path, true);
66
- } finally {
67
- try {
68
- unlinkSync(temporary);
69
- } catch {}
70
- }
71
- }
72
- function createFileCredentialSink2(path, expected, replace = false) {
73
- privatePath(path);
74
- id2(expected.machine_id);
75
- id2(expected.recovery_generation);
76
- let closed = false;
77
- let used = false;
78
- return {
79
- async deliver(input, signal, context) {
80
- if (closed || used || signal.aborted) {
81
- fail2("credential_sink_closed");
82
- }
83
- if (input.machine_id !== expected.machine_id || input.recovery_generation !== expected.recovery_generation) {
84
- fail2("credential_sink_mismatch");
85
- }
86
- used = true;
87
- saveCredential2(path, input, replace);
88
- return { ...context, machine_id: input.machine_id, recovery_generation: input.recovery_generation };
89
- },
90
- close() {
91
- closed = true;
92
- }
93
- };
94
- }
95
- function loadCredential2(path) {
96
- privatePath(path);
97
- privateFile(path);
98
- const fd = openSync(path, constants.O_RDONLY | constants.O_NOFOLLOW);
99
- try {
100
- const st = fstatSync(fd);
101
- if (!st.isFile() || st.nlink !== 1 || process.platform !== "win32" && ((st.mode & 511) !== 384 || st.uid !== process.getuid?.()) || st.size > 4096) {
102
- fail2("unsafe_storage_file");
103
- }
104
- try {
105
- return validate(JSON.parse(readFileSync(fd, "utf8")));
106
- } catch {
107
- fail2("invalid_device_credential");
108
- }
109
- } finally {
110
- closeSync(fd);
111
- }
112
- }
113
-
114
- // src/transport/custody.ts
115
- import { randomUUID as randomUUID2 } from "crypto";
116
- function createPairingDelivery2(options) {
117
- const timeout = options.timeout_ms ?? 5000;
118
- const concurrency = options.concurrency ?? 4;
119
- if (!Number.isSafeInteger(timeout) || timeout < 1 || timeout > 30000 || !Number.isSafeInteger(concurrency) || concurrency < 1 || concurrency > 64) {
120
- fail2("pairing_limit");
121
- }
122
- const pending = new Map;
123
- let closed = false;
124
- async function transfer(machine, operation, issue) {
125
- if (closed || pending.size >= concurrency) {
126
- fail2("pairing_unavailable");
127
- }
128
- id2(machine);
129
- const deliveryId = randomUUID2();
130
- let sink;
131
- try {
132
- sink = options.authorizeChannel({ machine_id: machine, delivery_id: deliveryId, operation });
133
- } catch {
134
- fail2("pairing_channel_forbidden");
135
- }
136
- if (!sink || typeof sink.deliver !== "function" || typeof sink.close !== "function") {
137
- fail2("pairing_channel_forbidden");
138
- }
139
- if (closed) {
140
- try {
141
- sink.close();
142
- } catch {}
143
- fail2("pairing_unavailable");
144
- }
145
- const controller = new AbortController;
146
- let rejectAbort;
147
- const aborted = new Promise((_, reject) => {
148
- rejectAbort = reject;
149
- });
150
- const closeSink = () => {
151
- controller.abort();
152
- try {
153
- sink.close();
154
- } catch {}
155
- };
156
- const abort = () => {
157
- closeSink();
158
- rejectAbort(new Error("pairing_delivery_unknown"));
159
- };
160
- const timer = setTimeout(abort, timeout);
161
- pending.set(deliveryId, { timer, abort });
162
- let installedDigest;
163
- let sending = false;
164
- try {
165
- const credential = issue();
166
- installedDigest = hash2(credential.credential);
167
- const generation = credential.recovery_generation;
168
- const revision = options.identities.credentialRevision(machine);
169
- sending = true;
170
- const delivered = Promise.resolve().then(() => sink.deliver(structuredClone(credential), controller.signal, { delivery_id: deliveryId, revision })).finally(() => {
171
- clearTimeout(timer);
172
- pending.delete(deliveryId);
173
- });
174
- const ack = await Promise.race([delivered, aborted]);
175
- if (!ack || ack.delivery_id !== deliveryId || ack.revision !== revision || ack.machine_id !== machine || ack.recovery_generation !== generation) {
176
- fail2("pairing_ack_mismatch");
177
- }
178
- if (closed || controller.signal.aborted) {
179
- fail2("pairing_delivery_unknown");
180
- }
181
- return { machine_id: machine, delivery_id: deliveryId, state: "delivered" };
182
- } catch {
183
- if (installedDigest !== undefined) {
184
- try {
185
- options.identities.rejectDelivery(machine, installedDigest);
186
- } catch {}
187
- }
188
- return fail2("pairing_delivery_unknown");
189
- } finally {
190
- clearTimeout(timer);
191
- closeSink();
192
- if (!sending) {
193
- pending.delete(deliveryId);
194
- }
195
- }
196
- }
197
- return {
198
- async redeem(request) {
199
- if (typeof request.enrollment !== "string" || !/^[A-Za-z0-9_-]{32,256}$/.test(request.enrollment)) {
200
- fail2("invalid_enrollment");
201
- }
202
- return transfer(request.registration_id, "enroll", () => {
203
- const device = options.backend.redeem(request.enrollment);
204
- if (device.machine_id !== request.registration_id) {
205
- fail2("pairing_target_mismatch");
206
- }
207
- return { ...device, recovery_generation: options.backend.generation() };
208
- });
209
- },
210
- status() {
211
- return { closed, pending: pending.size };
212
- },
213
- close() {
214
- if (closed) {
215
- return;
216
- }
217
- closed = true;
218
- for (const item of pending.values()) {
219
- clearTimeout(item.timer);
220
- item.abort();
221
- }
222
- }
223
- };
224
- }
225
-
226
- export { PairingAdmin2, saveCredential2, createFileCredentialSink2, loadCredential2, createPairingDelivery2 };
227
-
228
- //# debugId=A739B57897780E2964756E2164756E21
@@ -1,25 +0,0 @@
1
- // @bun
2
- import {
3
- writeAdminFiles2,
4
- managementSourceExists2,
5
- handleAdminCommand2
6
- } from "./chunk-yv9px0f5.js";
7
- import"./chunk-wxqhscsw.js";
8
- import"./chunk-1bf0wmgk.js";
9
- import"./chunk-z7kkfrgz.js";
10
- import"./chunk-hpzr94hm.js";
11
- import"./chunk-5b8g62kw.js";
12
- import"./chunk-3nnahj0j.js";
13
- import"./chunk-0y5542k8.js";
14
- import"./chunk-g7pnjzkk.js";
15
- import"./chunk-qt9m2kg2.js";
16
- import"./chunk-9tt13dm0.js";
17
- import"./chunk-7crhmqn2.js";
18
- import"./chunk-d71r315c.js";
19
- export {
20
- handleAdminCommand2 as handleAdminCommand,
21
- managementSourceExists2 as managementSourceExists,
22
- writeAdminFiles2 as writeAdminFiles
23
- };
24
-
25
- //# debugId=989933E8EAB2EB1A64756E2164756E21