toolroll 0.9.128 → 0.9.130

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 (129) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/accent-colors.js +3 -1
  3. package/dist/agent-fence.js +0 -2
  4. package/dist/agents-board.js +0 -3
  5. package/dist/approval-authority.js +2 -1
  6. package/dist/assignment.js +56 -2
  7. package/dist/backup-ui.js +6 -3
  8. package/dist/backup.js +6 -0
  9. package/dist/bounded-spawn.js +0 -1
  10. package/dist/browser/manifest.json +57 -0
  11. package/dist/browser/terminal.2a682d0b91a35288271c73b7ee253e524cca0917d17fbaf6733e80b7a767a37c.js.br +0 -0
  12. package/dist/browser/terminal.2a682d0b91a35288271c73b7ee253e524cca0917d17fbaf6733e80b7a767a37c.js.gz +0 -0
  13. package/dist/browser/{terminal.css → terminal.4d1cf20c32ad7c2099df657358d540d5fd92bb55195a88121e74b28467238b42.css} +1 -1
  14. package/dist/browser/terminal.4d1cf20c32ad7c2099df657358d540d5fd92bb55195a88121e74b28467238b42.css.br +0 -0
  15. package/dist/browser/terminal.4d1cf20c32ad7c2099df657358d540d5fd92bb55195a88121e74b28467238b42.css.gz +0 -0
  16. package/dist/browser/{workspace.js → workspace.9bd1db81d3c897045a5d82d4804e374e41e78b1b2cfd05d37b982a4ea0d02626.js} +25 -25
  17. package/dist/browser/workspace.9bd1db81d3c897045a5d82d4804e374e41e78b1b2cfd05d37b982a4ea0d02626.js.br +0 -0
  18. package/dist/browser/workspace.9bd1db81d3c897045a5d82d4804e374e41e78b1b2cfd05d37b982a4ea0d02626.js.gz +0 -0
  19. package/dist/browser/{workspace.css → workspace.a0752f935cfeaf16758d1085fe8f3e1719a7cd525b91a9c9943c789d65879a54.css} +1 -1
  20. package/dist/browser/workspace.a0752f935cfeaf16758d1085fe8f3e1719a7cd525b91a9c9943c789d65879a54.css.br +0 -0
  21. package/dist/browser/workspace.a0752f935cfeaf16758d1085fe8f3e1719a7cd525b91a9c9943c789d65879a54.css.gz +0 -0
  22. package/dist/browser-shell.js +271 -25
  23. package/dist/canvas-freshness.js +122 -0
  24. package/dist/canvas-fs.js +273 -0
  25. package/dist/canvas-reads.js +747 -0
  26. package/dist/canvas-state-key.js +45 -0
  27. package/dist/canvas-state-worker.js +12 -0
  28. package/dist/central-recovery-stage.js +3 -3
  29. package/dist/chat-actions.js +26 -0
  30. package/dist/chat-channel.js +4 -3
  31. package/dist/chat-task-actions.js +1 -1
  32. package/dist/chat-warmth.js +0 -1
  33. package/dist/check-report.js +0 -6
  34. package/dist/commit-extract.js +79 -40
  35. package/dist/companion/access.js +162 -0
  36. package/dist/companion/actions.js +622 -0
  37. package/dist/companion/bonjour.js +45 -0
  38. package/dist/companion/canvas.js +141 -0
  39. package/dist/companion/chat-origin.js +92 -0
  40. package/dist/companion/chat.js +571 -0
  41. package/dist/companion/daemon.js +1387 -0
  42. package/dist/companion/direct-server.js +177 -0
  43. package/dist/companion/finish.js +51 -0
  44. package/dist/companion/framing.js +498 -0
  45. package/dist/companion/noise.js +461 -0
  46. package/dist/companion/passkey-gate.js +287 -0
  47. package/dist/companion/paths.js +90 -0
  48. package/dist/companion/reads.js +283 -0
  49. package/dist/companion/relay-auth.js +265 -0
  50. package/dist/companion/relay-server.js +870 -0
  51. package/dist/companion/schema.js +289 -0
  52. package/dist/companion/service.js +581 -0
  53. package/dist/companion/store.js +325 -0
  54. package/dist/companion/webauthn.js +407 -0
  55. package/dist/console-instance.js +0 -4
  56. package/dist/contracts/console-api.js +18 -0
  57. package/dist/converse.js +0 -1
  58. package/dist/coordinator.js +1 -1
  59. package/dist/design/kit.css +30 -0
  60. package/dist/desktop-config.js +156 -0
  61. package/dist/desktop-host.js +6 -152
  62. package/dist/desktop-update.js +1 -1
  63. package/dist/finished-task-sql.js +14 -0
  64. package/dist/flexible-answers.js +0 -1
  65. package/dist/github-read.js +41 -0
  66. package/dist/guides.js +4 -3
  67. package/dist/lead-doors.js +50 -3
  68. package/dist/lead-queue-runtime.js +11 -2
  69. package/dist/lead-queue.js +25 -0
  70. package/dist/live-backup-change.js +93 -0
  71. package/dist/live-backup.js +75 -31
  72. package/dist/live-bus.js +3 -2
  73. package/dist/live-records.js +0 -1
  74. package/dist/local-landing.js +47 -0
  75. package/dist/local-owner.js +0 -1
  76. package/dist/model-choices.js +0 -11
  77. package/dist/nightly-check.js +0 -3
  78. package/dist/nightly-github.js +1 -2
  79. package/dist/notification-retention.js +119 -0
  80. package/dist/observations.js +0 -1
  81. package/dist/operate.js +17 -4
  82. package/dist/person-proof.js +5 -1
  83. package/dist/pull-request-flow.js +116 -2
  84. package/dist/qr.js +360 -0
  85. package/dist/release-adapters.js +14 -43
  86. package/dist/release-auto.js +17 -13
  87. package/dist/release-card.js +0 -4
  88. package/dist/release-cli.js +37 -2
  89. package/dist/release.js +13 -2
  90. package/dist/restore-retirement.js +6 -1
  91. package/dist/result-review.js +0 -3
  92. package/dist/retention-ui.js +1 -1
  93. package/dist/retention.js +14 -21
  94. package/dist/review-context.js +0 -5
  95. package/dist/route-rules.js +1 -5
  96. package/dist/sandbox-runtime.js +0 -1
  97. package/dist/scope.js +68 -17
  98. package/dist/scout.js +0 -6
  99. package/dist/serve.js +60 -9
  100. package/dist/server/kit.js +1 -0
  101. package/dist/server/live.js +9 -2
  102. package/dist/server/pages.js +12 -4
  103. package/dist/server/phone-engine-api.js +79 -0
  104. package/dist/server/render-pages.js +1 -11
  105. package/dist/server/render-results.js +0 -1
  106. package/dist/server/render-tasks.js +0 -68
  107. package/dist/server/route-table.js +12 -1
  108. package/dist/server/settings-phone.js +515 -0
  109. package/dist/server/settings-scripts.js +2 -0
  110. package/dist/server/settings-section-table.js +0 -3
  111. package/dist/server/settings-sections.js +10 -4
  112. package/dist/server/settings.js +20 -5
  113. package/dist/server/terminals.js +2 -1
  114. package/dist/settings-groups-ui.js +2 -1
  115. package/dist/settings-proofs.js +6 -0
  116. package/dist/store.js +52 -4
  117. package/dist/structured-output.js +0 -1
  118. package/dist/style-asset.js +20 -7
  119. package/dist/tailnet.js +39 -0
  120. package/dist/task-control.js +5 -0
  121. package/dist/task-sizing.js +0 -1
  122. package/dist/toolroll-update-cli.js +19 -3
  123. package/dist/toolroll-update-ui.js +2 -2
  124. package/dist/toolroll-update.js +98 -16
  125. package/dist/youiyoux-intake.js +8 -0
  126. package/package.json +7 -2
  127. package/dist/contracts/contract-test.js +0 -55
  128. package/dist/unfenced-test-support.js +0 -6
  129. /package/dist/browser/{terminal.js → terminal.2a682d0b91a35288271c73b7ee253e524cca0917d17fbaf6733e80b7a767a37c.js} +0 -0
