Polyman Documentation - v3.1.0
    Preparing search index...

    Class DefaultPermissionGate

    The PermissionGate of a session.

    Implements

    Index
    sessionRules: Set<string> = ...

    Tool names the user allowed for the whole session.

    waiting: Map<string, (decision: ApprovalDecision) => void> = ...

    Approvals that wait for an answer, by approval id.

    nextId: number = 1
    lastCallId: string = ''

    The id of the last tool_call event on the bus. check() gets no call id, but the session emits tool_call right before it runs the call, and calls run one at a time, so this is the call that waits.

    • Emits approval_needed on the bus when it must ask, then waits.

      Parameters

      • tool: Tool
      • args: unknown
      • signal: AbortSignal

      Returns Promise<CheckResult>

    • Registers a waiting approval, calls announce to emit its event, and waits for resolve() or an abort. Emits approval_resolved either way.

      Parameters

      • signal: AbortSignal
      • announce: (approvalId: string) => void

      Returns Promise<ApprovalDecision>