@threadbase-sh/streamer 1.50.0 → 1.52.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/index.cjs CHANGED
@@ -510,6 +510,12 @@ var FEATURE_FLAGS = [
510
510
  default: true,
511
511
  env: "THREADBASE_FEATURE_SESSION_REHYDRATION"
512
512
  },
513
+ {
514
+ id: "liveActivityPush",
515
+ description: "Drive iOS Live Activity surfaces for running sessions. Off by default: the streamer half needs an APNs p8 and a registered push-to-start token, and without both, mobile falls back to starting the activity locally \u2014 which freezes the moment the app backgrounds and expires silently after ~8h. Mobile reads this flag and skips its local path too, so one switch turns the whole surface off.",
516
+ default: false,
517
+ env: "THREADBASE_FEATURE_LIVE_ACTIVITY_PUSH"
518
+ },
513
519
  {
514
520
  id: "ptyHost",
515
521
  description: "Keep live PTYs in a separate host process so a streamer restart can reconnect without restarting the agents. Off by default until cross-platform behavior is qualified.",
@@ -6362,6 +6368,10 @@ async function listDirectories(absolutePath) {
6362
6368
  const entries = await (0, import_promises2.readdir)(absolutePath, { withFileTypes: true });
6363
6369
  return entries.filter((e) => e.isDirectory()).map((e) => ({ name: e.name })).sort((a, b) => a.name.localeCompare(b.name));
6364
6370
  }
6371
+ async function listFiles(absolutePath) {
6372
+ const entries = await (0, import_promises2.readdir)(absolutePath, { withFileTypes: true });
6373
+ return entries.filter((e) => e.isFile()).map((e) => ({ name: e.name })).sort((a, b) => a.name.localeCompare(b.name));
6374
+ }
6365
6375
  async function createDirectory(parentAbsolutePath, name) {
6366
6376
  if (name.includes("/") || name.includes("\\") || name === ".." || name === ".") {
6367
6377
  throw new Error("Invalid directory name");
@@ -11787,6 +11797,13 @@ var StreamerServer = class {
11787
11797
  * on disk; neither it nor any device token is ever logged.
11788
11798
  */
11789
11799
  initLiveActivityPush(pushRepo) {
11800
+ if (!this.featureFlags.liveActivityPush) {
11801
+ this.log.info(
11802
+ "Live Activity push is disabled by the liveActivityPush feature flag. Enable it with THREADBASE_FEATURE_LIVE_ACTIVITY_PUSH=1, --feature liveActivityPush=true, or feature_flags: in server.yaml.",
11803
+ { event: "live_activity.disabled" }
11804
+ );
11805
+ return;
11806
+ }
11790
11807
  const creds = readApnsCredentialsFromEnv();
11791
11808
  if (!creds) {
11792
11809
  const why = describeMissingApnsCredentials();
@@ -15344,8 +15361,11 @@ var StreamerServer = class {
15344
15361
  const relativePath = url.searchParams.get("path") ?? "";
15345
15362
  try {
15346
15363
  const resolved = await resolveBrowsePath(this.browseRoot, relativePath);
15347
- const directories = await listDirectories(resolved);
15348
- json(res, 200, { path: relativePath, directories });
15364
+ const [directories, files] = await Promise.all([
15365
+ listDirectories(resolved),
15366
+ listFiles(resolved)
15367
+ ]);
15368
+ json(res, 200, { path: relativePath, directories, files });
15349
15369
  } catch (err) {
15350
15370
  const message = err instanceof Error ? err.message : "Browse failed";
15351
15371
  if (err instanceof BrowsePathNotFoundError) {