# Human

> Humans: ask a person, get an approval, send a notice, request a connection.

## noclick.Human

```python
class Human
```

A person to reach. `user.human` (or `noclick.Human()`, meaning the
user current at each call, or the one a session or user-pinned key acts
for) is the user; `noclick.Human.owner()` is your account's owner;
`noclick.Human(email=...)` is anyone else.
Every method returns an `Operation`: `.wait()` for the outcome.
In an agent's `tools=`, a person gives the agent tools that notify them,
ask them, or hand them the conversation (`only`).

`via` says where a message goes: `"auto"` (the default), or a list of
`"web"` (only the page: you pass `request.url` on), `"email"`, and for the
owner `"whatsapp"` and `"imessage"`, sent from NoClick's own numbers to the
number they text NoClick from. `"auto"` is the app the owner last texted
NoClick on, else email. `"sms"` and `"call"` raise `noclick.NotAvailable`
for now. What couldn't be sent is listed in `undelivered`, never implied.

Usage:

Reach the person behind a user, or anyone by email:

```python
user = noclick.User.from_id("user_42")
user.human.notify("Your export is ready. It's in your dashboard.")
noclick.Human(email="finance@acme.com").approve("Refund $95.00 to Ana Lima?")
```

`noclick.Human()` is the user you're acting for, and the only way to
reach a person from a session or a key pinned to a user:

```python
with noclick.as_user(noclick.User.from_id("user_42")):
    noclick.Human().ask("Which time works for your cleaning?", options=["Thu 10:30", "Fri 14:00"])
```

### noclick.Human

```python
noclick.Human(*, email=None, phone=None, user=..., client=None)
```

Parameters:

- `email` (`str | None`, default `None`)
- `phone` (`str | None`, default `None`)
- `user` (`Any`, default: the current user): Who the call acts for. Defaults to the user set by `noclick.as_user` (none: the account itself).
- `client` (`Client | None`, default `None`): The client to send with; defaults to the module client built from `NOCLICK_API_KEY`.

### Human.owner

```python
noclick.Human.owner(*, client=None) -> Human
```

Your account's owner: the person behind the account, reached by email and on
the app they text NoClick from. Only your account reaches them: it always acts as
your account, inside `as_user` too, and a user's session or a key pinned to a user
raises `noclick.PermissionDenied`.

Parameters:

- `client` (`Client | None`, default `None`): The client to send with; defaults to the module client built from `NOCLICK_API_KEY`.

Returns: `Human` The owner, to message, ask, put in an agent's `tools=` or `answer_with`.

Usage:

Tell the owner something on the app they text NoClick on:

```python
noclick.Human.owner().notify("The site is live: https://morrowbakery.com")
```

Or give an agent a way to reach them:

```python
assistant = noclick.Agent.from_name(
    "assistant", create_if_missing=True, instructions="You run the bakery's errands.",
    tools=["search", noclick.Human.owner()],
)
```

### Human.answer_with

```python
human.answer_with(agent, *, conversation=None) -> Human
```

