Idle leases: status, MCP and the console show last use and the idle end

未关闭
#1,909 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
45/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript

调研方向

Read the cited entry points: src/cli/format.ts, src/mcp session and server tools, src/contract/inbox.ts, and the listed UI models and screens. Follow the searches for ttlDeadline, lastRenewedAt, ENDED_TEXT, and isExpiring, then run the named CLI, MCP, contract, and UI model tests. Done means the status and console show last use and idle timing, idle endings appear correctly in the Inbox and viewer, MCP explains idle loss, and the documentation and listed checks pass.

由索引模型根据 Issue 内容生成。

描述

task:ready

Part of #1899.

Scope

simlock status prints when each lease was last used and when it will end idle. MCP lease_status shows the same, and after an idle end the next MCP tool that needs the lease says why. The console shows "last used" and the idle countdown, lists a lease about to end idle in the Inbox, and its screen viewer says why an idle-ended stream stopped.

If it goes wrong, someone sees a wrong or missing last-use time, or an idle end reads as an unexplained loss.

Technical spec

Commit 056e29880.

Rows

Behaviours: B10, B11, B12
Interfaces: I6, I7, I9 (uses I2, I4)
Existing code: X15, X16, X17, X18 (cli.mdx simlock status, mcp-tools.mdx, console.mdx)

Facts
# Fact Source
F1 The status lease line prints times as raw ms numbers src/cli/format.ts:319-322
F2 A stream that ends with no known reason is opened again by the console ui/src/state/screen.ts:238-241, ui/src/data/stream.ts:322-330
F3 The Inbox's ending items are chosen by isExpiring(ttlDeadline) and timed from ttlDeadline src/contract/inbox.ts:158-163, ui/src/model/inbox.ts:118-137
Modules touched

cli (format), mcp (session, server tools), contract (inbox.ts), ui (model leases and inbox, data stream; screens ui/src/screens/leases/summary.tsx:90, ui/src/screens/leases/inspector.tsx:100, ui/src/screens/fleet/streaming-page.tsx:173, which draw "renewed" today), website (cli, mcp-tools, console pages). Searches: rg "ttlDeadline|lastRenewedAt" src/cli src/mcp ui/src, rg "ENDED_TEXT|isExpiring".

Rules in play
  • ui/AGENTS.md Layers: the rules live in ui/src/model/ and src/contract/inbox.ts; screens only draw. Look: a status is never colour alone.
  • src/contract/AGENTS.md: inbox.ts imports nothing at run time. The push hook counts it as a shape (.agents/scripts/protocol-bump-check.mjs:12-20): the change is a listing rule with no wire shape, so the commit carries Protocol-bump: none (inbox ending rule, no wire shape).
  • docs/internal/agent-rules/documentation.md rule 9: cli.mdx, mcp-tools.mdx and console.mdx describe the new fields and messages.
Tests

Seam: formatStatus through the CLI test harness (src/cli/index.test.ts), the MCP server (src/mcp/server.test.ts), the console model units (ui/src/model/leases.test.ts, ui/src/model/inbox.test.ts, src/contract/inbox.test.ts).

  • B10: simlock status lease line shows I7: used; never used; in use; limit off.
  • B11: MCP lease_status shows the fields, and after lease-lost reason idle the next tool answers I6: live lease; reason idle; other reasons; after a new lease.
  • B12: the console shows last use and the idle countdown, the Inbox lists an idle-ending lease timed from idleDeadline, and the viewer shows I9: used; never used; in use; limit off; idle nearer than TTL; TTL nearer; stream reason idle.

Done when

  • pnpm test:changed and pnpm typecheck pass.
  • pnpm exec vitest run --project ui-dom ui/src/screens/leases/leases.dom.test.tsx ui/src/screens/inbox/inbox.dom.test.tsx passes with cases for last use, the idle countdown and an idle-ending Inbox item.
  • pnpm --dir website install && pnpm --dir website build && node website/scripts/check-openapi.mjs passes (the diff touches src/contract/).
  • The push carries Protocol-bump: none (inbox ending rule, no wire shape) and the protocol-bump check passes.
  • cli.mdx, mcp-tools.mdx and console.mdx describe the new fields and the idle messages.

Out of scope

  • The fields and the idle reason themselves (#1907); the agent-device message (#1908).

Depends on

  • #1907

Written by an agent.

主要语言
TypeScript
星标
730
派生
44
平均合并
16 小时 13 分钟
30 天内合并 PR
387

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

callstackincubator/simlock 的其他 Issue

查看 callstackincubator/simlock 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。