Developers
Ask a person a question from your code, your terminal or your agent, and get a sealed answer back that only your service can open.
The courier API at https://yeaply.com/api/v1 is live. The SDK packages are not published yet, so every npm, pip and npx command below is marked coming soon. The phone app is coming soon to the App Store and Google Play.
JavaScript
npm install @yeaply/sdkYeaply.connect pairs on the first run (it shows a pairing code to type in the app) and reuses the saved keys after that. ask waits for the answer.
import { Yeaply } from "@yeaply/sdk";
const y = await Yeaply.connect({ name: "Deploy bot" });
const answer = await y.ask({
title: "Deploy v2.3 to production?",
body: "12 commits since v2.2.",
facts: { Branch: "main" },
options: ["Deploy", { id: "hold", label: "Hold", style: "danger" }],
});
if (answer.optionId === "deploy") {
// deploy
}To keep working while the question waits, use y.send(...); it returns a handle whose h.answer() waits for the answer and whose h.withdraw() takes the question back. y.onAnswer(callback) runs your callback for each answer as it comes in.
// Send now, collect the answer later
const h = await y.send({ title: "Rotate the API keys tonight?", options: ["Rotate", "Skip"] });
const answer = await h.answer(); // wait for the answer
// ...or, if the question no longer matters:
await h.withdraw();
// Or handle answers as they arrive
y.onAnswer((answer) => {
console.log(answer.optionId);
});Python
pip install yeaplyimport yeaply
y = yeaply.connect("Deploy bot")
answer = y.ask("Deploy v2.3?", options=["Deploy", "Hold"], timeout="1h")
print(answer.label)With asyncio, use await yeaply.aio.connect(...):
import asyncio
import yeaply
async def main():
y = await yeaply.aio.connect("Deploy bot")
answer = await y.ask("Deploy v2.3?", options=["Deploy", "Hold"], timeout="1h")
print(answer.label)
asyncio.run(main())Command line
Pair once, then ask from any script. The exit code says what was answered, so && runs the next command only on the first option.
npx yeaply pair --name "My laptop"
npx yeaply ask "Deploy to production?" --options yes,no --timeout 1h && ./deploy.sh| Exit code | Meaning |
|---|---|
| 0 | The first option was chosen (yes, in the example). |
| 1 | Any other option was chosen. |
| 2 | Nobody answered in time. |
| 3 | An error. |
Agents (MCP)
@yeaply/mcp gives an agent an ask_human tool. The first tool call gives a pairing code; type it in the Yeaply app, compare the fingerprint and tap Connect.
claude mcp add yeaply -e YEAPLY_NAME="Claude Code" -- npx -y @yeaply/mcp{
"mcpServers": {
"yeaply": {
"command": "npx",
"args": ["-y", "@yeaply/mcp"],
"env": { "YEAPLY_NAME": "Claude Desktop" }
}
}
}Where the keys live
Each service makes its own signing and encryption keys on first run. They are kept in ~/.config/yeaply/<service-name>.json (file mode 0600, readable only by you), or, on servers, in the YEAPLY_KEYS environment variable.
The protocol in brief
- Pairing by code. The service calls
POST /api/v1/pairwith its name and public keys and gets an 8-character code (ABCD-EFGH), valid 10 minutes. The phone claims the code, shows the service's name and fingerprint, and the person confirms. The service collects its token once; the server keeps only its hash. - The person's signed device list. The phones a service seals to come from a list signed by the person's own identity key, never from the server's word. A service refuses a list that does not verify or is older than the last one it accepted.
- Sealed packets. The question (title, body, facts, options) is sealed with a libsodium sealed box, one per phone, and the packet is Ed25519-signed by the service. The server stores the envelope and the boxes; it cannot open them.
- Answers sealed for the service. The phone seals the answer to the service's key and includes a
payloadHashof the exact question it opened, so the server cannot forge an answer or swap the question. - Collect, ack and withdraw. The service long-polls for answers (
?wait=25), acknowledges them (POST /api/v1/answers/ack, which deletes them), and can withdraw a waiting question (DELETE /api/v1/packets/{packetId}). - Answer callbacks. A connection may set a callback URL (
PATCH /api/v1/connections/{id}) that gets an unsigned POST of{ packetId }when an answer is ready. It carries only the packet id, so collect and check the sealed answer as above rather than trust the call. - Limits. 60 packets a minute and 500 open packets per connection; each sealed box at most 16 KB.
- Errors come as
{ "error": { "code", "message" } }with one of these codes:bad_request,unauthorized,not_found,pairing_expired,invalid_signature,unknown_device,too_large,rate_limited,connection_revoked,expired,withdrawn,already_answered.