@adea-ai/app-framework-release-tools 0.1.0 → 0.3.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/dist/cli.js CHANGED
@@ -18,12 +18,15 @@ var __export = (target, all) => {
18
18
  // src/index.ts
19
19
  var exports_src = {};
20
20
  __export(exports_src, {
21
+ createDailyNativeReceipt: () => createDailyNativeReceipt,
21
22
  createGitHubPromotionProvider: () => createGitHubPromotionProvider,
22
23
  createGitHubReleasePublisher: () => createGitHubReleasePublisher,
23
24
  createMacosDmg: () => createMacosDmg,
25
+ desktopDailyProfile: () => desktopDailyProfile,
24
26
  fileIdentity: () => fileIdentity2,
25
27
  finalizeReleasePleaseDraft: () => finalizeReleasePleaseDraft,
26
28
  inspectStagedStep: () => inspectStagedStep,
29
+ planDailyReleaseMatrix: () => planDailyReleaseMatrix,
27
30
  planQualificationRun: () => planQualificationRun2,
28
31
  planReleaseAssets: () => planReleaseAssets2,
29
32
  publishFrameworkPackage: () => publishFrameworkPackage,
@@ -40,15 +43,39 @@ __export(exports_src, {
40
43
  stageBuildStep: () => stageBuildStep,
41
44
  stagePlatformArtifacts: () => stagePlatformArtifacts,
42
45
  stageReleaseDescriptors: () => stageReleaseDescriptors,
46
+ verifyDailyReleaseMatrix: () => verifyDailyReleaseMatrix,
43
47
  verifyImage: () => verifyImage,
44
48
  writeDescriptors: () => writeDescriptors
45
49
  });
46
50
 
47
51
  // src/cli.ts
48
- import { Effect as Effect25 } from "effect";
52
+ import { Effect as Effect29 } from "effect";
49
53
 
50
54
  // src/cli-commands.ts
51
- import { Effect as Effect24 } from "effect";
55
+ import { Effect as Effect28 } from "effect";
56
+
57
+ // ../../src/installer/hosted-runner.ts
58
+ import { isAbsolute } from "path";
59
+ var JOB_NUMBER = /^[1-9]\d{0,19}$/;
60
+ function isHostedRunner(env) {
61
+ if (env.CI !== "true")
62
+ return false;
63
+ if (env.GITHUB_ACTIONS === "true")
64
+ return env.RUNNER_ENVIRONMENT === "github-hosted";
65
+ if (env.FRAMEWORK_DISPOSABLE_RUNNER !== "true")
66
+ return false;
67
+ if (env.GITLAB_CI === "true")
68
+ return JOB_NUMBER.test(env.CI_JOB_ID ?? "");
69
+ return env.CIRCLECI === "true" && JOB_NUMBER.test(env.CIRCLE_BUILD_NUM ?? "");
70
+ }
71
+ function assertHostedRunner(env, subject) {
72
+ if (!isHostedRunner(env))
73
+ throw new Error(`${subject} requires a disposable hosted runner`);
74
+ }
75
+ function runnerTemp(env) {
76
+ const path = env.GITHUB_ACTIONS === "true" ? env.RUNNER_TEMP : env.TMPDIR;
77
+ return path && isAbsolute(path) ? path : undefined;
78
+ }
52
79
 
53
80
  // ../../src/cli/cli-runner.ts
54
81
  var MAX_ERROR_LENGTH = 400;
@@ -201,29 +228,6 @@ function sidecarBundlePath(name, platform) {
201
228
  return `Resources/app/${SIDECAR_DIRECTORY}/${sidecarFileName(name, platform)}`;
202
229
  }
203
230
 
204
- // ../../src/installer/hosted-runner.ts
205
- import { isAbsolute } from "path";
206
- var JOB_NUMBER = /^[1-9]\d{0,19}$/;
207
- function isHostedRunner(env) {
208
- if (env.CI !== "true")
209
- return false;
210
- if (env.GITHUB_ACTIONS === "true")
211
- return env.RUNNER_ENVIRONMENT === "github-hosted";
212
- if (env.FRAMEWORK_DISPOSABLE_RUNNER !== "true")
213
- return false;
214
- if (env.GITLAB_CI === "true")
215
- return JOB_NUMBER.test(env.CI_JOB_ID ?? "");
216
- return env.CIRCLECI === "true" && JOB_NUMBER.test(env.CIRCLE_BUILD_NUM ?? "");
217
- }
218
- function assertHostedRunner(env, subject) {
219
- if (!isHostedRunner(env))
220
- throw new Error(`${subject} requires a disposable hosted runner`);
221
- }
222
- function runnerTemp(env) {
223
- const path = env.GITHUB_ACTIONS === "true" ? env.RUNNER_TEMP : env.TMPDIR;
224
- return path && isAbsolute(path) ? path : undefined;
225
- }
226
-
227
231
  // ../../src/installer/installer-layout.ts
228
232
  function assertInstallerContext(env, platform, host, arch) {
229
233
  assertHostedRunner(env, "Installer execution");
@@ -350,6 +354,149 @@ function errorCode(error) {
350
354
  return typeof code === "string" ? code : undefined;
351
355
  }
352
356
 
357
+ // ../../src/updates/feed/arch-package-policy.ts
358
+ var packageName = /^[a-z0-9][a-z0-9@+._-]{0,63}$/;
359
+ var executableName = /^[a-z][a-z0-9-]{0,63}$/;
360
+ var licenseToken = /^[A-Za-z0-9][A-Za-z0-9.+:-]{0,63}$/;
361
+ var category = /^[A-Za-z][A-Za-z0-9-]{0,31}$/;
362
+ var relative2 = /^[A-Za-z0-9._-]+(?:\/[A-Za-z0-9._-]+)*$/;
363
+ var optdependsEntry = /^[a-z0-9][a-z0-9@+._-]{0,63}(?:: [^<>\r\n]{1,128})?$/;
364
+ function assert(condition, message) {
365
+ if (!condition)
366
+ throw new Error(message);
367
+ }
368
+ function text(value, maximum) {
369
+ return typeof value === "string" && value.length > 0 && value.length <= maximum && !containsAsciiControl(value) && value.trim() === value;
370
+ }
371
+ function httpsUrl(value) {
372
+ if (typeof value !== "string" || value.length > 300)
373
+ return false;
374
+ let url;
375
+ try {
376
+ url = new URL(value);
377
+ } catch {
378
+ return false;
379
+ }
380
+ return url.protocol === "https:" && (url.href === value || url.pathname === "/" && url.href === `${value}/`) && !url.username && !url.password && !url.port && !url.search && !url.hash;
381
+ }
382
+ function sourceTemplate(value) {
383
+ if (typeof value !== "string" || !value.includes("{tag}"))
384
+ return false;
385
+ const rest = value.replaceAll("{tag}", "");
386
+ return !rest.includes("{") && !rest.includes("}") && httpsUrl(value.replaceAll("{tag}", "v1.0.0"));
387
+ }
388
+ function tokenList(value, options) {
389
+ assert(Array.isArray(value) && value.length >= options.minimum && value.length <= options.maximum && value.every((item) => typeof item === "string" && item.length <= 200 && options.pattern.test(item) && !containsAsciiControl(item)) && new Set(value).size === value.length, options.message);
390
+ return [...value];
391
+ }
392
+ function bundlePath(value, suffix) {
393
+ return typeof value === "string" && value.length <= 200 && relative2.test(value) && !value.split("/").some((part) => part === "." || part === "..") && (suffix === undefined || value.endsWith(suffix));
394
+ }
395
+ var policyKeys = new Set([
396
+ "pkgname",
397
+ "pkgdesc",
398
+ "maintainer",
399
+ "url",
400
+ "license",
401
+ "depends",
402
+ "optdepends",
403
+ "provides",
404
+ "conflicts",
405
+ "executable",
406
+ "setuid",
407
+ "desktop",
408
+ "icon",
409
+ "licenseSource",
410
+ "links",
411
+ "channel",
412
+ "repository"
413
+ ]);
414
+ function parseArchPackage(value) {
415
+ assert(isRecord(value) && Object.keys(value).every((key) => policyKeys.has(key)), "Invalid Arch package configuration");
416
+ const policy = value;
417
+ const desktop = policy.desktop;
418
+ const links = policy.links ?? [];
419
+ assert(typeof policy.pkgname === "string" && packageName.test(policy.pkgname) && policy.pkgname.endsWith("-bin"), "Arch package name must be a lowercase pkgname ending in -bin");
420
+ assert(text(policy.pkgdesc, 256), "Invalid Arch package description");
421
+ assert(text(policy.maintainer, 128) && /^[^<>\r\n]{1,64} <[^<>\r\n]{3,64}>$/.test(policy.maintainer), "Invalid Arch package maintainer");
422
+ assert(httpsUrl(policy.url), "Invalid Arch package URL");
423
+ assert(text(policy.executable, 64) && executableName.test(policy.executable), "Invalid Arch executable");
424
+ assert(policy.icon === undefined || bundlePath(policy.icon, ".svg"), "Invalid Arch package icon");
425
+ assert(policy.licenseSource === undefined || sourceTemplate(policy.licenseSource), "Invalid Arch license source");
426
+ assert(isRecord(desktop) && Object.keys(desktop).every((key) => ["name", "comment", "categories"].includes(key)) && text(desktop.name, 64) && (desktop.comment === undefined || text(desktop.comment, 128)) && "categories" in desktop, "Invalid Arch desktop entry");
427
+ assert(Array.isArray(links) && links.length <= 8 && links.every((link, index) => isRecord(link) && Object.keys(link).length === 2 && text(link.name, 64) && executableName.test(link.name) && link.name !== policy.executable && links.findIndex((item) => isRecord(item) && item.name === link.name) === index && bundlePath(link.target)), "Invalid Arch package links");
428
+ assert(policy.channel === undefined || policy.channel === "stable" || policy.channel === "daily", "Invalid Arch package channel");
429
+ const repository = policy.repository;
430
+ assert(repository === undefined || isRecord(repository) && Object.keys(repository).length === 3 && typeof repository.name === "string" && /^[a-z][a-z0-9-]{0,31}$/.test(repository.name) && httpsUrl(repository.base) && repository.base.endsWith("/") && httpsUrl(repository.publicKey), "Invalid Arch package repository");
431
+ return {
432
+ pkgname: policy.pkgname,
433
+ pkgdesc: policy.pkgdesc,
434
+ maintainer: policy.maintainer,
435
+ url: policy.url,
436
+ license: tokenList(policy.license, {
437
+ maximum: 8,
438
+ minimum: 1,
439
+ pattern: licenseToken,
440
+ message: "Invalid Arch package license"
441
+ }),
442
+ depends: tokenList(policy.depends, {
443
+ maximum: 64,
444
+ minimum: 1,
445
+ pattern: packageName,
446
+ message: "Invalid Arch package dependencies"
447
+ }),
448
+ optdepends: tokenList(policy.optdepends ?? [], {
449
+ maximum: 32,
450
+ minimum: 0,
451
+ pattern: optdependsEntry,
452
+ message: "Invalid Arch optional dependencies"
453
+ }),
454
+ provides: tokenList(policy.provides ?? [], {
455
+ maximum: 16,
456
+ minimum: 0,
457
+ pattern: packageName,
458
+ message: "Invalid Arch package provides"
459
+ }),
460
+ conflicts: tokenList(policy.conflicts ?? [], {
461
+ maximum: 16,
462
+ minimum: 0,
463
+ pattern: packageName,
464
+ message: "Invalid Arch package conflicts"
465
+ }),
466
+ executable: policy.executable,
467
+ setuid: tokenList(policy.setuid ?? [], {
468
+ maximum: 8,
469
+ minimum: 0,
470
+ pattern: /^[A-Za-z0-9._-]+(?:\/[A-Za-z0-9._-]+)+$/,
471
+ message: "Invalid Arch setuid executables"
472
+ }),
473
+ desktop: {
474
+ name: desktop.name,
475
+ ...desktop.comment === undefined ? {} : { comment: desktop.comment },
476
+ categories: tokenList(desktop.categories, {
477
+ maximum: 8,
478
+ minimum: 1,
479
+ pattern: category,
480
+ message: "Invalid Arch desktop categories"
481
+ })
482
+ },
483
+ ...policy.icon === undefined ? {} : { icon: policy.icon },
484
+ ...policy.licenseSource === undefined ? {} : { licenseSource: policy.licenseSource },
485
+ links: links.map((link) => ({
486
+ name: link.name,
487
+ target: link.target
488
+ })),
489
+ channel: policy.channel ?? "stable",
490
+ ...repository === undefined ? {} : {
491
+ repository: {
492
+ name: repository.name,
493
+ base: repository.base,
494
+ publicKey: repository.publicKey
495
+ }
496
+ }
497
+ };
498
+ }
499
+
353
500
  // ../../src/updates/feed/release-feed.ts
354
501
  var MAX_LEDGER_RELEASES = 500;
355
502
  var MAX_RELEASE_ASSETS = 256;
@@ -435,19 +582,19 @@ function parseReleaseLedger(value, app) {
435
582
  }
436
583
 
437
584
  // ../../src/updates/feed/release-config-contract.ts
438
- function assert(condition, message) {
585
+ function assert2(condition, message) {
439
586
  if (!condition)
440
587
  throw new Error(message);
441
588
  }
442
589
  function parseOfflinePolicy(value) {
443
- assert(typeof value === "object" && value !== null && !Array.isArray(value), "Invalid offline policy");
590
+ assert2(typeof value === "object" && value !== null && !Array.isArray(value), "Invalid offline policy");
444
591
  const policy = value;
445
- assert(typeof policy.marker === "string" && policy.marker.trim().length > 0 && policy.marker.length <= 256 && !containsAsciiControl(policy.marker), "Invalid offline marker");
592
+ assert2(typeof policy.marker === "string" && policy.marker.trim().length > 0 && policy.marker.length <= 256 && !containsAsciiControl(policy.marker), "Invalid offline marker");
446
593
  if (policy.kind === "standalone") {
447
- assert(Object.keys(policy).length === 2, "Invalid standalone offline policy");
594
+ assert2(Object.keys(policy).length === 2, "Invalid standalone offline policy");
448
595
  return { kind: "standalone", marker: policy.marker };
449
596
  }
450
- assert(policy.kind === "local-bootstrap" && Object.keys(policy).length === 3 && typeof policy.path === "string" && policy.path.length <= 256 && /^\/(?:[A-Za-z0-9_~-]+\/)*[A-Za-z0-9_~-]+$/.test(policy.path) && !policy.path.startsWith("/__framework/"), "Invalid bootstrap offline policy");
597
+ assert2(policy.kind === "local-bootstrap" && Object.keys(policy).length === 3 && typeof policy.path === "string" && policy.path.length <= 256 && /^\/(?:[A-Za-z0-9_~-]+\/)*[A-Za-z0-9_~-]+$/.test(policy.path) && !policy.path.startsWith("/__framework/"), "Invalid bootstrap offline policy");
451
598
  return { kind: "local-bootstrap", marker: policy.marker, path: policy.path };
452
599
  }
453
600
  var strings = (value) => Array.isArray(value) && value.length > 0 && value.every((item) => typeof item === "string" && item.length <= 200 && /^[A-Za-z0-9][A-Za-z0-9._{}-]*$/.test(item) && !item.replaceAll("{tag}", "").includes("{") && !item.replaceAll("{tag}", "").includes("}")) && new Set(value).size === value.length;
@@ -542,6 +689,7 @@ function parseReleaseConfig(config) {
542
689
  if (!/^[a-z0-9-]+$/.test(platform) || !strings(assets))
543
690
  throw new Error("Invalid release platform configuration");
544
691
  const platformSnapshot = Object.fromEntries(Object.entries(platforms).map(([platform, assets]) => [platform, [...assets]]));
692
+ const archPackage = config.archPackage === undefined ? undefined : parseArchPackage(config.archPackage);
545
693
  const commandArtifacts = parseCommandArtifacts(config.commandArtifacts, Object.keys(platforms));
546
694
  const appIds = [config.appId, ...commandArtifacts.map((artifact) => artifact.appId)];
547
695
  if (new Set(appIds).size !== appIds.length)
@@ -586,6 +734,7 @@ function parseReleaseConfig(config) {
586
734
  sidecars,
587
735
  releaseWorkflows,
588
736
  feed,
737
+ archPackage,
589
738
  commandArtifacts,
590
739
  requirements
591
740
  };
@@ -1123,7 +1272,7 @@ function normalizePromotionRelease(value) {
1123
1272
  }
1124
1273
 
1125
1274
  // ../../src/release/release-qualification.ts
1126
- function assert2(condition, message) {
1275
+ function assert3(condition, message) {
1127
1276
  if (!condition)
1128
1277
  throw new Error(message);
1129
1278
  }
@@ -1131,19 +1280,19 @@ function expectedAssets(requirements) {
1131
1280
  if (Object.hasOwn(requirements, "offlinePolicy"))
1132
1281
  parseOfflinePolicy(requirements.offlinePolicy);
1133
1282
  const platforms = Object.entries(requirements.platforms);
1134
- assert2(platforms.length > 0, "Missing platforms");
1283
+ assert3(platforms.length > 0, "Missing platforms");
1135
1284
  const names = [
1136
1285
  ...platforms.flatMap(([platform, artifacts]) => {
1137
- assert2(/^[a-z0-9-]+$/.test(platform) && artifacts.length > 0, "Invalid platform requirements");
1286
+ assert3(/^[a-z0-9-]+$/.test(platform) && artifacts.length > 0, "Invalid platform requirements");
1138
1287
  return artifacts;
1139
1288
  }),
1140
1289
  ...Object.entries(requirements.commandArtifacts ?? {}).flatMap(([kind, byPlatform]) => {
1141
- assert2(/^[a-z][a-z0-9-]{0,31}$/.test(kind) && Object.keys(byPlatform).length === platforms.length && platforms.every(([platform]) => typeof byPlatform[platform] === "string"), "Invalid command artifact requirements");
1290
+ assert3(/^[a-z][a-z0-9-]{0,31}$/.test(kind) && Object.keys(byPlatform).length === platforms.length && platforms.every(([platform]) => typeof byPlatform[platform] === "string"), "Invalid command artifact requirements");
1142
1291
  return Object.values(byPlatform);
1143
1292
  }),
1144
1293
  ...requirements.releaseAssets
1145
1294
  ];
1146
- assert2(names.length > 0 && names.every((name) => /^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(name)) && new Set(names).size === names.length, "Invalid or duplicate asset requirements");
1295
+ assert3(names.length > 0 && names.every((name) => /^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(name)) && new Set(names).size === names.length, "Invalid or duplicate asset requirements");
1147
1296
  return names;
1148
1297
  }
1149
1298
  function matches(saved, uploaded) {
@@ -1151,74 +1300,74 @@ function matches(saved, uploaded) {
1151
1300
  }
1152
1301
  function uniqueAsset(assets, name) {
1153
1302
  const found = assets.filter((asset) => asset.name === name);
1154
- assert2(found.length === 1, `Missing or duplicate asset: ${name}`);
1303
+ assert3(found.length === 1, `Missing or duplicate asset: ${name}`);
1155
1304
  return found[0];
1156
1305
  }
1157
1306
  function checkRenderer(value, offlinePolicy) {
1158
1307
  const port = Number(value?.origin?.split(":").at(-1));
1159
1308
  const common = value && port >= 1024 && port <= 65535 && /^http:\/\/127\.0\.0\.1:[1-9]\d{3,4}$/.test(value.origin) && value.samples === 2 && value.guardInstalled === true && value.offlineObserved === true && value.unexpectedActivity === false && Number.isFinite(value.elapsedMs) && value.elapsedMs >= 3000 && value.visible === true && ["interactive", "complete"].includes(value.readyState) && Number.isFinite(value.width) && value.width >= 100 && Number.isFinite(value.height) && value.height >= 100 && Number.isSafeInteger(value.interactiveElements) && value.interactiveElements >= 1 && Number.isSafeInteger(value.textLength) && value.textLength >= 1;
1160
1309
  if (!offlinePolicy) {
1161
- assert2(common && value.method === "native-dom-raf-v1" && value.bootstrapDenied === true, "Incomplete native renderer evidence");
1310
+ assert3(common && value.method === "native-dom-raf-v1" && value.bootstrapDenied === true, "Incomplete native renderer evidence");
1162
1311
  return;
1163
1312
  }
1164
- assert2(value && value.offlinePolicy, "Incomplete native renderer evidence");
1313
+ assert3(value && value.offlinePolicy, "Incomplete native renderer evidence");
1165
1314
  const policy = parseOfflinePolicy(offlinePolicy), observed = parseOfflinePolicy(value.offlinePolicy);
1166
- assert2(common && value.method === "native-dom-raf-v2" && value.markerObserved === true && value.browserNetworkRestricted === true && observed.kind === policy.kind && observed.marker === policy.marker && (policy.kind === "standalone" ? value.bootstrapDenied === false : observed.kind === "local-bootstrap" && observed.path === policy.path && value.bootstrapDenied === true), "Incomplete native renderer evidence");
1315
+ assert3(common && value.method === "native-dom-raf-v2" && value.markerObserved === true && value.browserNetworkRestricted === true && observed.kind === policy.kind && observed.marker === policy.marker && (policy.kind === "standalone" ? value.bootstrapDenied === false : observed.kind === "local-bootstrap" && observed.path === policy.path && value.bootstrapDenied === true), "Incomplete native renderer evidence");
1167
1316
  }
1168
1317
  function validateInstallerReceipt(identity, entry, platform, names, assets, offlinePolicy) {
1169
1318
  assertIdentity(identity, platform);
1170
- assert2(Array.isArray(names) && new Set(names).size === names.length, "Invalid installer receipt context");
1171
- assert2(entry && entry.platform === platform && entry.schema === 2 && entry.installed === true && entry.launched === true && entry.rendererReady === true && ["tag", "sourceSha", "workflowSha", "runId", "runAttempt"].every((key) => entry[key] === identity[key]), "Installer identity mismatch");
1319
+ assert3(Array.isArray(names) && new Set(names).size === names.length, "Invalid installer receipt context");
1320
+ assert3(entry && entry.platform === platform && entry.schema === 2 && entry.installed === true && entry.launched === true && entry.rendererReady === true && ["tag", "sourceSha", "workflowSha", "runId", "runAttempt"].every((key) => entry[key] === identity[key]), "Installer identity mismatch");
1172
1321
  checkRenderer(entry.rendererEvidence, offlinePolicy);
1173
- assert2(Array.isArray(entry.assets) && names.length > 0 && entry.assets.length === names.length, "Incorrect installer asset count");
1322
+ assert3(Array.isArray(entry.assets) && names.length > 0 && entry.assets.length === names.length, "Incorrect installer asset count");
1174
1323
  for (const name of names)
1175
- assert2(matches(uniqueAsset(entry.assets, name), uniqueAsset(assets, name)), `Installer asset mismatch: ${name}`);
1324
+ assert3(matches(uniqueAsset(entry.assets, name), uniqueAsset(assets, name)), `Installer asset mismatch: ${name}`);
1176
1325
  return true;
1177
1326
  }
1178
1327
  function assertIdentity(identity, platform) {
1179
- assert2(/^v\d+\.\d+\.\d+$/.test(identity.tag) && isGitSha(identity.sourceSha) && isGitSha(identity.workflowSha) && /^[1-9]\d{0,19}$/.test(identity.runId) && Number.isSafeInteger(identity.runAttempt) && identity.runAttempt > 0 && /^[a-z0-9-]+$/.test(platform), "Invalid receipt context");
1328
+ assert3(/^v\d+\.\d+\.\d+$/.test(identity.tag) && isGitSha(identity.sourceSha) && isGitSha(identity.workflowSha) && /^[1-9]\d{0,19}$/.test(identity.runId) && Number.isSafeInteger(identity.runAttempt) && identity.runAttempt > 0 && /^[a-z0-9-]+$/.test(platform), "Invalid receipt context");
1180
1329
  }
1181
1330
  function validateCommandReceipt(identity, entry, kind, platform, name, assets) {
1182
1331
  assertIdentity(identity, platform);
1183
- assert2(entry && entry.schema === 1 && entry.kind === kind && entry.platform === platform && entry.installed === true && entry.versionMatched === true && entry.probesPassed === true && entry.serviceStarted === true && entry.serviceStopped === (platform === "windows-x64" ? "process-tree" : "sigterm") && Object.keys(entry).length === 14 && ["tag", "sourceSha", "workflowSha", "runId", "runAttempt"].every((key) => entry[key] === identity[key]), "Command artifact receipt mismatch");
1184
- assert2(matches(entry.asset, uniqueAsset(assets, name)), `Command artifact asset mismatch: ${name}`);
1332
+ assert3(entry && entry.schema === 1 && entry.kind === kind && entry.platform === platform && entry.installed === true && entry.versionMatched === true && entry.probesPassed === true && entry.serviceStarted === true && entry.serviceStopped === (platform === "windows-x64" ? "process-tree" : "sigterm") && Object.keys(entry).length === 14 && ["tag", "sourceSha", "workflowSha", "runId", "runAttempt"].every((key) => entry[key] === identity[key]), "Command artifact receipt mismatch");
1333
+ assert3(matches(entry.asset, uniqueAsset(assets, name)), `Command artifact asset mismatch: ${name}`);
1185
1334
  return true;
1186
1335
  }
1187
1336
  function validateCommandReceipts(identity, receipts, requirements, assets) {
1188
1337
  const required = Object.entries(requirements.commandArtifacts ?? {}).flatMap(([kind, byPlatform]) => Object.entries(byPlatform).map(([platform, name]) => ({ kind, platform, name })));
1189
1338
  if (!required.length) {
1190
- assert2(receipts === undefined, "Unexpected command artifact receipts");
1339
+ assert3(receipts === undefined, "Unexpected command artifact receipts");
1191
1340
  return;
1192
1341
  }
1193
- assert2(Array.isArray(receipts) && receipts.length === required.length, "Missing or duplicate command artifact receipts");
1342
+ assert3(Array.isArray(receipts) && receipts.length === required.length, "Missing or duplicate command artifact receipts");
1194
1343
  for (const { kind, platform, name } of required) {
1195
1344
  const entries = receipts.filter((entry) => entry?.kind === kind && entry.platform === platform);
1196
- assert2(entries.length === 1, `Missing or duplicate command artifact receipt: ${kind}`);
1345
+ assert3(entries.length === 1, `Missing or duplicate command artifact receipt: ${kind}`);
1197
1346
  validateCommandReceipt(identity, entries[0], kind, platform, name, assets);
1198
1347
  }
1199
1348
  }
1200
1349
  function validateReleaseQualification(release, receipt, sourceSha, requirements) {
1201
1350
  const required = expectedAssets(requirements);
1202
1351
  const platforms = Object.keys(requirements.platforms);
1203
- assert2(release.draft === false && receipt.schema === 2 && receipt.tag === release.tag_name && receipt.sourceSha === sourceSha && isGitSha(sourceSha) && isGitSha(receipt.workflowSha) && /^[1-9]\d*$/.test(receipt.runId) && Number.isSafeInteger(receipt.runAttempt) && receipt.runAttempt > 0, "Qualification identity mismatch");
1204
- assert2(receipt.platforms.length === platforms.length && receipt.installerTests.length === platforms.length && receipt.installerReceipts.length === platforms.length && platforms.every((platform) => receipt.platforms.filter((x) => x === platform).length === 1 && receipt.installerTests.filter((x) => x === platform).length === 1), "Missing or duplicate platform tests");
1352
+ assert3(release.draft === false && receipt.schema === 2 && receipt.tag === release.tag_name && receipt.sourceSha === sourceSha && isGitSha(sourceSha) && isGitSha(receipt.workflowSha) && /^[1-9]\d*$/.test(receipt.runId) && Number.isSafeInteger(receipt.runAttempt) && receipt.runAttempt > 0, "Qualification identity mismatch");
1353
+ assert3(receipt.platforms.length === platforms.length && receipt.installerTests.length === platforms.length && receipt.installerReceipts.length === platforms.length && platforms.every((platform) => receipt.platforms.filter((x) => x === platform).length === 1 && receipt.installerTests.filter((x) => x === platform).length === 1), "Missing or duplicate platform tests");
1205
1354
  for (const platform of platforms) {
1206
1355
  const entries = receipt.installerReceipts.filter((entry) => entry.platform === platform);
1207
- assert2(entries.length === 1, `Missing or duplicate installer receipt: ${platform}`);
1356
+ assert3(entries.length === 1, `Missing or duplicate installer receipt: ${platform}`);
1208
1357
  validateInstallerReceipt(receipt, entries[0], platform, requirements.platforms[platform], release.assets, requirements.offlinePolicy);
1209
1358
  }
1210
1359
  validateCommandReceipts(receipt, receipt.commandReceipts, requirements, release.assets);
1211
- assert2(receipt.assets.length === required.length, "Incorrect qualification asset count");
1360
+ assert3(receipt.assets.length === required.length, "Incorrect qualification asset count");
1212
1361
  for (const name of required)
1213
- assert2(matches(uniqueAsset(receipt.assets, name), uniqueAsset(release.assets, name)), `Qualification asset mismatch: ${name}`);
1362
+ assert3(matches(uniqueAsset(receipt.assets, name), uniqueAsset(release.assets, name)), `Qualification asset mismatch: ${name}`);
1214
1363
  return true;
1215
1364
  }
1216
1365
  function validateQualificationRun(run, jobs, receipt, repository, requirements, assetsWorkflow) {
1217
1366
  expectedAssets(requirements);
1218
- assert2(String(run.id) === receipt.runId && run.run_attempt === receipt.runAttempt && run.conclusion === "success" && run.path === assetsWorkflow && run.repository.full_name === repository && run.head_sha === receipt.workflowSha && ["release", "workflow_dispatch"].includes(run.event), "Qualification run identity mismatch");
1367
+ assert3(String(run.id) === receipt.runId && run.run_attempt === receipt.runAttempt && run.conclusion === "success" && run.path === assetsWorkflow && run.repository.full_name === repository && run.head_sha === receipt.workflowSha && ["release", "workflow_dispatch"].includes(run.event), "Qualification run identity mismatch");
1219
1368
  for (const platform of Object.keys(requirements.platforms)) {
1220
1369
  const platformJobs = jobs.filter((job) => new RegExp(`^(?:[A-Za-z0-9_-]+ / )?Installer / ${platform}$`).test(job.name));
1221
- assert2(platformJobs.length === 1 && platformJobs[0].conclusion === "success", `Missing successful installer job: ${platform}`);
1370
+ assert3(platformJobs.length === 1 && platformJobs[0].conclusion === "success", `Missing successful installer job: ${platform}`);
1222
1371
  }
1223
1372
  return true;
1224
1373
  }
@@ -1760,6 +1909,9 @@ var RELEASE_VERSION = /^\d+\.\d+\.\d+(?:-dev\.\d+)?$/;
1760
1909
  function isReleaseVersion(value) {
1761
1910
  return typeof value === "string" && value.length <= MAX_RELEASE_VERSION_LENGTH && RELEASE_VERSION.test(value);
1762
1911
  }
1912
+ function isReleaseTag(value) {
1913
+ return typeof value === "string" && value.startsWith("v") && isReleaseVersion(value.slice(1));
1914
+ }
1763
1915
 
1764
1916
  // ../../src/release/release-promotion.ts
1765
1917
  function order(a, b) {
@@ -1881,7 +2033,7 @@ import { join as join3, resolve } from "path";
1881
2033
  // ../../src/installer/command-artifact.ts
1882
2034
  import { lstat as lstat2, mkdir as mkdir2, mkdtemp as mkdtemp2, readFile as readFile3, readdir as readdir4, rm as rm2 } from "fs/promises";
1883
2035
  import { tmpdir } from "os";
1884
- import { basename, join as join2, relative as relative2, sep } from "path";
2036
+ import { basename, join as join2, relative as relative3, sep } from "path";
1885
2037
  import { c as create, t as list, x as extract } from "tar";
1886
2038
 
1887
2039
  // ../../src/installer/archive-entry.ts
@@ -1996,7 +2148,7 @@ async function collect(root, directory, entries) {
1996
2148
  for (const child of children) {
1997
2149
  const path = join2(directory, child.name);
1998
2150
  const info = await lstat2(path);
1999
- const name = relative2(root, path).split(sep).join("/");
2151
+ const name = relative3(root, path).split(sep).join("/");
2000
2152
  if (info.isDirectory()) {
2001
2153
  entries.push(name);
2002
2154
  await collect(root, path, entries);
@@ -2778,7 +2930,7 @@ function readPackageFile(bytes, path) {
2778
2930
  }
2779
2931
 
2780
2932
  // src/framework-package-publish.ts
2781
- var packageName = "@adea-ai/app-framework";
2933
+ var packageName2 = "@adea-ai/app-framework";
2782
2934
  var registryUrl = "https://registry.npmjs.org/";
2783
2935
  var VISIBILITY_SLEEPS = 32;
2784
2936
  var FIRST_VISIBILITY_DELAY_MS = 5000;
@@ -2848,12 +3000,12 @@ function publishProgram(options) {
2848
3000
  const manifest = yield* step(async () => JSON.parse(await fs.readFile("package.json", "utf8")));
2849
3001
  const version = provenance.releasedVersion;
2850
3002
  const archive = resolve4(options.archive);
2851
- if (provenance.repository !== "adea-ai/app-framework" || manifest.name !== packageName || manifest.version !== version || basename2(archive) !== `adea-ai-app-framework-${version}.tgz`)
3003
+ if (provenance.repository !== "adea-ai/app-framework" || manifest.name !== packageName2 || manifest.version !== version || basename2(archive) !== `adea-ai-app-framework-${version}.tgz`)
2852
3004
  return yield* refused("source-mismatch");
2853
3005
  const { bytes, integrity } = yield* archiveIntegrity(fs, archive);
2854
3006
  const packed = yield* step(async () => readPackageFile(bytes, "package/package.json"));
2855
3007
  const source = yield* step(async () => readPackageFile(bytes, "package/dist/framework-source.json"));
2856
- if (packed.name !== packageName || packed.version !== version || source.version !== version || source.commit !== sha)
3008
+ if (packed.name !== packageName2 || packed.version !== version || source.version !== version || source.commit !== sha)
2857
3009
  return yield* refused("not-from-checkout");
2858
3010
  const existing = yield* step(() => registry(version));
2859
3011
  if (existing !== null) {
@@ -3133,6 +3285,264 @@ var stageReleaseDescriptorsEffect = (options) => Effect15.gen(function* () {
3133
3285
  });
3134
3286
  var writeDescriptors = (directory, signed) => runReleaseLibrary(provideLibraryPorts()(writeDescriptorsEffect(directory, signed)));
3135
3287
  var stageReleaseDescriptors = (options) => runReleaseLibrary(provideLibraryPorts({ run: planGitHubRun(options.env, options.run) })(stageReleaseDescriptorsEffect(options)));
3288
+ // src/library/daily-matrix.ts
3289
+ import { join as join8 } from "path";
3290
+ import { Effect as Effect16 } from "effect";
3291
+
3292
+ // src/library/daily-native-evidence.ts
3293
+ var digest = (value) => typeof value === "string" && /^sha256:[a-f0-9]{64}$/.test(value);
3294
+ var record = (value, keys) => isRecord(value) && hasExactOwnKeys(value, keys);
3295
+ function assertDailyIdentity(identity) {
3296
+ if (!isReleaseTag(identity.tag) || !isGitSha(identity.sourceSha) || identity.workflowSha !== identity.sourceSha || typeof identity.runId !== "string" || !/^[1-9]\d{0,19}$/.test(identity.runId) || !Number.isSafeInteger(identity.runAttempt) || identity.runAttempt <= 0)
3297
+ throw new Error("Invalid exact Daily identity");
3298
+ }
3299
+ function validArtifact(value) {
3300
+ return record(value, ["name", "size", "digest"]) && typeof value.name === "string" && typeof value.size === "number" && Number.isSafeInteger(value.size) && value.size > 0 && digest(value.digest);
3301
+ }
3302
+ function originMatches(value, payloadName) {
3303
+ if (record(value, ["kind", "sourceSha"]))
3304
+ return value.kind === "published-installer" && isGitSha(value.sourceSha);
3305
+ return record(value, ["kind", "sourceSha", "payload"]) && value.kind === "private-from-verified-payload" && isGitSha(value.sourceSha) && validArtifact(value.payload) && value.payload.name === payloadName;
3306
+ }
3307
+ function observationsMatch(value, { identity, check, baselineNames }) {
3308
+ const version = identity.tag.slice(1);
3309
+ if (!record(value, check.format === "command" ? ["install", "command"] : ["install", "launch", "upgrade"]) || !record(value.install, ["version"]) || value.install.version !== version)
3310
+ return false;
3311
+ if (check.format === "command") {
3312
+ const cmd = value.command;
3313
+ return record(cmd, ["version", "probesPassed", "serviceStarted", "serviceStopped"]) && cmd.version === version && cmd.probesPassed === true && cmd.serviceStarted === true && cmd.serviceStopped === (check.platform === "windows-x64" ? "process-tree" : "sigterm");
3314
+ }
3315
+ const { launch, upgrade } = value;
3316
+ return record(launch, ["version", "ready"]) && launch.version === version && launch.ready === true && record(upgrade, [
3317
+ "baselineTag",
3318
+ "baselineAsset",
3319
+ "baselineOrigin",
3320
+ "baselineVersion",
3321
+ "upgradedVersion",
3322
+ "ready",
3323
+ "fixtureBefore",
3324
+ "fixtureAfter"
3325
+ ]) && isReleaseTag(upgrade.baselineTag) && versionLessThan(upgrade.baselineTag, identity.tag) && validArtifact(upgrade.baselineAsset) && upgrade.baselineAsset.name === baselineNames(upgrade.baselineTag).installer && originMatches(upgrade.baselineOrigin, baselineNames(upgrade.baselineTag).payload) && upgrade.baselineVersion === upgrade.baselineTag.slice(1) && upgrade.upgradedVersion === version && upgrade.ready === true && digest(upgrade.fixtureBefore) && upgrade.fixtureAfter === upgrade.fixtureBefore;
3326
+ }
3327
+ function validateDailyNativeEvidence(input, schema, context) {
3328
+ const { appId, identity, check, assets } = context;
3329
+ const [os, arch] = platformTargets[check.platform];
3330
+ if (!record(input, [
3331
+ "schema",
3332
+ "appId",
3333
+ "profile",
3334
+ "tag",
3335
+ "sourceSha",
3336
+ "workflowSha",
3337
+ "runId",
3338
+ "runAttempt",
3339
+ "check",
3340
+ "platform",
3341
+ "format",
3342
+ "host",
3343
+ "assets",
3344
+ "observations"
3345
+ ]) || input.schema !== schema || input.appId !== appId || input.profile !== "desktop-v1" || input.tag !== identity.tag || input.sourceSha !== identity.sourceSha || input.workflowSha !== identity.workflowSha || input.runId !== identity.runId || input.runAttempt !== identity.runAttempt || input.check !== check.name || input.platform !== check.platform || input.format !== check.format || !record(input.host, ["os", "arch"]) || input.host.os !== os || input.host.arch !== arch || !Array.isArray(input.assets) || input.assets.length !== assets.length)
3346
+ throw new Error(`Native receipt identity or result mismatch: ${check.name}`);
3347
+ for (const expected of assets) {
3348
+ const matches = input.assets.filter((item) => validArtifact(item) && item.name === expected.name);
3349
+ if (matches.length !== 1 || matches[0].size !== expected.size || matches[0].digest !== expected.digest)
3350
+ throw new Error(`Native receipt does not qualify staged bytes: ${check.name} / ${expected.name}`);
3351
+ }
3352
+ if (!observationsMatch(input.observations, context))
3353
+ throw new Error(`Missing or invalid native observations: ${check.name}`);
3354
+ return { host: { os, arch }, observations: input.observations };
3355
+ }
3356
+
3357
+ // src/library/daily-matrix.ts
3358
+ var desktopDailyProfile = "desktop-v1";
3359
+ var platforms = [
3360
+ "macos-arm64",
3361
+ "windows-x64",
3362
+ "linux-x64"
3363
+ ];
3364
+ var receiptLimit = 64 * 1024;
3365
+ function requireThat(ok, message) {
3366
+ if (!ok)
3367
+ throw new Error(message);
3368
+ }
3369
+ function planDailyReleaseMatrix(config, tag) {
3370
+ requireThat(isRecord(config) && config.dailyReleaseProfile === desktopDailyProfile && typeof config.appId === "string", "Missing supported Daily release profile");
3371
+ const parsed = parseReleaseConfig(config);
3372
+ const requirements = parsed.requirements(tag);
3373
+ const checks = [];
3374
+ for (const platform of platforms) {
3375
+ const pair = requirements.platforms[platform];
3376
+ requireThat(pair?.length === 2, `Expected installer and updater archive for ${platform}`);
3377
+ const [installer, archive] = pair;
3378
+ const suffix = platform === "macos-arm64" ? ".dmg" : platform === "windows-x64" ? "-Setup.zip" : "-Setup.tar.gz";
3379
+ requireThat(installer.endsWith(suffix) && archive.endsWith(".tar.zst"), `Unexpected desktop installer or updater format for ${platform}`);
3380
+ const format = platform === "macos-arm64" ? "dmg" : platform === "windows-x64" ? "windows-setup" : "portable-linux";
3381
+ checks.push({ name: `installer-${platform}`, platform, format, assets: pair });
3382
+ for (const command of parsed.commandArtifacts) {
3383
+ const name = requirements.commandArtifacts?.[command.kind]?.[platform];
3384
+ requireThat(name, `Missing command archive for ${platform}`);
3385
+ checks.push({
3386
+ name: `command-${command.kind}-${platform}`,
3387
+ platform,
3388
+ format: "command",
3389
+ assets: [name]
3390
+ });
3391
+ }
3392
+ }
3393
+ const linux = "linux-x64";
3394
+ const base = requirements.platforms[linux][1].slice(0, -".tar.zst".length);
3395
+ checks.push({ name: "deb-linux-x64", platform: linux, format: "deb", assets: [base + ".deb"] }, {
3396
+ name: "appimage-linux-x64",
3397
+ platform: linux,
3398
+ format: "appimage",
3399
+ assets: [base + ".AppImage"]
3400
+ });
3401
+ const names = checks.flatMap((check) => check.assets);
3402
+ discoveryPolicies(config, tag);
3403
+ const all = [...names, ...requirements.releaseAssets];
3404
+ requireThat(new Set(all).size === all.length, "Daily release assets are not unique");
3405
+ return { appId: config.appId, profile: desktopDailyProfile, assets: all, checks };
3406
+ }
3407
+ function priorDailyInstallerNames(config, tag, check) {
3408
+ const plan = planDailyReleaseMatrix(config, tag);
3409
+ return {
3410
+ installer: plan.checks.find((entry) => entry.name === check.name)?.assets[0],
3411
+ payload: plan.checks.find((entry) => entry.name === `installer-${check.platform}`)?.assets[1]
3412
+ };
3413
+ }
3414
+ function exactDirectory(root, names) {
3415
+ return Effect16.gen(function* () {
3416
+ const fs = yield* ReleaseFs;
3417
+ const stat = yield* step(() => fs.lstat(root));
3418
+ if (!stat.isDirectory() || stat.isSymbolicLink())
3419
+ return yield* fail("Expected real matrix input directory");
3420
+ const entries = yield* step(() => fs.readdir(root, { withFileTypes: true }));
3421
+ const expected = new Set(names);
3422
+ if (entries.length !== expected.size || entries.some((e) => !e.isFile() || !expected.has(e.name)))
3423
+ return yield* fail("Matrix directory must contain exactly the required regular files");
3424
+ });
3425
+ }
3426
+ function readNativeReceipt(path, label) {
3427
+ return Effect16.gen(function* () {
3428
+ const fs = yield* ReleaseFs;
3429
+ const stat = yield* step(() => fs.lstat(path));
3430
+ if (!stat.isFile() || stat.isSymbolicLink() || stat.size < 1 || stat.size > receiptLimit)
3431
+ return yield* fail(`Invalid native receipt size or type: ${label}`);
3432
+ const { file, before } = yield* Effect16.acquireRelease(step(() => openUnchangedFile(path, stat, "Native receipt changed before opening")), ({ file: opened }) => Effect16.promise(() => opened.close().catch(() => {
3433
+ return;
3434
+ })));
3435
+ const data = yield* step(async () => {
3436
+ const bytes = Buffer.alloc(before.size);
3437
+ let offset = 0;
3438
+ while (offset < bytes.length) {
3439
+ const { bytesRead } = await file.read(bytes, offset, bytes.length - offset, offset);
3440
+ if (!bytesRead)
3441
+ throw new Error("Native receipt changed during read");
3442
+ offset += bytesRead;
3443
+ }
3444
+ const after = await file.stat();
3445
+ if (!sameFile(before, after) || before.ctimeMs !== after.ctimeMs)
3446
+ throw new Error("Native receipt changed during read");
3447
+ return bytes.toString("utf8");
3448
+ });
3449
+ return yield* attempt(() => {
3450
+ try {
3451
+ return JSON.parse(data);
3452
+ } catch {
3453
+ throw new Error(`Invalid native receipt JSON: ${label}`);
3454
+ }
3455
+ });
3456
+ }).pipe(Effect16.scoped);
3457
+ }
3458
+ var verifyDailyReleaseMatrixEffect = (options) => Effect16.gen(function* () {
3459
+ const { config, identity, artifacts, receipts } = options;
3460
+ const { tag } = identity;
3461
+ yield* attempt(() => assertDailyIdentity(identity));
3462
+ const matrix = yield* attempt(() => planDailyReleaseMatrix(config, tag));
3463
+ yield* exactDirectory(artifacts, matrix.assets);
3464
+ yield* exactDirectory(receipts, matrix.checks.map((c) => c.name + ".json"));
3465
+ const inventory = new Map;
3466
+ for (const name of matrix.assets)
3467
+ inventory.set(name, yield* fileIdentityEffect(join8(artifacts, name), name));
3468
+ for (const check of matrix.checks) {
3469
+ const r = yield* readNativeReceipt(join8(receipts, check.name + ".json"), check.name);
3470
+ yield* attempt(() => validateDailyNativeEvidence(r, "framework/daily-native-receipt/v2", {
3471
+ appId: matrix.appId,
3472
+ identity,
3473
+ check,
3474
+ assets: check.assets.map((name) => inventory.get(name)),
3475
+ baselineNames: (priorTag) => priorDailyInstallerNames(config, priorTag, check)
3476
+ }));
3477
+ }
3478
+ return {
3479
+ profile: matrix.profile,
3480
+ appId: matrix.appId,
3481
+ identity,
3482
+ assets: [...inventory.values()]
3483
+ };
3484
+ });
3485
+ function verifyDailyReleaseMatrix(options) {
3486
+ return runReleaseLibrary(provideLibraryPorts()(verifyDailyReleaseMatrixEffect(options)));
3487
+ }
3488
+ // src/library/daily-native-receipt.ts
3489
+ import { join as join9 } from "path";
3490
+ import { Effect as Effect17 } from "effect";
3491
+ var createDailyNativeReceiptEffect = (options, worker) => Effect17.gen(function* () {
3492
+ const { config, identity, artifacts, checkName, report } = options;
3493
+ yield* attempt(() => assertDailyIdentity(identity));
3494
+ const matrix = yield* attempt(() => planDailyReleaseMatrix(config, identity.tag));
3495
+ const check = matrix.checks.find(({ name }) => name === checkName);
3496
+ if (!check)
3497
+ return yield* fail("Unknown Daily native check");
3498
+ const [os, arch] = platformTargets[check.platform];
3499
+ if (worker.os !== os || worker.arch !== arch)
3500
+ return yield* fail(`Daily native check requires ${check.platform}`);
3501
+ const fs = yield* ReleaseFs;
3502
+ const dir = yield* step(() => fs.lstat(artifacts));
3503
+ if (!dir.isDirectory() || dir.isSymbolicLink())
3504
+ return yield* fail("Expected real native artifact directory");
3505
+ const assets = yield* Effect17.forEach(check.assets, (name) => fileIdentityEffect(join9(artifacts, name), name));
3506
+ const evidence = yield* attempt(() => validateDailyNativeEvidence(report, "framework/daily-native-job/v1", {
3507
+ appId: matrix.appId,
3508
+ identity,
3509
+ check,
3510
+ assets,
3511
+ baselineNames: (tag) => priorDailyInstallerNames(config, tag, check)
3512
+ }));
3513
+ if ("upgrade" in evidence.observations) {
3514
+ if (!options.baselineArtifacts)
3515
+ return yield* fail("Daily desktop check requires the exact baseline installer");
3516
+ const baselineDirectory = options.baselineArtifacts;
3517
+ const info = yield* step(() => fs.lstat(baselineDirectory));
3518
+ if (!info.isDirectory() || info.isSymbolicLink())
3519
+ return yield* fail("Expected real native baseline directory");
3520
+ const { baselineAsset, baselineOrigin } = evidence.observations.upgrade;
3521
+ const proofFiles = baselineOrigin.kind === "private-from-verified-payload" ? [baselineAsset, baselineOrigin.payload] : [baselineAsset];
3522
+ for (const expected of proofFiles) {
3523
+ const observed = yield* fileIdentityEffect(join9(baselineDirectory, expected.name), expected.name);
3524
+ if (observed.size !== expected.size || observed.digest !== expected.digest)
3525
+ return yield* fail("Daily desktop baseline installer or prior payload differs from native observations");
3526
+ }
3527
+ }
3528
+ return {
3529
+ ...identity,
3530
+ ...evidence,
3531
+ schema: "framework/daily-native-receipt/v2",
3532
+ appId: matrix.appId,
3533
+ profile: matrix.profile,
3534
+ check: check.name,
3535
+ platform: check.platform,
3536
+ format: check.format,
3537
+ assets
3538
+ };
3539
+ });
3540
+ function createDailyNativeReceipt(options) {
3541
+ return runReleaseLibrary(provideLibraryPorts()(createDailyNativeReceiptEffect(options, {
3542
+ os: process.platform,
3543
+ arch: process.arch
3544
+ })));
3545
+ }
3136
3546
  // src/library/macos-dmg.ts
3137
3547
  import { execFileSync } from "child_process";
3138
3548
  import {
@@ -3144,8 +3554,8 @@ import {
3144
3554
  rmSync,
3145
3555
  symlinkSync
3146
3556
  } from "fs";
3147
- import { basename as basename4, dirname, join as join8, resolve as resolve6 } from "path";
3148
- import { Context as Context2, Effect as Effect16 } from "effect";
3557
+ import { basename as basename4, dirname, join as join10, resolve as resolve6 } from "path";
3558
+ import { Context as Context2, Effect as Effect18 } from "effect";
3149
3559
 
3150
3560
  // ../../src/release/macos-dmg.ts
3151
3561
  var MIB = 1024 * 1024;
@@ -3176,7 +3586,7 @@ function treeSize(root) {
3176
3586
  logicalBytes += info.size;
3177
3587
  else if (info.isDirectory())
3178
3588
  for (const name of readdirSync(path))
3179
- pending.push(join8(path, name));
3589
+ pending.push(join10(path, name));
3180
3590
  else if (!info.isSymbolicLink())
3181
3591
  throw new Error("Unsupported disk image entry");
3182
3592
  if (!Number.isSafeInteger(logicalBytes))
@@ -3184,16 +3594,16 @@ function treeSize(root) {
3184
3594
  }
3185
3595
  return { logicalBytes, entries };
3186
3596
  }
3187
- var verifyImageEffect = (image) => Effect16.gen(function* () {
3597
+ var verifyImageEffect = (image) => Effect18.gen(function* () {
3188
3598
  const host = yield* MacosHost;
3189
3599
  for (let tries = 1;; tries++) {
3190
- const verified = yield* attempt(() => host.run("/usr/bin/hdiutil", ["verify", image])).pipe(Effect16.as(true), Effect16.catchIf(() => tries < 6, () => Effect16.succeed(false)));
3600
+ const verified = yield* attempt(() => host.run("/usr/bin/hdiutil", ["verify", image])).pipe(Effect18.as(true), Effect18.catchIf(() => tries < 6, () => Effect18.succeed(false)));
3191
3601
  if (verified)
3192
3602
  return;
3193
3603
  host.wait(5000 * 2 ** (tries - 1));
3194
3604
  }
3195
3605
  });
3196
- var createMacosDmgEffect = (options) => Effect16.gen(function* () {
3606
+ var createMacosDmgEffect = (options) => Effect18.gen(function* () {
3197
3607
  const host = yield* MacosHost;
3198
3608
  if (host.platform !== "darwin")
3199
3609
  return yield* fail("Disk image creation requires macOS");
@@ -3202,11 +3612,11 @@ var createMacosDmgEffect = (options) => Effect16.gen(function* () {
3202
3612
  const info = yield* attempt(() => lstatSync(app));
3203
3613
  if (!app.endsWith(".app") || !info.isDirectory() || info.isSymbolicLink() || !output.endsWith(".dmg"))
3204
3614
  return yield* fail("Invalid disk image paths");
3205
- const staging = yield* Effect16.acquireRelease(attempt(() => mkdtempSync(join8(dirname(output), ".framework-dmg-"))), (path) => Effect16.sync(() => rmSync(path, { recursive: true, force: true })));
3206
- const payload = join8(staging, "payload"), image = join8(staging, "result.dmg");
3615
+ const staging = yield* Effect18.acquireRelease(attempt(() => mkdtempSync(join10(dirname(output), ".framework-dmg-"))), (path) => Effect18.sync(() => rmSync(path, { recursive: true, force: true })));
3616
+ const payload = join10(staging, "payload"), image = join10(staging, "result.dmg");
3207
3617
  yield* attempt(() => mkdirSync(payload));
3208
- yield* attempt(() => host.run("/usr/bin/ditto", [app, join8(payload, basename4(app))]));
3209
- yield* attempt(() => symlinkSync("/Applications", join8(payload, "Applications")));
3618
+ yield* attempt(() => host.run("/usr/bin/ditto", [app, join10(payload, basename4(app))]));
3619
+ yield* attempt(() => symlinkSync("/Applications", join10(payload, "Applications")));
3210
3620
  const capacityMiB = yield* attempt(() => dmgCapacityMiB(treeSize(payload)));
3211
3621
  yield* attempt(() => host.run("/usr/bin/hdiutil", [
3212
3622
  "create",
@@ -3223,31 +3633,31 @@ var createMacosDmgEffect = (options) => Effect16.gen(function* () {
3223
3633
  yield* verifyImageEffect(image);
3224
3634
  yield* attempt(() => linkSync(image, output));
3225
3635
  return { capacityMiB };
3226
- }).pipe(Effect16.scoped);
3636
+ }).pipe(Effect18.scoped);
3227
3637
  function verifyImage(image, io = liveHost) {
3228
- runReleaseLibrarySync(verifyImageEffect(image).pipe(Effect16.provideService(MacosHost, {
3638
+ runReleaseLibrarySync(verifyImageEffect(image).pipe(Effect18.provideService(MacosHost, {
3229
3639
  run: (command, args) => io.run(command, args),
3230
3640
  wait: (milliseconds) => io.wait(milliseconds),
3231
3641
  platform: process.platform
3232
3642
  })));
3233
3643
  }
3234
3644
  function createMacosDmg(options) {
3235
- return runReleaseLibrarySync(createMacosDmgEffect(options).pipe(Effect16.provideService(MacosHost, liveHost)));
3645
+ return runReleaseLibrarySync(createMacosDmgEffect(options).pipe(Effect18.provideService(MacosHost, liveHost)));
3236
3646
  }
3237
3647
  // src/library/qualification-run.ts
3238
- import { Effect as Effect19 } from "effect";
3648
+ import { Effect as Effect21 } from "effect";
3239
3649
 
3240
3650
  // src/library/local-release.ts
3241
3651
  import { createHash as createHash8 } from "crypto";
3242
3652
  import { constants as constants3 } from "fs";
3243
- import { dirname as dirname2, join as join10, resolve as resolve8 } from "path";
3244
- import { Cause as Cause2, Effect as Effect18, Exit as Exit3 } from "effect";
3653
+ import { dirname as dirname2, join as join12, resolve as resolve8 } from "path";
3654
+ import { Cause as Cause2, Effect as Effect20, Exit as Exit3 } from "effect";
3245
3655
 
3246
3656
  // ../../src/native/native-rename.ts
3247
3657
  import { randomUUID } from "crypto";
3248
3658
  import { mkdir as mkdir3, readFile as readFile5, rm as rm3, writeFile as writeFile3 } from "fs/promises";
3249
3659
  import { dlopen, FFIType, ptr } from "bun:ffi";
3250
- import { join as join9 } from "path";
3660
+ import { join as join11 } from "path";
3251
3661
 
3252
3662
  // ../../src/native/canonical-path.ts
3253
3663
  import { isAbsolute as isAbsolute2, resolve as resolve7 } from "path";
@@ -3326,8 +3736,8 @@ async function probeDirectoryExchange(parent, exchange = exchangeDirectories) {
3326
3736
  if (!isCanonicalPath(parent))
3327
3737
  throw new Error("Invalid directory exchange probe parent");
3328
3738
  const id = randomUUID();
3329
- const first = join9(parent, `.framework-exchange-probe-${id}-a`);
3330
- const second = join9(parent, `.framework-exchange-probe-${id}-b`);
3739
+ const first = join11(parent, `.framework-exchange-probe-${id}-a`);
3740
+ const second = join11(parent, `.framework-exchange-probe-${id}-b`);
3331
3741
  const marker = "exchange-probe";
3332
3742
  const firstValue = `${id}:first`;
3333
3743
  const secondValue = `${id}:second`;
@@ -3338,12 +3748,12 @@ async function probeDirectoryExchange(parent, exchange = exchangeDirectories) {
3338
3748
  firstCreated = true;
3339
3749
  await mkdir3(second, { mode: 448 });
3340
3750
  secondCreated = true;
3341
- await writeFile3(join9(first, marker), firstValue, { flag: "wx", mode: 384 });
3342
- await writeFile3(join9(second, marker), secondValue, { flag: "wx", mode: 384 });
3751
+ await writeFile3(join11(first, marker), firstValue, { flag: "wx", mode: 384 });
3752
+ await writeFile3(join11(second, marker), secondValue, { flag: "wx", mode: 384 });
3343
3753
  exchange(first, second);
3344
3754
  const [firstAfter, secondAfter] = await Promise.all([
3345
- readFile5(join9(first, marker), "utf8"),
3346
- readFile5(join9(second, marker), "utf8")
3755
+ readFile5(join11(first, marker), "utf8"),
3756
+ readFile5(join11(second, marker), "utf8")
3347
3757
  ]);
3348
3758
  if (firstAfter !== secondValue || secondAfter !== firstValue)
3349
3759
  throw new Error("Directory exchange did not exchange both probe trees");
@@ -3409,7 +3819,7 @@ function createFeedReleaseCutProvider(options) {
3409
3819
 
3410
3820
  // src/library/feed-state.ts
3411
3821
  import { createHash as createHash7 } from "crypto";
3412
- import { Effect as Effect17 } from "effect";
3822
+ import { Effect as Effect19 } from "effect";
3413
3823
 
3414
3824
  // ../../src/shared/discard-stream.ts
3415
3825
  function discardStream(stream) {
@@ -3569,11 +3979,11 @@ var json = (bytes) => {
3569
3979
  throw new Error("Invalid release feed response");
3570
3980
  }
3571
3981
  };
3572
- var feedObject = (feed, path, maximum) => Effect17.gen(function* () {
3982
+ var feedObject = (feed, path, maximum) => Effect19.gen(function* () {
3573
3983
  const { fetch: fetch2 } = yield* ReleaseFetch;
3574
3984
  return yield* step(() => readFeedObject(feed, path, fetch2, maximum));
3575
3985
  });
3576
- var readFeedLedgerEffect = (feed) => Effect17.gen(function* () {
3986
+ var readFeedLedgerEffect = (feed) => Effect19.gen(function* () {
3577
3987
  const bytes = yield* feedObject(feed, "index.json", MAX_LEDGER_BYTES);
3578
3988
  const ledger = bytes ? yield* attempt(() => parseReleaseLedger(json(bytes), feed.app)) : null;
3579
3989
  if (ledger && ledger.releases.length > 0)
@@ -3585,7 +3995,7 @@ var readFeedLedgerEffect = (feed) => Effect17.gen(function* () {
3585
3995
  }
3586
3996
  return ledger ?? { schema: 1, app: feed.app, releases: [] };
3587
3997
  });
3588
- var readFeedReleaseEffect = (feed, tag) => Effect17.gen(function* () {
3998
+ var readFeedReleaseEffect = (feed, tag) => Effect19.gen(function* () {
3589
3999
  const bytes = yield* feedObject(feed, `${tag}/release.json`, MAX_RELEASE_BYTES);
3590
4000
  if (!bytes)
3591
4001
  return null;
@@ -3635,10 +4045,10 @@ class ReleaseFeedSnapshotChanged extends Error {
3635
4045
  var snapshotChanged = step(async () => {
3636
4046
  throw new ReleaseFeedSnapshotChanged;
3637
4047
  });
3638
- var verifyFeedReleaseEffect = (options) => Effect17.gen(function* () {
4048
+ var verifyFeedReleaseEffect = (options) => Effect19.gen(function* () {
3639
4049
  const { config, feed, tag } = options;
3640
4050
  const { fetch: fetcher } = yield* ReleaseFetch;
3641
- const ledger = yield* readFeedLedgerEffect(feed).pipe(Effect17.catchIf(() => options.expectedLedger !== undefined, () => snapshotChanged));
4051
+ const ledger = yield* readFeedLedgerEffect(feed).pipe(Effect19.catchIf(() => options.expectedLedger !== undefined, () => snapshotChanged));
3642
4052
  if (options.expectedLedger && JSON.stringify(ledger) !== JSON.stringify(options.expectedLedger))
3643
4053
  return yield* snapshotChanged;
3644
4054
  const release = yield* readFeedReleaseEffect(feed, tag);
@@ -3701,13 +4111,13 @@ var timestamp2 = (value) => {
3701
4111
  throw new Error("Invalid release clock");
3702
4112
  return new Date(value).toISOString();
3703
4113
  };
3704
- var exactFiles = (directory, names) => Effect18.gen(function* () {
4114
+ var exactFiles = (directory, names) => Effect20.gen(function* () {
3705
4115
  const fs = yield* ReleaseFs;
3706
4116
  const entries = yield* step(() => fs.readdir(directory, { withFileTypes: true }));
3707
4117
  if (entries.length !== names.length || entries.some((entry) => !entry.isFile() || !names.includes(entry.name)))
3708
4118
  return yield* fail("Staged directory does not hold exactly the platform release files");
3709
4119
  });
3710
- var promised2 = Effect18.gen(function* () {
4120
+ var promised2 = Effect20.gen(function* () {
3711
4121
  const fs = yield* ReleaseFs;
3712
4122
  const { fetch: fetch2 } = yield* ReleaseFetch;
3713
4123
  const { run: git } = yield* ReleaseGit;
@@ -3717,7 +4127,7 @@ var promised2 = Effect18.gen(function* () {
3717
4127
  run: (effect) => runReleaseLibrary(provideLibraryPorts({ fs, fetch: fetch2, git })(effect))
3718
4128
  };
3719
4129
  });
3720
- var runLocalReleaseCutEffect = (options) => Effect18.gen(function* () {
4130
+ var runLocalReleaseCutEffect = (options) => Effect20.gen(function* () {
3721
4131
  const { kind, platform } = options;
3722
4132
  const parsed = parseReleaseConfig(options.config);
3723
4133
  const provenance = yield* resolveLocalProvenanceEffect({
@@ -3742,7 +4152,7 @@ var runLocalReleaseCutEffect = (options) => Effect18.gen(function* () {
3742
4152
  }));
3743
4153
  return { ...result, version: result.tag.slice(1), platform };
3744
4154
  });
3745
- var localTagProvenanceEffect = (options) => Effect18.gen(function* () {
4155
+ var localTagProvenanceEffect = (options) => Effect20.gen(function* () {
3746
4156
  const parsed = parseReleaseConfig(options.config);
3747
4157
  parsed.requirements(options.tag);
3748
4158
  const provenance = yield* resolveLocalProvenanceEffect({
@@ -3753,7 +4163,7 @@ var localTagProvenanceEffect = (options) => Effect18.gen(function* () {
3753
4163
  return yield* fail("Release tag does not belong to the source version");
3754
4164
  return { repository: provenance.repository };
3755
4165
  });
3756
- var stageLocalDescriptorsEffect = (options) => Effect18.gen(function* () {
4166
+ var stageLocalDescriptorsEffect = (options) => Effect20.gen(function* () {
3757
4167
  const { tag, platform } = options;
3758
4168
  const local = localConfig(options.config);
3759
4169
  if (!/^[1-9]\d{0,19}$/.test(options.runId) || !isGitSha(options.sourceSha))
@@ -3762,7 +4172,7 @@ var stageLocalDescriptorsEffect = (options) => Effect18.gen(function* () {
3762
4172
  const payloads = platformPayloads(local.requirements(tag), platform);
3763
4173
  const directory = resolve8(options.directory);
3764
4174
  yield* exactFiles(directory, payloads);
3765
- const assets = yield* Effect18.forEach(payloads, (name) => fileIdentityEffect(join10(directory, name), name), { concurrency: "unbounded" });
4175
+ const assets = yield* Effect20.forEach(payloads, (name) => fileIdentityEffect(join12(directory, name), name), { concurrency: "unbounded" });
3766
4176
  const signed = signDiscoveryDescriptors({
3767
4177
  policies: discoveryPolicies(local.config, tag).filter((policy) => policy.platform === platform),
3768
4178
  assets,
@@ -3780,7 +4190,7 @@ var stageLocalDescriptorsEffect = (options) => Effect18.gen(function* () {
3780
4190
  privateKey: options.privateKey
3781
4191
  });
3782
4192
  for (const asset of assets)
3783
- if (JSON.stringify(yield* fileIdentityEffect(join10(directory, asset.name), asset.name)) !== JSON.stringify(asset))
4193
+ if (JSON.stringify(yield* fileIdentityEffect(join12(directory, asset.name), asset.name)) !== JSON.stringify(asset))
3784
4194
  return yield* fail("Staged payload changed before signing");
3785
4195
  yield* writeDescriptorsEffect(directory, signed);
3786
4196
  return signed.map((value) => value.name);
@@ -3804,18 +4214,18 @@ var describe = (key, bytes, cacheControl) => ({
3804
4214
  contentType: "application/json",
3805
4215
  cacheControl
3806
4216
  });
3807
- var writeStagedTree = (out, feed, assets, documents) => Effect18.gen(function* () {
4217
+ var writeStagedTree = (out, feed, assets, documents) => Effect20.gen(function* () {
3808
4218
  const fs = yield* ReleaseFs;
3809
4219
  const root = resolve8(out);
3810
- const exists = yield* step(() => fs.lstat(root)).pipe(Effect18.as(true), Effect18.catchIf((failure) => errorCode(failure.original) === "ENOENT", () => Effect18.succeed(false)));
4220
+ const exists = yield* step(() => fs.lstat(root)).pipe(Effect20.as(true), Effect20.catchIf((failure) => errorCode(failure.original) === "ENOENT", () => Effect20.succeed(false)));
3811
4221
  if (exists)
3812
4222
  return yield* fail("Release output directory already exists");
3813
4223
  yield* step(() => fs.mkdir(dirname2(root), { recursive: true, mode: 448 }));
3814
- const staging = yield* step(() => fs.mkdtemp(join10(dirname2(root), ".release-staging-")));
3815
- const exit = yield* Effect18.exit(Effect18.gen(function* () {
4224
+ const staging = yield* step(() => fs.mkdtemp(join12(dirname2(root), ".release-staging-")));
4225
+ const exit = yield* Effect20.exit(Effect20.gen(function* () {
3816
4226
  const objects = [];
3817
4227
  for (const { key, path, artifact } of assets) {
3818
- const target = join10(staging, key);
4228
+ const target = join12(staging, key);
3819
4229
  yield* step(() => fs.mkdir(dirname2(target), { recursive: true, mode: 448 }));
3820
4230
  yield* step(() => fs.copyFile(path, target, constants3.COPYFILE_EXCL));
3821
4231
  if (JSON.stringify(yield* fileIdentityEffect(target, artifact.name)) !== JSON.stringify(artifact))
@@ -3829,13 +4239,13 @@ var writeStagedTree = (out, feed, assets, documents) => Effect18.gen(function* (
3829
4239
  });
3830
4240
  }
3831
4241
  for (const { key, bytes } of documents) {
3832
- const target = join10(staging, key);
4242
+ const target = join12(staging, key);
3833
4243
  yield* step(() => fs.mkdir(dirname2(target), { recursive: true, mode: 448 }));
3834
4244
  yield* step(() => fs.writeFile(target, bytes, { flag: "wx", mode: 384 }));
3835
4245
  objects.push(describe(key, bytes, MUTABLE));
3836
4246
  }
3837
4247
  const plan = { schema: 1, base: feed.base, objects };
3838
- yield* step(() => fs.writeFile(join10(staging, UPLOAD_PLAN), jsonBytes(plan), { flag: "wx", mode: 384 }));
4248
+ yield* step(() => fs.writeFile(join12(staging, UPLOAD_PLAN), jsonBytes(plan), { flag: "wx", mode: 384 }));
3839
4249
  yield* attempt(() => renameExclusive(staging, root));
3840
4250
  return plan;
3841
4251
  }));
@@ -3843,10 +4253,10 @@ var writeStagedTree = (out, feed, assets, documents) => Effect18.gen(function* (
3843
4253
  return exit.value;
3844
4254
  const error = Cause2.squash(exit.cause);
3845
4255
  const original = error instanceof ReleaseFailure ? error.original ?? error : error;
3846
- const cleanup = yield* Effect18.exit(step(() => fs.rm(staging, { recursive: true, force: true })));
4256
+ const cleanup = yield* Effect20.exit(step(() => fs.rm(staging, { recursive: true, force: true })));
3847
4257
  if (Exit3.isFailure(cleanup)) {
3848
4258
  const cleanupError = Cause2.squash(cleanup.cause);
3849
- return yield* Effect18.fail(new ReleaseFailure({
4259
+ return yield* Effect20.fail(new ReleaseFailure({
3850
4260
  reason: "cleanup",
3851
4261
  message: "Release staging failed and its private temporary tree could not be removed",
3852
4262
  original: new AggregateError([
@@ -3855,8 +4265,8 @@ var writeStagedTree = (out, feed, assets, documents) => Effect18.gen(function* (
3855
4265
  ], "Release staging failed and its private temporary tree could not be removed", { cause: original })
3856
4266
  }));
3857
4267
  }
3858
- return yield* Effect18.failCause(exit.cause);
3859
- }).pipe(Effect18.uninterruptible);
4268
+ return yield* Effect20.failCause(exit.cause);
4269
+ }).pipe(Effect20.uninterruptible);
3860
4270
  function releaseDocuments(feed, ledger, release) {
3861
4271
  return [
3862
4272
  { key: feedReleaseKey(feed, release.tag), bytes: jsonBytes(release) },
@@ -3873,7 +4283,7 @@ function releaseDocuments(feed, ledger, release) {
3873
4283
  }))
3874
4284
  ];
3875
4285
  }
3876
- var stageLocalReleaseEffect = (options) => Effect18.gen(function* () {
4286
+ var stageLocalReleaseEffect = (options) => Effect20.gen(function* () {
3877
4287
  const fs = yield* ReleaseFs;
3878
4288
  const { tag, sourceSha, platform } = options;
3879
4289
  const local = localConfig(options.config);
@@ -3883,12 +4293,12 @@ var stageLocalReleaseEffect = (options) => Effect18.gen(function* () {
3883
4293
  const directory = resolve8(options.directory);
3884
4294
  const names = [...payloads, ...policies.map((policy) => policy.name)];
3885
4295
  yield* exactFiles(directory, names);
3886
- const staged = yield* Effect18.forEach(names, (name) => fileIdentityEffect(join10(directory, name), name), { concurrency: "unbounded" });
4296
+ const staged = yield* Effect20.forEach(names, (name) => fileIdentityEffect(join12(directory, name), name), { concurrency: "unbounded" });
3887
4297
  for (const policy of policies) {
3888
4298
  const artifact = staged.find((asset) => asset.name === policy.name);
3889
4299
  if (artifact.size > 65536)
3890
4300
  return yield* fail("Signed descriptor is too large");
3891
- const bytes = yield* step(() => fs.readFile(join10(directory, policy.name)));
4301
+ const bytes = yield* step(() => fs.readFile(join12(directory, policy.name)));
3892
4302
  if ("sha256:" + createHash8("sha256").update(bytes).digest("hex") !== artifact.digest)
3893
4303
  return yield* fail("Signed descriptor changed");
3894
4304
  let parsed;
@@ -3910,7 +4320,7 @@ var stageLocalReleaseEffect = (options) => Effect18.gen(function* () {
3910
4320
  if (!verified.ok || verified.descriptor.tag !== tag || verified.descriptor.sourceSha !== sourceSha || verified.descriptor.workflowSha !== sourceSha || verified.descriptor.asset.name !== payload.name || verified.descriptor.asset.size !== payload.size || "sha256:" + verified.descriptor.asset.sha256 !== payload.digest)
3911
4321
  return yield* fail(`Untrusted signed descriptor: ${policy.name}`);
3912
4322
  }
3913
- const [ledger, remote] = yield* Effect18.all([readFeedLedgerEffect(feed), readFeedReleaseEffect(feed, tag)], { concurrency: "unbounded" });
4323
+ const [ledger, remote] = yield* Effect20.all([readFeedLedgerEffect(feed), readFeedReleaseEffect(feed, tag)], { concurrency: "unbounded" });
3914
4324
  const entry = ledger.releases.find((item) => item.tag === tag);
3915
4325
  if (Boolean(entry) !== Boolean(remote) || entry && remote && (entry.kind !== remote.channel || Date.parse(entry.publishedAt) !== Date.parse(remote.publishedAt)))
3916
4326
  return yield* fail("Inconsistent feed release; reconcile publication before retrying");
@@ -3928,7 +4338,7 @@ var stageLocalReleaseEffect = (options) => Effect18.gen(function* () {
3928
4338
  merged.push({ name: artifact.name, size: artifact.size, sha256: artifact.digest.slice(7) });
3929
4339
  uploads.push({
3930
4340
  key: feedAssetKey(feed, tag, artifact.name),
3931
- path: join10(directory, artifact.name),
4341
+ path: join12(directory, artifact.name),
3932
4342
  artifact
3933
4343
  });
3934
4344
  }
@@ -3961,7 +4371,7 @@ function stablePlatforms(config) {
3961
4371
  throw new Error("Invalid stablePlatforms in the release configuration");
3962
4372
  return value;
3963
4373
  }
3964
- var verifyLocalReleaseEffect = (options) => Effect18.gen(function* () {
4374
+ var verifyLocalReleaseEffect = (options) => Effect20.gen(function* () {
3965
4375
  const local = localConfig(options.config);
3966
4376
  const { release, platforms } = yield* verifyFeedReleaseEffect({
3967
4377
  config: local.config,
@@ -3977,7 +4387,7 @@ var verifyLocalReleaseEffect = (options) => Effect18.gen(function* () {
3977
4387
  missing: Object.keys(platformTargets).filter((platform) => !platforms.includes(platform))
3978
4388
  };
3979
4389
  });
3980
- var runLocalPromotionEffect = (options) => Effect18.gen(function* () {
4390
+ var runLocalPromotionEffect = (options) => Effect20.gen(function* () {
3981
4391
  const local = localConfig(options.config);
3982
4392
  const feed = local.feed;
3983
4393
  const required = stablePlatforms(local.config);
@@ -4035,7 +4445,7 @@ var runLocalPromotionEffect = (options) => Effect18.gen(function* () {
4035
4445
  const verification = qualified.get(selected.tag);
4036
4446
  const absent = Object.keys(platformTargets).filter((name) => !verification?.platforms.includes(name));
4037
4447
  const entry = ledger.releases.find((item) => item.tag === selected.tag);
4038
- const [currentLedger, remote] = await run(Effect18.all([readFeedLedgerEffect(feed), readFeedReleaseEffect(feed, selected.tag)], {
4448
+ const [currentLedger, remote] = await run(Effect20.all([readFeedLedgerEffect(feed), readFeedReleaseEffect(feed, selected.tag)], {
4039
4449
  concurrency: "unbounded"
4040
4450
  }));
4041
4451
  if (!entry || !remote || !verification || entry.kind === "dev" || JSON.stringify(currentLedger) !== JSON.stringify(ledger) || JSON.stringify(remote) !== JSON.stringify(verification.release))
@@ -4074,7 +4484,7 @@ var runLocalPromotionEffect = (options) => Effect18.gen(function* () {
4074
4484
 
4075
4485
  // src/library/qualification-run.ts
4076
4486
  var REFUSAL = "Qualification requires a GitHub release-assets run, a GitLab tag pipeline or a CircleCI tag workflow";
4077
- var tagRun = (options) => Effect19.gen(function* () {
4487
+ var tagRun = (options) => Effect21.gen(function* () {
4078
4488
  const { tag, sha, runId } = options;
4079
4489
  if (options.tagName !== tag || !isGitSha(sha) || !/^[1-9]\d{0,19}$/.test(runId ?? "") || !/^v\d+\.\d+\.\d+$/.test(tag) || tag.length > 65)
4080
4490
  return yield* fail(REFUSAL);
@@ -4088,7 +4498,7 @@ var tagRun = (options) => Effect19.gen(function* () {
4088
4498
  runAttempt: 1
4089
4499
  };
4090
4500
  });
4091
- var planQualificationRunEffect = (options) => Effect19.gen(function* () {
4501
+ var planQualificationRunEffect = (options) => Effect21.gen(function* () {
4092
4502
  const { env, config, tag } = options;
4093
4503
  if (env.GITHUB_ACTIONS === "true") {
4094
4504
  const plan = yield* planReleaseAssetsEffect({ env, config, tag });
@@ -4121,8 +4531,8 @@ var planQualificationRun2 = (options) => runReleaseLibrary(provideLibraryPorts({
4121
4531
  ...options.git ? { git: options.git } : {}
4122
4532
  })(planQualificationRunEffect(options)));
4123
4533
  // src/library/retained-build.ts
4124
- import { Effect as Effect20 } from "effect";
4125
- var id = (value) => Effect20.gen(function* () {
4534
+ import { Effect as Effect22 } from "effect";
4535
+ var id = (value) => Effect22.gen(function* () {
4126
4536
  if (typeof value === "number" && !Number.isSafeInteger(value))
4127
4537
  return yield* fail("Invalid GitHub identity");
4128
4538
  const text = String(value);
@@ -4130,7 +4540,7 @@ var id = (value) => Effect20.gen(function* () {
4130
4540
  return yield* fail("Invalid GitHub identity");
4131
4541
  return text;
4132
4542
  });
4133
- var selectRetainedReleaseBuildEffect = (options) => Effect20.gen(function* () {
4543
+ var selectRetainedReleaseBuildEffect = (options) => Effect22.gen(function* () {
4134
4544
  const { env, config, tag, platform } = options;
4135
4545
  if (!["macos-arm64", "windows-x64", "linux-x64"].includes(platform) || !isRecord(config) || typeof config.appName !== "string" || env.RELEASE_TAG !== tag)
4136
4546
  return yield* fail("Invalid retained build context");
@@ -4249,9 +4659,9 @@ var selectRetainedReleaseBuildEffect = (options) => Effect20.gen(function* () {
4249
4659
  var selectRetainedReleaseBuild = (options) => runReleaseLibrary(provideLibraryPorts({ run: planGitHubRun(options.env, options.run) })(selectRetainedReleaseBuildEffect(options)));
4250
4660
  // src/library/staging.ts
4251
4661
  import { createHash as createHash9 } from "crypto";
4252
- import { join as join11, resolve as resolve9 } from "path";
4253
- import { Effect as Effect21 } from "effect";
4254
- var copyHashed = (input, output, size) => Effect21.tryPromise({
4662
+ import { join as join13, resolve as resolve9 } from "path";
4663
+ import { Effect as Effect23 } from "effect";
4664
+ var copyHashed = (input, output, size) => Effect23.tryPromise({
4255
4665
  try: async (signal) => {
4256
4666
  const hash = createHash9("sha256");
4257
4667
  let copied = 0;
@@ -4280,15 +4690,14 @@ var copyHashed = (input, output, size) => Effect21.tryPromise({
4280
4690
  original: error
4281
4691
  })
4282
4692
  });
4283
- var stagePlatformArtifactsEffect = (options) => Effect21.gen(function* () {
4693
+ var stageExpectedFilesEffect = (options) => Effect23.gen(function* () {
4284
4694
  const fs = yield* ReleaseFs;
4285
- const requirements = parseReleaseConfig(options.config).requirements(options.tag);
4286
- const expected = platformPayloads(requirements, options.platform);
4287
- if (!expected.length || Object.keys(options.sources).length !== expected.length || expected.some((name) => !Object.hasOwn(options.sources, name)))
4288
- return yield* fail("Platform staging sources do not match release configuration");
4695
+ const { expected } = options;
4696
+ if (!expected.length || new Set(expected).size !== expected.length || expected.some((name) => !/^[a-zA-Z0-9][a-zA-Z0-9_.-]*$/.test(name)) || Object.keys(options.sources).length !== expected.length || expected.some((name) => !Object.hasOwn(options.sources, name)))
4697
+ return yield* fail("Staging sources do not match expected filenames");
4289
4698
  const directory = resolve9(options.directory);
4290
4699
  const created = [];
4291
- const stage = Effect21.forEach(expected, (name) => Effect21.gen(function* () {
4700
+ const stage = Effect23.forEach(expected, (name) => Effect23.gen(function* () {
4292
4701
  const sourcePath = options.sources[name];
4293
4702
  if (typeof sourcePath !== "string" || !sourcePath)
4294
4703
  return yield* fail("Invalid staging source");
@@ -4299,7 +4708,7 @@ var stagePlatformArtifactsEffect = (options) => Effect21.gen(function* () {
4299
4708
  const before = yield* step(() => input.stat());
4300
4709
  if (!before.isFile() || before.dev !== sourceInfo.dev || before.ino !== sourceInfo.ino || before.size !== sourceInfo.size)
4301
4710
  return yield* fail("Staging source changed");
4302
- const target = join11(directory, name);
4711
+ const target = join13(directory, name);
4303
4712
  const output = yield* scopedHandle(() => fs.open(target, "wx"));
4304
4713
  created.push(target);
4305
4714
  const copied = yield* copyHashed(input, output, before.size);
@@ -4308,18 +4717,25 @@ var stagePlatformArtifactsEffect = (options) => Effect21.gen(function* () {
4308
4717
  if (copied.size !== before.size || after.size !== before.size || after.mtimeMs !== before.mtimeMs || after.dev !== before.dev || after.ino !== before.ino)
4309
4718
  return yield* fail("Staging source changed");
4310
4719
  return { name, size: copied.size, digest: copied.digest };
4311
- }).pipe(Effect21.scoped), { concurrency: 1 });
4312
- return yield* stage.pipe(Effect21.onError(() => Effect21.promise(() => Promise.all(created.map((path) => fs.rm(path, { force: true }).catch(() => {}))))));
4720
+ }).pipe(Effect23.scoped), { concurrency: 1 });
4721
+ return yield* stage.pipe(Effect23.onError(() => Effect23.promise(() => Promise.all(created.map((path) => fs.rm(path, { force: true }).catch(() => {}))))));
4722
+ });
4723
+ var stagePlatformArtifactsEffect = (options) => Effect23.gen(function* () {
4724
+ const requirements = parseReleaseConfig(options.config).requirements(options.tag);
4725
+ const expected = platformPayloads(requirements, options.platform);
4726
+ if (!expected.length || Object.keys(options.sources).length !== expected.length || expected.some((name) => !Object.hasOwn(options.sources, name)))
4727
+ return yield* fail("Platform staging sources do not match release configuration");
4728
+ return yield* stageExpectedFilesEffect({ ...options, expected });
4313
4729
  });
4314
4730
  var stagePlatformArtifacts = (options) => runReleaseLibrary(provideLibraryPorts()(stagePlatformArtifactsEffect(options)));
4315
4731
  // src/library/steps.ts
4316
- import { join as join31 } from "path";
4317
- import { Effect as Effect22 } from "effect";
4732
+ import { join as join33 } from "path";
4733
+ import { Effect as Effect24 } from "effect";
4318
4734
 
4319
4735
  // ../../src/installer/installer-archive-members.ts
4320
4736
  import { createHash as createHash10 } from "crypto";
4321
4737
  import { lstat as lstat6, open as open5 } from "fs/promises";
4322
- import { isAbsolute as isAbsolute3, relative as relative3, sep as sep2 } from "path";
4738
+ import { isAbsolute as isAbsolute3, relative as relative4, sep as sep2 } from "path";
4323
4739
 
4324
4740
  // ../../src/installer/native-executable.ts
4325
4741
  async function assertNativeExecutable(file, size, platform, what) {
@@ -4342,7 +4758,7 @@ async function assertNativeExecutable(file, size, platform, what) {
4342
4758
  // ../../src/installer/installer-archive-members.ts
4343
4759
  var EMBEDDED_ARCHIVE_MARKER = Buffer.from("ELECTROBUN_ARCHIVE_V1");
4344
4760
  function isWithin(root, path) {
4345
- const rel = relative3(root, path);
4761
+ const rel = relative4(root, path);
4346
4762
  return rel !== "" && rel !== ".." && !rel.startsWith(".." + sep2) && !isAbsolute3(rel);
4347
4763
  }
4348
4764
  function normalizeArchiveMember(name) {
@@ -4443,11 +4859,11 @@ async function assertEmbeddedArchive(path, size, archive) {
4443
4859
  // ../../src/installer/installer-identity.ts
4444
4860
  import { lstat as lstat8, mkdtemp as mkdtemp4, readdir as readdir6, realpath } from "fs/promises";
4445
4861
  import { tmpdir as tmpdir4 } from "os";
4446
- import { basename as basename5, join as join13, resolve as resolve10, win32 } from "path";
4862
+ import { basename as basename5, join as join15, resolve as resolve10, win32 } from "path";
4447
4863
 
4448
4864
  // ../../src/installer/installer-image-mount.ts
4449
4865
  import { lstat as lstat7, mkdir as mkdir4, mkdtemp as mkdtemp3, readdir as readdir5, rm as rm4, stat } from "fs/promises";
4450
- import { dirname as dirname3, join as join12 } from "path";
4866
+ import { dirname as dirname3, join as join14 } from "path";
4451
4867
  var FAILED_ATTACH_PROBES = 5;
4452
4868
  var FAILED_ATTACH_PROBE_INTERVAL_MS = 500;
4453
4869
  async function containsMountAt(path, expectedDevice) {
@@ -4457,7 +4873,7 @@ async function containsMountAt(path, expectedDevice) {
4457
4873
  if (info.dev !== expectedDevice)
4458
4874
  return true;
4459
4875
  for (const name of await readdir5(path)) {
4460
- const child = join12(path, name), childInfo = await lstat7(child);
4876
+ const child = join14(path, name), childInfo = await lstat7(child);
4461
4877
  if (!childInfo.isDirectory() || childInfo.isSymbolicLink())
4462
4878
  continue;
4463
4879
  if (childInfo.dev !== info.dev || await containsMountAt(child, info.dev))
@@ -4651,8 +5067,8 @@ async function withInstallerImageRetries(options) {
4651
5067
  };
4652
5068
  const priorErrors = () => failedAttempts.map((attempt) => attempt.error);
4653
5069
  for (let attempt = 1;attempt <= maximumAttempts; attempt++) {
4654
- const directory = await mkdtemp3(join12(options.parent, options.prefix));
4655
- const mount = join12(directory, "mount");
5070
+ const directory = await mkdtemp3(join14(options.parent, options.prefix));
5071
+ const mount = join14(directory, "mount");
4656
5072
  const io = options.createIo?.(directory, mount) ?? defaultInstallerImageMountIo(options.run);
4657
5073
  let lifecycleStarted = false;
4658
5074
  try {
@@ -4852,7 +5268,7 @@ async function verifyInstallerPayload(options) {
4852
5268
  if (!Number.isSafeInteger(before.archive.size + 256 * 1024 * 1024))
4853
5269
  throw new Error("Installer archive exceeds bound");
4854
5270
  const env = environment(parent);
4855
- const temporary = await mkdtemp4(join13(tmpdir4(), "framework-installer-inspect-"));
5271
+ const temporary = await mkdtemp4(join15(tmpdir4(), "framework-installer-inspect-"));
4856
5272
  const cleanupIo = defaultInstallerImageMountIo(command);
4857
5273
  try {
4858
5274
  if (options.platform === "macos-arm64") {
@@ -4866,21 +5282,21 @@ async function verifyInstallerPayload(options) {
4866
5282
  const apps = (await readdir6(mount)).filter((name) => name.endsWith(".app"));
4867
5283
  if (apps.length !== 1)
4868
5284
  throw new Error("Installer application is missing or ambiguous");
4869
- const resources = join13(mount, apps[0], "Contents", "Resources");
4870
- const actualRoot = await realpath(mount), actualApp = await realpath(join13(mount, apps[0])), actualResources = await realpath(resources);
5285
+ const resources = join15(mount, apps[0], "Contents", "Resources");
5286
+ const actualRoot = await realpath(mount), actualApp = await realpath(join15(mount, apps[0])), actualResources = await realpath(resources);
4871
5287
  if (!isWithin(actualRoot, actualApp) || !isWithin(actualApp, actualResources))
4872
5288
  throw new Error("Installer resources escape mounted image");
4873
- const plist = join13(actualApp, "Contents", "Info.plist"), plistInfo = await lstat8(plist);
5289
+ const plist = join15(actualApp, "Contents", "Info.plist"), plistInfo = await lstat8(plist);
4874
5290
  if (!plistInfo.isFile() || plistInfo.isSymbolicLink() || plistInfo.size < 1 || plistInfo.size > 1024 * 1024)
4875
5291
  throw new Error("Invalid installer property list");
4876
5292
  const executable = (await command(["/usr/libexec/PlistBuddy", "-c", "Print :CFBundleExecutable", plist], env)).trim();
4877
5293
  if (!executable || executable === "." || executable === ".." || /[\\/]/.test(executable))
4878
5294
  throw new Error("Invalid installer executable name");
4879
- await assertInstallerExecutable(join13(actualApp, "Contents", "MacOS", executable), options.platform);
5295
+ await assertInstallerExecutable(join15(actualApp, "Contents", "MacOS", executable), options.platform);
4880
5296
  const archives = (await readdir6(actualResources)).filter((name) => name.endsWith(".tar.zst"));
4881
5297
  if (archives.length !== 1)
4882
5298
  throw new Error("Installer archive is missing or ambiguous");
4883
- const embedded = await identity(join13(actualResources, archives[0]));
5299
+ const embedded = await identity(join15(actualResources, archives[0]));
4884
5300
  if (embedded.size !== before.archive.size || embedded.digest !== before.archive.digest)
4885
5301
  throw new Error("Installer archive differs from release archive");
4886
5302
  }
@@ -4898,7 +5314,7 @@ async function verifyInstallerPayload(options) {
4898
5314
  const matches = names.filter((name) => candidates.includes(normalizeArchiveMember(name)));
4899
5315
  if (matches.length !== 1)
4900
5316
  throw new Error("Installer archive is missing or ambiguous");
4901
- const extracted = join13(temporary, "member");
5317
+ const extracted = join15(temporary, "member");
4902
5318
  const count = await extractArchiveMember({
4903
5319
  tar,
4904
5320
  archive: installerPath,
@@ -4909,7 +5325,7 @@ async function verifyInstallerPayload(options) {
4909
5325
  });
4910
5326
  if (options.platform === "windows-x64") {
4911
5327
  const setup = findArchiveMember(names, `${options.appName}-Setup.exe`, options.platform, "Installer executable is missing or ambiguous");
4912
- const executable = join13(temporary, "setup.exe");
5328
+ const executable = join15(temporary, "setup.exe");
4913
5329
  await extractArchiveMember({
4914
5330
  tar,
4915
5331
  archive: installerPath,
@@ -4946,18 +5362,18 @@ async function verifyInstallerPayload(options) {
4946
5362
 
4947
5363
  // ../../src/installer/installer-qualification-command.ts
4948
5364
  import { lstat as lstat18, writeFile as writeFile9 } from "fs/promises";
4949
- import { join as join28, resolve as resolve13 } from "path";
5365
+ import { join as join30, resolve as resolve13 } from "path";
4950
5366
 
4951
5367
  // ../../src/installer/installer-observation.ts
4952
5368
  import { randomBytes as randomBytes2 } from "crypto";
4953
5369
  import { chmod as chmod2, mkdir as mkdir9, readFile as readFile9, realpath as realpath8, writeFile as writeFile8 } from "fs/promises";
4954
5370
  import { createServer } from "net";
4955
- import { delimiter, dirname as dirname12, join as join27 } from "path";
5371
+ import { delimiter, dirname as dirname12, join as join29 } from "path";
4956
5372
 
4957
5373
  // ../../src/installer/installer-ci-bootstrap.ts
4958
5374
  import { randomBytes } from "crypto";
4959
5375
  import { lstat as lstat9, mkdir as mkdir5, mkdtemp as mkdtemp5, realpath as realpath2, rm as rm5, writeFile as writeFile4 } from "fs/promises";
4960
- import { dirname as dirname4, isAbsolute as isAbsolute4, join as join14, relative as relative4, sep as sep3 } from "path";
5376
+ import { dirname as dirname4, isAbsolute as isAbsolute4, join as join16, relative as relative5, sep as sep3 } from "path";
4961
5377
  import { fileURLToPath } from "url";
4962
5378
  var bootstrapModules = [
4963
5379
  "app/value-guards.js",
@@ -4969,6 +5385,7 @@ var bootstrapModules = [
4969
5385
  "installer/hosted-runner.js",
4970
5386
  "release/release-qualification.js",
4971
5387
  "updates/feed/release-config-contract.js",
5388
+ "updates/feed/arch-package-policy.js",
4972
5389
  "updates/feed/release-feed.js",
4973
5390
  "native/app-bundle.js",
4974
5391
  "desktop/string-policy.js",
@@ -4983,23 +5400,23 @@ async function prepareInstallerCiBootstrap(env = process.env) {
4983
5400
  if (/\s/.test(parent) || !(await lstat9(parent)).isDirectory())
4984
5401
  throw new Error("Runner temp cannot represent a Bun preload path");
4985
5402
  const source = dirname4(dirname4(fileURLToPath(import.meta.url)));
4986
- const directory = await mkdtemp5(join14(parent, "framework-ci-"));
5403
+ const directory = await mkdtemp5(join16(parent, "framework-ci-"));
4987
5404
  try {
4988
5405
  for (const name of bootstrapModules) {
4989
- const contents = await readBoundedFile(join14(source, name), 2 * 1024 * 1024, "installer bootstrap module");
4990
- await mkdir5(dirname4(join14(directory, name)), { recursive: true, mode: 448 });
4991
- await writeFile4(join14(directory, name), contents, { flag: "wx", mode: 384 });
5406
+ const contents = await readBoundedFile(join16(source, name), 2 * 1024 * 1024, "installer bootstrap module");
5407
+ await mkdir5(dirname4(join16(directory, name)), { recursive: true, mode: 448 });
5408
+ await writeFile4(join16(directory, name), contents, { flag: "wx", mode: 384 });
4992
5409
  }
4993
- await writeFile4(join14(directory, "package.json"), `{"type":"module"}
5410
+ await writeFile4(join16(directory, "package.json"), `{"type":"module"}
4994
5411
  `, {
4995
5412
  flag: "wx",
4996
5413
  mode: 384
4997
5414
  });
4998
- const worker = join14(directory, "installer/installer-ci-worker.js");
5415
+ const worker = join16(directory, "installer/installer-ci-worker.js");
4999
5416
  return {
5000
5417
  directory,
5001
5418
  worker,
5002
- preflight: join14(directory, "installer/installer-ci-preflight.js"),
5419
+ preflight: join16(directory, "installer/installer-ci-preflight.js"),
5003
5420
  bunOptions: `--preload=${worker}`
5004
5421
  };
5005
5422
  } catch (error) {
@@ -5013,8 +5430,8 @@ async function preflightInstallerRuntime(options) {
5013
5430
  if (!isHostedRunner(env) || !temp || !isAbsolute4(runtime))
5014
5431
  throw new Error("Runtime preflight requires a disposable hosted runner");
5015
5432
  const tempRoot = await realpath2(temp), bootstrapRoot = await realpath2(bootstrap.directory);
5016
- const relativeBootstrap = relative4(tempRoot, bootstrapRoot);
5017
- if (!relativeBootstrap || relativeBootstrap === ".." || relativeBootstrap.startsWith(".." + sep3) || isAbsolute4(relativeBootstrap) || /\s/.test(bootstrapRoot) || bootstrap.worker !== join14(bootstrapRoot, "installer/installer-ci-worker.js") || bootstrap.preflight !== join14(bootstrapRoot, "installer/installer-ci-preflight.js") || bootstrap.bunOptions !== `--preload=${bootstrap.worker}`)
5433
+ const relativeBootstrap = relative5(tempRoot, bootstrapRoot);
5434
+ if (!relativeBootstrap || relativeBootstrap === ".." || relativeBootstrap.startsWith(".." + sep3) || isAbsolute4(relativeBootstrap) || /\s/.test(bootstrapRoot) || bootstrap.worker !== join16(bootstrapRoot, "installer/installer-ci-worker.js") || bootstrap.preflight !== join16(bootstrapRoot, "installer/installer-ci-preflight.js") || bootstrap.bunOptions !== `--preload=${bootstrap.worker}`)
5018
5435
  throw new Error("Invalid installer bootstrap location");
5019
5436
  await runInstallerPreflight({
5020
5437
  env,
@@ -5034,7 +5451,7 @@ async function runInstallerPreflight(options) {
5034
5451
  const info = await lstat9(runtime);
5035
5452
  if (!info.isFile() || info.isSymbolicLink() || info.size < 4096)
5036
5453
  throw new Error("Invalid candidate Bun runtime");
5037
- const temporary = await mkdtemp5(join14(options.parent, "framework-preflight-"));
5454
+ const temporary = await mkdtemp5(join16(options.parent, "framework-preflight-"));
5038
5455
  try {
5039
5456
  const clean = {};
5040
5457
  for (const key of [
@@ -5059,11 +5476,11 @@ async function runInstallerPreflight(options) {
5059
5476
  BUN_OPTIONS: `--preload=${worker}`,
5060
5477
  FRAMEWORK_CI_WORKER_ENTRY: preflight,
5061
5478
  FRAMEWORK_CI_NONCE: nonce,
5062
- FRAMEWORK_CI_ACK: join14(temporary, "ack"),
5063
- FRAMEWORK_CI_PERMIT: join14(temporary, "permit"),
5479
+ FRAMEWORK_CI_ACK: join16(temporary, "ack"),
5480
+ FRAMEWORK_CI_PERMIT: join16(temporary, "permit"),
5064
5481
  FRAMEWORK_CI_ORIGIN: "http://127.0.0.1:48999",
5065
- FRAMEWORK_CI_OBSERVATION: join14(temporary, "observation"),
5066
- FRAMEWORK_CI_UNEXPECTED: join14(temporary, "unexpected"),
5482
+ FRAMEWORK_CI_OBSERVATION: join16(temporary, "observation"),
5483
+ FRAMEWORK_CI_UNEXPECTED: join16(temporary, "unexpected"),
5067
5484
  FRAMEWORK_CI_EXPECTED_READS: JSON.stringify([
5068
5485
  "https://example.invalid/framework-ci-sentinel"
5069
5486
  ])
@@ -5098,7 +5515,7 @@ async function runInstallerPreflight(options) {
5098
5515
  if (status !== 0 || !stdout.includes("framework installer preload preflight passed"))
5099
5516
  throw new Error("Candidate Bun runtime failed installer preflight");
5100
5517
  try {
5101
- await lstat9(join14(temporary, "unexpected"));
5518
+ await lstat9(join16(temporary, "unexpected"));
5102
5519
  throw new Error("Runtime preflight recorded unexpected activity");
5103
5520
  } catch (error) {
5104
5521
  if (errorCode(error) !== "ENOENT")
@@ -5111,7 +5528,7 @@ async function runInstallerPreflight(options) {
5111
5528
 
5112
5529
  // ../../src/installer/installer-extraction.ts
5113
5530
  import { chmod, lstat as lstat10, mkdir as mkdir6, mkdtemp as mkdtemp6, readdir as readdir7, realpath as realpath3 } from "fs/promises";
5114
- import { join as join15, resolve as resolve11, win32 as win322 } from "path";
5531
+ import { join as join17, resolve as resolve11, win32 as win322 } from "path";
5115
5532
  async function run(cmd, env) {
5116
5533
  return runInstallerCommand(cmd, env, {
5117
5534
  outputLimit: 8 * 1024 * 1024,
@@ -5119,7 +5536,7 @@ async function run(cmd, env) {
5119
5536
  failureMessage: "Installer preparation command failed"
5120
5537
  });
5121
5538
  }
5122
- async function digest(path) {
5539
+ async function digest2(path) {
5123
5540
  const info = await lstat10(path);
5124
5541
  if (!info.isFile() || info.isSymbolicLink() || !Number.isSafeInteger(info.size) || info.size < 1)
5125
5542
  throw new Error("Invalid extracted file");
@@ -5163,10 +5580,10 @@ async function prepareInstallerExecution(options) {
5163
5580
  archive: sourceArchive,
5164
5581
  env
5165
5582
  });
5166
- const directory = await mkdtemp6(join15(parent, "framework-installer-"));
5583
+ const directory = await mkdtemp6(join17(parent, "framework-installer-"));
5167
5584
  const imageIo = defaultInstallerImageMountIo(run);
5168
5585
  try {
5169
- const profile = join15(directory, "profile"), incoming = join15(directory, "incoming");
5586
+ const profile = join17(directory, "profile"), incoming = join17(directory, "incoming");
5170
5587
  await mkdir6(profile, { mode: 448 });
5171
5588
  await mkdir6(incoming, { mode: 448 });
5172
5589
  const clean = cleanEnv(env);
@@ -5182,31 +5599,31 @@ async function prepareInstallerExecution(options) {
5182
5599
  const appName = `${options.appName}.app`, apps = (await readdir7(mount)).filter((name) => name.endsWith(".app"));
5183
5600
  if (apps.length !== 1 || apps[0] !== appName)
5184
5601
  throw new Error("Unexpected installer application");
5185
- const sourceApp = await realpath3(join15(mount, appName)), mountRoot = await realpath3(mount);
5602
+ const sourceApp = await realpath3(join17(mount, appName)), mountRoot = await realpath3(mount);
5186
5603
  if (!isWithin(mountRoot, sourceApp))
5187
5604
  throw new Error("Installer application escapes image");
5188
- const app = join15(incoming, appName);
5605
+ const app = join17(incoming, appName);
5189
5606
  await run(["/usr/bin/ditto", sourceApp, app], clean);
5190
- const actualApp = await realpath3(app), resources = await realpath3(join15(actualApp, "Contents", "Resources"));
5607
+ const actualApp = await realpath3(app), resources = await realpath3(join17(actualApp, "Contents", "Resources"));
5191
5608
  if (!isWithin(await realpath3(incoming), actualApp) || !isWithin(actualApp, resources))
5192
5609
  throw new Error("Copied installer escapes profile");
5193
- const plist = join15(actualApp, "Contents", "Info.plist"), plistInfo = await lstat10(plist);
5610
+ const plist = join17(actualApp, "Contents", "Info.plist"), plistInfo = await lstat10(plist);
5194
5611
  if (!plistInfo.isFile() || plistInfo.isSymbolicLink() || plistInfo.size < 1 || plistInfo.size > 1024 * 1024)
5195
5612
  throw new Error("Invalid installer property list");
5196
5613
  const name = (await run(["/usr/libexec/PlistBuddy", "-c", "Print :CFBundleExecutable", plist], clean)).trim();
5197
5614
  if (!name || name === "." || name === ".." || /[\\/]/.test(name))
5198
5615
  throw new Error("Invalid installer executable");
5199
- const appExecutable = join15(actualApp, "Contents", "MacOS", name);
5200
- const sourceExecutable = join15(sourceApp, "Contents", "MacOS", name);
5616
+ const appExecutable = join17(actualApp, "Contents", "MacOS", name);
5617
+ const sourceExecutable = join17(sourceApp, "Contents", "MacOS", name);
5201
5618
  if (!isWithin(actualApp, await realpath3(appExecutable)) || !isWithin(sourceApp, await realpath3(sourceExecutable)))
5202
5619
  throw new Error("Installer executable escapes application");
5203
5620
  await assertInstallerExecutable(appExecutable, options.platform);
5204
- if (JSON.stringify(await digest(sourceExecutable)) !== JSON.stringify(await digest(appExecutable)))
5621
+ if (JSON.stringify(await digest2(sourceExecutable)) !== JSON.stringify(await digest2(appExecutable)))
5205
5622
  throw new Error("Copied installer executable differs");
5206
5623
  const archives = (await readdir7(resources)).filter((value) => value.endsWith(".tar.zst"));
5207
5624
  if (archives.length !== 1)
5208
5625
  throw new Error("Missing installer archive");
5209
- const embedded = await digest(join15(resources, archives[0]));
5626
+ const embedded = await digest2(join17(resources, archives[0]));
5210
5627
  if (embedded.size !== verified.archive.size || embedded.digest !== verified.archive.digest)
5211
5628
  throw new Error("Copied installer archive differs");
5212
5629
  return executable;
@@ -5221,9 +5638,9 @@ async function prepareInstallerExecution(options) {
5221
5638
  assertInstallerLayout(options.platform, options.appName, names);
5222
5639
  const find = (name) => findArchiveMember(names, name, options.platform, "Installer member missing or ambiguous");
5223
5640
  if (options.platform === "windows-x64") {
5224
- const subdirectory = join15(incoming, ".installer");
5641
+ const subdirectory = join17(incoming, ".installer");
5225
5642
  await mkdir6(subdirectory);
5226
- executable = join15(incoming, `${options.appName}-Setup.exe`);
5643
+ executable = join17(incoming, `${options.appName}-Setup.exe`);
5227
5644
  await extractArchiveMember({
5228
5645
  tar,
5229
5646
  archive: sourceInstaller,
@@ -5237,11 +5654,11 @@ async function prepareInstallerExecution(options) {
5237
5654
  tar,
5238
5655
  archive: sourceInstaller,
5239
5656
  member: find(`.installer/${options.appName}-Setup.metadata.json`),
5240
- destination: join15(subdirectory, `${options.appName}-Setup.metadata.json`),
5657
+ destination: join17(subdirectory, `${options.appName}-Setup.metadata.json`),
5241
5658
  maximum: 1024 * 1024,
5242
5659
  env: clean
5243
5660
  });
5244
- const embeddedPath = join15(subdirectory, `${options.appName}-Setup.tar.zst`);
5661
+ const embeddedPath = join17(subdirectory, `${options.appName}-Setup.tar.zst`);
5245
5662
  await extractArchiveMember({
5246
5663
  tar,
5247
5664
  archive: sourceInstaller,
@@ -5250,11 +5667,11 @@ async function prepareInstallerExecution(options) {
5250
5667
  maximum: verified.archive.size,
5251
5668
  env: clean
5252
5669
  });
5253
- const embedded = await digest(embeddedPath);
5670
+ const embedded = await digest2(embeddedPath);
5254
5671
  if (embedded.size !== verified.archive.size || embedded.digest !== verified.archive.digest)
5255
5672
  throw new Error("Copied installer archive differs");
5256
5673
  } else {
5257
- executable = join15(incoming, "installer");
5674
+ executable = join17(incoming, "installer");
5258
5675
  await extractArchiveMember({
5259
5676
  tar,
5260
5677
  archive: sourceInstaller,
@@ -5313,7 +5730,7 @@ function assertInstallerRendererObservation(value, offline = false) {
5313
5730
  import { createHash as createHash11 } from "crypto";
5314
5731
  import { lstat as lstat11, open as open6, realpath as realpath4, rm as rm6 } from "fs/promises";
5315
5732
  import { once } from "events";
5316
- import { join as join16, resolve as resolve12 } from "path";
5733
+ import { join as join18, resolve as resolve12 } from "path";
5317
5734
  import { createZstdDecompress } from "zlib";
5318
5735
  import { Parser } from "tar";
5319
5736
  function cleanEnv2(parent, forceLocal) {
@@ -5484,7 +5901,7 @@ async function verifyInstalledPayload(options) {
5484
5901
  const member = members.get(path);
5485
5902
  if (!member || member.count !== 1)
5486
5903
  throw new Error("Archive member missing or ambiguous");
5487
- const current = await installed(join16(root, name), root, limit);
5904
+ const current = await installed(join18(root, name), root, limit);
5488
5905
  if (member.size !== current.size || member.digest !== current.digest)
5489
5906
  throw new Error(`Installed file differs from archive: ${name}`);
5490
5907
  if (name === "Resources/version.json") {
@@ -5519,7 +5936,7 @@ async function extractCandidateRuntime(options) {
5519
5936
  const prefix = options.platform === "macos-arm64" ? `${options.appName}.app/Contents/MacOS` : `${options.appName.replaceAll(" ", "")}/bin`, suffix = options.platform === "windows-x64" ? ".exe" : "";
5520
5937
  const expected = `${prefix}/bun${suffix}`;
5521
5938
  const member = findArchiveMember(entries, expected, options.platform, "Runtime archive member missing or ambiguous");
5522
- const destination = join16(profile, `candidate-bun${suffix}`), output = await open6(destination, "wx", 448);
5939
+ const destination = join18(profile, `candidate-bun${suffix}`), output = await open6(destination, "wx", 448);
5523
5940
  const spawn = () => Bun.spawn({
5524
5941
  cmd: ["tar", "--zstd", "-xOf", archive, "--", member],
5525
5942
  env: tarEnv,
@@ -5726,7 +6143,7 @@ async function windowsRunningExecutable(pid) {
5726
6143
 
5727
6144
  // ../../src/updates/install/update-swap-stage.ts
5728
6145
  import { lstat as lstat17, mkdtemp as mkdtemp8, readFile as readFile8, realpath as realpath7, rm as rm8 } from "fs/promises";
5729
- import { join as join26 } from "path";
6146
+ import { join as join28 } from "path";
5730
6147
 
5731
6148
  // ../../src/updates/install/update-handoff-plan.ts
5732
6149
  import { basename as basename6 } from "path";
@@ -5768,7 +6185,7 @@ function planUpdateHandoff(options) {
5768
6185
  import { createHash as createHash12 } from "crypto";
5769
6186
  import { constants as constants4 } from "fs";
5770
6187
  import { lstat as lstat12, mkdir as mkdir7, mkdtemp as mkdtemp7, open as open7, readFile as readFile6, realpath as realpath6, rm as rm7, symlink } from "fs/promises";
5771
- import { isAbsolute as isAbsolute5, join as join17 } from "path";
6188
+ import { isAbsolute as isAbsolute5, join as join19 } from "path";
5772
6189
  import { Transform } from "stream";
5773
6190
  import { pipeline } from "stream/promises";
5774
6191
  import { createZstdDecompress as createZstdDecompress2 } from "zlib";
@@ -5814,8 +6231,8 @@ async function extractVerifiedUpdate(options) {
5814
6231
  const parent = await realpath6(options.directory);
5815
6232
  if (!(await lstat12(parent)).isDirectory())
5816
6233
  throw new Error("Invalid update staging directory");
5817
- directory = await mkdtemp7(join17(parent, "framework-update-extract-"));
5818
- const payloadRoot = join17(directory, "payload"), decompressed = join17(directory, "payload.tar");
6234
+ directory = await mkdtemp7(join19(parent, "framework-update-extract-"));
6235
+ const payloadRoot = join19(directory, "payload"), decompressed = join19(directory, "payload.tar");
5819
6236
  await mkdir7(payloadRoot, { mode: 448 });
5820
6237
  const entries = [], links = [], seen = new Set, fold = platform === "windows-x64";
5821
6238
  let invalid = false;
@@ -5933,14 +6350,14 @@ async function extractVerifiedUpdate(options) {
5933
6350
  if (invalid)
5934
6351
  throw new Error("Unsafe or unsupported update archive entry");
5935
6352
  if (links.length) {
5936
- const bin = join17(payloadRoot, archiveRoot, "bin"), cef = join17(bin, "cef");
5937
- for (const path of [join17(payloadRoot, archiveRoot), bin, cef]) {
6353
+ const bin = join19(payloadRoot, archiveRoot, "bin"), cef = join19(bin, "cef");
6354
+ for (const path of [join19(payloadRoot, archiveRoot), bin, cef]) {
5938
6355
  const value = await lstat12(path);
5939
6356
  if (!value.isDirectory() || value.isSymbolicLink())
5940
6357
  throw new Error("Invalid CEF link directory");
5941
6358
  }
5942
6359
  for (const link of links) {
5943
- const destination = join17(payloadRoot, link.path), target = join17(bin, link.target), value = await lstat12(target);
6360
+ const destination = join19(payloadRoot, link.path), target = join19(bin, link.target), value = await lstat12(target);
5944
6361
  if (!value.isFile() || value.isSymbolicLink())
5945
6362
  throw new Error("Invalid CEF link target");
5946
6363
  await symlink(link.target, destination);
@@ -5948,12 +6365,12 @@ async function extractVerifiedUpdate(options) {
5948
6365
  }
5949
6366
  await rm7(decompressed);
5950
6367
  assertPayloadLayout({ platform, renderer, appName, entries, sidecars });
5951
- const prefix = platform === "macos-arm64" ? join17(`${appName}.app`, "Contents") : appName.replaceAll(" ", "");
5952
- const resources = join17(payloadRoot, prefix, "Resources");
6368
+ const prefix = platform === "macos-arm64" ? join19(`${appName}.app`, "Contents") : appName.replaceAll(" ", "");
6369
+ const resources = join19(payloadRoot, prefix, "Resources");
5953
6370
  const bin = platform === "macos-arm64" ? "MacOS" : "bin", suffix = platform === "windows-x64" ? ".exe" : "";
5954
6371
  const executables = [
5955
- join17(bin, `launcher${suffix}`),
5956
- join17(bin, `bun${suffix}`),
6372
+ join19(bin, `launcher${suffix}`),
6373
+ join19(bin, `bun${suffix}`),
5957
6374
  ...sidecars.map((name) => sidecarBundlePath(name, platform))
5958
6375
  ];
5959
6376
  const critical = [
@@ -5963,21 +6380,21 @@ async function extractVerifiedUpdate(options) {
5963
6380
  "Resources/app/client/index.html"
5964
6381
  ];
5965
6382
  for (const path of critical) {
5966
- const item = await lstat12(join17(payloadRoot, prefix, path));
6383
+ const item = await lstat12(join19(payloadRoot, prefix, path));
5967
6384
  if (!item.isFile() || item.isSymbolicLink() || item.size < 1 || platform !== "windows-x64" && process.platform !== "win32" && executables.includes(path) && !(item.mode & 64))
5968
6385
  throw new Error("Invalid critical update file");
5969
6386
  }
5970
6387
  for (const name of ["version.json", "build.json"]) {
5971
- const metadata = await lstat12(join17(resources, name));
6388
+ const metadata = await lstat12(join19(resources, name));
5972
6389
  if (!metadata.isFile() || metadata.isSymbolicLink() || metadata.size < 1 || metadata.size > 1048576)
5973
6390
  throw new Error("Invalid update metadata");
5974
6391
  }
5975
- if (JSON.parse(await readFile6(join17(resources, "version.json"), "utf8")).version !== descriptor.version)
6392
+ if (JSON.parse(await readFile6(join19(resources, "version.json"), "utf8")).version !== descriptor.version)
5976
6393
  throw new Error("Update version mismatch");
5977
- assertBuildMetadata(JSON.parse(await readFile6(join17(resources, "build.json"), "utf8")), renderer);
6394
+ assertBuildMetadata(JSON.parse(await readFile6(join19(resources, "build.json"), "utf8")), renderer);
5978
6395
  return {
5979
6396
  directory,
5980
- payload: join17(payloadRoot, platform === "macos-arm64" ? `${appName}.app` : prefix)
6397
+ payload: join19(payloadRoot, platform === "macos-arm64" ? `${appName}.app` : prefix)
5981
6398
  };
5982
6399
  } catch (error) {
5983
6400
  if (directory)
@@ -5992,16 +6409,16 @@ async function extractVerifiedUpdate(options) {
5992
6409
  import { createHash as createHash13 } from "crypto";
5993
6410
  import { constants as constants7 } from "fs";
5994
6411
  import { lstat as lstat13, open as open10, readdir as readdir8, readFile as readFile7, readlink as readlink2 } from "fs/promises";
5995
- import { basename as basename8, dirname as dirname6, join as join20 } from "path";
6412
+ import { basename as basename8, dirname as dirname6, join as join22 } from "path";
5996
6413
 
5997
6414
  // ../../src/updates/update-state-store.ts
5998
6415
  import { randomUUID as randomUUID2 } from "crypto";
5999
6416
  import { constants as constants6 } from "fs";
6000
6417
  import { open as open9, rename, unlink, writeFile as writeFile5 } from "fs/promises";
6001
- import { join as join19 } from "path";
6418
+ import { join as join21 } from "path";
6002
6419
 
6003
6420
  // ../../src/updates/locks/update-lock.ts
6004
- import { basename as basename7, dirname as dirname5, join as join18 } from "path";
6421
+ import { basename as basename7, dirname as dirname5, join as join20 } from "path";
6005
6422
 
6006
6423
  // ../../src/updates/locks/native-file-lock.ts
6007
6424
  import { constants as constants5 } from "fs";
@@ -6169,7 +6586,7 @@ async function tryAcquireWindows(path, mode) {
6169
6586
  function updateLockPath(target) {
6170
6587
  if (!isCanonicalPath(target))
6171
6588
  throw new Error("Invalid update lock target");
6172
- return join18(dirname5(target), `.${basename7(target)}.framework-update.lock`);
6589
+ return join20(dirname5(target), `.${basename7(target)}.framework-update.lock`);
6173
6590
  }
6174
6591
  async function tryAcquireUpdateLock(target) {
6175
6592
  return tryAcquireNativeFileLock(updateLockPath(target), "exclusive");
@@ -6234,7 +6651,7 @@ function parseState(value) {
6234
6651
  return Object.freeze(record);
6235
6652
  }
6236
6653
  async function readUpdateStageState(staging) {
6237
- const text = await readSmallStateFile(join19(staging, "state.json"), 4096, "Invalid update staging state");
6654
+ const text = await readSmallStateFile(join21(staging, "state.json"), 4096, "Invalid update staging state");
6238
6655
  return text === undefined ? undefined : parseState(JSON.parse(text));
6239
6656
  }
6240
6657
  async function writeUpdateStageState(staging, state) {
@@ -6243,8 +6660,8 @@ async function writeUpdateStageState(staging, state) {
6243
6660
  async function replaceUpdateStageState(staging, state, durable) {
6244
6661
  if (typeof state.generation !== "string" || !isUuid(state.generation))
6245
6662
  throw new Error("Invalid update staging state");
6246
- const path = join19(staging, "state.json");
6247
- const temporary = join19(staging, `.state-${state.generation}-${randomUUID2()}.tmp`);
6663
+ const path = join21(staging, "state.json");
6664
+ const temporary = join21(staging, `.state-${state.generation}-${randomUUID2()}.tmp`);
6248
6665
  const contents = JSON.stringify(state) + `
6249
6666
  `;
6250
6667
  let renamed = false;
@@ -6282,10 +6699,10 @@ async function withUpdateLock(target, operation) {
6282
6699
  function updateStagingFor(target) {
6283
6700
  if (!isCanonicalPath(target))
6284
6701
  throw new Error("Invalid update target");
6285
- return join20(dirname6(target), `.${basename8(target)}.framework-update`);
6702
+ return join22(dirname6(target), `.${basename8(target)}.framework-update`);
6286
6703
  }
6287
6704
  async function readUpdateTreeVersion(tree) {
6288
- const versionPath = join20(tree, ...process.platform === "darwin" ? ["Contents", "Resources"] : ["Resources"], "version.json");
6705
+ const versionPath = join22(tree, ...process.platform === "darwin" ? ["Contents", "Resources"] : ["Resources"], "version.json");
6289
6706
  try {
6290
6707
  const value = JSON.parse(await readFile7(versionPath, "utf8"));
6291
6708
  if (typeof value !== "object" || value === null || typeof value.version !== "string")
@@ -6379,7 +6796,7 @@ async function readUpdateTreeDigest(tree, options = {}) {
6379
6796
  if (before.isDirectory()) {
6380
6797
  const names = (await limit(() => readdir8(path))).map((name) => ({ name, bytes: Buffer.from(name, "utf8") })).toSorted((left, right) => Buffer.compare(left.bytes, right.bytes)).map(({ name }) => name);
6381
6798
  const children = await Promise.all(names.map(async (name) => {
6382
- const childPath = join20(path, name);
6799
+ const childPath = join22(path, name);
6383
6800
  return list(childPath, relative ? `${relative}/${name}` : name, await limit(() => lstat13(childPath, { bigint: true })));
6384
6801
  }));
6385
6802
  return [{ kind: "directory", path, relative, before }, ...children.flat()];
@@ -6522,8 +6939,8 @@ async function swapUpdateTreeWhileLocked(options, exchangeOperation = exchangeDi
6522
6939
  const { target, staging } = options;
6523
6940
  if (dirname6(staging) !== dirname6(target) || staging === target)
6524
6941
  throw new Error("Invalid update swap context");
6525
- const candidate = join20(staging, "candidate");
6526
- const legacyOld = join20(staging, "old");
6942
+ const candidate = join22(staging, "candidate");
6943
+ const legacyOld = join22(staging, "old");
6527
6944
  if (await pathExists(legacyOld))
6528
6945
  throw new Error("A legacy update tree requires recovery before another swap");
6529
6946
  await assertDirectory(target);
@@ -6553,10 +6970,10 @@ async function swapUpdateTreeWhileLocked(options, exchangeOperation = exchangeDi
6553
6970
 
6554
6971
  // ../../src/updates/retention/retirement-inventory.ts
6555
6972
  import { lstat as lstat15, readdir as readdir10 } from "fs/promises";
6556
- import { basename as basename12, dirname as dirname10, join as join24 } from "path";
6973
+ import { basename as basename12, dirname as dirname10, join as join26 } from "path";
6557
6974
 
6558
6975
  // ../../src/updates/retention/update-retention-marker.ts
6559
- import { basename as basename9, dirname as dirname7, join as join21 } from "path";
6976
+ import { basename as basename9, dirname as dirname7, join as join23 } from "path";
6560
6977
  var LOWERCASE_UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
6561
6978
  var IDENTITY_COMPONENT = /^[1-9]\d{0,19}$/;
6562
6979
  function assertCanonicalTarget(target) {
@@ -6575,28 +6992,28 @@ function isTreeIdentity(value) {
6575
6992
  function updateRetentionIntentPath(target, generation) {
6576
6993
  assertCanonicalTarget(target);
6577
6994
  assertGeneration(generation);
6578
- return join21(dirname7(target), `.${basename9(target)}.framework-prune-${generation}.json`);
6995
+ return join23(dirname7(target), `.${basename9(target)}.framework-prune-${generation}.json`);
6579
6996
  }
6580
6997
 
6581
6998
  // ../../src/updates/retention/retention-prune-progress.ts
6582
- import { basename as basename11, dirname as dirname9, join as join23 } from "path";
6999
+ import { basename as basename11, dirname as dirname9, join as join25 } from "path";
6583
7000
 
6584
7001
  // ../../src/updates/retention/retirement-records.ts
6585
7002
  import { lstat as lstat14, readdir as readdir9, writeFile as writeFile6 } from "fs/promises";
6586
- import { basename as basename10, dirname as dirname8, join as join22 } from "path";
7003
+ import { basename as basename10, dirname as dirname8, join as join24 } from "path";
6587
7004
  function updateRetirementPaths(target, generation) {
6588
7005
  if (!isCanonicalPath(target) || !isUuid(generation))
6589
7006
  throw new Error("Invalid update retirement identity");
6590
7007
  const prefix = `.${basename10(target)}.framework-retired-${generation}`;
6591
- const container = join22(dirname8(target), prefix);
7008
+ const container = join24(dirname8(target), prefix);
6592
7009
  return Object.freeze({
6593
7010
  container,
6594
- tree: join22(container, "tree"),
6595
- healthReceipt: join22(container, "healthy.json"),
7011
+ tree: join24(container, "tree"),
7012
+ healthReceipt: join24(container, "healthy.json"),
6596
7013
  healthTemporaryPrefix: ".healthy-",
6597
- claim: join22(dirname8(target), `${prefix}.claim.json`),
7014
+ claim: join24(dirname8(target), `${prefix}.claim.json`),
6598
7015
  claimTemporaryPrefix: `${prefix}.claim-`,
6599
- cleanupMarker: join22(dirname8(target), `.${basename10(target)}.framework-update-cleanup.json`),
7016
+ cleanupMarker: join24(dirname8(target), `.${basename10(target)}.framework-update-cleanup.json`),
6600
7017
  cleanupMarkerTemporaryPrefix: `.${basename10(target)}.framework-update-cleanup-`
6601
7018
  });
6602
7019
  }
@@ -6700,10 +7117,10 @@ async function assertNoUpdateRetentionPruneArtifactsWhileLocked(target) {
6700
7117
 
6701
7118
  // ../../src/updates/retention/update-retirement.ts
6702
7119
  import { lstat as lstat16, mkdir as mkdir8, readdir as readdir11, rmdir, unlink as unlink2, writeFile as writeFile7 } from "fs/promises";
6703
- import { basename as basename13, dirname as dirname11, join as join25 } from "path";
7120
+ import { basename as basename13, dirname as dirname11, join as join27 } from "path";
6704
7121
  async function reconcileRetirementCleanupMarkerWhileLocked(options) {
6705
7122
  const { target, staging, currentVersion } = options;
6706
- const markerPath = join25(dirname11(target), `.${basename13(target)}.framework-update-cleanup.json`);
7123
+ const markerPath = join27(dirname11(target), `.${basename13(target)}.framework-update-cleanup.json`);
6707
7124
  const markerInfo = await pathInfo(markerPath);
6708
7125
  if (!markerInfo)
6709
7126
  return "none";
@@ -6744,7 +7161,7 @@ async function assertInstalledVersion(options) {
6744
7161
  const info = await lstat17(options.target);
6745
7162
  if (!info.isDirectory() || info.isSymbolicLink() || await realpath7(options.target) !== options.target)
6746
7163
  throw new Error("Invalid update install target");
6747
- const versionFile = join26(options.target, ...options.platform === "macos-arm64" ? ["Contents", "Resources"] : ["Resources"], "version.json");
7164
+ const versionFile = join28(options.target, ...options.platform === "macos-arm64" ? ["Contents", "Resources"] : ["Resources"], "version.json");
6748
7165
  const versionInfo = await lstat17(versionFile);
6749
7166
  if (!versionInfo.isFile() || versionInfo.size > 1024 * 1024)
6750
7167
  throw new Error("Installed update version mismatch");
@@ -6768,7 +7185,7 @@ async function stageUpdateSwap(options) {
6768
7185
  });
6769
7186
  const staging = updateStagingFor(plan.target);
6770
7187
  const preparing = await mkdtemp8(`${staging}.preparing-`);
6771
- const candidate = join26(staging, "candidate");
7188
+ const candidate = join28(staging, "candidate");
6772
7189
  let published = false;
6773
7190
  try {
6774
7191
  const extracted = await extractVerifiedUpdate({
@@ -6782,12 +7199,12 @@ async function stageUpdateSwap(options) {
6782
7199
  maxExpandedBytes: options.maxExpandedBytes,
6783
7200
  ...options.sidecars === undefined ? {} : { sidecars: options.sidecars }
6784
7201
  });
6785
- renameExclusive(extracted.payload, join26(preparing, "candidate"));
7202
+ renameExclusive(extracted.payload, join28(preparing, "candidate"));
6786
7203
  await rm8(extracted.directory, { recursive: true, force: true });
6787
- const candidateTreeIdentity = await readUpdateTreeIdentity(join26(preparing, "candidate"));
7204
+ const candidateTreeIdentity = await readUpdateTreeIdentity(join28(preparing, "candidate"));
6788
7205
  if (!candidateTreeIdentity)
6789
7206
  throw new Error("Update candidate tree identity could not be read");
6790
- const candidateTreeDigest = await readUpdateTreeDigest(join26(preparing, "candidate"));
7207
+ const candidateTreeDigest = await readUpdateTreeDigest(join28(preparing, "candidate"));
6791
7208
  await writeUpdateStageState(preparing, newUpdateStageState({
6792
7209
  version: plan.version,
6793
7210
  previousVersion: options.currentVersion,
@@ -6872,11 +7289,11 @@ function isolatedEnv(parent, profile, platform) {
6872
7289
  RUNNER_ENVIRONMENT: "github-hosted",
6873
7290
  HOME: profile,
6874
7291
  USERPROFILE: profile,
6875
- LOCALAPPDATA: join27(profile, "LocalAppData"),
6876
- XDG_DATA_HOME: join27(profile, ".local", "share"),
6877
- TMP: join27(profile, "tmp"),
6878
- TEMP: join27(profile, "tmp"),
6879
- TMPDIR: join27(profile, "tmp"),
7292
+ LOCALAPPDATA: join29(profile, "LocalAppData"),
7293
+ XDG_DATA_HOME: join29(profile, ".local", "share"),
7294
+ TMP: join29(profile, "tmp"),
7295
+ TEMP: join29(profile, "tmp"),
7296
+ TMPDIR: join29(profile, "tmp"),
6880
7297
  ELECTROBUN_INSTALLER_UI_AUTOCLOSE: "1"
6881
7298
  });
6882
7299
  if (platform === "windows-x64")
@@ -6971,15 +7388,15 @@ async function observeInstalledApp(options) {
6971
7388
  await preflightInstallerRuntime({ env: parent, runtime: candidate.path, bootstrap });
6972
7389
  stage("runtime-preflight-passed");
6973
7390
  for (const path of [
6974
- join27(prepared.profile, "LocalAppData"),
6975
- join27(prepared.profile, ".local", "share"),
6976
- join27(prepared.profile, "tmp")
7391
+ join29(prepared.profile, "LocalAppData"),
7392
+ join29(prepared.profile, ".local", "share"),
7393
+ join29(prepared.profile, "tmp")
6977
7394
  ])
6978
7395
  await mkdir9(path, { recursive: true, mode: 448 });
6979
7396
  const mac = options.platform === "macos-arm64", windows = options.platform === "windows-x64";
6980
- const installedRoot = mac ? join27(prepared.incoming, `${options.appName}.app`, "Contents") : join27(prepared.profile, windows ? "LocalAppData" : ".local/share", options.appId, "stable", "app");
6981
- const resources = join27(installedRoot, "Resources"), binary = join27(installedRoot, mac ? "MacOS" : "bin"), launcher = join27(binary, windows ? "launcher.exe" : "launcher"), runtime = join27(binary, windows ? "bun.exe" : "bun");
6982
- const worker = join27(resources, "app", "bun", "index.js");
7397
+ const installedRoot = mac ? join29(prepared.incoming, `${options.appName}.app`, "Contents") : join29(prepared.profile, windows ? "LocalAppData" : ".local/share", options.appId, "stable", "app");
7398
+ const resources = join29(installedRoot, "Resources"), binary = join29(installedRoot, mac ? "MacOS" : "bin"), launcher = join29(binary, windows ? "launcher.exe" : "launcher"), runtime = join29(binary, windows ? "bun.exe" : "bun");
7399
+ const worker = join29(resources, "app", "bun", "index.js");
6983
7400
  const sidecars = options.sidecars ?? [];
6984
7401
  let foreignHits = 0;
6985
7402
  const sentinel = policy ? Bun.serve({
@@ -7030,7 +7447,7 @@ async function observeInstalledApp(options) {
7030
7447
  throw new Error("Foreign network sentinel unavailable");
7031
7448
  foreignHits = 0;
7032
7449
  const nonce = randomBytes2(24).toString("hex");
7033
- const ack = join27(run.directory, "ack"), permit = join27(run.directory, "permit"), observation = join27(run.directory, "observation"), unexpected = join27(run.directory, "unexpected"), pidRecord = join27(run.directory, "worker-pid");
7450
+ const ack = join29(run.directory, "ack"), permit = join29(run.directory, "permit"), observation = join29(run.directory, "observation"), unexpected = join29(run.directory, "unexpected"), pidRecord = join29(run.directory, "worker-pid");
7034
7451
  const env = {
7035
7452
  ...baseEnv,
7036
7453
  FRAMEWORK_CI_NONCE: nonce,
@@ -7043,13 +7460,13 @@ async function observeInstalledApp(options) {
7043
7460
  };
7044
7461
  let launchRecord, expectedApp;
7045
7462
  if (mac && viaInstaller) {
7046
- const shimDir = join27(run.directory, "launch-shim");
7463
+ const shimDir = join29(run.directory, "launch-shim");
7047
7464
  await mkdir9(shimDir, { mode: 448 });
7048
- const path = join27(shimDir, "open");
7465
+ const path = join29(shimDir, "open");
7049
7466
  await writeFile8(path, shim, { flag: "wx", mode: 448 });
7050
7467
  await chmod2(path, 448);
7051
- expectedApp = join27(await realpath8(prepared.incoming), `${options.appName}.app`);
7052
- launchRecord = join27(run.directory, "launch-record");
7468
+ expectedApp = join29(await realpath8(prepared.incoming), `${options.appName}.app`);
7469
+ launchRecord = join29(run.directory, "launch-record");
7053
7470
  Object.assign(env, {
7054
7471
  PATH: shimDir + delimiter + (env.PATH ?? ""),
7055
7472
  FRAMEWORK_CI_EXPECTED_APP: expectedApp,
@@ -7085,7 +7502,7 @@ async function observeInstalledApp(options) {
7085
7502
  const error = installerErrorName(await Promise.race([installerStderr, Bun.sleep(2000).then(() => "")]));
7086
7503
  throw new Error(`Installer exited unsuccessfully (exit=${installer.exitCode}, signal=${installer.signalCode ?? "none"}, ` + `ready=${await pathExists(worker) && await pathExists(launcher)}, acknowledged=${await pathExists(ack)}, ` + `error=${error ?? "none"})`);
7087
7504
  }
7088
- const ready = await pathExists(worker) && await pathExists(launcher) && await pathExists(join27(resources, "version.json"));
7505
+ const ready = await pathExists(worker) && await pathExists(launcher) && await pathExists(join29(resources, "version.json"));
7089
7506
  if (installer && shouldLaunchInstalledApp({
7090
7507
  platform: options.platform,
7091
7508
  ready,
@@ -7261,7 +7678,7 @@ async function observeInstalledApp(options) {
7261
7678
  await swapAfterExit(target, staged.staging);
7262
7679
  stage("update-swapped");
7263
7680
  await preflightInstallerRuntime({ env: parent, runtime, bootstrap });
7264
- const directory = join27(prepared.directory, "update");
7681
+ const directory = join29(prepared.directory, "update");
7265
7682
  await mkdir9(directory, { mode: 448 });
7266
7683
  const updated = await observeRun({
7267
7684
  directory,
@@ -7310,7 +7727,7 @@ async function qualifyInstallerCommand(options) {
7310
7727
  const parsed = parseReleaseConfig(config), requirements = parsed.requirements(tag), policy = requirements.offlinePolicy, names = requirements.platforms[platform];
7311
7728
  if (!policy || !names || names.length !== 2)
7312
7729
  throw new Error("Installer qualification requires an explicit offline policy and payloads");
7313
- const directory = resolve13(options.directory), destination = join28(directory, `installer-test-${platform}.json`);
7730
+ const directory = resolve13(options.directory), destination = join30(directory, `installer-test-${platform}.json`);
7314
7731
  try {
7315
7732
  await lstat18(destination);
7316
7733
  throw new Error("Installer receipt already exists");
@@ -7326,8 +7743,8 @@ async function qualifyInstallerCommand(options) {
7326
7743
  appName: app.appName,
7327
7744
  appId: app.appId,
7328
7745
  version: plan.version,
7329
- installer: join28(directory, names[0]),
7330
- archive: join28(directory, names[1]),
7746
+ installer: join30(directory, names[0]),
7747
+ archive: join30(directory, names[1]),
7331
7748
  expectedReads: parsed.expectedReads,
7332
7749
  offlinePolicy: policy,
7333
7750
  sidecars: parsed.sidecars
@@ -7359,7 +7776,7 @@ async function qualifyInstallerCommand(options) {
7359
7776
 
7360
7777
  // ../../src/installer/installer-upgrade-command.ts
7361
7778
  import { lstat as lstat19, mkdir as mkdir10, rename as rename2, writeFile as writeFile10 } from "fs/promises";
7362
- import { join as join30, resolve as resolve15 } from "path";
7779
+ import { join as join32, resolve as resolve15 } from "path";
7363
7780
 
7364
7781
  // ../../src/installer/upgrade-asset-download.ts
7365
7782
  import { createHash as createHash14 } from "crypto";
@@ -7495,7 +7912,7 @@ async function discoverSignedRelease(options) {
7495
7912
 
7496
7913
  // ../../src/updates/install/update-download.ts
7497
7914
  import { mkdtemp as mkdtemp9, open as open12, realpath as realpath9, rm as rm9 } from "fs/promises";
7498
- import { basename as basename14, dirname as dirname13, join as join29, resolve as resolve14 } from "path";
7915
+ import { basename as basename14, dirname as dirname13, join as join31, resolve as resolve14 } from "path";
7499
7916
  async function downloadVerifiedRelease(options) {
7500
7917
  const { descriptor, maxBytes } = options;
7501
7918
  const timeout = options.timeoutMs ?? 120000;
@@ -7528,12 +7945,12 @@ async function downloadVerifiedRelease(options) {
7528
7945
  throw new Error("Release download size mismatch");
7529
7946
  }
7530
7947
  const root = options.createTemporaryDirectory ? await realpath9(resolve14(options.directory)) : resolve14(options.directory);
7531
- const allocated = options.createTemporaryDirectory ? await options.createTemporaryDirectory(root) : await mkdtemp9(join29(root, "framework-update-"));
7948
+ const allocated = options.createTemporaryDirectory ? await options.createTemporaryDirectory(root) : await mkdtemp9(join31(root, "framework-update-"));
7532
7949
  const temporaryDirectory = resolve14(allocated);
7533
7950
  if (dirname13(temporaryDirectory) !== root || !basename14(temporaryDirectory).startsWith("framework-update-"))
7534
7951
  throw new Error("Invalid update download directory");
7535
7952
  temporary = temporaryDirectory;
7536
- const path = join29(temporary, "archive");
7953
+ const path = join31(temporary, "archive");
7537
7954
  const file = await open12(path, "wx", 384);
7538
7955
  try {
7539
7956
  async function* writeChunks() {
@@ -7636,7 +8053,7 @@ async function qualifyUpgradeCommand(options) {
7636
8053
  const parsed = parseReleaseConfig(config), feed = feedUrl(parsed.feed), requirements = parsed.requirements(tag), names = requirements.platforms[platform];
7637
8054
  if (!requirements.offlinePolicy || !names || names.length !== 2)
7638
8055
  throw new Error("Upgrade qualification requires an explicit offline policy and payloads");
7639
- const directory = resolve15(options.directory), destination = join30(directory, `upgrade-test-${platform}.json`);
8056
+ const directory = resolve15(options.directory), destination = join32(directory, `upgrade-test-${platform}.json`);
7640
8057
  try {
7641
8058
  await lstat19(destination);
7642
8059
  throw new Error("Upgrade receipt already exists");
@@ -7659,7 +8076,7 @@ async function qualifyUpgradeCommand(options) {
7659
8076
  const channel = "daily";
7660
8077
  const trust = { ...base, channel };
7661
8078
  const discovery = discoveryName(config, channel, platform);
7662
- const signed = await readJsonFile(join30(directory, discovery), 65536, "staged descriptor");
8079
+ const signed = await readJsonFile(join32(directory, discovery), 65536, "staged descriptor");
7663
8080
  const verified = verifyReleaseDescriptor(signed, trust);
7664
8081
  if (!verified.ok || verified.descriptor.tag !== tag || verified.descriptor.asset.name !== names[1])
7665
8082
  throw new Error("Untrusted staged descriptor");
@@ -7682,7 +8099,7 @@ async function qualifyUpgradeCommand(options) {
7682
8099
  return null;
7683
8100
  if (previous.tag === tag || !versionLessThan(previous.version, descriptor.version))
7684
8101
  throw new Error("Previous release is not older than this release");
7685
- const work = join30(directory, `upgrade-${platform}`);
8102
+ const work = join32(directory, `upgrade-${platform}`);
7686
8103
  await mkdir10(work, { mode: 448 });
7687
8104
  const downloaded = await downloadVerifiedRelease({
7688
8105
  descriptor: previous,
@@ -7691,12 +8108,12 @@ async function qualifyUpgradeCommand(options) {
7691
8108
  timeoutMs: 600000,
7692
8109
  fetch: fetcher
7693
8110
  });
7694
- const previousArchive = join30(work, previous.asset.name);
8111
+ const previousArchive = join32(work, previous.asset.name);
7695
8112
  await rename2(downloaded.path, previousArchive);
7696
8113
  const installerName = parsed.requirements(previous.tag).platforms[platform]?.[0];
7697
8114
  if (!installerName)
7698
8115
  throw new Error("Previous release has no installer for this platform");
7699
- const previousInstaller = join30(work, installerName);
8116
+ const previousInstaller = join32(work, installerName);
7700
8117
  await downloadAsset({
7701
8118
  feed,
7702
8119
  tag: previous.tag,
@@ -7720,7 +8137,7 @@ async function qualifyUpgradeCommand(options) {
7720
8137
  update: {
7721
8138
  descriptor,
7722
8139
  trust,
7723
- archive: join30(directory, names[1]),
8140
+ archive: join32(directory, names[1]),
7724
8141
  maxCompressedBytes: MAX_COMPRESSED_BYTES2,
7725
8142
  maxExpandedBytes: MAX_EXPANDED_BYTES2
7726
8143
  }
@@ -7743,7 +8160,7 @@ async function qualifyUpgradeCommand(options) {
7743
8160
  }
7744
8161
 
7745
8162
  // src/library/steps.ts
7746
- var selectRetainedStepEffect = (context) => Effect22.gen(function* () {
8163
+ var selectRetainedStepEffect = (context) => Effect24.gen(function* () {
7747
8164
  const output = context.env.GITHUB_OUTPUT;
7748
8165
  if (!output)
7749
8166
  return yield* fail("Expected GITHUB_OUTPUT");
@@ -7755,7 +8172,7 @@ runId=${result.runId}
7755
8172
  ` : `reuse=false
7756
8173
  `));
7757
8174
  });
7758
- var stageBuildStepEffect = (context, directory, artifacts = "artifacts") => Effect22.gen(function* () {
8175
+ var stageBuildStepEffect = (context, directory, artifacts = "artifacts") => Effect24.gen(function* () {
7759
8176
  const fs = yield* ReleaseFs;
7760
8177
  const [installerAsset, archiveAsset] = platformAssets(context);
7761
8178
  const [installer, archive] = electrobunArtifacts(context.config.appName, context.platform);
@@ -7764,12 +8181,12 @@ var stageBuildStepEffect = (context, directory, artifacts = "artifacts") => Effe
7764
8181
  yield* step(() => fs.mkdir(directory, { recursive: true }));
7765
8182
  const packed = yield* scopedTempDirectory("framework-command-pack-");
7766
8183
  const sources = {
7767
- [installerAsset]: join31(artifacts, installer),
7768
- [archiveAsset]: join31(artifacts, archive)
8184
+ [installerAsset]: join33(artifacts, installer),
8185
+ [archiveAsset]: join33(artifacts, archive)
7769
8186
  };
7770
8187
  for (const policy of parsed.commandArtifacts) {
7771
8188
  const name = requirements.commandArtifacts[policy.kind][context.platform];
7772
- sources[name] = join31(packed, name);
8189
+ sources[name] = join33(packed, name);
7773
8190
  yield* step(() => packCommandArtifact({
7774
8191
  source: policy.build,
7775
8192
  archive: sources[name],
@@ -7778,8 +8195,8 @@ var stageBuildStepEffect = (context, directory, artifacts = "artifacts") => Effe
7778
8195
  }));
7779
8196
  }
7780
8197
  return yield* stagePlatformArtifactsEffect({ ...context, directory, sources });
7781
- }).pipe(Effect22.scoped);
7782
- var inspectStagedStepEffect = (context, directory) => Effect22.gen(function* () {
8198
+ }).pipe(Effect24.scoped);
8199
+ var inspectStagedStepEffect = (context, directory) => Effect24.gen(function* () {
7783
8200
  const fs = yield* ReleaseFs;
7784
8201
  const parsed = parseReleaseConfig(context.config);
7785
8202
  const requirements = parsed.requirements(context.tag);
@@ -7787,10 +8204,10 @@ var inspectStagedStepEffect = (context, directory) => Effect22.gen(function* ()
7787
8204
  const entries = yield* step(() => fs.readdir(directory, { withFileTypes: true }));
7788
8205
  if (entries.length !== assets.length || entries.some((entry) => !entry.isFile() || !assets.includes(entry.name)))
7789
8206
  return yield* fail("Staged platform directory contains unexpected files");
7790
- const [installer, archive] = platformAssets(context).map((name) => join31(directory, name));
8207
+ const [installer, archive] = platformAssets(context).map((name) => join33(directory, name));
7791
8208
  for (const policy of parsed.commandArtifacts)
7792
8209
  yield* step(() => readCommandArtifact({
7793
- archive: join31(directory, requirements.commandArtifacts[policy.kind][context.platform]),
8210
+ archive: join33(directory, requirements.commandArtifacts[policy.kind][context.platform]),
7794
8211
  executable: policy.executable,
7795
8212
  platform: context.platform
7796
8213
  }));
@@ -7806,12 +8223,12 @@ var inspectStagedStepEffect = (context, directory) => Effect22.gen(function* ()
7806
8223
  }))
7807
8224
  };
7808
8225
  });
7809
- var qualifyStepEffect = (context, directory) => Effect22.gen(function* () {
8226
+ var qualifyStepEffect = (context, directory) => Effect24.gen(function* () {
7810
8227
  const mode = stepRenderer(context.env);
7811
8228
  yield* step(() => qualifyCommandArtifactsCommand({ ...context, directory }));
7812
8229
  yield* step(() => qualifyInstallerCommand({ ...context, renderer: mode, directory }));
7813
8230
  });
7814
- var qualifyUpgradeStepEffect = (context, directory, onStage) => Effect22.suspend(() => {
8231
+ var qualifyUpgradeStepEffect = (context, directory, onStage) => Effect24.suspend(() => {
7815
8232
  const renderer = stepRenderer(context.env);
7816
8233
  return step(() => qualifyUpgradeCommand({ ...context, renderer, directory, ...onStage ? { onStage } : {} }));
7817
8234
  });
@@ -7842,19 +8259,55 @@ function electrobunArtifacts(appName, platform) {
7842
8259
  }[platform];
7843
8260
  }
7844
8261
 
8262
+ // src/library/daily-batch.ts
8263
+ import { join as join34, resolve as resolve16 } from "path";
8264
+ import { Effect as Effect25, Exit as Exit4 } from "effect";
8265
+ var stageDailyBatchEffect = (options) => Effect25.gen(function* () {
8266
+ const fs = yield* ReleaseFs;
8267
+ const parent = resolve16(options.parent);
8268
+ const root = yield* step(() => fs.lstat(parent));
8269
+ if (!root.isDirectory() || root.isSymbolicLink())
8270
+ return yield* fail("Daily staging needs an existing real scratch parent");
8271
+ const original = yield* verifyDailyReleaseMatrixEffect(options);
8272
+ const plan = yield* attempt(() => planDailyReleaseMatrix(options.config, options.identity.tag));
8273
+ const directory = yield* Effect25.acquireRelease(step(() => fs.mkdtemp(join34(parent, "daily-candidate-"))), (path, exit) => Exit4.isSuccess(exit) ? Effect25.void : Effect25.promise(() => fs.rm(path, { recursive: true, force: true })));
8274
+ const copy = (source, name, expected) => Effect25.gen(function* () {
8275
+ const target = join34(directory, name);
8276
+ yield* step(() => fs.mkdir(target, { mode: 448 }));
8277
+ yield* stageExpectedFilesEffect({
8278
+ expected,
8279
+ directory: target,
8280
+ sources: Object.fromEntries(expected.map((file) => [file, join34(source, file)]))
8281
+ });
8282
+ return target;
8283
+ });
8284
+ const artifacts = yield* copy(options.artifacts, "artifacts", plan.assets);
8285
+ const receipts = yield* copy(options.receipts, "receipts", plan.checks.map((check) => check.name + ".json"));
8286
+ const staged = yield* verifyDailyReleaseMatrixEffect({ ...options, artifacts, receipts });
8287
+ if (original.assets.some((a, index) => a.name !== staged.assets[index]?.name || a.size !== staged.assets[index]?.size || a.digest !== staged.assets[index]?.digest))
8288
+ return yield* fail("Daily inputs changed between inspection and local staging");
8289
+ const manifest = { schema: "framework/daily-staged-batch/v1", ...staged };
8290
+ yield* step(() => fs.writeFile(join34(directory, "candidate.json"), JSON.stringify(manifest) + `
8291
+ `, {
8292
+ flag: "wx",
8293
+ mode: 384
8294
+ }));
8295
+ return { directory, ...manifest };
8296
+ }).pipe(Effect25.scoped);
8297
+
7845
8298
  // src/cli-runner.ts
7846
- import { Cause as Cause3, Effect as Effect23, Exit as Exit4 } from "effect";
8299
+ import { Cause as Cause3, Effect as Effect26, Exit as Exit5 } from "effect";
7847
8300
  function failureError(cause) {
7848
8301
  const error = Cause3.squash(cause);
7849
8302
  if (error instanceof ReleaseFailure)
7850
8303
  return new Error(error.message);
7851
8304
  return error instanceof Error ? error : new Error(String(error));
7852
8305
  }
7853
- var runCommand = (failure, program, options = {}) => Effect23.gen(function* () {
8306
+ var runCommand = (failure, program, options = {}) => Effect26.gen(function* () {
7854
8307
  const { env } = yield* ReleaseConfig;
7855
8308
  const output = yield* ReleaseOutput;
7856
- const exit = yield* Effect23.exit(options.requireGitHubActions && env.GITHUB_ACTIONS !== "true" ? refuse("untrusted", "Invalid workflow invocation") : program);
7857
- if (Exit4.isSuccess(exit))
8309
+ const exit = yield* Effect26.exit(options.requireGitHubActions && env.GITHUB_ACTIONS !== "true" ? refuse("untrusted", "Invalid workflow invocation") : program);
8310
+ if (Exit5.isSuccess(exit))
7858
8311
  return 0;
7859
8312
  if (Cause3.hasInterruptsOnly(exit.cause))
7860
8313
  return 130;
@@ -7864,7 +8317,7 @@ var runCommand = (failure, program, options = {}) => Effect23.gen(function* () {
7864
8317
  return 1;
7865
8318
  });
7866
8319
  var readReleaseConfig = (path) => readBoundedJson(path, 262144);
7867
- var readBoundedJson = (path, maxBytes, name = "configuration file") => Effect23.gen(function* () {
8320
+ var readBoundedJson = (path, maxBytes, name = "configuration file") => Effect26.gen(function* () {
7868
8321
  const fs = yield* ReleaseFs;
7869
8322
  const info = yield* step(() => fs.lstat(path));
7870
8323
  if (!info.isFile() || info.size < 1 || info.size > maxBytes)
@@ -7874,48 +8327,905 @@ var readBoundedJson = (path, maxBytes, name = "configuration file") => Effect23.
7874
8327
  return yield* refuse("file-changed", `${name[0].toUpperCase()}${name.slice(1)} changed`);
7875
8328
  return yield* step(async () => JSON.parse(bytes.toString("utf8")));
7876
8329
  });
7877
- var provideLivePorts = (program) => program.pipe(Effect23.provideService(ReleaseConfig, {
8330
+ var provideLivePorts = (program) => program.pipe(Effect26.provideService(ReleaseConfig, {
7878
8331
  env: process.env,
7879
8332
  platform: process.platform,
7880
8333
  arch: process.arch,
7881
8334
  cwd: process.cwd()
7882
- }), Effect23.provideService(ReleaseOutput, {
8335
+ }), Effect26.provideService(ReleaseOutput, {
7883
8336
  stdout: (text) => void process.stdout.write(text),
7884
8337
  stderr: (text) => void process.stderr.write(text)
7885
- }), Effect23.provideService(ReleaseGit, { run: gitRun }), Effect23.provideService(ReleaseGitHub, { run: ghRun, withEnvironment: ghRunWith }), Effect23.provideService(ReleaseFetch, { fetch }), Effect23.provideService(ReleaseClock, {
8338
+ }), Effect26.provideService(ReleaseGit, { run: gitRun }), Effect26.provideService(ReleaseGitHub, { run: ghRun, withEnvironment: ghRunWith }), Effect26.provideService(ReleaseFetch, { fetch }), Effect26.provideService(ReleaseClock, {
7886
8339
  sleep: (milliseconds) => Bun.sleep(milliseconds),
7887
8340
  now: () => new Date().toISOString()
7888
- }), Effect23.provideService(ReleaseFs, nodeFs), Effect23.provideService(ReleaseSigning, {
8341
+ }), Effect26.provideService(ReleaseFs, nodeFs), Effect26.provideService(ReleaseSigning, {
7889
8342
  privateKey: environmentKey(process.env),
7890
8343
  codesign: codesignRun
7891
8344
  }));
7892
8345
 
8346
+ // src/commands/prepare-stable-catalog.ts
8347
+ import { createHash as createHash16 } from "crypto";
8348
+ import { createReadStream } from "fs";
8349
+ import { lstat as lstat20, mkdir as mkdir11, readFile as readFile10, rm as rm10, writeFile as writeFile11 } from "fs/promises";
8350
+ import { basename as basename15, dirname as dirname14, join as join35 } from "path";
8351
+
8352
+ // src/library/stable-catalogs.ts
8353
+ function object(value) {
8354
+ if (typeof value !== "object" || value === null || Array.isArray(value))
8355
+ throw new Error("Expected a JSON object");
8356
+ return value;
8357
+ }
8358
+ function requireText(value, label, pattern) {
8359
+ if (typeof value !== "string" || value.length < 1 || value.length > 200 || Array.from(value).some((c) => c.charCodeAt(0) < 32 || c.charCodeAt(0) === 127) || pattern && !pattern.test(value))
8360
+ throw new Error(`Invalid ${label}`);
8361
+ return value;
8362
+ }
8363
+ function requireHttps(value, label) {
8364
+ const url = new URL(requireText(value, label));
8365
+ if (url.protocol !== "https:" || url.username || url.password || url.search || url.hash)
8366
+ throw new Error(`Expected canonical HTTPS URL for ${label}`);
8367
+ return url;
8368
+ }
8369
+ var sha = (value) => requireText(value, "SHA-256", /^[a-f0-9]{64}$/);
8370
+ var source = (value) => requireText(value, "source SHA", /^[a-f0-9]{40}$/);
8371
+ var file = (value) => requireText(value, "asset name", /^[a-zA-Z0-9][a-zA-Z0-9._-]*$/);
8372
+ var quoted = JSON.stringify;
8373
+ var ruby = (value) => JSON.stringify(value).replace(/#(?=[{@$])/g, "\\#");
8374
+ function asset(value) {
8375
+ const row = object(value);
8376
+ const size = row.size;
8377
+ if (typeof size !== "number" || !Number.isSafeInteger(size) || size <= 0)
8378
+ throw new Error("Invalid asset size");
8379
+ return { name: file(row.name), size, sha256: sha(row.sha256) };
8380
+ }
8381
+ function select(value, name, tag, stable = false) {
8382
+ const doc = object(value);
8383
+ if (doc.tag !== tag || !Array.isArray(doc.assets) || stable && doc.channel !== "stable")
8384
+ throw new Error(stable ? "Expected matching Stable pointer" : "Expected exact asset manifest");
8385
+ const matching = doc.assets.filter((row) => object(row).name === name);
8386
+ if (matching.length !== 1)
8387
+ throw new Error("Expected exactly one matching installer asset");
8388
+ return asset(matching[0]);
8389
+ }
8390
+ function equal(actual, expected) {
8391
+ return actual.name === expected.name && actual.size === expected.size && actual.sha256 === expected.sha256;
8392
+ }
8393
+ function requireChecks(receipt, keys) {
8394
+ if (keys.some((key) => receipt[key] !== true))
8395
+ throw new Error("Missing required native signing, install, launch, upgrade or manager proof");
8396
+ }
8397
+ function prepareStableCatalog(input) {
8398
+ const { channel, phase, measuredAsset } = input;
8399
+ if (channel !== "homebrew" && channel !== "winget" || phase !== "preflight" && phase !== "published-stable")
8400
+ throw new Error("Invalid catalog channel or release phase");
8401
+ const config = object(input.config);
8402
+ const name = requireText(config.name, "product name");
8403
+ const desc = requireText(config.description, "description");
8404
+ const homepage = requireHttps(config.homepage, "homepage").href;
8405
+ const base = requireHttps(config.releaseBase, "release base");
8406
+ if (!base.pathname.endsWith("/"))
8407
+ throw new Error("Expected release base directory URL");
8408
+ const channelConfig = object(config[channel]);
8409
+ const receipt = object(input.receipt);
8410
+ const tag = requireText(receipt.tag, "release tag", /^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/);
8411
+ if (receipt.schema !== "stable-catalog.v1" || receipt.channel !== channel)
8412
+ throw new Error("Wrong qualification receipt");
8413
+ if (source(receipt.sourceSha) !== source(input.expectedSourceSha))
8414
+ throw new Error("Receipt source differs from the protected candidate source");
8415
+ const template = requireText(channelConfig.artifact, "asset template", /^[A-Za-z0-9][A-Za-z0-9._-]*\{tag\}[A-Za-z0-9._-]*$/);
8416
+ const assetName = file(template.replace("{tag}", tag));
8417
+ if (!assetName.endsWith(channel === "homebrew" ? ".dmg" : ".zip"))
8418
+ throw new Error("Wrong installer format");
8419
+ const staged = select(input.manifest, assetName, tag);
8420
+ if (!equal(staged, asset(measuredAsset)) || !equal(staged, asset(receipt.asset)))
8421
+ throw new Error("Digest or size disagrees across installer bytes, manifest and receipt");
8422
+ if (phase === "published-stable" && !equal(staged, select(input.stablePointer, assetName, tag, true)))
8423
+ throw new Error("Stable pointer disagrees with installer release manifest");
8424
+ const version = tag.slice(1);
8425
+ const url = new URL(`${tag}/${assetName}`, base).href;
8426
+ requireChecks(receipt, [
8427
+ "freshInstall",
8428
+ "launch",
8429
+ "upgrade",
8430
+ "profileRetained",
8431
+ "managerOwnsUpdates"
8432
+ ]);
8433
+ if (channel === "homebrew") {
8434
+ requireChecks(receipt, ["developerId", "notarized"]);
8435
+ if (receipt.platform !== "macos-arm64")
8436
+ throw new Error("Wrong macOS qualification platform");
8437
+ const token = requireText(channelConfig.token, "cask token", /^[a-z0-9]+(?:-[a-z0-9]+)*$/);
8438
+ const bundle = requireText(channelConfig.bundle, "app bundle", /^[A-Za-z0-9][A-Za-z0-9 ._-]*\.app$/);
8439
+ return [
8440
+ {
8441
+ path: `Casks/${token}.rb`,
8442
+ contents: `cask ${ruby(token)} do
8443
+ version ${ruby(version)}
8444
+ sha256 ${ruby(staged.sha256)}
8445
+
8446
+ url ${ruby(url)}
8447
+ name ${ruby(name)}
8448
+ desc ${ruby(desc)}
8449
+ homepage ${ruby(homepage)}
8450
+
8451
+ depends_on arch: :arm64
8452
+
8453
+ app ${ruby(bundle)}
8454
+ end
8455
+ `
8456
+ }
8457
+ ];
8458
+ }
8459
+ requireChecks(receipt, ["authenticode", "windows11", "windows10", "unattended", "uninstall"]);
8460
+ if (receipt.platform !== "windows-x64")
8461
+ throw new Error("Wrong Windows qualification platform");
8462
+ const id = requireText(channelConfig.identifier, "WinGet package identifier", /^[A-Za-z0-9][A-Za-z0-9-]*(\.[A-Za-z0-9][A-Za-z0-9-]*)+$/);
8463
+ const publisher = requireText(channelConfig.publisher, "WinGet publisher");
8464
+ const license = requireText(channelConfig.license, "license");
8465
+ const exe = requireText(receipt.nestedInstaller, "nested executable", /^[A-Za-z0-9][A-Za-z0-9 ._-]*\.exe$/i);
8466
+ const flags = /^[-/][a-zA-Z0-9_-]+(?: [-/][a-zA-Z0-9_-]+)*$/;
8467
+ const silent = requireText(receipt.silent, "silent flags", flags);
8468
+ const progress = requireText(receipt.silentWithProgress, "silent progress flags", flags);
8469
+ const schemaVersion = "1.12.0";
8470
+ const path = `manifests/${id[0].toLowerCase()}/${id.replaceAll(".", "/")}/${version}/${id}`;
8471
+ const manifest = (type, body) => `# yaml-language-server: $schema=https://aka.ms/winget-manifest.${type}.${schemaVersion}.schema.json
8472
+ PackageIdentifier: ${quoted(id)}
8473
+ PackageVersion: ${quoted(version)}
8474
+ ${body}ManifestType: ${type}
8475
+ ManifestVersion: ${schemaVersion}
8476
+ `;
8477
+ return [
8478
+ { path: `${path}.yaml`, contents: manifest("version", `DefaultLocale: en-US
8479
+ `) },
8480
+ {
8481
+ path: `${path}.installer.yaml`,
8482
+ contents: manifest("installer", `InstallerType: zip
8483
+ NestedInstallerType: exe
8484
+ NestedInstallerFiles:
8485
+ - RelativeFilePath: ${quoted(exe)}
8486
+ InstallerSwitches:
8487
+ Silent: ${quoted(silent)}
8488
+ SilentWithProgress: ${quoted(progress)}
8489
+ Installers:
8490
+ - Architecture: x64
8491
+ InstallerUrl: ${quoted(url)}
8492
+ InstallerSha256: ${staged.sha256.toUpperCase()}
8493
+ `)
8494
+ },
8495
+ {
8496
+ path: `${path}.locale.en-US.yaml`,
8497
+ contents: manifest("defaultLocale", `PackageLocale: en-US
8498
+ Publisher: ${quoted(publisher)}
8499
+ PublisherUrl: ${quoted(homepage)}
8500
+ PackageName: ${quoted(name)}
8501
+ PackageUrl: ${quoted(homepage)}
8502
+ License: ${quoted(license)}
8503
+ ShortDescription: ${quoted(desc)}
8504
+ `)
8505
+ }
8506
+ ];
8507
+ }
8508
+
8509
+ // src/commands/prepare-stable-catalog.ts
8510
+ var read2 = async (path) => {
8511
+ const stat = await lstat20(path);
8512
+ if (!stat.isFile() || stat.size > 1024 * 1024)
8513
+ throw new Error("Expected bounded ordinary JSON file");
8514
+ return JSON.parse(await readFile10(path, "utf8"));
8515
+ };
8516
+ async function prepareStableCatalogCommand(args) {
8517
+ const [
8518
+ channel,
8519
+ phase,
8520
+ expectedSourceSha,
8521
+ configPath,
8522
+ receiptPath,
8523
+ manifestPath,
8524
+ artifact,
8525
+ out,
8526
+ stablePointerPath,
8527
+ ...extra
8528
+ ] = args;
8529
+ if (channel !== "homebrew" && channel !== "winget" || phase !== "preflight" && phase !== "published-stable" || !expectedSourceSha || !configPath || !receiptPath || !manifestPath || !artifact || !out || extra.length || phase === "published-stable" !== Boolean(stablePointerPath))
8530
+ throw new Error("Expected channel, phase, source SHA, config, receipt, manifest, archive, new output directory [stable pointer]");
8531
+ const st = await lstat20(artifact);
8532
+ if (!st.isFile())
8533
+ throw new Error("Expected ordinary installer file");
8534
+ const hash = createHash16("sha256");
8535
+ for await (const chunk of createReadStream(artifact))
8536
+ hash.update(chunk);
8537
+ const files = prepareStableCatalog({
8538
+ channel,
8539
+ phase,
8540
+ expectedSourceSha,
8541
+ config: await read2(configPath),
8542
+ receipt: await read2(receiptPath),
8543
+ manifest: await read2(manifestPath),
8544
+ stablePointer: stablePointerPath && await read2(stablePointerPath),
8545
+ measuredAsset: { name: basename15(artifact), size: st.size, sha256: hash.digest("hex") }
8546
+ });
8547
+ await mkdir11(out);
8548
+ try {
8549
+ for (const entry of files) {
8550
+ const target = join35(out, entry.path);
8551
+ await mkdir11(dirname14(target), { recursive: true });
8552
+ await writeFile11(target, entry.contents, { flag: "wx" });
8553
+ }
8554
+ return { channel, phase, files: files.length };
8555
+ } catch (error) {
8556
+ await rm10(out, { recursive: true, force: true });
8557
+ throw error;
8558
+ }
8559
+ }
8560
+
8561
+ // src/library/apt/stage-apt-repository.ts
8562
+ import { spawnSync as spawnSync2 } from "child_process";
8563
+ import { mkdir as mkdir12, readFile as readFile11, rm as rm11, writeFile as writeFile12 } from "fs/promises";
8564
+ import { dirname as dirname15, isAbsolute as isAbsolute6, join as join36 } from "path";
8565
+
8566
+ // src/library/apt/apt-metadata.ts
8567
+ import { createHash as createHash17 } from "crypto";
8568
+ import { gzipSync } from "zlib";
8569
+ var sha256 = (data) => createHash17("sha256").update(data).digest("hex");
8570
+ function stageAptMetadata({ policy, tag, assets, deb, control, now }) {
8571
+ if (!/^v(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)$/.test(tag))
8572
+ throw new Error("Invalid release tag");
8573
+ const { packageName, architecture, assetName: name, suite, origin } = policy;
8574
+ if (!/^[a-z][a-z0-9+.-]{1,62}$/.test(packageName) || architecture !== "amd64" && architecture !== "arm64" || !/^[A-Za-z0-9][A-Za-z0-9_.+-]*\.deb$/.test(name) || suite !== "daily" && suite !== "stable" || !/^[A-Za-z0-9][A-Za-z0-9 .+_-]{0,62}$/.test(origin))
8575
+ throw new Error("Invalid Debian repository policy");
8576
+ const matching = assets.filter((asset) => asset.name === name);
8577
+ if (matching.length !== 1)
8578
+ throw new Error("Require one staged Debian artifact");
8579
+ const asset = matching[0];
8580
+ if (!deb.length || asset.size !== deb.length || asset.sha256 !== sha256(deb))
8581
+ throw new Error("Staged Debian bytes do not match the verified release inventory");
8582
+ const fields = new Map;
8583
+ let lines = control.replaceAll(`\r
8584
+ `, `
8585
+ `).split(`
8586
+ `);
8587
+ if (lines.at(-1) === "")
8588
+ lines = lines.slice(0, -1);
8589
+ for (const [index, line] of lines.entries()) {
8590
+ if (/^[ \t]/.test(line) && index !== 0)
8591
+ continue;
8592
+ const field = /^([a-z][a-z0-9-]*):[ \t]*(.*)$/i.exec(line);
8593
+ if (!field || fields.has(field[1].toLowerCase()))
8594
+ throw new Error("Invalid or duplicate Debian control field");
8595
+ fields.set(field[1].toLowerCase(), field[2]);
8596
+ }
8597
+ for (const key of ["filename", "size", "md5sum", "sha1", "sha256", "sha512"])
8598
+ if (fields.has(key))
8599
+ throw new Error("Debian control includes repository-owned metadata");
8600
+ if (fields.get("package") !== packageName || fields.get("version") !== tag.slice(1) || fields.get("architecture") !== architecture || !fields.get("description"))
8601
+ throw new Error("Unexpected Debian package, version, architecture or description");
8602
+ if (!Number.isFinite(now.getTime()))
8603
+ throw new Error("Invalid release timestamp");
8604
+ const filename = `pool/main/${packageName[0]}/${packageName}/${name}`;
8605
+ const entries = `${lines.join(`
8606
+ `)}
8607
+ Filename: ${filename}
8608
+ Size: ${asset.size}
8609
+ SHA256: ${asset.sha256}
8610
+
8611
+ `;
8612
+ const plain = new TextEncoder().encode(entries);
8613
+ const compressed = gzipSync(plain);
8614
+ const directories = `main/binary-${architecture}`;
8615
+ const members = [
8616
+ [`${directories}/Packages`, plain],
8617
+ [`${directories}/Packages.gz`, compressed]
8618
+ ];
8619
+ const release = [
8620
+ `Origin: ${origin}`,
8621
+ `Label: ${origin} ${suite}`,
8622
+ `Suite: ${suite}`,
8623
+ `Codename: ${suite}`,
8624
+ `Date: ${now.toUTCString()}`,
8625
+ `Valid-Until: ${new Date(now.getTime() + 30 * 86400000).toUTCString()}`,
8626
+ `Architectures: ${architecture}`,
8627
+ "Components: main",
8628
+ "Acquire-By-Hash: yes",
8629
+ "SHA256:",
8630
+ ...members.map(([path, bytes]) => ` ${sha256(bytes)} ${bytes.length} ${path}`),
8631
+ ""
8632
+ ].join(`
8633
+ `);
8634
+ return {
8635
+ packagePath: filename,
8636
+ release,
8637
+ files: new Map([
8638
+ ...members,
8639
+ ...members.map(([, bytes]) => [`${directories}/by-hash/SHA256/${sha256(bytes)}`, bytes])
8640
+ ])
8641
+ };
8642
+ }
8643
+
8644
+ // src/library/apt/stage-apt-repository.ts
8645
+ function cmd(program, options, label) {
8646
+ const run = spawnSync2(program, options, { encoding: "utf8", timeout: 60000 });
8647
+ if (run.error || run.status !== 0)
8648
+ throw new Error(label);
8649
+ return run.stdout;
8650
+ }
8651
+ async function add(path, bytes) {
8652
+ await mkdir12(dirname15(path), { recursive: true });
8653
+ await writeFile12(path, bytes, { flag: "wx" });
8654
+ }
8655
+ async function stageAptRepositoryCommand(args) {
8656
+ const [tag, policyPath, inventoryPath, packagePath, output, signingHome, trustedFingerprint] = args;
8657
+ if (args.length !== 7 || !tag || !/^v(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)$/.test(tag) || !policyPath || !inventoryPath || !packagePath || !output || !signingHome || !isAbsolute6(signingHome) || !trustedFingerprint || !/^[A-F0-9]{40}$/.test(trustedFingerprint))
8658
+ throw new Error("Expected TAG POLICY VERIFIED_INVENTORY DEB NEW_OUTPUT GPG_HOME PINNED_FINGERPRINT");
8659
+ const policy = JSON.parse(await readFile11(policyPath, "utf8"));
8660
+ const inventory = JSON.parse(await readFile11(inventoryPath, "utf8"));
8661
+ if (inventory.tag !== tag || !Array.isArray(inventory.assets))
8662
+ throw new Error("Verified inventory does not name requested release");
8663
+ const deb = await readFile11(packagePath);
8664
+ await mkdir12(output, { mode: 448 });
8665
+ try {
8666
+ const stagedInput = join36(output, ".input.deb");
8667
+ await writeFile12(stagedInput, deb, { mode: 384, flag: "wx" });
8668
+ const control = cmd("dpkg-deb", ["--field", stagedInput], "Debian control inspection failed");
8669
+ const staged = stageAptMetadata({
8670
+ policy,
8671
+ tag,
8672
+ assets: inventory.assets,
8673
+ deb,
8674
+ control,
8675
+ now: new Date
8676
+ });
8677
+ const base = join36(output, "dists", policy.suite);
8678
+ await add(join36(output, staged.packagePath), deb);
8679
+ for (const [path, contents] of staged.files)
8680
+ await add(join36(base, path), contents);
8681
+ await add(join36(base, "Release"), staged.release);
8682
+ const flags = [
8683
+ "--batch",
8684
+ "--no-tty",
8685
+ "--pinentry-mode",
8686
+ "error",
8687
+ "--homedir",
8688
+ signingHome,
8689
+ "--local-user",
8690
+ `${trustedFingerprint}!`,
8691
+ "--digest-algo",
8692
+ "SHA256"
8693
+ ];
8694
+ for (const [name, mode] of [
8695
+ ["InRelease", "--clearsign"],
8696
+ ["Release.gpg", "--detach-sign"]
8697
+ ]) {
8698
+ cmd("gpg", [...flags, "--armor", "--output", join36(base, name), mode, join36(base, "Release")], `Could not produce ${name} with the pinned signing identity`);
8699
+ }
8700
+ const { unlink } = await import("fs/promises");
8701
+ await unlink(stagedInput);
8702
+ await add(join36(output, "STAGED"), `${tag}
8703
+ `);
8704
+ return { tag, staged: true };
8705
+ } catch (error) {
8706
+ await rm11(output, { recursive: true, force: true });
8707
+ throw error;
8708
+ }
8709
+ }
8710
+
8711
+ // src/linux-channel-proof-cli.ts
8712
+ import { spawnSync as spawnSync3 } from "child_process";
8713
+ import { createHash as createHash18 } from "crypto";
8714
+ import { createReadStream as createReadStream2 } from "fs";
8715
+ import { lstat as lstat21, readFile as readFile12, realpath as realpath10 } from "fs/promises";
8716
+ import { join as join37 } from "path";
8717
+ import { pathToFileURL } from "url";
8718
+ function check(ok, message) {
8719
+ if (!ok)
8720
+ throw new Error(message);
8721
+ }
8722
+ async function hash(path) {
8723
+ check((await lstat21(path)).isFile(), "artifact must be a regular file");
8724
+ const digest = createHash18("sha256");
8725
+ for await (const chunk of createReadStream2(path))
8726
+ digest.update(chunk);
8727
+ return digest.digest("hex");
8728
+ }
8729
+ function options(text, section) {
8730
+ const values = new Map;
8731
+ let matched = false;
8732
+ for (const raw of text.split(/\r?\n/)) {
8733
+ const line = raw.trim();
8734
+ if (!line || line.startsWith("#") || line.startsWith(";"))
8735
+ continue;
8736
+ if (line === `[${section}]` && !matched) {
8737
+ matched = true;
8738
+ continue;
8739
+ }
8740
+ const field = /^([a-z_]+)\s*=\s*(\S+)$/.exec(line);
8741
+ check(matched && field && !values.has(field[1]), "unexpected or duplicate repository option");
8742
+ values.set(field[1], field[2]);
8743
+ }
8744
+ check(matched, "expected exactly one repository section");
8745
+ return values;
8746
+ }
8747
+ async function verifyRpmStage(stage) {
8748
+ check(/^[0-9a-f]{40}$/.test(stage.sourceSha), "expected an exact source commit");
8749
+ check(/^[a-z0-9][a-z0-9._+-]*$/.test(stage.packageName), "invalid RPM package name");
8750
+ check(/^[a-zA-Z0-9][a-zA-Z0-9._+~^]*$/.test(stage.version), "invalid RPM version");
8751
+ check(stage.architecture === "x86_64", "only x86_64 is supported");
8752
+ check(/^[a-zA-Z0-9][a-zA-Z0-9._:-]*$/.test(stage.repoId), "invalid repository ID");
8753
+ for (const artifact of [stage.payload, stage.rpm]) {
8754
+ check(/^[0-9a-f]{64}$/.test(artifact.sha256), "expected SHA-256");
8755
+ check(await hash(artifact.path) === artifact.sha256, "staged artifact digest mismatch");
8756
+ }
8757
+ const repo = await realpath10(stage.repository);
8758
+ const keyUrl = pathToFileURL(await realpath10(stage.publicKey)).href;
8759
+ const config = options(await readFile12(stage.repoFile, "utf8"), stage.repoId);
8760
+ check(config.get("baseurl") === pathToFileURL(repo).href, "expected the local repository");
8761
+ check(config.get("gpgkey") === keyUrl, "expected the configured QA public key");
8762
+ for (const flag of ["pkg_gpgcheck", "repo_gpgcheck"]) {
8763
+ check(config.get(flag) === "1", `${flag} must be enabled`);
8764
+ }
8765
+ const allowed = new Set(["name", "enabled", "baseurl", "gpgkey", "pkg_gpgcheck", "repo_gpgcheck"]);
8766
+ check([...config.keys()].every((key) => allowed.has(key)), "unexpected repository options");
8767
+ for (const path of [
8768
+ stage.publicKey,
8769
+ join37(repo, "repodata/repomd.xml"),
8770
+ join37(repo, "repodata/repomd.xml.asc")
8771
+ ]) {
8772
+ check((await lstat21(path)).isFile(), "expected regular key and signed metadata files");
8773
+ }
8774
+ const result = spawnSync3("rpm", ["-qp", "--queryformat", "%{NAME}|%{VERSION}|%{ARCH}", await realpath10(stage.rpm.path)], { encoding: "utf8", timeout: 1e4 });
8775
+ check(result.error?.code !== "ENOENT", "rpm is required for RPM header verification");
8776
+ check(result.status === 0 && result.stdout === `${stage.packageName}|${stage.version}|${stage.architecture}`, "RPM header does not match the requested package, version and architecture");
8777
+ return { kind: "rpm-staging-inputs", sourceSha: stage.sourceSha };
8778
+ }
8779
+ var systemTalkDenied = /^(org\.freedesktop\.(Flatpak|DBus|systemd1)|org\.gtk\.GDBus)(\.|$)/;
8780
+ function verifyFlatpakCapabilities(policy, result) {
8781
+ check(/^[A-Za-z_][A-Za-z0-9_-]*(\.[A-Za-z_][A-Za-z0-9_-]*){2,}$/.test(policy.applicationId) && result.applicationId === policy.applicationId, "unexpected Flatpak app identity");
8782
+ check(/^[0-9a-f]{40}$/.test(policy.sourceSha) && result.sourceSha === policy.sourceSha && /^[0-9a-f]{64}$/.test(policy.artifactSha256) && result.artifactSha256 === policy.artifactSha256, "Flatpak evidence does not match the expected source and artifact");
8783
+ check(result.architecture === "x86_64", "only x86_64 is supported");
8784
+ const cap = policy.permissions;
8785
+ const actual = result.effectivePermissions;
8786
+ check(cap.sockets.every((name) => name === "wayland" || name === "pulseaudio"), "unsafe socket policy");
8787
+ check(cap.devices.every((name) => name === "dri"), "unsafe device policy");
8788
+ check(cap.sessionTalkNames.every((name) => /^[A-Za-z_][\w-]*(\.[A-Za-z_][\w-]*)+$/.test(name) && !systemTalkDenied.test(name)), "unsafe session-bus policy");
8789
+ check(typeof actual.network === "boolean" && typeof cap.network === "boolean" && (!actual.network || cap.network === true) && actual.sockets.every((name) => cap.sockets.some((allowed) => allowed === name)) && actual.devices.every((name) => cap.devices.some((allowed) => allowed === name)) && actual.sessionTalkNames.every((name) => cap.sessionTalkNames.includes(name)) && actual.filesystems.length === 0 && actual.systemTalkNames.length === 0, "effective Flatpak permissions exceed policy");
8790
+ check([
8791
+ result.localRepositoryInstall,
8792
+ result.upgradedAndRetainedData,
8793
+ result.sandboxedRenderer,
8794
+ result.portalSelectedWorkspace,
8795
+ result.sandboxTerminalAndCli,
8796
+ result.unselectedWorkspaceDenied,
8797
+ result.hostCredentialsDenied,
8798
+ result.genericHostExecutionDenied
8799
+ ].every((outcome) => outcome === true), "missing a required Flatpak capability or isolation observation");
8800
+ return { kind: "flatpak-observations", sourceSha: result.sourceSha };
8801
+ }
8802
+
8803
+ // src/library/arch-publish.ts
8804
+ import { createHash as createHash19 } from "crypto";
8805
+ import { join as join38 } from "path";
8806
+ import { tmpdir as tmpdir5 } from "os";
8807
+ import { Effect as Effect27 } from "effect";
8808
+
8809
+ // ../../src/release/arch-package.ts
8810
+ function archPkgver(tag) {
8811
+ if (!/^v\d+\.\d+\.\d+$/.test(tag))
8812
+ throw new Error("Invalid Arch package release tag");
8813
+ return tag.slice(1);
8814
+ }
8815
+ function archBundle(appName) {
8816
+ assertPortableAppName(appName);
8817
+ return appName.replaceAll(" ", "");
8818
+ }
8819
+ function shell(value) {
8820
+ if (/[\r\n]/.test(value))
8821
+ throw new Error("Arch package value spans lines");
8822
+ return `'${value.replaceAll("'", "'\\''")}'`;
8823
+ }
8824
+ function array(name, values) {
8825
+ if (!values.length)
8826
+ return "";
8827
+ const lines = values.map((value) => ` ${shell(value)}`).join(`
8828
+ `);
8829
+ return `${name}=(
8830
+ ${lines}
8831
+ )`;
8832
+ }
8833
+ function desktopEntry(input, bundle) {
8834
+ const { policy } = input;
8835
+ return [
8836
+ "[Desktop Entry]",
8837
+ "Type=Application",
8838
+ `Name=${policy.desktop.name}`,
8839
+ ...policy.desktop.comment ? [`Comment=${policy.desktop.comment}`] : [],
8840
+ `Exec=/opt/${policy.pkgname}/bin/launcher %U`,
8841
+ `Icon=${policy.executable}`,
8842
+ "Terminal=false",
8843
+ `StartupWMClass=${bundle}`,
8844
+ `Categories=${policy.desktop.categories.map((value) => `${value};`).join("")}`,
8845
+ ""
8846
+ ].join(`
8847
+ `);
8848
+ }
8849
+ function packageBody(input, bundle) {
8850
+ const { policy } = input;
8851
+ const lines = [
8852
+ "package() {",
8853
+ ` install -d "$pkgdir/opt/${policy.pkgname}"`,
8854
+ ` cp -a --no-preserve=ownership "$srcdir/${bundle}/." "$pkgdir/opt/${policy.pkgname}/"`,
8855
+ ` chmod -R u=rwX,go=rX "$pkgdir/opt/${policy.pkgname}"`,
8856
+ ...policy.setuid.map((path) => ` chmod 4755 "$pkgdir/opt/${policy.pkgname}/${path}"`),
8857
+ "",
8858
+ ' install -d "$pkgdir/usr/bin"',
8859
+ ` ln -s "/opt/${policy.pkgname}/bin/launcher" "$pkgdir/usr/bin/${policy.executable}"`,
8860
+ ...policy.links.map((link) => ` ln -s "/opt/${policy.pkgname}/${link.target}" "$pkgdir/usr/bin/${link.name}"`),
8861
+ "",
8862
+ ` install -Dm644 /dev/stdin "$pkgdir/usr/share/applications/${policy.pkgname}.desktop" <<'EOF'`,
8863
+ desktopEntry(input, bundle).trimEnd(),
8864
+ "EOF"
8865
+ ];
8866
+ if (policy.icon)
8867
+ lines.push("", ` install -Dm644 "$srcdir/${bundle}/${policy.icon}" \\`, ` "$pkgdir/usr/share/icons/hicolor/scalable/apps/${policy.executable}.svg"`);
8868
+ if (input.license)
8869
+ lines.push("", ` install -Dm644 "$srcdir/LICENSE" "$pkgdir/usr/share/licenses/${policy.pkgname}/LICENSE"`);
8870
+ lines.push("}", "");
8871
+ return lines.join(`
8872
+ `);
8873
+ }
8874
+ function sources(input) {
8875
+ const entries = [
8876
+ ...input.license ? [`LICENSE::${input.license.url}`] : [],
8877
+ `${input.assetName}::${input.assetUrl}`
8878
+ ];
8879
+ const sums = [...input.license ? [input.license.sha256] : [], input.assetSha256];
8880
+ return { entries, sums };
8881
+ }
8882
+ function renderArchPackage(input) {
8883
+ const { policy } = input;
8884
+ const pkgver = archPkgver(input.tag);
8885
+ if (!Number.isSafeInteger(input.pkgrel) || input.pkgrel < 1 || input.pkgrel > 999)
8886
+ throw new Error("Invalid Arch package release");
8887
+ const bundle = archBundle(input.appName);
8888
+ const { entries, sums } = sources(input);
8889
+ const metadata = [
8890
+ `pkgname=${policy.pkgname}`,
8891
+ `pkgver=${pkgver}`,
8892
+ `pkgrel=${input.pkgrel}`,
8893
+ `pkgdesc=${shell(policy.pkgdesc)}`,
8894
+ "arch=('x86_64')",
8895
+ `url=${shell(policy.url)}`,
8896
+ array("license", policy.license),
8897
+ array("depends", policy.depends),
8898
+ array("optdepends", policy.optdepends),
8899
+ array("provides", policy.provides),
8900
+ array("conflicts", policy.conflicts),
8901
+ "options=('!strip' '!debug')",
8902
+ array("source", entries),
8903
+ array("sha256sums", sums)
8904
+ ].filter(Boolean).join(`
8905
+ `);
8906
+ const pkgbuild = `${[`# Maintainer: ${policy.maintainer}`, metadata, packageBody(input, bundle).trimEnd()].join(`
8907
+
8908
+ `)}
8909
+ `;
8910
+ const srcinfo = [
8911
+ `pkgbase = ${policy.pkgname}`,
8912
+ ` pkgdesc = ${policy.pkgdesc}`,
8913
+ ` pkgver = ${pkgver}`,
8914
+ ` pkgrel = ${input.pkgrel}`,
8915
+ ` url = ${policy.url}`,
8916
+ "\tarch = x86_64",
8917
+ ...policy.license.map((value) => ` license = ${value}`),
8918
+ ...policy.depends.map((value) => ` depends = ${value}`),
8919
+ ...policy.optdepends.map((value) => ` optdepends = ${value}`),
8920
+ ...policy.provides.map((value) => ` provides = ${value}`),
8921
+ ...policy.conflicts.map((value) => ` conflicts = ${value}`),
8922
+ "\toptions = !strip",
8923
+ "\toptions = !debug",
8924
+ ...entries.map((value) => ` source = ${value}`),
8925
+ ...sums.map((value) => ` sha256sums = ${value}`),
8926
+ "",
8927
+ `pkgname = ${policy.pkgname}`,
8928
+ ""
8929
+ ].join(`
8930
+ `);
8931
+ return { pkgver, bundle, files: { PKGBUILD: pkgbuild, ".SRCINFO": srcinfo } };
8932
+ }
8933
+ function renderPacmanRepository(policy) {
8934
+ const { repository } = policy;
8935
+ if (!repository)
8936
+ return {};
8937
+ const stanza = [
8938
+ `[${repository.name}]`,
8939
+ "SigLevel = Required DatabaseOptional",
8940
+ `Server = ${repository.base}$arch`,
8941
+ ""
8942
+ ].join(`
8943
+ `);
8944
+ const bootstrap = `#!/bin/sh
8945
+ # Install ${policy.desktop.name} from the ${repository.name} pacman repository.
8946
+ #
8947
+ # curl -fsSL ${repository.base}install.sh | sudo sh
8948
+ # curl -fsSL ${repository.base}install.sh | sudo sh -s -- <package>...
8949
+ set -eu
8950
+
8951
+ repo=${shell(repository.name)}
8952
+ package=${shell(policy.pkgname)}
8953
+ server=${shell(repository.base)}
8954
+ key_url=${shell(repository.publicKey)}
8955
+
8956
+ if [ "$(id -u)" -ne 0 ]; then
8957
+ echo "Run this script as root, for example: curl -fsSL ${repository.base}install.sh | sudo sh" >&2
8958
+ exit 1
8959
+ fi
8960
+ for tool in curl pacman-key pacman grep; do
8961
+ command -v "$tool" >/dev/null || { echo "Missing $tool" >&2; exit 1; }
8962
+ done
8963
+ # A fresh container or a minimal install may have no local keyring; lsign needs one.
8964
+ [ -s /etc/pacman.d/gnupg/pubring.gpg ] || pacman-key --init >/dev/null
8965
+ tmp=$(mktemp)
8966
+ trap 'rm -f "$tmp"' EXIT
8967
+ curl -fsSL "$key_url" -o "$tmp"
8968
+ pacman-key --add "$tmp" >/dev/null
8969
+ # The key's own fingerprint, so the script trusts exactly the key it just imported.
8970
+ fingerprint=$(gpg --batch --show-keys --with-colons "$tmp" 2>/dev/null |
8971
+ awk -F: '/^fpr:/{print $10; exit}')
8972
+ [ -n "$fingerprint" ] || { echo "Could not read the signing key at $key_url" >&2; exit 1; }
8973
+ # Trust the key locally. It is the only key this repository's packages are signed with.
8974
+ pacman-key --lsign-key "$fingerprint" >/dev/null
8975
+ if ! grep -q "^\\[$repo\\]" /etc/pacman.conf; then
8976
+ printf '\\n[%s]\\nSigLevel = Required DatabaseOptional\\nServer = %s$arch\\n' "$repo" "$server" >> /etc/pacman.conf
8977
+ fi
8978
+ pacman -Sy --noconfirm >/dev/null
8979
+ if [ "$#" -eq 0 ]; then set -- "$package"; fi
8980
+ exec pacman -S --needed --noconfirm "$@"
8981
+ `;
8982
+ return { "install.sh": bootstrap, "pacman.conf": stanza };
8983
+ }
8984
+
8985
+ // src/library/arch-publish.ts
8986
+ var AUR_HOST_KEY = "aur.archlinux.org ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEuBKrPzbawxA/k2g6NcyV5jmqwJ2s+zpgZGZ7tpLIcN";
8987
+ var MAX_LICENSE_BYTES = 1024 * 1024;
8988
+ var feedBytes = (feed, path, maximum) => Effect27.gen(function* () {
8989
+ const { fetch: fetch2 } = yield* ReleaseFetch;
8990
+ const scope = feedUrl(feed);
8991
+ const response = yield* step(() => fetchReleaseLocation(`${scope}${path}`, scope, fetch2, AbortSignal.timeout(30000)));
8992
+ if (response.status === 404) {
8993
+ yield* step(async () => discardStream(response.body));
8994
+ return null;
8995
+ }
8996
+ return yield* step(() => readReleaseBytes(response, maximum));
8997
+ });
8998
+ var feedJson = (feed, path, maximum) => Effect27.gen(function* () {
8999
+ const bytes = yield* feedBytes(feed, path, maximum);
9000
+ if (!bytes)
9001
+ return null;
9002
+ return yield* step(async () => {
9003
+ try {
9004
+ return JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes));
9005
+ } catch {
9006
+ throw new Error("Invalid release feed response");
9007
+ }
9008
+ });
9009
+ });
9010
+ var readChannelTag = (feed, channel) => Effect27.gen(function* () {
9011
+ const parsed = yield* feedJson(feed, `channels/${channel}.json`, 262144);
9012
+ if (parsed === null)
9013
+ return null;
9014
+ return yield* step(async () => parseFeedRelease(parsed).tag);
9015
+ });
9016
+ var readLicense = (url) => Effect27.gen(function* () {
9017
+ const { fetch: fetch2 } = yield* ReleaseFetch;
9018
+ const response = yield* step(() => fetch2(url, { redirect: "follow", signal: AbortSignal.timeout(30000) }));
9019
+ if (response.status !== 200 || !response.body) {
9020
+ yield* step(async () => discardStream(response.body));
9021
+ return yield* fail("Release license is unavailable");
9022
+ }
9023
+ const bytes = yield* step(() => readReleaseBytes(response, MAX_LICENSE_BYTES));
9024
+ const sha256 = yield* step(async () => createHash19("sha256").update(bytes).digest("hex"));
9025
+ return { url, sha256 };
9026
+ });
9027
+ var git2 = (args) => Effect27.gen(function* () {
9028
+ const { run } = yield* ReleaseGit;
9029
+ return yield* Effect27.tryPromise({
9030
+ try: () => run(args),
9031
+ catch: (error) => {
9032
+ const stderr = String(error.stderr ?? "").trim().split(`
9033
+ `).slice(-3).join(" ");
9034
+ return new ReleaseFailure({
9035
+ reason: "git-failed",
9036
+ message: `git ${args.find((value) => !value.startsWith("-")) ?? ""} failed${stderr ? `: ${stderr}` : ""}`,
9037
+ original: error
9038
+ });
9039
+ }
9040
+ });
9041
+ });
9042
+ var gitExit = (args) => Effect27.gen(function* () {
9043
+ const { run } = yield* ReleaseGit;
9044
+ return yield* Effect27.promise(() => run(args).then(() => 0, (error) => Number(error.code ?? 1) || 1));
9045
+ });
9046
+ var verifyArchRelease = (options) => Effect27.gen(function* () {
9047
+ const parsed = parseReleaseConfig(options.config);
9048
+ const { config } = options;
9049
+ const repository = typeof config.repository === "string" && isRepositorySlug(config.repository) ? config.repository : null;
9050
+ if (!repository)
9051
+ return yield* fail("release-config.json has no repository to verify the signed descriptor");
9052
+ const ledger = yield* readFeedLedgerEffect(options.feed);
9053
+ const entry = ledger.releases.find((item) => item.tag === options.tag);
9054
+ if (!entry || entry.kind !== options.channel)
9055
+ return yield* fail(`Release ${options.tag} is not a ${options.channel} release in the ledger`);
9056
+ const archive = parsed.requirements(options.tag).platforms["linux-x64"]?.[1];
9057
+ if (!archive)
9058
+ return yield* fail("Arch packaging requires the linux-x64 desktop archive to be configured");
9059
+ const descriptorPolicy = discoveryPolicies(config, options.tag).find((candidate) => candidate.channel === options.channel && candidate.platform === "linux-x64" && candidate.payload === archive);
9060
+ if (!descriptorPolicy)
9061
+ return yield* fail("Release has no signed Linux descriptor");
9062
+ const listed = options.release.assets.find((item) => item.name === descriptorPolicy.name);
9063
+ if (!listed)
9064
+ return yield* fail(`Missing signed descriptor: ${descriptorPolicy.name}`);
9065
+ const bytes = yield* feedBytes(options.feed, `${options.tag}/${descriptorPolicy.name}`, 65536);
9066
+ if (!bytes || bytes.length !== listed.size || createHash19("sha256").update(bytes).digest("hex") !== listed.sha256)
9067
+ return yield* fail(`Signed descriptor differs from its release: ${descriptorPolicy.name}`);
9068
+ const json = yield* step(async () => {
9069
+ try {
9070
+ return JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes));
9071
+ } catch {
9072
+ throw new Error("Signed descriptor is not JSON");
9073
+ }
9074
+ });
9075
+ const verified = verifyReleaseDescriptor(json, {
9076
+ appId: descriptorPolicy.appId,
9077
+ repository,
9078
+ channel: descriptorPolicy.channel,
9079
+ platform: descriptorPolicy.os,
9080
+ arch: descriptorPolicy.arch,
9081
+ feed: feedUrl(options.feed),
9082
+ keys: releaseVerificationKeys(config)
9083
+ });
9084
+ if (!verified.ok)
9085
+ return yield* fail("Untrusted signed descriptor");
9086
+ const descriptor = verified.descriptor;
9087
+ if (descriptor.tag !== options.tag || descriptor.sourceSha !== entry.sourceSha)
9088
+ return yield* fail("Signed descriptor names another release");
9089
+ const payload = options.release.assets.find((item) => item.name === descriptorPolicy.payload);
9090
+ if (!payload)
9091
+ return yield* fail("Signed descriptor names a missing archive");
9092
+ if (descriptor.asset.name !== payload.name || descriptor.asset.size !== payload.size || descriptor.asset.sha256 !== payload.sha256)
9093
+ return yield* fail("Signed descriptor does not bind the published archive");
9094
+ return descriptor.asset;
9095
+ });
9096
+ var publishArchPackageEffect = (options) => Effect27.gen(function* () {
9097
+ const { archPackage: policy, feed } = parseReleaseConfig(options.config);
9098
+ if (!policy)
9099
+ return { status: "not-configured" };
9100
+ if (!/^v\d+\.\d+\.\d+$/.test(options.tag))
9101
+ return yield* fail("Invalid Arch package release tag");
9102
+ const release = yield* readFeedReleaseEffect(feed, options.tag);
9103
+ if (!release)
9104
+ return yield* fail(`Release ${options.tag} is not published on the feed`);
9105
+ const channelTag = yield* readChannelTag(feed, policy.channel);
9106
+ if (channelTag !== options.tag)
9107
+ return {
9108
+ status: "not-current",
9109
+ channel: policy.channel,
9110
+ channelTag
9111
+ };
9112
+ const asset = yield* verifyArchRelease({
9113
+ config: options.config,
9114
+ feed,
9115
+ tag: options.tag,
9116
+ release,
9117
+ channel: policy.channel
9118
+ });
9119
+ const license = policy.licenseSource ? yield* readLicense(policy.licenseSource.replaceAll("{tag}", options.tag)) : undefined;
9120
+ const pkgrel = options.pkgrel ?? 1;
9121
+ const rendered = renderArchPackage({
9122
+ appName: options.appName,
9123
+ tag: options.tag,
9124
+ pkgrel,
9125
+ policy,
9126
+ assetName: asset.name,
9127
+ assetUrl: asset.url,
9128
+ assetSha256: asset.sha256,
9129
+ ...license ? { license } : {}
9130
+ });
9131
+ const files = rendered.files;
9132
+ const repositoryFiles = renderPacmanRepository(policy);
9133
+ const fs = yield* ReleaseFs;
9134
+ if (options.printDirectory) {
9135
+ const directory = options.printDirectory;
9136
+ yield* step(() => fs.mkdir(directory, { recursive: true }));
9137
+ for (const [name, contents] of Object.entries({ ...files, ...repositoryFiles }))
9138
+ yield* step(() => fs.writeFile(join38(directory, name), contents, { mode: 420 }));
9139
+ }
9140
+ const base = { pkgname: policy.pkgname, pkgver: rendered.pkgver, pkgrel };
9141
+ if (options.dryRun)
9142
+ return { status: "dry-run", ...base, files: { ...files, ...repositoryFiles } };
9143
+ const { env } = yield* ReleaseConfig;
9144
+ const encodedKey = env.AUR_SSH_PRIVATE_KEY_B64;
9145
+ if (!encodedKey)
9146
+ return yield* fail("AUR_SSH_PRIVATE_KEY_B64 is not set");
9147
+ const key = Buffer.from(encodedKey, "base64").toString("utf8");
9148
+ if (!key.includes("PRIVATE KEY"))
9149
+ return yield* fail("AUR_SSH_PRIVATE_KEY_B64 is not a private key");
9150
+ return yield* Effect27.gen(function* () {
9151
+ const work = yield* step(() => fs.mkdtemp(join38(tmpdir5(), "arch-package-")));
9152
+ yield* Effect27.addFinalizer(() => Effect27.promise(() => fs.rm(work, { recursive: true, force: true }).then(() => {
9153
+ return;
9154
+ }, () => {
9155
+ return;
9156
+ })));
9157
+ const keyFile = join38(work, "aur_id_ed25519");
9158
+ const knownHosts = join38(work, "aur_known_hosts");
9159
+ yield* step(() => fs.mkdir(work, { recursive: true, mode: 448 }));
9160
+ yield* step(() => fs.writeFile(keyFile, key.endsWith(`
9161
+ `) ? key : `${key}
9162
+ `, { mode: 384 }));
9163
+ yield* step(() => fs.writeFile(knownHosts, `${AUR_HOST_KEY}
9164
+ `, { mode: 420 }));
9165
+ const ssh = `ssh -i "${keyFile}" -o IdentitiesOnly=yes -o UserKnownHostsFile="${knownHosts}" -o StrictHostKeyChecking=yes`;
9166
+ const checkout = join38(work, policy.pkgname);
9167
+ yield* git2([
9168
+ "-c",
9169
+ `core.sshCommand=${ssh}`,
9170
+ "-c",
9171
+ "init.defaultBranch=master",
9172
+ "clone",
9173
+ "--depth",
9174
+ "1",
9175
+ `ssh://aur@aur.archlinux.org/${policy.pkgname}.git`,
9176
+ checkout
9177
+ ]);
9178
+ for (const [name, contents] of Object.entries(files))
9179
+ yield* step(() => fs.writeFile(join38(checkout, name), contents, { mode: 420 }));
9180
+ yield* git2(["-C", checkout, "add", "--", ...Object.keys(files)]);
9181
+ const staged = yield* gitExit(["-C", checkout, "diff", "--cached", "--quiet"]);
9182
+ if (staged === 0)
9183
+ return { status: "unchanged", ...base };
9184
+ if (staged !== 1)
9185
+ return yield* fail("Comparing the AUR package failed");
9186
+ const host = new URL(policy.url).hostname;
9187
+ yield* git2([
9188
+ "-C",
9189
+ checkout,
9190
+ "-c",
9191
+ `user.name=${options.appName} Release`,
9192
+ "-c",
9193
+ `user.email=release@${host}`,
9194
+ "commit",
9195
+ "-m",
9196
+ `${policy.pkgname}: update to ${rendered.pkgver}-${pkgrel}`
9197
+ ]);
9198
+ yield* git2(["-C", checkout, "-c", `core.sshCommand=${ssh}`, "push", "origin", "HEAD:master"]);
9199
+ return { status: "published", ...base };
9200
+ }).pipe(Effect27.scoped);
9201
+ });
9202
+
7893
9203
  // src/cli-commands.ts
7894
- var print = (value) => Effect24.gen(function* () {
9204
+ var print = (value) => Effect28.gen(function* () {
7895
9205
  const { stdout } = yield* ReleaseOutput;
7896
9206
  stdout(JSON.stringify(value) + `
7897
9207
  `);
7898
9208
  });
7899
- var say = (line) => Effect24.gen(function* () {
9209
+ var say = (line) => Effect28.gen(function* () {
7900
9210
  const { stdout } = yield* ReleaseOutput;
7901
9211
  stdout(line + `
7902
9212
  `);
7903
9213
  });
7904
9214
  var invalid = (message = "Invalid workflow invocation") => refuse("usage", message);
7905
9215
  var localFlag = (args) => args[0] === "--local" ? [true, args.slice(1)] : [false, args];
7906
- var hostPlatform = Effect24.gen(function* () {
9216
+ var hostPlatform = Effect28.gen(function* () {
7907
9217
  const { platform, arch } = yield* ReleaseConfig;
7908
9218
  return yield* step(async () => hostReleasePlatform(platform, arch));
7909
9219
  });
7910
- var withPlanGitHub = (env, effect) => Effect24.gen(function* () {
9220
+ var withPlanGitHub = (env, effect) => Effect28.gen(function* () {
7911
9221
  const github = yield* ReleaseGitHub;
7912
- return yield* effect.pipe(Effect24.provideService(ReleaseGitHub, {
9222
+ return yield* effect.pipe(Effect28.provideService(ReleaseGitHub, {
7913
9223
  run: github.withEnvironment ? github.withEnvironment(releasePlanGitHubEnvironment(env)) : github.run
7914
9224
  }));
7915
9225
  });
7916
9226
  var publish = (argv) => {
7917
9227
  const [local, args] = localFlag(argv);
7918
- return runCommand("Unable to publish release artifacts; check the trusted workflow or local checkout, receipts, signing configuration and staged bytes.", Effect24.gen(function* () {
9228
+ return runCommand("Unable to publish release artifacts; check the trusted workflow or local checkout, receipts, signing configuration and staged bytes.", Effect28.gen(function* () {
7919
9229
  const [directory, configPath, out, ...extra] = args;
7920
9230
  if (!directory || !configPath || extra.length || !out !== !local)
7921
9231
  return yield* invalid();
@@ -7928,7 +9238,7 @@ var publish = (argv) => {
7928
9238
  const clock = yield* ReleaseClock;
7929
9239
  const platform = yield* hostPlatform;
7930
9240
  const { repository } = yield* localTagProvenanceEffect({ config, tag, sourceSha });
7931
- const plan = yield* Effect24.uninterruptible(stageLocalReleaseEffect({
9241
+ const plan = yield* Effect28.uninterruptible(stageLocalReleaseEffect({
7932
9242
  config,
7933
9243
  directory,
7934
9244
  out,
@@ -7946,7 +9256,7 @@ var publish = (argv) => {
7946
9256
  };
7947
9257
  var cut = (argv) => {
7948
9258
  const [local, args] = localFlag(argv);
7949
- return runCommand((error) => `Unable to cut the release: ${redactedErrorMessage(error)}. Check the trusted workflow or local checkout and release configuration.`, Effect24.gen(function* () {
9259
+ return runCommand((error) => `Unable to cut the release: ${redactedErrorMessage(error)}. Check the trusted workflow or local checkout and release configuration.`, Effect28.gen(function* () {
7950
9260
  const [kind, path, sourceSha, ...extra] = args;
7951
9261
  if (kind !== "daily" || !path || extra.length || !sourceSha !== !local)
7952
9262
  return yield* invalid();
@@ -7956,7 +9266,7 @@ var cut = (argv) => {
7956
9266
  const { env } = yield* ReleaseConfig;
7957
9267
  if (local) {
7958
9268
  const platform = yield* hostPlatform;
7959
- const result = yield* Effect24.uninterruptible(runLocalReleaseCutEffect({ kind, config, sourceSha, platform }));
9269
+ const result = yield* Effect28.uninterruptible(runLocalReleaseCutEffect({ kind, config, sourceSha, platform }));
7960
9270
  return yield* print(result);
7961
9271
  }
7962
9272
  const result = yield* releaseCutCommand({
@@ -7970,7 +9280,7 @@ var cut = (argv) => {
7970
9280
  };
7971
9281
  var promote = (argv) => {
7972
9282
  const [local, args] = localFlag(argv);
7973
- return runCommand("Unable to promote the release; check the trusted workflow or feed and release configuration.", Effect24.gen(function* () {
9283
+ return runCommand("Unable to promote the release; check the trusted workflow or feed and release configuration.", Effect28.gen(function* () {
7974
9284
  const [path, out, ...extra] = args;
7975
9285
  const { env } = yield* ReleaseConfig;
7976
9286
  const held = env.STABLE_PROMOTION_HELD;
@@ -7980,7 +9290,7 @@ var promote = (argv) => {
7980
9290
  if (local) {
7981
9291
  const clock = yield* ReleaseClock;
7982
9292
  const repository = yield* originRepositoryEffect;
7983
- const result = yield* Effect24.uninterruptible(runLocalPromotionEffect({
9293
+ const result = yield* Effect28.uninterruptible(runLocalPromotionEffect({
7984
9294
  config,
7985
9295
  out,
7986
9296
  now: clock.now(),
@@ -7993,7 +9303,7 @@ var promote = (argv) => {
7993
9303
  yield* print(yield* promotionCommand({ env, config }));
7994
9304
  }), { requireGitHubActions: !local });
7995
9305
  };
7996
- var finalize = (argv) => runCommand((error) => `Release finalization failed: ${redactedErrorMessage(error)}`, Effect24.gen(function* () {
9306
+ var finalize = (argv) => runCommand((error) => `Release finalization failed: ${redactedErrorMessage(error)}`, Effect28.gen(function* () {
7997
9307
  const { env } = yield* ReleaseConfig;
7998
9308
  if (argv[0] === "--local") {
7999
9309
  const [configPath, tag, ...extra] = argv.slice(1);
@@ -8014,7 +9324,7 @@ var finalize = (argv) => runCommand((error) => `Release finalization failed: ${r
8014
9324
  yield* finalizeReleasePleaseDraftEffect({ env, config, ...identity });
8015
9325
  yield* say("Qualified draft published as a prerelease");
8016
9326
  }));
8017
- var planAssets = (args) => runCommand("Unable to plan release assets; check release provenance and the trusted workflow.", Effect24.gen(function* () {
9327
+ var planAssets = (args) => runCommand("Unable to plan release assets; check release provenance and the trusted workflow.", Effect28.gen(function* () {
8018
9328
  const [tag, path, ...extra] = args;
8019
9329
  if (!tag || !path || extra.length)
8020
9330
  return yield* invalid("Expected release tag and configuration file");
@@ -8022,7 +9332,7 @@ var planAssets = (args) => runCommand("Unable to plan release assets; check rele
8022
9332
  const { env } = yield* ReleaseConfig;
8023
9333
  yield* print(yield* planReleaseAssetsEffect({ env, config, tag }));
8024
9334
  }));
8025
- var sign2 = (args) => runCommand("Unable to sign release artifact; check the identity, archive and signing key.", Effect24.gen(function* () {
9335
+ var sign2 = (args) => runCommand("Unable to sign release artifact; check the identity, archive and signing key.", Effect28.gen(function* () {
8026
9336
  const [identityPath, artifactPath, feed, ...extra] = args;
8027
9337
  const { env } = yield* ReleaseConfig;
8028
9338
  if (!identityPath || !artifactPath || !feed || extra.length || !env.ADEA_RELEASE_SIGNING_KEY)
@@ -8033,7 +9343,7 @@ var sign2 = (args) => runCommand("Unable to sign release artifact; check the ide
8033
9343
  }));
8034
9344
  var signDescriptors = (argv) => {
8035
9345
  const [local, args] = localFlag(argv);
8036
- return runCommand("Unable to stage signed descriptors; check the trusted release, installer receipts and signing configuration.", Effect24.gen(function* () {
9346
+ return runCommand("Unable to stage signed descriptors; check the trusted release, installer receipts and signing configuration.", Effect28.gen(function* () {
8037
9347
  const [directory, configPath, ...extra] = args;
8038
9348
  const { env } = yield* ReleaseConfig;
8039
9349
  const {
@@ -8066,7 +9376,7 @@ var signDescriptors = (argv) => {
8066
9376
  }));
8067
9377
  }));
8068
9378
  };
8069
- var releaseStep = (argv) => runCommand((error) => `Release step failed: ${error.message}`, Effect24.gen(function* () {
9379
+ var releaseStep = (argv) => runCommand((error) => `Release step failed: ${error.message}`, Effect28.gen(function* () {
8070
9380
  const args = [...argv];
8071
9381
  const flag = args.indexOf("--artifacts");
8072
9382
  const artifacts = flag === -1 ? undefined : args.splice(flag, 2)[1];
@@ -8118,9 +9428,9 @@ var releaseStep = (argv) => runCommand((error) => `Release step failed: ${error.
8118
9428
  return yield* invalid(`Unknown release step ${String(name)}`);
8119
9429
  }
8120
9430
  }));
8121
- var verifyMacosSigning = (args) => Effect24.gen(function* () {
9431
+ var verifyMacosSigning = (args) => Effect28.gen(function* () {
8122
9432
  let problems = 0;
8123
- const code = yield* runCommand("Unable to check the app signing; run it on macOS with codesign.", Effect24.gen(function* () {
9433
+ const code = yield* runCommand("Unable to check the app signing; run it on macOS with codesign.", Effect28.gen(function* () {
8124
9434
  const [app, flag, ...extra] = args;
8125
9435
  if (!app || extra.length || ![undefined, "--hardened"].includes(flag))
8126
9436
  return yield* invalid("usage");
@@ -8133,22 +9443,120 @@ var verifyMacosSigning = (args) => Effect24.gen(function* () {
8133
9443
  }));
8134
9444
  return code || (problems ? 1 : 0);
8135
9445
  });
8136
- var publishFramework = (args) => runCommand((error) => error.message, Effect24.gen(function* () {
9446
+ var publishFramework = (args) => runCommand((error) => error.message, Effect28.gen(function* () {
8137
9447
  const [archive, flag, ...extra] = args;
8138
9448
  if (!archive || extra.length || flag !== undefined && flag !== "--dry-run")
8139
9449
  return yield* invalid("Expected one framework package archive and an optional --dry-run");
8140
9450
  const { env } = yield* ReleaseConfig;
8141
9451
  yield* print(yield* step(() => publishFrameworkPackage({ env, archive, dryRun: flag === "--dry-run" })));
8142
9452
  }));
9453
+ var publishArch = (argv) => runCommand((error) => `Unable to publish the Arch package: ${redactedErrorMessage(error)}`, Effect28.gen(function* () {
9454
+ const args = [...argv];
9455
+ const printIndex = args.indexOf("--print");
9456
+ const printDirectory = printIndex === -1 ? undefined : args[printIndex + 1];
9457
+ if (printIndex !== -1 && !printDirectory)
9458
+ return yield* invalid("Expected a directory after --print");
9459
+ if (printIndex !== -1)
9460
+ args.splice(printIndex, 2);
9461
+ const pkgrelIndex = args.indexOf("--pkgrel");
9462
+ const pkgrelText = pkgrelIndex === -1 ? undefined : args[pkgrelIndex + 1];
9463
+ if (pkgrelIndex !== -1 && !pkgrelText)
9464
+ return yield* invalid("Expected a number after --pkgrel");
9465
+ if (pkgrelIndex !== -1)
9466
+ args.splice(pkgrelIndex, 2);
9467
+ if (pkgrelText !== undefined && !/^[1-9]\d{0,2}$/.test(pkgrelText))
9468
+ return yield* invalid("--pkgrel must be an integer between 1 and 999");
9469
+ const dryIndex = args.indexOf("--dry-run");
9470
+ const dryRun = dryIndex !== -1;
9471
+ if (dryRun)
9472
+ args.splice(dryIndex, 1);
9473
+ const [configPath, tag, ...extra] = args;
9474
+ if (!configPath || !tag || extra.length)
9475
+ return yield* invalid("Expected <release-config.json> <tag>");
9476
+ const config = yield* readReleaseConfig(configPath);
9477
+ if (typeof config !== "object" || config === null || Array.isArray(config) || typeof config.appName !== "string")
9478
+ return yield* invalid("release-config.json names no app");
9479
+ yield* print(yield* publishArchPackageEffect({
9480
+ config,
9481
+ appName: config.appName,
9482
+ tag,
9483
+ ...pkgrelText === undefined ? {} : { pkgrel: Number(pkgrelText) },
9484
+ ...dryRun ? { dryRun } : {},
9485
+ ...printDirectory ? { printDirectory } : {}
9486
+ }));
9487
+ }));
9488
+ var dailyMatrix = (args) => runCommand("Unable to prepare the Daily matrix; check the command arguments and use matching exact staged artifacts and native receipts.", Effect28.gen(function* () {
9489
+ const [action, configPath, ...operands] = args;
9490
+ if (!configPath)
9491
+ return yield* invalid();
9492
+ if (action === "plan" && operands.length === 1) {
9493
+ const config = yield* readReleaseConfig(configPath);
9494
+ const matrix = yield* step(async () => planDailyReleaseMatrix(config, operands[0]));
9495
+ return yield* print(matrix);
9496
+ }
9497
+ if (!(action === "verify" && operands.length === 3 || action === "stage-local" && operands.length === 4 || action === "produce-native-receipt" && (operands.length === 4 || operands.length === 5)))
9498
+ return yield* invalid();
9499
+ const [identityPath, artifacts, receipts, parent, baselineArtifacts] = operands;
9500
+ const raw = yield* readBoundedJson(identityPath, 4096, "Daily identity");
9501
+ if (!isRecord(raw) || typeof raw.tag !== "string" || typeof raw.sourceSha !== "string" || typeof raw.workflowSha !== "string" || typeof raw.runId !== "string" || typeof raw.runAttempt !== "number")
9502
+ return yield* invalid();
9503
+ const { tag, sourceSha, workflowSha, runId, runAttempt } = raw;
9504
+ const config = yield* readReleaseConfig(configPath);
9505
+ const identity = { tag, sourceSha, workflowSha, runId, runAttempt };
9506
+ if (action === "produce-native-receipt") {
9507
+ const { env, platform: os, arch } = yield* ReleaseConfig;
9508
+ yield* step(async () => assertHostedRunner(env, "Daily native receipt"));
9509
+ const report = yield* readBoundedJson(parent, 65536, "Daily native job report");
9510
+ return yield* print(yield* createDailyNativeReceiptEffect({
9511
+ config,
9512
+ identity,
9513
+ artifacts,
9514
+ checkName: receipts,
9515
+ baselineArtifacts,
9516
+ report
9517
+ }, { os, arch }));
9518
+ }
9519
+ const options = {
9520
+ config,
9521
+ identity,
9522
+ artifacts,
9523
+ receipts
9524
+ };
9525
+ const result = action === "verify" ? yield* verifyDailyReleaseMatrixEffect(options) : yield* stageDailyBatchEffect({ ...options, parent });
9526
+ return yield* print(result);
9527
+ }));
9528
+ var prepareStableCatalog2 = (args) => runCommand((error) => `Unable to prepare Stable catalog: ${redactedErrorMessage(error)}`, Effect28.gen(function* () {
9529
+ yield* print(yield* step(() => prepareStableCatalogCommand(args)));
9530
+ }));
9531
+ var stageAptRepository = (args) => runCommand((error) => `Unable to stage Apt repository: ${redactedErrorMessage(error)}`, Effect28.gen(function* () {
9532
+ yield* print(yield* step(() => stageAptRepositoryCommand(args)));
9533
+ }));
9534
+ var linuxChannelProof = (args) => runCommand((error) => `Unable to check Linux package channel: ${redactedErrorMessage(error)}`, Effect28.gen(function* () {
9535
+ const [channel, input, ...extra] = args;
9536
+ if (channel !== "rpm" && channel !== "flatpak" || !input || extra.length)
9537
+ return yield* invalid("Expected <rpm|flatpak> <input.json>");
9538
+ const value = yield* readBoundedJson(input, 1024 * 1024, "Linux channel proof");
9539
+ if (channel === "rpm") {
9540
+ yield* print(yield* step(() => verifyRpmStage(value)));
9541
+ } else {
9542
+ const { policy, observation } = value;
9543
+ yield* print(yield* step(async () => verifyFlatpakCapabilities(policy, observation)));
9544
+ }
9545
+ }));
8143
9546
  var commands = {
8144
9547
  cut,
9548
+ "daily-matrix": dailyMatrix,
8145
9549
  finalize,
9550
+ "linux-channel-proof": linuxChannelProof,
8146
9551
  "plan-assets": planAssets,
9552
+ "prepare-stable-catalog": prepareStableCatalog2,
8147
9553
  promote,
8148
9554
  publish,
9555
+ "publish-arch": publishArch,
8149
9556
  "publish-framework-package": publishFramework,
8150
9557
  sign: sign2,
8151
9558
  "sign-descriptors": signDescriptors,
9559
+ "stage-apt-repository": stageAptRepository,
8152
9560
  step: releaseStep,
8153
9561
  "verify-macos-signing": verifyMacosSigning
8154
9562
  };
@@ -8157,7 +9565,7 @@ var releaseCli = (argv) => {
8157
9565
  const command = name === undefined ? undefined : commands[name];
8158
9566
  if (command)
8159
9567
  return command(args);
8160
- return Effect24.gen(function* () {
9568
+ return Effect28.gen(function* () {
8161
9569
  const { stderr } = yield* ReleaseOutput;
8162
9570
  stderr(`Usage: adea-release <${Object.keys(commands).join("|")}> [arguments]; unknown command ${String(name)}
8163
9571
  `);
@@ -8166,4 +9574,4 @@ var releaseCli = (argv) => {
8166
9574
  };
8167
9575
 
8168
9576
  // src/cli.ts
8169
- process.exitCode = await Effect25.runPromise(provideLivePorts(releaseCli(process.argv.slice(2))));
9577
+ process.exitCode = await Effect29.runPromise(provideLivePorts(releaseCli(process.argv.slice(2))));