amos 913d3c367f Add the usable task catalog and admit batch 6 tasks
All 161 task packages, including the 21 batch 6 C++17 tasks that passed
gates 1/2, are now in Git. rollout.catalog builds docs/task-catalog.{json,md}
from the task packages, a fresh trace5 calibration (128/128 PASS), every
verified controller receipt on the current task digest, documented holds
and digest-bound difficulty reviews. 123 tasks are usable (6 HARD),
5 are on hold and 33 still need a subprocess-only grader.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 17:43:15 +08:00

3.1 KiB
Raw Blame History

unit-observe行协议

make后运行./unit-observe,从stdin逐行取命令。空行和首个非空白字符为#的整行忽略;不支持inline注释。字段只以ASCII空白分隔,不解释引号。业务文字输入全部是连续偶数位hex(大小写均可),单个-表示空字节串。所有输出文字字段为小写hex的JSON string,空字节串为"",因此NUL/非ASCII不依赖宿主编码。

slot只能0/1,两个Stream默认构造。mode和Piece.kind wire字段为十进制int32,可以传非法枚举供API校验;capacity为十进制size_t,可以超过业务上限。COUNT为0..8192的十进制数,是wire界限,不代替Program的4096项业务界限。nonce是任意hex字节串,只用于预置输出。字段缺失、多余、数字或hex语法错误exit2;有效命令每条输出一条JSON,正常EOF exit0。stdout只含JSON,stderr可写诊断。

命令 API与输出
V text valid_utf8(text);[bool,input_unchanged]
E text nonce output预置nonce后escape;[error,output_hex,input_unchanged]
U text nonce 同样unescape;[error,output_hex,input_unchanged]
N slot mode capacity reset;[error,view]
F slot chunk feed;[error,view,input_unchanged]
D slot finish;[error,view]
Q slot view并保存到held_view;输出view
Y slot nonce 取view的独立副本,按下述固定字段改写;[改写后的副本,再次view],不保存held_view
P unit nonce ServiceName五string均预置nonce、instantiated=true后parse_unit;[error,service,input_unchanged]
C text nonce Program预置一项kind=decoded_instance、text=nonce后compile_template;[error,program,input_unchanged]
R COUNT kind text ... unit capacity nonce 构造COUNT个Piece,output预置nonce后render;[error,output_hex,input_unchanged]
T unit capacity nonce 对此前C保存的held_program调用render,output预置nonce;[error,output_hex,input_unchanged],不覆盖held_program
X text unit capacity nonce output预置nonce后expand;[error,output_hex,input_unchanged]
H 不调用库,输出[held_view,held_service,held_program,held_result_hex]

error是API返回的枚举整数,bool用JSON true/false。service=[unit_hex,prefix_hex,instance_hex,decoded_prefix_hex,decoded_instance_hex,instantiated];Piece=[kind,text_hex];program为Piece数组;view=[mode,phase,capacity,input_bytes,utf8_pending,escape_pending,result_hex]。

Y把副本mode/phase/capacity/input_bytes/utf8_pending/escape_pending分别改为17/18/19/20/21/22,result改为nonce,然后再次从同一Stream取view。它只修改调用方副本,不向库传入非法状态。V/E/U/F/P/C完整比较源string调用前后;R/T比较unit和所有Piece字段;X比较两个源string,不变布尔值仅是原始观察。

E/U/R/T/X把实际输出保存为held_result;P保存实际ServiceName为held_service;C保存实际Program为held_program。其它命令不覆盖这些保存值,Q单独更新held_view。初始held_view为默认StreamView,held_service/held_program为默认空值,held_result为空。H用来观察后续成功/失败、reset与另一Stream是否追改已返回的值。