arco-workbench 0.2.2 → 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.
Files changed (46) hide show
  1. package/client/dist/assets/{PhosphorBackdrop-BbR3xmfD.js → PhosphorBackdrop-CHXVFLGT.js} +1 -1
  2. package/client/dist/assets/{ThemedBackgroundShaderImpl-UMjbs9ZN.js → ThemedBackgroundShaderImpl-Bhs4I9jA.js} +1 -1
  3. package/client/dist/assets/{XtermView-n135qz-f.js → XtermView-CdfurwFx.js} +1 -1
  4. package/client/dist/assets/{galleryEditor-CFSke4by.js → galleryEditor-DYjZZ4cf.js} +1 -1
  5. package/client/dist/assets/{index-DeoJbjI3.js → index-BjDmFvqG.js} +219 -219
  6. package/client/dist/index.html +1 -1
  7. package/client/dist/manifest-mobile.webmanifest +1 -0
  8. package/client/src/components/Connections/Connections.tsx +3 -3
  9. package/client/src/components/research/QuickResearchOverview.tsx +7 -3
  10. package/client/src/components/research/SavedQuickKeep.tsx +7 -3
  11. package/client/src/help/content/misc.tsx +2 -2
  12. package/client/src/help/content/rightPanel.tsx +3 -2
  13. package/client/src/help/manualSections/clusters.tsx +1 -1
  14. package/client/src/help/manualSections/powerFeatures.tsx +3 -2
  15. package/client/src/layout/layoutRange.ts +10 -0
  16. package/client/src/main.tsx +2 -0
  17. package/docs/CHECKPOINTS.md +67 -3
  18. package/docs/CLIENT.md +1 -1
  19. package/docs/HTTP_API.md +9 -7
  20. package/docs/PROVIDERS.md +1 -1
  21. package/docs/RESEARCH.md +2 -2
  22. package/node_modules/@arco/shared/package.json +1 -1
  23. package/package.json +2 -2
  24. package/server/dist/explorerDocs.d.ts +1 -0
  25. package/server/dist/explorerDocs.js +4 -4
  26. package/server/dist/gitSnapshots.d.ts +1 -0
  27. package/server/dist/gitSnapshots.js +547 -83
  28. package/server/dist/http/clusterRoutes.js +9 -3
  29. package/server/dist/http/router.js +1 -0
  30. package/server/dist/providers/codexChatBoundary.js +6 -1
  31. package/server/dist/research/quickPromotion.d.ts +3 -0
  32. package/server/dist/research/quickPromotion.js +26 -9
  33. package/server/dist/research/savedQuickPromotion.js +2 -11
  34. package/server/dist/turnChanges.d.ts +1 -1
  35. package/server/dist/turnChanges.js +5 -4
  36. package/server/dist/ws/turnEngine.js +4 -1
  37. package/server/package.json +1 -1
  38. package/server/src/explorerDocs.ts +5 -5
  39. package/server/src/gitSnapshots.ts +538 -82
  40. package/server/src/http/clusterRoutes.ts +10 -3
  41. package/server/src/http/router.ts +1 -0
  42. package/server/src/providers/codexChatBoundary.ts +6 -1
  43. package/server/src/research/quickPromotion.ts +24 -6
  44. package/server/src/research/savedQuickPromotion.ts +2 -8
  45. package/server/src/turnChanges.ts +5 -4
  46. 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';
@@ -23,6 +23,12 @@ import { PORT } from '../server/constants.js';
23
23
  import { workflowCwds, workflows, } from '../server/state.js';
24
24
  import { readMeta, updateMeta } from '../workflowMeta.js';
25
25
  import { formatBoardForModel } from '../project/taskLedger.js';
26
+ function quickPromotionError(error) {
27
+ return {
28
+ error: error instanceof Error ? error.message : 'Could not keep the project.',
29
+ ...(error instanceof QuickPromotionFolderMissingError ? { code: 'research_folder_missing' } : {}),
30
+ };
31
+ }
26
32
  // Cluster / sandbox / codebase-memory route group — peeled verbatim from
27
33
  // router.ts (see docs/ARCHITECTURE.md). Returns true when a route
28
34
  // in this group matched (request answered), false otherwise so the caller
@@ -53,7 +59,7 @@ export async function tryHandleClusterRoutes(req, res, deps) {
53
59
  }
