/**
 * TopicPlacementDescription — the pure resolver behind `GET /pool/placement?topic=N`
 * (Multi-Machine Session Pool observability). Answers the question a session could
 * not previously answer about itself: "which machine is this topic running on, and
 * WHY — was it deliberately pinned there, or just load-placed?"
 *
 * THE GAP THIS CLOSES (2026-06-04): from a standby session there was no way to read
 * the pin/route state (it lives on the lease-holder), so an agent would *infer* its
 * placement and narrate a guess as fact. This makes placement an explicit, queryable
 * answer. Pure over its inputs — the route supplies live state + a nickname resolver.
 */
/**
 * Describe a topic's placement from already-resolved live state. `pinnedTo` is the
 * pin's target machine ONLY when a hard pin is set (the route passes null for an
 * absent/soft pin). `nicknameOf` maps a machineId → its user-facing nickname.
 */
export function describeTopicPlacement(opts) {
    const reason = opts.pinnedTo ? 'pinned' : opts.owner ? 'placed' : 'unowned';
    return {
        topicId: opts.topicId,
        owner: opts.owner,
        ownerNickname: opts.nicknameOf(opts.owner),
        reason,
        pinnedTo: opts.pinnedTo,
        pinnedToNickname: opts.nicknameOf(opts.pinnedTo),
        leaseHolder: opts.leaseHolder,
        leaseHolderNickname: opts.nicknameOf(opts.leaseHolder),
        isThisMachine: opts.owner != null && opts.owner === opts.selfMachineId,
        thisMachine: opts.selfMachineId,
    };
}
//# sourceMappingURL=TopicPlacementDescription.js.map