@linxin666/dsh-remote-bridge 0.4.11 → 0.4.12

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/src/index.ts CHANGED
@@ -59,7 +59,7 @@ import { QuestionClaims } from './core/questions.ts'
59
59
  import { UiCards } from './core/ui.ts'
60
60
  import { WS_PATH } from './core/protocol.ts'
61
61
  import { SessionMeta, type SessionStoreFace, type SessionTitleFace, type WorkspacesFace } from './core/session-meta.ts'
62
- import { sessionQuietProbe, TURN_END_QUIET_MAX_MS, TurnEndQuietGate } from './core/turn-end-quiet.ts'
62
+ import { sessionQuietProbe, TURN_END_QUIET_REPORT_MS, TurnEndQuietGate } from './core/turn-end-quiet.ts'
63
63
  import { SessionPermissions, type ApprovalPolicyFace, type PermissionPresetsFace, type SandboxPolicyFace } from './core/session-permissions.ts'
64
64
  import { selectionOf, modelSelectionOf } from './core/connection.ts'
65
65
  import { UsageService, type CredentialStoreFace, type SessionRosterFace, type SessionRouteFace, type SettingsFace } from './core/usage.ts'
@@ -108,25 +108,29 @@ export function offlineClaimTtl(env: NodeJS.ProcessEnv = process.env): number {
108
108
  return Number.isFinite(configured) && configured > 0 ? configured : OFFLINE_QUESTION_CLAIM_TTL_MS
109
109
  }
110
110
 
111
- /** The environment variable that moves how long a finished turn waits for its session to go quiet (§28). */
111
+ /**
112
+ * The environment variable that moves when a still-waiting turn end is reported (§28).
113
+ *
114
+ * The name is the one deployments already set and is kept as it is; what it moves is
115
+ * the point at which the bridge says it is still waiting, because the wait itself has
116
+ * no cap.
117
+ */
112
118
  export const TURN_END_QUIET_MAX_ENV = 'DSH_REMOTE_BRIDGE_TURN_END_QUIET_MAX_MS'
113
119
 
114
120
  /**
115
- * The quiet-wait budget this process runs with.
121
+ * The still-waiting report point this process runs with.
116
122
  *
117
- * The budget is the bridge's own constant and never a host fact, so a deployment
118
- * moves it here. A value that is missing, unreadable or not positive falls back to
119
- * the constant instead of closing the window: a zero budget would announce every
120
- * turn end at its frame, and an operator who wanted that would be turning push
121
- * off. The budget only bounds the wait — a session that does fall quiet inside it
122
- * is announced then, and one that does not is announced at the end with the
123
- * reason it was still busy.
123
+ * It is the bridge's own constant and never a host fact, so a deployment moves it
124
+ * here. A value that is missing, unreadable or not positive falls back to the
125
+ * constant: the point only decides when the log line saying the wait continues is
126
+ * written, and nothing about it can make the bridge announce work that is still
127
+ * running or withhold a turn end whose family is quiet.
124
128
  * @param env - the process environment, injectable for a suite.
125
- * @returns the budget in milliseconds.
129
+ * @returns the report point in milliseconds.
126
130
  */
127
131
  export function turnEndQuietMaxWait(env: NodeJS.ProcessEnv = process.env): number {
128
132
  const configured = Number(env[TURN_END_QUIET_MAX_ENV])
129
- return Number.isFinite(configured) && configured > 0 ? configured : TURN_END_QUIET_MAX_MS
133
+ return Number.isFinite(configured) && configured > 0 ? configured : TURN_END_QUIET_REPORT_MS
130
134
  }
131
135
 
132
136
  /** This machine's IANA time zone, or undefined when the platform has none. */
@@ -431,15 +435,17 @@ function applyImpl(ctx: Context): void {
431
435
  },
432
436
  })
433
437
  // The quiet gate both channels announce a finished turn through: §28's
434
- // notification and §29's card end wait for the host's own answer that nothing is
435
- // left running under that session — its own agent, any descendant, and any job
436
- // the host attributes to either. Inert while no key is configured, because both
437
- // channels are then off and no timer is worth arming.
438
+ // notification and §29's card end wait for the host's own answer that the session's
439
+ // whole family is quiet — the root its parent chain climbs to, every session under
440
+ // that root at any depth, and any job the host attributes to one of them. A family
441
+ // that stays busy is never announced, and a subagent session's own turn end is
442
+ // dropped unless the phone prompted it. Inert while no key is configured, because
443
+ // both channels are then off and no timer is worth arming.
438
444
  const turnEndQuiet = new TurnEndQuietGate({
439
445
  push,
440
446
  liveActivity,
441
447
  probe: sessionQuietProbe({ gateway: ctx.typertGateway, peer: ownerPeer, jobs }),
442
- maxWaitMs: turnEndQuietMaxWait(),
448
+ reportAfterMs: turnEndQuietMaxWait(),
443
449
  log,
444
450
  })
445
451
  // The bridge's own follow streams (§28/§29): a suspended phone has no socket,