docs: record sub2api timeout closeout and agentrun cli updates
This commit is contained in:
@@ -10,6 +10,13 @@ export interface JsonEnvelope<T> {
|
||||
error?: unknown;
|
||||
}
|
||||
|
||||
export interface RenderedCliResult {
|
||||
ok: boolean;
|
||||
command: string;
|
||||
renderedText: string;
|
||||
contentType: "text/plain" | "application/json" | "application/yaml";
|
||||
}
|
||||
|
||||
const GH_OUTPUT_DUMP_THRESHOLD_BYTES = 20 * 1024;
|
||||
const OUTPUT_DUMP_PREVIEW_CHARS = 2000;
|
||||
const OUTPUT_DUMP_DIR = join(tmpdir(), "unidesk-cli-output");
|
||||
@@ -33,6 +40,18 @@ export function emitJson<T>(command: string, data: T, ok = true): void {
|
||||
safeStdoutWrite(renderEnvelope(command, envelope));
|
||||
}
|
||||
|
||||
export function isRenderedCliResult(value: unknown): value is RenderedCliResult {
|
||||
return typeof value === "object"
|
||||
&& value !== null
|
||||
&& typeof (value as { renderedText?: unknown }).renderedText === "string"
|
||||
&& typeof (value as { command?: unknown }).command === "string"
|
||||
&& typeof (value as { ok?: unknown }).ok === "boolean";
|
||||
}
|
||||
|
||||
export function emitText(text: string): void {
|
||||
safeStdoutWrite(text.endsWith("\n") ? text : `${text}\n`);
|
||||
}
|
||||
|
||||
export function emitError(command: string, error: unknown): void {
|
||||
const payload = normalizeErrorPayload(command, error);
|
||||
const envelope: JsonEnvelope<never> = { ok: false, command, error: payload };
|
||||
|
||||
Reference in New Issue
Block a user