54
60
  }
55
61
  catch (error) {
56
- reply(400, { error: error instanceof Error ? error.message : 'Could not keep the project.' });
62
+ reply(400, quickPromotionError(error));
57
63
  }
58
64
  return true;
59
65
  }
@@ -81,7 +87,7 @@ export async function tryHandleClusterRoutes(req, res, deps) {
81
87
  }
82
88
  }
83
89
  catch (error) {
84
- reply(400, { error: error instanceof Error ? error.message : 'Could not keep the project.' });
90
+ reply(400, quickPromotionError(error));
85
91
  }
86
92
  return true;
87
93
  }
@@ -2233,6 +2233,7 @@ const STATIC_CONTENT_TYPES = {
2233
2233
  '.mjs': 'text/javascript; charset=utf-8',
2234
2234
  '.css': 'text/css; charset=utf-8',
2235
2235
  '.json': 'application/json; charset=utf-8',
2236
+ '.webmanifest': 'application/manifest+json; charset=utf-8',
2236
2237
  '.svg': 'image/svg+xml',
2237
2238
  '.png': 'image/png',
2238
2239
  '.jpg': 'image/jpeg',
@@ -25,7 +25,12 @@ export function supportsCodexChat(probe, web = false) {
25
25
  }
26
26
  catch { /* Unsupported or failed strict configuration probe. */ }
27
27
  return supportedVersion && validated && (!web || listed(probe.listedFeatures ?? '', 'code_mode_host')) && requiredFeatures.every(name => listed(probe.listedFeatures ?? '', name))
28
- && disabledFeatures.filter(name => requiredFeatures.includes(name) || listed(probe.listedFeatures ?? '', name)).every(name => new RegExp(`^${name}\\s+(?:${requiredFeatures.includes(name) || (web && name === 'code_mode_host') ? 'stable|experimental|under development' : 'stable|experimental|under development|removed'})\\s+${web && name === 'code_mode_host'}\\s*$`, 'm').test(probe.features ?? ''))
28
+ && disabledFeatures.filter(name => requiredFeatures.includes(name) || listed(probe.listedFeatures ?? '', name)).every(name => {
29
+ const enabled = web && name === 'code_mode_host';
30
+ const activeStages = 'stable|experimental|under development';
31
+ const stages = requiredFeatures.includes(name) || enabled ? activeStages : `${activeStages}|deprecated|removed`;
32
+ return new RegExp(`^${name}\\s+(?:${stages})\\s+${enabled}\\s*$`, 'm').test(probe.features ?? '');
33
+ })
29
34
  && [probe.execHelp, probe.resumeHelp].every(help => help?.includes('--ignore-user-config') && help.includes('--ignore-rules') && help.includes('--strict-config'));
30
35
  }
31
36
  const cache = new Map();
@@ -18,6 +18,9 @@ export declare function beginQuickPromotion(workflowId: string): ActivePromotion
18
18
  export declare function finishQuickPromotion(workflowId: string, active: ActivePromotion, ready: boolean): void;
19
19
  export declare function yieldQuickPromotionToMessage(workflowId: string): Promise<boolean>;
20
20
  export declare function readQuickPromotion(clusterId: string): Promise<QuickPromotionJournal | null>;
21
+ export declare class QuickPromotionFolderMissingError extends Error {
22
+ }
23
+ export declare function resolveQuickPromotionRoot(source: string, folderRoot?: string): Promise<string>;
21
24
  export declare function requestQuickPromotion(clusterId: string, folderRoot?: string): Promise<QuickPromotionJournal>;
22
25
  export declare function recoverQuickPromotion(journal: QuickPromotionJournal): Promise<QuickPromotionJournal>;
23
26
  export declare function stopQuickPromotionTimer(clusterId: string): boolean;
@@ -65,6 +65,31 @@ function schedule(clusterId) {
65
65
  timer.unref();
66
66
  timers.set(clusterId, timer);
67
67
  }
