@adea-ai/app-framework 0.36.1 → 0.37.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.
- package/README.md +2 -0
- package/dist/appearance/appearance-host.js +2 -1
- package/dist/appearance/custom-theme-import.js +3 -1
- package/dist/appearance/custom-theme-library.d.ts +6 -185
- package/dist/appearance/custom-theme-library.js +3 -621
- package/dist/appearance/theme-library-mutation.d.ts +42 -0
- package/dist/appearance/theme-library-mutation.js +172 -0
- package/dist/appearance/theme-library-schema.d.ts +108 -0
- package/dist/appearance/theme-library-schema.js +189 -0
- package/dist/appearance/theme-library-store.d.ts +61 -0
- package/dist/appearance/theme-library-store.js +268 -0
- package/dist/appearance/theme-record-adapter.js +3 -1
- package/dist/appearance/theme-registry.js +2 -1
- package/dist/appearance/window-surface.d.ts +19 -0
- package/dist/appearance/window-surface.js +68 -1
- package/dist/cli/update-helper-cli.js +1 -1
- package/dist/cli/windows-installer-build-cli.d.ts +2 -0
- package/dist/cli/windows-installer-build-cli.js +14 -0
- package/dist/desktop/desktop-client.d.ts +1 -1
- package/dist/framework-source.json +1 -1
- package/dist/installer/installed-payload.js +2 -2
- package/dist/installer/{installer-archive.js → installer-archive-members.js} +2 -2
- package/dist/installer/installer-extraction.js +2 -2
- package/dist/installer/installer-fetch-guard.d.ts +1 -1
- package/dist/installer/installer-identity.js +2 -2
- package/dist/installer/installer-observation.d.ts +1 -1
- package/dist/installer/installer-observation.js +2 -2
- package/dist/installer/installer-upgrade-command.d.ts +2 -2
- package/dist/installer/installer-upgrade-command.js +5 -5
- package/dist/installer/linux-process-group.js +1 -1
- package/dist/installer/upgrade-asset-download.d.ts +1 -1
- package/dist/installer/upgrade-asset-download.js +2 -2
- package/dist/native/installer-archive.d.ts +42 -0
- package/dist/native/installer-archive.js +172 -0
- package/dist/native/posix-tree-removal.d.ts +1 -1
- package/dist/native/window-surface-store.d.ts +16 -0
- package/dist/native/window-surface-store.js +69 -0
- package/dist/native/windows-extractor-build.d.ts +95 -0
- package/dist/native/windows-extractor-build.js +326 -0
- package/dist/release/feed-release-cut.d.ts +1 -1
- package/dist/release/feed-state.d.ts +2 -2
- package/dist/release/feed-state.js +3 -3
- package/dist/release/github-release-cut.js +1 -1
- package/dist/release/github-release-promotion.js +1 -1
- package/dist/release/github-release-publisher.js +1 -1
- package/dist/release/github-release-qualification.js +1 -1
- package/dist/release/local-release.d.ts +2 -2
- package/dist/release/local-release.js +3 -3
- package/dist/release/release-artifact.d.ts +1 -1
- package/dist/release/release-artifact.js +2 -2
- package/dist/release/release-assets-plan.js +1 -1
- package/dist/release/release-config.d.ts +1 -1
- package/dist/release/release-config.js +1 -1
- package/dist/release/release-descriptor-staging.js +3 -3
- package/dist/release/release-finalize.js +1 -1
- package/dist/release/release-promotion.js +1 -1
- package/dist/release/release-publication.d.ts +1 -1
- package/dist/release/release-publication.js +2 -2
- package/dist/release/release-publish-command.js +2 -2
- package/dist/update-helper.bundle.js +18 -18
- package/dist/updates/channel-update-manager.d.ts +3 -3
- package/dist/updates/channel-update-manager.js +2 -2
- package/dist/updates/desktop-updater.d.ts +10 -83
- package/dist/updates/desktop-updater.js +14 -217
- package/dist/updates/{packaged-release-config.js → feed/packaged-release-config.js} +5 -5
- package/dist/updates/{release-feed.js → feed/release-feed.js} +2 -2
- package/dist/updates/{release-location.js → feed/release-location.js} +2 -2
- package/dist/updates/{release-version.js → feed/release-version.js} +1 -1
- package/dist/updates/{signed-release.js → feed/signed-release.js} +2 -2
- package/dist/updates/{update-discovery.js → feed/update-discovery.js} +1 -1
- package/dist/updates/helper/launch-gate-recovery.d.ts +8 -0
- package/dist/updates/{update-resume.js → helper/launch-gate-recovery.js} +13 -423
- package/dist/updates/helper/resume-staging.d.ts +22 -0
- package/dist/updates/helper/resume-staging.js +180 -0
- package/dist/updates/{update-helper.d.ts → helper/update-helper.d.ts} +1 -1
- package/dist/updates/{update-helper.js → helper/update-helper.js} +9 -9
- package/dist/updates/{update-resume.d.ts → helper/update-resume.d.ts} +4 -10
- package/dist/updates/helper/update-resume.js +252 -0
- package/dist/updates/{update-shutdown.js → helper/update-shutdown.js} +2 -2
- package/dist/updates/{update-arm.d.ts → install/update-arm.d.ts} +2 -2
- package/dist/updates/{update-arm.js → install/update-arm.js} +9 -9
- package/dist/updates/{update-download-cleanup.d.ts → install/update-download-cleanup.d.ts} +1 -1
- package/dist/updates/{update-download-cleanup.js → install/update-download-cleanup.js} +3 -3
- package/dist/updates/{update-download.d.ts → install/update-download.d.ts} +2 -2
- package/dist/updates/{update-download.js → install/update-download.js} +3 -3
- package/dist/updates/{update-extraction.d.ts → install/update-extraction.d.ts} +2 -2
- package/dist/updates/{update-extraction.js → install/update-extraction.js} +6 -6
- package/dist/updates/{update-handoff-plan.d.ts → install/update-handoff-plan.d.ts} +2 -2
- package/dist/updates/{update-handoff-plan.js → install/update-handoff-plan.js} +5 -5
- package/dist/updates/{update-marker.js → install/update-marker.js} +2 -2
- package/dist/updates/{update-swap-stage.d.ts → install/update-swap-stage.d.ts} +2 -2
- package/dist/updates/{update-swap-stage.js → install/update-swap-stage.js} +7 -6
- package/dist/updates/{update-swap.d.ts → install/update-swap.d.ts} +1 -1
- package/dist/updates/{update-swap.js → install/update-swap.js} +5 -5
- package/dist/updates/install-target.d.ts +8 -0
- package/dist/updates/install-target.js +27 -0
- package/dist/updates/{launch-environment.js → launch/launch-environment.js} +1 -1
- package/dist/updates/{packaged-launch-admission.js → launch/packaged-launch-admission.js} +4 -4
- package/dist/updates/{packaged-update-startup.d.ts → launch/packaged-update-startup.d.ts} +3 -3
- package/dist/updates/{packaged-update-startup.js → launch/packaged-update-startup.js} +10 -7
- package/dist/updates/{update-launch-gate.d.ts → launch/update-launch-gate.d.ts} +1 -1
- package/dist/updates/{update-launch-gate.js → launch/update-launch-gate.js} +9 -9
- package/dist/updates/{update-launch.d.ts → launch/update-launch.d.ts} +1 -1
- package/dist/updates/{update-launch.js → launch/update-launch.js} +2 -2
- package/dist/updates/{linux-process-state.js → locks/linux-process-state.js} +1 -1
- package/dist/updates/{native-file-lock.js → locks/native-file-lock.js} +1 -1
- package/dist/updates/{stable-file.js → locks/stable-file.js} +2 -2
- package/dist/updates/{update-download-lock.js → locks/update-download-lock.js} +1 -1
- package/dist/updates/{update-generation-lease.js → locks/update-generation-lease.js} +3 -3
- package/dist/updates/{update-inherited-launch-lease.d.ts → locks/update-inherited-launch-lease.d.ts} +1 -1
- package/dist/updates/{update-inherited-launch-lease.js → locks/update-inherited-launch-lease.js} +2 -2
- package/dist/updates/{update-instance-lease.js → locks/update-instance-lease.js} +2 -2
- package/dist/updates/{update-lock.js → locks/update-lock.js} +2 -2
- package/dist/updates/{update-process-fence.js → locks/update-process-fence.js} +3 -3
- package/dist/updates/{update-process-liveness.js → locks/update-process-liveness.js} +2 -2
- package/dist/updates/retained-client-assets.d.ts +60 -0
- package/dist/updates/retained-client-assets.js +116 -0
- package/dist/updates/retention/retention-cleanup.d.ts +103 -0
- package/dist/updates/retention/retention-cleanup.js +439 -0
- package/dist/updates/retention/retention-prune-progress.d.ts +27 -0
- package/dist/updates/retention/retention-prune-progress.js +203 -0
- package/dist/updates/retention/retirement-inventory.d.ts +93 -0
- package/dist/updates/retention/retirement-inventory.js +373 -0
- package/dist/updates/retention/retirement-records.d.ts +75 -0
- package/dist/updates/retention/retirement-records.js +309 -0
- package/dist/updates/{update-retention-marker.d.ts → retention/update-retention-marker.d.ts} +1 -1
- package/dist/updates/{update-retention-marker.js → retention/update-retention-marker.js} +3 -3
- package/dist/updates/{update-retention-plan.d.ts → retention/update-retention-plan.d.ts} +1 -1
- package/dist/updates/{update-retention-plan.js → retention/update-retention-plan.js} +2 -2
- package/dist/updates/{update-retention-sync.d.ts → retention/update-retention-sync.d.ts} +1 -1
- package/dist/updates/{update-retention-sync.js → retention/update-retention-sync.js} +2 -2
- package/dist/updates/retention/update-retirement.d.ts +26 -0
- package/dist/updates/retention/update-retirement.js +205 -0
- package/dist/updates/update-adapter.js +1 -1
- package/dist/updates/update-channel-store.d.ts +1 -1
- package/dist/updates/update-channel-store.js +2 -2
- package/dist/updates/update-manager.d.ts +4 -4
- package/dist/updates/update-manager.js +5 -5
- package/dist/updates/update-services.d.ts +15 -0
- package/dist/updates/update-services.js +77 -0
- package/dist/updates/update-state-store.d.ts +2 -2
- package/dist/updates/update-state-store.js +2 -2
- package/dist/views/appearance-surface.js +3 -1
- package/package.json +42 -29
- package/src/appearance/custom-theme-library.ts +42 -956
- package/src/appearance/theme-library-mutation.ts +288 -0
- package/src/appearance/theme-library-schema.ts +347 -0
- package/src/appearance/theme-library-store.ts +379 -0
- package/src/appearance/window-surface.ts +91 -5
- package/src/updates/update-adapter.ts +1 -1
- package/templates/application/src/bun/index.ts +15 -0
- package/templates/application/src/web/main.tsx +13 -1
- package/dist/updates/update-retirement.d.ts +0 -205
- package/dist/updates/update-retirement.js +0 -1485
- /package/dist/installer/{installer-archive.d.ts → installer-archive-members.d.ts} +0 -0
- /package/dist/updates/{packaged-release-config.d.ts → feed/packaged-release-config.d.ts} +0 -0
- /package/dist/updates/{release-feed.d.ts → feed/release-feed.d.ts} +0 -0
- /package/dist/updates/{release-location.d.ts → feed/release-location.d.ts} +0 -0
- /package/dist/updates/{release-version.d.ts → feed/release-version.d.ts} +0 -0
- /package/dist/updates/{signed-release.d.ts → feed/signed-release.d.ts} +0 -0
- /package/dist/updates/{update-discovery.d.ts → feed/update-discovery.d.ts} +0 -0
- /package/dist/updates/{update-shutdown.d.ts → helper/update-shutdown.d.ts} +0 -0
- /package/dist/updates/{update-marker.d.ts → install/update-marker.d.ts} +0 -0
- /package/dist/updates/{launch-environment.d.ts → launch/launch-environment.d.ts} +0 -0
- /package/dist/updates/{packaged-launch-admission.d.ts → launch/packaged-launch-admission.d.ts} +0 -0
- /package/dist/updates/{linux-process-state.d.ts → locks/linux-process-state.d.ts} +0 -0
- /package/dist/updates/{native-file-lock.d.ts → locks/native-file-lock.d.ts} +0 -0
- /package/dist/updates/{stable-file.d.ts → locks/stable-file.d.ts} +0 -0
- /package/dist/updates/{update-download-lock.d.ts → locks/update-download-lock.d.ts} +0 -0
- /package/dist/updates/{update-generation-lease.d.ts → locks/update-generation-lease.d.ts} +0 -0
- /package/dist/updates/{update-instance-lease.d.ts → locks/update-instance-lease.d.ts} +0 -0
- /package/dist/updates/{update-lock.d.ts → locks/update-lock.d.ts} +0 -0
- /package/dist/updates/{update-process-fence.d.ts → locks/update-process-fence.d.ts} +0 -0
- /package/dist/updates/{update-process-liveness.d.ts → locks/update-process-liveness.d.ts} +0 -0
- /package/src/updates/{release-version.ts → feed/release-version.ts} +0 -0
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import { toUiVariant } from "./theme-library-schema.js";
|
|
2
|
+
import { defaultPreferenceStorage, quarantineRecord } from "@adea-ai/ui/lib/preference-store";
|
|
3
|
+
// src/appearance/theme-library-store.ts
|
|
4
|
+
var CUSTOM_THEME_LIBRARY_STORAGE_KEY = "appearance.library";
|
|
5
|
+
/**
|
|
6
|
+
* Where an unreadable library is quarantined. It is its own key: the library and
|
|
7
|
+
* the appearance preference used to share `appearance.recovery`, so one could
|
|
8
|
+
* overwrite the other's capture.
|
|
9
|
+
*/
|
|
10
|
+
var CUSTOM_THEME_LIBRARY_RECOVERY_KEY = "appearance.library.recovery";
|
|
11
|
+
var CUSTOM_THEME_LIBRARY_VERSION = 1;
|
|
12
|
+
var CUSTOM_THEME_ID_PREFIX = "custom-";
|
|
13
|
+
var libraryHost = globalThis;
|
|
14
|
+
function library() {
|
|
15
|
+
const existing = libraryHost.__ADEA_THEME_LIBRARY__;
|
|
16
|
+
if (existing && Array.isArray(existing.themes) && existing.listeners) return existing;
|
|
17
|
+
const created = {
|
|
18
|
+
themes: [],
|
|
19
|
+
listeners: existing?.listeners ?? /* @__PURE__ */ new Set(),
|
|
20
|
+
atomicMutationDepth: 0
|
|
21
|
+
};
|
|
22
|
+
libraryHost.__ADEA_THEME_LIBRARY__ = created;
|
|
23
|
+
return created;
|
|
24
|
+
}
|
|
25
|
+
function replaceThemes(themes) {
|
|
26
|
+
const state = library();
|
|
27
|
+
state.themes = Object.freeze([...themes]);
|
|
28
|
+
state.uiVariants = void 0;
|
|
29
|
+
}
|
|
30
|
+
/** The imported themes' stored variants, in import order. */
|
|
31
|
+
function customThemeVariants() {
|
|
32
|
+
return library().themes.map((theme) => theme.variant);
|
|
33
|
+
}
|
|
34
|
+
/** Find one stored variant without projecting the rest of the imported library. */
|
|
35
|
+
function customThemeVariantById(id) {
|
|
36
|
+
return library().themes.find((theme) => theme.variant.id === id)?.variant;
|
|
37
|
+
}
|
|
38
|
+
/** The imported themes as shared-provider variants: what the provider's `themes` takes. */
|
|
39
|
+
function customUiVariants() {
|
|
40
|
+
const state = library();
|
|
41
|
+
state.uiVariants ??= Object.freeze(state.themes.map(toUiVariant));
|
|
42
|
+
return state.uiVariants;
|
|
43
|
+
}
|
|
44
|
+
function handlePersistentLibraryChange(event) {
|
|
45
|
+
if (event.key !== "appearance.library" && event.key !== null) return;
|
|
46
|
+
const storage = defaultPreferenceStorage();
|
|
47
|
+
if (!storage || event.storageArea !== storage) return;
|
|
48
|
+
readCustomThemeLibrary(storage);
|
|
49
|
+
}
|
|
50
|
+
function observePersistentLibraryChanges() {
|
|
51
|
+
const state = library();
|
|
52
|
+
if (state.storageEventTarget || typeof window === "undefined") return;
|
|
53
|
+
const target = window;
|
|
54
|
+
const listener = handlePersistentLibraryChange;
|
|
55
|
+
state.storageEventTarget = target;
|
|
56
|
+
state.storageEventListener = listener;
|
|
57
|
+
target.addEventListener("storage", listener);
|
|
58
|
+
}
|
|
59
|
+
function subscribeCustomThemes(listener) {
|
|
60
|
+
observePersistentLibraryChanges();
|
|
61
|
+
const { listeners } = library();
|
|
62
|
+
listeners.add(listener);
|
|
63
|
+
return () => listeners.delete(listener);
|
|
64
|
+
}
|
|
65
|
+
function notifyCustomThemes() {
|
|
66
|
+
const { listeners } = library();
|
|
67
|
+
for (const listener of [...listeners]) {
|
|
68
|
+
if (!listeners.has(listener)) continue;
|
|
69
|
+
try {
|
|
70
|
+
Promise.resolve(listener()).catch(() => {});
|
|
71
|
+
} catch {}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function isCustomThemeId(id) {
|
|
75
|
+
return id.startsWith(CUSTOM_THEME_ID_PREFIX);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Replace the in-memory imported-theme set and tell subscribers. Durable mutations
|
|
79
|
+
* must use `mutateCustomThemeLibrary`; this deprecated synchronous API fails closed
|
|
80
|
+
* when a storage adapter is supplied because it cannot acquire the shared lock.
|
|
81
|
+
*
|
|
82
|
+
* @deprecated Use `mutateCustomThemeLibrary` for persisted read/modify/write operations.
|
|
83
|
+
*/
|
|
84
|
+
function setCustomThemes(themes, storage) {
|
|
85
|
+
if ((library().atomicMutationDepth ?? 0) > 0) return false;
|
|
86
|
+
if (storage) return false;
|
|
87
|
+
replaceThemes(namespaceCustomThemes(themes));
|
|
88
|
+
notifyCustomThemes();
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
function namespaceCustomThemes(themes) {
|
|
92
|
+
return themes.map((theme) => {
|
|
93
|
+
if (isCustomThemeId(theme.id)) return theme;
|
|
94
|
+
const id = `${CUSTOM_THEME_ID_PREFIX}${theme.id}`;
|
|
95
|
+
return {
|
|
96
|
+
...theme,
|
|
97
|
+
id,
|
|
98
|
+
variant: {
|
|
99
|
+
...theme.variant,
|
|
100
|
+
id
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
var object = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
106
|
+
var fields = (value, names) => object(value) && names.every((name) => typeof value[name] === "string");
|
|
107
|
+
function isStoredTheme(entry) {
|
|
108
|
+
if (!object(entry) || !object(entry.variant)) return false;
|
|
109
|
+
const theme = entry;
|
|
110
|
+
const variant = entry.variant;
|
|
111
|
+
return typeof theme.id === "string" && typeof theme.name === "string" && (theme.appearance === "light" || theme.appearance === "dark") && typeof theme.importedAt === "string" && fields(variant, [
|
|
112
|
+
"id",
|
|
113
|
+
"familyId",
|
|
114
|
+
"familyName",
|
|
115
|
+
"name"
|
|
116
|
+
]) && (variant.appearance === "light" || variant.appearance === "dark") && fields(variant.colors, [
|
|
117
|
+
"background",
|
|
118
|
+
"foreground",
|
|
119
|
+
"card",
|
|
120
|
+
"cardForeground",
|
|
121
|
+
"popover",
|
|
122
|
+
"popoverForeground",
|
|
123
|
+
"primary",
|
|
124
|
+
"primaryForeground",
|
|
125
|
+
"secondary",
|
|
126
|
+
"secondaryForeground",
|
|
127
|
+
"muted",
|
|
128
|
+
"mutedForeground",
|
|
129
|
+
"accent",
|
|
130
|
+
"accentForeground",
|
|
131
|
+
"destructive",
|
|
132
|
+
"destructiveAction",
|
|
133
|
+
"destructiveActionForeground",
|
|
134
|
+
"success",
|
|
135
|
+
"border",
|
|
136
|
+
"input",
|
|
137
|
+
"ring"
|
|
138
|
+
]) && fields(variant.terminal, [
|
|
139
|
+
"background",
|
|
140
|
+
"foreground",
|
|
141
|
+
"cursor",
|
|
142
|
+
"selection"
|
|
143
|
+
]) && object(variant.terminal) && Array.isArray(variant.terminal.ansi) && variant.terminal.ansi.length === 16 && variant.terminal.ansi.every((color) => typeof color === "string") && fields(variant.editor, [
|
|
144
|
+
"keyword",
|
|
145
|
+
"string",
|
|
146
|
+
"number",
|
|
147
|
+
"comment",
|
|
148
|
+
"function",
|
|
149
|
+
"variable",
|
|
150
|
+
"type",
|
|
151
|
+
"tag",
|
|
152
|
+
"attribute",
|
|
153
|
+
"operator",
|
|
154
|
+
"heading",
|
|
155
|
+
"link",
|
|
156
|
+
"diffAdd",
|
|
157
|
+
"diffDelete",
|
|
158
|
+
"diffHunk",
|
|
159
|
+
"searchMatch"
|
|
160
|
+
]) && fields(variant.charts, [
|
|
161
|
+
"chart1",
|
|
162
|
+
"chart2",
|
|
163
|
+
"chart3",
|
|
164
|
+
"chart4",
|
|
165
|
+
"chart5",
|
|
166
|
+
"chart6"
|
|
167
|
+
]) && object(theme.flatTokens) && Object.values(theme.flatTokens).every((value) => typeof value === "string") && Array.isArray(theme.notes) && theme.notes.every((note) => typeof note === "string");
|
|
168
|
+
}
|
|
169
|
+
function parseLibrary(raw) {
|
|
170
|
+
let value;
|
|
171
|
+
try {
|
|
172
|
+
value = JSON.parse(raw);
|
|
173
|
+
} catch {
|
|
174
|
+
return {
|
|
175
|
+
themes: [],
|
|
176
|
+
reason: "corrupt_json"
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
if (!object(value) || value.version !== 1 || !Array.isArray(value.themes)) return {
|
|
180
|
+
themes: [],
|
|
181
|
+
reason: "unsupported_record"
|
|
182
|
+
};
|
|
183
|
+
const themes = value.themes.filter(isStoredTheme);
|
|
184
|
+
return themes.length === value.themes.length ? { themes } : {
|
|
185
|
+
themes,
|
|
186
|
+
reason: "unsupported_record"
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
function preserveLibrary(storage, raw, reason) {
|
|
190
|
+
if (!storage.getItem("appearance.library.recovery")) quarantineRecord(storage, CUSTOM_THEME_LIBRARY_RECOVERY_KEY, raw, reason);
|
|
191
|
+
const saved = storage.getItem(CUSTOM_THEME_LIBRARY_RECOVERY_KEY);
|
|
192
|
+
try {
|
|
193
|
+
const capture = saved && JSON.parse(saved);
|
|
194
|
+
return object(capture) && capture.schemaVersion === 1 && capture.raw === raw;
|
|
195
|
+
} catch {
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Read the stored library. A malformed document starts an empty library and
|
|
201
|
+
* quarantines the raw bytes into the library's own recovery key, mirroring the
|
|
202
|
+
* appearance-preference recovery contract; individual invalid records are dropped,
|
|
203
|
+
* not fatal.
|
|
204
|
+
*/
|
|
205
|
+
function readCustomThemeLibrary(storage) {
|
|
206
|
+
if (!storage) return [];
|
|
207
|
+
const result = tryReadCustomThemeLibrary(storage);
|
|
208
|
+
if (result?.changed) notifyCustomThemes();
|
|
209
|
+
return result?.themes ?? [];
|
|
210
|
+
}
|
|
211
|
+
function sameThemeValue(left, right) {
|
|
212
|
+
if (Object.is(left, right)) return true;
|
|
213
|
+
if (!left || !right || typeof left !== "object" || typeof right !== "object") return false;
|
|
214
|
+
if (Array.isArray(left) || Array.isArray(right)) {
|
|
215
|
+
if (!Array.isArray(left) || !Array.isArray(right) || left.length !== right.length) return false;
|
|
216
|
+
if (Object.getPrototypeOf(left) !== Array.prototype) return false;
|
|
217
|
+
if (Reflect.ownKeys(left).length !== left.length + 1) return false;
|
|
218
|
+
for (let index = 0; index < left.length; index++) {
|
|
219
|
+
const entry = Object.getOwnPropertyDescriptor(left, index);
|
|
220
|
+
if (!entry || !entry.enumerable || !("value" in entry)) return false;
|
|
221
|
+
if (!sameThemeValue(entry.value, right[index])) return false;
|
|
222
|
+
}
|
|
223
|
+
return true;
|
|
224
|
+
}
|
|
225
|
+
if (Object.getPrototypeOf(left) !== Object.prototype) return false;
|
|
226
|
+
const leftKeys = Object.keys(left);
|
|
227
|
+
const rightKeys = Object.keys(right);
|
|
228
|
+
if (leftKeys.length !== rightKeys.length || Reflect.ownKeys(left).length !== leftKeys.length) return false;
|
|
229
|
+
const rightRecord = right;
|
|
230
|
+
return leftKeys.every((key) => {
|
|
231
|
+
const entry = Object.getOwnPropertyDescriptor(left, key);
|
|
232
|
+
return !!entry && "value" in entry && Object.hasOwn(rightRecord, key) && sameThemeValue(entry.value, rightRecord[key]);
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
/** A failed read must not be confused with a successfully read empty library. */
|
|
236
|
+
function tryReadCustomThemeLibrary(storage) {
|
|
237
|
+
const state = library();
|
|
238
|
+
const previousThemes = state.themes;
|
|
239
|
+
try {
|
|
240
|
+
const raw = storage.getItem(CUSTOM_THEME_LIBRARY_STORAGE_KEY);
|
|
241
|
+
const { themes, reason } = raw ? parseLibrary(raw) : { themes: [] };
|
|
242
|
+
if (raw && reason) preserveLibrary(storage, raw, reason);
|
|
243
|
+
let changed = true;
|
|
244
|
+
try {
|
|
245
|
+
changed = !sameThemeValue(previousThemes, themes);
|
|
246
|
+
} catch {}
|
|
247
|
+
if (storage.getItem("appearance.library") !== raw || library() !== state || state.themes !== previousThemes) return void 0;
|
|
248
|
+
if (changed) replaceThemes(themes);
|
|
249
|
+
return {
|
|
250
|
+
themes: changed ? themes : previousThemes,
|
|
251
|
+
changed
|
|
252
|
+
};
|
|
253
|
+
} catch {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Synchronous legacy removal for the in-memory library. Passing storage fails closed;
|
|
259
|
+
* use `removeCustomThemeAtomically` for persisted removals.
|
|
260
|
+
*
|
|
261
|
+
* @deprecated Use `removeCustomThemeAtomically` for persisted removals.
|
|
262
|
+
*/
|
|
263
|
+
function removeCustomTheme(id, storage) {
|
|
264
|
+
if (storage) return false;
|
|
265
|
+
const themes = library().themes;
|
|
266
|
+
return setCustomThemes(themes.filter((theme) => theme.id !== id), storage);
|
|
267
|
+
}
|
|
268
|
+
export { CUSTOM_THEME_LIBRARY_RECOVERY_KEY, CUSTOM_THEME_LIBRARY_STORAGE_KEY, CUSTOM_THEME_LIBRARY_VERSION, customThemeVariantById, customThemeVariants, customUiVariants, library, namespaceCustomThemes, notifyCustomThemes, parseLibrary, preserveLibrary, readCustomThemeLibrary, removeCustomTheme, replaceThemes, setCustomThemes, subscribeCustomThemes };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import "./appearance-preferences.js";
|
|
2
|
-
import {
|
|
2
|
+
import { storedVariantRecord } from "./theme-library-schema.js";
|
|
3
|
+
import { customThemeVariantById, customThemeVariants } from "./theme-library-store.js";
|
|
4
|
+
import "./custom-theme-library.js";
|
|
3
5
|
import { themeRegistry } from "./theme-registry.js";
|
|
4
6
|
import { accentRolesForSelection, themeRecordById, themeRecords, tokensAsHex } from "@adea-ai/ui/lib/themes";
|
|
5
7
|
import { getAccent } from "@adea-ai/ui/lib/accent-presets";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { customUiVariants } from "./
|
|
1
|
+
import { customUiVariants } from "./theme-library-store.js";
|
|
2
|
+
import "./custom-theme-library.js";
|
|
2
3
|
import { builtinThemes } from "@adea-ai/ui/lib/themes";
|
|
3
4
|
// src/appearance/theme-registry.ts
|
|
4
5
|
var registriesByCustomVariants = /* @__PURE__ */ new WeakMap();
|
|
@@ -2,4 +2,23 @@ export type WindowSurface = 'theme' | 'frosted' | 'opaque';
|
|
|
2
2
|
type WindowSurfaceMirror = (surface: WindowSurface) => void;
|
|
3
3
|
export declare function registerWindowSurfaceMirror(next: WindowSurfaceMirror): void;
|
|
4
4
|
export declare function mirrorWindowSurface(surface: WindowSurface): void;
|
|
5
|
+
/**
|
|
6
|
+
* A mirror that retries a failed update once after `retryDelayMs`, never replaying a choice a
|
|
7
|
+
* newer one superseded. `whenSettled` runs before a retry (for example, until an uncertain
|
|
8
|
+
* write is fenced); `onFailure` hears about a mirror that still failed and may retry it later.
|
|
9
|
+
*/
|
|
10
|
+
export declare function createWindowSurfaceMirror(update: (surface: WindowSurface) => Promise<void>, options?: {
|
|
11
|
+
retryDelayMs?: number;
|
|
12
|
+
whenSettled?: () => Promise<void>;
|
|
13
|
+
onFailure?: (surface: WindowSurface, retry: () => void) => void;
|
|
14
|
+
}): WindowSurfaceMirror;
|
|
15
|
+
/**
|
|
16
|
+
* The update `createWindowSurfaceMirror` needs, through the framework `shell.window-surface`
|
|
17
|
+
* service. The host persists every request it receives, so requests go out one at a time: a
|
|
18
|
+
* newer choice waits for the request in flight, and a choice superseded while it waits is never
|
|
19
|
+
* sent. The last write to reach the store is always the latest choice.
|
|
20
|
+
*/
|
|
21
|
+
export declare function desktopWindowSurfaceUpdate(invoke: (name: string, input: unknown) => Promise<{
|
|
22
|
+
ok: boolean;
|
|
23
|
+
}>): (surface: WindowSurface) => Promise<void>;
|
|
5
24
|
export {};
|
|
@@ -6,4 +6,71 @@ function registerWindowSurfaceMirror(next) {
|
|
|
6
6
|
function mirrorWindowSurface(surface) {
|
|
7
7
|
mirror?.(surface);
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* A mirror that retries a failed update once after `retryDelayMs`, never replaying a choice a
|
|
11
|
+
* newer one superseded. `whenSettled` runs before a retry (for example, until an uncertain
|
|
12
|
+
* write is fenced); `onFailure` hears about a mirror that still failed and may retry it later.
|
|
13
|
+
*/
|
|
14
|
+
function createWindowSurfaceMirror(update, options = {}) {
|
|
15
|
+
const retryDelayMs = options.retryDelayMs ?? 500;
|
|
16
|
+
const whenSettled = options.whenSettled ?? (() => Promise.resolve());
|
|
17
|
+
if (!Number.isSafeInteger(retryDelayMs) || retryDelayMs < 0 || retryDelayMs > 2147483647) throw new Error("Invalid window surface retry delay");
|
|
18
|
+
let generation = 0;
|
|
19
|
+
let retryTimer;
|
|
20
|
+
return (surface) => {
|
|
21
|
+
const mine = ++generation;
|
|
22
|
+
if (retryTimer !== void 0) clearTimeout(retryTimer);
|
|
23
|
+
retryTimer = void 0;
|
|
24
|
+
const afterSettled = (retry) => void Promise.resolve().then(whenSettled).then(() => {
|
|
25
|
+
if (mine === generation) attempt(retry);
|
|
26
|
+
}).catch(reportFailure);
|
|
27
|
+
const reportFailure = () => {
|
|
28
|
+
if (mine !== generation) return;
|
|
29
|
+
let used = false;
|
|
30
|
+
try {
|
|
31
|
+
options.onFailure?.(surface, () => {
|
|
32
|
+
if (used || mine !== generation) return;
|
|
33
|
+
used = true;
|
|
34
|
+
afterSettled(true);
|
|
35
|
+
});
|
|
36
|
+
} catch {}
|
|
37
|
+
};
|
|
38
|
+
const attempt = (retry) => {
|
|
39
|
+
let result;
|
|
40
|
+
try {
|
|
41
|
+
result = update(surface);
|
|
42
|
+
} catch (error) {
|
|
43
|
+
result = Promise.reject(error);
|
|
44
|
+
}
|
|
45
|
+
result.catch(() => {
|
|
46
|
+
if (mine !== generation) return;
|
|
47
|
+
if (!retry) return reportFailure();
|
|
48
|
+
retryTimer = setTimeout(() => {
|
|
49
|
+
retryTimer = void 0;
|
|
50
|
+
afterSettled(false);
|
|
51
|
+
}, retryDelayMs);
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
attempt(true);
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The update `createWindowSurfaceMirror` needs, through the framework `shell.window-surface`
|
|
59
|
+
* service. The host persists every request it receives, so requests go out one at a time: a
|
|
60
|
+
* newer choice waits for the request in flight, and a choice superseded while it waits is never
|
|
61
|
+
* sent. The last write to reach the store is always the latest choice.
|
|
62
|
+
*/
|
|
63
|
+
function desktopWindowSurfaceUpdate(invoke) {
|
|
64
|
+
let latest = 0;
|
|
65
|
+
let previous = Promise.resolve();
|
|
66
|
+
return (surface) => {
|
|
67
|
+
const mine = ++latest;
|
|
68
|
+
const request = previous.then(async () => {
|
|
69
|
+
if (mine !== latest) return;
|
|
70
|
+
if (!(await invoke("shell.window-surface", { surface })).ok) throw new Error("Unable to save the window surface");
|
|
71
|
+
});
|
|
72
|
+
previous = request.catch(() => void 0);
|
|
73
|
+
return request;
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
export { createWindowSurfaceMirror, desktopWindowSurfaceUpdate, mirrorWindowSurface, registerWindowSurfaceMirror };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import { redactedErrorMessage, runCli } from "./cli-runner.js";
|
|
3
|
+
import { buildPatchedWindowsInstaller } from "../native/windows-extractor-build.js";
|
|
4
|
+
import { resolve } from "node:path";
|
|
5
|
+
// src/cli/windows-installer-build-cli.ts
|
|
6
|
+
await runCli((error) => `Unable to build the patched Windows installer: ${redactedErrorMessage(error)}`, async () => {
|
|
7
|
+
const [appName, appRoot = ".", ...extra] = process.argv.slice(2);
|
|
8
|
+
if (!appName || extra.length) throw new Error("Expected an app name and optional app root");
|
|
9
|
+
const installer = await buildPatchedWindowsInstaller({
|
|
10
|
+
appName,
|
|
11
|
+
appRoot: resolve(appRoot)
|
|
12
|
+
});
|
|
13
|
+
process.stdout.write(`${installer}\n`);
|
|
14
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ServiceResult } from '../app/service-registry';
|
|
2
|
-
import type { FetchFunction } from '../updates/release-location';
|
|
2
|
+
import type { FetchFunction } from '../updates/feed/release-location';
|
|
3
3
|
type Bootstrap = (signal?: AbortSignal) => Promise<{
|
|
4
4
|
bootstrap: string;
|
|
5
5
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"0.
|
|
1
|
+
{"version":"0.37.1","commit":"bf77bd05ea8d9c9d143754b623909cf50bdc55d5"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { assertSidecarNames, sidecarBundlePath } from "../native/app-bundle.js";
|
|
2
2
|
import { runnerTemp } from "./hosted-runner.js";
|
|
3
3
|
import { assertBuildMetadata, assertInstallerContext, assertPayloadLayout, assertPortableAppName } from "./installer-layout.js";
|
|
4
|
-
import { hashFileAt } from "../updates/stable-file.js";
|
|
4
|
+
import { hashFileAt } from "../updates/locks/stable-file.js";
|
|
5
5
|
import { assertNativeExecutable } from "./native-executable.js";
|
|
6
|
-
import { assertArchiveUnchanged, findArchiveMember, isWithin } from "./installer-archive.js";
|
|
6
|
+
import { assertArchiveUnchanged, findArchiveMember, isWithin } from "./installer-archive-members.js";
|
|
7
7
|
import { lstat, open, realpath, rm } from "node:fs/promises";
|
|
8
8
|
import { join, resolve } from "node:path";
|
|
9
9
|
import { createHash } from "node:crypto";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { sameFile } from "../updates/stable-file.js";
|
|
1
|
+
import { sameFile } from "../updates/locks/stable-file.js";
|
|
2
2
|
import { assertNativeExecutable } from "./native-executable.js";
|
|
3
3
|
import { lstat, open } from "node:fs/promises";
|
|
4
4
|
import { isAbsolute, relative, sep } from "node:path";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
|
-
// src/installer/installer-archive.ts
|
|
6
|
+
// src/installer/installer-archive-members.ts
|
|
7
7
|
var EMBEDDED_ARCHIVE_MARKER = Buffer.from("ELECTROBUN_ARCHIVE_V1");
|
|
8
8
|
/** Whether `path` lies strictly inside `root`, judged lexically. */
|
|
9
9
|
function isWithin(root, path) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { runnerTemp } from "./hosted-runner.js";
|
|
2
2
|
import { assertInstallerContext, assertInstallerLayout, assertPortableAppName } from "./installer-layout.js";
|
|
3
|
-
import { hashFileAt } from "../updates/stable-file.js";
|
|
4
|
-
import { assertEmbeddedArchive, assertInstallerExecutable, extractArchiveMember, findArchiveMember, isWithin } from "./installer-archive.js";
|
|
3
|
+
import { hashFileAt } from "../updates/locks/stable-file.js";
|
|
4
|
+
import { assertEmbeddedArchive, assertInstallerExecutable, extractArchiveMember, findArchiveMember, isWithin } from "./installer-archive-members.js";
|
|
5
5
|
import { cleanupInstallerDirectoryAfterFailure, defaultInstallerImageMountIo, withInstallerImageRetries } from "./installer-image-mount.js";
|
|
6
6
|
import { runInstallerCommand } from "./installer-command.js";
|
|
7
7
|
import { verifyInstallerPayload } from "./installer-identity.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FetchFunction } from '../updates/release-location';
|
|
1
|
+
import type { FetchFunction } from '../updates/feed/release-location';
|
|
2
2
|
/** CI preflight only: block external fetches while recording unexpected activity.
|
|
3
3
|
* This does not intercept sockets, subprocesses, or webview networking. */
|
|
4
4
|
export declare function installInstallerFetchGuard(options: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { assertInstallerContext, assertInstallerHost, assertInstallerLayout, assertPortableAppName } from "./installer-layout.js";
|
|
2
|
-
import { hashFileAt } from "../updates/stable-file.js";
|
|
3
|
-
import { assertEmbeddedArchive, assertInstallerExecutable, extractArchiveMember, findArchiveMember, isWithin, normalizeArchiveMember } from "./installer-archive.js";
|
|
2
|
+
import { hashFileAt } from "../updates/locks/stable-file.js";
|
|
3
|
+
import { assertEmbeddedArchive, assertInstallerExecutable, extractArchiveMember, findArchiveMember, isWithin, normalizeArchiveMember } from "./installer-archive-members.js";
|
|
4
4
|
import { InstallerImageLifecycleError, cleanupInstallerDirectoryAfterFailure, defaultInstallerImageMountIo, installerImageMountState, withInstallerImageRetries } from "./installer-image-mount.js";
|
|
5
5
|
import { runInstallerCommand } from "./installer-command.js";
|
|
6
6
|
import { lstat, mkdtemp, readdir, realpath } from "node:fs/promises";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type InstallerPlatform, type InstallerRenderer } from './installer-layout';
|
|
2
2
|
import { type InstallerRendererObservation } from './installer-renderer-evidence';
|
|
3
3
|
import { type Artifact, type OfflinePolicy, type RendererEvidence } from '../release/release-qualification';
|
|
4
|
-
import type { ReleaseTrust, VerifiedRelease } from '../updates/signed-release';
|
|
4
|
+
import type { ReleaseTrust, VerifiedRelease } from '../updates/feed/signed-release';
|
|
5
5
|
/** Whether the runner should start the installed app on this loop iteration.
|
|
6
6
|
*
|
|
7
7
|
* Electrobun's Windows and Linux extractors (since 2.0.1, `launchInstalledApp` in
|
|
@@ -7,8 +7,8 @@ import { prepareInstallerExecution } from "./installer-extraction.js";
|
|
|
7
7
|
import { assertInstallerRendererObservation } from "./installer-renderer-evidence.js";
|
|
8
8
|
import { extractCandidateRuntime, verifyInstalledPayload } from "./installed-payload.js";
|
|
9
9
|
import { terminateGuardedWorker } from "./installer-process-cleanup.js";
|
|
10
|
-
import { swapUpdateTree } from "../updates/update-swap.js";
|
|
11
|
-
import { stageUpdateSwap } from "../updates/update-swap-stage.js";
|
|
10
|
+
import { swapUpdateTree } from "../updates/install/update-swap.js";
|
|
11
|
+
import { stageUpdateSwap } from "../updates/install/update-swap-stage.js";
|
|
12
12
|
import { chmod, lstat, mkdir, readFile, realpath, writeFile } from "node:fs/promises";
|
|
13
13
|
import { delimiter, dirname, join } from "node:path";
|
|
14
14
|
import { randomBytes } from "node:crypto";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { InstallerPlatform, InstallerRenderer } from './installer-layout';
|
|
2
2
|
import type { RendererEvidence } from '../release/release-qualification';
|
|
3
|
-
import type { FetchFunction } from '../updates/release-location';
|
|
4
|
-
import { type ReleaseDescriptor } from '../updates/signed-release';
|
|
3
|
+
import type { FetchFunction } from '../updates/feed/release-location';
|
|
4
|
+
import { type ReleaseDescriptor } from '../updates/feed/signed-release';
|
|
5
5
|
export type UpgradeReceipt = {
|
|
6
6
|
schema: 1;
|
|
7
7
|
tag: string;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { versionLessThan } from "../updates/release-version.js";
|
|
1
|
+
import { versionLessThan } from "../updates/feed/release-version.js";
|
|
2
2
|
import { errorCode, isRecord } from "../app/value-guards.js";
|
|
3
|
-
import { verifyReleaseDescriptor } from "../updates/signed-release.js";
|
|
4
|
-
import { feedUrl } from "../updates/release-feed.js";
|
|
3
|
+
import { verifyReleaseDescriptor } from "../updates/feed/signed-release.js";
|
|
4
|
+
import { feedUrl } from "../updates/feed/release-feed.js";
|
|
5
5
|
import { parseReleaseConfig } from "../release/release-config.js";
|
|
6
6
|
import { planReleaseAssets } from "../release/release-assets-plan.js";
|
|
7
7
|
import { observeInstalledApp } from "./installer-observation.js";
|
|
8
8
|
import { downloadAsset } from "./upgrade-asset-download.js";
|
|
9
|
-
import { discoverSignedRelease } from "../updates/update-discovery.js";
|
|
10
|
-
import { downloadVerifiedRelease } from "../updates/update-download.js";
|
|
9
|
+
import { discoverSignedRelease } from "../updates/feed/update-discovery.js";
|
|
10
|
+
import { downloadVerifiedRelease } from "../updates/install/update-download.js";
|
|
11
11
|
import { lstat, mkdir, open, rename, writeFile } from "node:fs/promises";
|
|
12
12
|
import { join, resolve } from "node:path";
|
|
13
13
|
// src/installer/installer-upgrade-command.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { linuxProcessIsExited } from "../updates/linux-process-state.js";
|
|
1
|
+
import { linuxProcessIsExited } from "../updates/locks/linux-process-state.js";
|
|
2
2
|
import { readFile, readdir, readlink } from "node:fs/promises";
|
|
3
3
|
// src/installer/linux-process-group.ts
|
|
4
4
|
var proc = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { open } from 'node:fs/promises';
|
|
2
|
-
import { type FetchFunction } from '../updates/release-location';
|
|
2
|
+
import { type FetchFunction } from '../updates/feed/release-location';
|
|
3
3
|
/** Download one published release asset and check it against its release.json inventory. */
|
|
4
4
|
export declare function downloadAsset(options: {
|
|
5
5
|
/** The app's feed URL, ending in `/`. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { isFeedAssetName, isFeedTag, parseFeedRelease } from "../updates/release-feed.js";
|
|
1
|
+
import { isFeedAssetName, isFeedTag, parseFeedRelease } from "../updates/feed/release-feed.js";
|
|
2
2
|
import { discardStream } from "../shared/discard-stream.js";
|
|
3
|
-
import { fetchReleaseLocation, readReleaseJson } from "../updates/release-location.js";
|
|
3
|
+
import { fetchReleaseLocation, readReleaseJson } from "../updates/feed/release-location.js";
|
|
4
4
|
import { writeAll } from "./write-all.js";
|
|
5
5
|
import { open, unlink } from "node:fs/promises";
|
|
6
6
|
import { createHash } from "node:crypto";
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export type InstallerArchiveOutcome = {
|
|
2
|
+
state: 'removed';
|
|
3
|
+
path: string;
|
|
4
|
+
} | {
|
|
5
|
+
state: 'absent';
|
|
6
|
+
} | {
|
|
7
|
+
state: 'skipped';
|
|
8
|
+
reason: string;
|
|
9
|
+
};
|
|
10
|
+
/** What a descriptor-relative lookup of one name proved. */
|
|
11
|
+
export type EntryProbe = 'present' | 'absent' | 'unknown';
|
|
12
|
+
/** Descriptor-relative file operations; the seam the race tests use. */
|
|
13
|
+
export interface DescriptorOps {
|
|
14
|
+
/** `openat`; returns a descriptor or -1. */
|
|
15
|
+
openAt(dirFd: number, name: string, flags: number): number;
|
|
16
|
+
/** `unlinkat(dirFd, name, 0)`; returns 0 or -1. */
|
|
17
|
+
unlinkAt(dirFd: number, name: string): number;
|
|
18
|
+
/**
|
|
19
|
+
* Whether `name` exists in the directory, without following a final symlink
|
|
20
|
+
* (a dangling symlink is `present`). `absent` only when the kernel positively
|
|
21
|
+
* reported "no such entry"; any other failure is `unknown`, never `absent`.
|
|
22
|
+
*/
|
|
23
|
+
probe(dirFd: number, name: string): EntryProbe;
|
|
24
|
+
}
|
|
25
|
+
/** libc `openat`/`unlinkat`/`faccessat` through Bun's FFI, or null when unavailable. */
|
|
26
|
+
export declare function loadNativeOps(): DescriptorOps | null;
|
|
27
|
+
/** Test seams; production callers pass only the two directories. */
|
|
28
|
+
export interface RetireInstallerArchiveOptions {
|
|
29
|
+
/** The running bundle's `Resources` directory (`bundleResourcesDirectory(import.meta.dir)`). */
|
|
30
|
+
resourcesDir: string;
|
|
31
|
+
/** The directory Electrobun installs under (`Library/Application Support` on macOS); the one trusted root. */
|
|
32
|
+
applicationSupportDir: string;
|
|
33
|
+
ops?: DescriptorOps | null;
|
|
34
|
+
/** Runs once the directory chain is verified, before the prepared-record check. */
|
|
35
|
+
afterDirectoryVerified?: () => void;
|
|
36
|
+
/** Runs immediately before unlinking. */
|
|
37
|
+
beforeUnlink?: () => void;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Remove the installer's retained payload tar for the running build.
|
|
41
|
+
*/
|
|
42
|
+
export declare function retireInstallerArchive(options: RetireInstallerArchiveOptions): InstallerArchiveOutcome;
|