@halcyonlabs/app 0.47.0-halcyon.481 → 0.47.0-halcyon.484
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/dist/index.d.ts +15 -15
- package/package.json +2 -2
- package/server/dist/builtin-plugins/orbit/dist/assets/moonlet/fixed-runner/linux-x64/manifest.json +6 -6
- package/server/dist/builtin-plugins/orbit/dist/assets/moonlet/fixed-runner/linux-x64/orbit-deploy +0 -0
- package/server/dist/builtin-plugins/orbit/dist/assets/moonlet/revision +1 -1
- package/server/dist/builtin-plugins/orbit/dist/assets/moonlet/source.json +1 -1
- package/server/dist/builtin-plugins/orbit/skills/github-change/SKILL.md +33 -1
- package/server/dist/builtin-plugins/orbit/skills/github-change/pre-push.d.mts +3 -1
- package/server/dist/builtin-plugins/orbit/skills/github-change/pre-push.mjs +157 -8
package/dist/index.d.ts
CHANGED
|
@@ -191,10 +191,10 @@ declare const uiPreferenceDefinitions: {
|
|
|
191
191
|
}>>;
|
|
192
192
|
readonly "sidebar.threadGrouping.environment": UiPreferenceDefinition<z$1.ZodUnion<readonly [z$1.ZodLiteral<"auto">, z$1.ZodBoolean]>>;
|
|
193
193
|
readonly "sidebar.chronologicalSort": UiPreferenceDefinition<z$1.ZodEnum<{
|
|
194
|
+
none: "none";
|
|
194
195
|
updated: "updated";
|
|
195
196
|
created: "created";
|
|
196
197
|
alpha: "alpha";
|
|
197
|
-
none: "none";
|
|
198
198
|
}>>;
|
|
199
199
|
readonly "sidebar.sortDirection": UiPreferenceDefinition<z$1.ZodEnum<{
|
|
200
200
|
default: "default";
|
|
@@ -628,8 +628,8 @@ declare const hostSchema: z$1.ZodObject<{
|
|
|
628
628
|
}, z$1.core.$strip>>;
|
|
629
629
|
}, z$1.core.$strip>;
|
|
630
630
|
maxPermissionMode: z$1.ZodEnum<{
|
|
631
|
-
full: "full";
|
|
632
631
|
auto: "auto";
|
|
632
|
+
full: "full";
|
|
633
633
|
"accept-edits": "accept-edits";
|
|
634
634
|
}>;
|
|
635
635
|
delivery: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodObject<{
|
|
@@ -3176,8 +3176,8 @@ declare const threadEventSchema: z$1.ZodUnion<readonly [z$1.ZodIntersection<z$1.
|
|
|
3176
3176
|
}>;
|
|
3177
3177
|
permissionMode: z$1.ZodEnum<{
|
|
3178
3178
|
readonly: "readonly";
|
|
3179
|
-
full: "full";
|
|
3180
3179
|
auto: "auto";
|
|
3180
|
+
full: "full";
|
|
3181
3181
|
"accept-edits": "accept-edits";
|
|
3182
3182
|
"workspace-write": "workspace-write";
|
|
3183
3183
|
}>;
|
|
@@ -3975,8 +3975,8 @@ type ReasoningLevel = z$1.infer<typeof reasoningLevelSchema>;
|
|
|
3975
3975
|
declare const serviceTierSchema: z$1.ZodString;
|
|
3976
3976
|
type ServiceTier = z$1.infer<typeof serviceTierSchema>;
|
|
3977
3977
|
declare const permissionModeSchema: z$1.ZodEnum<{
|
|
3978
|
-
full: "full";
|
|
3979
3978
|
auto: "auto";
|
|
3979
|
+
full: "full";
|
|
3980
3980
|
"accept-edits": "accept-edits";
|
|
3981
3981
|
}>;
|
|
3982
3982
|
type PermissionMode = z$1.infer<typeof permissionModeSchema>;
|
|
@@ -4145,8 +4145,8 @@ declare const resolvedThreadExecutionOptionsSchema: z$1.ZodObject<{
|
|
|
4145
4145
|
serviceTier: z$1.ZodString;
|
|
4146
4146
|
reasoningLevel: z$1.ZodString;
|
|
4147
4147
|
permissionMode: z$1.ZodEnum<{
|
|
4148
|
-
full: "full";
|
|
4149
4148
|
auto: "auto";
|
|
4149
|
+
full: "full";
|
|
4150
4150
|
"accept-edits": "accept-edits";
|
|
4151
4151
|
}>;
|
|
4152
4152
|
source: z$1.ZodEnum<{
|
|
@@ -4162,8 +4162,8 @@ declare const projectExecutionDefaultsSchema: z$1.ZodObject<{
|
|
|
4162
4162
|
serviceTier: z$1.ZodString;
|
|
4163
4163
|
reasoningLevel: z$1.ZodString;
|
|
4164
4164
|
permissionMode: z$1.ZodEnum<{
|
|
4165
|
-
full: "full";
|
|
4166
4165
|
auto: "auto";
|
|
4166
|
+
full: "full";
|
|
4167
4167
|
"accept-edits": "accept-edits";
|
|
4168
4168
|
}>;
|
|
4169
4169
|
}, z$1.core.$strip>;
|
|
@@ -4203,8 +4203,8 @@ declare const providerInfoSchema: z$1.ZodObject<{
|
|
|
4203
4203
|
supportsFork: z$1.ZodBoolean;
|
|
4204
4204
|
supportsSessionRewind: z$1.ZodBoolean;
|
|
4205
4205
|
permissionModes: z$1.ZodArray<z$1.ZodEnum<{
|
|
4206
|
-
full: "full";
|
|
4207
4206
|
auto: "auto";
|
|
4207
|
+
full: "full";
|
|
4208
4208
|
"accept-edits": "accept-edits";
|
|
4209
4209
|
}>>;
|
|
4210
4210
|
modelCatalogScope: z$1.ZodEnum<{
|
|
@@ -4444,8 +4444,8 @@ declare const threadQueuedMessageSchema: z$1.ZodObject<{
|
|
|
4444
4444
|
model: z$1.ZodString;
|
|
4445
4445
|
reasoningLevel: z$1.ZodString;
|
|
4446
4446
|
permissionMode: z$1.ZodEnum<{
|
|
4447
|
-
full: "full";
|
|
4448
4447
|
auto: "auto";
|
|
4448
|
+
full: "full";
|
|
4449
4449
|
"accept-edits": "accept-edits";
|
|
4450
4450
|
}>;
|
|
4451
4451
|
serviceTier: z$1.ZodString;
|
|
@@ -6131,8 +6131,8 @@ declare const hostDaemonCommandRegistry: {
|
|
|
6131
6131
|
skillFilePath: z$1.ZodString;
|
|
6132
6132
|
}, z$1.core.$strict>], "kind">>;
|
|
6133
6133
|
instructionMode: z$1.ZodEnum<{
|
|
6134
|
-
replace: "replace";
|
|
6135
6134
|
append: "append";
|
|
6135
|
+
replace: "replace";
|
|
6136
6136
|
}>;
|
|
6137
6137
|
type: z$1.ZodLiteral<"thread.rewind.prepare">;
|
|
6138
6138
|
leaseId: z$1.ZodString;
|
|
@@ -6280,8 +6280,8 @@ declare const hostDaemonCommandRegistry: {
|
|
|
6280
6280
|
skillFilePath: z$1.ZodString;
|
|
6281
6281
|
}, z$1.core.$strict>], "kind">>;
|
|
6282
6282
|
instructionMode: z$1.ZodEnum<{
|
|
6283
|
-
replace: "replace";
|
|
6284
6283
|
append: "append";
|
|
6284
|
+
replace: "replace";
|
|
6285
6285
|
}>;
|
|
6286
6286
|
type: z$1.ZodLiteral<"thread.start">;
|
|
6287
6287
|
requestId: z$1.ZodString;
|
|
@@ -6744,8 +6744,8 @@ declare const hostDaemonCommandRegistry: {
|
|
|
6744
6744
|
envPassthrough: z$1.ZodArray<z$1.ZodString>;
|
|
6745
6745
|
}, z$1.core.$strict>;
|
|
6746
6746
|
instructionMode: z$1.ZodEnum<{
|
|
6747
|
-
replace: "replace";
|
|
6748
6747
|
append: "append";
|
|
6748
|
+
replace: "replace";
|
|
6749
6749
|
}>;
|
|
6750
6750
|
projectId: z$1.ZodString;
|
|
6751
6751
|
providerId: z$1.ZodString;
|
|
@@ -6960,8 +6960,8 @@ declare const hostDaemonCommandRegistry: {
|
|
|
6960
6960
|
envPassthrough: z$1.ZodArray<z$1.ZodString>;
|
|
6961
6961
|
}, z$1.core.$strict>;
|
|
6962
6962
|
instructionMode: z$1.ZodEnum<{
|
|
6963
|
-
replace: "replace";
|
|
6964
6963
|
append: "append";
|
|
6964
|
+
replace: "replace";
|
|
6965
6965
|
}>;
|
|
6966
6966
|
projectId: z$1.ZodString;
|
|
6967
6967
|
providerId: z$1.ZodString;
|
|
@@ -8133,8 +8133,8 @@ declare const hostDaemonCommandRegistry: {
|
|
|
8133
8133
|
supported: z$1.ZodLiteral<true>;
|
|
8134
8134
|
health: z$1.ZodObject<{
|
|
8135
8135
|
status: z$1.ZodEnum<{
|
|
8136
|
-
unknown: "unknown";
|
|
8137
8136
|
ready: "ready";
|
|
8137
|
+
unknown: "unknown";
|
|
8138
8138
|
not_installed: "not_installed";
|
|
8139
8139
|
unauthenticated: "unauthenticated";
|
|
8140
8140
|
expired: "expired";
|
|
@@ -8185,9 +8185,9 @@ declare const hostDaemonCommandRegistry: {
|
|
|
8185
8185
|
executablePath: z$1.ZodNullable<z$1.ZodString>;
|
|
8186
8186
|
installed: z$1.ZodBoolean;
|
|
8187
8187
|
installSource: z$1.ZodEnum<{
|
|
8188
|
+
external: "external";
|
|
8188
8189
|
notInstalled: "notInstalled";
|
|
8189
8190
|
npmGlobal: "npmGlobal";
|
|
8190
|
-
external: "external";
|
|
8191
8191
|
}>;
|
|
8192
8192
|
currentVersion: z$1.ZodNullable<z$1.ZodString>;
|
|
8193
8193
|
latestVersion: z$1.ZodNullable<z$1.ZodString>;
|
|
@@ -8736,9 +8736,9 @@ declare const providerCliStatusResponseSchema: z$1.ZodRecord<z$1.ZodString, z$1.
|
|
|
8736
8736
|
executablePath: z$1.ZodNullable<z$1.ZodString>;
|
|
8737
8737
|
installed: z$1.ZodBoolean;
|
|
8738
8738
|
installSource: z$1.ZodEnum<{
|
|
8739
|
+
external: "external";
|
|
8739
8740
|
notInstalled: "notInstalled";
|
|
8740
8741
|
npmGlobal: "npmGlobal";
|
|
8741
|
-
external: "external";
|
|
8742
8742
|
}>;
|
|
8743
8743
|
currentVersion: z$1.ZodNullable<z$1.ZodString>;
|
|
8744
8744
|
latestVersion: z$1.ZodNullable<z$1.ZodString>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@halcyonlabs/app",
|
|
3
|
-
"version": "0.47.0-halcyon.
|
|
3
|
+
"version": "0.47.0-halcyon.484",
|
|
4
4
|
"description": "bb app launcher for npx",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bb",
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"node": "^22.19.0 || ^24.0.0 || ^26.0.0"
|
|
106
106
|
},
|
|
107
107
|
"moonletRelease": {
|
|
108
|
-
"summary": "
|
|
108
|
+
"summary": "Preserve source during stopped-turn output cleanup (#497)"
|
|
109
109
|
},
|
|
110
110
|
"license": "SEE LICENSE IN LICENSE"
|
|
111
111
|
}
|
package/server/dist/builtin-plugins/orbit/dist/assets/moonlet/fixed-runner/linux-x64/manifest.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
-
"commit": "
|
|
2
|
+
"commit": "f13912d1b9e9dbd15cbb466bef71463a2c20acf1",
|
|
3
3
|
"file": "orbit-deploy",
|
|
4
4
|
"platform": "linux-x64",
|
|
5
5
|
"provenance": {
|
|
6
|
-
"artifactId":
|
|
7
|
-
"artifactName": "linux-bundle-
|
|
6
|
+
"artifactId": 14775961441,
|
|
7
|
+
"artifactName": "linux-bundle-f13912d1b9e9dbd15cbb466bef71463a2c20acf1",
|
|
8
8
|
"repository": "matt0x6F/personalassistant",
|
|
9
|
-
"runId":
|
|
9
|
+
"runId": 45075327448,
|
|
10
10
|
"workflow": ".github/workflows/moonlet-linux-bundle.yml"
|
|
11
11
|
},
|
|
12
12
|
"schema": 1,
|
|
13
|
-
"sha256": "
|
|
14
|
-
"size":
|
|
13
|
+
"sha256": "fe2b276c682ef92d975b67d2ae105b6003ebcf02fa6d372a83025cc87e41d080",
|
|
14
|
+
"size": 3306208
|
|
15
15
|
}
|
package/server/dist/builtin-plugins/orbit/dist/assets/moonlet/fixed-runner/linux-x64/orbit-deploy
CHANGED
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
f13912d1b9e9dbd15cbb466bef71463a2c20acf1
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"repository":"matt0x6F/personalassistant","revision":"
|
|
1
|
+
{"repository":"matt0x6F/personalassistant","revision":"f13912d1b9e9dbd15cbb466bef71463a2c20acf1"}
|
|
@@ -208,9 +208,41 @@ question for the owner's approval; neither enables the other.
|
|
|
208
208
|
export npm_config_cache="$PWD/.orbit-build/npm-cache"
|
|
209
209
|
export npm_config_store_dir="$PWD/.orbit-build/pnpm-store"
|
|
210
210
|
export XDG_CACHE_HOME="$PWD/.orbit-build/cache"
|
|
211
|
-
|
|
211
|
+
python3 - <<'ORBIT_BUILD_CACHES'
|
|
212
|
+
import os
|
|
213
|
+
from contextlib import ExitStack
|
|
214
|
+
with ExitStack() as handles:
|
|
215
|
+
def directory(parent, name):
|
|
216
|
+
try:
|
|
217
|
+
os.mkdir(name, mode=0o700, dir_fd=parent)
|
|
218
|
+
created = True
|
|
219
|
+
except FileExistsError:
|
|
220
|
+
created = False
|
|
221
|
+
fd = os.open(name, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=parent)
|
|
222
|
+
handles.callback(os.close, fd)
|
|
223
|
+
return fd, created
|
|
224
|
+
root = os.open(".", os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW)
|
|
225
|
+
handles.callback(os.close, root)
|
|
226
|
+
build, _ = directory(root, ".orbit-build")
|
|
227
|
+
directory(build, "home")
|
|
228
|
+
cargo, _ = directory(build, "cargo-home")
|
|
229
|
+
for parent, name in [(build, name) for name in ["tmp", "cargo-target", "npm-cache", "pnpm-store", "cache"]] + [(cargo, "registry"), (cargo, "git"), (root, "node_modules")]:
|
|
230
|
+
cache, created = directory(parent, name)
|
|
231
|
+
if created:
|
|
232
|
+
fd = os.open("CACHEDIR.TAG", os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o600, dir_fd=cache)
|
|
233
|
+
with os.fdopen(fd, "w") as tag:
|
|
234
|
+
info = os.fstat(cache)
|
|
235
|
+
tag.write(f"Signature: 8a477f597d28d172789f06886806bc55\n# Orbit generated cache v1: {info.st_dev}:{info.st_ino}\n")
|
|
236
|
+
ORBIT_BUILD_CACHES
|
|
212
237
|
```
|
|
213
238
|
|
|
239
|
+
This marks only newly created cache directories with an explicit disposable-cache
|
|
240
|
+
declaration bound to its device and inode. Generic cache tags alone do not
|
|
241
|
+
prove origin. Existing unproved directories are kept; never add a tag afterward
|
|
242
|
+
merely because a folder has a familiar name. Keep source, notes, patches and
|
|
243
|
+
unique results outside declared caches. Enclosing tracked, staged or untracked
|
|
244
|
+
source still blocks cleanup, and declared results always stay.
|
|
245
|
+
|
|
214
246
|
Keep `.orbit-build/` out of commits, and use it only for regenerable files. Keep
|
|
215
247
|
logs and anything you will deliver as a result elsewhere in your work folder.
|
|
216
248
|
These are local development files, never an installation on the station. A cache write denied under your home folder means the
|
|
@@ -20,6 +20,8 @@ export type CheckOutput = { current: string; folders: string[] };
|
|
|
20
20
|
export declare function prepareCheckOutput(top: string): CheckOutput | null;
|
|
21
21
|
export declare function cleanupCheckOutput(top: string, context: CheckOutput | null, keep?: string[]): string[];
|
|
22
22
|
|
|
23
|
-
export declare function runAll(top: string, steps: (Step & { setup?: boolean })[], log: string, context?: CheckOutput | null, environment?: Record<string, string | undefined>): { ok: boolean; skipped: boolean; status: number | string | null; command: string }[];
|
|
23
|
+
export declare function runAll(top: string, steps: (Step & { setup?: boolean })[], log: string, context?: CheckOutput | null, environment?: Record<string, string | undefined>): { ok: boolean; skipped: boolean; status: number | string | null; command: string; output: string }[];
|
|
24
24
|
|
|
25
25
|
export declare function activeBuildLease(env: Record<string, string | undefined>, queue?: string): boolean;
|
|
26
|
+
|
|
27
|
+
export declare function scopedCommand(program: string, args: string[]): { program: string; args: string[] };
|
|
@@ -246,6 +246,88 @@ function plan(top, base) {
|
|
|
246
246
|
return { kind: "derived", changed, untracked, uncovered: [], ...derivedChecks(top) };
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
+
const LINUX_CHECK_SCOPE = String.raw`import ctypes
|
|
250
|
+
import os
|
|
251
|
+
import signal
|
|
252
|
+
import subprocess
|
|
253
|
+
import sys
|
|
254
|
+
from pathlib import Path
|
|
255
|
+
|
|
256
|
+
PR_SET_CHILD_SUBREAPER = 36
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
class Interrupted(Exception):
|
|
260
|
+
def __init__(self, number):
|
|
261
|
+
self.number = number
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
def finish_children():
|
|
265
|
+
children = Path('/proc/self/task') / str(os.getpid()) / 'children'
|
|
266
|
+
while True:
|
|
267
|
+
try:
|
|
268
|
+
while os.waitpid(-1, os.WNOHANG)[0]:
|
|
269
|
+
pass
|
|
270
|
+
except ChildProcessError:
|
|
271
|
+
return
|
|
272
|
+
for pid in children.read_text().split():
|
|
273
|
+
try:
|
|
274
|
+
os.kill(int(pid), signal.SIGKILL)
|
|
275
|
+
except ProcessLookupError:
|
|
276
|
+
pass
|
|
277
|
+
try:
|
|
278
|
+
os.waitpid(-1, 0)
|
|
279
|
+
except ChildProcessError:
|
|
280
|
+
return
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
def main():
|
|
284
|
+
if sys.platform != 'linux' or len(sys.argv) < 2:
|
|
285
|
+
raise ValueError('Linux check command required')
|
|
286
|
+
libc = ctypes.CDLL(None, use_errno=True)
|
|
287
|
+
libc.prctl.argtypes = [ctypes.c_int, ctypes.c_ulong, ctypes.c_ulong, ctypes.c_ulong, ctypes.c_ulong]
|
|
288
|
+
libc.prctl.restype = ctypes.c_int
|
|
289
|
+
if libc.prctl(PR_SET_CHILD_SUBREAPER, 1, 0, 0, 0) != 0:
|
|
290
|
+
raise OSError(ctypes.get_errno(), 'could not own check descendants')
|
|
291
|
+
signals = [signal.SIGTERM, signal.SIGINT, signal.SIGHUP]
|
|
292
|
+
child = None
|
|
293
|
+
received = None
|
|
294
|
+
|
|
295
|
+
def interrupted(number, _frame):
|
|
296
|
+
nonlocal received
|
|
297
|
+
received = number
|
|
298
|
+
if child is None:
|
|
299
|
+
raise Interrupted(number)
|
|
300
|
+
try:
|
|
301
|
+
child.send_signal(number)
|
|
302
|
+
except ProcessLookupError:
|
|
303
|
+
pass
|
|
304
|
+
|
|
305
|
+
for number in signals:
|
|
306
|
+
signal.signal(number, interrupted)
|
|
307
|
+
signal.signal(signal.SIGCHLD, signal.SIG_DFL)
|
|
308
|
+
result = 1
|
|
309
|
+
try:
|
|
310
|
+
child = subprocess.Popen(sys.argv[1:], close_fds=False)
|
|
311
|
+
result = child.wait()
|
|
312
|
+
except Interrupted as error:
|
|
313
|
+
result = 128 + error.number
|
|
314
|
+
finally:
|
|
315
|
+
for number in signals:
|
|
316
|
+
signal.signal(number, signal.SIG_IGN)
|
|
317
|
+
finish_children()
|
|
318
|
+
if received is not None and result == 0:
|
|
319
|
+
result = 128 + received
|
|
320
|
+
return result if result >= 0 else 128 - result
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
if __name__ == '__main__':
|
|
324
|
+
sys.exit(main())
|
|
325
|
+
`;
|
|
326
|
+
|
|
327
|
+
export function scopedCommand(program, args) {
|
|
328
|
+
return { program: "python3", args: ["-I", "-B", "-c", LINUX_CHECK_SCOPE, program, ...args] };
|
|
329
|
+
}
|
|
330
|
+
|
|
249
331
|
export function runAll(top, steps, log, context, environment = process.env.BB_THREAD_ID ? buildEnvironment(top) : { ...process.env }) {
|
|
250
332
|
const results = [];
|
|
251
333
|
if (context) environment.TMPDIR = context.current;
|
|
@@ -257,15 +339,27 @@ export function runAll(top, steps, log, context, environment = process.env.BB_TH
|
|
|
257
339
|
const started = Date.now();
|
|
258
340
|
appendFileSync(log, `\n$ (cd ${step.cwd}) ${step.command}\n`);
|
|
259
341
|
const queued = process.platform === "linux" && environment.BB_THREAD_ID && !covered && existsSync("/usr/local/orbit/bin/orbit-build");
|
|
260
|
-
|
|
261
|
-
|
|
342
|
+
let program = queued ? "/usr/local/orbit/bin/orbit-build" : "bash";
|
|
343
|
+
let args = queued ? ["--", "/bin/bash", "-c", step.command] : ["-c", step.command];
|
|
344
|
+
if (process.platform === "linux") {
|
|
345
|
+
const scoped = scopedCommand(program, args);
|
|
346
|
+
program = scoped.program;
|
|
347
|
+
args = scoped.args;
|
|
348
|
+
}
|
|
262
349
|
const result = spawnSync(program, args, { cwd: resolve(top, step.cwd), env: environment, stdio, encoding: "utf8", maxBuffer: 256 * 1024 * 1024 });
|
|
263
350
|
const output = `${result.stdout ?? ""}${result.stderr ?? ""}${result.error ? `${result.error.message}\n` : ""}`;
|
|
264
351
|
appendFileSync(log, output);
|
|
265
352
|
const seconds = Math.round((Date.now() - started) / 1000);
|
|
266
|
-
const skipped = !step.setup && result.status === NOT_HERE;
|
|
267
|
-
results.push({
|
|
268
|
-
|
|
353
|
+
const skipped = !step.setup && !result.error && result.status === NOT_HERE;
|
|
354
|
+
results.push({
|
|
355
|
+
...step,
|
|
356
|
+
ok: !result.error && (result.status === 0 || skipped),
|
|
357
|
+
skipped,
|
|
358
|
+
status: result.error ? (result.error.code ?? "spawn-error") : (result.status ?? result.signal),
|
|
359
|
+
seconds,
|
|
360
|
+
output,
|
|
361
|
+
});
|
|
362
|
+
if (step.setup && (result.error || result.status !== 0)) break;
|
|
269
363
|
}
|
|
270
364
|
return results;
|
|
271
365
|
}
|
|
@@ -283,6 +377,58 @@ const BUILD_CACHES = [
|
|
|
283
377
|
"home/.rustup",
|
|
284
378
|
];
|
|
285
379
|
|
|
380
|
+
function cacheDeclaration(path) {
|
|
381
|
+
let descriptor;
|
|
382
|
+
try {
|
|
383
|
+
const tag = join(path, "CACHEDIR.TAG");
|
|
384
|
+
descriptor = openSync(tag, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
|
|
385
|
+
const info = fstatSync(descriptor, { bigint: true });
|
|
386
|
+
if (!info.isFile() || info.nlink !== 1n || info.uid !== BigInt(process.getuid()) || info.size > 65536n) return false;
|
|
387
|
+
const found = Buffer.alloc(Number(info.size));
|
|
388
|
+
if (readSync(descriptor, found, 0, found.length, 0) !== found.length) return false;
|
|
389
|
+
const named = lstatSync(tag, { bigint: true });
|
|
390
|
+
if (named.ino !== info.ino || named.dev !== info.dev || named.size !== info.size) return false;
|
|
391
|
+
const text = found.toString("utf8");
|
|
392
|
+
const directory = lstatSync(path, { bigint: true });
|
|
393
|
+
const origin = `# Orbit generated cache v1: ${directory.dev}:${directory.ino}`;
|
|
394
|
+
return text.startsWith("Signature: 8a477f597d28d172789f06886806bc55") && text.split(/\r?\n/u).includes(origin);
|
|
395
|
+
} catch {
|
|
396
|
+
return false;
|
|
397
|
+
} finally {
|
|
398
|
+
if (descriptor !== undefined) closeSync(descriptor);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
function sourceInCache(path, device, budget, depth = 0) {
|
|
403
|
+
if (depth > 128 || --budget.remaining < 0) return true;
|
|
404
|
+
const entries = readdirSync(path, { withFileTypes: true });
|
|
405
|
+
const protectedNames = new Set([".git", ".hg", ".svn", "logs", "_logs", "results", ".agents", ".aws", ".codex", ".claude"]);
|
|
406
|
+
if (entries.some((entry) => protectedNames.has(entry.name) || entry.name.endsWith(".log"))) return true;
|
|
407
|
+
if (entries.some((entry) => entry.name === "HEAD") && entries.some((entry) => ["objects", "refs", "reftable", "packed-refs", "commondir", "config"].includes(entry.name))) return true;
|
|
408
|
+
for (const entry of entries) {
|
|
409
|
+
if (--budget.remaining < 0) return true;
|
|
410
|
+
const child = join(path, entry.name);
|
|
411
|
+
const info = lstatSync(child, { bigint: true });
|
|
412
|
+
if (info.dev !== device || info.uid !== BigInt(process.getuid())) return true;
|
|
413
|
+
if (info.isDirectory() && sourceInCache(child, device, budget, depth + 1)) return true;
|
|
414
|
+
if (!info.isDirectory() && !info.isFile() && !info.isSymbolicLink() && !info.isFIFO() && !info.isSocket()) return true;
|
|
415
|
+
}
|
|
416
|
+
return false;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
function disposableCache(job, path) {
|
|
420
|
+
if (!safeLocalPath(job, path) || !cacheDeclaration(path)) return false;
|
|
421
|
+
try {
|
|
422
|
+
const before = lstatSync(path, { bigint: true });
|
|
423
|
+
if (!before.isDirectory() || before.isSymbolicLink() || before.uid !== BigInt(process.getuid())) return false;
|
|
424
|
+
if (sourceInCache(path, before.dev, { remaining: 2_000_000 })) return false;
|
|
425
|
+
const after = lstatSync(path, { bigint: true });
|
|
426
|
+
return after.isDirectory() && after.ino === before.ino && after.dev === before.dev && safeLocalPath(job, path);
|
|
427
|
+
} catch {
|
|
428
|
+
return false;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
|
|
286
432
|
export function rebuildableFolders(top) {
|
|
287
433
|
const job = jobRoot(top);
|
|
288
434
|
if (!job) return null;
|
|
@@ -296,14 +442,17 @@ export function rebuildableFolders(top) {
|
|
|
296
442
|
for (const output of PACKAGE_OUTPUTS) folders.add(join(checkout, dir, output));
|
|
297
443
|
}
|
|
298
444
|
for (const output of ["packages/templates/src/generated", "packages/plugin-build/src/generated"]) folders.add(join(checkout, output));
|
|
299
|
-
const sourceFiles = must(top, "ls-files", "-z")
|
|
445
|
+
const sourceFiles = must(top, "ls-files", "--cached", "--others", "--exclude-standard", "-z")
|
|
300
446
|
.split("\0")
|
|
301
447
|
.filter(Boolean)
|
|
302
448
|
.map((file) => join(checkout, file));
|
|
449
|
+
const retained = retainedPaths(top, []);
|
|
303
450
|
return {
|
|
304
451
|
job,
|
|
305
452
|
folders: [...folders]
|
|
306
|
-
.filter((folder) =>
|
|
453
|
+
.filter((folder) => !sourceFiles.some((file) => file === folder || file.startsWith(`${folder}/`)))
|
|
454
|
+
.filter((folder) => !retained.some((saved) => pathsOverlap(join(job, folder), saved)))
|
|
455
|
+
.filter((folder) => disposableCache(job, join(job, folder)))
|
|
307
456
|
.sort(),
|
|
308
457
|
};
|
|
309
458
|
}
|
|
@@ -467,7 +616,7 @@ export function cleanupBuildOutputs(top, keep = []) {
|
|
|
467
616
|
const removed = [];
|
|
468
617
|
for (const folder of found.folders) {
|
|
469
618
|
const path = join(found.job, folder);
|
|
470
|
-
if (!existsSync(path) || !
|
|
619
|
+
if (!existsSync(path) || !disposableCache(found.job, path)) continue;
|
|
471
620
|
if (protectedFiles.some((saved) => pathsOverlap(path, saved))) continue;
|
|
472
621
|
rmSync(path, { recursive: true, force: true });
|
|
473
622
|
removed.push(folder);
|