68
+ export class QuickPromotionFolderMissingError extends Error {
69
+ }
70
+ export async function resolveQuickPromotionRoot(source, folderRoot) {
71
+ const settings = await readSettings();
72
+ const selected = folderRoot?.trim();
73
+ const requested = selected || settings.researchFolder;
74
+ if (!requested || !isAbsolute(requested))
75
+ throw new Error('Choose a research folder.');
76
+ let root;
77
+ try {
78
+ root = safeDirectory(requested);
79
+ }
80
+ catch (error) {
81
+ if (error.code !== 'ENOENT')
82
+ throw error;
83
+ throw new QuickPromotionFolderMissingError(selected
84
+ ? 'The folder you chose is gone. Choose another folder.'
85
+ : 'The saved research folder is gone. Choose a new folder to keep this research.');
86
+ }
87
+ if (isPathWithin(source, root) || isPathWithin(root, source))
88
+ throw new Error('Choose a research folder outside the Quick research workspace.');
89
+ if (selected && root !== settings.researchFolder)
90
+ await patchSettings({ researchFolder: root });
91
+ return root;
92
+ }
68
93
  export async function requestQuickPromotion(clusterId, folderRoot) {
69
94
  return withFileLock(journalPath(clusterId), async () => {
70
95
  const current = await readQuickPromotion(clusterId);
@@ -75,15 +100,7 @@ export async function requestQuickPromotion(clusterId, folderRoot) {
75
100
  throw new Error('This is not an open Quick research.');
76
101
  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())
77
102
  throw new Error('The Quick research workspace is unavailable.');
78
- const settings = await readSettings();
79
- const requested = settings.researchFolder || folderRoot?.trim();
80
- if (!requested || !isAbsolute(requested))
81
- throw new Error('Choose a research folder.');
82
- const root = safeDirectory(requested);
83
- if (isPathWithin(state.folder, root) || isPathWithin(root, state.folder))
84
- throw new Error('Choose a research folder outside the Quick research workspace.');
85
- if (!settings.researchFolder)
86
- await patchSettings({ researchFolder: root });
103
+ const root = await resolveQuickPromotionRoot(state.folder, folderRoot);
87
104
  const journal = { clusterId, projectId: state.projectId, directorWorkflowId: state.directorWorkflowId, source: state.folder, root, phase: 'waiting' };
88
105
  await save(journal);
89
106
  schedule(clusterId);
@@ -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 } from './quickPromotion.js';
14
+ import { beginQuickPromotion, copyWorkspace, finishQuickPromotion, resolveQuickPromotionRoot, yieldQuickPromotionToMessage } from './quickPromotion.js';
16
15
  const validId = (id) => /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(id);
17
16
  const pathFor = (id) => join(arcoHome(), 'research', 'closed-promotions', `${id}.json`);
18
17
  const timers = new Map();
@@ -71,15 +70,7 @@ export async function requestSavedQuickPromotion(id, folderRoot) {
71
70
  const source = antigravityChatWorkspace(id);
72
71
  if (!state?.quick || !state.closedAt || resolve(state.folder) !== resolve(source) || (await fs.lstat(source)).isSymbolicLink())
73
72
  throw new Error('This saved Chat has no Quick research to keep.');
74
- const settings = await readSettings();
75
- const chosen = settings.researchFolder || folderRoot?.trim();
76
- if (!chosen || !isAbsolute(chosen))
77
- throw new Error('Choose a research folder.');
78
- const root = safeDirectory(chosen);
79
- if (isPathWithin(source, root) || isPathWithin(root, source))
80
- throw new Error('Choose a research folder outside the Quick research workspace.');
81
- if (!settings.researchFolder)
82
- await patchSettings({ researchFolder: root });
73
+ const root = await resolveQuickPromotionRoot(source, folderRoot);
83
74
  const journal = { projectId: id, source, root, phase: 'waiting' };
84
75
  await save(journal);
85
76
  schedule(id);
@@ -8,7 +8,7 @@ export interface TurnChangeSummary {
8
8
  }
9
9
  export declare function parseTurnNumstat(output: string): TurnChangeSummary | null;
10
10
  export declare function summarizeTurnChanges(cwd: string, from: string, to: string): Promise<TurnChangeSummary | null>;
11
- export declare function timelyCheckpoint<T>(capture: Promise<T | null>, timeoutMs?: number): Promise<T | null>;
11
+ export declare function timelyCheckpoint<T>(capture: Promise<T | null>, timeoutMs?: number, onTimeout?: () => void): Promise<T | null>;
12
12
  export declare function shouldCaptureTurn(opts: {
13
13
  chatMode: boolean;
14
14
  planMode: boolean;
@@ -62,14 +62,15 @@ export async function summarizeTurnChanges(cwd, from, to) {
62
62
  return null;
63
63
  }
64
64
  }
65
- // A timed-out pre-turn capture may finish later, but its result is discarded:
66
- // the worker can already be editing by then and the ref is not a safe baseline.
67
- export async function timelyCheckpoint(capture, timeoutMs = 2000) {
65
+ // A timed-out pre-turn capture is never used: the worker can already be
66
+ // editing by then and the ref is not a safe baseline. `onTimeout` lets the
67
+ // caller cancel it so it stops and publishes nothing.
68
+ export async function timelyCheckpoint(capture, timeoutMs = 2000, onTimeout) {
68
69
  let timer;
69
70
  try {
70
71
  return await Promise.race([
71
72
  capture.catch(() => null),
72
- new Promise(resolve => { timer = setTimeout(() => resolve(null), timeoutMs); }),
73
+ new Promise(resolve => { timer = setTimeout(() => { onTimeout?.(); resolve(null); }, timeoutMs); }),
73
74
  ]);
74
75
  }
75
76
  finally {
@@ -2659,7 +2659,10 @@ opts) {
2659
2659
  if (!(firstIteration && primitive === 'plan-review') && shouldCaptureTurn({ chatMode, planMode: armPlanMode, isolated: isolatedMember, provider: wf.primary.provider, tools: wf.primary.tools })) {
2660
2660
  checkpointGuardSeq = currentWorkflowSeq(cwd, workflowId);
2661
2661
  activeTurnObservation = observeCheckoutWriters(workflowWritePaths(wf), wf.manager);
2662
- checkpoint = await timelyCheckpoint((deps.captureCheckpoint ?? createCheckpoint)({ cwd, workflowId, seq: checkpointGuardSeq, onSkipped: onCheckpointSkipped }));
2662
+ // A capture that misses the cutoff is cancelled, so it neither keeps
2663
+ // working in the background nor publishes an undo point later.
2664
+ const lateCapture = new AbortController();
2665
+ checkpoint = await timelyCheckpoint((deps.captureCheckpoint ?? createCheckpoint)({ cwd, workflowId, seq: checkpointGuardSeq, onSkipped: onCheckpointSkipped, signal: lateCapture.signal }), 2000, () => lateCapture.abort());
2663
2666
  if (!checkpoint || !ownsBusy(wf, busyToken)) {
2664
2667
  activeTurnObservation.stop();
2665
2668
  activeTurnObservation = undefined;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arco/server",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "private": true,
5
5
  "type": "module"
6
6
  }
@@ -89,8 +89,7 @@ export async function collectProjectDocs(project: string, limit = 1000): Promise
89
89
  return (await collectProjectDocsPage(project, limit)).entries;
90
90
  }
91
91
 
92
- async function collectScopedDocs(project: string): Promise<DocsPage> {
93
- const budget = scanBudget();
92
+ async function collectScopedDocs(project: string, budget = scanBudget()): Promise<DocsPage> {
94
93
  const out: DocEntry[] = [];
95
94
  const root = await scanBeforeDeadline(realpathWithinHome(project), budget);
96
95
  if (root) await scanDocuments(root, root, budget, out, file => confinedPath(file, [root], 'file'));
@@ -120,9 +119,10 @@ async function collectScopedDocs(project: string): Promise<DocsPage> {
120
119
 
121
120
  // Global doc scan across known projects, bounded per-project so a home load over
122
121
  // dozens of projects stays responsive. `project` scopes to one (full limit).
123
- export async function collectDocsPage(opts: { project?: string } = {}): Promise<DocsPage> {
124
- if (opts.project) return collectScopedDocs(opts.project);
125
- const global = scanBudget(50_000, 650);
122
+ // `budget` replaces the default scan budget; routes always use the defaults.
123
+ export async function collectDocsPage(opts: { project?: string; budget?: ScanBudget } = {}): Promise<DocsPage> {
124
+ if (opts.project) return collectScopedDocs(opts.project, opts.budget);
125
+ const global = opts.budget ?? scanBudget(50_000, 650);
126
126
  const known = await scanBeforeDeadline(readKnownCwds(), global);
127
127
  if (!known) return { entries: [], partial: true };
128
128
  const cwds = [...new Set(known)];