@@ -0,0 +1,273 @@
1
+ import { closeSync, constants, fstatSync, lstatSync, openSync, opendirSync, readSync, realpathSync } from "node:fs";
2
+ import { join, sep } from "node:path";
3
+ const NOFOLLOW = constants.O_NOFOLLOW ?? 0;
4
+ const NONBLOCK = constants.O_NONBLOCK ?? 0;
5
+ const DIRECTORY = constants.O_DIRECTORY ?? 0;
6
+ const PLAIN_NAME = /^[A-Za-z0-9][A-Za-z0-9._-]{0,120}$/;
7
+ export const DIR_BUDGET = 16;
8
+ export const plainName = (name) => (PLAIN_NAME.test(name) && !name.includes("..")) || name === ".youi";
9
+ let hook = null;
10
+ export function setCanvasFsHookForTest(next) { hook = next; }
11
+ const counters = { peakHeld: 0, entriesRead: 0 };
12
+ export function canvasFsCountersForTest() { return { ...counters }; }
13
+ export function resetCanvasFsCountersForTest() { counters.peakHeld = 0; counters.entriesRead = 0; }
14
+ const lstatBig = (path) => { try {
15
+ return lstatSync(path, { bigint: true });
16
+ }
17
+ catch {
18
+ return null;
19
+ } };
20
+ const myUid = () => typeof process.getuid === "function" ? BigInt(process.getuid()) : null;
21
+ function trusted(stats) {
22
+ const uid = myUid();
23
+ return stats.isDirectory() && (stats.uid === 0n || (uid !== null && stats.uid === uid)) && (stats.mode & 18n) === 0n;
24
+ }
25
+ export class DirScope {
26
+ budget;
27
+ dirs = new Set();
28
+ files = new Set();
29
+ closed = false;
30
+ constructor(budget = DIR_BUDGET) {
31
+ this.budget = budget;
32
+ }
33
+ get held() { return this.dirs.size; }
34
+ root(path) {
35
+ let real;
36
+ try {
37
+ real = realpathSync(path);
38
+ }
39
+ catch {
40
+ return null;
41
+ }
42
+ if (real !== path || !path.startsWith(sep))
43
+ return null;
44
+ const parts = path.split(sep).filter(one => one !== "");
45
+ if (parts.length === 0)
46
+ return null;
47
+ let above = this.open(sep, null, true);
48
+ for (const part of parts.slice(0, -1)) {
49
+ if (above === null)
50
+ return null;
51
+ const next = this.open(join(above.path, part), above, true);
52
+ this.release(above);
53
+ above = next;
54
+ }
55
+ if (above === null)
56
+ return null;
57
+ const root = this.open(path, above, false);
58
+ this.release(above);
59
+ if (root === null)
60
+ return null;
61
+ const standalone = { ...root, parent: null };
62
+ this.dirs.delete(root);
63
+ this.dirs.add(standalone);
64
+ return standalone;
65
+ }
66
+ child(parent, name) {
67
+ if (!plainName(name) || !this.holds(parent))
68
+ return null;
69
+ return this.open(join(parent.path, name), parent, false);
70
+ }
71
+ open(path, parent, mustTrust) {
72
+ if (this.closed || this.dirs.size >= this.budget)
73
+ return null;
74
+ hook?.("check", "dir", path);
75
+ const before = lstatBig(path);
76
+ if (before === null || before.isSymbolicLink() || !before.isDirectory() || (mustTrust && !trusted(before)))
77
+ return null;
78
+ let fd;
79
+ try {
80
+ fd = openSync(path, constants.O_RDONLY | DIRECTORY | NOFOLLOW | NONBLOCK);
81
+ }
82
+ catch {
83
+ return null;
84
+ }
85
+ hook?.("opened", "dir", path);
86
+ let opened;
87
+ try {
88
+ opened = fstatSync(fd, { bigint: true });
89
+ }
90
+ catch {
91
+ closeSync(fd);
92
+ return null;
93
+ }
94
+ const held = { path, fd, dev: opened.dev, ino: opened.ino, ctimeNs: opened.ctimeNs, parent, trusted: mustTrust };
95
+ this.dirs.add(held);
96
+ counters.peakHeld = Math.max(counters.peakHeld, this.dirs.size);
97
+ const fine = opened.isDirectory() && opened.dev === before.dev && opened.ino === before.ino && (!mustTrust || trusted(opened))
98
+ && (parent === null || (parent.trusted ? this.same(parent) : this.holds(parent)));
99
+ if (!fine) {
100
+ this.release(held);
101
+ return null;
102
+ }
103
+ return held;
104
+ }
105
+ same(dir) {
106
+ const there = lstatBig(dir.path);
107
+ return there !== null && !there.isSymbolicLink() && there.isDirectory() && there.dev === dir.dev && there.ino === dir.ino;
108
+ }
109
+ holds(dir) {
110
+ for (let at = dir; at !== null; at = at.parent) {
111
+ if (!this.dirs.has(at))
112
+ return false;
113
+ let now;
114
+ try {
115
+ now = fstatSync(at.fd, { bigint: true });
116
+ }
117
+ catch {
118
+ return false;
119
+ }
120
+ if (now.ctimeNs !== at.ctimeNs || !this.same(at))
121
+ return false;
122
+ }
123
+ return true;
124
+ }
125
+ listUpTo(dir, max) {
126
+ if (!this.holds(dir))
127
+ return { names: [], more: false };
128
+ const names = [];
129
+ let more = false;
130
+ let listing;
131
+ try {
132
+ listing = opendirSync(dir.path, { bufferSize: 32 });
133
+ }
134
+ catch {
135
+ return { names: [], more: false };
136
+ }
137
+ try {
138
+ for (let entry = listing.readSync(); entry !== null; entry = listing.readSync()) {
139
+ counters.entriesRead += 1;
140
+ if (names.length >= max) {
141
+ more = true;
142
+ break;
143
+ }
144
+ if (plainName(entry.name))
145
+ names.push(entry.name);
146
+ }
147
+ }
148
+ catch {
149
+ return { names: [], more: false };
150
+ }
151
+ finally {
152
+ try {
153
+ listing.closeSync();
154
+ }
155
+ catch { }
156
+ }
157
+ return this.holds(dir) ? { names, more } : { names: [], more: false };
158
+ }
159
+ list(dir, max) {
160
+ return this.listUpTo(dir, max).names;
161
+ }
162
+ peek(dir, name) {
163
+ if (!plainName(name))
164
+ return null;
165
+ try {
166
+ return lstatSync(join(dir.path, name));
167
+ }
168
+ catch {
169
+ return null;
170
+ }
171
+ }
172
+ openFile(dir, name, cap) {
173
+ if (this.closed || !plainName(name) || name === ".youi" || !this.holds(dir))
174
+ return null;
175
+ const path = join(dir.path, name);
176
+ hook?.("check", "file", path);
177
+ const before = lstatBig(path);
178
+ if (before === null || before.isSymbolicLink() || !before.isFile())
179
+ return null;
180
+ let fd;
181
+ try {
182
+ fd = openSync(path, constants.O_RDONLY | NOFOLLOW | NONBLOCK);
183
+ }
184
+ catch {
185
+ return null;
186
+ }
187
+ hook?.("opened", "file", path);
188
+ this.files.add(fd);
189
+ let stats;
190
+ try {
191
+ stats = fstatSync(fd);
192
+ }
193
+ catch {
194
+ this.releaseFile(fd);
195
+ return null;
196
+ }
197
+ if (!stats.isFile() || stats.nlink !== 1 || BigInt(stats.ino) !== before.ino || BigInt(stats.dev) !== before.dev || stats.size > cap || !this.holds(dir)) {
198
+ this.releaseFile(fd);
199
+ return null;
200
+ }
201
+ return { dir, name, fd, stats };
202
+ }
203
+ readAt(file, position, length) {
204
+ const bytes = Buffer.alloc(length);
205
+ let got = 0;
206
+ try {
207
+ while (got < length) {
208
+ const read = readSync(file.fd, bytes, got, length - got, position + got);
209
+ if (read <= 0)
210
+ return null;
211
+ got += read;
212
+ }
213
+ }
214
+ catch {
215
+ return null;
216
+ }
217
+ return this.holds(file.dir) ? bytes : null;
218
+ }
219
+ readFile(dir, name, cap, prefix) {
220
+ const file = this.openFile(dir, name, cap);
221
+ if (file === null)
222
+ return null;
223
+ try {
224
+ const bytes = this.readAt(file, 0, Math.min(file.stats.size, prefix ?? file.stats.size));
225
+ return bytes === null ? null : { bytes, stats: file.stats };
226
+ }
227
+ finally {
228
+ this.releaseFile(file.fd);
229
+ }
230
+ }
231
+ release(dir) {
232
+ if (!this.dirs.delete(dir))
233
+ return;
234
+ try {
235
+ closeSync(dir.fd);
236
+ }
237
+ catch { }
238
+ }
239
+ releaseFile(fd) {
240
+ if (!this.files.delete(fd))
241
+ return;
242
+ try {
243
+ closeSync(fd);
244
+ }
245
+ catch { }
246
+ }
247
+ close() {
248
+ this.closed = true;
249
+ for (const fd of this.files) {
250
+ try {
251
+ closeSync(fd);
252
+ }
253
+ catch { }
254
+ }
255
+ this.files.clear();
256
+ for (const dir of this.dirs) {
257
+ try {
258
+ closeSync(dir.fd);
259
+ }
260
+ catch { }
261
+ }
262
+ this.dirs.clear();
263
+ }
264
+ }
265
+ export function withDirScope(work) {
266
+ const scope = new DirScope();
267
+ try {
268
+ return work(scope);
269
+ }
270
+ finally {
271
+ scope.close();
272
+ }
273
+ }