mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-10 11:40:45 +08:00
fix: support legacy and current DSH hosts
This commit is contained in:
parent
72ffd7115c
commit
6b9118fe95
20 changed files with 1279 additions and 259 deletions
|
|
@ -389,6 +389,24 @@ function consumeInteractionOwnership(ownership, entries) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Decide whether the current Host has a live dsh-im interaction watcher for
|
||||
* this Session. The modern Harness adapter uses the same ownership registry
|
||||
* as HarnessClient so it never steals a browser-owned question or approval.
|
||||
*/
|
||||
export function hasActiveHarnessInteractionOwner(scope, sessionId, entries = []) {
|
||||
if (!scope || !['object', 'function', 'string'].includes(typeof scope)
|
||||
|| typeof sessionId !== 'string' || !sessionId) return false;
|
||||
const owners = interactionRegistry(scope).ownerships.get(sessionId);
|
||||
if (!owners || owners.size === 0) return false;
|
||||
for (const ownership of owners) consumeInteractionOwnership(ownership, entries);
|
||||
return [...owners].some((ownership) => (
|
||||
ownership.active
|
||||
&& !ownership.completed
|
||||
&& typeof ownership.reconnect === 'function'
|
||||
));
|
||||
}
|
||||
|
||||
export class HarnessReplyTracker {
|
||||
#promptRpcId;
|
||||
#lastSeq;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue