INNER CODE UNIT · TypeScript
ownerRule
agentconnect-md/agentconnect · packages/activation-policy/src/index.ts:201
const ownerRule = scopeCandidates.find((x) => x.agentId === owner)
if (ownerRule) return pickRule(ownerRule, 'thread') // continuity, kind-agnostic
}
}
// 3. CP per-sessionKey override (§8.3: CP authoritative).
// A rule scoped to the channel this message sits in (its enclosing channel counts —
// same predicate as the scope filter), NOT an unscoped global CP rule.
const cpInChannel = kindCandidates.some(
(r) =>
r.source === 'cp' &&
r.scope.channel !== undefined &&
channelInScope(r.scope.channel, msg) &&
(r.scope.thread === undefined || r.scope.thread === msg.thread)
)
const layer = cpInChannel ? kindCandidates.filter((r) => r.source === 'cp') : kindCandidates
// 4/5. kind precedence within the chosen layer (mention already handled).