@evident-ai/cli 3.0.1-dev.5bd5ecd → 3.0.1-dev.60e0bdb

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
@@ -2685,6 +2685,7 @@ async function handleAuthError(state, error2) {
2685
2685
  }
2686
2686
  async function driveChannels(state, driver) {
2687
2687
  let idlePolls = 0;
2688
+ let lastSeenProxiedActivityAt = state.lastProxiedActivityAt;
2688
2689
  while (state.running) {
2689
2690
  if (state.connection?.reconnecting && state.connection.reconnectPromise) {
2690
2691
  logActivity(state, { type: "info", message: "Waiting for tunnel reconnection..." });
@@ -2694,7 +2695,9 @@ async function driveChannels(state, driver) {
2694
2695
  try {
2695
2696
  const processed = await driver.drainPending();
2696
2697
  state.messageCount += processed;
2697
- if (processed > 0 || driver.hasInFlightWatchers()) {
2698
+ const proxiedActivity = state.lastProxiedActivityAt !== lastSeenProxiedActivityAt;
2699
+ lastSeenProxiedActivityAt = state.lastProxiedActivityAt;
2700
+ if (processed > 0 || driver.hasInFlightWatchers() || proxiedActivity) {
2698
2701
  idlePolls = 0;
2699
2702
  if (processed > 0 && state.interactive) displayStatus(state);
2700
2703
  } else if (state.idleTimeout !== null) {
@@ -2769,6 +2772,7 @@ async function run(options) {
2769
2772
  running: true,
2770
2773
  activityLog: [],
2771
2774
  messageCount: 0,
2775
+ lastProxiedActivityAt: null,
2772
2776
  authHeader: ""
2773
2777
  };
2774
2778
  if (state.idleTimeout === null && (process.env.GITHUB_ACTIONS || process.env.CI)) {
@@ -2958,9 +2962,14 @@ async function run(options) {
2958
2962
  logActivity(state, { type: "error", error: error2 });
2959
2963
  if (state.interactive) displayStatus(state);
2960
2964
  },
2961
- // Web traffic is proxied transparently; only note opencode is live.
2965
+ // Web traffic is proxied transparently; note opencode is live and stamp
2966
+ // proxied activity so the idle loop treats interactive proxy use as work.
2967
+ // Fires per forwarded response head (incl. every SSE open) and excludes
2968
+ // the internal drain-ping, so an actively-used proxy keeps the timer
2969
+ // fresh while a lone idle SSE with no follow-up requests still ages out.
2962
2970
  onResponse: () => {
2963
2971
  state.opencodeConnected = true;
2972
+ state.lastProxiedActivityAt = Date.now();
2964
2973
  },
2965
2974
  // A channel message was queued and the api-worker pinged us over the
2966
2975
  // tunnel to drain immediately instead of waiting for the next poll tick.