Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 25 additions & 5 deletions docs/reference/required-work-context.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,20 @@ applies during explicit Todo selection when work and quota spending are
still disabled. A complete scan can still hit the summary's display limit.
The initial view then also keeps the exact omitted count and reconciliation
guidance. The required read and its existing cursor deliver the scoped request
rows. The captured summary remains available at its original address. An
incomplete scan, unavailable scan records or an unmatched read keeps the whole
summary inline.
rows. With `--attention-only`, each incoming page keeps full `items` for
requests still needing their briefs and `open_request_summaries` for requests
whose latest delivered conclusion leaves remaining work. Follow `next_cursor`
even on summary-only pages. The same cursor continues to open sent requests
after the incoming rows. Pages with only sent summaries do not deliver or
consume results. A nonzero `unavailable_count` calls for receipt recovery.
For peer returns, folding a brief requires a delivery receipt that binds its
request ID and exact result key. An older receipt without that binding keeps
the full brief visible until an authorized read supplies the specific result.
Use `--request-id` without `--attention-only` to read a complete incoming
brief. Inspect a sent Goal request with `manager-inbox status` using the
summary's receiver `agent_id` and exact `request_id` in the same Goal.
The captured summary remains available at its original address. An incomplete
scan, unavailable scan records or an unmatched read keeps the whole summary inline.
Adoption and queued returns are intermediate states. Read the full current request before
assessing, executing or returning it. Use the existing scoped request and
consumption routes for those actions.
Expand Down Expand Up @@ -444,8 +455,17 @@ full/delta 字节比较计入这些 reader 命令元数据;既有进程内引
首读包含有界 `unfinished_delegations` 投影和 `read_complete` 标记。已准入的普通
工作 Turn 若有大型委派摘要、扫描完整,且必读列表中有同一条管家收件箱命令,首读保留
收发请求计数、扫描状态和必读命令。扫描完整但摘要达到展示上限时,首读同时保留精确的
省略数量与核对指引。逐条请求通过必读命令及其现有分页游标交付。原摘要仍可从同一
捕获取回。扫描不完整、扫描记录不可读或没有匹配必读命令时,首读保留完整摘要。
省略数量与核对指引。逐条请求通过必读命令及其现有分页游标交付。`--attention-only`
下,需要原简报的收件仍在 `items`,最近一次结论已送达且有剩余工作的收件在
`open_request_summaries`。只有摘要的页也继续跟随 `next_cursor`,收件读完后
沿同一游标查阅未结外发委派。只含外发摘要的续页不送达或消费结果。
`Peer` 回传只有在送达回执绑定请求 ID 和确切结果键时才折叠简报。缺少绑定的旧回执
继续保留完整简报,直到有权限的读取实际交付该条结果。
`unavailable_count` 大于零时须恢复对应回执。收件全文用不带
`--attention-only` 的 `--request-id` 精读。Goal 外发委派可在同一 Goal 下用
摘要中的接收方 `agent_id` 和精确 `request_id` 查阅 `manager-inbox status`。
原摘要仍可从同一捕获取回。
扫描不完整、扫描记录不可读或没有匹配必读命令时,首读保留完整摘要。
采纳和回传入队是中间状态,评估、执行或回传前须读当前请求全文,并沿已有范围约束和
消费入口办理。

Expand Down
14 changes: 11 additions & 3 deletions loopx/capabilities/manager_context/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ and governed-delegation tool descriptions. Keep reader, language, corrections
and result destination with the original work; do not maintain a second copy in
a private manager configuration or an installed skill.
The heartbeat hook's required Inbox read uses the same CLI entrypoint.
It requests `read --attention-only`. An unfinished incoming request with a
verified delivered partial answer for its current revision stays on the compact
agenda, with its remaining work and the unfiltered read command. Requests
without that proof, including queued or unreadable returns, still supply the
full brief before work. Read a request's full current brief with `--request-id`
before resuming it or returning an answer. Peer returns, native child results
and operation handoffs use their usual readers.

The rule calls for a useful outcome first, explained terms and comparisons with
units and direction. Full evidence, negative results, unknown costs and remaining
Expand Down Expand Up @@ -745,9 +752,10 @@ and are not paginated by this cursor. `status --offset/--limit` remains separate
Large Markdown Inbox responses open with a reference to a private capture.
The generated native context configuration declares
`LOOPX_CONTEXT_PAGE_OUTPUT_BYTES=64000` for tools that can retain that size.
The Inbox uses that profile for both capture reader commands and keeps the
opening within 12,000 bytes. Without that declaration the reader also stays
within 12,000 bytes. Follow the capture's byte cursors and verify coverage before
The Inbox uses that profile for both capture reader commands. The Markdown
response and capture opening stay within 5,000 serialized bytes. Without the
declaration, both reader commands use the same 5,000-byte limit. Follow the
capture's byte cursors and verify coverage before
using the Inbox cursor. If a reader output is truncated, reduce both page
limits and recover the affected range of the same capture.

