Onboarding: emoji-first flow with shape/color selection, user preferences, language setup (9 locales), and bot creation with avatarValue persistence. executor.ts: split 4928→4159 lines into 8 modules (completion, computer, effects, model, utils, tools, attachments, types). pi-runtime.ts: split 1726→561 lines into 2 modules (model-config, tool-utils). E2E: new onboarding-emoji-first tests + updated completeOnboarding helper.
24 lines
565 B
TypeScript
24 lines
565 B
TypeScript
/** Avoid an expensive remote workspace export when a turn never touched the computer. */
|
|
export function createRunWorkspaceCheckpoint(checkpoint: () => Promise<unknown>) {
|
|
let dirty = false;
|
|
return {
|
|
markDirty() {
|
|
dirty = true;
|
|
},
|
|
markFiles(files: readonly unknown[]) {
|
|
if (files.length > 0) dirty = true;
|
|
},
|
|
async flush() {
|
|
if (!dirty) return false;
|
|
dirty = false;
|
|
try {
|
|
await checkpoint();
|
|
return true;
|
|
} catch (error) {
|
|
dirty = true;
|
|
throw error;
|
|
}
|
|
},
|
|
};
|
|
}
|