Skip to content
Merged
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
16 changes: 1 addition & 15 deletions sdk/typescript/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,6 @@ class PublicationProgressPresenter {
try {
dashboard.stop();
} catch {}
this.#dashboard = null;
}
}

Expand Down Expand Up @@ -1672,14 +1671,10 @@ export async function runCodexSkillCommand(
}),
]);
invocationStatus = new Promise<number>((resolve, reject) => {
let completed = false;
const complete = (
code: number | null,
signal: NodeJS.Signals | null,
): void => {
if (completed) return;
completed = true;
forceStatusCompletion = null;
resolve(
requestedSignal === "SIGINT" || signal === "SIGINT"
? 130
Expand All @@ -1689,12 +1684,7 @@ export async function runCodexSkillCommand(
);
};
forceStatusCompletion = () => complete(null, null);
invocation.once("error", (error) => {
if (completed) return;
completed = true;
forceStatusCompletion = null;
reject(error);
});
invocation.once("error", reject);
invocation.once(output === undefined ? "exit" : "close", complete);
});
let [status, events] = await Promise.all([invocationStatus, captured]);
Expand Down Expand Up @@ -9512,7 +9502,6 @@ export class Progress {
#timerLineActive = false;
#cursorHidden = false;
#observingStreamErrors = false;
#streamErrorsActive = false;
#streamErrorGeneration = 0;
readonly #onStreamError = (): void => {};

Expand Down Expand Up @@ -9580,14 +9569,12 @@ export class Progress {
}
} finally {
if (this.#observingStreamErrors) {
this.#streamErrorsActive = false;
const generation = this.#streamErrorGeneration;
try {
this.#stream.write("", () => {
queueMicrotask(() => {
if (
generation === this.#streamErrorGeneration &&
!this.#streamErrorsActive &&
this.#observingStreamErrors
) {
this.#stream.off?.("error", this.#onStreamError);
Expand Down Expand Up @@ -9623,7 +9610,6 @@ export class Progress {
}

#observeStreamErrors(): void {
this.#streamErrorsActive = true;
this.#streamErrorGeneration += 1;
if (!this.#observingStreamErrors && this.#stream.on !== undefined) {
this.#stream.on("error", this.#onStreamError);
Expand Down
8 changes: 2 additions & 6 deletions sdk/typescript/src/scan-dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ export class ScanDashboard {
input.on("data", this.#onInput);
this.#stream.write(ENABLE_ALTERNATE_SCROLL);
}
this.#render();
this.#stream.write(this.#frame());
} catch (error) {
try {
this.stop();
Expand Down Expand Up @@ -537,14 +537,10 @@ export class ScanDashboard {
#refresh(): void {
if (this.#timer === null) return;
try {
this.#render();
this.#stream.write(this.#frame());
} catch {}
}

#render(): void {
this.#stream.write(this.#frame());
}

#frame(): string {
if (this.#options.presentation === "components") {
return this.#showComponent
Expand Down
7 changes: 3 additions & 4 deletions sdk/typescript/src/scan-history-renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,17 @@ export function renderScanHistory(
const wrap = (value: string, indent: number, prefix?: string): void => {
const available = width - indent - 2;
let line = "";
let first = true;
for (const word of clean(value).split(/\s+/)) {
if (line.length > 0 && line.length + word.length + 1 > available) {
lines.push(`${first && prefix ? prefix : " ".repeat(indent)}${line}`);
first = false;
lines.push(`${prefix || " ".repeat(indent)}${line}`);
prefix = undefined;
line = word;
} else {
line = line.length > 0 ? `${line} ${word}` : word;
}
}
if (line.length > 0) {
lines.push(`${first && prefix ? prefix : " ".repeat(indent)}${line}`);
lines.push(`${prefix || " ".repeat(indent)}${line}`);
}
};

Expand Down
Loading