fix(cli): stream JSON results at the shared command boundary
Route ordinary CLI results through the bounded JSON writer after command registration, including managed member inspection. Remove JavaScript-specific output plumbing while preserving filters, envelopes, cancellation, and failure exits. Measure formatted UTF-16 expansion before Incur token counting and return resource_constraint above the runtime string limit, with recovery guidance. Validate output above the real V8 string limit by SHA-256 and exercise the compiled managed provider. Clean-worktree validation: npm run check; 76 focused tests passed, with 2 optional-provider skips; test discovery passed. Fixes #1371.
This commit is contained in:
@@ -10,7 +10,7 @@ export const writeJsonOutput = async (
|
||||
destination: Writable,
|
||||
format: JsonOutputFormat = "json",
|
||||
): Promise<void> => {
|
||||
for (const part of bufferedJsonParts(documentParts(value, format)))
|
||||
for (const part of bufferedJsonParts(jsonOutputParts(value, format)))
|
||||
await writePart(destination, part);
|
||||
};
|
||||
|
||||
@@ -35,7 +35,8 @@ const writePart = (destination: Writable, part: string): Promise<void> =>
|
||||
}
|
||||
});
|
||||
|
||||
function* documentParts(
|
||||
/** The exact formatted document, including its final newline. */
|
||||
export function* jsonOutputParts(
|
||||
value: unknown,
|
||||
format: JsonOutputFormat,
|
||||
): Generator<string> {
|
||||
|
||||
Reference in New Issue
Block a user