商业产业 Hacker News Agent 2026-10-08T18:11 正文 ok 211 words

Show HN:Pocketty——当 Agent 被阻塞时会通知你的 iPhone SSH 终端

英文标题:🔶 Show HN: Pocketty – iPhone SSH terminal that pings you when an agent is blocked

Pocketty 是一款面向 iPhone 的 SSH 终端,主打在 AI Agent 执行受阻时向用户发送提醒。该项目在 Hacker News 上获得 28 分和 15 条评论。附带的代码变更将速率限制重试时间统一抽取为 `RETRY_AFTER` 常量,当前设为 60 秒,并同时用于授权与推送请求的限流响应,便于开发者集中维护限流策略。
打开原文相关 3 · 机会 1
media34.0 KB media15.1 KB media67.8 KB media32.1 KB media77.1 KB media38.2 KB media80.0 KB media39.7 KB media29.2 KB media12.9 KB media135.6 KB media65.6 KB media131.4 KB media63.8 KB media134.2 KB media63.8 KB media190.1 KB

中文

13 13 pub const MAX_BODY: usize = 16 * 1024;

14 14 const APNS_TOKEN_LIFETIME: u64 = 40 * 60;

15 15 const FCM_TOKEN_MARGIN: u64 = 5 * 60;

16 + pub const RETRY_AFTER: u32 = 60;

16 17 const NO_PLATFORM: &str = "platform is not configured on this relay";

17 18 const NO_ENV: &str = "environment is not configured on this relay";

18 19 ``

46 47 ``

47 48 pub async fn grant(&self, body: &[u8], client: &str, now: u64) -> Reply {

48 49 if ! self.runtime.allow(Bucket::Grants, client).await {

49 - return error(429, "rate limited").with_retry(60);

50 + return error(429, "rate limited").with_retry(RETRY_AFTER);

50 51 }

51 52 let Ok(request) = serde_json::from_slice::<GrantRequest>(bod y) else {

52 53 return error(400, "malformed grant request");

79 80 }

80 81 };

81 82 if ! self.runtime.allow(Bucket::Push, &bucket_key(&claims)).await {

82 - return push_reply(&PushResponse::RateLimited { retry_after: 60 });

83 + return push_reply(&PushResponse::RateLimited { retry_after: RETRY_AFTER });

English / 原文

13 13 pub const MAX_BODY: usize = 16 * 1024;

14 14 const APNS_TOKEN_LIFETIME: u64 = 40 * 60;

15 15 const FCM_TOKEN_MARGIN: u64 = 5 * 60;

16 + pub const RETRY_AFTER: u32 = 60;

16 17 const NO_PLATFORM: &str = "platform is not configured on this relay";

17 18 const NO_ENV: &str = "environment is not configured on this relay";

18 19 ``

46 47 ``

47 48 pub async fn grant(&self, body: &[u8], client: &str, now: u64) -> Reply {

48 49 if ! self.runtime.allow(Bucket::Grants, client).await {

49 - return error(429, "rate limited").with_retry(60);

50 + return error(429, "rate limited").with_retry(RETRY_AFTER);

50 51 }

51 52 let Ok(request) = serde_json::from_slice::<GrantRequest>(bod y) else {

52 53 return error(400, "malformed grant request");

79 80 }

80 81 };

81 82 if ! self.runtime.allow(Bucket::Push, &bucket_key(&claims)).await {

82 - return push_reply(&PushResponse::RateLimited { retry_after: 60 });

83 + return push_reply(&PushResponse::RateLimited { retry_after: RETRY_AFTER });