@halcyonlabs/app 0.47.0-halcyon.426 → 0.47.0-halcyon.427

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.
Files changed (48) hide show
  1. package/dist/bb-app.js +93 -16
  2. package/dist/index.d.ts +69 -69
  3. package/dist/index.js +13 -0
  4. package/host-daemon/dist/bb +2 -2
  5. package/host-daemon/dist/bb-chunks/{browser-WHQ7FOYB.js → browser-ZEFFGB26.js} +1 -1
  6. package/host-daemon/dist/bb-chunks/{chunk-NBD63LSE.js → chunk-2VBVXHCO.js} +1 -1
  7. package/host-daemon/dist/bb-chunks/{chunk-KOHZHKV3.js → chunk-4DB32TQ2.js} +1 -1
  8. package/host-daemon/dist/bb-chunks/{chunk-ASVZVMB7.js → chunk-6W522XWW.js} +1 -1
  9. package/host-daemon/dist/bb-chunks/{chunk-CO7MWB5S.js → chunk-CQQULLUB.js} +1 -1
  10. package/host-daemon/dist/bb-chunks/{chunk-7XQFWLHC.js → chunk-EGI3PDJP.js} +2 -2
  11. package/host-daemon/dist/bb-chunks/{chunk-XSWDT4Z7.js → chunk-G7UKUDRZ.js} +1 -1
  12. package/host-daemon/dist/bb-chunks/chunk-G7YL5DVK.js +2 -0
  13. package/host-daemon/dist/bb-chunks/{chunk-JV4DTKAM.js → chunk-GRWMDTBD.js} +1 -1
  14. package/host-daemon/dist/bb-chunks/{chunk-4MDJTHVY.js → chunk-HIWLZ4JX.js} +6 -2
  15. package/host-daemon/dist/bb-chunks/{chunk-QQHP55AW.js → chunk-NKXENHEU.js} +1 -1
  16. package/host-daemon/dist/bb-chunks/{chunk-4RFVFB3F.js → chunk-OD73XZBZ.js} +1 -1
  17. package/host-daemon/dist/bb-chunks/{client-UV5XAEUU.js → client-ARSXLZ7U.js} +1 -1
  18. package/host-daemon/dist/bb-chunks/{commander-errors-2ZA2II5B.js → commander-errors-LG2MJ6KV.js} +1 -1
  19. package/host-daemon/dist/bb-chunks/{context-env-AK3SQXHK.js → context-env-5PHP22B2.js} +1 -1
  20. package/host-daemon/dist/bb-chunks/{context-hints-W52LG6SC.js → context-hints-V6LBX4TV.js} +1 -1
  21. package/host-daemon/dist/bb-chunks/{diagnostics-47OCBACR.js → diagnostics-XYZ2XT6S.js} +1 -1
  22. package/host-daemon/dist/bb-chunks/{environment-YQBGGDAF.js → environment-FS7NEMOY.js} +1 -1
  23. package/host-daemon/dist/bb-chunks/{file-R4Z7DRXC.js → file-YGLCC6R4.js} +1 -1
  24. package/host-daemon/dist/bb-chunks/{guide-X7BLBOHV.js → guide-MV7X42MR.js} +1 -1
  25. package/host-daemon/dist/bb-chunks/{machine-NATUHEOT.js → machine-IY6LFZJ7.js} +1 -1
  26. package/host-daemon/dist/bb-chunks/{marketplace-C2ADGBOS.js → marketplace-T52ANUUC.js} +1 -1
  27. package/host-daemon/dist/bb-chunks/{permissions-JNQZO4MB.js → permissions-GZMED7X7.js} +1 -1
  28. package/host-daemon/dist/bb-chunks/{plugin-6365EP4W.js → plugin-VA4UGRYQ.js} +1 -1
  29. package/host-daemon/dist/bb-chunks/{plugin-cli-proxy-WS4TNUQO.js → plugin-cli-proxy-GCWTZ7AA.js} +1 -1
  30. package/host-daemon/dist/bb-chunks/{project-MP2KPUP5.js → project-BB5DNBCN.js} +1 -1
  31. package/host-daemon/dist/bb-chunks/{prompt-history-A45GQCAH.js → prompt-history-QTZ2B3LB.js} +1 -1
  32. package/host-daemon/dist/bb-chunks/{provider-PAU7BND7.js → provider-L3CLTJKX.js} +1 -1
  33. package/host-daemon/dist/bb-chunks/{schedule-DEYAHYDB.js → schedule-AEDFLDHP.js} +1 -1
  34. package/host-daemon/dist/bb-chunks/{server-WKX3EXD5.js → server-GUBCT4WZ.js} +1 -1
  35. package/host-daemon/dist/bb-chunks/{settings-EVFPBWJ3.js → settings-JUGX3QON.js} +1 -1
  36. package/host-daemon/dist/bb-chunks/{skill-IG7H76CR.js → skill-I5D53CJV.js} +1 -1
  37. package/host-daemon/dist/bb-chunks/{status-MIGTL764.js → status-SSJMYM4S.js} +1 -1
  38. package/host-daemon/dist/bb-chunks/{terminal-PPYCAE62.js → terminal-VMCCEQDY.js} +1 -1
  39. package/host-daemon/dist/bb-chunks/{theme-HSOUFGMX.js → theme-U637PPQA.js} +1 -1
  40. package/host-daemon/dist/bb-chunks/{thread-FXA7B7RK.js → thread-DOGLLRXR.js} +1 -1
  41. package/host-daemon/dist/bb-chunks/{updates-B3MHHKGZ.js → updates-DYICOEFL.js} +1 -1
  42. package/host-daemon/dist/bb-chunks/{voice-LNAFNPHW.js → voice-DE4QKGCQ.js} +1 -1
  43. package/host-daemon/dist/daemon-bundle.mjs +86 -86
  44. package/package.json +2 -2
  45. package/server/dist/builtin-plugins/orbit/dist/assets/moonlet/fixed-runner/linux-x64/manifest.json +4 -4
  46. package/server/dist/builtin-plugins/orbit/dist/assets/moonlet/revision +1 -1
  47. package/server/dist/start-server.js +84067 -83667
  48. package/host-daemon/dist/bb-chunks/chunk-DUXDOOOQ.js +0 -2
