@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.js CHANGED
@@ -458,6 +458,12 @@ var FEATURE_FLAGS = [
458
458
  default: true,
459
459
  env: "THREADBASE_FEATURE_SESSION_REHYDRATION"
460
460
  },
461
+ {
462
+ id: "liveActivityPush",
463
+ 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.",
464
+ default: false,
465
+ env: "THREADBASE_FEATURE_LIVE_ACTIVITY_PUSH"
466
+ },
461
467
  {
462
468
  id: "ptyHost",
463
469
  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.",
@@ -6323,6 +6329,10 @@ async function listDirectories(absolutePath) {
6323
6329
  const entries = await readdir(absolutePath, { withFileTypes: true });
6324
6330
  return entries.filter((e) => e.isDirectory()).map((e) => ({ name: e.name })).sort((a, b) => a.name.localeCompare(b.name));
6325
6331
  }
6332
+ async function listFiles(absolutePath) {
6333
+ const entries = await readdir(absolutePath, { withFileTypes: true });
6334
+ return entries.filter((e) => e.isFile()).map((e) => ({ name: e.name })).sort((a, b) => a.name.localeCompare(b.name));
6335
+ }
6326
6336
  async function createDirectory(parentAbsolutePath, name) {
6327
6337
  if (name.includes("/") || name.includes("\\") || name === ".." || name === ".") {
6328
6338
  throw new Error("Invalid directory name");
@@ -11750,6 +11760,13 @@ var StreamerServer = class {
11750
11760
  * on disk; neither it nor any device token is ever logged.
11751
11761
  */
11752
11762
  initLiveActivityPush(pushRepo) {
11763
+ if (!this.featureFlags.liveActivityPush) {
11764
+ this.log.info(
11765
+ "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.",
11766
+ { event: "live_activity.disabled" }
11767
+ );
11768
+ return;
11769
+ }
11753
11770
  const creds = readApnsCredentialsFromEnv();
11754
11771
  if (!creds) {
11755
11772
  const why = describeMissingApnsCredentials();
@@ -15307,8 +15324,11 @@ var StreamerServer = class {
15307
15324
  const relativePath = url.searchParams.get("path") ?? "";
15308
15325
  try {
15309
15326
  const resolved = await resolveBrowsePath(this.browseRoot, relativePath);
15310
- const directories = await listDirectories(resolved);
15311
- json(res, 200, { path: relativePath, directories });
15327
+ const [directories, files] = await Promise.all([
15328
+ listDirectories(resolved),
15329
+ listFiles(resolved)
15330
+ ]);
15331
+ json(res, 200, { path: relativePath, directories, files });
15312
15332
  } catch (err) {
15313
15333
  const message = err instanceof Error ? err.message : "Browse failed";
15314
15334
  if (err instanceof BrowsePathNotFoundError) {