arco-workbench 0.1.3 → 0.1.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 +1 -1
- package/README.md +5 -1
- package/client/dist/assets/{PhosphorBackdrop-CkVIGkeX.js → PhosphorBackdrop-CNumba2X.js} +1 -1
- package/client/dist/assets/{ThemedBackgroundShaderImpl-DHF7CnpE.js → ThemedBackgroundShaderImpl-DX5KyCt3.js} +1 -1
- package/client/dist/assets/{XtermView-SY0UcZUS.js → XtermView-DhS5g8Rt.js} +1 -1
- package/client/dist/assets/{galleryEditor-Ca4F8HiM.js → galleryEditor-fPb76Cjv.js} +1 -1
- package/client/dist/assets/index-CjkHb-_n.js +592 -0
- package/client/dist/assets/index-DIbh3ae5.css +1 -0
- package/client/dist/index.html +2 -2
- package/client/src/App.tsx +2 -0
- package/client/src/alerts/desktopAlerts.ts +13 -1
- package/client/src/brief/briefFacts.ts +22 -0
- package/client/src/brief/briefFromStore.ts +7 -2
- package/client/src/components/ArtifactMoveDialog.tsx +64 -0
- package/client/src/components/BriefControl.tsx +38 -47
- package/client/src/components/CatchMeUp.tsx +25 -25
- package/client/src/components/CheckpointActions.tsx +7 -4
- package/client/src/components/ClusterComposerButtons.tsx +6 -3
- package/client/src/components/ClusterPlanTab.tsx +15 -1
- package/client/src/components/ClusterRightPanel/AutoPickupControl.tsx +6 -2
- package/client/src/components/ClusterTab.tsx +33 -3
- package/client/src/components/ClusterTaskBoardTab.tsx +62 -8
- package/client/src/components/DialogShell.tsx +115 -0
- package/client/src/components/DocsUpdateDialog.tsx +16 -42
- package/client/src/components/ForwardMessages.tsx +28 -32
- package/client/src/components/GitDialog.tsx +52 -52
- package/client/src/components/GitOtherWork.tsx +4 -2
- package/client/src/components/HandoffDialog.tsx +19 -45
- package/client/src/components/Home/HomeView.tsx +36 -8
- package/client/src/components/Home/home.css +7 -0
- package/client/src/components/KeepButton.tsx +23 -0
- package/client/src/components/MdTuneupDialog.tsx +52 -51
- package/client/src/components/MemberCard.tsx +4 -1
- package/client/src/components/MemberPane.tsx +1 -1
- package/client/src/components/NotificationCenter.tsx +4 -3
- package/client/src/components/NotificationChannelsSettings.tsx +25 -7
- package/client/src/components/PlanCandidateBanner.tsx +111 -57
- package/client/src/components/PlanComposerDialog.tsx +55 -87
- package/client/src/components/ProjectStateNotice.tsx +60 -0
- package/client/src/components/PublicProjectBox.tsx +25 -0
- package/client/src/components/ResearchDialog.tsx +15 -24
- package/client/src/components/ReviewDialog.tsx +32 -57
- package/client/src/components/RightPanel/OutputsPanel.tsx +4 -0
- package/client/src/components/RightPanel/PlanTab.tsx +24 -2
- package/client/src/components/RightPanel/UsageTab.tsx +77 -1
- package/client/src/components/SkillEditorDialog.tsx +38 -73
- package/client/src/components/SpawnDialog.tsx +19 -41
- package/client/src/components/StorageWarnings.tsx +21 -0
- package/client/src/components/SystemHeader.tsx +2 -2
- package/client/src/components/TerminalInput.tsx +6 -2
- package/client/src/components/TidyComposer.tsx +24 -41
- package/client/src/components/TranscriptSendDialog.tsx +151 -202
- package/client/src/components/UtilityAgentPicker.tsx +4 -2
- package/client/src/components/WorkflowCreator/index.tsx +2 -0
- package/client/src/components/WorkflowView.tsx +4 -1
- package/client/src/components/clusterNeedsYou.ts +35 -3
- package/client/src/components/compare/CompareDialog.tsx +26 -2
- package/client/src/components/terminalInput/planDraft.ts +33 -4
- package/client/src/components/utilityResult.ts +5 -1
- package/client/src/explorer/ExplorerApp.tsx +5 -2
- package/client/src/explorer/PlansLens.tsx +60 -19
- package/client/src/explorer/StorageLens.tsx +275 -0
- package/client/src/explorer/launch.ts +3 -3
- package/client/src/explorer/plansGrouping.ts +15 -0
- package/client/src/help/content/cluster.tsx +42 -7
- package/client/src/help/content/composer.tsx +26 -6
- package/client/src/help/content/header.tsx +16 -14
- package/client/src/help/content/misc.tsx +141 -6
- package/client/src/help/content/rightPanel.tsx +16 -0
- package/client/src/help/content/settings.tsx +4 -4
- package/client/src/help/manualSections/actions.tsx +19 -4
- package/client/src/help/manualSections/clusters.tsx +29 -16
- package/client/src/help/manualSections/configuration.tsx +6 -4
- package/client/src/help/manualSections/maintenance.tsx +27 -5
- package/client/src/help/manualSections/plans.tsx +96 -2
- package/client/src/help/manualSections/powerFeatures.tsx +2 -2
- package/client/src/help/manualSections/reference.tsx +6 -0
- package/client/src/help/manualSections/workspace.tsx +9 -5
- package/client/src/stores/appStore.ts +10 -1
- package/client/src/stores/appStore.types.ts +2 -0
- package/client/src/stores/mdTuneupStore.ts +5 -4
- package/client/src/stores/memoryTrim.ts +18 -2
- package/client/src/stores/storageWarningStore.ts +18 -0
- package/client/src/utils/gitDialogMemory.ts +26 -0
- package/client/src/utils/historyEvents.ts +1 -0
- package/client/src/utils/homeModel.ts +19 -0
- package/client/src/utils/publicProject.ts +56 -0
- package/client/src/ws/handleServerMessage.ts +7 -2
- package/docs/ARCHITECTURE.md +1 -1
- package/docs/CHECKPOINTS.md +2 -0
- package/docs/CLIENT.md +29 -11
- package/docs/FEATURES.md +14 -11
- package/docs/GETTING_STARTED.md +7 -7
- package/docs/GLOSSARY.md +3 -3
- package/docs/GOTCHAS.md +3 -2
- package/docs/HTTP_API.md +31 -1
- package/docs/NOTIFICATIONS.md +13 -14
- package/docs/OPERATIONS.md +27 -1
- package/docs/OPERATOR_ACTIONS.md +1 -1
- package/docs/OUTPUTS.md +9 -0
- package/docs/PERSISTENCE.md +34 -4
- package/docs/PLAN_OR_BOARD.md +7 -0
- package/docs/PRIMITIVES.md +3 -3
- package/docs/PROTOCOL.md +14 -4
- package/docs/PROTOCOL_CLUSTER.md +3 -2
- package/docs/SERVICE_MODE.md +5 -1
- package/docs/SETTINGS.md +8 -6
- package/docs/STORAGE_PLAN.md +324 -0
- package/docs/TASK_LEDGER.md +5 -4
- package/native/linux-arm64/manifest.json +1 -1
- package/node_modules/@arco/shared/dist/index.d.ts +2 -0
- package/node_modules/@arco/shared/dist/index.js +2 -0
- package/node_modules/@arco/shared/dist/protocol/autoPickup.d.ts +1 -1
- package/node_modules/@arco/shared/dist/protocol/autoPickup.js +1 -1
- package/node_modules/@arco/shared/dist/protocol/checkpoints.d.ts +1 -0
- package/node_modules/@arco/shared/dist/protocol/clusters.d.ts +2 -1
- package/node_modules/@arco/shared/dist/protocol/index.d.ts +1 -0
- package/node_modules/@arco/shared/dist/protocol/index.js +1 -0
- package/node_modules/@arco/shared/dist/protocol/mdTuneup.d.ts +6 -0
- package/node_modules/@arco/shared/dist/protocol/notifications.d.ts +2 -1
- package/node_modules/@arco/shared/dist/protocol/notifications.js +3 -2
- package/node_modules/@arco/shared/dist/protocol/plans.d.ts +2 -0
- package/node_modules/@arco/shared/dist/protocol/serverMessages.d.ts +2 -1
- package/node_modules/@arco/shared/dist/protocol/storage.d.ts +21 -0
- package/node_modules/@arco/shared/dist/protocol/storage.js +3 -0
- package/node_modules/@arco/shared/dist/protocol/tasks.d.ts +3 -0
- package/node_modules/@arco/shared/dist/protocol/utilityAgent.d.ts +2 -2
- package/node_modules/@arco/shared/dist/protocol/utilityAgent.js +2 -2
- package/node_modules/@arco/shared/dist/publicGuardrails.d.ts +7 -0
- package/node_modules/@arco/shared/dist/publicGuardrails.js +47 -0
- package/node_modules/@arco/shared/dist/publicSafetyRules.d.ts +1 -0
- package/node_modules/@arco/shared/dist/publicSafetyRules.js +6 -0
- package/node_modules/@arco/shared/package.json +1 -1
- package/package.json +3 -2
- package/scripts/packaging/arco.mjs +17 -1
- package/scripts/packaging/services.mjs +35 -5
- package/scripts/packaging/storage.mjs +125 -0
- package/scripts/packaging/update.mjs +3 -3
- package/server/dist/artifactCopy.d.ts +26 -0
- package/server/dist/artifactCopy.js +398 -0
- package/server/dist/atomicFile.d.ts +1 -0
- package/server/dist/atomicFile.js +1 -1
- package/server/dist/attention.d.ts +1 -1
- package/server/dist/attention.js +10 -13
- package/server/dist/catchUp.d.ts +2 -0
- package/server/dist/catchUp.js +46 -23
- package/server/dist/clusterPeerOps.d.ts +2 -0
- package/server/dist/clusterPeerOps.js +2 -0
- package/server/dist/clusterSnapshots.js +22 -12
- package/server/dist/eventLog.d.ts +55 -0
- package/server/dist/eventLog.js +792 -0
- package/server/dist/explorerLaunch.d.ts +4 -1
- package/server/dist/explorerLaunch.js +3 -2
- package/server/dist/explorerPlans.d.ts +4 -0
- package/server/dist/explorerPlans.js +27 -2
- package/server/dist/http/clusterRoutes.js +2 -0
- package/server/dist/http/explorerRoutes.js +2 -1
- package/server/dist/http/publicProjectRoutes.d.ts +2 -0
- package/server/dist/http/publicProjectRoutes.js +68 -0
- package/server/dist/http/router.js +6 -0
- package/server/dist/http/storageRoutes.d.ts +2 -0
- package/server/dist/http/storageRoutes.js +254 -0
- package/server/dist/http/usageStatsRoutes.js +3 -12
- package/server/dist/index.js +4 -0
- package/server/dist/keepStore.d.ts +16 -0
- package/server/dist/keepStore.js +119 -0
- package/server/dist/management/clusterActivity.js +6 -20
- package/server/dist/management/initHubLink.js +10 -43
- package/server/dist/mcp/clusterMcpTools.js +8 -1
- package/server/dist/notifications.d.ts +3 -1
- package/server/dist/notifications.js +5 -4
- package/server/dist/outputStore.d.ts +1 -0
- package/server/dist/outputStore.js +1 -1
- package/server/dist/outputs.js +39 -8
- package/server/dist/planHistory.d.ts +3 -0
- package/server/dist/planHistory.js +60 -0
- package/server/dist/primitives/runMdTuneup.d.ts +5 -1
- package/server/dist/primitives/runMdTuneup.js +43 -2
- package/server/dist/project/taskLedger.d.ts +4 -0
- package/server/dist/project/taskLedger.js +19 -0
- package/server/dist/providers/claude-native/peerTools.js +4 -0
- package/server/dist/providers/claude-native/resumeSummary.js +30 -19
- package/server/dist/providers/index.js +8 -13
- package/server/dist/providers/localProviderQueue.d.ts +2 -0
- package/server/dist/providers/localProviderQueue.js +11 -0
- package/server/dist/publicProject.d.ts +54 -0
- package/server/dist/publicProject.js +135 -0
- package/server/dist/recall/index.js +22 -23
- package/server/dist/server/broadcast.d.ts +2 -1
- package/server/dist/server/broadcast.js +56 -1
- package/server/dist/smartPickupAdapters.d.ts +7 -0
- package/server/dist/smartPickupAdapters.js +172 -8
- package/server/dist/storageActions.d.ts +50 -0
- package/server/dist/storageActions.js +326 -0
- package/server/dist/storageArchive.d.ts +24 -0
- package/server/dist/storageArchive.js +358 -0
- package/server/dist/storageOverview.d.ts +47 -0
- package/server/dist/storageOverview.js +197 -0
- package/server/dist/storageReport.d.ts +48 -0
- package/server/dist/storageReport.js +185 -0
- package/server/dist/storageWarnings.d.ts +4 -0
- package/server/dist/storageWarnings.js +96 -0
- package/server/dist/workers/limits.js +4 -1
- package/server/dist/workflowStore.d.ts +2 -0
- package/server/dist/workflowStore.js +88 -72
- package/server/dist/workflows/purgeWorkflow.d.ts +1 -0
- package/server/dist/workflows/purgeWorkflow.js +15 -2
- package/server/dist/workflows/sessionDiscovery.js +5 -17
- package/server/dist/workflows/sessionIndex.js +22 -17
- package/server/dist/ws/taskLedgerHandlers.js +8 -3
- package/server/dist/ws/workflowHandlers.js +5 -4
- package/server/package.json +1 -1
- package/server/src/artifactCopy.ts +254 -0
- package/server/src/atomicFile.ts +1 -1
- package/server/src/attention.ts +9 -10
- package/server/src/catchUp.ts +37 -15
- package/server/src/clusterPeerOps.ts +5 -0
- package/server/src/clusterSnapshots.ts +20 -13
- package/server/src/eventLog.ts +571 -0
- package/server/src/explorerLaunch.ts +3 -2
- package/server/src/explorerPlans.ts +22 -2
- package/server/src/http/clusterRoutes.ts +4 -1
- package/server/src/http/explorerRoutes.ts +2 -1
- package/server/src/http/publicProjectRoutes.ts +54 -0
- package/server/src/http/router.ts +4 -0
- package/server/src/http/storageRoutes.ts +187 -0
- package/server/src/http/usageStatsRoutes.ts +3 -11
- package/server/src/index.ts +4 -0
- package/server/src/keepStore.ts +102 -0
- package/server/src/management/clusterActivity.ts +6 -16
- package/server/src/management/initHubLink.ts +10 -39
- package/server/src/mcp/clusterMcpTools.ts +8 -2
- package/server/src/notifications.ts +4 -3
- package/server/src/outputStore.ts +5 -2
- package/server/src/outputs.ts +30 -6
- package/server/src/planHistory.ts +48 -0
- package/server/src/primitives/runMdTuneup.ts +32 -2
- package/server/src/project/taskLedger.ts +20 -0
- package/server/src/providers/claude-native/peerTools.ts +4 -0
- package/server/src/providers/claude-native/resumeSummary.ts +32 -18
- package/server/src/providers/index.ts +2 -16
- package/server/src/providers/localProviderQueue.ts +13 -0
- package/server/src/publicProject.ts +142 -0
- package/server/src/recall/index.ts +4 -9
- package/server/src/server/broadcast.ts +53 -1
- package/server/src/smartPickupAdapters.ts +128 -5
- package/server/src/storageActions.ts +216 -0
- package/server/src/storageArchive.ts +277 -0
- package/server/src/storageOverview.ts +184 -0
- package/server/src/storageReport.ts +210 -0
- package/server/src/storageWarnings.ts +84 -0
- package/server/src/workers/limits.ts +4 -1
- package/server/src/workflowStore.ts +78 -61
- package/server/src/workflows/purgeWorkflow.ts +12 -3
- package/server/src/workflows/sessionDiscovery.ts +5 -13
- package/server/src/workflows/sessionIndex.ts +5 -9
- package/server/src/ws/taskLedgerHandlers.ts +8 -3
- package/server/src/ws/workflowHandlers.ts +5 -4
- package/shared/dist/index.d.ts +2 -0
- package/shared/dist/index.js +2 -0
- package/shared/dist/protocol/autoPickup.d.ts +1 -1
- package/shared/dist/protocol/autoPickup.js +1 -1
- package/shared/dist/protocol/checkpoints.d.ts +1 -0
- package/shared/dist/protocol/clusters.d.ts +2 -1
- package/shared/dist/protocol/index.d.ts +1 -0
- package/shared/dist/protocol/index.js +1 -0
- package/shared/dist/protocol/mdTuneup.d.ts +6 -0
- package/shared/dist/protocol/notifications.d.ts +2 -1
- package/shared/dist/protocol/notifications.js +3 -2
- package/shared/dist/protocol/plans.d.ts +2 -0
- package/shared/dist/protocol/serverMessages.d.ts +2 -1
- package/shared/dist/protocol/storage.d.ts +21 -0
- package/shared/dist/protocol/storage.js +3 -0
- package/shared/dist/protocol/tasks.d.ts +3 -0
- package/shared/dist/protocol/utilityAgent.d.ts +2 -2
- package/shared/dist/protocol/utilityAgent.js +2 -2
- package/shared/dist/publicGuardrails.d.ts +7 -0
- package/shared/dist/publicGuardrails.js +47 -0
- package/shared/dist/publicSafetyRules.d.ts +1 -0
- package/shared/dist/publicSafetyRules.js +6 -0
- package/shared/src/index.ts +3 -0
- package/shared/src/protocol/autoPickup.ts +1 -1
- package/shared/src/protocol/checkpoints.ts +4 -0
- package/shared/src/protocol/clusters.ts +6 -1
- package/shared/src/protocol/index.ts +1 -0
- package/shared/src/protocol/mdTuneup.ts +5 -0
- package/shared/src/protocol/notifications.ts +6 -2
- package/shared/src/protocol/plans.ts +2 -0
- package/shared/src/protocol/serverMessages.ts +2 -0
- package/shared/src/protocol/storage.ts +35 -0
- package/shared/src/protocol/tasks.ts +6 -0
- package/shared/src/protocol/utilityAgent.ts +2 -2
- package/shared/src/publicGuardrails.ts +50 -0
- package/shared/src/publicSafetyRules.ts +5 -0
- package/client/dist/assets/index-CcNtMA2y.js +0 -546
- package/client/dist/assets/index-Dl8tYsSp.css +0 -1
|
@@ -2,6 +2,7 @@ import { ensureProjectStateIgnore } from '../../projectStateIgnore.js';
|
|
|
2
2
|
import { promises as fs } from 'node:fs';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
import { atomicWriteFile } from '../../atomicFile.js';
|
|
5
|
+
import { listSegments, readLogText } from '../../eventLog.js';
|
|
5
6
|
import { serverFoldSeed } from './serverFold.js';
|
|
6
7
|
const SUMMARY_CACHE_VERSION = 1;
|
|
7
8
|
const SUMMARY_CACHE_KIND = 'claude-native-resume-summary';
|
|
@@ -25,6 +26,23 @@ function eventsPath(cwd, workflowId) {
|
|
|
25
26
|
function summaryCachePath(cwd, workflowId) {
|
|
26
27
|
return join(workflowDir(cwd, workflowId), 'resume-summary.json');
|
|
27
28
|
}
|
|
29
|
+
async function openLogSource(cwd, workflowId) {
|
|
30
|
+
const dir = workflowDir(cwd, workflowId);
|
|
31
|
+
if ((await listSegments(dir)).length > 0) {
|
|
32
|
+
const text = Buffer.from(await readLogText(dir), 'utf8');
|
|
33
|
+
return { size: text.length, read: async (start, length) => text.subarray(start, start + length).toString('utf8') };
|
|
34
|
+
}
|
|
35
|
+
const path = eventsPath(cwd, workflowId);
|
|
36
|
+
try {
|
|
37
|
+
const size = (await fs.stat(path)).size;
|
|
38
|
+
return { size, read: (start, length) => readByteRange(path, start, length) };
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
if (err.code === 'ENOENT')
|
|
42
|
+
return null;
|
|
43
|
+
throw err;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
28
46
|
async function readByteRange(path, start, length) {
|
|
29
47
|
const fh = await fs.open(path, 'r');
|
|
30
48
|
try {
|
|
@@ -36,11 +54,11 @@ async function readByteRange(path, start, length) {
|
|
|
36
54
|
await fh.close();
|
|
37
55
|
}
|
|
38
56
|
}
|
|
39
|
-
async function findTailReplayStart(
|
|
57
|
+
async function findTailReplayStart(source, desiredStart) {
|
|
40
58
|
if (desiredStart <= 0)
|
|
41
59
|
return { start: 0, completeLine: true };
|
|
42
60
|
const probeStart = Math.max(0, desiredStart - TAIL_LINE_BACKTRACK_BYTES);
|
|
43
|
-
const raw = await
|
|
61
|
+
const raw = await source.read(probeStart, desiredStart - probeStart);
|
|
44
62
|
const lines = raw.split('\n');
|
|
45
63
|
let cursor = probeStart;
|
|
46
64
|
let turnStart = null;
|
|
@@ -420,17 +438,10 @@ async function writeSummaryCache(cwd, path, cache) {
|
|
|
420
438
|
}
|
|
421
439
|
}
|
|
422
440
|
export async function replayMessagesWithResumePolicy(cwd, workflowId, maxSeq, opts = {}) {
|
|
423
|
-
const
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
}
|
|
428
|
-
catch (err) {
|
|
429
|
-
if (err.code === 'ENOENT') {
|
|
430
|
-
return { messages: [], mode: 'empty', eventBytes: 0 };
|
|
431
|
-
}
|
|
432
|
-
throw err;
|
|
433
|
-
}
|
|
441
|
+
const source = await openLogSource(cwd, workflowId);
|
|
442
|
+
if (!source)
|
|
443
|
+
return { messages: [], mode: 'empty', eventBytes: 0 };
|
|
444
|
+
const stat = { size: source.size };
|
|
434
445
|
const exactReplayBytes = opts.exactReplayBytes ?? RESUME_EXACT_REPLAY_BYTES;
|
|
435
446
|
const recentTailBytes = opts.recentTailBytes ?? RESUME_RECENT_TAIL_BYTES;
|
|
436
447
|
// docs/PERSISTENCE.md - branch-aware replay. `meta.leafSeq` being set
|
|
@@ -447,7 +458,7 @@ export async function replayMessagesWithResumePolicy(cwd, workflowId, maxSeq, op
|
|
|
447
458
|
// This is what lets post-rewind turns be included WITHOUT advancing leafSeq
|
|
448
459
|
// on every turn.
|
|
449
460
|
if (typeof opts.leafSeq === 'number') {
|
|
450
|
-
const raw = await
|
|
461
|
+
const raw = await source.read(0, stat.size);
|
|
451
462
|
const events = parseJsonl(raw);
|
|
452
463
|
let tailSeq;
|
|
453
464
|
for (const e of events) {
|
|
@@ -464,7 +475,7 @@ export async function replayMessagesWithResumePolicy(cwd, workflowId, maxSeq, op
|
|
|
464
475
|
};
|
|
465
476
|
}
|
|
466
477
|
if (stat.size <= exactReplayBytes) {
|
|
467
|
-
const raw = await
|
|
478
|
+
const raw = await source.read(0, stat.size);
|
|
468
479
|
const events = parseJsonl(raw);
|
|
469
480
|
return {
|
|
470
481
|
messages: buildMessagesFromReplayEvents(events, [], maxSeq),
|
|
@@ -476,7 +487,7 @@ export async function replayMessagesWithResumePolicy(cwd, workflowId, maxSeq, op
|
|
|
476
487
|
// behavior so Spawn-from-here callers do not inherit a summary past maxSeq.
|
|
477
488
|
if (typeof maxSeq === 'number') {
|
|
478
489
|
const start = Math.max(0, stat.size - recentTailBytes);
|
|
479
|
-
const raw = await
|
|
490
|
+
const raw = await source.read(start, stat.size - start);
|
|
480
491
|
const events = parseJsonl(raw, { dropFirstPartial: start > 0 });
|
|
481
492
|
return {
|
|
482
493
|
messages: buildMessagesFromReplayEvents(events, [], maxSeq),
|
|
@@ -486,14 +497,14 @@ export async function replayMessagesWithResumePolicy(cwd, workflowId, maxSeq, op
|
|
|
486
497
|
};
|
|
487
498
|
}
|
|
488
499
|
const desiredTailStartByte = Math.max(0, stat.size - recentTailBytes);
|
|
489
|
-
const tailStart = await findTailReplayStart(
|
|
500
|
+
const tailStart = await findTailReplayStart(source, desiredTailStartByte);
|
|
490
501
|
const tailStartByte = tailStart.start;
|
|
491
|
-
const tailRaw = await
|
|
502
|
+
const tailRaw = await source.read(tailStartByte, stat.size - tailStartByte);
|
|
492
503
|
const tailEvents = parseJsonl(tailRaw, { dropFirstPartial: !tailStart.completeLine });
|
|
493
504
|
const cachePath = summaryCachePath(cwd, workflowId);
|
|
494
505
|
let cache = await readSummaryCache(cachePath, workflowId, stat.size, tailStartByte);
|
|
495
506
|
if (!cache) {
|
|
496
|
-
const olderRaw = tailStartByte > 0 ? await
|
|
507
|
+
const olderRaw = tailStartByte > 0 ? await source.read(0, tailStartByte) : '';
|
|
497
508
|
const olderEvents = parseJsonl(olderRaw, { dropLastPartial: !tailStart.completeLine });
|
|
498
509
|
const built = summarizeClaudeNativePriorTurns(olderEvents);
|
|
499
510
|
cache = {
|
|
@@ -7,6 +7,7 @@ import { CodexAppServerProvider, disposeCodexAppServerWorker } from './codex-app
|
|
|
7
7
|
import { ClaudeNativeProvider, disposeClaudeNativeWorker } from './claude-native/index.js';
|
|
8
8
|
import { LlamacppProvider } from './llamacpp.js';
|
|
9
9
|
import { isLocalModelProvider, localModelsUnloading, localModelBusyMessage } from './localModelControl.js';
|
|
10
|
+
import { queueLocalProvider } from './localProviderQueue.js';
|
|
10
11
|
import { DeepSeekProvider } from './deepseek.js';
|
|
11
12
|
import { StrataProvider } from './strata.js';
|
|
12
13
|
import { LmstudioProvider } from './lmstudio.js';
|
|
@@ -22,13 +23,12 @@ const PROVIDERS = {
|
|
|
22
23
|
deepseek: DeepSeekProvider,
|
|
23
24
|
cursor: CursorProvider,
|
|
24
25
|
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
};
|
|
26
|
+
// M13 — LM Studio joins ollama/llamacpp on the serial local queue. LM Studio's
|
|
27
|
+
// app typically serves one loaded model at a time on the configured endpoint,
|
|
28
|
+
// so running multiple Arco turns against it concurrently would contend on the
|
|
29
|
+
// same backend; serializing matches the local-runtime pattern. (Override the
|
|
30
|
+
// serial behavior via ARCO_LOCAL_PROVIDER_SERIAL_QUEUE=0, except Strata:
|
|
31
|
+
// its profile manager requires the slot for the entire tool loop.)
|
|
32
32
|
class QueuedLocalProcess extends EventEmitter {
|
|
33
33
|
id;
|
|
34
34
|
providerName;
|
|
@@ -80,12 +80,7 @@ class QueuedLocalProcess extends EventEmitter {
|
|
|
80
80
|
inner.kill();
|
|
81
81
|
});
|
|
82
82
|
};
|
|
83
|
-
|
|
84
|
-
let release;
|
|
85
|
-
localQueues[this.providerName] = new Promise((resolve) => { release = resolve; });
|
|
86
|
-
void prior
|
|
87
|
-
.then(run, run)
|
|
88
|
-
.finally(() => release());
|
|
83
|
+
void queueLocalProvider(this.providerName, run);
|
|
89
84
|
this.emit('system_notice', `${this.providerName} local slot queued; Arco runs one ${this.providerName} worker at a time`);
|
|
90
85
|
}
|
|
91
86
|
kill() {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const queues = {
|
|
2
|
+
ollama: Promise.resolve(), llamacpp: Promise.resolve(), lmstudio: Promise.resolve(),
|
|
3
|
+
strata: Promise.resolve(), deepseek: Promise.resolve(),
|
|
4
|
+
};
|
|
5
|
+
export function queueLocalProvider(provider, run) {
|
|
6
|
+
const prior = queues[provider];
|
|
7
|
+
let release;
|
|
8
|
+
queues[provider] = new Promise((resolve) => { release = resolve; });
|
|
9
|
+
return prior.then(run, run).finally(release);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=localProviderQueue.js.map
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export declare const PUBLIC_HOSTS: string[];
|
|
2
|
+
export interface ParsedRemote {
|
|
3
|
+
name: string;
|
|
4
|
+
host: string;
|
|
5
|
+
owner: string;
|
|
6
|
+
repo: string;
|
|
7
|
+
}
|
|
8
|
+
export type RemoteSuggestion = {
|
|
9
|
+
state: 'none';
|
|
10
|
+
} | {
|
|
11
|
+
state: 'hosted';
|
|
12
|
+
host: string;
|
|
13
|
+
} | {
|
|
14
|
+
state: 'public';
|
|
15
|
+
host: string;
|
|
16
|
+
};
|
|
17
|
+
export declare function projectGitEnv(): NodeJS.ProcessEnv;
|
|
18
|
+
export declare function parseRemoteUrl(url: string): Omit<ParsedRemote, 'name'> | null;
|
|
19
|
+
/** Parse `git remote -v` output; fetch lines only, origin first. */
|
|
20
|
+
export declare function parseRemotes(text: string): ParsedRemote[];
|
|
21
|
+
type FetchLike = (url: string, init: {
|
|
22
|
+
signal: AbortSignal;
|
|
23
|
+
headers: Record<string, string>;
|
|
24
|
+
}) => Promise<{
|
|
25
|
+
status: number;
|
|
26
|
+
json(): Promise<unknown>;
|
|
27
|
+
}>;
|
|
28
|
+
/** One unauthenticated request. 200 with private:false means public; anything else is unknown. */
|
|
29
|
+
export declare function githubIsPublic(owner: string, repo: string, fetchImpl?: FetchLike): Promise<boolean>;
|
|
30
|
+
export declare function clearRemoteCache(): void;
|
|
31
|
+
export declare function suggestFromRemote(cwd: string, opts?: {
|
|
32
|
+
fetchImpl?: FetchLike;
|
|
33
|
+
now?: number;
|
|
34
|
+
}): Promise<RemoteSuggestion>;
|
|
35
|
+
export interface ProjectStateReport {
|
|
36
|
+
isGit: boolean;
|
|
37
|
+
hasState: boolean;
|
|
38
|
+
tracked: number;
|
|
39
|
+
trackedSample: string[];
|
|
40
|
+
ignored: boolean;
|
|
41
|
+
ignoreFile: 'default' | 'missing' | 'edited';
|
|
42
|
+
}
|
|
43
|
+
export declare function checkProjectState(cwd: string): Promise<ProjectStateReport>;
|
|
44
|
+
/** Write the default ignore file; an existing different file is moved aside first. */
|
|
45
|
+
export declare function restoreIgnoreFile(cwd: string): {
|
|
46
|
+
backup?: string;
|
|
47
|
+
};
|
|
48
|
+
/** Remove .arco from the index only. Files stay on disk. */
|
|
49
|
+
export declare function stopTrackingState(cwd: string): Promise<{
|
|
50
|
+
ok: boolean;
|
|
51
|
+
removed: number;
|
|
52
|
+
error?: string;
|
|
53
|
+
}>;
|
|
54
|
+
export {};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
// Public-project guardrails: suggestion from the Git remote and the check that
|
|
2
|
+
// Arco's project state stays out of Git. Read-only except for the two explicit
|
|
3
|
+
// fixes (restore the ignore file, stop tracking). Every git call is argv-only.
|
|
4
|
+
import { execFile } from 'node:child_process';
|
|
5
|
+
import { existsSync, readFileSync, renameSync, statSync, writeFileSync } from 'node:fs';
|
|
6
|
+
import { join } from 'node:path';
|
|
7
|
+
import { promisify } from 'node:util';
|
|
8
|
+
import { DEFAULT_PROJECT_IGNORE } from './projectStateIgnore.js';
|
|
9
|
+
const execFileAsync = promisify(execFile);
|
|
10
|
+
const GIT_TIMEOUT_MS = 10_000;
|
|
11
|
+
const FETCH_TIMEOUT_MS = 4_000;
|
|
12
|
+
const CACHE_MS = 24 * 60 * 60 * 1000;
|
|
13
|
+
export const PUBLIC_HOSTS = ['github.com', 'gitlab.com', 'bitbucket.org', 'codeberg.org'];
|
|
14
|
+
export function projectGitEnv() {
|
|
15
|
+
const env = { ...process.env, GIT_TERMINAL_PROMPT: '0' };
|
|
16
|
+
for (const name of ['GIT_DIR', 'GIT_WORK_TREE', 'GIT_COMMON_DIR', 'GIT_INDEX_FILE', 'GIT_OBJECT_DIRECTORY', 'GIT_ALTERNATE_OBJECT_DIRECTORIES'])
|
|
17
|
+
delete env[name];
|
|
18
|
+
return env;
|
|
19
|
+
}
|
|
20
|
+
async function git(cwd, args) {
|
|
21
|
+
try {
|
|
22
|
+
const { stdout } = await execFileAsync('git', args, { cwd, timeout: GIT_TIMEOUT_MS, maxBuffer: 1024 * 1024, encoding: 'utf8', env: projectGitEnv() });
|
|
23
|
+
return { code: 0, stdout };
|
|
24
|
+
}
|
|
25
|
+
catch (err) {
|
|
26
|
+
const e = err;
|
|
27
|
+
return { code: typeof e.code === 'number' ? e.code : 1, stdout: e.stdout ?? '' };
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export function parseRemoteUrl(url) {
|
|
31
|
+
const text = url.trim();
|
|
32
|
+
const m = /^(?:[a-z+]+:\/\/)?(?:[^@/]+@)?([^/:]+)[/:](?:\d+\/)?([^/]+)\/([^/]+?)(?:\.git)?\/?$/i.exec(text);
|
|
33
|
+
if (!m)
|
|
34
|
+
return null;
|
|
35
|
+
const host = m[1].toLowerCase();
|
|
36
|
+
if (!PUBLIC_HOSTS.includes(host))
|
|
37
|
+
return null;
|
|
38
|
+
return { host, owner: m[2], repo: m[3] };
|
|
39
|
+
}
|
|
40
|
+
/** Parse `git remote -v` output; fetch lines only, origin first. */
|
|
41
|
+
export function parseRemotes(text) {
|
|
42
|
+
const out = [];
|
|
43
|
+
for (const line of text.split(/\r?\n/)) {
|
|
44
|
+
const m = /^(\S+)\s+(\S+)\s+\(fetch\)$/.exec(line.trim());
|
|
45
|
+
if (!m)
|
|
46
|
+
continue;
|
|
47
|
+
const parsed = parseRemoteUrl(m[2]);
|
|
48
|
+
if (parsed)
|
|
49
|
+
out.push({ name: m[1], ...parsed });
|
|
50
|
+
}
|
|
51
|
+
return out.sort((a, b) => Number(b.name === 'origin') - Number(a.name === 'origin'));
|
|
52
|
+
}
|
|
53
|
+
/** One unauthenticated request. 200 with private:false means public; anything else is unknown. */
|
|
54
|
+
export async function githubIsPublic(owner, repo, fetchImpl = fetch) {
|
|
55
|
+
if (!/^[A-Za-z0-9._-]+$/.test(owner) || !/^[A-Za-z0-9._-]+$/.test(repo))
|
|
56
|
+
return false;
|
|
57
|
+
const ctl = new AbortController();
|
|
58
|
+
const timer = setTimeout(() => ctl.abort(), FETCH_TIMEOUT_MS);
|
|
59
|
+
try {
|
|
60
|
+
const res = await fetchImpl(`https://api.github.com/repos/${owner}/${repo}`, { signal: ctl.signal, headers: { Accept: 'application/vnd.github+json', 'User-Agent': 'arco' } });
|
|
61
|
+
if (res.status !== 200)
|
|
62
|
+
return false;
|
|
63
|
+
const body = await res.json();
|
|
64
|
+
return body.private === false;
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
finally {
|
|
70
|
+
clearTimeout(timer);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const cache = new Map();
|
|
74
|
+
export function clearRemoteCache() { cache.clear(); }
|
|
75
|
+
export async function suggestFromRemote(cwd, opts = {}) {
|
|
76
|
+
const now = opts.now ?? Date.now();
|
|
77
|
+
const hit = cache.get(cwd);
|
|
78
|
+
if (hit && now - hit.at < CACHE_MS)
|
|
79
|
+
return hit.value;
|
|
80
|
+
const listed = await git(cwd, ['remote', '-v']);
|
|
81
|
+
const remote = listed.code === 0 ? parseRemotes(listed.stdout)[0] : undefined;
|
|
82
|
+
let value = { state: 'none' };
|
|
83
|
+
if (remote) {
|
|
84
|
+
value = remote.host === 'github.com' && await githubIsPublic(remote.owner, remote.repo, opts.fetchImpl)
|
|
85
|
+
? { state: 'public', host: remote.host }
|
|
86
|
+
: { state: 'hosted', host: remote.host };
|
|
87
|
+
}
|
|
88
|
+
cache.set(cwd, { at: now, value });
|
|
89
|
+
return value;
|
|
90
|
+
}
|
|
91
|
+
export async function checkProjectState(cwd) {
|
|
92
|
+
const base = { isGit: false, hasState: false, tracked: 0, trackedSample: [], ignored: true, ignoreFile: 'default' };
|
|
93
|
+
if (/[\\/]isolates[\\/]/.test(cwd))
|
|
94
|
+
return base;
|
|
95
|
+
const inside = await git(cwd, ['rev-parse', '--is-inside-work-tree']);
|
|
96
|
+
if (inside.code !== 0 || inside.stdout.trim() !== 'true')
|
|
97
|
+
return base;
|
|
98
|
+
base.isGit = true;
|
|
99
|
+
const dir = join(cwd, '.arco');
|
|
100
|
+
const file = join(dir, '.gitignore');
|
|
101
|
+
const listed = await git(cwd, ['ls-files', '--', '.arco']);
|
|
102
|
+
const tracked = listed.code === 0 ? listed.stdout.split('\n').filter(Boolean) : [];
|
|
103
|
+
base.tracked = tracked.length;
|
|
104
|
+
base.trackedSample = tracked.slice(0, 5);
|
|
105
|
+
base.hasState = tracked.length > 0 || (existsSync(dir) && statSync(dir).isDirectory());
|
|
106
|
+
if (!base.hasState)
|
|
107
|
+
return base;
|
|
108
|
+
base.ignoreFile = !existsSync(file) ? 'missing' : readFileSync(file, 'utf8') === DEFAULT_PROJECT_IGNORE ? 'default' : 'edited';
|
|
109
|
+
base.ignored = (await git(cwd, ['check-ignore', '-q', '--no-index', '--', '.arco/workflows/.probe'])).code === 0;
|
|
110
|
+
return base;
|
|
111
|
+
}
|
|
112
|
+
/** Write the default ignore file; an existing different file is moved aside first. */
|
|
113
|
+
export function restoreIgnoreFile(cwd) {
|
|
114
|
+
const dir = join(cwd, '.arco');
|
|
115
|
+
const file = join(dir, '.gitignore');
|
|
116
|
+
let backup;
|
|
117
|
+
if (existsSync(file)) {
|
|
118
|
+
if (readFileSync(file, 'utf8') === DEFAULT_PROJECT_IGNORE)
|
|
119
|
+
return {};
|
|
120
|
+
backup = `.gitignore.backup-${new Date().toISOString().replace(/[:.]/g, '-')}`;
|
|
121
|
+
renameSync(file, join(dir, backup));
|
|
122
|
+
}
|
|
123
|
+
writeFileSync(file, DEFAULT_PROJECT_IGNORE, { encoding: 'utf8', flag: 'wx' });
|
|
124
|
+
return backup ? { backup } : {};
|
|
125
|
+
}
|
|
126
|
+
/** Remove .arco from the index only. Files stay on disk. */
|
|
127
|
+
export async function stopTrackingState(cwd) {
|
|
128
|
+
const before = await git(cwd, ['ls-files', '--', '.arco']);
|
|
129
|
+
const count = before.stdout.split('\n').filter(Boolean).length;
|
|
130
|
+
if (count === 0)
|
|
131
|
+
return { ok: true, removed: 0 };
|
|
132
|
+
const res = await git(cwd, ['rm', '-r', '-q', '--cached', '--', '.arco']);
|
|
133
|
+
return res.code === 0 ? { ok: true, removed: count } : { ok: false, removed: 0, error: 'git could not stop tracking the folder' };
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=publicProject.js.map
|
|
@@ -32,6 +32,7 @@ import { readMeta, listWorkflowMetas, latestCliSessionFor } from '../workflowMet
|
|
|
32
32
|
import { extractSessionName } from '../workflows/sessionDiscovery.js';
|
|
33
33
|
import { encodeProjectDir } from '../http/fileRead.js';
|
|
34
34
|
import { arcoHome } from '../arcoHome.js';
|
|
35
|
+
import { readLogLines } from '../eventLog.js';
|
|
35
36
|
const WFID_PATTERN = /^[a-zA-Z0-9-]{1,64}$/;
|
|
36
37
|
const TITLE_MAX = 80;
|
|
37
38
|
// §F2 — bound how much summary body we mirror into the FTS5 `summary` column.
|
|
@@ -672,33 +673,31 @@ async function findAiTitle(meta) {
|
|
|
672
673
|
async function scanEvents(cwd, wfid) {
|
|
673
674
|
if (!WFID_PATTERN.test(wfid))
|
|
674
675
|
return { turnCount: 0, firstMessage: '' };
|
|
675
|
-
const eventsPath = path.join(cwd, '.arco', 'workflows', wfid, 'events.jsonl');
|
|
676
|
-
let raw;
|
|
677
|
-
try {
|
|
678
|
-
raw = await fs.readFile(eventsPath, 'utf8');
|
|
679
|
-
}
|
|
680
|
-
catch {
|
|
681
|
-
return { turnCount: 0, firstMessage: '' };
|
|
682
|
-
}
|
|
683
676
|
let turnCount = 0;
|
|
684
677
|
let firstMessage = '';
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
entry
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
678
|
+
// Sealed segments and the live file (P7.3).
|
|
679
|
+
try {
|
|
680
|
+
for await (const line of readLogLines(path.join(cwd, '.arco', 'workflows', wfid))) {
|
|
681
|
+
if (!line || !line.includes('"user_message_echo"'))
|
|
682
|
+
continue;
|
|
683
|
+
let entry;
|
|
684
|
+
try {
|
|
685
|
+
entry = JSON.parse(line);
|
|
686
|
+
}
|
|
687
|
+
catch {
|
|
688
|
+
continue;
|
|
689
|
+
}
|
|
690
|
+
if (entry.type !== 'user_message_echo')
|
|
691
|
+
continue;
|
|
692
|
+
turnCount++;
|
|
693
|
+
if (!firstMessage && typeof entry.content === 'string' && entry.content.trim()) {
|
|
694
|
+
firstMessage = entry.content.trim();
|
|
695
|
+
}
|
|
700
696
|
}
|
|
701
697
|
}
|
|
698
|
+
catch {
|
|
699
|
+
return { turnCount, firstMessage };
|
|
700
|
+
}
|
|
702
701
|
return { turnCount, firstMessage };
|
|
703
702
|
}
|
|
704
703
|
async function readKnownCwds() {
|
|
@@ -17,8 +17,9 @@ export declare function releasePlansWatcher(cwd: string): void;
|
|
|
17
17
|
export declare function fsWatchEnsureDir(dir: string): void;
|
|
18
18
|
export declare function flushPlansWatcher(cwd: string, state: PlansWatcher): Promise<void>;
|
|
19
19
|
export declare function broadcastWorkflow(workflowId: string, message: ServerMessage): void;
|
|
20
|
-
export declare const CLUSTER_STATE_TRIGGERS: Set<"error" | "provider_fell_back" | "checkpoint_created" | "turn_changes" | "checkpoint_reverted" | "operator_question" | "operator_question_reply_result" | "mcp_registry_snapshot" | "mcp_probe_result" | "mcp_allow_snapshot" | "mcp_malware_warning" | "genesis_seed_updated" | "genesis_assist_started" | "genesis_assist_proposed" | "workflow_cwd_bound" | "genesis_scaffolded" | "genesis_creative_armed" | "computer_context_updated" | "voice_tool_call" | "computer_activity_changed" | "output_saved" | "peer_message_sent" | "peer_message_received" | "peer_send_rejected" | "cluster_snapshot_list" | "cluster_snapshot_saved" | "cluster_snapshot_conflict" | "cluster_snapshot_error" | "workflow_rename_result" | "workflow_renamed" | "cluster_state" | "cluster_not_found" | "cluster_created" | "cluster_deleted" | "cluster_member_added" | "cluster_member_removed" | "cluster_member_replaced" | "cluster_plan_changed" | "codebase_memory_state" | "cluster_broadcast_dispatched" | "cluster_dispatch_result" | "cluster_swarm_created" | "cluster_member_nudged" | "cluster_auto_turn_fired" | "hub_link_status" | "bakeoff_list_result" | "bakeoff_state" | "bakeoff_error" | "bakeoff_attempts_removed" | "review_started" | "review_artifact_ready" | "research_started" | "research_progress" | "research_complete" | "compare_started" | "compare_leg_delta" | "compare_leg_complete" | "compare_complete" | "compare_vote_recorded" | "diagnostics" | "doc_edit_started" | "doc_edit_proposed" | "md_tuneup_candidates" | "md_tuneup_started" | "md_tuneup_proposed" | "md_tuneup_applied" | "md_tuneup_undone" | "knowledge_distill_started" | "knowledge_distill_proposed" | "recall_summary_ready" | "workbench_notice" | "notification_mutes" | "attention_event" | "handoff_started" | "handoff_artifact_ready" | "handoff_complete" | "handoff_lock_snapshot" | "spawn_from_here_complete" | "live_changes_snapshot" | "git_op_result" | "media_stems_result" | "media_op_result" | "terminal_opened" | "terminal_sessions" | "terminal_killed" | "shutdown" | "terminal_command_logged" | "task_ledger_snapshot" | "task_ledger_event" | "cluster_orchestration_assist_started" | "cluster_orchestration_proposal_started" | "cluster_orchestration_proposals_snapshot" | "cluster_orchestration_proposal_proposed" | "cluster_orchestration_proposal_rejected" | "cluster_orchestration_proposal_applied" | "preview_capture_started" | "preview_capture_ready" | "plan_attached" | "plan_detached" | "plan_set" | "plan_exited" | "plan_candidate_ready" | "connected" | "workspace_snapshot" | "workspace_changed" | "workflow_config_synced" | "workflow_created" | "user_message_echo" | "primary_text" | "primary_complete" | "hook_rewrote_input" | "tool_gate_triggered" | "tool_posture_set" | "goal_set" | "goal_run_state" | "pinned_skills_set" | "project_trust_prompt" | "project_trust_set" | "worker_stuck" | "tool_loop_warning" | "file_mutation_queued" | "model_resolved" | "primary_refusal" | "primary_tool_counter" | "sandbox_chunk_added" | "sandbox_db_cleared" | "ctx_action" | "native_compacting" | "native_compacted" | "context_folded" | "tool_filtered" | "tool_evicted" | "primary_turn_token_usage" | "primary_model" | "primary_thinking" | "primary_tool_use" | "primary_activity" | "primary_turn_started" | "primary_turn_ended" | "worker_model" | "worker_spawned" | "worker_text" | "worker_thinking" | "worker_tool_use" | "worker_complete" | "worker_activity" | "worker_error" | "file_uploaded" | "primary_artifact" | "quota_status" | "turn_cancelled" | "conversation_changed" | "workflow_state_snapshot" | "workflow_session_metadata" | "replay_batch" | "capabilities_updated" | "capabilities_changed" | "settings_updated" | "session_entry" | "queued_message_cancelled" | "queued_messages_drained" | "system_notice" | "claude_native_question_settled" | "session_history_status" | "codex_token_snapshot" | "gate_required" | "gate_resolved" | "gate_standing" | "preview_set" | "preview_cleared" | "preview_history" | "context_usage" | "ultracode_fleet_progress" | "context_budget" | "operator_label" | "queue_update" | "todos_updated" | "task_started" | "task_status" | "branch_summary" | "leaf_move" | "app_update_available" | "turn_messages_delivered">;
|
|
20
|
+
export declare const CLUSTER_STATE_TRIGGERS: Set<"error" | "provider_fell_back" | "checkpoint_created" | "turn_changes" | "checkpoint_reverted" | "operator_question" | "operator_question_reply_result" | "mcp_registry_snapshot" | "mcp_probe_result" | "mcp_allow_snapshot" | "mcp_malware_warning" | "genesis_seed_updated" | "genesis_assist_started" | "genesis_assist_proposed" | "workflow_cwd_bound" | "genesis_scaffolded" | "genesis_creative_armed" | "computer_context_updated" | "voice_tool_call" | "computer_activity_changed" | "output_saved" | "peer_message_sent" | "peer_message_received" | "peer_send_rejected" | "cluster_snapshot_list" | "cluster_snapshot_saved" | "cluster_snapshot_conflict" | "cluster_snapshot_error" | "workflow_rename_result" | "workflow_renamed" | "cluster_state" | "cluster_not_found" | "cluster_created" | "cluster_deleted" | "cluster_member_added" | "cluster_member_removed" | "cluster_member_replaced" | "cluster_plan_changed" | "codebase_memory_state" | "cluster_broadcast_dispatched" | "cluster_dispatch_result" | "cluster_swarm_created" | "cluster_member_nudged" | "cluster_auto_turn_fired" | "hub_link_status" | "bakeoff_list_result" | "bakeoff_state" | "bakeoff_error" | "bakeoff_attempts_removed" | "review_started" | "review_artifact_ready" | "research_started" | "research_progress" | "research_complete" | "compare_started" | "compare_leg_delta" | "compare_leg_complete" | "compare_complete" | "compare_vote_recorded" | "diagnostics" | "doc_edit_started" | "doc_edit_proposed" | "md_tuneup_candidates" | "md_tuneup_started" | "md_tuneup_proposed" | "md_tuneup_applied" | "md_tuneup_undone" | "knowledge_distill_started" | "knowledge_distill_proposed" | "recall_summary_ready" | "workbench_notice" | "notification_mutes" | "attention_event" | "handoff_started" | "handoff_artifact_ready" | "handoff_complete" | "handoff_lock_snapshot" | "spawn_from_here_complete" | "live_changes_snapshot" | "storage_warning" | "git_op_result" | "media_stems_result" | "media_op_result" | "terminal_opened" | "terminal_sessions" | "terminal_killed" | "shutdown" | "terminal_command_logged" | "task_ledger_snapshot" | "task_ledger_event" | "cluster_orchestration_assist_started" | "cluster_orchestration_proposal_started" | "cluster_orchestration_proposals_snapshot" | "cluster_orchestration_proposal_proposed" | "cluster_orchestration_proposal_rejected" | "cluster_orchestration_proposal_applied" | "preview_capture_started" | "preview_capture_ready" | "plan_attached" | "plan_detached" | "plan_set" | "plan_exited" | "plan_candidate_ready" | "connected" | "workspace_snapshot" | "workspace_changed" | "workflow_config_synced" | "workflow_created" | "user_message_echo" | "primary_text" | "primary_complete" | "hook_rewrote_input" | "tool_gate_triggered" | "tool_posture_set" | "goal_set" | "goal_run_state" | "pinned_skills_set" | "project_trust_prompt" | "project_trust_set" | "worker_stuck" | "tool_loop_warning" | "file_mutation_queued" | "model_resolved" | "primary_refusal" | "primary_tool_counter" | "sandbox_chunk_added" | "sandbox_db_cleared" | "ctx_action" | "native_compacting" | "native_compacted" | "context_folded" | "tool_filtered" | "tool_evicted" | "primary_turn_token_usage" | "primary_model" | "primary_thinking" | "primary_tool_use" | "primary_activity" | "primary_turn_started" | "primary_turn_ended" | "worker_model" | "worker_spawned" | "worker_text" | "worker_thinking" | "worker_tool_use" | "worker_complete" | "worker_activity" | "worker_error" | "file_uploaded" | "primary_artifact" | "quota_status" | "turn_cancelled" | "conversation_changed" | "workflow_state_snapshot" | "workflow_session_metadata" | "replay_batch" | "capabilities_updated" | "capabilities_changed" | "settings_updated" | "session_entry" | "queued_message_cancelled" | "queued_messages_drained" | "system_notice" | "claude_native_question_settled" | "session_history_status" | "codex_token_snapshot" | "gate_required" | "gate_resolved" | "gate_standing" | "preview_set" | "preview_cleared" | "preview_history" | "context_usage" | "ultracode_fleet_progress" | "context_budget" | "operator_label" | "queue_update" | "todos_updated" | "task_started" | "task_status" | "branch_summary" | "leaf_move" | "app_update_available" | "turn_messages_delivered">;
|
|
21
21
|
export declare function broadcastCluster(clusterId: string, message: ServerMessage): void;
|
|
22
|
+
export declare function sendWorkflowLive(workflowId: string, message: ServerMessage): void;
|
|
22
23
|
export declare function buildClusterStatePayload(clusterId: string): Promise<{
|
|
23
24
|
clusterId: string;
|
|
24
25
|
cwd: string;
|
|
@@ -12,6 +12,8 @@ import { basename, join } from 'path';
|
|
|
12
12
|
import { sessions, workflows, workflowCwds, cwdHandoffChain, plansWatchers, clusterPlanWatcherCwds, } from './state.js';
|
|
13
13
|
import { WS_BACKPRESSURE_DROP_BYTES } from './constants.js';
|
|
14
14
|
import { persistAndStampSeq } from '../workflowStore.js';
|
|
15
|
+
import { rememberPlanBody } from '../planHistory.js';
|
|
16
|
+
import { checkArtifactSizes, conversationWarnBytes, fileWarnBytes } from '../storageWarnings.js';
|
|
15
17
|
import { readMeta, updateMeta } from '../workflowMeta.js';
|
|
16
18
|
import { appendRecord, matchFileEvent, resolveMatchPath } from '../recentFilesLedger.js';
|
|
17
19
|
import { artifactsDir } from '../workers/limits.js';
|
|
@@ -166,6 +168,10 @@ export function send(ws, message) {
|
|
|
166
168
|
// ARCHIVE — agent-writes ledger. Native Write/Edit/NotebookEdit tool events
|
|
167
169
|
// ride the operator turn through send(); record them here.
|
|
168
170
|
recordFilesLedger(wfid, stamped);
|
|
171
|
+
// P7.4: primary turns end through send(); warn once about very large
|
|
172
|
+
// artifacts (idempotent with the broadcastWorkflow hook).
|
|
173
|
+
if (stamped.type === 'primary_turn_ended' && cwd && source && !source.config.incognito)
|
|
174
|
+
void reportArtifactSizes(wfid, cwd);
|
|
169
175
|
// Fan out to every observer of this workflow. Multi-observer so a
|
|
170
176
|
// second browser window attached to the same workflowId also sees the
|
|
171
177
|
// stream; previously the single-slot pointer got overwritten on the
|
|
@@ -390,6 +396,20 @@ export async function flushPlansWatcher(cwd, state) {
|
|
|
390
396
|
}
|
|
391
397
|
}
|
|
392
398
|
}
|
|
399
|
+
async function reportArtifactSizes(workflowId, cwd) {
|
|
400
|
+
try {
|
|
401
|
+
const items = await checkArtifactSizes(join(cwd, '.arco', 'workflows', workflowId));
|
|
402
|
+
if (items.length) {
|
|
403
|
+
broadcastWorkflow(workflowId, {
|
|
404
|
+
type: 'storage_warning', workflowId, items,
|
|
405
|
+
fileThresholdBytes: fileWarnBytes(), conversationThresholdBytes: conversationWarnBytes(),
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
catch (err) {
|
|
410
|
+
console.error(`[arco] artifact size check failed for ${workflowId.slice(0, 8)}:`, err);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
393
413
|
export function broadcastWorkflow(workflowId, message) {
|
|
394
414
|
const wf = workflows.get(workflowId);
|
|
395
415
|
if (!wf)
|
|
@@ -442,6 +462,9 @@ export function broadcastWorkflow(workflowId, message) {
|
|
|
442
462
|
}
|
|
443
463
|
else if (message.type === 'primary_turn_ended') {
|
|
444
464
|
clusterIdleNudger.onMemberTurnEnded(workflowId);
|
|
465
|
+
// P7.4: warn once about very large artifacts written during the turn.
|
|
466
|
+
if (cwd && !wf.config.incognito)
|
|
467
|
+
void reportArtifactSizes(workflowId, cwd);
|
|
445
468
|
if (!wf.config.incognito) {
|
|
446
469
|
notifications.onTurnEnded(workflowId, { provider: wf.config.primaryProvider, workflowName: wf.config.name });
|
|
447
470
|
}
|
|
@@ -539,8 +562,40 @@ export function broadcastCluster(clusterId, message) {
|
|
|
539
562
|
if (message.type === 'cluster_plan_changed') {
|
|
540
563
|
clusterAutoTurn.rulePickupWorkChanged(clusterId);
|
|
541
564
|
const members = clusterStore.getMembers(clusterId) ?? [];
|
|
565
|
+
// P7.2: the audit copy carries the body's hash; the body itself is
|
|
566
|
+
// stored once in the project's plan history (never deleted with plans).
|
|
567
|
+
const hashes = new Map();
|
|
542
568
|
for (const wfid of members)
|
|
543
|
-
broadcastWorkflow(wfid, message);
|
|
569
|
+
broadcastWorkflow(wfid, planAuditCopy(message, workflowCwds.get(wfid), hashes));
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
function planAuditCopy(message, cwd, hashes) {
|
|
573
|
+
if (!cwd || !message.body)
|
|
574
|
+
return message;
|
|
575
|
+
let hash = hashes.get(cwd);
|
|
576
|
+
if (hash === undefined) {
|
|
577
|
+
hash = rememberPlanBody(cwd, message.body);
|
|
578
|
+
hashes.set(cwd, hash);
|
|
579
|
+
}
|
|
580
|
+
if (!hash)
|
|
581
|
+
return message;
|
|
582
|
+
const { body: _body, ...rest } = message;
|
|
583
|
+
void _body;
|
|
584
|
+
return { ...rest, bodySha256: hash };
|
|
585
|
+
}
|
|
586
|
+
// Live-only fan-out to a workflow's open tabs: no sequence number, nothing
|
|
587
|
+
// written to events.jsonl. For full task-board copies (P7.2): the board lives
|
|
588
|
+
// in the ledger store, reconnecting tabs get a fresh copy
|
|
589
|
+
// (sendTaskLedgerSnapshot / task_ledger_list), and recovery folds the
|
|
590
|
+
// persisted task_ledger_event records.
|
|
591
|
+
export function sendWorkflowLive(workflowId, message) {
|
|
592
|
+
const wf = workflows.get(workflowId);
|
|
593
|
+
if (!wf)
|
|
594
|
+
return;
|
|
595
|
+
const payload = JSON.stringify(message);
|
|
596
|
+
for (const obs of wf.observers) {
|
|
597
|
+
if (obs.readyState === WebSocket.OPEN)
|
|
598
|
+
obs.send(payload);
|
|
544
599
|
}
|
|
545
600
|
}
|
|
546
601
|
export async function buildClusterStatePayload(clusterId) {
|
|
@@ -42,6 +42,13 @@ export declare function codexAdapter(opts?: {
|
|
|
42
42
|
reason?: string;
|
|
43
43
|
}>;
|
|
44
44
|
}): EvaluatorAdapter;
|
|
45
|
+
export declare function openAiCompatibleAdapter(provider: SmartPickupEvaluatorProvider, opts: {
|
|
46
|
+
base: (model: string, signal: AbortSignal) => Promise<string>;
|
|
47
|
+
available: () => Promise<boolean>;
|
|
48
|
+
fetchImpl?: typeof fetch;
|
|
49
|
+
run?: <T>(work: () => Promise<T>) => Promise<T>;
|
|
50
|
+
}): EvaluatorAdapter;
|
|
51
|
+
export declare function requireLoadedLocalModel(provider: 'lmstudio' | 'strata' | 'deepseek', base: string, model: string, signal: AbortSignal): Promise<string>;
|
|
45
52
|
export declare function evaluatorAdapter(provider: SmartPickupEvaluatorProvider): EvaluatorAdapter;
|
|
46
53
|
export declare function setEvaluatorAdaptersForTest(next: Partial<Record<SmartPickupEvaluatorProvider, EvaluatorAdapter>>): () => void;
|
|
47
54
|
export declare function evaluatorCapabilities(): Promise<SmartPickupEvaluatorCapability[]>;
|