@adea-ai/app-framework 0.26.0 → 0.28.0
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 +183 -17
- package/dist/app/create-application.d.ts +2 -0
- package/dist/app/create-application.js +6 -0
- package/dist/app/service-registry.js +4 -0
- package/dist/appearance/custom-theme-import.js +43 -7
- package/dist/appearance/custom-theme-library.d.ts +2 -0
- package/dist/appearance/custom-theme-library.js +5 -1
- package/dist/appearance/theme-record-adapter.js +4 -2
- package/dist/appearance/theme-registry.js +7 -1
- package/dist/cli/cef-helper-cli.js +0 -0
- package/dist/cli/create-application-cli.js +4 -2
- package/dist/cli/electrobun-shortcut-patch-cli.js +0 -0
- package/dist/cli/framework-update-cli.js +0 -0
- package/dist/cli/macos-signing-cli.js +0 -0
- package/dist/cli/release-assets-plan-cli.js +0 -0
- package/dist/cli/release-cut-cli.js +0 -0
- package/dist/cli/release-descriptor-staging-cli.js +0 -0
- package/dist/cli/release-finalize-cli.js +0 -0
- package/dist/cli/release-promote-cli.js +0 -0
- package/dist/cli/release-publish-cli.js +0 -0
- package/dist/cli/release-sign-cli.js +0 -0
- package/dist/cli/release-step-cli.js +6 -1
- package/dist/cli/toolchain-identity-cli.js +0 -0
- package/dist/cli/update-helper-cli.js +28 -6
- package/dist/cli/windows-runtime-patch-cli.js +0 -0
- package/dist/desktop/client-asset-manifest.d.ts +47 -0
- package/dist/desktop/client-asset-manifest.js +114 -0
- package/dist/desktop/client-asset-stream.d.ts +10 -0
- package/dist/desktop/client-asset-stream.js +138 -33
- package/dist/desktop/client-assets.d.ts +20 -0
- package/dist/desktop/client-assets.js +132 -22
- package/dist/desktop/client-response-lifecycle.d.ts +22 -0
- package/dist/desktop/client-response-lifecycle.js +233 -0
- package/dist/desktop/desktop-host.d.ts +40 -2
- package/dist/desktop/desktop-host.js +159 -9
- package/dist/framework-source.json +1 -1
- package/dist/installer/command-artifact.d.ts +4 -2
- package/dist/installer/command-artifact.js +119 -19
- package/dist/installer/installer-identity.d.ts +4 -1
- package/dist/installer/installer-identity.js +6 -3
- package/dist/installer/installer-layout.d.ts +2 -0
- package/dist/installer/installer-layout.js +5 -1
- package/dist/installer/linux-process-group.d.ts +13 -0
- package/dist/installer/linux-process-group.js +58 -0
- package/dist/native/darwin-sync.d.ts +7 -0
- package/dist/native/darwin-sync.js +43 -0
- package/dist/native/desktop-build-hook.js +7 -0
- package/dist/native/directory-exchange.d.ts +10 -0
- package/dist/native/directory-exchange.js +90 -0
- package/dist/native/electrobun-source-patch.d.ts +5 -0
- package/dist/native/electrobun-source-patch.js +19 -1
- package/dist/native/posix-launcher-build.d.ts +24 -0
- package/dist/native/posix-launcher-build.js +232 -0
- package/dist/native/posix-tree-removal.d.ts +36 -0
- package/dist/native/posix-tree-removal.js +425 -0
- package/dist/release/release-steps.d.ts +5 -0
- package/dist/release/release-steps.js +2 -1
- package/dist/update-helper.bundle.js +1483 -105
- package/dist/updates/channel-update-manager.d.ts +5 -0
- package/dist/updates/channel-update-manager.js +13 -1
- package/dist/updates/desktop-updater.d.ts +78 -2
- package/dist/updates/desktop-updater.js +320 -37
- package/dist/updates/launch-environment.d.ts +2 -0
- package/dist/updates/launch-environment.js +4 -0
- package/dist/updates/native-file-lock.d.ts +15 -0
- package/dist/updates/native-file-lock.js +189 -0
- package/dist/updates/packaged-launch-admission.d.ts +13 -0
- package/dist/updates/packaged-launch-admission.js +45 -0
- package/dist/updates/packaged-release-config.d.ts +18 -0
- package/dist/updates/packaged-release-config.js +60 -0
- package/dist/updates/packaged-update-startup.d.ts +44 -0
- package/dist/updates/packaged-update-startup.js +81 -0
- package/dist/updates/update-arm.d.ts +9 -8
- package/dist/updates/update-arm.js +227 -62
- package/dist/updates/update-cleanup-error.d.ts +23 -0
- package/dist/updates/update-cleanup-error.js +65 -0
- package/dist/updates/update-download-cleanup.d.ts +11 -0
- package/dist/updates/update-download-cleanup.js +112 -2
- package/dist/updates/update-download-lock.d.ts +20 -0
- package/dist/updates/update-download-lock.js +73 -0
- package/dist/updates/update-download.d.ts +2 -0
- package/dist/updates/update-download.js +7 -3
- package/dist/updates/update-generation-lease.d.ts +6 -0
- package/dist/updates/update-generation-lease.js +14 -0
- package/dist/updates/update-helper.d.ts +11 -2
- package/dist/updates/update-helper.js +322 -13
- package/dist/updates/update-inherited-launch-lease.d.ts +22 -0
- package/dist/updates/update-inherited-launch-lease.js +58 -0
- package/dist/updates/update-instance-lease.d.ts +15 -0
- package/dist/updates/update-instance-lease.js +25 -0
- package/dist/updates/update-launch-gate.d.ts +137 -0
- package/dist/updates/update-launch-gate.js +617 -0
- package/dist/updates/update-launch.js +3 -1
- package/dist/updates/update-lock.d.ts +12 -0
- package/dist/updates/update-lock.js +18 -0
- package/dist/updates/update-manager.d.ts +2 -0
- package/dist/updates/update-manager.js +9 -2
- package/dist/updates/update-marker.d.ts +7 -0
- package/dist/updates/update-marker.js +62 -0
- package/dist/updates/update-preflight-error.d.ts +7 -0
- package/dist/updates/update-preflight-error.js +11 -0
- package/dist/updates/update-process-fence.d.ts +4 -0
- package/dist/updates/update-process-fence.js +85 -73
- package/dist/updates/update-process-liveness.d.ts +2 -0
- package/dist/updates/update-process-liveness.js +11 -0
- package/dist/updates/update-resume.d.ts +37 -3
- package/dist/updates/update-resume.js +839 -23
- package/dist/updates/update-retention-marker.d.ts +67 -0
- package/dist/updates/update-retention-marker.js +165 -0
- package/dist/updates/update-retention-plan.d.ts +25 -0
- package/dist/updates/update-retention-plan.js +54 -0
- package/dist/updates/update-retention-sync.d.ts +34 -0
- package/dist/updates/update-retention-sync.js +83 -0
- package/dist/updates/update-retirement.d.ts +205 -0
- package/dist/updates/update-retirement.js +1485 -0
- package/dist/updates/update-shutdown.d.ts +16 -4
- package/dist/updates/update-shutdown.js +133 -8
- package/dist/updates/update-state-store.d.ts +58 -0
- package/dist/updates/update-state-store.js +139 -0
- package/dist/updates/update-swap-stage.d.ts +1 -1
- package/dist/updates/update-swap-stage.js +85 -14
- package/dist/updates/update-swap.d.ts +45 -2
- package/dist/updates/update-swap.js +207 -17
- package/package.json +31 -1
- package/src/appearance/custom-theme-import.ts +96 -14
- package/src/appearance/custom-theme-library.ts +5 -0
- package/src/appearance/theme-record-adapter.ts +15 -6
- package/src/appearance/theme-registry.ts +8 -1
- package/src/desktop/client-asset-manifest.ts +207 -0
- package/src/desktop/client-asset-stream.ts +193 -32
- package/src/desktop/client-assets.ts +210 -19
- package/src/desktop/client-response-lifecycle.ts +305 -0
- package/src/native/electrobun-posix-launch-lease.patch +398 -0
- package/templates/application/README.md +50 -0
- package/templates/application/electrobun.config.ts +5 -1
- package/templates/application/scripts/build-desktop.ts +4 -0
- package/templates/application/src/bun/index.ts +173 -16
- package/templates/application/vite.config.ts +112 -6
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { tryAcquireNativeFileLock } from "./native-file-lock.js";
|
|
2
|
+
import { basename, dirname, isAbsolute, join, resolve } from "node:path";
|
|
3
|
+
// src/updates/update-instance-lease.ts
|
|
4
|
+
/** Stable app-lifetime path, separate from the updater transition lock. */
|
|
5
|
+
function updateInstanceLeasePath(target) {
|
|
6
|
+
if (typeof target !== "string" || !isAbsolute(target) || resolve(target) !== target || target.includes("\0")) throw new Error("Invalid update instance lease target");
|
|
7
|
+
return join(dirname(target), "." + basename(target) + ".framework-instance-lease.lock");
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Try to acquire a per-install app-lifetime lease without waiting. Application
|
|
11
|
+
* processes use shared mode and an updater uses exclusive mode. undefined means
|
|
12
|
+
* another process owns an incompatible lease; other failures reject.
|
|
13
|
+
*
|
|
14
|
+
* The lock file is persistent and must never be removed or replaced.
|
|
15
|
+
*/
|
|
16
|
+
async function tryAcquireUpdateInstanceLease(target, mode) {
|
|
17
|
+
if (mode !== "shared" && mode !== "exclusive") throw new Error("Invalid update instance lease mode");
|
|
18
|
+
const lock = await tryAcquireNativeFileLock(updateInstanceLeasePath(target), mode);
|
|
19
|
+
if (!lock) return void 0;
|
|
20
|
+
return {
|
|
21
|
+
mode,
|
|
22
|
+
release: lock.release
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export { tryAcquireUpdateInstanceLease, updateInstanceLeasePath };
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { type UpdateInstanceLease } from './update-instance-lease';
|
|
2
|
+
export type UpdateLaunchGate = Readonly<{
|
|
3
|
+
schema: 1;
|
|
4
|
+
generation: string;
|
|
5
|
+
version: string;
|
|
6
|
+
/** Unique helper-run identity; two helpers for one staged generation cannot cancel each other. */
|
|
7
|
+
owner: string;
|
|
8
|
+
}>;
|
|
9
|
+
export type UpdateLaunchLeaseAttempt = Readonly<{
|
|
10
|
+
status: 'acquired';
|
|
11
|
+
lease: UpdateInstanceLease;
|
|
12
|
+
}> | Readonly<{
|
|
13
|
+
status: 'busy' | 'gated';
|
|
14
|
+
}>;
|
|
15
|
+
/** OS-held EX claim owned by one helper process, independent of app lifetime leases. */
|
|
16
|
+
export type UpdateHelperLivenessLease = Readonly<{
|
|
17
|
+
owner: string;
|
|
18
|
+
release(): Promise<void>;
|
|
19
|
+
}>;
|
|
20
|
+
export type UpdateLaunchGateRecoveryResult = 'absent' | 'busy' | 'helper-live' | 'unreconciled' | 'recovered';
|
|
21
|
+
export type UpdateLaunchGateCancellationResult = 'absent' | 'owner-mismatch' | 'unproven' | 'writer-active' | 'cleared';
|
|
22
|
+
/**
|
|
23
|
+
* Publish the schema-3 helper's cancellation request under the same
|
|
24
|
+
* coordinator used for the final writer grant. This defines the cutoff:
|
|
25
|
+
* whichever operation acquires the coordinator first wins.
|
|
26
|
+
*/
|
|
27
|
+
export declare function publishUpdateLaunchGateCancellationRequest(target: string, staging: string, generation: string, helperOwner: string): Promise<boolean>;
|
|
28
|
+
export type UpdateLaunchGateWriter = Readonly<{
|
|
29
|
+
gate: UpdateLaunchGate;
|
|
30
|
+
/** Recheck generation ownership under the transition lock before mutating the install tree. */
|
|
31
|
+
withTransition<T>(operation: (gate: UpdateLaunchGate) => Promise<T>): Promise<T>;
|
|
32
|
+
/** Clear only after the caller re-reads and proves the persisted transition and tree identities. */
|
|
33
|
+
clearGate(verifyPersistedTransition: (gate: UpdateLaunchGate) => Promise<boolean>): Promise<'cleared' | 'absent' | 'unproven'>;
|
|
34
|
+
/** Release the install lifetime EX lease; helper liveness remains held until separately released. */
|
|
35
|
+
release(): Promise<void>;
|
|
36
|
+
}>;
|
|
37
|
+
/**
|
|
38
|
+
* Returned when a failed bootstrap handoff could not confirm child termination.
|
|
39
|
+
* Keep the bootstrap lease until `releaseAfterSupervisorReaped` waits for the
|
|
40
|
+
* startup callback to settle and the reap callback confirms cleanup.
|
|
41
|
+
*/
|
|
42
|
+
export declare class UpdateLaunchHandoffCleanupError extends Error {
|
|
43
|
+
private readonly lease;
|
|
44
|
+
private readonly callbackSettled;
|
|
45
|
+
private readonly terminateAndReap;
|
|
46
|
+
private readonly priorCleanupSettled;
|
|
47
|
+
private released;
|
|
48
|
+
private releaseInFlight;
|
|
49
|
+
constructor(cause: unknown, lease: UpdateInstanceLease, callbackSettled: Promise<void>, terminateAndReap: () => Promise<void>, priorCleanupSettled?: Promise<void>);
|
|
50
|
+
releaseAfterSupervisorReaped(): Promise<void>;
|
|
51
|
+
private confirmReapedAndRelease;
|
|
52
|
+
}
|
|
53
|
+
/** Stable gate metadata path, adjacent to the install and distinct from both lock files. */
|
|
54
|
+
export declare function updateLaunchGatePath(target: string): string;
|
|
55
|
+
/** Stable, per-install helper-process liveness lock, separate from both install locks. */
|
|
56
|
+
export declare function updateHelperLivenessPath(target: string): string;
|
|
57
|
+
/**
|
|
58
|
+
* Acquire the one stable per-install helper liveness EX lock. Helpers must do
|
|
59
|
+
* this before publication; the helper publishes the gate with this branded
|
|
60
|
+
* claim, then acknowledges the bootstrap. A held lease proves a live process,
|
|
61
|
+
* while a dead process releases the OS lock automatically.
|
|
62
|
+
*/
|
|
63
|
+
export declare function tryAcquireUpdateHelperLiveness(target: string): Promise<UpdateHelperLivenessLease | undefined>;
|
|
64
|
+
/**
|
|
65
|
+
* Cancel a published gate before the helper receives an exclusive writer
|
|
66
|
+
* lease. The helper's branded liveness claim proves this is the live owner;
|
|
67
|
+
* changing its local state first stops and drains any pending wait, so that
|
|
68
|
+
* wait cannot hand out a writer while cancellation is being checked. The
|
|
69
|
+
* caller must validate the exact journal generation/version/owner and the
|
|
70
|
+
* unchanged install/candidate tree under the transition lock. False, errors,
|
|
71
|
+
* malformed state, or a changed gate preserve the gate. This is suitable for
|
|
72
|
+
* cancellation while application processes still hold shared instance leases;
|
|
73
|
+
* it deliberately cannot cancel once a writer handle has been returned.
|
|
74
|
+
*/
|
|
75
|
+
export declare function cancelUpdateLaunchGateBeforeTransition(target: string, helperLiveness: UpdateHelperLivenessLease, expected: UpdateLaunchGate, validateJournalAndTree: (gate: UpdateLaunchGate) => Promise<boolean>): Promise<UpdateLaunchGateCancellationResult>;
|
|
76
|
+
/** Read the atomic gate record. Missing means open; malformed or non-file state fails closed. */
|
|
77
|
+
export declare function readUpdateLaunchGate(target: string): Promise<UpdateLaunchGate | undefined>;
|
|
78
|
+
/**
|
|
79
|
+
* Atomically publish a generation-bound launch gate under the short transition lock.
|
|
80
|
+
* This must run in the helper process that acquired the branded liveness lease;
|
|
81
|
+
* the owner is derived from that lease, so a string/PID cannot impersonate it.
|
|
82
|
+
*/
|
|
83
|
+
export declare function publishUpdateLaunchGate(target: string, helperLiveness: UpdateHelperLivenessLease, input: Pick<UpdateLaunchGate, 'generation' | 'version'>, persistOwner?: (gate: UpdateLaunchGate) => Promise<void>): Promise<UpdateLaunchGate>;
|
|
84
|
+
/**
|
|
85
|
+
* Reclaim a crashed helper's exact gate only after the caller reconciles its
|
|
86
|
+
* durable journal and install tree. Lock order is lifetime EX -> coordinator
|
|
87
|
+
* EX -> nonblocking helper-liveness EX; a live helper causes a fast fail-closed
|
|
88
|
+
* return. No PID or process-table inference participates in this decision.
|
|
89
|
+
* The callback must verify journal generation/version and a recovery-safe phase,
|
|
90
|
+
* reconcile the actual tree for that exact gate, and return true only after the
|
|
91
|
+
* reconciliation is durable. False or a thrown error leaves the gate in place.
|
|
92
|
+
* This WIP API has no production caller; existing resume paths are not safe
|
|
93
|
+
* substitutes unless they also enforce these ownership and validation steps.
|
|
94
|
+
*/
|
|
95
|
+
export declare function tryRecoverUpdateLaunchGate(target: string, reconcileJournalAndTree: (gate: UpdateLaunchGate) => Promise<boolean>): Promise<UpdateLaunchGateRecoveryResult>;
|
|
96
|
+
/**
|
|
97
|
+
* Bootstrap and the long-lived supervisor use this same short transaction:
|
|
98
|
+
* coordinator EX -> inspect gate -> nonblocking instance SH -> coordinator release.
|
|
99
|
+
* Busy and gated states are reported without waiting while holding the coordinator.
|
|
100
|
+
*/
|
|
101
|
+
export declare function tryAcquireUpdateLaunchLease(target: string): Promise<UpdateLaunchLeaseAttempt>;
|
|
102
|
+
/**
|
|
103
|
+
* Keep a bootstrap's shared lease until the started child acknowledges the
|
|
104
|
+
* independent ownership required by its role. An update helper must acquire
|
|
105
|
+
* liveness, publish its gate with that claim, and acknowledge publication
|
|
106
|
+
* before this callback resolves. On abort, stop future spawns and settle only
|
|
107
|
+
* after cancellation or child reaping is guaranteed.
|
|
108
|
+
*/
|
|
109
|
+
export declare function withUpdateLaunchLeaseHandoff<T>(options: {
|
|
110
|
+
target: string;
|
|
111
|
+
/** Stop future spawns; resolve only after the child confirms its independent lease and any required gate publication. */
|
|
112
|
+
startAndWaitForSupervisorAcknowledgement(signal: AbortSignal): Promise<T>;
|
|
113
|
+
/** Must terminate and reap any child whose lease acknowledgement did not arrive. */
|
|
114
|
+
terminateAndReapUnacknowledgedSupervisor(): Promise<void>;
|
|
115
|
+
acknowledgementTimeoutMs?: number;
|
|
116
|
+
cleanupTimeoutMs?: number;
|
|
117
|
+
}): Promise<Readonly<{
|
|
118
|
+
status: 'started';
|
|
119
|
+
value: T;
|
|
120
|
+
}> | Readonly<{
|
|
121
|
+
status: 'busy' | 'gated';
|
|
122
|
+
}>>;
|
|
123
|
+
/**
|
|
124
|
+
* Wait cancellably for every app reader to leave. This loop never holds the
|
|
125
|
+
* transition lock while waiting; it takes the coordinator only to verify the
|
|
126
|
+
* exact committed gate on each poll and again after an exclusive-lease attempt
|
|
127
|
+
* succeeds. An abort signal leaves the gate in place. The live owner may use
|
|
128
|
+
* cancelUpdateLaunchGateBeforeTransition to stop and drain this wait and clear
|
|
129
|
+
* only after its caller validates the durable pre-transition state.
|
|
130
|
+
*/
|
|
131
|
+
export declare function waitForUpdateLaunchGateWriter(target: string, expected: UpdateLaunchGate, options: {
|
|
132
|
+
helperLiveness: UpdateHelperLivenessLease;
|
|
133
|
+
signal?: AbortSignal;
|
|
134
|
+
pollIntervalMs?: number;
|
|
135
|
+
/** Run under the coordinator immediately before writer grant; true aborts without a lease. */
|
|
136
|
+
beforeWriterGrant?: () => Promise<boolean>;
|
|
137
|
+
}): Promise<UpdateLaunchGateWriter>;
|