package/dist/bb-app.js CHANGED
@@ -14898,7 +14898,7 @@ function relayDesktopAppUpdates(child) {
14898
14898
  }
14899
14899
 
14900
14900
  // src/launcher.ts
14901
- import { existsSync as existsSync2, readdirSync, readFileSync as readFileSync2 } from "node:fs";
14901
+ import { existsSync as existsSync3, readdirSync, readFileSync as readFileSync2 } from "node:fs";
14902
14902
 
14903
14903
  // src/logged-process.ts
14904
14904
  import { spawn } from "node:child_process";
@@ -16415,6 +16415,10 @@ import { delimiter as delimiter2 } from "node:path";
16415
16415
  import { randomUUID } from "node:crypto";
16416
16416
  import { mkdir as mkdir4, open as open3, readFile as readFile3, rename as rename2, unlink as unlink2 } from "node:fs/promises";
16417
16417
  import { join as join8 } from "node:path";
16418
+ var APP_UPDATE_CONTINUATION_PLUGIN_ID = "bb-app-update";
16419
+ var APP_UPDATE_CONTINUATION_SEND_AT = 864e13;
16420
+ var APP_UPDATE_CONTINUATION_PROTOCOL_ENV_NAME = "BB_APP_UPDATE_CONTINUATION_PROTOCOL";
16421
+ var APP_UPDATE_CONTINUATION_PROTOCOL_VERSION = "1";
16418
16422
  var APP_UPDATE_RECOVERY_PROTOCOL_ENV_NAME = "BB_APP_UPDATE_RECOVERY_PROTOCOL";
16419
16423
  var APP_UPDATE_SHIM_PROTOCOL_ENV_NAME = "BB_APP_UPDATE_SHIM_PROTOCOL";
16420
16424
  var APP_UPDATE_SHIM_PROTOCOL_VERSION = 1;
@@ -17541,11 +17545,40 @@ async function writeCliLauncher(args) {
17541
17545
  return "written";
17542
17546
  }
17543
17547
 
17548
+ // src/app-update/continuations.ts
17549
+ import { existsSync } from "node:fs";
17550
+ import { createRequire as createRequire2 } from "node:module";
17551
+ function releaseAppUpdateContinuations(dataDir, attemptId) {
17552
+ const path2 = resolveDataDirDatabasePath({ dataDir });
17553
+ if (!existsSync(path2)) return;
17554
+ const Database = createRequire2(import.meta.url)("better-sqlite3");
17555
+ const db = new Database(path2, { fileMustExist: true });
17556
+ try {
17557
+ db.pragma("busy_timeout = 5000");
17558
+ db.prepare(
17559
+ `UPDATE queued_thread_messages
17560
+ SET send_at = NULL, waiting_on = NULL, wait_holder = NULL,
17561
+ state = 'queued', updated_at = ?
17562
+ WHERE send_at = ? AND state = 'scheduled' AND claim_token IS NULL
17563
+ AND json_extract(system_notice, '$.kind') = 'plugin-notice'
17564
+ AND json_extract(system_notice, '$.subject.pluginId') = ?
17565
+ AND json_extract(system_notice, '$.subject.label') = ?`
17566
+ ).run(
17567
+ Date.now(),
17568
+ APP_UPDATE_CONTINUATION_SEND_AT,
17569
+ APP_UPDATE_CONTINUATION_PLUGIN_ID,
17570
+ attemptId
17571
+ );
17572
+ } finally {
17573
+ db.close();
17574
+ }
17575
+ }
17576
+
17544
17577
  // src/app-update/launcher-controller.ts
