toolroll 0.9.129 → 0.9.131
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.
- package/CHANGELOG.md +44 -0
- package/dist/agent-fence.js +0 -2
- package/dist/agent-state.js +1 -1
- package/dist/agents-board.js +0 -3
- package/dist/assignment.js +4 -3
- package/dist/backup-ui.js +6 -3
- package/dist/bounded-spawn.js +0 -1
- package/dist/browser/manifest.json +57 -0
- package/dist/browser/terminal.4d1cf20c32ad7c2099df657358d540d5fd92bb55195a88121e74b28467238b42.css.br +0 -0
- package/dist/browser/terminal.4d1cf20c32ad7c2099df657358d540d5fd92bb55195a88121e74b28467238b42.css.gz +0 -0
- package/dist/browser/{terminal.js → terminal.8978c8cbb268e1006f4b0be371c2401b58078e6d9f1380f4a5c2a12da843909f.js} +1 -1
- package/dist/browser/terminal.8978c8cbb268e1006f4b0be371c2401b58078e6d9f1380f4a5c2a12da843909f.js.br +0 -0
- package/dist/browser/terminal.8978c8cbb268e1006f4b0be371c2401b58078e6d9f1380f4a5c2a12da843909f.js.gz +0 -0
- package/dist/browser/{workspace.js → workspace.4f5935dc80574baadf1adafd39a08c567fb1fac1323052ca355546622f9b06d2.js} +25 -25
- package/dist/browser/workspace.4f5935dc80574baadf1adafd39a08c567fb1fac1323052ca355546622f9b06d2.js.br +0 -0
- package/dist/browser/workspace.4f5935dc80574baadf1adafd39a08c567fb1fac1323052ca355546622f9b06d2.js.gz +0 -0
- package/dist/browser/{workspace.css → workspace.a0752f935cfeaf16758d1085fe8f3e1719a7cd525b91a9c9943c789d65879a54.css} +1 -1
- package/dist/browser/workspace.a0752f935cfeaf16758d1085fe8f3e1719a7cd525b91a9c9943c789d65879a54.css.br +0 -0
- package/dist/browser/workspace.a0752f935cfeaf16758d1085fe8f3e1719a7cd525b91a9c9943c789d65879a54.css.gz +0 -0
- package/dist/browser-shell.js +271 -25
- package/dist/builder-restart.js +13 -4
- package/dist/builder.js +4 -1
- package/dist/canvas-freshness.js +122 -0
- package/dist/canvas-fs.js +273 -0
- package/dist/canvas-reads.js +747 -0
- package/dist/canvas-state-key.js +45 -0
- package/dist/canvas-state-worker.js +12 -0
- package/dist/central-recovery-stage.js +3 -3
- package/dist/chat-actions.js +26 -0
- package/dist/chat-channel.js +4 -3
- package/dist/chat-follow.js +4 -0
- package/dist/chat-task-actions.js +1 -1
- package/dist/chat-warmth.js +0 -1
- package/dist/check-report.js +0 -6
- package/dist/commit-extract.js +79 -40
- package/dist/companion/access.js +1 -0
- package/dist/companion/actions.js +79 -16
- package/dist/companion/canvas.js +141 -0
- package/dist/companion/chat-origin.js +92 -0
- package/dist/companion/chat.js +571 -0
- package/dist/companion/daemon.js +46 -5
- package/dist/companion/finish.js +51 -0
- package/dist/companion/reads.js +5 -1
- package/dist/companion/schema.js +64 -0
- package/dist/companion/service.js +1 -0
- package/dist/companion/store.js +1 -0
- package/dist/companion/webauthn.js +11 -2
- package/dist/console-instance.js +0 -4
- package/dist/contracts/console-api.js +1 -1
- package/dist/converse.js +0 -1
- package/dist/coordinator.js +1 -1
- package/dist/db-tuning.js +16 -0
- package/dist/desktop-config.js +156 -0
- package/dist/desktop-host.js +6 -152
- package/dist/desktop-update.js +1 -1
- package/dist/discord.js +9 -3
- package/dist/dispatch.js +32 -4
- package/dist/doctor.js +30 -0
- package/dist/evidence.js +49 -3
- package/dist/exec.js +3 -0
- package/dist/finished-task-sql.js +14 -0
- package/dist/flexible-answers.js +0 -1
- package/dist/git-views.js +7 -1
- package/dist/github-read.js +41 -0
- package/dist/guides.js +4 -3
- package/dist/invoke.js +12 -2
- package/dist/lead-doors.js +50 -3
- package/dist/lead-queue-runtime.js +18 -6
- package/dist/lead-queue.js +25 -0
- package/dist/lead-status.js +3 -3
- package/dist/live-backup-change.js +93 -0
- package/dist/live-backup.js +75 -31
- package/dist/live-bus.js +3 -2
- package/dist/live-records.js +0 -1
- package/dist/local-owner.js +0 -1
- package/dist/loop-recovery.js +40 -0
- package/dist/maintenance.js +29 -1
- package/dist/model-choices.js +0 -11
- package/dist/needs-you.js +2 -0
- package/dist/nightly-check.js +0 -3
- package/dist/nightly-github.js +1 -2
- package/dist/notification-retention.js +119 -0
- package/dist/observations.js +0 -1
- package/dist/operate.js +393 -56
- package/dist/planner.js +4 -1
- package/dist/pull-request-flow.js +56 -15
- package/dist/qr.js +0 -25
- package/dist/query-index-schema.js +10 -0
- package/dist/read-executor-worker.js +9 -7
- package/dist/read-executor.js +18 -1
- package/dist/read-worker-connection.js +7 -0
- package/dist/release-adapters.js +63 -48
- package/dist/release-auto.js +17 -13
- package/dist/release-card.js +0 -4
- package/dist/release-cli.js +58 -10
- package/dist/release-next.js +1 -1
- package/dist/release-stops.js +71 -0
- package/dist/release-supersede.js +125 -0
- package/dist/release-supervise.js +90 -0
- package/dist/release.js +265 -42
- package/dist/restore-retirement.js +4 -1
- package/dist/result-review.js +0 -3
- package/dist/retention-ui.js +1 -1
- package/dist/retention.js +14 -21
- package/dist/review-context.js +0 -5
- package/dist/route-rules.js +1 -5
- package/dist/runner.js +36 -1
- package/dist/sandbox-runtime.js +0 -1
- package/dist/scope.js +1 -13
- package/dist/scout.js +4 -7
- package/dist/serve.js +122 -12
- package/dist/server/kit.js +1 -0
- package/dist/server/live.js +9 -2
- package/dist/server/pages.js +3 -2
- package/dist/server/phone-engine-api.js +22 -2
- package/dist/server/render-pages.js +1 -11
- package/dist/server/render-results.js +0 -1
- package/dist/server/render-tasks.js +0 -68
- package/dist/server/route-table.js +1 -1
- package/dist/server/settings-phone.js +32 -9
- package/dist/server/settings-scripts.js +1 -1
- package/dist/server/settings-section-table.js +0 -3
- package/dist/server/settings-sections.js +4 -2
- package/dist/server/settings.js +20 -5
- package/dist/server/terminals.js +2 -1
- package/dist/shutdown-proof.js +29 -0
- package/dist/slack.js +9 -3
- package/dist/sqlite-telemetry.js +26 -14
- package/dist/statement-cache.js +137 -0
- package/dist/store.js +86 -14
- package/dist/structured-output.js +0 -1
- package/dist/style-asset.js +20 -7
- package/dist/tailnet.js +0 -3
- package/dist/task-control.js +5 -0
- package/dist/task-sizing.js +0 -1
- package/dist/task-status.js +1 -1
- package/dist/teams.js +9 -3
- package/dist/teardown-git.js +10 -1
- package/dist/telegram.js +4 -1
- package/dist/toolroll-update-cli.js +19 -3
- package/dist/toolroll-update-ui.js +2 -2
- package/dist/toolroll-update.js +95 -15
- package/dist/up-processes.js +16 -1
- package/dist/up-role-child.js +2 -0
- package/dist/wake-hub.js +15 -6
- package/dist/work-index.js +101 -44
- package/dist/work-reads.js +53 -9
- package/dist/work-snapshots.js +185 -0
- package/dist/worker-statement-cache.js +83 -0
- package/dist/workspace-revision.js +145 -21
- package/package.json +1 -1
- package/dist/companion/webauthn-test-support.js +0 -44
- package/dist/contracts/contract-test.js +0 -55
- package/dist/unfenced-test-support.js +0 -6
- /package/dist/browser/{terminal.css → terminal.4d1cf20c32ad7c2099df657358d540d5fd92bb55195a88121e74b28467238b42.css} +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
|
+
}
|