Expand Down
1 change: 1 addition & 0 deletions loopx/capabilities/manager_context/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ def produce():
str(runtime_root),
"manager-inbox",
"read",
"--attention-only",
*(["--format", "markdown"] if model_read else []),
"--goal-id",
goal_id,
Expand Down
14 changes: 10 additions & 4 deletions loopx/cli_commands/manager_inbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,12 @@ def _render_read_markdown(result: dict) -> str:
def _read_markdown(result: dict, *, runtime_root: Path) -> tuple[str, bool]:
"""Deliver the already-recorded scoped read without repeating its effects."""
from ..control_plane.turn_driver.native_context_profile import (
NATIVE_CONTEXT_FIRST_READ_FALLBACK_BYTES,
NATIVE_CONTEXT_OUTPUT_ENV,
NATIVE_INBOX_MARKDOWN_OUTPUT_BYTES,
native_context_page_budget,
)

limit = NATIVE_CONTEXT_FIRST_READ_FALLBACK_BYTES
limit = NATIVE_INBOX_MARKDOWN_OUTPUT_BYTES
view = _share_item_guidance(result)
body = _render_read_markdown(view)
size = len((body + os.linesep).encode("utf-8"))
Expand Down Expand Up @@ -151,7 +151,8 @@ def _read_markdown(result: dict, *, runtime_root: Path) -> tuple[str, bool]:
"Follow next_command through eof in UTF-8 byte-offset order. Compare each reported digest with "
"this opening's SHA-256. Check each "
"page's content length against its offsets, and complete coverage through total_bytes. "
"If output is missing or truncated, reread that range of the same capture with a smaller page. "
"If output is missing or truncated, reread that range of the same capture with smaller "
"--page-bytes and --max-page-output-bytes. "
+ CONTEXT_CAPTURE_CODE_MODE_GUIDANCE
+ "Apply any shared_item_guidance to the items on this page. After the page is complete, "
"follow its next_cursor, operation_handoff_next_cursor, or native_child_results.next_cursor with the original Inbox command. "
Expand Down Expand Up @@ -245,6 +246,8 @@ def register_manager_inbox(subparsers, add_format):
parser.add_argument("--sender-id", help="For configuring a new delivery source: its independently verified sender.")
parser.add_argument("--execute", action="store_true")
parser.add_argument("--request-id", help="For read: inspect this exact current or concluded request instead of the pending inbox.")
parser.add_argument("--attention-only", action="store_true",
help="For read: page through incoming briefs, summaries of partial conclusions and open sent requests.")
parser.add_argument(
"--phase", choices=("decision", "conclusion"), default="conclusion"
)
Expand Down Expand Up @@ -273,6 +276,9 @@ def handle_manager_inbox(args, registry_path, runtime_root):
try:
remainder = getattr(args, "remaining_work", None)
resume = getattr(args, "resume_when", None)
attention_only = getattr(args, "attention_only", False)
if attention_only and (args.manager_inbox_action != "read" or getattr(args, "request_id", None) is not None):
raise ValueError("--attention-only requires read without --request-id")
if remainder is not None or resume is not None:
if args.manager_inbox_action != "report" or remainder is None or resume is None:
raise ValueError("--remaining-work and --resume-when require report and each other")
Expand Down Expand Up @@ -478,7 +484,7 @@ def handle_manager_inbox(args, registry_path, runtime_root):
# Only the invocation-bound host reader can record Turn delivery.
result = read_inbox(runtime_root, registry_path, args.goal_id, args.agent_id,
workspace=Path.cwd(), cursor=cursor, operation_cursor=operation_cursor,
request_id=request_id)
request_id=request_id, attention_only=attention_only)
result["instruction"] += " " + collaboration_answer_instruction()
if request_id is None:
result["followthrough"] += (
Expand Down
5 changes: 4 additions & 1 deletion loopx/control_plane/collaboration/inbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,10 @@ def pending(

def _pending_result(root, snapshot, scope, operation_cursor):
result = snapshot["result"]
if "request_id" in result or snapshot.get("completed") or snapshot.get("native_child_continuation"):
# A completed request page has no read effects left, but an explicitly
# requested operation page still has its own independent cursor.
if ("request_id" in result or snapshot.get("native_child_continuation")
or (snapshot.get("completed") and operation_cursor is None)):
return result
from .operation_handoff import pending_operation_handoffs

Expand Down
Loading
Loading