Refresh the Impeccable product experience

Rework the landing page proof, steering demo, feature grid, slop catalog, detector coverage, theming, Live workflow, and responsive behavior.\n\nAI-assisted implementation by OpenAI Codex.
This commit is contained in:
Paul Bakaus
2026-07-15 23:29:47 -07:00
parent 8682c85c57
commit bbed6eef08
553 changed files with 8903 additions and 97987 deletions
+16 -81
View File
@@ -10,12 +10,10 @@
*/
import { execFileSync } from 'node:child_process';
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { completionAckForAcceptResult, completionTypeForAcceptResult } from './live/completion.mjs';
import { getLiveCodexWorkerStatePath, readLiveServerInfo } from './lib/impeccable-paths.mjs';
import { codexWorkerProcessStateIsOwned } from './live/codex-worker.mjs';
import { readLiveServerInfo } from './lib/impeccable-paths.mjs';
// Absolute path to a sibling script in this skill's scripts dir, so runtime
// error hints print a directly-runnable command instead of a placeholder.
@@ -29,7 +27,7 @@ const scriptCmd = (name) => `node "${path.join(SELF_DIR, name)}"`;
export const PER_REQUEST_TIMEOUT_MS = 270_000;
export const DEFAULT_EVENT_LEASE_MS = 600_000;
const EVENT_TYPES_NEEDING_AGENT_REPLY = new Set(['generate', 'steer', 'manual_edit_apply', 'carbonize_cleanup']);
const EVENT_TYPES_NEEDING_AGENT_REPLY = new Set(['generate', 'steer', 'manual_edit_apply']);
function readServerInfo() {
const record = readLiveServerInfo(process.cwd());
@@ -40,8 +38,8 @@ function readServerInfo() {
return record.info;
}
export function buildPollReplyPayload(token, { id, type, message, file, data, sourceEventType }) {
return { token, id, type, message, file, data, sourceEventType };
export function buildPollReplyPayload(token, { id, type, message, file, data }) {
return { token, id, type, message, file, data };
}
export function manualApplyPollBanner(event = {}) {
@@ -154,14 +152,7 @@ export async function waitForEventAck(base, token, eventId, {
return false;
}
export async function fetchNextEvent(base, token, {
totalDeadline,
types,
resolveTypes,
perRequestTimeoutMs = PER_REQUEST_TIMEOUT_MS,
leaseMs = DEFAULT_EVENT_LEASE_MS,
signal,
} = {}) {
export async function fetchNextEvent(base, token, { totalDeadline } = {}) {
while (true) {
if (totalDeadline && Date.now() >= totalDeadline) {
return { type: 'timeout' };
@@ -170,15 +161,8 @@ export async function fetchNextEvent(base, token, {
const remaining = totalDeadline
? totalDeadline - Date.now()
: PER_REQUEST_TIMEOUT_MS;
const slice = Math.min(Math.max(remaining, 1000), perRequestTimeoutMs);
const query = new URLSearchParams({
token,
timeout: String(slice),
leaseMs: String(leaseMs),
});
const normalizedTypes = normalizePollTypes(resolveTypes ? await resolveTypes() : types);
if (normalizedTypes.length > 0) query.set('types', normalizedTypes.join(','));
const res = await fetch(`${base}/poll?${query}`, { signal });
const slice = Math.min(Math.max(remaining, 1000), PER_REQUEST_TIMEOUT_MS);
const res = await fetch(`${base}/poll?token=${token}&timeout=${slice}&leaseMs=${DEFAULT_EVENT_LEASE_MS}`);
if (res.status === 401) {
const err = new Error('Authentication failed. The server token may have changed.');
@@ -200,7 +184,7 @@ export async function fetchNextEvent(base, token, {
}
}
export async function augmentEventWithAcceptHandling(event, base, token, { deferReply = false } = {}) {
export async function augmentEventWithAcceptHandling(event, base, token) {
if (event.type !== 'accept' && event.type !== 'discard') return event;
const __dirname = path.dirname(fileURLToPath(import.meta.url));
@@ -218,21 +202,11 @@ export async function augmentEventWithAcceptHandling(event, base, token, { defer
event._acceptResult = { handled: false, mode: 'error', error: err.message };
}
if (deferReply) {
event._completionAck = { ok: false, deferred: true };
return event;
}
await completeAcceptHandling(event, base, token);
return event;
}
export async function completeAcceptHandling(event, base, token) {
const completionType = completionTypeForAcceptResult(event.type, event._acceptResult);
try {
await postReply(base, token, {
id: event.id,
type: completionType,
sourceEventType: event.type,
message: event._acceptResult?.error,
file: event._acceptResult?.file,
data: event._acceptResult?.carbonize === true ? { carbonize: true } : undefined,
@@ -243,6 +217,7 @@ export async function completeAcceptHandling(event, base, token) {
if (!event._completionAck) {
event._completionAck = completionAckForAcceptResult(event.id, completionType, event._acceptResult);
}
return event;
}
@@ -270,9 +245,9 @@ export function printPollEvent(event) {
console.log(JSON.stringify(event));
}
export async function runPollOnce(base, token, { totalTimeout = 600_000, types, resolveTypes, perRequestTimeoutMs } = {}) {
export async function runPollOnce(base, token, { totalTimeout = 600_000 } = {}) {
const deadline = Date.now() + totalTimeout;
const event = await fetchNextEvent(base, token, { totalDeadline: deadline, types, resolveTypes, perRequestTimeoutMs });
const event = await fetchNextEvent(base, token, { totalDeadline: deadline });
await augmentEventWithAcceptHandling(event, base, token);
writeCarbonizeBanner(event);
printPollEvent(event);
@@ -283,14 +258,11 @@ export async function runPollStream(base, token, {
ackTimeoutMs = 600_000,
ackPollIntervalMs = 400,
shouldContinue = () => true,
types,
resolveTypes,
perRequestTimeoutMs,
} = {}) {
process.stderr.write('[impeccable-poll] stream mode: one JSON object per line on stdout; use --reply while this process stays running\n');
while (shouldContinue()) {
const event = await fetchNextEvent(base, token, { types, resolveTypes, perRequestTimeoutMs });
const event = await fetchNextEvent(base, token);
await augmentEventWithAcceptHandling(event, base, token);
writeCarbonizeBanner(event);
printPollEvent(event);
@@ -350,19 +322,14 @@ Modes:
Options:
--timeout=MS One-shot poll timeout in ms (default: 600000). Ignored in --stream mode
--types=A,B Lease only these event types (used by partitioned Codex control lane)
--codex-worker-fallback
Add generation events only if the dedicated Codex worker fails or exits
--ack-timeout=MS Stream mode: max wait for --reply after generate/steer (default: 600000)
--file PATH Attach a source file path to the reply (generate/steer flow)
--data JSON Attach a JSON result object to the reply (manual_edit_apply flow). Must be valid JSON
--help Show this help message
Harness note:
Default one-shot mode is the primary contract, including Codex foreground polling.
Claude Code may run it as a background task; Cursor uses a background terminal with exit notification.
--stream is retained for explicitly enabled experimental worker control lanes.
Do not use --stream on Cursor.`);
Default one-shot mode is the portable contract for Claude Code, Codex, and Cursor.
--stream is experimental for harnesses with fast incremental stdout; do not use on Cursor.`);
process.exit(0);
}
@@ -393,55 +360,23 @@ Harness note:
}
const streamMode = args.includes('--stream');
const typesArg = args.find((a) => a.startsWith('--types='));
const types = normalizePollTypes(typesArg ? typesArg.slice('--types='.length) : null);
const workerFallback = args.includes('--codex-worker-fallback');
const resolveTypes = workerFallback ? () => resolveCodexWorkerFallbackTypes(types) : null;
const perRequestTimeoutMs = workerFallback ? 2_000 : undefined;
const ackTimeoutArg = args.find((a) => a.startsWith('--ack-timeout='));
const ackTimeoutMs = ackTimeoutArg ? parseInt(ackTimeoutArg.split('=')[1], 10) : 600_000;
try {
if (streamMode) {
await runPollStream(base, info.token, { ackTimeoutMs, types, resolveTypes, perRequestTimeoutMs });
await runPollStream(base, info.token, { ackTimeoutMs });
return;
}
const timeoutArg = args.find((a) => a.startsWith('--timeout='));
const totalTimeout = timeoutArg ? parseInt(timeoutArg.split('=')[1], 10) : 600_000;
await runPollOnce(base, info.token, { totalTimeout, types, resolveTypes, perRequestTimeoutMs });
await runPollOnce(base, info.token, { totalTimeout });
} catch (err) {
handlePollError(err);
}
}
export function normalizePollTypes(value) {
const values = Array.isArray(value) ? value : String(value || '').split(',');
return [...new Set(values.map((type) => String(type).trim()).filter(Boolean))];
}
export function resolveCodexWorkerFallbackTypes(baseTypes, {
cwd = process.cwd(),
state = readJson(getLiveCodexWorkerStatePath(cwd)),
isPidReachable = pidReachable,
} = {}) {
const base = normalizePollTypes(baseTypes);
const workerOwnsGeneration = codexWorkerProcessStateIsOwned(state, cwd)
&& ['starting', 'ready', 'working'].includes(state?.status)
&& isPidReachable(state?.pid);
if (workerOwnsGeneration) return base;
return normalizePollTypes([...base, 'generate', 'accept', 'discard', 'prefetch']);
}
function readJson(file) {
try { return JSON.parse(fs.readFileSync(file, 'utf-8')); } catch { return null; }
}
function pidReachable(pid) {
if (!Number.isInteger(pid) || pid <= 0) return false;
try { process.kill(pid, 0); return true; } catch { return false; }
}
// Auto-execute when run directly
const _running = process.argv[1];
if (_running?.endsWith('live-poll.mjs') || _running?.endsWith('live-poll.mjs/')) {