@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/README.i18n.yaml +2 -2
- package/README.md +2 -2
- package/README.zh.md +2 -2
- package/lib/client.js.map +1 -1
- package/lib/index.js +244 -80
- package/lib/types/core/protocol.d.ts +1 -1
- package/lib/types/core/turn-end-quiet.d.ts +104 -40
- package/lib/types/index.d.ts +14 -10
- package/package.json +1 -1
- package/src/core/connection.ts +38 -2
- package/src/core/protocol.ts +1 -1
- package/src/core/turn-end-quiet.ts +281 -98
- package/src/index.ts +23 -17
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,
|
|
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
|
-
/**
|
|
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
|
|
121
|
+
* The still-waiting report point this process runs with.
|
|
116
122
|
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
* the
|
|
120
|
-
*
|
|
121
|
-
*
|
|
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
|
|
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 :
|
|
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
|
|
435
|
-
//
|
|
436
|
-
// the host attributes to
|
|
437
|
-
//
|
|
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
|
-
|
|
448
|
+
reportAfterMs: turnEndQuietMaxWait(),
|
|
443
449
|
log,
|
|
444
450
|
})
|
|
445
451
|
// The bridge's own follow streams (§28/§29): a suspended phone has no socket,
|