17545
17578
  import { randomUUID as randomUUID2 } from "node:crypto";
17546
17579
 
17547
17580
  // src/app-update/npm-revision.ts
17548
- import { existsSync, readFileSync } from "node:fs";
17581
+ import { existsSync as existsSync2, readFileSync } from "node:fs";
17549
17582
 
17550
17583
  // ../config/src/app-package.ts
17551
17584
  var BB_APP_NPM_PACKAGE_NAME = "@halcyonlabs/app";
@@ -17557,7 +17590,7 @@ function bbAppInstallSpec(versionOrTag) {
17557
17590
  // src/app-update/npm-revision.ts
17558
17591
  var import_semver = __toESM(require_semver2(), 1);
17559
17592
  import { mkdir as mkdir8, readdir as readdir2, rename as rename5, rm as rm5, writeFile as writeFile6 } from "node:fs/promises";
17560
- import { createRequire as createRequire2 } from "node:module";
17593
+ import { createRequire as createRequire3 } from "node:module";
17561
17594
  import { delimiter as delimiter3, dirname as dirname4, join as join11 } from "node:path";
17562
17595
 
17563
17596
  // src/app-update/run-command.ts
@@ -17672,11 +17705,15 @@ var shimLockFileSchema = external_exports.object({
17672
17705
  function hasErrorCode3(error2, code2) {
17673
17706
  return error2 instanceof Error && "code" in error2 && error2.code === code2;
17674
17707
  }
17708
+ function hasAppUpdateContinuationSupervisor(env) {
17709
+ return env[APP_UPDATE_RECOVERY_PROTOCOL_ENV_NAME] === "1" && env[APP_UPDATE_CONTINUATION_PROTOCOL_ENV_NAME] === APP_UPDATE_CONTINUATION_PROTOCOL_VERSION;
17710
+ }
17675
17711
  function createLauncherEnv(mode) {
17676
17712
  return {
17677
17713
  ...process.env,
17678
17714
  [APP_UPDATE_MODE_ENV_NAME]: mode,
17679
17715
  [APP_UPDATE_RECOVERY_PROTOCOL_ENV_NAME]: "1",
17716
+ [APP_UPDATE_CONTINUATION_PROTOCOL_ENV_NAME]: APP_UPDATE_CONTINUATION_PROTOCOL_VERSION,
17680
17717
  [APP_UPDATE_SHIM_PROTOCOL_ENV_NAME]: String(
17681
17718
  APP_UPDATE_SHIM_PROTOCOL_VERSION
17682
17719
  )
@@ -17861,7 +17898,7 @@ function isOwnNpmRevision(revision) {
17861
17898
  }
17862
17899
  function isUsableNpmRevision(revision) {
17863
17900
  return readPackageVersion(revision.packageRoot) === revision.version && NPM_REVISION_REQUIRED_FILES.every(
17864
- (file2) => existsSync(join11(revision.packageRoot, file2))
17901
+ (file2) => existsSync2(join11(revision.packageRoot, file2))
17865
17902
  );
17866
17903
  }
17867
17904
  function formatNpmRevisionInstallDir(dataDir, version2) {
@@ -17876,7 +17913,7 @@ function formatNpmRevisionPackageRoot(dataDir, version2) {
17876
17913
  }
17877
17914
  function resolveNpmCliPath() {
17878
17915
  try {
17879
- const require2 = createRequire2(import.meta.url);
17916
+ const require2 = createRequire3(import.meta.url);
17880
17917
  return join11(
17881
17918
  dirname4(require2.resolve("npm/package.json")),
17882
17919
  "bin",
@@ -18216,7 +18253,7 @@ function createLauncherAppUpdateController(args) {
18216
18253
  const timer = setTimeout(
18217
18254
  () => finish({
18218
18255
  kind: "cancel",
18219
- message: automatic ? "The automatic restart was not confirmed; work can continue and the updater can retry." : "The server did not confirm the restart. Update again to retry."
18256
+ message: automatic ? "The automatic restart was not confirmed. Any remaining pause in background work ends when you interact with the app or turn off automatic updates." : "The server did not confirm the restart. Update again to retry."
18220
18257
  }),
18221
18258
  READY_DECISION_TIMEOUT_MS
18222
18259
  );
@@ -18474,7 +18511,7 @@ function createLauncherAppUpdateController(args) {
18474
18511
  if (request.type === "restart" && activity.decisionId !== void 0 && (request.deadlineMonotonicMs === void 0 || monotonicNowMs() >= request.deadlineMonotonicMs)) {
18475
18512
  decide({
18476
18513
  kind: "cancel",
18477
- message: "The automatic update deadline expired before restart; work can continue."
18514
+ message: "The automatic update deadline expired before restart. Any remaining pause in background work ends when you interact with the app or turn off automatic updates."
18478
18515
  });
18479
18516
  return null;
18480
18517
  }
@@ -18606,6 +18643,12 @@ function createLauncherAppUpdateController(args) {
18606
18643
  args.dataDir,
18607
18644
  (state) => state.pending?.id !== pending.id ? state : { ...state, lastResult: result, pending: null }
18608
18645
  );
18646
+ if (args.mode === "source" && (updated || restored)) {
18647
+ (args.releaseContinuations ?? releaseAppUpdateContinuations)(
18648
+ args.dataDir,
18649
+ pending.id
18650
+ );
18651
+ }
18609
18652
  if (updated && pending.to.kind === "npm") {
18610
18653
  await pruneNpmRevisions({
18611
18654
  dataDir: args.dataDir,
@@ -18800,6 +18843,15 @@ async function runNpmShim(args) {
18800
18843
  ...state.lastResult?.id === attempt.id ? { lastResult: result } : {}
18801
18844
  }));
18802
18845
  };
18846
+ const releasedContinuations = /* @__PURE__ */ new Set();
18847
+ const releaseContinuations = (attemptId) => {
18848
+ if (releasedContinuations.has(attemptId)) return;
18849
+ (args.releaseContinuations ?? releaseAppUpdateContinuations)(
18850
+ args.dataDir,
18851
+ attemptId
18852
+ );
18853
+ releasedContinuations.add(attemptId);
18854
+ };
18803
18855
  const verifyReadinessReceipt = async (attempt, revision, recovering) => {
18804
18856
  const receipt = await readAppUpdateReceipt(
18805
18857
  args.dataDir,
@@ -18816,6 +18868,24 @@ async function runNpmShim(args) {
18816
18868
  for (; ; ) {
18817
18869
  const before = await readAppUpdateStateFile(args.dataDir);
18818
18870
  const pending = before?.pending ?? null;
18871
+ if (pending === null) {
18872
+ const result = before?.lastResult;
18873
+ const revision = result?.outcome === "updated" ? result.to : result?.restored;
18874
+ if (result !== null && result !== void 0 && revision?.kind === "npm" && isSameRevision(revision, launch)) {
18875
+ try {
18876
+ await verifyReadinessReceipt(
18877
+ result,
18878
+ launch,
18879
+ result.outcome === "failed"
18880
+ );
18881
+ releaseContinuations(result.id);
18882
+ } catch (error2) {
18883
+ args.output.warn(
18884
+ `Saved work remains held because its readiness receipt could not be verified: ${String(error2)}`
18885
+ );
18886
+ }
18887
+ }
18888
+ }
18819
18889
  if (pending !== null && pending.rollbackReason === void 0 && pending.from.kind === "npm") {
18820
18890
  const failed = await readAppUpdateReceipt(
18821
18891
  args.dataDir,
@@ -18885,8 +18955,12 @@ async function runNpmShim(args) {
18885
18955
  const result = state2?.lastResult;
18886
18956
  const ready = state2?.pending?.id !== attempt.id && result?.id === attempt.id && (recovering ? result.restored !== void 0 && isSameRevision(result.restored, launch) || result.outcome === "updated" && isSameRevision(result.to, launch) : result.outcome === "updated" && isSameRevision(result.to, launch));
18887
18957
  if (ready) {
18888
- if (recovering) await recordRestored(attempt, launch);
18958
+ if (recovering && result?.outcome === "updated")
18959
+ await recordRestored(attempt, launch);
18889
18960
  await verifyReadinessReceipt(attempt, launch, recovering);
18961
+ if (recovering && result?.outcome !== "updated")
18962
+ await recordRestored(attempt, launch);
18963
+ releaseContinuations(attempt.id);
18890
18964
  startupVerified = true;
18891
18965
  clearInterval(poll);
18892
18966
  } else if (result?.id === attempt.id && result.outcome === "failed" && state2?.pending === null) {
@@ -18931,8 +19005,12 @@ async function runNpmShim(args) {
18931
19005
  let verified = startupVerified;
18932
19006
  if (!verified && stateVerified) {
18933
19007
  try {
18934
- if (recovering) await recordRestored(attempt, launch);
19008
+ if (recovering && result?.outcome === "updated")
19009
+ await recordRestored(attempt, launch);
18935
19010
  await verifyReadinessReceipt(attempt, launch, recovering);
19011
+ if (recovering && result?.outcome !== "updated")
19012
+ await recordRestored(attempt, launch);
19013
+ releaseContinuations(attempt.id);
18936
19014
  verified = true;
18937
19015
  } catch (error2) {
18938
19016
  failure2 = `Could not verify the startup receipt: ${String(error2)}`;
@@ -18967,8 +19045,6 @@ async function runNpmShim(args) {
18967
19045
  continue;
18968
19046
  }
18969
19047
  }
18970
- if (attempt !== null && recovering && !startupVerified)
18971
- await recordRestored(attempt, launch);
18972
19048
  if (exit.code !== APP_UPDATE_RESTART_EXIT_CODE) {
18973
19049
  return toShimExitCode(exit);
18974
19050
  }
@@ -20238,7 +20314,7 @@ function requiredFullStackArtifactPaths(context) {
20238
20314
  function artifactPresent(artifact) {
20239
20315
  switch (artifact.kind) {
20240
20316
  case "file":
20241
- return existsSync2(artifact.path);
20317
+ return existsSync3(artifact.path);
20242
20318
  case "chunk-dir":
20243
20319
  try {
20244
20320
  return readdirSync(artifact.path).some((name2) => name2.endsWith(".js"));
@@ -20598,7 +20674,7 @@ async function resolveMovedDaemonLaunch(args) {
20598
20674
  function resolveEnrollmentRequirements(args) {
20599
20675
  const enrollKey = toOptionalString(args.env.BB_HOST_ENROLL_KEY);
20600
20676
  return {
20601
- enrolled: existsSync2(join14(args.context.dataDir, HOST_AUTH_FILE_NAME)),
20677
+ enrolled: existsSync3(join14(args.context.dataDir, HOST_AUTH_FILE_NAME)),
20602
20678
  ...enrollKey !== void 0 ? { enrollKey } : {}
20603
20679
  };
20604
20680
  }
@@ -20694,7 +20770,7 @@ async function runHostDaemonOnly(args) {
20694
20770
  ${bold("Moonlet host-daemon")}
20695
20771
 
20696
20772
  `);
20697
- if (existsSync2(args.context.daemonLockDir)) {
20773
+ if (existsSync3(args.context.daemonLockDir)) {
20698
20774
  warnExistingDaemonLock(args.context.daemonLockDir);
20699
20775
  }
20700
20776
  if (!enrollment.enrolled && enrollment.enrollKey === void 0) {
@@ -21561,8 +21637,9 @@ var shimOutput = {
21561
21637
  async function runBbApp(cliArgs = process.argv.slice(2), options = { worktreePolicy: null }) {
21562
21638
  const parsedArgs = parseLauncherArgs(cliArgs);
21563
21639
  const underAppUpdateShim = isRunningUnderAppUpdateShim(process.env);
21564
- const needsRecoverySupervisor = underAppUpdateShim && process.env[APP_UPDATE_RECOVERY_PROTOCOL_ENV_NAME] !== "1";
21640
+ const needsRecoverySupervisor = underAppUpdateShim && !hasAppUpdateContinuationSupervisor(process.env);
21565
21641
  delete process.env[APP_UPDATE_RECOVERY_PROTOCOL_ENV_NAME];
21642
+ delete process.env[APP_UPDATE_CONTINUATION_PROTOCOL_ENV_NAME];
21566
21643
  const appUpdateMode = takeAppUpdateModeFromEnv(process.env);
21567
21644
  if (parsedArgs.options.help) {
21568
21645
  printBbAppHelp();
@@ -21711,7 +21788,7 @@ async function runBbApp(cliArgs = process.argv.slice(2), options = { worktreePol
21711
21788
  ${bold("Moonlet")}
21712
21789
 
21713
21790
  `);
21714
- if (existsSync2(runtime.context.daemonLockDir)) {
21791
+ if (existsSync3(runtime.context.daemonLockDir)) {
21715
21792
  warnExistingDaemonLock(runtime.context.daemonLockDir);
21716
21793
  }
21717
21794
  const runtimeRecordOwned = await claimBbAppRuntimeFile({