@threadbase-sh/streamer 1.55.3 → 1.56.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.d.cts CHANGED
@@ -145,6 +145,11 @@ declare const FEATURE_FLAGS: readonly [{
145
145
  readonly description: string;
146
146
  readonly default: false;
147
147
  readonly env: "THREADBASE_FEATURE_LIVE_ACTIVITY_PUSH";
148
+ }, {
149
+ readonly id: "e2ee";
150
+ readonly description: string;
151
+ readonly default: false;
152
+ readonly env: "THREADBASE_FEATURE_E2EE";
148
153
  }, {
149
154
  readonly id: "ptyHost";
150
155
  readonly description: string;
package/dist/index.d.ts CHANGED
@@ -145,6 +145,11 @@ declare const FEATURE_FLAGS: readonly [{
145
145
  readonly description: string;
146
146
  readonly default: false;
147
147
  readonly env: "THREADBASE_FEATURE_LIVE_ACTIVITY_PUSH";
148
+ }, {
149
+ readonly id: "e2ee";
150
+ readonly description: string;
151
+ readonly default: false;
152
+ readonly env: "THREADBASE_FEATURE_E2EE";
148
153
  }, {
149
154
  readonly id: "ptyHost";
150
155
  readonly description: string;
package/dist/index.js CHANGED
@@ -464,6 +464,12 @@ var FEATURE_FLAGS = [
464
464
  default: false,
465
465
  env: "THREADBASE_FEATURE_LIVE_ACTIVITY_PUSH"
466
466
  },
467
+ {
468
+ id: "e2ee",
469
+ description: "Application-layer encryption between a paired device and this server, independent of TLS, so a tunnel or a LAN observer on the path carries ciphertext. Off by default: it is negotiated per device, never forced, because released mobile builds cannot be force-updated and a server that demanded it would break every one of them.",
470
+ default: false,
471
+ env: "THREADBASE_FEATURE_E2EE"
472
+ },
467
473
  {
468
474
  id: "ptyHost",
469
475
  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.",
@@ -996,6 +1002,7 @@ import { Terminal } from "@xterm/headless";
996
1002
  var PTY_COLS = 120;
997
1003
  var PTY_ROWS = 40;
998
1004
  var SCREEN_SCROLLBACK = 1e3;
1005
+ var REPLAY_MAX_LINES = SCREEN_SCROLLBACK + PTY_ROWS;
999
1006
  function digestBytes(s) {
1000
1007
  const escaped = s.replace(new RegExp(String.fromCharCode(27), "g"), "\\x1b").replace(/\r/g, "\\r").replace(/\n/g, "\\n").replace(/\t/g, "\\t");
1001
1008
  if (escaped.length <= 200) return escaped;
@@ -5733,6 +5740,25 @@ function describePushCapability(liveActivityEnabled, env = process.env) {
5733
5740
  liveActivityReason: describeMissingApnsCredentials(env) ?? "APNs credentials are set but the push token store is unavailable, so Live Activity push is disabled."
5734
5741
  };
5735
5742
  }
5743
+ var E2EE_PROTOCOL_VERSION = 1;
5744
+ var E2EE_SUPPORTED = false;
5745
+ function describeE2eeCapability(flagEnabled) {
5746
+ const enabled = E2EE_SUPPORTED && flagEnabled;
5747
+ const base = {
5748
+ supported: E2EE_SUPPORTED,
5749
+ enabled,
5750
+ version: E2EE_PROTOCOL_VERSION,
5751
+ required: false
5752
+ };
5753
+ if (enabled) return base;
5754
+ return {
5755
+ ...base,
5756
+ // Always says why, including when `supported` is false. An operator who set
5757
+ // the flag and saw nothing happen has exactly one question, and a field that
5758
+ // goes absent in the case they hit is the field not answering it.
5759
+ reason: E2EE_SUPPORTED ? "disabled by the e2ee feature flag \u2014 set THREADBASE_FEATURE_E2EE=1, --feature e2ee=true, or feature_flags: in server.yaml" : "this build carries the capability negotiation but not yet the handshake it gates"
5760
+ };
5761
+ }
5736
5762
  var identityKeyFailureLogged = false;
5737
5763
  function describeServerIdentityKey() {
5738
5764
  try {
@@ -5787,7 +5813,11 @@ var createMiscRoutes = (deps) => {
5787
5813
  // learn it without re-scanning. Additive: absent means a server with no
5788
5814
  // readable identity key, which a client must read as "cannot verify this
5789
5815
  // server" — never as a reason to fail the rest of this response.
5790
- serverIdentityKey: describeServerIdentityKey()
5816
+ serverIdentityKey: describeServerIdentityKey(),
5817
+ // Whether to encrypt to this server. Additive, same contract as `push`:
5818
+ // absent means an older server, which a client must read as "unknown" and
5819
+ // resolve as today's plaintext path — never as a reason to fail.
5820
+ e2ee: describeE2eeCapability(deps.featureFlagsConfig().values.e2ee)
5791
5821
  });
5792
5822
  });
5793
5823
  app.get("/api/profiles", (c) => c.json([]));
@@ -12315,7 +12345,7 @@ function createApiDeps(deps) {
12315
12345
  }
12316
12346
  deps.addSessionSubscriber(msg.sessionId, ws);
12317
12347
  if (deps.ptyManager.hasSession(msg.sessionId)) {
12318
- const lines = await deps.ptyManager.getOutputLines(msg.sessionId, 200);
12348
+ const lines = await deps.ptyManager.getOutputLines(msg.sessionId, REPLAY_MAX_LINES);
12319
12349
  const userMessages = deps.ptyManager.getInputHistory(msg.sessionId);
12320
12350
  ws.send(
12321
12351
  JSON.stringify({