You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(cli): expose list-page truncation in the payload
An oversize structured list page is emitted as its leading rows, but the
reduction was announced only on stderr while total / has_next_page /
search_after_ctx kept describing the page the server returned — so a script
that discards stderr and stops on has_next_page silently loses every withheld
row.
A reduced list envelope now carries truncated: true plus emitted_rows: N when
rows were withheld (the case paging can repair); when long values inside rows
were clipped instead, truncated rides alone, because re-requesting cannot
restore them. Bare top-level arrays have nowhere to carry the marker and keep
the stderr note as their only signal.
Docs: README / README_zh bounded-pages section; a page-level note in the
flashduty skill so agents recognise the two keys.
**JSON (`--json` / `--output-format json`):** Machine-parseable, full data, no truncation.
324
+
**JSON (`--json` / `--output-format json`):** Machine-parseable output for `jq` and scripts.
325
325
326
326
```bash
327
327
flashduty incident list --json | jq '.[].title'
328
328
```
329
329
330
-
**TOON (`--output-format toon`):** Token-Oriented Object Notation — full data, no truncation, but drops the per-row repeated keys that JSON emits for uniform arrays, so list output costs materially fewer tokens. Preferred for LLM/agent consumption. Not directly `jq`-able; use `--json` when you need to pipe into `jq`.
330
+
**TOON (`--output-format toon`):** Token-Oriented Object Notation — drops the per-row repeated keys that JSON emits for uniform arrays, so list output costs materially fewer tokens. Preferred for LLM/agent consumption. Not directly `jq`-able; use `--json` when you need to pipe into `jq`.
331
331
332
332
```bash
333
333
flashduty incident list --output-format toon
334
334
```
335
335
336
+
**Bounded list pages.** Every structured list page is capped at 16 KiB: an oversize page is emitted as the leading rows that fit, and the reduction is announced on stderr. A reduced **list envelope says so in the payload** too — scripts routinely discard stderr — and the marker's shape tells you which reduction happened:
337
+
338
+
-`"truncated": true`**with**`"emitted_rows": N` — the page carries its first N rows and withheld the rest. The envelope's `total` / `has_next_page` / `search_after_ctx` still describe the page as the server returned it, so a page cut to 7 of 100 rows reads as complete. To collect everything, re-request with a `--limit` no larger than the rows you received (or, where the command documents its cursor as a row id, pass the last received row's id back as `--search-after-ctx`) and repeat until the rows you hold reach `total`; stopping on `has_next_page=false` alone silently drops the withheld rows.
339
+
-`"truncated": true`**alone** — every row was emitted, but long values inside them were clipped (stderr names the fields). Paging cannot restore them; narrow `--fields` and re-request.
340
+
341
+
A bare top-level array has nowhere to carry the marker, so it announces a reduction only on stderr — page it with a lower `--limit`, or switch to a page-envelope command (`alert event-list`, `insight incident-list`) when a script needs completeness.
342
+
336
343
**No truncation (`--no-trunc`):** Table with full field content.
Copy file name to clipboardExpand all lines: skills/flashduty/SKILL.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,8 @@ Append `--output-format toon` to read commands: it drops the per-row repeated ke
29
29
30
30
**Shape the payload before you fetch it.** For ID scans, counts, or "find the matching row" tasks, prefer `--fields` projections and compact list verbs over full detail dumps. Huge raw JSON dumps are a last resort, not a default.
31
31
32
+
**A structured list page is capped at 16 KiB.** An oversize page is emitted as its leading rows, and the envelope carries `"truncated": true` with `"emitted_rows": N`; `total` / `has_next_page` / `search_after_ctx` still describe the page as the server returned it, so a reduced page reads as complete unless you check the marker. `truncated` WITHOUT `emitted_rows` means long values inside the rows were clipped — narrow `--fields` instead of paging. When a walk must cover everything (a script, a full export), resume after the last row you actually received: re-request with a `--limit` no larger than the rows you got, then follow that response's cursor.
33
+
32
34
**Empty result = authoritative not-found.** A filter returning `[]` means no such entity in scope — report it (optionally the 1–2 closest names) and stop. Do **not** brute-force (no shifted-keyword re-queries, no widening past caps, no full-dump grep). Never infer "feature not enabled" from an empty list, and never fabricate data absent from tool output.
33
35
34
36
**A result you did not fetch is "unknown", never "empty" — and "fetched" means the same scope, not just the same verb.** You may report a command's result for a given window, entity, or aspect — including "returned empty" or any count/list/finding — **only if a call covering that exact scope appears in your tool-call history this turn**. A wider or different time window, or a sibling entity's result, does not transfer: extrapolating from what you did fetch is the same fabrication as skipping the fetch. If the scope wasn't queried, the honest answer is "未查询 — 可运行 <command>", not a filled-in number or a generalized claim.
0 commit comments