Send what this person texts or says to NoClick's own numbers (its WhatsApp and
iMessage numbers and its voice number) to `agent` (an `noclick.Agent` or id of your
account's). A text's reply goes back on the app they texted on once the agent's turn
ends, and texts sent while it's busy go in its next turn, in order; on a call, each thing
they say is a turn whose reply is read aloud as it's written. `None` hands them back to
NoClick's assistant. Only `Human.owner()` reaches NoClick's numbers: your users reach an
agent on a number of your own (`PhoneNumber.answer_with`).

`conversation` is the agent's conversation each text or call lands in, a template over
`{channel}` (`whatsapp`, `imessage` or `call`); omitted, `"owner"`. Give an inbox
and a number the same key and the person's email, calls and texts are one conversation.

Parameters:

- `agent` (`Any`, required)
- `conversation` (`str | None`, default `None`)

Returns: `Human` This person.

Usage:

Make an agent the owner's assistant on every channel:

```python
owner = noclick.Human.owner()
assistant = noclick.Agent.from_name("assistant")
owner.answer_with(assistant)
noclick.Inbox.from_name("assistant", create_if_missing=True, agent=assistant, senders="owner",
                        conversation="owner")
assistant.message("What's on today?", conversation="owner")   # the same thread
```

### Human.answering

```python
human.answering() -> Any | None
```

The agent this person's texts to NoClick's own numbers go to (`answer_with`), or
`None` when NoClick's assistant answers them.

Returns: `Any | None` The `noclick.Agent`, or `None`.

Usage:

```python
agent = noclick.Human.owner().answering()
print(agent.name if agent else "NoClick's assistant")
```

### Human.reach

```python
human.reach() -> OwnerReach
```

NoClick's own numbers the owner texts it on, whether a phone of theirs is linked
(never which), and the address they email their assistant at (`email`, `None`
before it has one). Show a number only once a phone is linked: a text from a phone the
account hasn't linked starts an account of its own, and linking one is the owner's,
signed in to NoClick. Your account's own key reads it, never a user's.

Returns: `OwnerReach` The `noclick.OwnerReach`.

Usage:

```python
reach = noclick.Human.owner().reach()
if reach.phone_linked:
    for line in reach.lines:
        print(f"{line.app}: {line.number}")
```

### Human.set_timezone

```python
human.set_timezone(timezone) -> None
```

Where the signed-in owner is, from their browser (an IANA zone such as `"Europe/London"`):
the clock of the account's assistant, and of each of its own agents NoClick placed, moves
there; a zone chosen through the API stays. The signed-in owner's alone: a key raises
`noclick.PermissionDenied`.

Parameters:

- `timezone` (`str`, required)

Usage:

```python
noclick.Human.owner().set_timezone("Europe/London")
```

### Human.claim_email_address

```python
human.claim_email_address() -> OwnerEmailAddress | None
```

The address the owner emails their assistant at (`reach().email`), claiming a
readable one, from their own address, the first time it's wanted; `None` where NoClick
takes no mail. The signed-in owner's alone: a key raises `noclick.PermissionDenied`.

Returns: `OwnerEmailAddress | None` The `noclick.OwnerEmailAddress`, or `None`.

Usage:

```python
mail = noclick.Human.owner().claim_email_address()
print(f"Email your assistant at {mail.address}" if mail else "No email here")
```

### Human.rename_email_address

```python
human.rename_email_address(name) -> OwnerEmailAddress
```

Renames the address the owner emails their assistant at to `name` (the part before
the @) on its domain, keeping whether its mail is taken; claimed at that name where it had
none. Mail to the old address no longer reaches the assistant. Raises
`noclick.Conflict` when the name is someone else's and `noclick.InvalidRequest` for a
name no address takes. The signed-in owner's alone.

Parameters:

- `name` (`str`, required)

Returns: `OwnerEmailAddress` The `noclick.OwnerEmailAddress` at its new name.

Usage:

```python
mail = noclick.Human.owner().rename_email_address("bakery-desk")
print(mail.address)  # bakery-desk@noclick.email
```

### Human.add_email

```python
human.add_email(email) -> None
```

Send a code to `email` for the owner of an account made by texting NoClick (which
has none); `confirm_email` with the code makes it theirs. Raises
`noclick.Conflict` when the account already has an email, `noclick.RateLimited`
after too many codes.

Parameters:

- `email` (`str`, required)

Usage:

```python
owner = noclick.Human.owner()
owner.add_email("maya@morrowbakery.com")
owner.confirm_email(input("The code in that email: "))
```

### Human.confirm_email

```python
human.confirm_email(code) -> OwnerEmail
```

The code `add_email` sent: on a match the email is the owner's to sign in with,
or, when an account already has it, that account takes this one in (`merged`).
Whether an account has the email is said only once the code matches.

Parameters:

- `code` (`str`, required)

Returns: `OwnerEmail` The confirmed email.

Usage:

```python
confirmed = noclick.Human.owner().confirm_email("482913")
print(confirmed.email, "merged" if confirmed.merged else "added")
```

### Human.only

```python
human.only(*tools) -> HumanOperations
```

Some of the tools this person gives an agent, for `tools=`. In an agent's tools
a `Human` gives it three, each addressed only to this person: `notify` (a
message), `ask` (a question, with `options` if it has some, or a `pick` from one of
their connected accounts: the turn waits,
`awaiting_human`, and the answer arrives as the conversation's next turn) and
`hand_off` (the conversation goes to this person: a page and an email with the
transcript, the agent's summary and a reply box; their replies post as `person`
messages, the agent stays quiet until `agent.hand_back(conversation)`, and on a
call it's transferred to the person's `phone`). Policy names them
`human.notify`, `human.ask` and `human.hand_off`.

`noclick.Human()` there is the user each turn acts for; `user.human` is that user;
`noclick.Human.owner()` is your account's owner and `noclick.Human(email=..., phone=...)`
anyone else, neither of which a user's own agent may name.

Parameters:

- `tools` (`str`)

Returns: `HumanOperations` A ref to just those tools of this person, to list in `tools=`.

Usage:

Let a support agent ask a manager before a big refund, but never hand them the chat:

```python
manager = noclick.Human(email="ops@acme.com", phone="+14155550123")
support = noclick.Agent.from_name(
    "support", create_if_missing=True,
    instructions="You answer billing questions. Ask the manager before refunding over $200.",
    tools=["stripe.create_refund", manager.only("notify", "ask")],
)
```

Or let it hand an upset customer to a person, who replies from their page:

```python
person = noclick.Human(email="support-lead@acme.com")
support = noclick.Agent.from_name(
    "support", create_if_missing=True,
    instructions="Hand the conversation to a person when the customer asks for one.",
    tools=["search", person.only("hand_off")],
)
```

### Human.ask

```python
human.ask(
    message, *, options=None, pick=None, multiple=False, connect=None, secret=None,
    via='auto', expires_in=None
) -> HumanRequest
```

Ask a question; `.wait()` returns an `Answer`.

`pick` asks, in place of `options`, for something in a connected account:
`{"connection": ..., "field": ..., "arguments": ...}`, the connection (a `Connection`,
or its id or name) and the field its lookup lists (`connection.lookup` names them:
`repository`, `team_id`, `channel`), with the values that field depends on. NoClick
reads the choices from the account, the person picks from it, and an account that holds
just one answers at once with it, asking nobody. `multiple` lets them choose several of
the options, or of a pick's choices.

`connect` asks the owner which of the account's connections a workflow step uses:
`{"integration": "slack", "step": {"workflow": wf, "step_id": "post"}}` (or
`credential_type` in place of `integration`; `step["slot"]` narrows it to one kind).
Their page lists the connections that fit and connects another with the provider's own
sign-in; NoClick sets the one they choose on the step as them, never as you, and an account
holding just one that fits answers at once with it. Needs the `workflows` scope.

`secret` asks for a secret's values: `{"name": "warehouse", "keys": ["WAREHOUSE_TOKEN"]}`,
typed on NoClick's page (its link carries a key, so the request's id alone opens nothing),
kept as the account's secret `name` (made, or those keys replaced) and never shown to you
or a model; with `"step": {"workflow": wf, "step_id": "agent"}` (the owner's only), the
agent step's shell gets it too. Needs the `secrets` scope. Your code can answer either
with `HumanRequest.answer`.

Parameters:

- `message` (`str`, required)
- `options` (`Sequence[str] | None`, default `None`)
- `pick` (`Mapping[str, Any] | None`, default `None`)
- `multiple` (`bool`, default `False`)
- `connect` (`Mapping[str, Any] | None`, default `None`)
- `secret` (`Mapping[str, Any] | None`, default `None`)
- `via` (`str | Sequence[str]`, default `'auto'`)
- `expires_in` (`int | float | timedelta | None`, default `None`)

Returns: `HumanRequest` The request, already sent. `wait()` blocks until the person answers
and gives what they picked (`choice`, a pick's `value` beside it; each of
several in `choices` and `values`) and wrote (`text`).

Usage:

Offer choices, then wait for the pick:

```python
human = noclick.User.from_id("user_42").human
request = human.ask(
    "Which time works for your cleaning?", options=["Thu 10:30", "Fri 14:00", "Neither"],
)
answer = request.wait()
print(answer.choice or answer.text)
```

Ask which repositories, from the person's own GitHub:

```python
answer = noclick.Human.owner().ask(
    "Which repositories should the reviewer watch?",
    pick={"connection": "github", "field": "repository"}, multiple=True,
).wait()
print(answer.values)   # ['acme/site', 'acme/api']
```

With `via=["web"]` nothing is sent: pass the answer page on
yourself. `expires_in` is in seconds (or a `timedelta`):

```python
human = noclick.User.from_id("user_42").human
request = human.ask("What should we call your workspace?", via=["web"], expires_in=3600)
print(request.url)
```

Ask the owner which Slack a step posts with, and for the token an agent step needs:

```python
wf = noclick.Workflow.from_id("wf_123")
owner = noclick.Human.owner()
slack = owner.ask("Which Slack should the Post step use?",
                  connect={"integration": "slack", "step": {"workflow": wf, "step_id": "post"}})
token = owner.ask("The warehouse API token, please.",
                  secret={"name": "warehouse", "keys": ["WAREHOUSE_TOKEN"],
                          "step": {"workflow": wf, "step_id": "agent"}})
print(slack.wait().connection, token.wait().secret)
```

### Human.approve

```python
human.approve(message, *, details=None, via='auto', expires_in=None) -> HumanRequest
```

Ask for a yes/no; `.wait()` returns `True` when approved.

Parameters:

- `message` (`str`, required)
- `details` (`Any`, default `None`)
- `via` (`str | Sequence[str]`, default `'auto'`)
- `expires_in` (`int | float | timedelta | None`, default `None`)

Returns: `HumanRequest` The request, already sent. `wait()` gives `True` if they approve
and `False` if they decline.

Usage:

Put what the person needs to decide in `details`; it's shown on the page:

```python
finance = noclick.Human(email="finance@acme.com")
approved = finance.approve(
    "Refund $95.00 to Ana Lima?",
    details={"invoice": "INV-1042", "reason": "Charged for a cancelled visit"},
).wait()
if approved:
    issue_refund()
```

In a web server, save the request's id and pick the answer up later:

```python
request = noclick.User.from_id("user_42").human.approve("Publish the new pricing page?")
save(request.id)
approved = noclick.Operation.from_id(saved_id).wait()   # later, from anywhere
```

### Human.notify

```python
human.notify(message, *, via='auto') -> HumanRequest
```

Send a notice (the operation succeeds once it's sent).

Parameters:

- `message` (`str`, required)
- `via` (`str | Sequence[str]`, default `'auto'`)

Returns: `HumanRequest` The request, already sent and its operation already succeeded, so
`wait()` returns `None` at once. `undelivered` names any channel that failed.

Usage:

```python
human = noclick.User.from_id("user_42").human
human.notify("Your export is ready. It's in your dashboard.")
```

### Human.connect

```python
human.connect(connection, *, reason=None, redirect_url=None) -> ConnectLink
```

Ask this person to connect `connection` (a `Connection` or its
name, this person's own); `.wait()` returns the connected
`Connection`.

Parameters:

- `connection` (`Any`, required)
- `reason` (`str | None`, default `None`)
- `redirect_url` (`str | None`, default `None`)

Returns: `ConnectLink` The link, already emailed: its `url` and when it `expires_at`.
`wait()` gives the connected `Connection`.

Usage:

Email the user a link to connect their calendar, and wait until they have:

```python
user = noclick.User.from_id("user_42")
calendar = noclick.Connection.from_name(
    "calendar", integration="google_calendar", create_if_missing=True, user=user,
)
calendar = user.human.connect(calendar, reason="to book your appointments").wait()
```

A connection the user already has can be named instead:

```python
user = noclick.User.from_id("user_42")
user.human.connect("calendar", redirect_url="https://app.example.com/settings")
```

## noclick.HumanRequest

```python
class HumanRequest(Operation)
```

A request to a person; also the operation that finishes when they answer.

| Attribute | Type | Description |
| --- | --- | --- |
| `request_id` | `str | None` | The request's own id (the operation's is `id`). |
| `request_status` | `str | None` | `pending`, `answered`, `delivered`, `expired` or `canceled`. |
| `request` | `dict[str, Any]` | The request as created: `url`, `delivered_via`, `undelivered`, ... |
| `url` | `str | None` | The page where the person answers (`/h/{id}`); embed or send it yourself. |
| `delivered_via` | `list[str]` |  |
| `undelivered` | `list[dict[str, Any]]` | Channels that failed, each with a `reason`. |
| `file` | `HumanFileAsk | None` | A file question's file where the agent works (`None` for any other request). |
| `note` | `str | None` | What the approver wrote with their answer (`None` until answered, or if they wrote nothing). |

### HumanRequest.list

```python
noclick.HumanRequest.list(
    *, status=None, status_not=None, kind=None, answerable=None, limit=None,
    user_filter=None, user=..., client=None
) -> list[HumanRequest]
```

Requests your code and agents sent, newest first (or the first `limit`).
`answerable="owner"`: only those the signed-in account owner may answer;
`answerable="code"`: only those your code may answer with `approve` or
`decline`. A call NoClick holds for the account's owner (a purchase or a
deletion, whose `request["owner_only"]` is true) is listed only for a key that
names the `approvals:answer` scope, and never one made with that key or one
whose terms a person accepts (see `noclick.Approval`).

Parameters:

- `status` (`Many`, default `None`)
- `status_not` (`Many`, default `None`)
- `kind` (`Many`, default `None`)
- `answerable` (`str | None`, default `None`)
- `limit` (`int | None`, default `None`): Return at most this many.
- `user_filter` (`Any`, default `None`): Which users a read covers: `noclick.ALL_USERS`, `noclick.NO_USER`, a `User`, or your id for one. It filters without acting as that user.
- `user` (`Any`, default: the current user): Who the call acts for. Defaults to the user set by `noclick.as_user` (none: the account itself).
- `client` (`Client | None`, default `None`): The client to send with; defaults to the module client built from `NOCLICK_API_KEY`.

Returns: `list[HumanRequest]` Every matching request, fetched page by page. Each is also the
operation you can `wait()` on; `request_status` is the request's own status.

Usage:

```python
for request in noclick.HumanRequest.list(status="pending", kind="approve"):
    print(request.request["message"], request.url)

waiting_on_you = noclick.HumanRequest.list(answerable="owner")
yours_to_answer = noclick.HumanRequest.list(status="pending", kind="approve", answerable="code")
```

### HumanRequest.list_page

```python
noclick.HumanRequest.list_page(
    *, cursor=None, limit=None, status=None, status_not=None, kind=None,
    answerable=None, user_filter=None, user=..., client=None
) -> Page
```

One page of requests; pass `next_cursor` back as `cursor`.

Parameters:

- `cursor` (`str | None`, default `None`): The `next_cursor` of the page before; omit it for the first page.
- `limit` (`int | None`, default `None`): Return at most this many.
- `status` (`Many`, default `None`)
- `status_not` (`Many`, default `None`)
- `kind` (`Many`, default `None`)
- `answerable` (`str | None`, default `None`)
- `user_filter` (`Any`, default `None`): Which users a read covers: `noclick.ALL_USERS`, `noclick.NO_USER`, a `User`, or your id for one. It filters without acting as that user.
- `user` (`Any`, default: the current user): Who the call acts for. Defaults to the user set by `noclick.as_user` (none: the account itself).
- `client` (`Client | None`, default `None`): The client to send with; defaults to the module client built from `NOCLICK_API_KEY`.

Returns: `Page` A page whose `data` holds the requests and whose `next_cursor` is `None` on the last page.

Usage:

```python
page = noclick.HumanRequest.list_page(status="pending", limit=50)
while True:
    for request in page.data:
        print(request.request_status, request.url)
    if page.next_cursor is None:
        break
    page = noclick.HumanRequest.list_page(status="pending", limit=50, cursor=page.next_cursor)
```

### HumanRequest.retrieve

```python
noclick.HumanRequest.retrieve(request_id, *, user=..., client=None) -> HumanRequest
```

One request by its own id (a `request_id`, the `/h/{id}` page's): what it asks, how it stands
(`request_status`) and, once answered, the answer. A user reads only their own; any other raises
`noclick.NotFound`. Answer it with `answer`, `approve` or `decline`.

Parameters:

- `request_id` (`str`, required)
- `user` (`Any`, default: the current user): Who the call acts for. Defaults to the user set by `noclick.as_user` (none: the account itself).
- `client` (`Client | None`, default `None`): The client to send with; defaults to the module client built from `NOCLICK_API_KEY`.

Returns: `HumanRequest` The request.

Usage:

```python
request = noclick.HumanRequest.retrieve("hr_3f2a1c9e")
if request.request_status == "pending":
    request.approve(note="Go ahead")
```

### HumanRequest.summary

```python
noclick.HumanRequest.summary(**filters) -> OperationSummary
```

How many human-request operations (ask, approve, notify) match, by operation
status; takes `Operation.summary`'s filters except `kind`.

Parameters:

- `filters` (`Any`)

Returns: `OperationSummary` The number that match in `total`, and per operation status in `by_status`.

Usage:

```python
counts = noclick.HumanRequest.summary(status="live")
print(counts.total, counts.by_status)
```

### HumanRequest.answer

```python
request.answer(
    *, choice=None, choices=None, text=None, connection=None, secret_values=None,
    file_content=None
) -> HumanRequest
```

Answer a question from your own code, as the person it waits on (who may: as `approve`
says). A question takes a `choice` (or `choices` for one asked with `multiple`) and/or
`text`; a `connect` question, a `connection` (a `Connection`, or its ref or name: one of
the account's that fits), which NoClick sets on the step as your key, so it needs the
`workflows` scope and a key acting for your whole account, never a user's or an agent's own
tools; a `secret` question, `secret_values` (a value for each of its keys), kept in the
secret and never with the answer, which needs the `secrets` scope. A `file` question is the
account's owner's alone, signed in: `secret_values` for its keys, else `file_content` (the
whole file as text, up to 1 MB), written into the asking agent's sandbox or machine while it runs
and never kept with the answer.

Parameters:

- `choice` (`str | None`, default `None`)
- `choices` (`Sequence[str] | None`, default `None`)
- `text` (`str | None`, default `None`)
- `connection` (`Any`, default `None`)
- `secret_values` (`Mapping[str, str] | None`, default `None`)
- `file_content` (`str | None`, default `None`)

Returns: `HumanRequest` This request, answered: `request_status` is `answered`.

Usage:

```python
for request in noclick.HumanRequest.list(status="pending", kind="ask", answerable="code"):
    if request.request.get("connect"):
        request.answer(connection="work-slack")
```

### HumanRequest.approve

```python
request.approve(*, note=None) -> HumanRequest
```

Approve it from your own code, as the person it waits on: with a key acting for your
account, an approval routed to your account (a held call on one of its connections, say);
with a user's session or inside `as_user`, one addressed to that user. A held operation call
then runs exactly as it was held (a held shell command or other tool, the agent makes again
itself), and the agent gets a turn in the same conversation with its result, its reply going
out wherever the conversation lives (the chat, the call, or on an email thread the same
thread: an inbox agent's `reply` tool is bound to the thread's latest message, not to the
message that woke a turn). A call NoClick holds for the account's owner is answered only
with a key that names the `approvals:answer` scope, as `noclick.Approval.approve` answers
it. Anyone else gets `noclick.PermissionDenied`.

Parameters:

- `note` (`str | None`, default `None`)

Returns: `HumanRequest` This request, answered: `request_status` is `answered` and `note` is yours.

Usage:

```python
for request in noclick.HumanRequest.list(status="pending", kind="approve", answerable="code"):
    if request.request["details"].get("amount_usd", 0) < 50:
        request.approve(note="Under $50: fine.")
```

### HumanRequest.decline

```python
request.decline(*, note=None) -> HumanRequest
```

Decline it from your own code, as `approve` answers it. A held call never runs; the agent
gets a turn saying it was declined, with your `note`, so it can tell the person it was
acting for why.

Parameters:

- `note` (`str | None`, default `None`)

Returns: `HumanRequest` This request, answered: `request_status` is `answered` and `note` is yours.

Usage:

```python
[request] = noclick.HumanRequest.list(status="pending", kind="approve", answerable="code", limit=1)
request.decline(note="Refunds over $500 go through finance; ask the customer for the invoice.")
```

## noclick.HumanOperations

```python
class HumanOperations
```

Some of a person's tools for an agent (`human.only(...)`), for `tools=`.

| Attribute | Type | Description |
| --- | --- | --- |
| `human` | `Human` |  |
| `tools` | `list[str]` |  |

## noclick.Answer

```python
class Answer
```

What the person chose (`choice`) and/or wrote (`text`). A `pick`'s answer names the
choice in the account too (`value`: a repository's `owner/name`, a channel's id); a question
asked with `multiple` names each one they chose (`choices`, and a pick's `values`). A
`connect` question's names the connection set on the step (`connection`, its ref, also its
`value`; `choice` its name), a `secret` question's the secret its values went into
(`secret`), never the values.

| Attribute | Type | Description |
| --- | --- | --- |
| `choice` | `str | None` |  |
| `text` | `str | None` |  |
| `raw` | `Any` | The response JSON exactly as the API sent it. |
| `value` | `str | None` |  |
| `choices` | `list[str]` |  |
| `values` | `list[str]` |  |
| `connection` | `str | None` |  |
| `secret` | `str | None` |  |

## noclick.HumanFileAsk

```python
class HumanFileAsk
```

A file in the asking agent's sandbox or machine its owner fills in (`HumanRequest.file`): a local `.env`,
a key file. Only an agent's own `ask` tool asks one, and only the account's owner answers it: with `keys`, a
value for each (set in the file as `KEY=value` lines, the rest of it kept); without (`keys` `None`), the
whole file. NoClick writes it at `path` there as a file holding secrets, never keeping it anywhere else.

| Attribute | Type | Description |
| --- | --- | --- |
| `path` | `str` |  |
| `keys` | `list[str] | None` |  |
| `agent_id` | `str` |  |
| `agent_name` | `str | None` |  |

## noclick.OwnerEmail

```python
class OwnerEmail
```

An email confirmed for the owner: `status` is `added`, or `verified` when an
agent's turn confirmed it (it's added once that turn ends); `merged` when an account
that already had the email takes this one in.

| Attribute | Type | Description |
| --- | --- | --- |
| `email` | `str` |  |
| `status` | `str` |  |
| `merged` | `bool` |  |

## noclick.OwnerLine

```python
class OwnerLine
```

One of NoClick's own numbers the owner texts it on (`Human.reach`): `app` is
`whatsapp` or `imessage`.

| Attribute | Type | Description |
| --- | --- | --- |
| `app` | `str` |  |
| `number` | `str` |  |

## noclick.OwnerReach

```python
class OwnerReach
```

Where the owner texts NoClick (`Human.reach`): NoClick's own numbers, one for each app
it answers on, whether a phone of the owner's is linked to the account (which one is never
said), and the address they email their assistant at (`None` before it has one).

| Attribute | Type | Description |
| --- | --- | --- |
| `lines` | `list[OwnerLine]` |  |
| `phone_linked` | `bool` |  |
| `email` | `OwnerEmailAddress | None` |  |

## noclick.HumanRequestLink

```python
class HumanRequestLink
```

A human request's page (`/h/{id}`), as the person its link reached reads and answers it. The id is the
capability; the link NoClick sends its person carries a key beside it (`?k=`), which a request asked of the
account's owner, one only its person answers and a held call's approval need: pass it as `key`. Who may answer
is NoClick's to judge, as on its own page: a request the link can't open raises `noclick.NotFound`, and an
answer it doesn't take raises with its reason.

Usage:

```python
link = noclick.HumanRequestLink(request_id, key=key_from_the_link)
if link.read().kind == "approve":
    link.answer({"decision": "approve"})
```

| Attribute | Type | Description |
| --- | --- | --- |
| `id` | `str` |  |
| `key` | `str | None` |  |

### noclick.HumanRequestLink

```python
noclick.HumanRequestLink(
    request_id, *, key=None, base_url=None, timeout=60.0, max_retries=3
)
```

Parameters:

- `request_id` (`str`, required)
- `key` (`str | None`, default `None`)
- `base_url` (`str | None`, default `None`)
- `timeout` (`float`, default `60.0`)
- `max_retries` (`int`, default `3`)

### HumanRequestLink.read

```python
human_request_link.read() -> HumanRequestPage
```

The request as its page shows it.

Returns: `HumanRequestPage` The `HumanRequestPage`.

Usage:

```python
page = noclick.HumanRequestLink(request_id, key=key).read()
print(page.kind, page.message)
```

### HumanRequestLink.answer

```python
human_request_link.answer(body) -> dict[str, Any]
```

Answer it, once: a question's `choice` (or `choices`) and `text`, an approval's `decision`
(`approve` or `deny`); a held call's `approved`, `note` and each of its terms accepted; a step
question's `connection` or `values`. Raises with the reason an answer isn't taken (already answered,
expired, not this link's to give).

Parameters:

- `body` (`dict[str, Any]`, required)

Returns: `dict[str, Any]` The request as it stands once answered.

Usage:

```python
noclick.HumanRequestLink(request_id, key=key).answer({"choice": "Yes"})
```

### HumanRequestLink.connect

```python
human_request_link.connect(*, credential_type=None) -> str
```

A connect question's other account: the provider's sign-in link, which comes back to the request's page and
whose account answers the question. `credential_type`: which of its ways to sign in.

Parameters:

- `credential_type` (`str | None`, default `None`)

Returns: `str` The sign-in link to open.

Usage:

```python
url = noclick.HumanRequestLink(request_id, key=key).connect()
```

### HumanRequestLink.reply

```python
human_request_link.reply(text) -> dict[str, Any]
```

Reply in the conversation an agent handed this link's person.

Parameters:

- `text` (`str`, required)

Returns: `dict[str, Any]` The request as it stands.

Usage:

```python
noclick.HumanRequestLink(request_id, key=key).reply("I'll take it from here.")
```

### HumanRequestLink.hand_back

```python
human_request_link.hand_back() -> dict[str, Any]
```

Give the handed-over conversation back to the agent, which answers from the next message.

Returns: `dict[str, Any]` The request as it stands.

Usage:

```python
noclick.HumanRequestLink(request_id, key=key).hand_back()
```

## noclick.HumanRequestPage

```python
class HumanRequestPage
```

A human request as its page shows it (`HumanRequestLink.read`): its `kind` (`ask`, `approve`,
`notify`, `hand_off`, `setup`, ...), its `status` (`pending` until it's answered), its message, when it
expires, and in `raw` everything the page shows (its options, its brand, a held call's approval, a step
question, a hand-off).

| Attribute | Type | Description |
| --- | --- | --- |
| `id` | `str` |  |
| `kind` | `str` |  |
| `status` | `str` |  |
| `message` | `str | None` |  |
| `expires_at` | `datetime | None` |  |
| `raw` | `dict[str, Any]` | The response JSON exactly as the API sent it. |

## noclick.OwnerEmailAddress

```python
class OwnerEmailAddress
```

The address the owner emails their assistant at (`OwnerReach.email`): `paused` when
the owner turned its mail off (the address stays theirs), `from_anyone` when anyone's mail
reaches the assistant, not only the owner's.

| Attribute | Type | Description |
| --- | --- | --- |
| `address` | `str` |  |
| `paused` | `bool` |  |
| `from_anyone` | `bool` |  |
