arco-workbench 0.2.1 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +26 -24
- package/client/dist/assets/{PhosphorBackdrop-BbR3xmfD.js → PhosphorBackdrop-CHXVFLGT.js} +1 -1
- package/client/dist/assets/{ThemedBackgroundShaderImpl-UMjbs9ZN.js → ThemedBackgroundShaderImpl-Bhs4I9jA.js} +1 -1
- package/client/dist/assets/{XtermView-n135qz-f.js → XtermView-CdfurwFx.js} +1 -1
- package/client/dist/assets/{galleryEditor-CFSke4by.js → galleryEditor-DYjZZ4cf.js} +1 -1
- package/client/dist/assets/{index-DeoJbjI3.js → index-BjDmFvqG.js} +219 -219
- package/client/dist/index.html +1 -1
- package/client/dist/manifest-mobile.webmanifest +1 -0
- package/client/src/components/Connections/Connections.tsx +3 -3
- package/client/src/components/research/QuickResearchOverview.tsx +7 -3
- package/client/src/components/research/SavedQuickKeep.tsx +7 -3
- package/client/src/help/content/misc.tsx +2 -2
- package/client/src/help/content/rightPanel.tsx +3 -2
- package/client/src/help/manualSections/clusters.tsx +1 -1
- package/client/src/help/manualSections/powerFeatures.tsx +3 -2
- package/client/src/layout/layoutRange.ts +10 -0
- package/client/src/main.tsx +2 -0
- package/docs/CHECKPOINTS.md +67 -3
- package/docs/CLIENT.md +1 -1
- package/docs/HTTP_API.md +9 -7
- package/docs/PROVIDERS.md +1 -1
- package/docs/RESEARCH.md +2 -2
- package/node_modules/@arco/shared/package.json +1 -1
- package/package.json +2 -2
- package/server/dist/capabilities.d.ts +6 -0
- package/server/dist/capabilities.js +13 -4
- package/server/dist/explorerDocs.d.ts +1 -0
- package/server/dist/explorerDocs.js +4 -4
- package/server/dist/gitSnapshots.d.ts +1 -0
- package/server/dist/gitSnapshots.js +547 -83
- package/server/dist/http/clusterRoutes.js +9 -3
- package/server/dist/http/router.js +1 -0
- package/server/dist/providers/codexChatBoundary.js +6 -1
- package/server/dist/research/quickPromotion.d.ts +3 -0
- package/server/dist/research/quickPromotion.js +26 -9
- package/server/dist/research/savedQuickPromotion.js +2 -11
- package/server/dist/turnChanges.d.ts +1 -1
- package/server/dist/turnChanges.js +5 -4
- package/server/dist/ws/turnEngine.js +4 -1
- package/server/package.json +1 -1
- package/server/src/capabilities.ts +14 -4
- package/server/src/explorerDocs.ts +5 -5
- package/server/src/gitSnapshots.ts +538 -82
- package/server/src/http/clusterRoutes.ts +10 -3
- package/server/src/http/router.ts +1 -0
- package/server/src/providers/codexChatBoundary.ts +6 -1
- package/server/src/research/quickPromotion.ts +24 -6
- package/server/src/research/savedQuickPromotion.ts +2 -8
- package/server/src/turnChanges.ts +5 -4
- package/server/src/ws/turnEngine.ts +4 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readQuickPromotion, requestQuickPromotion } from '../research/quickPromotion.js';
|
|
1
|
+
import { QuickPromotionFolderMissingError, readQuickPromotion, requestQuickPromotion } from '../research/quickPromotion.js';
|
|
2
2
|
import { previewResearchExport, prepareResearchExport, confirmResearchExport } from '../research/exportResults.js';
|
|
3
3
|
import { antigravityChatWorkspace } from '../chatMode.js';
|
|
4
4
|
import { sendResearchToFolder, sendResearchToPlan, stageResearchForComposer, confirmResearchComposer, recordResearchExport, previewResearchStart, prepareResearchStart, confirmResearchStart } from '../research/sendToProject.js';
|
|
@@ -35,6 +35,13 @@ import { formatBoardForModel } from '../project/taskLedger.js';
|
|
|
35
35
|
import type { HttpDeps } from './router.js';
|
|
36
36
|
import type { LedgerTaskStatus, TaskLink } from '@arco/shared';
|
|
37
37
|
|
|
38
|
+
function quickPromotionError(error: unknown) {
|
|
39
|
+
return {
|
|
40
|
+
error: error instanceof Error ? error.message : 'Could not keep the project.',
|
|
41
|
+
...(error instanceof QuickPromotionFolderMissingError ? { code: 'research_folder_missing' } : {}),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
38
45
|
// Cluster / sandbox / codebase-memory route group — peeled verbatim from
|
|
39
46
|
// router.ts (see docs/ARCHITECTURE.md). Returns true when a route
|
|
40
47
|
// in this group matched (request answered), false otherwise so the caller
|
|
@@ -57,7 +64,7 @@ export async function tryHandleClusterRoutes(
|
|
|
57
64
|
const journal = await saved.requestSavedQuickPromotion(savedPromotion[1], body.folderRoot);
|
|
58
65
|
reply(202, { phase: journal.phase, message: journal.message });
|
|
59
66
|
}
|
|
60
|
-
} catch (error) { reply(400,
|
|
67
|
+
} catch (error) { reply(400, quickPromotionError(error)); }
|
|
61
68
|
return true;
|
|
62
69
|
}
|
|
63
70
|
const promotion = req.url ? /^\/api\/research\/([0-9a-f-]{36})\/keep-as-project$/.exec(req.url.split('?')[0]) : null;
|
|
@@ -74,7 +81,7 @@ export async function tryHandleClusterRoutes(
|
|
|
74
81
|
const journal = await requestQuickPromotion(promotion[1], body.folderRoot);
|
|
75
82
|
reply(202, { phase: journal.phase, message: journal.message });
|
|
76
83
|
}
|
|
77
|
-
} catch (error) { reply(400,
|
|
84
|
+
} catch (error) { reply(400, quickPromotionError(error)); }
|
|
78
85
|
return true;
|
|
79
86
|
}
|
|
80
87
|
const chatFolder = req.method === 'GET' && req.url ? /^\/api\/antigravity-chat-folder\/([0-9a-f-]{36})$/.exec(req.url) : null;
|
|
@@ -2227,6 +2227,7 @@ const STATIC_CONTENT_TYPES: Record<string, string> = {
|
|
|
2227
2227
|
'.mjs': 'text/javascript; charset=utf-8',
|
|
2228
2228
|
'.css': 'text/css; charset=utf-8',
|
|
2229
2229
|
'.json': 'application/json; charset=utf-8',
|
|
2230
|
+
'.webmanifest': 'application/manifest+json; charset=utf-8',
|
|
2230
2231
|
'.svg': 'image/svg+xml',
|
|
2231
2232
|
'.png': 'image/png',
|
|
2232
2233
|
'.jpg': 'image/jpeg',
|
|
@@ -24,7 +24,12 @@ export function supportsCodexChat(probe: ChatCapabilityProbe, web = false): bool
|
|
|
24
24
|
let validated = false;
|
|
25
25
|
try { const startup = JSON.parse(probe.startupConfig ?? ''); validated = typeof startup.appServerVersion === 'string' && !startup.error; } catch { /* Unsupported or failed strict configuration probe. */ }
|
|
26
26
|
return supportedVersion && validated && (!web || listed(probe.listedFeatures ?? '', 'code_mode_host')) && requiredFeatures.every(name => listed(probe.listedFeatures ?? '', name))
|
|
27
|
-
&& disabledFeatures.filter(name => requiredFeatures.includes(name) || listed(probe.listedFeatures ?? '', name)).every(name =>
|
|
27
|
+
&& disabledFeatures.filter(name => requiredFeatures.includes(name) || listed(probe.listedFeatures ?? '', name)).every(name => {
|
|
28
|
+
const enabled = web && name === 'code_mode_host';
|
|
29
|
+
const activeStages = 'stable|experimental|under development';
|
|
30
|
+
const stages = requiredFeatures.includes(name) || enabled ? activeStages : `${activeStages}|deprecated|removed`;
|
|
31
|
+
return new RegExp(`^${name}\\s+(?:${stages})\\s+${enabled}\\s*$`, 'm').test(probe.features ?? '');
|
|
32
|
+
})
|
|
28
33
|
&& [probe.execHelp, probe.resumeHelp].every(help => help?.includes('--ignore-user-config') && help.includes('--ignore-rules') && help.includes('--strict-config'));
|
|
29
34
|
}
|
|
30
35
|
const cache = new Map<string, { expires: number; supported: boolean; overrides: readonly string[] }>();
|
|
@@ -77,6 +77,29 @@ function schedule(clusterId: string): void {
|
|
|
77
77
|
timer.unref(); timers.set(clusterId, timer);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
+
export class QuickPromotionFolderMissingError extends Error {}
|
|
81
|
+
|
|
82
|
+
export async function resolveQuickPromotionRoot(source: string, folderRoot?: string): Promise<string> {
|
|
83
|
+
const settings = await readSettings();
|
|
84
|
+
const selected = folderRoot?.trim();
|
|
85
|
+
const requested = selected || settings.researchFolder;
|
|
86
|
+
if (!requested || !isAbsolute(requested)) throw new Error('Choose a research folder.');
|
|
87
|
+
|
|
88
|
+
let root: string;
|
|
89
|
+
try {
|
|
90
|
+
root = safeDirectory(requested);
|
|
91
|
+
} catch (error) {
|
|
92
|
+
if ((error as NodeJS.ErrnoException).code !== 'ENOENT') throw error;
|
|
93
|
+
throw new QuickPromotionFolderMissingError(selected
|
|
94
|
+
? 'The folder you chose is gone. Choose another folder.'
|
|
95
|
+
: 'The saved research folder is gone. Choose a new folder to keep this research.');
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (isPathWithin(source, root) || isPathWithin(root, source)) throw new Error('Choose a research folder outside the Quick research workspace.');
|
|
99
|
+
if (selected && root !== settings.researchFolder) await patchSettings({ researchFolder: root });
|
|
100
|
+
return root;
|
|
101
|
+
}
|
|
102
|
+
|
|
80
103
|
export async function requestQuickPromotion(clusterId: string, folderRoot?: string): Promise<QuickPromotionJournal> {
|
|
81
104
|
return withFileLock(journalPath(clusterId), async () => {
|
|
82
105
|
const current = await readQuickPromotion(clusterId);
|
|
@@ -84,12 +107,7 @@ export async function requestQuickPromotion(clusterId: string, folderRoot?: stri
|
|
|
84
107
|
const state = await loadResearch(clusterId);
|
|
85
108
|
if (!state?.quick || state.closedAt) throw new Error('This is not an open Quick research.');
|
|
86
109
|
if (!/^[0-9a-f-]{36}$/i.test(state.projectId) || resolve(state.folder) !== resolve(join(await fs.realpath(arcoHome()), 'chat-workspaces', state.projectId)) || (await fs.lstat(state.folder)).isSymbolicLink()) throw new Error('The Quick research workspace is unavailable.');
|
|
87
|
-
const
|
|
88
|
-
const requested = settings.researchFolder || folderRoot?.trim();
|
|
89
|
-
if (!requested || !isAbsolute(requested)) throw new Error('Choose a research folder.');
|
|
90
|
-
const root = safeDirectory(requested);
|
|
91
|
-
if (isPathWithin(state.folder, root) || isPathWithin(root, state.folder)) throw new Error('Choose a research folder outside the Quick research workspace.');
|
|
92
|
-
if (!settings.researchFolder) await patchSettings({ researchFolder: root });
|
|
110
|
+
const root = await resolveQuickPromotionRoot(state.folder, folderRoot);
|
|
93
111
|
const journal: QuickPromotionJournal = { clusterId, projectId: state.projectId, directorWorkflowId: state.directorWorkflowId, source: state.folder, root, phase: 'waiting' };
|
|
94
112
|
await save(journal); schedule(clusterId); return journal;
|
|
95
113
|
});
|
|
@@ -6,13 +6,12 @@ import { arcoHome } from '../arcoHome.js';
|
|
|
6
6
|
import { antigravityChatWorkspace, chatStorageDir } from '../chatMode.js';
|
|
7
7
|
import { readLogLines } from '../eventLog.js';
|
|
8
8
|
import { isPathWithin, safeDirectory } from '../fileAccessPolicy.js';
|
|
9
|
-
import { readSettings, patchSettings } from '../settings.js';
|
|
10
9
|
import { workflows } from '../server/state.js';
|
|
11
10
|
import { flushWorkflowBuffer } from '../workflowStore.js';
|
|
12
11
|
import { createResearchFolder, writeProjectFiles } from './researchFolder.js';
|
|
13
12
|
import { closedResearchRecordPath } from './researchClose.js';
|
|
14
13
|
import { addToLibrary, readClosedRecord } from './researchLibrary.js';
|
|
15
|
-
import { beginQuickPromotion, copyWorkspace, finishQuickPromotion, yieldQuickPromotionToMessage, type ActivePromotion } from './quickPromotion.js';
|
|
14
|
+
import { beginQuickPromotion, copyWorkspace, finishQuickPromotion, resolveQuickPromotionRoot, yieldQuickPromotionToMessage, type ActivePromotion } from './quickPromotion.js';
|
|
16
15
|
|
|
17
16
|
interface Journal { projectId: string; source: string; root: string; target?: string; phase: 'waiting' | 'copying' | 'switching' | 'done' | 'error'; message?: string }
|
|
18
17
|
const validId = (id: string) => /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(id);
|
|
@@ -57,12 +56,7 @@ export async function requestSavedQuickPromotion(id: string, folderRoot?: string
|
|
|
57
56
|
const state = await savedRecord(id);
|
|
58
57
|
const source = antigravityChatWorkspace(id);
|
|
59
58
|
if (!state?.quick || !state.closedAt || resolve(state.folder) !== resolve(source) || (await fs.lstat(source)).isSymbolicLink()) throw new Error('This saved Chat has no Quick research to keep.');
|
|
60
|
-
const
|
|
61
|
-
const chosen = settings.researchFolder || folderRoot?.trim();
|
|
62
|
-
if (!chosen || !isAbsolute(chosen)) throw new Error('Choose a research folder.');
|
|
63
|
-
const root = safeDirectory(chosen);
|
|
64
|
-
if (isPathWithin(source, root) || isPathWithin(root, source)) throw new Error('Choose a research folder outside the Quick research workspace.');
|
|
65
|
-
if (!settings.researchFolder) await patchSettings({ researchFolder: root });
|
|
59
|
+
const root = await resolveQuickPromotionRoot(source, folderRoot);
|
|
66
60
|
const journal: Journal = { projectId: id, source, root, phase: 'waiting' };
|
|
67
61
|
await save(journal); schedule(id); return journal;
|
|
68
62
|
});
|
|
@@ -61,14 +61,15 @@ export async function summarizeTurnChanges(cwd: string, from: string, to: string
|
|
|
61
61
|
} catch { return null; }
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
// A timed-out pre-turn capture
|
|
65
|
-
//
|
|
66
|
-
|
|
64
|
+
// A timed-out pre-turn capture is never used: the worker can already be
|
|
65
|
+
// editing by then and the ref is not a safe baseline. `onTimeout` lets the
|
|
66
|
+
// caller cancel it so it stops and publishes nothing.
|
|
67
|
+
export async function timelyCheckpoint<T>(capture: Promise<T | null>, timeoutMs = 2000, onTimeout?: () => void): Promise<T | null> {
|
|
67
68
|
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
68
69
|
try {
|
|
69
70
|
return await Promise.race([
|
|
70
71
|
capture.catch(() => null),
|
|
71
|
-
new Promise<null>(resolve => { timer = setTimeout(() => resolve(null), timeoutMs); }),
|
|
72
|
+
new Promise<null>(resolve => { timer = setTimeout(() => { onTimeout?.(); resolve(null); }, timeoutMs); }),
|
|
72
73
|
]);
|
|
73
74
|
} finally { if (timer) clearTimeout(timer); }
|
|
74
75
|
}
|
|
@@ -2749,7 +2749,10 @@ export async function handleUserMessage(
|
|
|
2749
2749
|
if (!(firstIteration && primitive === 'plan-review') && shouldCaptureTurn({ chatMode, planMode: armPlanMode, isolated: isolatedMember, provider: wf.primary.provider, tools: wf.primary.tools })) {
|
|
2750
2750
|
checkpointGuardSeq = currentWorkflowSeq(cwd, workflowId);
|
|
2751
2751
|
activeTurnObservation = observeCheckoutWriters(workflowWritePaths(wf), wf.manager);
|
|
2752
|
-
|
|
2752
|
+
// A capture that misses the cutoff is cancelled, so it neither keeps
|
|
2753
|
+
// working in the background nor publishes an undo point later.
|
|
2754
|
+
const lateCapture = new AbortController();
|
|
2755
|
+
checkpoint = await timelyCheckpoint((deps.captureCheckpoint ?? createCheckpoint)({ cwd, workflowId, seq: checkpointGuardSeq, onSkipped: onCheckpointSkipped, signal: lateCapture.signal }), 2000, () => lateCapture.abort());
|
|
2753
2756
|
if (!checkpoint || !ownsBusy(wf, busyToken)) {
|
|
2754
2757
|
activeTurnObservation.stop(); activeTurnObservation = undefined;
|
|
2755
2758
|
checkpoint = null;
|