arco-workbench 0.1.3 → 0.1.5
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 +41 -9
- package/README.md +40 -22
- package/THIRD_PARTY_NOTICES +789 -0
- package/client/dist/assets/{PhosphorBackdrop-CkVIGkeX.js → PhosphorBackdrop-D6cbmLNY.js} +1 -1
- package/client/dist/assets/{ThemedBackgroundShaderImpl-DHF7CnpE.js → ThemedBackgroundShaderImpl-2dyerOi4.js} +1 -1
- package/client/dist/assets/{XtermView-SY0UcZUS.js → XtermView-AIwo7O3D.js} +2 -2
- package/client/dist/assets/galleryEditor-DXAuxS8D.js +702 -0
- package/client/dist/assets/index-8j6p-pmQ.js +610 -0
- package/client/dist/assets/index-DD9kFGsF.css +1 -0
- package/client/dist/index.html +2 -2
- package/client/src/App.tsx +46 -55
- package/client/src/alerts/desktopAlerts.ts +29 -9
- package/client/src/alerts/desktopTest.ts +68 -0
- package/client/src/alerts/focusNotice.ts +16 -0
- package/client/src/brief/briefFacts.ts +22 -0
- package/client/src/brief/briefFromStore.ts +7 -2
- package/client/src/buildCheck.ts +42 -2
- package/client/src/components/ArchitectureReviewDialog.tsx +98 -0
- package/client/src/components/ArtifactModal.tsx +4 -6
- package/client/src/components/ArtifactMoveDialog.tsx +68 -0
- package/client/src/components/AskUserQuestionNotice.tsx +2 -1
- package/client/src/components/AutomaticMessage.tsx +19 -0
- package/client/src/components/BriefControl.tsx +42 -49
- package/client/src/components/BrowserNotice.tsx +35 -0
- package/client/src/components/CatchMeUp.tsx +35 -29
- package/client/src/components/ChatMessage.tsx +15 -4
- package/client/src/components/ChatModeView.tsx +23 -16
- package/client/src/components/ChatPanel.tsx +33 -5
- package/client/src/components/CheckpointActions.tsx +97 -29
- package/client/src/components/ClusterActivityTab.tsx +4 -2
- package/client/src/components/ClusterComposerButtons.tsx +6 -3
- package/client/src/components/ClusterMemberPicker.tsx +6 -3
- package/client/src/components/ClusterPlanTab.tsx +108 -63
- package/client/src/components/ClusterRightPanel/AddWorkerSection.tsx +16 -5
- package/client/src/components/ClusterRightPanel/AutoPickupControl.tsx +31 -16
- package/client/src/components/ClusterRightPanel/MailboxModal.tsx +7 -3
- package/client/src/components/ClusterRightPanel/MemberRow.tsx +5 -2
- package/client/src/components/ClusterRightPanel/MemberSettingsFields.tsx +104 -0
- package/client/src/components/ClusterRightPanel/MessageGuardControl.tsx +1 -1
- package/client/src/components/ClusterRightPanel/ReplaceMemberDialog.tsx +85 -7
- package/client/src/components/ClusterRightPanel/index.tsx +90 -36
- package/client/src/components/ClusterRightPanel/memberSettings.ts +52 -0
- package/client/src/components/ClusterRightPanel/panels.ts +18 -0
- package/client/src/components/ClusterRightPanel/types.ts +9 -10
- package/client/src/components/ClusterTab.tsx +281 -61
- package/client/src/components/ClusterTaskBoardTab.tsx +84 -606
- package/client/src/components/CommandPalette.tsx +17 -6
- package/client/src/components/ComputerAgentPicker.tsx +1 -1
- package/client/src/components/ComputerPanel.tsx +4 -2
- package/client/src/components/Connections/Connections.tsx +5 -2
- package/client/src/components/Connections/EndpointEditor.tsx +2 -2
- package/client/src/components/Connections/connections.css +1 -1
- package/client/src/components/Connections/model.ts +5 -1
- package/client/src/components/ContextMeter.tsx +15 -4
- package/client/src/components/DeepSeekControls.tsx +7 -6
- package/client/src/components/DiagnosticsTab.tsx +3 -2
- package/client/src/components/DialogShell.tsx +123 -0
- package/client/src/components/DocsUpdateDialog.tsx +16 -42
- package/client/src/components/FileExplorer.tsx +8 -9
- package/client/src/components/FileViewerModal.tsx +37 -12
- package/client/src/components/FirstRun.tsx +8 -7
- package/client/src/components/ForwardMessages.tsx +28 -32
- package/client/src/components/GateApprovalNotice.tsx +4 -2
- package/client/src/components/GitDialog.tsx +53 -52
- package/client/src/components/GitHubPanel/CodeView.tsx +35 -23
- package/client/src/components/GitHubPanel/IssueView.tsx +6 -4
- package/client/src/components/GitHubPanel/PullView.tsx +7 -6
- package/client/src/components/GitHubPanel/RunView.tsx +7 -5
- package/client/src/components/GitHubPanel/shared.tsx +23 -8
- package/client/src/components/GitOtherWork.tsx +4 -2
- package/client/src/components/HandoffDialog.tsx +19 -45
- package/client/src/components/HandoffSeedPill.tsx +5 -5
- package/client/src/components/HandoffSource.tsx +54 -0
- package/client/src/components/HeaderAuthChip.tsx +22 -1
- package/client/src/components/HeaderDropdown.tsx +5 -0
- package/client/src/components/HeaderVersionBox.tsx +3 -0
- package/client/src/components/HistoryTab.tsx +59 -32
- package/client/src/components/Home/AddProject.tsx +1 -1
- package/client/src/components/Home/HomeView.tsx +59 -22
- package/client/src/components/Home/LocationDialog.tsx +1 -1
- package/client/src/components/Home/ProjectCard.tsx +5 -3
- package/client/src/components/Home/home.css +11 -4
- package/client/src/components/KeepButton.tsx +45 -0
- package/client/src/components/LlamacppCatalogEditor.tsx +12 -3
- package/client/src/components/LocalRuntimeStatus.tsx +54 -0
- package/client/src/components/MdTuneupDialog.tsx +55 -52
- package/client/src/components/MemberCard.tsx +47 -42
- package/client/src/components/MemberPane.tsx +12 -11
- package/client/src/components/ModelHealthPanel.tsx +5 -4
- package/client/src/components/NativeSubagentControls.tsx +64 -0
- package/client/src/components/NeedsYouBadge.tsx +13 -6
- package/client/src/components/NorthStarBar.tsx +5 -3
- package/client/src/components/NotificationCenter.tsx +18 -5
- package/client/src/components/NotificationChannelsSettings.tsx +50 -24
- package/client/src/components/NotificationToasts.tsx +6 -8
- package/client/src/components/PendingQuestionsButton.tsx +4 -1
- package/client/src/components/PlanBodyRenderer.tsx +1 -0
- package/client/src/components/PlanCandidateBanner.tsx +129 -58
- package/client/src/components/PlanComposerDialog.tsx +55 -87
- package/client/src/components/PlanReviewPicker.tsx +6 -3
- package/client/src/components/PreviewTab.tsx +62 -25
- package/client/src/components/PrimaryStatus.tsx +20 -74
- package/client/src/components/ProjectStateNotice.tsx +60 -0
- package/client/src/components/ProjectsSettings.tsx +28 -2
- package/client/src/components/ProviderReleasesModal.tsx +13 -3
- package/client/src/components/ProvidersPopover.tsx +81 -23
- package/client/src/components/PublicProjectBox.tsx +29 -0
- package/client/src/components/PurgeConversationModal.tsx +7 -2
- package/client/src/components/QueuedMessagesIndicator.tsx +42 -150
- package/client/src/components/Recall/RecallResultRow.tsx +4 -2
- package/client/src/components/Recall/RecallView.tsx +12 -9
- package/client/src/components/ResearchDialog.tsx +16 -25
- package/client/src/components/ReviewDialog.tsx +44 -62
- package/client/src/components/RightPanel/ActivityTab.tsx +32 -16
- package/client/src/components/RightPanel/CodebaseMemorySection.tsx +3 -1
- package/client/src/components/RightPanel/ConfigTab.tsx +129 -140
- package/client/src/components/RightPanel/GenesisTab.tsx +67 -24
- package/client/src/components/RightPanel/HandoffsTab.tsx +4 -0
- package/client/src/components/RightPanel/KnowledgeTab.tsx +1 -1
- package/client/src/components/RightPanel/LedgerTab.tsx +1 -1
- package/client/src/components/RightPanel/McpRegistrySection.tsx +7 -6
- package/client/src/components/RightPanel/MoveTargetModal.tsx +6 -3
- package/client/src/components/RightPanel/OutputsPanel.tsx +44 -17
- package/client/src/components/RightPanel/PlanTab.tsx +131 -111
- package/client/src/components/RightPanel/ReviewTab.tsx +7 -4
- package/client/src/components/RightPanel/UsageTab.tsx +92 -3
- package/client/src/components/RightPanel/format.ts +3 -1
- package/client/src/components/RightPanel/index.tsx +10 -2
- package/client/src/components/RightPanel/types.ts +4 -2
- package/client/src/components/RunAsPicker.tsx +5 -3
- package/client/src/components/RuntimeStateBanner.tsx +13 -3
- package/client/src/components/SavedClustersList.tsx +30 -3
- package/client/src/components/ServicesTab.tsx +17 -34
- package/client/src/components/SettingsPanel.tsx +101 -337
- package/client/src/components/ShortcutCheatSheet.tsx +6 -4
- package/client/src/components/SkillEditorDialog.tsx +40 -74
- package/client/src/components/SkillsSettings.tsx +307 -0
- package/client/src/components/SpawnDialog.tsx +22 -44
- package/client/src/components/SpawnSeedPill.tsx +5 -4
- package/client/src/components/StaleBuildBanner.tsx +3 -1
- package/client/src/components/StorageWarnings.tsx +23 -0
- package/client/src/components/SystemHeader.tsx +19 -12
- package/client/src/components/SystemModal.tsx +6 -5
- package/client/src/components/TabBar.tsx +20 -10
- package/client/src/components/TabContextMenu.tsx +36 -10
- package/client/src/components/TaskCard.tsx +16 -11
- package/client/src/components/TasksPanel.tsx +13 -11
- package/client/src/components/Terminal/XtermView.tsx +2 -0
- package/client/src/components/TerminalInput.tsx +251 -446
- package/client/src/components/TerminalSessions.tsx +1 -1
- package/client/src/components/TidyComposer.tsx +24 -41
- package/client/src/components/TokenBadge.tsx +20 -17
- package/client/src/components/ToolCallPill.tsx +5 -3
- package/client/src/components/ToolboxMenu.tsx +5 -5
- package/client/src/components/TranscriptSendDialog.tsx +151 -202
- package/client/src/components/TurnTimer.tsx +21 -0
- package/client/src/components/UpdateAction.tsx +4 -1
- package/client/src/components/UsageBar.tsx +32 -126
- package/client/src/components/UserManual/index.tsx +6 -4
- package/client/src/components/UtilityAgentPicker.tsx +4 -2
- package/client/src/components/VoiceMenu.tsx +5 -1
- package/client/src/components/VoiceSetupSettings.tsx +21 -11
- package/client/src/components/WorkerCard.tsx +7 -1
- package/client/src/components/WorkerDetailModal.tsx +7 -3
- package/client/src/components/WorkflowCreator/ClusterMembersSection.tsx +6 -6
- package/client/src/components/WorkflowCreator/ProjectPicker.tsx +13 -12
- package/client/src/components/WorkflowCreator/index.tsx +238 -77
- package/client/src/components/WorkflowCreator/types.ts +5 -3
- package/client/src/components/WorkflowStatusChip.tsx +93 -13
- package/client/src/components/WorkflowView.tsx +59 -25
- package/client/src/components/WorkspaceRename.tsx +11 -1
- package/client/src/components/activityTime.ts +4 -0
- package/client/src/components/clusterNeedsYou.ts +35 -3
- package/client/src/components/compare/CompareDialog.tsx +32 -5
- package/client/src/components/compare/CompareOverlay.tsx +10 -3
- package/client/src/components/composer/submitComposer.ts +191 -0
- package/client/src/components/diff/ChangesPanel.tsx +4 -2
- package/client/src/components/diff/LiveChangesPanel.tsx +18 -2
- package/client/src/components/editor/CodeEditor.tsx +17 -2
- package/client/src/components/headerPopoverState.ts +15 -0
- package/client/src/components/help/DocViewer.tsx +6 -4
- package/client/src/components/help/HelpCard.tsx +3 -2
- package/client/src/components/help/HelpPopover.tsx +3 -1
- package/client/src/components/media/AudioEditor/AudioOpsPanel.tsx +16 -2
- package/client/src/components/media/DirectoryPicker.tsx +18 -11
- package/client/src/components/media/ImageEditor/ImageEditor.tsx +2 -2
- package/client/src/components/media/MediaModalHost.tsx +7 -15
- package/client/src/components/media/MediaStemsControls.tsx +16 -2
- package/client/src/components/media/VideoEditor/VideoOpsPanel.tsx +16 -2
- package/client/src/components/media/launchers.ts +4 -0
- package/client/src/components/plans/PlanChooser.tsx +135 -0
- package/client/src/components/plans/PlanRefsSection.tsx +47 -28
- package/client/src/components/plans/planBodySave.ts +17 -0
- package/client/src/components/plans/planRefs.ts +21 -11
- package/client/src/components/plans/startPlanGenesis.ts +37 -0
- package/client/src/components/primitives/Panel.tsx +1 -0
- package/client/src/components/providerPanelState.ts +17 -0
- package/client/src/components/settings/AppVersionSection.tsx +5 -5
- package/client/src/components/settings/AppWindowBrowserSection.tsx +88 -0
- package/client/src/components/settings/PreviewPortsSection.tsx +31 -0
- package/client/src/components/settings/SettingsLayout.tsx +1 -1
- package/client/src/components/settings/appWindowBrowserReport.ts +23 -0
- package/client/src/components/settings/navigation.ts +5 -1
- package/client/src/components/settings/settings.css +6 -0
- package/client/src/components/terminalInput/planDraft.ts +34 -5
- package/client/src/components/usageVisibility.ts +3 -2
- package/client/src/components/utilityResult.ts +5 -1
- package/client/src/components/workSurface/WorkSurfaceControls.tsx +125 -10
- package/client/src/components/workSurface/workSurface.css +10 -2
- package/client/src/explorer/ArtifactsLens.tsx +53 -17
- package/client/src/explorer/ExplorerApp.tsx +12 -7
- package/client/src/explorer/PlansLens.tsx +140 -39
- package/client/src/explorer/RecentsLens.tsx +22 -61
- package/client/src/explorer/StorageLens.tsx +281 -0
- package/client/src/explorer/changedAttribution.ts +23 -0
- package/client/src/explorer/launch.ts +6 -3
- package/client/src/explorer/plansGrouping.ts +15 -0
- package/client/src/explorer/treeReveal.ts +21 -0
- package/client/src/explorer/types.ts +3 -3
- package/client/src/help/content/chat.tsx +17 -10
- package/client/src/help/content/cluster.tsx +175 -109
- package/client/src/help/content/composer.tsx +149 -48
- package/client/src/help/content/gitOps.tsx +19 -19
- package/client/src/help/content/github.tsx +9 -4
- package/client/src/help/content/header.tsx +82 -61
- package/client/src/help/content/media.tsx +20 -20
- package/client/src/help/content/misc.tsx +475 -156
- package/client/src/help/content/recall.tsx +12 -12
- package/client/src/help/content/rightPanel.tsx +210 -97
- package/client/src/help/content/settings.tsx +120 -47
- package/client/src/help/content/shared.tsx +1 -1
- package/client/src/help/content/tabbar.tsx +1 -1
- package/client/src/help/manualSections/actions.tsx +43 -21
- package/client/src/help/manualSections/chat.tsx +28 -5
- package/client/src/help/manualSections/clusters.tsx +222 -147
- package/client/src/help/manualSections/configuration.tsx +236 -50
- package/client/src/help/manualSections/deepseek.tsx +7 -5
- package/client/src/help/manualSections/gettingStarted.tsx +74 -12
- package/client/src/help/manualSections/maintenance.tsx +84 -15
- package/client/src/help/manualSections/media.tsx +14 -12
- package/client/src/help/manualSections/plans.tsx +192 -15
- package/client/src/help/manualSections/powerFeatures.tsx +146 -51
- package/client/src/help/manualSections/providers.tsx +237 -42
- package/client/src/help/manualSections/reference.tsx +24 -10
- package/client/src/help/manualSections/strata.tsx +6 -6
- package/client/src/help/manualSections/troubleshooting.tsx +14 -8
- package/client/src/help/manualSections/voice.tsx +12 -7
- package/client/src/help/manualSections/workflows.tsx +76 -19
- package/client/src/help/manualSections/workspace.tsx +179 -48
- package/client/src/help/shortcuts.ts +1 -0
- package/client/src/hooks/useWebSocket.ts +49 -25
- package/client/src/layout/SlideOut.tsx +77 -0
- package/client/src/layout/ToolbarOverflow.tsx +97 -0
- package/client/src/layout/keepInWindow.ts +216 -0
- package/client/src/layout/layoutRange.ts +129 -0
- package/client/src/main.tsx +2 -0
- package/client/src/phosphor-demo/Demo.tsx +5 -13
- package/client/src/phosphor-demo/demo.css +1 -1
- package/client/src/stores/appStore.ts +75 -15
- package/client/src/stores/appStore.types.ts +37 -16
- package/client/src/stores/docEditStore.ts +13 -21
- package/client/src/stores/draftStore.ts +28 -4
- package/client/src/stores/knowledgeDistillStore.ts +4 -2
- package/client/src/stores/mdTuneupStore.ts +12 -6
- package/client/src/stores/memoryTrim.ts +18 -2
- package/client/src/stores/notificationChannelsStore.ts +21 -11
- package/client/src/stores/planGenesisStore.ts +67 -0
- package/client/src/stores/recallStore.ts +6 -0
- package/client/src/stores/storageWarningStore.ts +18 -0
- package/client/src/stores/terminalStore.ts +1 -1
- package/client/src/styles/global.css +72 -0
- package/client/src/styles/matrix.css +7 -0
- package/client/src/themes/apply.ts +3 -3
- package/client/src/themes/bootstrap.ts +3 -0
- package/client/src/utils/activeProject.ts +6 -0
- package/client/src/utils/activityPresentation.ts +51 -0
- package/client/src/utils/browserFamily.ts +22 -0
- package/client/src/utils/chatFileLinks.ts +3 -2
- package/client/src/utils/chatText.ts +14 -6
- package/client/src/utils/checkedJson.ts +11 -0
- package/client/src/utils/checkpointChanges.ts +18 -0
- package/client/src/utils/clusterCreation.ts +39 -0
- package/client/src/utils/clusterNudge.ts +31 -0
- package/client/src/utils/displayMessages.ts +45 -7
- package/client/src/utils/effortDefaults.ts +4 -3
- package/client/src/utils/format.ts +11 -4
- package/client/src/utils/gateArgs.ts +3 -2
- package/client/src/utils/gitDialogMemory.ts +26 -0
- package/client/src/utils/handoffSeeds.ts +13 -0
- package/client/src/utils/historyEvents.ts +22 -12
- package/client/src/utils/homeModel.ts +38 -3
- package/client/src/utils/memberReviewScope.ts +6 -0
- package/client/src/utils/outputNavigation.ts +16 -0
- package/client/src/utils/outputStyleText.ts +8 -0
- package/client/src/utils/publicProject.ts +130 -0
- package/client/src/utils/queuedMessageEdit.ts +40 -0
- package/client/src/utils/requestGeneration.ts +8 -0
- package/client/src/utils/rewindSupport.ts +17 -0
- package/client/src/utils/settingsRequests.ts +36 -0
- package/client/src/utils/settingsResponse.ts +8 -0
- package/client/src/utils/wsSession.ts +12 -5
- package/client/src/vendor/odysseus-editor/editor/clipboard-and-drop.js +9 -9
- package/client/src/vendor/odysseus-editor/editor/keyboard-shortcuts.js +2 -2
- package/client/src/vendor/odysseus-editor/editor/state.js +8 -0
- package/client/src/vendor/odysseus-editor/editor.css +13 -5
- package/client/src/vendor/odysseus-editor/galleryEditor.d.ts +1 -1
- package/client/src/vendor/odysseus-editor/galleryEditor.js +16 -5
- package/client/src/voice/executor.ts +4 -3
- package/client/src/voice/panels.ts +14 -3
- package/client/src/voice/screen.ts +48 -6
- package/client/src/voice/setupAudio.ts +5 -3
- package/client/src/ws/handleServerMessage.ts +158 -35
- package/client/src/ws/operatorQuestions.ts +2 -2
- package/docs/ARCHITECTURE.md +95 -55
- package/docs/ARCHITECTURE_REVIEW.md +47 -0
- package/docs/BACKUP.md +5 -2
- package/docs/CHAT.md +48 -37
- package/docs/CHECKPOINTS.md +45 -16
- package/docs/CLIENT.md +242 -88
- package/docs/CODEX_GPT56_CLUSTER_INCOMPAT.md +1 -1
- package/docs/DEEPSEEK.md +6 -6
- package/docs/DIAGNOSTICS.md +12 -7
- package/docs/EXTENDING.md +52 -48
- package/docs/FEATURES.md +42 -26
- package/docs/GENESIS.md +42 -6
- package/docs/GETTING_STARTED.md +63 -29
- package/docs/GIT_WORKBENCH.md +15 -9
- package/docs/GLOSSARY.md +44 -42
- package/docs/GOTCHAS.md +73 -59
- package/docs/HTTP_API.md +167 -39
- package/docs/INDEX.md +3 -4
- package/docs/KNOWLEDGE.md +6 -4
- package/docs/LOCAL_SERVICES.md +6 -6
- package/docs/LSP.md +4 -3
- package/docs/MCP_REGISTRY.md +16 -12
- package/docs/MEDIA_STUDIO.md +23 -16
- package/docs/NOTIFICATIONS.md +60 -28
- package/docs/OPERATIONS.md +237 -120
- package/docs/OPERATOR_ACTIONS.md +44 -25
- package/docs/OUTPUTS.md +35 -9
- package/docs/PERSISTENCE.md +117 -33
- package/docs/PHOSPHOR_DEMO.md +4 -4
- package/docs/PLAN_OR_BOARD.md +13 -1
- package/docs/PREVIEW_VERIFY.md +10 -8
- package/docs/PRIMITIVES.md +92 -89
- package/docs/PROTOCOL.md +113 -32
- package/docs/PROTOCOL_CLUSTER.md +80 -16
- package/docs/PROTOCOL_PRIMITIVES.md +9 -9
- package/docs/PROVIDERS.md +471 -82
- package/docs/RECALL.md +17 -12
- package/docs/REMOTE_MANAGEMENT.md +69 -8
- package/docs/REPO_LAYOUT.md +1 -1
- package/docs/RESUME_INDEX.md +16 -17
- package/docs/SERVICE_MODE.md +50 -11
- package/docs/SETTINGS.md +66 -13
- package/docs/STORAGE_PLAN.md +329 -0
- package/docs/STRATA.md +4 -4
- package/docs/TASK_LEDGER.md +38 -16
- package/docs/TERMINAL.md +14 -12
- package/docs/THIRD_PARTY.md +1 -3
- package/docs/VOICE.md +15 -7
- package/native/darwin-arm64/manifest.json +1 -1
- package/native/linux-arm64/manifest.json +1 -1
- package/native/win32-arm64/manifest.json +1 -1
- package/node_modules/@arco/shared/dist/clusterCoordination.js +15 -7
- package/node_modules/@arco/shared/dist/clusterRolePresets.js +8 -6
- package/node_modules/@arco/shared/dist/codexChat.d.ts +2 -0
- package/node_modules/@arco/shared/dist/codexChat.js +5 -0
- package/node_modules/@arco/shared/dist/folderName.d.ts +1 -0
- package/node_modules/@arco/shared/dist/folderName.js +18 -0
- package/node_modules/@arco/shared/dist/index.d.ts +8 -0
- package/node_modules/@arco/shared/dist/index.js +8 -0
- package/node_modules/@arco/shared/dist/localRuntimeStatus.d.ts +23 -0
- package/node_modules/@arco/shared/dist/localRuntimeStatus.js +47 -0
- package/node_modules/@arco/shared/dist/notificationTitle.d.ts +9 -0
- package/node_modules/@arco/shared/dist/notificationTitle.js +23 -0
- package/node_modules/@arco/shared/dist/outputStyle.d.ts +10 -0
- package/node_modules/@arco/shared/dist/outputStyle.js +28 -0
- package/node_modules/@arco/shared/dist/outputs.d.ts +1 -0
- package/node_modules/@arco/shared/dist/protocol/autoPickup.d.ts +3 -1
- package/node_modules/@arco/shared/dist/protocol/autoPickup.js +1 -1
- package/node_modules/@arco/shared/dist/protocol/chat.d.ts +4 -0
- package/node_modules/@arco/shared/dist/protocol/checkpoints.d.ts +25 -2
- package/node_modules/@arco/shared/dist/protocol/checkpoints.js +1 -0
- package/node_modules/@arco/shared/dist/protocol/clientMessages.d.ts +9 -14
- package/node_modules/@arco/shared/dist/protocol/clusters.d.ts +23 -5
- package/node_modules/@arco/shared/dist/protocol/clusters.js +3 -3
- package/node_modules/@arco/shared/dist/protocol/connections.d.ts +2 -0
- package/node_modules/@arco/shared/dist/protocol/diagnostics.js +1 -1
- package/node_modules/@arco/shared/dist/protocol/genesis.d.ts +9 -0
- 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/mcp.d.ts +1 -0
- package/node_modules/@arco/shared/dist/protocol/mcp.js +8 -5
- package/node_modules/@arco/shared/dist/protocol/mdTuneup.d.ts +8 -0
- package/node_modules/@arco/shared/dist/protocol/models.d.ts +3 -1
- package/node_modules/@arco/shared/dist/protocol/models.js +19 -8
- package/node_modules/@arco/shared/dist/protocol/notifications.d.ts +4 -2
- package/node_modules/@arco/shared/dist/protocol/notifications.js +18 -5
- package/node_modules/@arco/shared/dist/protocol/plans.d.ts +4 -1
- package/node_modules/@arco/shared/dist/protocol/remoteManagement.d.ts +6 -0
- package/node_modules/@arco/shared/dist/protocol/serverMessages.d.ts +70 -10
- package/node_modules/@arco/shared/dist/protocol/settings.d.ts +16 -4
- package/node_modules/@arco/shared/dist/protocol/settings.js +17 -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 +4 -0
- package/node_modules/@arco/shared/dist/protocol/usage.d.ts +1 -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/protocol/workers.d.ts +1 -0
- package/node_modules/@arco/shared/dist/protocol/workflows.d.ts +73 -14
- package/node_modules/@arco/shared/dist/protocol/workflows.js +66 -0
- 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/dist/runtimeVersions.d.ts +2 -0
- package/node_modules/@arco/shared/dist/runtimeVersions.js +13 -0
- package/node_modules/@arco/shared/dist/shellTool.d.ts +2 -0
- package/node_modules/@arco/shared/dist/shellTool.js +9 -0
- package/node_modules/@arco/shared/package.json +1 -1
- package/node_modules/xlsx/LICENSE +201 -0
- package/node_modules/xlsx/dist/cpexcel.js +1506 -0
- package/node_modules/xlsx/package.json +69 -0
- package/node_modules/xlsx/xlsx.js +28103 -0
- package/node_modules/xlsx/xlsx.mjs +28228 -0
- package/package.json +23 -3
- package/scripts/packaging/arco.mjs +19 -3
- package/scripts/packaging/browsers.mjs +366 -0
- package/scripts/packaging/launch.mjs +34 -20
- package/scripts/packaging/services.mjs +36 -6
- package/scripts/packaging/storage.mjs +161 -0
- package/scripts/packaging/update.mjs +3 -3
- package/server/dist/appBrowsers.d.ts +45 -0
- package/server/dist/appBrowsers.js +73 -0
- package/server/dist/architectureReview.d.ts +60 -0
- package/server/dist/architectureReview.js +347 -0
- package/server/dist/architectureSkill.d.ts +8 -0
- package/server/dist/architectureSkill.js +70 -0
- package/server/dist/arcoHome.d.ts +1 -0
- package/server/dist/arcoHome.js +43 -3
- package/server/dist/artifactCopy.d.ts +29 -0
- package/server/dist/artifactCopy.js +475 -0
- package/server/dist/atomicFile.d.ts +1 -0
- package/server/dist/atomicFile.js +6 -1
- package/server/dist/attention.d.ts +6 -2
- package/server/dist/attention.js +37 -29
- package/server/dist/auth.d.ts +1 -0
- package/server/dist/auth.js +19 -6
- package/server/dist/authLoginSession.d.ts +2 -0
- package/server/dist/authLoginSession.js +6 -1
- package/server/dist/boundedRead.d.ts +26 -0
- package/server/dist/boundedRead.js +246 -0
- package/server/dist/capabilities.d.ts +4 -1
- package/server/dist/capabilities.js +25 -8
- package/server/dist/catchUp.d.ts +9 -0
- package/server/dist/catchUp.js +66 -24
- package/server/dist/checkedFile.d.ts +5 -0
- package/server/dist/checkedFile.js +138 -0
- package/server/dist/claudeTransport.d.ts +7 -0
- package/server/dist/claudeTransport.js +14 -0
- package/server/dist/clusterAutoTurn.d.ts +7 -0
- package/server/dist/clusterAutoTurn.js +54 -7
- package/server/dist/clusterBusyReminder.d.ts +7 -0
- package/server/dist/clusterBusyReminder.js +45 -0
- package/server/dist/clusterDirector.js +6 -3
- package/server/dist/clusterIdleNudger.d.ts +6 -0
- package/server/dist/clusterIdleNudger.js +5 -0
- package/server/dist/clusterMailbox.d.ts +4 -2
- package/server/dist/clusterMailbox.js +104 -24
- package/server/dist/clusterPeerOps.d.ts +2 -0
- package/server/dist/clusterPeerOps.js +11 -21
- package/server/dist/clusterPlanBridge.d.ts +6 -3
- package/server/dist/clusterPlanBridge.js +48 -45
- package/server/dist/clusterPresets.js +46 -32
- package/server/dist/clusterProgress.js +3 -0
- package/server/dist/clusterSnapshots.d.ts +1 -1
- package/server/dist/clusterSnapshots.js +39 -14
- package/server/dist/clusterStore.d.ts +3 -0
- package/server/dist/clusterStore.js +23 -13
- package/server/dist/clusterTurnTools.d.ts +4 -0
- package/server/dist/clusterTurnTools.js +9 -0
- package/server/dist/commandShell.d.ts +56 -0
- package/server/dist/commandShell.js +278 -0
- package/server/dist/compactionCounter.d.ts +6 -0
- package/server/dist/compactionCounter.js +73 -0
- package/server/dist/compactionReport.d.ts +8 -0
- package/server/dist/compactionReport.js +15 -0
- package/server/dist/contentSearch.js +16 -6
- package/server/dist/contextCalibrator.js +7 -2
- package/server/dist/contextEstimator.d.ts +4 -0
- package/server/dist/contextEstimator.js +76 -17
- package/server/dist/contextRefs.d.ts +1 -0
- package/server/dist/contextRefs.js +44 -9
- package/server/dist/conversationActivity.d.ts +3 -0
- package/server/dist/conversationActivity.js +27 -0
- package/server/dist/cursorUsage.js +15 -4
- package/server/dist/diagnostics/checks.js +4 -12
- package/server/dist/diagnostics/executableLookup.d.ts +2 -0
- package/server/dist/diagnostics/executableLookup.js +28 -0
- package/server/dist/diagnostics/modelHealth.js +3 -12
- package/server/dist/diagnostics/supportBundle.js +5 -13
- package/server/dist/eventLog.d.ts +74 -0
- package/server/dist/eventLog.js +992 -0
- package/server/dist/existingClusterMembers.d.ts +1 -0
- package/server/dist/existingClusterMembers.js +9 -0
- package/server/dist/explorerArtifacts.js +46 -12
- package/server/dist/explorerChanged.d.ts +7 -0
- package/server/dist/explorerChanged.js +116 -80
- package/server/dist/explorerDocs.d.ts +11 -0
- package/server/dist/explorerDocs.js +46 -48
- package/server/dist/explorerLaunch.d.ts +8 -1
- package/server/dist/explorerLaunch.js +11 -2
- package/server/dist/explorerPlans.d.ts +4 -0
- package/server/dist/explorerPlans.js +27 -2
- package/server/dist/fileAccessPolicy.d.ts +21 -0
- package/server/dist/fileAccessPolicy.js +89 -1
- package/server/dist/fileContent/decodeSlots.d.ts +1 -0
- package/server/dist/fileContent/decodeSlots.js +50 -0
- package/server/dist/fileContent/detect.d.ts +2 -0
- package/server/dist/fileContent/detect.js +55 -0
- package/server/dist/fileContent/externalImage.d.ts +3 -0
- package/server/dist/fileContent/externalImage.js +68 -0
- package/server/dist/fileContent/icons.d.ts +4 -0
- package/server/dist/fileContent/icons.js +58 -0
- package/server/dist/fileContent/images.d.ts +15 -0
- package/server/dist/fileContent/images.js +182 -0
- package/server/dist/fileContent/legacyText.d.ts +3 -0
- package/server/dist/fileContent/legacyText.js +19 -0
- package/server/dist/fileContent/notebook.d.ts +2 -0
- package/server/dist/fileContent/notebook.js +54 -0
- package/server/dist/fileContent/office.d.ts +3 -0
- package/server/dist/fileContent/office.js +349 -0
- package/server/dist/fileContent/pdf.d.ts +2 -0
- package/server/dist/fileContent/pdf.js +76 -0
- package/server/dist/fileContent/pngRows.d.ts +4 -0
- package/server/dist/fileContent/pngRows.js +118 -0
- package/server/dist/fileContent/svg.d.ts +3 -0
- package/server/dist/fileContent/svg.js +60 -0
- package/server/dist/fileContent/types.d.ts +8 -0
- package/server/dist/fileContent/types.js +43 -0
- package/server/dist/fileContent/worker.d.ts +1 -0
- package/server/dist/fileContent/worker.js +68 -0
- package/server/dist/fileContent.d.ts +55 -0
- package/server/dist/fileContent.js +81 -0
- package/server/dist/fileContextReceipts.d.ts +12 -0
- package/server/dist/fileContextReceipts.js +53 -0
- package/server/dist/fileFetch.d.ts +17 -0
- package/server/dist/fileFetch.js +191 -0
- package/server/dist/fileVersion.d.ts +10 -0
- package/server/dist/fileVersion.js +43 -0
- package/server/dist/genesis/creative.js +28 -36
- package/server/dist/genesis/prompts.js +4 -0
- package/server/dist/genesis/savePlan.d.ts +5 -0
- package/server/dist/genesis/savePlan.js +49 -0
- package/server/dist/genesis/stages.js +4 -4
- package/server/dist/gitDiff.js +25 -5
- package/server/dist/gitSnapshots.d.ts +18 -0
- package/server/dist/gitSnapshots.js +280 -149
- package/server/dist/gitWorking.js +15 -13
- package/server/dist/github.js +5 -1
- package/server/dist/goalRun.d.ts +1 -1
- package/server/dist/goalRun.js +7 -5
- package/server/dist/handoffHistory.d.ts +26 -0
- package/server/dist/handoffHistory.js +80 -0
- package/server/dist/handoffHistoryProtocol.d.ts +59 -0
- package/server/dist/handoffHistoryProtocol.js +20 -0
- package/server/dist/handoffHistorySupport.d.ts +2 -0
- package/server/dist/handoffHistorySupport.js +11 -0
- package/server/dist/handoffHistoryTool.d.ts +29 -0
- package/server/dist/handoffHistoryTool.js +235 -0
- package/server/dist/handoffPrompts.js +6 -4
- package/server/dist/handoffReplay.d.ts +9 -0
- package/server/dist/handoffReplay.js +14 -0
- package/server/dist/handoffSeedCache.d.ts +3 -0
- package/server/dist/handoffSeedCache.js +26 -0
- package/server/dist/http/appBrowserRoutes.d.ts +3 -0
- package/server/dist/http/appBrowserRoutes.js +16 -0
- package/server/dist/http/architectureReviewRoutes.d.ts +3 -0
- package/server/dist/http/architectureReviewRoutes.js +117 -0
- package/server/dist/http/clusterRoutes.js +15 -1
- package/server/dist/http/clusterSnapshotRoutes.js +8 -3
- package/server/dist/http/connectionsRoutes.js +3 -1
- package/server/dist/http/diffRoutes.js +37 -3
- package/server/dist/http/explorerRoot.d.ts +3 -0
- package/server/dist/http/explorerRoot.js +22 -0
- package/server/dist/http/explorerRoutes.js +66 -12
- package/server/dist/http/fileRead.js +2 -3
- package/server/dist/http/fileWriteRoutes.js +4 -3
- package/server/dist/http/gitCompareRoutes.js +4 -6
- package/server/dist/http/gitDiffRoutes.js +3 -3
- package/server/dist/http/gitOpRoutes.js +3 -5
- package/server/dist/http/gitWorktreeRoutes.js +3 -3
- package/server/dist/http/handoffHistoryRoutes.d.ts +4 -0
- package/server/dist/http/handoffHistoryRoutes.js +59 -0
- package/server/dist/http/imageWriteRoutes.js +6 -2
- package/server/dist/http/knowledgeRoutes.js +2 -0
- package/server/dist/http/mediaOpsRoutes.js +2 -3
- package/server/dist/http/originGuard.d.ts +1 -1
- package/server/dist/http/originGuard.js +95 -12
- package/server/dist/http/outputRoutes.js +31 -6
- package/server/dist/http/projectBinding.d.ts +3 -0
- package/server/dist/http/projectBinding.js +133 -0
- package/server/dist/http/providerThrottleRoutes.d.ts +8 -0
- package/server/dist/http/providerThrottleRoutes.js +96 -0
- package/server/dist/http/publicProjectRoutes.d.ts +2 -0
- package/server/dist/http/publicProjectRoutes.js +109 -0
- package/server/dist/http/readConfinement.d.ts +2 -1
- package/server/dist/http/readConfinement.js +17 -15
- package/server/dist/http/router.js +230 -62
- package/server/dist/http/searchRoutes.js +4 -4
- package/server/dist/http/sessionTransport.d.ts +2 -0
- package/server/dist/http/sessionTransport.js +32 -0
- package/server/dist/http/skillManagementRoutes.d.ts +5 -0
- package/server/dist/http/skillManagementRoutes.js +166 -0
- package/server/dist/http/storageRoutes.d.ts +2 -0
- package/server/dist/http/storageRoutes.js +268 -0
- package/server/dist/http/usageStatsRoutes.js +3 -12
- package/server/dist/http/utilityAgentRoutes.js +27 -5
- package/server/dist/http/workflowDataRoutes.js +75 -14
- package/server/dist/http/writeConfinement.d.ts +5 -3
- package/server/dist/http/writeConfinement.js +37 -11
- package/server/dist/http/wsAuth.d.ts +3 -2
- package/server/dist/http/wsAuth.js +26 -8
- package/server/dist/imageTokens.d.ts +7 -0
- package/server/dist/imageTokens.js +85 -0
- package/server/dist/index.js +287 -178
- package/server/dist/inputDeliveryHistory.d.ts +21 -0
- package/server/dist/inputDeliveryHistory.js +146 -0
- package/server/dist/keepStore.d.ts +20 -0
- package/server/dist/keepStore.js +167 -0
- package/server/dist/knowledge/store.js +28 -20
- package/server/dist/legacyTarRestore.d.ts +1 -0
- package/server/dist/legacyTarRestore.js +240 -0
- package/server/dist/llamacppCatalog.d.ts +8 -1
- package/server/dist/llamacppCatalog.js +65 -13
- package/server/dist/localRuntimeStatus.d.ts +35 -0
- package/server/dist/localRuntimeStatus.js +136 -0
- package/server/dist/lsp/client.js +28 -9
- package/server/dist/lsp/servers.js +2 -2
- package/server/dist/managedPath.d.ts +2 -0
- package/server/dist/managedPath.js +47 -0
- package/server/dist/management/clusterActivity.js +6 -20
- package/server/dist/management/hubGuard.d.ts +23 -0
- package/server/dist/management/hubGuard.js +118 -0
- package/server/dist/management/hubLink.d.ts +4 -1
- package/server/dist/management/hubLink.js +8 -1
- package/server/dist/management/initHubLink.d.ts +12 -0
- package/server/dist/management/initHubLink.js +54 -65
- package/server/dist/manualCompactCapability.d.ts +2 -0
- package/server/dist/manualCompactCapability.js +7 -0
- package/server/dist/mcp/arcoMcpServer.js +4 -0
- package/server/dist/mcp/client.d.ts +4 -4
- package/server/dist/mcp/client.js +31 -10
- package/server/dist/mcp/clusterMcpLoopback.d.ts +4 -0
- package/server/dist/mcp/clusterMcpLoopback.js +21 -1
- package/server/dist/mcp/clusterMcpTools.js +33 -27
- package/server/dist/mcp/fileContent.d.ts +8 -0
- package/server/dist/mcp/fileContent.js +55 -0
- package/server/dist/mcp/fileMcpServer.d.ts +1 -0
- package/server/dist/mcp/fileMcpServer.js +13 -0
- package/server/dist/mcp/fileMcpTools.d.ts +2 -0
- package/server/dist/mcp/fileMcpTools.js +54 -0
- package/server/dist/mcp/handoffHistoryMcpTools.d.ts +3 -0
- package/server/dist/mcp/handoffHistoryMcpTools.js +27 -0
- package/server/dist/mcp/mcpConfigWriter.d.ts +5 -0
- package/server/dist/mcp/mcpConfigWriter.js +44 -12
- package/server/dist/mcp/planMcpTools.d.ts +6 -14
- package/server/dist/mcp/planMcpTools.js +6 -250
- package/server/dist/mcp/planReadMcpServer.d.ts +1 -0
- package/server/dist/mcp/planReadMcpServer.js +19 -0
- package/server/dist/mcp/registry.js +44 -38
- package/server/dist/mcp/registryWiring.js +4 -5
- package/server/dist/media/demucs.d.ts +5 -0
- package/server/dist/media/demucs.js +16 -4
- package/server/dist/media/ffmpeg.js +24 -16
- package/server/dist/media/scratch.js +24 -9
- package/server/dist/noticeSource.d.ts +2 -0
- package/server/dist/noticeSource.js +11 -0
- package/server/dist/notifications.d.ts +4 -1
- package/server/dist/notifications.js +11 -6
- package/server/dist/npmPlatformResolve.d.ts +9 -3
- package/server/dist/npmPlatformResolve.js +24 -5
- package/server/dist/ntfyTransport.d.ts +2 -1
- package/server/dist/ntfyTransport.js +15 -4
- package/server/dist/outputGrants.d.ts +9 -0
- package/server/dist/outputGrants.js +63 -0
- package/server/dist/outputStore.d.ts +1 -0
- package/server/dist/outputStore.js +1 -1
- package/server/dist/outputs.js +117 -21
- package/server/dist/peerRecipientContext.js +22 -5
- package/server/dist/planHistory.d.ts +3 -0
- package/server/dist/planHistory.js +60 -0
- package/server/dist/planStore.d.ts +11 -2
- package/server/dist/planStore.js +236 -64
- package/server/dist/planTools.d.ts +41 -0
- package/server/dist/planTools.js +259 -0
- package/server/dist/previewAutoDetect.js +31 -23
- package/server/dist/previewPortConfiguration.d.ts +2 -0
- package/server/dist/previewPortConfiguration.js +32 -0
- package/server/dist/previewPorts.d.ts +1 -0
- package/server/dist/previewPorts.js +3 -0
- package/server/dist/previewProxy.d.ts +30 -9
- package/server/dist/previewProxy.js +226 -183
- package/server/dist/primaryBackgroundTracker.d.ts +15 -2
- package/server/dist/primaryBackgroundTracker.js +172 -63
- package/server/dist/primitives/exportContext.d.ts +3 -0
- package/server/dist/primitives/exportContext.js +77 -15
- package/server/dist/primitives/localFileContext.d.ts +3 -0
- package/server/dist/primitives/localFileContext.js +38 -0
- package/server/dist/primitives/reviewContent.d.ts +2 -0
- package/server/dist/primitives/reviewContent.js +53 -6
- package/server/dist/primitives/runCompare.js +1 -1
- package/server/dist/primitives/runDocEdit.js +1 -1
- package/server/dist/primitives/runMdTuneup.d.ts +7 -2
- package/server/dist/primitives/runMdTuneup.js +59 -32
- package/server/dist/primitives/runResearch.js +1 -1
- package/server/dist/primitives/runReviewer.d.ts +2 -0
- package/server/dist/primitives/runReviewer.js +5 -2
- package/server/dist/primitives/seedWorker.d.ts +11 -2
- package/server/dist/primitives/seedWorker.js +26 -12
- package/server/dist/project/orchestrationProposals.d.ts +1 -0
- package/server/dist/project/orchestrationProposals.js +5 -1
- package/server/dist/project/taskLedger.d.ts +5 -0
- package/server/dist/project/taskLedger.js +36 -11
- package/server/dist/projectGlob.d.ts +1 -0
- package/server/dist/projectGlob.js +9 -0
- package/server/dist/projectIgnore.d.ts +1 -0
- package/server/dist/projectIgnore.js +24 -0
- package/server/dist/projectScan.d.ts +24 -0
- package/server/dist/projectScan.js +101 -0
- package/server/dist/projectStateIgnore.d.ts +13 -0
- package/server/dist/projectStateIgnore.js +36 -1
- package/server/dist/projects.d.ts +11 -3
- package/server/dist/projects.js +141 -40
- package/server/dist/prompts.js +7 -8
- package/server/dist/proportionateTestingSkill.d.ts +7 -0
- package/server/dist/proportionateTestingSkill.js +32 -0
- package/server/dist/providers/attachmentLabels.d.ts +4 -0
- package/server/dist/providers/attachmentLabels.js +9 -0
- package/server/dist/providers/attachments.d.ts +1 -3
- package/server/dist/providers/attachments.js +58 -173
- package/server/dist/providers/claude-native/apiEndpoint.d.ts +2 -0
- package/server/dist/providers/claude-native/apiEndpoint.js +8 -0
- package/server/dist/providers/claude-native/appendOnlyPrefix.js +21 -1
- package/server/dist/providers/claude-native/catalog.js +17 -15
- package/server/dist/providers/claude-native/contentBlocks.d.ts +22 -2
- package/server/dist/providers/claude-native/contentBlocks.js +31 -8
- package/server/dist/providers/claude-native/contextBudget.d.ts +0 -4
- package/server/dist/providers/claude-native/contextBudget.js +0 -2
- package/server/dist/providers/claude-native/editApply.js +6 -1
- package/server/dist/providers/claude-native/fileContent.d.ts +15 -0
- package/server/dist/providers/claude-native/fileContent.js +120 -0
- package/server/dist/providers/claude-native/filterConfigs/bash-cargo-test.js +2 -0
- package/server/dist/providers/claude-native/filterConfigs/bash-jest-vitest.js +2 -0
- package/server/dist/providers/claude-native/filterConfigs/bash-pytest.js +2 -0
- package/server/dist/providers/claude-native/filterConfigs/index.js +2 -1
- package/server/dist/providers/claude-native/foldDigest.js +10 -2
- package/server/dist/providers/claude-native/gateReview.d.ts +1 -1
- package/server/dist/providers/claude-native/gateReview.js +0 -0
- package/server/dist/providers/claude-native/hookIf.d.ts +28 -0
- package/server/dist/providers/claude-native/hookIf.js +590 -0
- package/server/dist/providers/claude-native/hooks.d.ts +77 -7
- package/server/dist/providers/claude-native/hooks.js +344 -52
- package/server/dist/providers/claude-native/imageRead.d.ts +15 -0
- package/server/dist/providers/claude-native/imageRead.js +108 -0
- package/server/dist/providers/claude-native/index.d.ts +4 -1
- package/server/dist/providers/claude-native/index.js +32 -2
- package/server/dist/providers/claude-native/mediaLimits.d.ts +6 -0
- package/server/dist/providers/claude-native/mediaLimits.js +15 -0
- package/server/dist/providers/claude-native/mediaRetention.d.ts +11 -0
- package/server/dist/providers/claude-native/mediaRetention.js +66 -0
- package/server/dist/providers/claude-native/mediaRetirementNotice.d.ts +1 -0
- package/server/dist/providers/claude-native/mediaRetirementNotice.js +12 -0
- package/server/dist/providers/claude-native/modelParams.d.ts +6 -0
- package/server/dist/providers/claude-native/modelParams.js +21 -3
- package/server/dist/providers/claude-native/oauth.js +9 -8
- package/server/dist/providers/claude-native/outputAccumulator.d.ts +2 -0
- package/server/dist/providers/claude-native/outputAccumulator.js +29 -18
- package/server/dist/providers/claude-native/peerTools.js +5 -156
- package/server/dist/providers/claude-native/pretoolGuards.js +92 -9
- package/server/dist/providers/claude-native/registryTools.js +4 -2
- package/server/dist/providers/claude-native/resumeSummary.d.ts +23 -2
- package/server/dist/providers/claude-native/resumeSummary.js +163 -45
- package/server/dist/providers/claude-native/sandboxExecutor.js +26 -19
- package/server/dist/providers/claude-native/taskAdmission.d.ts +21 -0
- package/server/dist/providers/claude-native/taskAdmission.js +75 -0
- package/server/dist/providers/claude-native/toolChecks.d.ts +38 -0
- package/server/dist/providers/claude-native/toolChecks.js +96 -0
- package/server/dist/providers/claude-native/toolPosture.js +5 -3
- package/server/dist/providers/claude-native/toolResultEviction.d.ts +4 -3
- package/server/dist/providers/claude-native/toolResultEviction.js +18 -29
- package/server/dist/providers/claude-native/tools.d.ts +17 -4
- package/server/dist/providers/claude-native/tools.js +248 -135
- package/server/dist/providers/claude-native/usageContext.d.ts +30 -0
- package/server/dist/providers/claude-native/usageContext.js +70 -0
- package/server/dist/providers/claude-native/wireFingerprint.d.ts +2 -2
- package/server/dist/providers/claude-native/wireFingerprint.js +2 -2
- package/server/dist/providers/claude-native/worker.d.ts +63 -1
- package/server/dist/providers/claude-native/worker.js +1103 -324
- package/server/dist/providers/claude-native/workerHelpers.d.ts +13 -0
- package/server/dist/providers/claude-native/workerHelpers.js +117 -6
- package/server/dist/providers/claude-native/workspaceFacts.js +2 -2
- package/server/dist/providers/claude.d.ts +1 -0
- package/server/dist/providers/claude.js +69 -85
- package/server/dist/providers/clusterTaskToolDefinitions.d.ts +11 -0
- package/server/dist/providers/clusterTaskToolDefinitions.js +161 -0
- package/server/dist/providers/codex-appserver/catalog.js +26 -20
- package/server/dist/providers/codex-appserver/index.js +10 -3
- package/server/dist/providers/codex-appserver/jsonRpc.d.ts +2 -1
- package/server/dist/providers/codex-appserver/jsonRpc.js +11 -3
- package/server/dist/providers/codex-appserver/worker.d.ts +5 -0
- package/server/dist/providers/codex-appserver/worker.js +119 -81
- package/server/dist/providers/codex.js +55 -58
- package/server/dist/providers/codexChatBoundary.d.ts +11 -0
- package/server/dist/providers/codexChatBoundary.js +60 -0
- package/server/dist/providers/codexCodeMode.js +2 -2
- package/server/dist/providers/codexContextWindow.js +2 -2
- package/server/dist/providers/codexHome.d.ts +1 -0
- package/server/dist/providers/codexHome.js +6 -0
- package/server/dist/providers/codexImageTool.d.ts +6 -0
- package/server/dist/providers/codexImageTool.js +21 -0
- package/server/dist/providers/codexVersion.d.ts +1 -0
- package/server/dist/providers/codexVersion.js +14 -0
- package/server/dist/providers/codexWebSearch.d.ts +2 -0
- package/server/dist/providers/codexWebSearch.js +4 -0
- package/server/dist/providers/cursor/acpJsonRpc.d.ts +1 -0
- package/server/dist/providers/cursor/acpJsonRpc.js +3 -1
- package/server/dist/providers/cursor/authState.d.ts +10 -0
- package/server/dist/providers/cursor/authState.js +78 -0
- package/server/dist/providers/cursor/catalog.js +22 -14
- package/server/dist/providers/cursor/chatSandbox.d.ts +11 -0
- package/server/dist/providers/cursor/chatSandbox.js +81 -0
- package/server/dist/providers/cursor/filePlugin.d.ts +4 -0
- package/server/dist/providers/cursor/filePlugin.js +31 -0
- package/server/dist/providers/cursor/index.d.ts +1 -0
- package/server/dist/providers/cursor/index.js +30 -4
- package/server/dist/providers/cursor/modelMap.d.ts +35 -0
- package/server/dist/providers/cursor/modelMap.js +180 -0
- package/server/dist/providers/cursor/print.js +95 -30
- package/server/dist/providers/cursor/worker.d.ts +4 -1
- package/server/dist/providers/cursor/worker.js +169 -89
- package/server/dist/providers/errorClassifier.js +6 -2
- package/server/dist/providers/handoffHistoryBinding.d.ts +11 -0
- package/server/dist/providers/handoffHistoryBinding.js +43 -0
- package/server/dist/providers/index.d.ts +1 -1
- package/server/dist/providers/index.js +18 -18
- package/server/dist/providers/llamacpp.d.ts +1 -0
- package/server/dist/providers/llamacpp.js +102 -192
- package/server/dist/providers/llamacppManager.d.ts +5 -0
- package/server/dist/providers/llamacppManager.js +68 -32
- package/server/dist/providers/llamacppVersion.d.ts +1 -0
- package/server/dist/providers/llamacppVersion.js +5 -0
- package/server/dist/providers/lmstudio.d.ts +3 -3
- package/server/dist/providers/lmstudio.js +133 -207
- package/server/dist/providers/localFileMedia.d.ts +25 -0
- package/server/dist/providers/localFileMedia.js +302 -0
- package/server/dist/providers/localMcp.d.ts +17 -0
- package/server/dist/providers/localMcp.js +85 -0
- package/server/dist/providers/localProviderQueue.d.ts +2 -0
- package/server/dist/providers/localProviderQueue.js +11 -0
- package/server/dist/providers/localShellLifecycle.d.ts +7 -0
- package/server/dist/providers/localShellLifecycle.js +33 -0
- package/server/dist/providers/localToolDispatch.d.ts +28 -0
- package/server/dist/providers/localToolDispatch.js +90 -0
- package/server/dist/providers/ollama.d.ts +2 -1
- package/server/dist/providers/ollama.js +180 -181
- package/server/dist/providers/ollamaDurableCompaction.js +5 -4
- package/server/dist/providers/ollamaExecutionHistory.d.ts +1 -1
- package/server/dist/providers/ollamaExecutionHistory.js +55 -14
- package/server/dist/providers/ollamaFencedTools.js +10 -11
- package/server/dist/providers/ollamaResilience.js +9 -13
- package/server/dist/providers/ollamaTokens.js +3 -4
- package/server/dist/providers/ollamaToolSubset.d.ts +2 -0
- package/server/dist/providers/ollamaToolSubset.js +11 -40
- package/server/dist/providers/ollamaTools.d.ts +13 -0
- package/server/dist/providers/ollamaTools.js +225 -219
- package/server/dist/providers/outputStyle.d.ts +2 -1
- package/server/dist/providers/outputStyle.js +70 -76
- package/server/dist/providers/providerFileContent.d.ts +40 -0
- package/server/dist/providers/providerFileContent.js +151 -0
- package/server/dist/providers/renderedTranscript.d.ts +1 -0
- package/server/dist/providers/renderedTranscript.js +3 -0
- package/server/dist/providers/requestDeadline.d.ts +1 -0
- package/server/dist/providers/requestDeadline.js +26 -0
- package/server/dist/providers/sessionScope.d.ts +2 -0
- package/server/dist/providers/sessionScope.js +8 -0
- package/server/dist/providers/types.d.ts +1 -0
- package/server/dist/publicProject.d.ts +62 -0
- package/server/dist/publicProject.js +181 -0
- package/server/dist/publicProjectChoice.d.ts +4 -0
- package/server/dist/publicProjectChoice.js +46 -0
- package/server/dist/quota.d.ts +10 -7
- package/server/dist/quota.js +49 -19
- package/server/dist/recall/index.js +22 -23
- package/server/dist/recall/search.js +9 -32
- package/server/dist/recall/transcriptSearch.d.ts +4 -0
- package/server/dist/recall/transcriptSearch.js +29 -0
- package/server/dist/recentFilesLedger.js +9 -7
- package/server/dist/recentProjectActivity.d.ts +11 -0
- package/server/dist/recentProjectActivity.js +69 -0
- package/server/dist/scanDeadline.d.ts +4 -0
- package/server/dist/scanDeadline.js +48 -0
- package/server/dist/searchText.d.ts +1 -0
- package/server/dist/searchText.js +22 -0
- package/server/dist/server/broadcast.d.ts +2 -1
- package/server/dist/server/broadcast.js +177 -50
- package/server/dist/sessionJsonl.js +45 -19
- package/server/dist/settings.d.ts +6 -1
- package/server/dist/settings.js +183 -56
- package/server/dist/skillManagement.d.ts +125 -0
- package/server/dist/skillManagement.js +709 -0
- package/server/dist/skillMutation.d.ts +1 -0
- package/server/dist/skillMutation.js +6 -0
- package/server/dist/skills.d.ts +75 -1
- package/server/dist/skills.js +254 -75
- package/server/dist/smartPickup.d.ts +1 -0
- package/server/dist/smartPickup.js +2 -1
- package/server/dist/smartPickupAdapters.d.ts +8 -0
- package/server/dist/smartPickupAdapters.js +201 -14
- 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 +389 -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/storageRoot.d.ts +5 -0
- package/server/dist/storageRoot.js +38 -0
- package/server/dist/storageTurnWatch.d.ts +6 -0
- package/server/dist/storageTurnWatch.js +36 -0
- package/server/dist/storageWarnings.d.ts +4 -0
- package/server/dist/storageWarnings.js +96 -0
- package/server/dist/taskDispatcher.js +69 -41
- package/server/dist/templates/store.js +75 -59
- package/server/dist/terminal/ptyManager.d.ts +3 -1
- package/server/dist/terminal/ptyManager.js +44 -37
- package/server/dist/terminal/ptyPidRegistry.d.ts +4 -2
- package/server/dist/terminal/ptyPidRegistry.js +9 -63
- package/server/dist/thirdPartySkills.d.ts +4 -0
- package/server/dist/thirdPartySkills.js +80 -0
- package/server/dist/toolPath.d.ts +1 -0
- package/server/dist/toolPath.js +38 -0
- package/server/dist/toolboxWorkflow.js +2 -1
- package/server/dist/uploadImages.d.ts +6 -0
- package/server/dist/uploadImages.js +155 -0
- package/server/dist/voice/computerContext.js +2 -0
- package/server/dist/voice/conditionSchema.d.ts +1 -0
- package/server/dist/voice/conditionSchema.js +3 -1
- package/server/dist/voice/conditions.js +1 -1
- package/server/dist/workers/StreamParser.d.ts +3 -0
- package/server/dist/workers/StreamParser.js +45 -11
- package/server/dist/workers/WorkerManager.d.ts +9 -2
- package/server/dist/workers/WorkerManager.js +18 -18
- package/server/dist/workers/durablePidRegistry.d.ts +53 -0
- package/server/dist/workers/durablePidRegistry.js +289 -0
- package/server/dist/workers/limits.js +5 -2
- package/server/dist/workers/pidRegistry.d.ts +6 -9
- package/server/dist/workers/pidRegistry.js +13 -101
- package/server/dist/workers/processActivity.d.ts +6 -0
- package/server/dist/workers/processActivity.js +13 -0
- package/server/dist/workers/processKill.d.ts +30 -0
- package/server/dist/workers/processKill.js +174 -0
- package/server/dist/workers/processStartTime.d.ts +21 -5
- package/server/dist/workers/processStartTime.js +127 -50
- package/server/dist/workflowMeta.d.ts +15 -12
- package/server/dist/workflowMeta.js +42 -10
- package/server/dist/workflowStore.d.ts +3 -0
- package/server/dist/workflowStore.js +275 -88
- package/server/dist/workflows/modelTitles.js +4 -3
- 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.d.ts +2 -0
- package/server/dist/workflows/sessionIndex.js +46 -19
- package/server/dist/workflows/types.d.ts +15 -5
- package/server/dist/workspace.d.ts +1 -0
- package/server/dist/workspace.js +5 -0
- package/server/dist/ws/afterTurn.d.ts +9 -0
- package/server/dist/ws/afterTurn.js +25 -0
- package/server/dist/ws/clusterHandlers.d.ts +7 -2
- package/server/dist/ws/clusterHandlers.js +361 -407
- package/server/dist/ws/clusterMembers.d.ts +42 -0
- package/server/dist/ws/clusterMembers.js +165 -0
- package/server/dist/ws/compactHandlers.js +38 -28
- package/server/dist/ws/gateHandlers.js +2 -1
- package/server/dist/ws/genesisHandlers.js +171 -116
- package/server/dist/ws/handoffHandlers.d.ts +3 -1
- package/server/dist/ws/handoffHandlers.js +367 -196
- package/server/dist/ws/previewCaptureHandlers.js +1 -4
- package/server/dist/ws/taskLedgerHandlers.d.ts +6 -1
- package/server/dist/ws/taskLedgerHandlers.js +34 -13
- package/server/dist/ws/taskLifecycle.d.ts +15 -0
- package/server/dist/ws/taskLifecycle.js +39 -0
- package/server/dist/ws/turnEngine.d.ts +27 -8
- package/server/dist/ws/turnEngine.js +1790 -1637
- package/server/dist/ws/turnPrompt.d.ts +17 -0
- package/server/dist/ws/turnPrompt.js +47 -0
- package/server/dist/ws/turnSettings.d.ts +41 -0
- package/server/dist/ws/turnSettings.js +61 -0
- package/server/dist/ws/updatePrimaryConfig.js +63 -40
- package/server/dist/ws/workflowHandlers.d.ts +2 -1
- package/server/dist/ws/workflowHandlers.js +223 -182
- package/server/package.json +1 -1
- package/server/src/appBrowsers.ts +95 -0
- package/server/src/architectureReview.ts +327 -0
- package/server/src/architectureSkill.ts +71 -0
- package/server/src/arcoHome.ts +42 -3
- package/server/src/artifactCopy.ts +320 -0
- package/server/src/atomicFile.ts +6 -1
- package/server/src/attention.ts +33 -27
- package/server/src/auth.ts +20 -6
- package/server/src/authLoginSession.ts +7 -2
- package/server/src/boundedRead.ts +172 -0
- package/server/src/capabilities.ts +26 -9
- package/server/src/catchUp.ts +56 -17
- package/server/src/checkedFile.ts +90 -0
- package/server/src/claudeTransport.ts +14 -0
- package/server/src/clusterAutoTurn.ts +55 -7
- package/server/src/clusterBusyReminder.ts +45 -0
- package/server/src/clusterDirector.ts +6 -3
- package/server/src/clusterIdleNudger.ts +6 -0
- package/server/src/clusterMailbox.ts +96 -26
- package/server/src/clusterPeerOps.ts +11 -19
- package/server/src/clusterPlanBridge.ts +37 -45
- package/server/src/clusterPresets.ts +44 -31
- package/server/src/clusterProgress.ts +3 -0
- package/server/src/clusterSnapshots.ts +36 -15
- package/server/src/clusterStore.ts +25 -14
- package/server/src/clusterTurnTools.ts +11 -0
- package/server/src/commandShell.ts +287 -0
- package/server/src/compactionCounter.ts +69 -0
- package/server/src/compactionReport.ts +20 -0
- package/server/src/contentSearch.ts +8 -3
- package/server/src/contextCalibrator.ts +6 -1
- package/server/src/contextEstimator.ts +71 -16
- package/server/src/contextRefs.ts +41 -11
- package/server/src/conversationActivity.ts +26 -0
- package/server/src/cursorUsage.ts +13 -3
- package/server/src/diagnostics/checks.ts +4 -11
- package/server/src/diagnostics/executableLookup.ts +20 -0
- package/server/src/diagnostics/modelHealth.ts +3 -11
- package/server/src/diagnostics/supportBundle.ts +5 -13
- package/server/src/eventLog.ts +718 -0
- package/server/src/existingClusterMembers.ts +9 -0
- package/server/src/explorerArtifacts.ts +27 -10
- package/server/src/explorerChanged.ts +99 -67
- package/server/src/explorerDocs.ts +37 -31
- package/server/src/explorerLaunch.ts +11 -2
- package/server/src/explorerPlans.ts +22 -2
- package/server/src/fileAccessPolicy.ts +82 -1
- package/server/src/fileContent/decodeSlots.ts +31 -0
- package/server/src/fileContent/detect.ts +28 -0
- package/server/src/fileContent/externalImage.ts +49 -0
- package/server/src/fileContent/icons.ts +37 -0
- package/server/src/fileContent/images.ts +140 -0
- package/server/src/fileContent/legacyText.ts +16 -0
- package/server/src/fileContent/notebook.ts +37 -0
- package/server/src/fileContent/office.ts +234 -0
- package/server/src/fileContent/pdf.ts +59 -0
- package/server/src/fileContent/pngRows.ts +54 -0
- package/server/src/fileContent/svg.ts +42 -0
- package/server/src/fileContent/types.ts +39 -0
- package/server/src/fileContent/worker.ts +43 -0
- package/server/src/fileContent.ts +108 -0
- package/server/src/fileContextReceipts.ts +44 -0
- package/server/src/fileFetch.ts +167 -0
- package/server/src/fileVersion.ts +36 -0
- package/server/src/genesis/creative.ts +27 -33
- package/server/src/genesis/prompts.ts +3 -0
- package/server/src/genesis/savePlan.ts +45 -0
- package/server/src/genesis/stages.ts +4 -4
- package/server/src/gitDiff.ts +20 -5
- package/server/src/gitSnapshots.ts +288 -191
- package/server/src/gitWorking.ts +11 -11
- package/server/src/github.ts +3 -1
- package/server/src/goalRun.ts +7 -4
- package/server/src/handoffHistory.ts +89 -0
- package/server/src/handoffHistoryProtocol.ts +20 -0
- package/server/src/handoffHistorySupport.ts +10 -0
- package/server/src/handoffHistoryTool.ts +192 -0
- package/server/src/handoffPrompts.ts +6 -4
- package/server/src/handoffReplay.ts +20 -0
- package/server/src/handoffSeedCache.ts +22 -0
- package/server/src/http/appBrowserRoutes.ts +17 -0
- package/server/src/http/architectureReviewRoutes.ts +86 -0
- package/server/src/http/clusterRoutes.ts +17 -2
- package/server/src/http/clusterSnapshotRoutes.ts +8 -3
- package/server/src/http/connectionsRoutes.ts +5 -1
- package/server/src/http/diffRoutes.ts +36 -3
- package/server/src/http/explorerRoot.ts +20 -0
- package/server/src/http/explorerRoutes.ts +60 -12
- package/server/src/http/fileRead.ts +2 -1
- package/server/src/http/fileWriteRoutes.ts +3 -2
- package/server/src/http/gitCompareRoutes.ts +4 -5
- package/server/src/http/gitDiffRoutes.ts +3 -2
- package/server/src/http/gitOpRoutes.ts +3 -4
- package/server/src/http/gitWorktreeRoutes.ts +3 -2
- package/server/src/http/handoffHistoryRoutes.ts +42 -0
- package/server/src/http/imageWriteRoutes.ts +5 -1
- package/server/src/http/knowledgeRoutes.ts +2 -0
- package/server/src/http/mediaOpsRoutes.ts +2 -1
- package/server/src/http/originGuard.ts +71 -14
- package/server/src/http/outputRoutes.ts +26 -5
- package/server/src/http/projectBinding.ts +108 -0
- package/server/src/http/providerThrottleRoutes.ts +76 -0
- package/server/src/http/publicProjectRoutes.ts +86 -0
- package/server/src/http/readConfinement.ts +16 -9
- package/server/src/http/router.ts +177 -60
- package/server/src/http/searchRoutes.ts +4 -4
- package/server/src/http/sessionTransport.ts +27 -0
- package/server/src/http/skillManagementRoutes.ts +120 -0
- package/server/src/http/storageRoutes.ts +200 -0
- package/server/src/http/usageStatsRoutes.ts +3 -11
- package/server/src/http/utilityAgentRoutes.ts +19 -5
- package/server/src/http/workflowDataRoutes.ts +68 -16
- package/server/src/http/writeConfinement.ts +31 -12
- package/server/src/http/wsAuth.ts +27 -9
- package/server/src/imageTokens.ts +60 -0
- package/server/src/index.ts +269 -178
- package/server/src/inputDeliveryHistory.ts +122 -0
- package/server/src/keepStore.ts +139 -0
- package/server/src/knowledge/store.ts +27 -19
- package/server/src/legacyTarRestore.ts +177 -0
- package/server/src/llamacppCatalog.ts +47 -12
- package/server/src/localRuntimeStatus.ts +121 -0
- package/server/src/lsp/client.ts +19 -11
- package/server/src/lsp/servers.ts +2 -2
- package/server/src/managedPath.ts +38 -0
- package/server/src/management/clusterActivity.ts +6 -16
- package/server/src/management/hubGuard.ts +135 -0
- package/server/src/management/hubLink.ts +8 -2
- package/server/src/management/initHubLink.ts +54 -75
- package/server/src/manualCompactCapability.ts +8 -0
- package/server/src/mcp/arcoMcpServer.ts +4 -0
- package/server/src/mcp/client.ts +28 -11
- package/server/src/mcp/clusterMcpLoopback.ts +27 -1
- package/server/src/mcp/clusterMcpTools.ts +32 -27
- package/server/src/mcp/fileContent.ts +34 -0
- package/server/src/mcp/fileMcpServer.ts +12 -0
- package/server/src/mcp/fileMcpTools.ts +51 -0
- package/server/src/mcp/handoffHistoryMcpTools.ts +21 -0
- package/server/src/mcp/mcpConfigWriter.ts +43 -12
- package/server/src/mcp/planMcpTools.ts +9 -285
- package/server/src/mcp/planReadMcpServer.ts +19 -0
- package/server/src/mcp/registry.ts +41 -35
- package/server/src/mcp/registryWiring.ts +4 -5
- package/server/src/media/demucs.ts +11 -4
- package/server/src/media/ffmpeg.ts +21 -16
- package/server/src/media/scratch.ts +17 -10
- package/server/src/noticeSource.ts +11 -0
- package/server/src/notifications.ts +10 -5
- package/server/src/npmPlatformResolve.ts +25 -8
- package/server/src/ntfyTransport.ts +12 -4
- package/server/src/outputGrants.ts +53 -0
- package/server/src/outputStore.ts +5 -2
- package/server/src/outputs.ts +84 -17
- package/server/src/peerRecipientContext.ts +16 -5
- package/server/src/planHistory.ts +48 -0
- package/server/src/planStore.ts +201 -55
- package/server/src/planTools.ts +303 -0
- package/server/src/previewAutoDetect.ts +26 -19
- package/server/src/previewPortConfiguration.ts +28 -0
- package/server/src/previewPorts.ts +2 -0
- package/server/src/previewProxy.ts +156 -189
- package/server/src/primaryBackgroundTracker.ts +151 -61
- package/server/src/primitives/exportContext.ts +67 -16
- package/server/src/primitives/localFileContext.ts +31 -0
- package/server/src/primitives/reviewContent.ts +42 -7
- package/server/src/primitives/runCompare.ts +1 -1
- package/server/src/primitives/runDocEdit.ts +1 -1
- package/server/src/primitives/runMdTuneup.ts +45 -25
- package/server/src/primitives/runResearch.ts +1 -1
- package/server/src/primitives/runReviewer.ts +6 -2
- package/server/src/primitives/seedWorker.ts +36 -17
- package/server/src/project/orchestrationProposals.ts +6 -1
- package/server/src/project/taskLedger.ts +37 -11
- package/server/src/projectGlob.ts +9 -0
- package/server/src/projectIgnore.ts +19 -0
- package/server/src/projectScan.ts +76 -0
- package/server/src/projectStateIgnore.ts +40 -1
- package/server/src/projects.ts +114 -36
- package/server/src/prompts.ts +5 -8
- package/server/src/proportionateTestingSkill.ts +31 -0
- package/server/src/providers/attachmentLabels.ts +8 -0
- package/server/src/providers/attachments.ts +52 -174
- package/server/src/providers/claude-native/apiEndpoint.ts +9 -0
- package/server/src/providers/claude-native/appendOnlyPrefix.ts +17 -1
- package/server/src/providers/claude-native/catalog.ts +16 -14
- package/server/src/providers/claude-native/contentBlocks.ts +39 -8
- package/server/src/providers/claude-native/contextBudget.ts +0 -6
- package/server/src/providers/claude-native/editApply.ts +6 -1
- package/server/src/providers/claude-native/fileContent.ts +98 -0
- package/server/src/providers/claude-native/filterConfigs/bash-cargo-test.ts +1 -0
- package/server/src/providers/claude-native/filterConfigs/bash-jest-vitest.ts +1 -0
- package/server/src/providers/claude-native/filterConfigs/bash-pytest.ts +1 -0
- package/server/src/providers/claude-native/filterConfigs/index.ts +2 -1
- package/server/src/providers/claude-native/foldDigest.ts +9 -2
- package/server/src/providers/claude-native/gateReview.ts +0 -0
- package/server/src/providers/claude-native/hookIf.ts +414 -0
- package/server/src/providers/claude-native/hooks.ts +398 -54
- package/server/src/providers/claude-native/imageRead.ts +92 -0
- package/server/src/providers/claude-native/index.ts +32 -1
- package/server/src/providers/claude-native/mediaLimits.ts +14 -0
- package/server/src/providers/claude-native/mediaRetention.ts +49 -0
- package/server/src/providers/claude-native/mediaRetirementNotice.ts +8 -0
- package/server/src/providers/claude-native/modelParams.ts +23 -2
- package/server/src/providers/claude-native/oauth.ts +9 -8
- package/server/src/providers/claude-native/outputAccumulator.ts +29 -17
- package/server/src/providers/claude-native/peerTools.ts +5 -167
- package/server/src/providers/claude-native/pretoolGuards.ts +76 -9
- package/server/src/providers/claude-native/registryTools.ts +4 -2
- package/server/src/providers/claude-native/resumeSummary.ts +168 -44
- package/server/src/providers/claude-native/sandboxExecutor.ts +24 -16
- package/server/src/providers/claude-native/taskAdmission.ts +62 -0
- package/server/src/providers/claude-native/toolChecks.ts +127 -0
- package/server/src/providers/claude-native/toolPosture.ts +5 -3
- package/server/src/providers/claude-native/toolResultEviction.ts +17 -7
- package/server/src/providers/claude-native/tools.ts +228 -130
- package/server/src/providers/claude-native/usageContext.ts +93 -0
- package/server/src/providers/claude-native/wireFingerprint.ts +2 -2
- package/server/src/providers/claude-native/worker.ts +1056 -334
- package/server/src/providers/claude-native/workerHelpers.ts +133 -6
- package/server/src/providers/claude-native/workspaceFacts.ts +2 -2
- package/server/src/providers/claude.ts +65 -93
- package/server/src/providers/clusterTaskToolDefinitions.ts +180 -0
- package/server/src/providers/codex-appserver/catalog.ts +26 -19
- package/server/src/providers/codex-appserver/index.ts +8 -3
- package/server/src/providers/codex-appserver/jsonRpc.ts +9 -2
- package/server/src/providers/codex-appserver/worker.ts +108 -77
- package/server/src/providers/codex.ts +49 -57
- package/server/src/providers/codexChatBoundary.ts +55 -0
- package/server/src/providers/codexCodeMode.ts +2 -2
- package/server/src/providers/codexContextWindow.ts +2 -2
- package/server/src/providers/codexHome.ts +6 -0
- package/server/src/providers/codexImageTool.ts +22 -0
- package/server/src/providers/codexVersion.ts +13 -0
- package/server/src/providers/codexWebSearch.ts +5 -0
- package/server/src/providers/cursor/acpJsonRpc.ts +3 -1
- package/server/src/providers/cursor/authState.ts +72 -0
- package/server/src/providers/cursor/catalog.ts +20 -13
- package/server/src/providers/cursor/chatSandbox.ts +71 -0
- package/server/src/providers/cursor/filePlugin.ts +27 -0
- package/server/src/providers/cursor/index.ts +29 -4
- package/server/src/providers/cursor/modelMap.ts +182 -0
- package/server/src/providers/cursor/print.ts +80 -27
- package/server/src/providers/cursor/worker.ts +156 -84
- package/server/src/providers/errorClassifier.ts +7 -2
- package/server/src/providers/handoffHistoryBinding.ts +40 -0
- package/server/src/providers/index.ts +14 -22
- package/server/src/providers/llamacpp.ts +93 -176
- package/server/src/providers/llamacppManager.ts +62 -33
- package/server/src/providers/llamacppVersion.ts +4 -0
- package/server/src/providers/lmstudio.ts +124 -190
- package/server/src/providers/localFileMedia.ts +229 -0
- package/server/src/providers/localMcp.ts +76 -0
- package/server/src/providers/localProviderQueue.ts +13 -0
- package/server/src/providers/localShellLifecycle.ts +30 -0
- package/server/src/providers/localToolDispatch.ts +111 -0
- package/server/src/providers/ollama.ts +161 -171
- package/server/src/providers/ollamaCtxFallback.ts +1 -2
- package/server/src/providers/ollamaDurableCompaction.ts +5 -4
- package/server/src/providers/ollamaExecutionHistory.ts +40 -13
- package/server/src/providers/ollamaFencedTools.ts +10 -11
- package/server/src/providers/ollamaResilience.ts +10 -13
- package/server/src/providers/ollamaTokens.ts +4 -7
- package/server/src/providers/ollamaToolSubset.ts +14 -2
- package/server/src/providers/ollamaTools.ts +212 -200
- package/server/src/providers/outputStyle.ts +72 -72
- package/server/src/providers/providerFileContent.ts +133 -0
- package/server/src/providers/renderedTranscript.ts +2 -0
- package/server/src/providers/requestDeadline.ts +27 -0
- package/server/src/providers/sessionScope.ts +9 -0
- package/server/src/providers/types.ts +3 -0
- package/server/src/publicProject.ts +183 -0
- package/server/src/publicProjectChoice.ts +39 -0
- package/server/src/quota.ts +48 -23
- package/server/src/recall/index.ts +4 -9
- package/server/src/recall/search.ts +9 -32
- package/server/src/recall/transcriptSearch.ts +27 -0
- package/server/src/recentFilesLedger.ts +10 -8
- package/server/src/recentProjectActivity.ts +56 -0
- package/server/src/scanDeadline.ts +26 -0
- package/server/src/searchText.ts +16 -0
- package/server/src/server/broadcast.ts +166 -48
- package/server/src/sessionJsonl.ts +31 -17
- package/server/src/settings.ts +137 -41
- package/server/src/skillManagement.ts +585 -0
- package/server/src/skillMutation.ts +6 -0
- package/server/src/skills.ts +195 -25
- package/server/src/smartPickup.ts +3 -2
- package/server/src/smartPickupAdapters.ts +157 -13
- package/server/src/storageActions.ts +216 -0
- package/server/src/storageArchive.ts +297 -0
- package/server/src/storageOverview.ts +184 -0
- package/server/src/storageReport.ts +210 -0
- package/server/src/storageRoot.ts +30 -0
- package/server/src/storageTurnWatch.ts +39 -0
- package/server/src/storageWarnings.ts +84 -0
- package/server/src/taskDispatcher.ts +22 -2
- package/server/src/templates/store.ts +72 -57
- package/server/src/terminal/ptyManager.ts +37 -27
- package/server/src/terminal/ptyPidRegistry.ts +10 -58
- package/server/src/thirdPartySkills.ts +79 -0
- package/server/src/toolPath.ts +31 -0
- package/server/src/toolboxWorkflow.ts +2 -1
- package/server/src/uploadImages.ts +124 -0
- package/server/src/voice/computerContext.ts +2 -1
- package/server/src/voice/conditionSchema.ts +3 -1
- package/server/src/voice/conditions.ts +1 -1
- package/server/src/workers/StreamParser.ts +42 -11
- package/server/src/workers/WorkerManager.ts +32 -35
- package/server/src/workers/durablePidRegistry.ts +266 -0
- package/server/src/workers/limits.ts +5 -2
- package/server/src/workers/pidRegistry.ts +15 -89
- package/server/src/workers/processActivity.ts +14 -0
- package/server/src/workers/processKill.ts +175 -1
- package/server/src/workers/processStartTime.ts +137 -49
- package/server/src/workflowMeta.ts +59 -19
- package/server/src/workflowStore.ts +248 -76
- package/server/src/workflows/modelTitles.ts +4 -3
- package/server/src/workflows/purgeWorkflow.ts +12 -3
- package/server/src/workflows/sessionDiscovery.ts +5 -13
- package/server/src/workflows/sessionIndex.ts +29 -12
- package/server/src/workflows/types.ts +20 -10
- package/server/src/workspace.ts +6 -0
- package/server/src/ws/afterTurn.ts +34 -0
- package/server/src/ws/clusterHandlers.ts +198 -276
- package/server/src/ws/clusterMembers.ts +204 -0
- package/server/src/ws/compactHandlers.ts +38 -11
- package/server/src/ws/gateHandlers.ts +2 -1
- package/server/src/ws/genesisHandlers.ts +49 -6
- package/server/src/ws/handoffHandlers.ts +168 -53
- package/server/src/ws/previewCaptureHandlers.ts +1 -4
- package/server/src/ws/taskLedgerHandlers.ts +28 -14
- package/server/src/ws/taskLifecycle.ts +41 -0
- package/server/src/ws/turnEngine.ts +488 -366
- package/server/src/ws/turnPrompt.ts +60 -0
- package/server/src/ws/turnSettings.ts +95 -0
- package/server/src/ws/updatePrimaryConfig.ts +55 -31
- package/server/src/ws/workflowHandlers.ts +190 -160
- package/shared/dist/clusterCoordination.js +15 -7
- package/shared/dist/clusterRolePresets.js +8 -6
- package/shared/dist/codexChat.d.ts +2 -0
- package/shared/dist/codexChat.js +5 -0
- package/shared/dist/folderName.d.ts +1 -0
- package/shared/dist/folderName.js +18 -0
- package/shared/dist/index.d.ts +8 -0
- package/shared/dist/index.js +8 -0
- package/shared/dist/localRuntimeStatus.d.ts +23 -0
- package/shared/dist/localRuntimeStatus.js +47 -0
- package/shared/dist/notificationTitle.d.ts +9 -0
- package/shared/dist/notificationTitle.js +23 -0
- package/shared/dist/outputStyle.d.ts +10 -0
- package/shared/dist/outputStyle.js +28 -0
- package/shared/dist/outputs.d.ts +1 -0
- package/shared/dist/protocol/autoPickup.d.ts +3 -1
- package/shared/dist/protocol/autoPickup.js +1 -1
- package/shared/dist/protocol/chat.d.ts +4 -0
- package/shared/dist/protocol/checkpoints.d.ts +25 -2
- package/shared/dist/protocol/checkpoints.js +1 -0
- package/shared/dist/protocol/clientMessages.d.ts +9 -14
- package/shared/dist/protocol/clusters.d.ts +23 -5
- package/shared/dist/protocol/clusters.js +3 -3
- package/shared/dist/protocol/connections.d.ts +2 -0
- package/shared/dist/protocol/diagnostics.js +1 -1
- package/shared/dist/protocol/genesis.d.ts +9 -0
- package/shared/dist/protocol/index.d.ts +1 -0
- package/shared/dist/protocol/index.js +1 -0
- package/shared/dist/protocol/mcp.d.ts +1 -0
- package/shared/dist/protocol/mcp.js +8 -5
- package/shared/dist/protocol/mdTuneup.d.ts +8 -0
- package/shared/dist/protocol/models.d.ts +3 -1
- package/shared/dist/protocol/models.js +19 -8
- package/shared/dist/protocol/notifications.d.ts +4 -2
- package/shared/dist/protocol/notifications.js +18 -5
- package/shared/dist/protocol/plans.d.ts +4 -1
- package/shared/dist/protocol/remoteManagement.d.ts +6 -0
- package/shared/dist/protocol/serverMessages.d.ts +70 -10
- package/shared/dist/protocol/settings.d.ts +16 -4
- package/shared/dist/protocol/settings.js +17 -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 +4 -0
- package/shared/dist/protocol/usage.d.ts +1 -0
- package/shared/dist/protocol/utilityAgent.d.ts +2 -2
- package/shared/dist/protocol/utilityAgent.js +2 -2
- package/shared/dist/protocol/workers.d.ts +1 -0
- package/shared/dist/protocol/workflows.d.ts +73 -14
- package/shared/dist/protocol/workflows.js +66 -0
- 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/dist/runtimeVersions.d.ts +2 -0
- package/shared/dist/runtimeVersions.js +13 -0
- package/shared/dist/shellTool.d.ts +2 -0
- package/shared/dist/shellTool.js +9 -0
- package/shared/src/clusterCoordination.ts +12 -7
- package/shared/src/clusterRolePresets.ts +8 -6
- package/shared/src/codexChat.ts +8 -0
- package/shared/src/folderName.ts +11 -0
- package/shared/src/index.ts +11 -0
- package/shared/src/localRuntimeStatus.ts +53 -0
- package/shared/src/notificationTitle.ts +23 -0
- package/shared/src/outputStyle.ts +35 -0
- package/shared/src/outputs.ts +3 -0
- package/shared/src/protocol/autoPickup.ts +3 -1
- package/shared/src/protocol/chat.ts +5 -0
- package/shared/src/protocol/checkpoints.ts +41 -5
- package/shared/src/protocol/clientMessages.ts +11 -11
- package/shared/src/protocol/clusters.ts +46 -11
- package/shared/src/protocol/connections.ts +6 -0
- package/shared/src/protocol/diagnostics.ts +1 -1
- package/shared/src/protocol/genesis.ts +11 -0
- package/shared/src/protocol/index.ts +1 -0
- package/shared/src/protocol/mcp.ts +12 -7
- package/shared/src/protocol/mdTuneup.ts +9 -2
- package/shared/src/protocol/models.ts +22 -8
- package/shared/src/protocol/notifications.ts +22 -5
- package/shared/src/protocol/plans.ts +7 -7
- package/shared/src/protocol/remoteManagement.ts +10 -3
- package/shared/src/protocol/serverMessages.ts +90 -7
- package/shared/src/protocol/settings.ts +35 -5
- package/shared/src/protocol/storage.ts +35 -0
- package/shared/src/protocol/tasks.ts +7 -0
- package/shared/src/protocol/usage.ts +3 -3
- package/shared/src/protocol/utilityAgent.ts +2 -2
- package/shared/src/protocol/workers.ts +5 -0
- package/shared/src/protocol/workflows.ts +133 -21
- package/shared/src/publicGuardrails.ts +50 -0
- package/shared/src/publicSafetyRules.ts +5 -0
- package/shared/src/runtimeVersions.ts +15 -0
- package/shared/src/shellTool.ts +9 -0
- package/client/dist/assets/galleryEditor-Ca4F8HiM.js +0 -702
- package/client/dist/assets/index-CcNtMA2y.js +0 -546
- package/client/dist/assets/index-Dl8tYsSp.css +0 -1
- package/client/src/components/ConversationMenu.tsx +0 -467
- package/client/src/stores/sessionIndexStore.ts +0 -92
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { mintHandoffHistoryCapability } from '../http/handoffHistoryRoutes.js';
|
|
2
|
+
import { deliverAfterTurnRevoked } from './taskLifecycle.js';
|
|
3
|
+
import { resolveClaudeTransport } from '../claudeTransport.js';
|
|
4
|
+
import { projectLocalFileReferences } from '../primitives/localFileContext.js';
|
|
5
|
+
import { getEffectivePublicProjectChoice } from '../publicProjectChoice.js';
|
|
6
|
+
import { buildMessageGuardPolicy, storedOutputStyle } from '@arco/shared';
|
|
2
7
|
import * as attention from '../attention.js';
|
|
3
8
|
import { acquireCheckoutWriter, assertCheckoutAvailable, workflowWritePaths, observeCheckoutWriters } from '../checkoutOwnership.js';
|
|
4
9
|
import { randomUUID } from 'node:crypto';
|
|
10
|
+
import path from 'node:path';
|
|
5
11
|
import { projectOllamaHistory, stampOllamaExecution } from '../providers/ollamaExecutionHistory.js';
|
|
6
12
|
import { publishActivity, computerProjectionChanged } from '../voice/activityBus.js';
|
|
7
13
|
import { setComputerBackgroundClaim, clearComputerBackgroundClaim, isComputerBackgroundClaim } from '../voice/operatorTools.js';
|
|
@@ -16,17 +22,19 @@ SteerItem,
|
|
|
16
22
|
WorkflowConfig,
|
|
17
23
|
ClusterEfficiencyLevel
|
|
18
24
|
} from '@arco/shared';
|
|
19
|
-
import { isAutoCompactionPolicy, resolveProviderAutoCompaction } from '@arco/shared';
|
|
25
|
+
import { AUTO_HANDOFF_DEFAULT_COMPACTIONS, autoHandoffAvailability, clampAutoHandoffCompactions, isAutoCompactionPolicy, normalizeAutoHandoff, resolveProviderAutoCompaction, type AutoHandoffAvailability, type AutoHandoffConfig, type AutoHandoffMode } from '@arco/shared';
|
|
26
|
+
import { compactionsThisConversation } from '../compactionCounter.js';
|
|
20
27
|
import { WebSocket } from 'ws';
|
|
21
28
|
import { discoverClaudeMdFiles } from '../claudeMdDiscovery.js';
|
|
22
29
|
import { buildKnowledgeBlock } from '../knowledge/store.js';
|
|
23
|
-
import { expandContextRefs } from '../contextRefs.js';
|
|
30
|
+
import { expandContextRefs, type ContextExpansion } from '../contextRefs.js';
|
|
24
31
|
import { refsDoctrine } from '../planRefContext.js';
|
|
25
32
|
import { createCheckpoint } from '../gitSnapshots.js';
|
|
26
33
|
import { summarizeTurnChanges, timelyCheckpoint, shouldCaptureTurn } from '../turnChanges.js';
|
|
27
34
|
import { isManagedBakeoffWorktree } from '../gitBakeoff.js';
|
|
28
35
|
import * as clusterMailbox from '../clusterMailbox.js';
|
|
29
36
|
import * as clusterPlanBridge from '../clusterPlanBridge.js';
|
|
37
|
+
import { clusterToolsPending, CLUSTER_TOOLS_PENDING_NOTICE, CLUSTER_TOOLS_PENDING_AGENT } from '../clusterTurnTools.js';
|
|
30
38
|
import * as clusterStore from '../clusterStore.js';
|
|
31
39
|
import * as clusterEfficiency from '../clusterEfficiency.js';
|
|
32
40
|
import { BLIND_CLUSTER_DOCTRINE } from '../clusterAccessDoctrine.js';
|
|
@@ -79,6 +87,9 @@ withPreviewNudge
|
|
|
79
87
|
} from '../server/prompts.js';
|
|
80
88
|
import { buildGenesisSystemBlock } from '../genesis/prompts.js';
|
|
81
89
|
import { CHAT_PROVIDERS, chatSystemPrompt, chatWebArmed, isChatWorkflow } from '../chatMode.js';
|
|
90
|
+
import { resolveNativeInTurnCompactPercent, resolveTurnSettings } from './turnSettings.js';
|
|
91
|
+
import { composeBasePrompts } from './turnPrompt.js';
|
|
92
|
+
import { runAfterTurn } from './afterTurn.js';
|
|
82
93
|
import {
|
|
83
94
|
sessions,
|
|
84
95
|
workflows
|
|
@@ -94,10 +105,13 @@ buildPinnedSkillsBlock,
|
|
|
94
105
|
resolvePinnedSkills,
|
|
95
106
|
buildSkillsManifest,
|
|
96
107
|
listSkills,
|
|
97
|
-
readSkillBody
|
|
108
|
+
readSkillBody,
|
|
109
|
+
readBuiltinSkill,
|
|
98
110
|
} from '../skills.js';
|
|
111
|
+
import { ARCHITECTURE_REVIEW_SLUG, architectureReviewFacts } from '../architectureReview.js';
|
|
112
|
+
import { artifactsDir } from '../workers/limits.js';
|
|
99
113
|
import {
|
|
100
|
-
ensureMeta,readMeta,reconcileLatestCliSession,updateMeta,type WorkflowMeta
|
|
114
|
+
ensureMeta,readMeta,reconcileLatestCliSession,updateMeta,workflowDir,type WorkflowMeta
|
|
101
115
|
} from '../workflowMeta.js';
|
|
102
116
|
import {
|
|
103
117
|
currentSeq as currentWorkflowSeq,
|
|
@@ -134,11 +148,18 @@ export interface TurnEngineDeps {
|
|
|
134
148
|
captureCheckpoint?: typeof createCheckpoint;
|
|
135
149
|
previewAutoDetect: PreviewAutoDetect;
|
|
136
150
|
handleCreateWorkflow: (ws: WebSocket, session: Session, config: WorkflowConfig) => Promise<void>;
|
|
137
|
-
handleHandoffRequest: (ws: WebSocket, session: Session, msg: import('@arco/shared').HandoffRequestMessage) => Promise<void>;
|
|
151
|
+
handleHandoffRequest: (ws: WebSocket, session: Session, msg: import('@arco/shared').HandoffRequestMessage) => Promise<{ artifactName: string } | void>;
|
|
138
152
|
handleCompactWorkflow?: (ws: WebSocket, session: Session, msg: import('@arco/shared').CompactWorkflowMessage, guard?: (claim: () => number) => Promise<number | false>, autoDetail?: string) => Promise<void>;
|
|
139
153
|
}
|
|
140
154
|
let deps: TurnEngineDeps;
|
|
141
|
-
export function initTurnEngine(d: TurnEngineDeps): void {
|
|
155
|
+
export function initTurnEngine(d: TurnEngineDeps): void {
|
|
156
|
+
deps = d;
|
|
157
|
+
clusterStore.setMemberJoinedListener((clusterId, workflowId) => {
|
|
158
|
+
if (clusterToolsPending(workflows.get(workflowId), clusterId)) {
|
|
159
|
+
broadcastWorkflow(workflowId, { type: 'system_notice', workflowId, content: CLUSTER_TOOLS_PENDING_NOTICE });
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
}
|
|
142
163
|
|
|
143
164
|
|
|
144
165
|
// Extract renderable entries from a raw Claude session JSONL line. A single
|
|
@@ -263,18 +284,7 @@ export function toSessionEntries(raw: SessionJsonlEntry): SessionEntryPayload[]
|
|
|
263
284
|
return out;
|
|
264
285
|
}
|
|
265
286
|
|
|
266
|
-
|
|
267
|
-
// (the harness WorkflowTool lives only in the `claude` binary), else explicit
|
|
268
|
-
// per-tab config wins, else the cwd's TRANSPORT DEFAULTS cascade, else 'cli'.
|
|
269
|
-
// Same precedence as the turn dispatcher — keep the two in sync.
|
|
270
|
-
export async function resolveClaudeTransport(wf: WorkflowState, cwd: string): Promise<'cli' | 'native'> {
|
|
271
|
-
if (wf.primary.provider === 'claude' && wf.config.ultracode === true) return 'cli';
|
|
272
|
-
if (wf.config.claudeTransport === 'native' || wf.config.claudeTransport === 'cli') {
|
|
273
|
-
return wf.config.claudeTransport;
|
|
274
|
-
}
|
|
275
|
-
const cascade = await readSettings(cwd).catch(() => null);
|
|
276
|
-
return cascade?.claude?.transport === 'native' ? 'native' : 'cli';
|
|
277
|
-
}
|
|
287
|
+
export { resolveClaudeTransport } from '../claudeTransport.js';
|
|
278
288
|
|
|
279
289
|
// Start watching Claude's session JSONL for a workflow.
|
|
280
290
|
// `initialWs` receives the historical entries; new entries go to all observers.
|
|
@@ -285,20 +295,25 @@ export async function resolveClaudeTransport(wf: WorkflowState, cwd: string): Pr
|
|
|
285
295
|
// synthetic "No response requested." rows — render as agent replies while
|
|
286
296
|
// ChatPanel's sessionChat-canonical mode hid every real finalized answer
|
|
287
297
|
// otherwise stale session entries could hide finalized answers.
|
|
298
|
+
const sessionWatcherEpochs = new WeakMap<WorkflowState, number>();
|
|
299
|
+
|
|
288
300
|
export function startSessionWatcher(workflowId: string, wf: WorkflowState, cwd: string, initialWs?: WebSocket): void {
|
|
289
|
-
|
|
301
|
+
const epoch = (sessionWatcherEpochs.get(wf) ?? 0) + 1;
|
|
302
|
+
sessionWatcherEpochs.set(wf, epoch);
|
|
290
303
|
const sessionId = wf.primarySessionId;
|
|
291
|
-
if (!sessionId) return;
|
|
292
304
|
if (wf.sessionWatcher) {
|
|
293
305
|
wf.sessionWatcher();
|
|
294
306
|
wf.sessionWatcher = null;
|
|
295
307
|
}
|
|
308
|
+
if (wf.primary.provider !== 'claude' || !sessionId) return;
|
|
309
|
+
const current = () => workflows.get(workflowId) === wf && wf.primarySessionId === sessionId
|
|
310
|
+
&& sessionWatcherEpochs.get(wf) === epoch && wf.primary.provider === 'claude';
|
|
296
311
|
const path = resolveSessionJsonlPath(cwd, sessionId);
|
|
297
312
|
resolveClaudeTransport(wf, cwd).then((transport) => {
|
|
298
|
-
if (transport === 'native') return null;
|
|
313
|
+
if (!current() || transport === 'native') return null;
|
|
299
314
|
return loadSessionJsonl(path);
|
|
300
315
|
}).then((loaded) => {
|
|
301
|
-
if (!loaded) return;
|
|
316
|
+
if (!loaded || !current()) return;
|
|
302
317
|
const { entries, byteLength } = loaded;
|
|
303
318
|
// Tail-first: only the last N raw entries go out immediately. Anything
|
|
304
319
|
// older sits on wf.pendingEarlierEntries until the operator pages back
|
|
@@ -330,6 +345,7 @@ export function startSessionWatcher(workflowId: string, wf: WorkflowState, cwd:
|
|
|
330
345
|
}
|
|
331
346
|
if (!workflows.has(workflowId)) return; // workflow removed while loading
|
|
332
347
|
const dispose = watchSessionJsonl(path, byteLength, (raw) => {
|
|
348
|
+
if (!current()) return;
|
|
333
349
|
// Concurrent-session detection. Live writes with an entrypoint other
|
|
334
350
|
// than 'sdk-cli' mean a native `claude --resume` terminal is writing
|
|
335
351
|
// to this same JSONL. Flag the workflow, and emit a debounced chat
|
|
@@ -359,7 +375,7 @@ export function startSessionWatcher(workflowId: string, wf: WorkflowState, cwd:
|
|
|
359
375
|
}
|
|
360
376
|
});
|
|
361
377
|
const wfNow = workflows.get(workflowId);
|
|
362
|
-
if (wfNow) {
|
|
378
|
+
if (wfNow && current()) {
|
|
363
379
|
wfNow.sessionWatcher = dispose;
|
|
364
380
|
} else {
|
|
365
381
|
dispose(); // workflow gone — clean up immediately
|
|
@@ -382,17 +398,17 @@ export function derivePrimaryConfig(config: WorkflowConfig): PrimaryConfig {
|
|
|
382
398
|
}
|
|
383
399
|
|
|
384
400
|
export function deriveAutoHandoff(config: WorkflowConfig): WorkflowState['autoHandoff'] {
|
|
401
|
+
const saved = normalizeAutoHandoff(config.autoHandoff);
|
|
385
402
|
return {
|
|
386
|
-
enabled:
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
autoFired: false,
|
|
403
|
+
enabled: saved?.enabled ?? false,
|
|
404
|
+
afterCompactions: saved?.afterCompactions ?? AUTO_HANDOFF_DEFAULT_COMPACTIONS,
|
|
405
|
+
compactions: 0,
|
|
406
|
+
fired: false,
|
|
391
407
|
// WP5 — carry through verbatim (no defaulting); resolution happens at
|
|
392
408
|
// fire time so a later change to the global default still affects tabs
|
|
393
409
|
// that never set a per-tab override.
|
|
394
|
-
mode:
|
|
395
|
-
summarizer:
|
|
410
|
+
mode: saved?.mode,
|
|
411
|
+
summarizer: saved?.summarizer,
|
|
396
412
|
};
|
|
397
413
|
}
|
|
398
414
|
|
|
@@ -412,24 +428,28 @@ export function deriveAutoFold(config: WorkflowConfig): WorkflowState['autoFold'
|
|
|
412
428
|
|
|
413
429
|
export function applyAutoHandoffDefault(
|
|
414
430
|
config: WorkflowConfig,
|
|
415
|
-
defaults?:
|
|
431
|
+
defaults?: { enabled?: boolean; afterCompactions?: number; mode?: AutoHandoffMode; summarizer?: AutoHandoffConfig['summarizer'] } | null,
|
|
416
432
|
): boolean {
|
|
433
|
+
// A config from an older client or saved file may carry percent fields.
|
|
434
|
+
if (config.autoHandoff !== undefined) {
|
|
435
|
+
const saved = normalizeAutoHandoff(config.autoHandoff);
|
|
436
|
+
if (saved) config.autoHandoff = saved; else delete config.autoHandoff;
|
|
437
|
+
}
|
|
417
438
|
if (config.autoHandoff) return false;
|
|
418
439
|
if (!defaults) return false;
|
|
419
440
|
if (
|
|
420
441
|
defaults.enabled === undefined
|
|
421
|
-
&& defaults.
|
|
422
|
-
&& defaults.autoAt === undefined
|
|
442
|
+
&& defaults.afterCompactions === undefined
|
|
423
443
|
&& defaults.mode === undefined
|
|
424
444
|
&& defaults.summarizer === undefined
|
|
425
445
|
) return false;
|
|
426
|
-
|
|
446
|
+
// Through normalizeAutoHandoff so the saved form carries the 0.1.4 fields too.
|
|
447
|
+
config.autoHandoff = normalizeAutoHandoff({
|
|
427
448
|
enabled: defaults.enabled ?? false,
|
|
428
|
-
|
|
429
|
-
autoAt: defaults.autoAt ?? 90,
|
|
449
|
+
afterCompactions: clampAutoHandoffCompactions(defaults.afterCompactions),
|
|
430
450
|
...(defaults.mode !== undefined ? { mode: defaults.mode } : {}),
|
|
431
451
|
...(defaults.summarizer !== undefined ? { summarizer: defaults.summarizer } : {}),
|
|
432
|
-
};
|
|
452
|
+
});
|
|
433
453
|
return true;
|
|
434
454
|
}
|
|
435
455
|
|
|
@@ -469,8 +489,6 @@ export function resetCodexContextAfterCompact(
|
|
|
469
489
|
modelContextWindow?: number,
|
|
470
490
|
): void {
|
|
471
491
|
wf.lastContextPercent = 0;
|
|
472
|
-
wf.autoHandoff.warnFired = false;
|
|
473
|
-
wf.autoHandoff.autoFired = false;
|
|
474
492
|
broadcastTransient(workflowId, {
|
|
475
493
|
type: 'codex_token_snapshot',
|
|
476
494
|
workflowId,
|
|
@@ -511,6 +529,8 @@ export function anyObserver(workflowId: string): WebSocket | null {
|
|
|
511
529
|
let busyClaimSeq = 0;
|
|
512
530
|
const busyCheckoutLeases = new WeakMap<WorkflowState, () => void>();
|
|
513
531
|
const busyOwners = new WeakMap<WorkflowState, number>();
|
|
532
|
+
const storageMigrations = new WeakSet<WorkflowState>();
|
|
533
|
+
const incomingMessages = new WeakMap<WorkflowState, number>();
|
|
514
534
|
const lastBusyClaim = new WeakMap<WorkflowState, number>();
|
|
515
535
|
const busyRevocations = new WeakMap<WorkflowState, number>();
|
|
516
536
|
|
|
@@ -521,7 +541,8 @@ export function publishWorkerActivity(wf: WorkflowState, kind: 'worker_started'
|
|
|
521
541
|
}
|
|
522
542
|
}
|
|
523
543
|
|
|
524
|
-
export function claimBusy(wf: WorkflowState): number {
|
|
544
|
+
export function claimBusy(wf: WorkflowState, workerActivity = true): number {
|
|
545
|
+
if (storageMigrations.has(wf)) throw new Error('Workflow storage is moving. Wait for the scaffold to finish.');
|
|
525
546
|
// Keep the existing conservative restore reservation, but observe isolated
|
|
526
547
|
// members at their actual scratch cwd for turn-overlap reporting.
|
|
527
548
|
const wfid = [...workflows].find(([, current]) => current === wf)?.[0];
|
|
@@ -536,15 +557,32 @@ export function claimBusy(wf: WorkflowState): number {
|
|
|
536
557
|
lastBusyClaim.set(wf, token);
|
|
537
558
|
watchClaimed(wf, token);
|
|
538
559
|
wf.busy = true;
|
|
560
|
+
wf.turnStartedAt = undefined;
|
|
561
|
+
if (wfid && workerActivity) void notifyClusterStateForWorkflow(wfid);
|
|
539
562
|
if(wf.config?.voiceOperator)wf.computerSettled=false;
|
|
540
|
-
publishWorkerActivity(wf, 'worker_started');
|
|
563
|
+
if (workerActivity) publishWorkerActivity(wf, 'worker_started');
|
|
541
564
|
return token;
|
|
542
565
|
}
|
|
543
566
|
|
|
567
|
+
export function isWorkflowStorageMoving(wf: WorkflowState): boolean { return storageMigrations.has(wf); }
|
|
568
|
+
|
|
569
|
+
export function reserveWorkflowMigration(wf: WorkflowState): () => void {
|
|
570
|
+
if (wf.busy || storageMigrations.has(wf) || incomingMessages.get(wf)) throw new Error('Workflow is busy.');
|
|
571
|
+
const token = claimBusy(wf, false);
|
|
572
|
+
storageMigrations.add(wf);
|
|
573
|
+
return () => { storageMigrations.delete(wf); if (!releaseBusy(wf, token, 'finished', false)) wf.busy = false; };
|
|
574
|
+
}
|
|
575
|
+
|
|
544
576
|
export function ownsBusy(wf: WorkflowState, token: number): boolean {
|
|
545
577
|
return busyOwners.get(wf) === token;
|
|
546
578
|
}
|
|
547
579
|
|
|
580
|
+
// A released claim remains current until another claim or STOP supersedes it.
|
|
581
|
+
// Background completion metadata can use this without retaining busy.
|
|
582
|
+
export function isCurrentBusyClaim(wf: WorkflowState, token: number): boolean {
|
|
583
|
+
return lastBusyClaim.get(wf) === token;
|
|
584
|
+
}
|
|
585
|
+
|
|
548
586
|
// Returns false (and leaves wf.busy alone) when the claim was revoked or
|
|
549
587
|
// superseded — the caller is a stale holder and must not touch busy/queue.
|
|
550
588
|
export function releaseBusy(wf: WorkflowState, token: number, outcome: 'finished' | 'interrupted' | 'failed' = 'interrupted', workerActivity = true): boolean {
|
|
@@ -553,6 +591,7 @@ export function releaseBusy(wf: WorkflowState, token: number, outcome: 'finished
|
|
|
553
591
|
busyOwners.delete(wf);
|
|
554
592
|
busyCheckoutLeases.get(wf)?.(); busyCheckoutLeases.delete(wf);
|
|
555
593
|
wf.busy = false;
|
|
594
|
+
wf.turnStartedAt = undefined;
|
|
556
595
|
clearComputerBackgroundClaim([...workflows].find(([, current]) => current === wf)?.[0] ?? '', token);
|
|
557
596
|
if (wf.config?.voiceOperator) computerProjectionChanged();
|
|
558
597
|
// Compaction publishes its own operation outcome after refresh/queue drain;
|
|
@@ -575,7 +614,8 @@ export function revokeBusy(wf: WorkflowState): void {
|
|
|
575
614
|
watchSettled(wf, busyOwners.get(wf), 'interrupted');
|
|
576
615
|
busyOwners.delete(wf);
|
|
577
616
|
busyCheckoutLeases.get(wf)?.(); busyCheckoutLeases.delete(wf);
|
|
578
|
-
wf.busy =
|
|
617
|
+
wf.busy = storageMigrations.has(wf);
|
|
618
|
+
wf.turnStartedAt = undefined;
|
|
579
619
|
if (token !== undefined) clearComputerBackgroundClaim([...workflows].find(([, current]) => current === wf)?.[0] ?? '', token);
|
|
580
620
|
if (wf.config?.voiceOperator) computerProjectionChanged();
|
|
581
621
|
if(token !== undefined)publishWorkerActivity(wf, 'worker_interrupted');
|
|
@@ -663,8 +703,7 @@ export async function maybeAutoFold(workflowId: string, wf: WorkflowState, cwd:
|
|
|
663
703
|
if ((st.foldIneffectiveCount ?? 0) >= MAX_INEFFECTIVE_FOLDS) return false;
|
|
664
704
|
|
|
665
705
|
// Native transport required (CLI Claude has no in-process history to fold).
|
|
666
|
-
const
|
|
667
|
-
const transport = wf.config.claudeTransport ?? (cascade?.claude?.transport === 'native' ? 'native' : 'cli');
|
|
706
|
+
const transport = await resolveClaudeTransport(wf, cwd);
|
|
668
707
|
if (transport !== 'native') return false;
|
|
669
708
|
// Re-check after the settings await: an operator message can have claimed
|
|
670
709
|
// the tab meanwhile, and folding under a live turn corrupts its history.
|
|
@@ -709,99 +748,105 @@ export async function maybeAutoFold(workflowId: string, wf: WorkflowState, cwd:
|
|
|
709
748
|
return true;
|
|
710
749
|
}
|
|
711
750
|
|
|
712
|
-
//
|
|
713
|
-
// loop exits (wf.busy
|
|
714
|
-
|
|
751
|
+
// Auto-handoff after N compactions (operator decision for 0.1.5). Runs at a
|
|
752
|
+
// turn boundary only: called after the turn loop exits (wf.busy reset), before
|
|
753
|
+
// any automatic fold or compaction of that boundary. Nothing is said before
|
|
754
|
+
// the handoff; once it has run, one chat line names the count and links the
|
|
755
|
+
// handoff document. Returns true when a handoff was started.
|
|
756
|
+
export async function maybeAutoHandoff(workflowId: string, wf: WorkflowState, cwd: string): Promise<boolean> {
|
|
715
757
|
// Chat tabs are projectless: a handoff re-seeds as an Agent worker (tools,
|
|
716
758
|
// project context) and, for incognito, installed a cwdHandoffChain slot for
|
|
717
|
-
// the temp root + broadcast lock snapshots.
|
|
718
|
-
|
|
719
|
-
if (isChatWorkflow(wf.config)) return;
|
|
720
|
-
const percentOfWindow = wf.lastContextPercent;
|
|
721
|
-
if (typeof percentOfWindow !== 'number' || percentOfWindow <= 0) return;
|
|
722
|
-
|
|
759
|
+
// the temp root + broadcast lock snapshots. Never automatically.
|
|
760
|
+
if (isChatWorkflow(wf.config)) return false;
|
|
723
761
|
const ah = wf.autoHandoff;
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
if (
|
|
727
|
-
|
|
728
|
-
|
|
762
|
+
if (!ah?.enabled || ah.fired || wf.busy) return false;
|
|
763
|
+
const count = compactionsThisConversation(wf);
|
|
764
|
+
if (count < ah.afterCompactions) return false;
|
|
765
|
+
const cascade = await readSettings(cwd).catch(() => null);
|
|
766
|
+
if (!(await autoHandoffAvailableFor(workflowId, wf, cwd, cascade)).available) return false;
|
|
767
|
+
if (wf.busy || ah.fired) return false;
|
|
768
|
+
const obs = anyObserver(workflowId);
|
|
769
|
+
if (!obs) {
|
|
770
|
+
console.warn(`[arco] [${workflowId.slice(0, 8)}] auto-handoff: no observer to broadcast on`);
|
|
771
|
+
return false;
|
|
729
772
|
}
|
|
773
|
+
ah.fired = true;
|
|
774
|
+
console.log(`[arco] [${workflowId.slice(0, 8)}] auto-handoff: ${count} compactions this conversation, firing`);
|
|
730
775
|
|
|
731
|
-
//
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
776
|
+
// Re-use the same handoff logic as the manual button by constructing
|
|
777
|
+
// a synthetic message and calling the handler.
|
|
778
|
+
//
|
|
779
|
+
// Per-tab override wins over the global default; quick is the fallback.
|
|
780
|
+
const mode: AutoHandoffMode =
|
|
781
|
+
wf.autoHandoff.mode
|
|
782
|
+
?? cascade?.autoHandoffDefaults?.mode
|
|
783
|
+
?? 'quick';
|
|
784
|
+
// Keep mode resolution in sync with manual handoff: provider-specific
|
|
785
|
+
// resume capability is handled by handoffHandlers, which translates the
|
|
786
|
+
// original-worker choice where a live session cannot be reopened.
|
|
787
|
+
const synthMsg: import('@arco/shared').HandoffRequestMessage = {
|
|
788
|
+
type: 'handoff_request',
|
|
789
|
+
workflowId,
|
|
790
|
+
mode,
|
|
791
|
+
};
|
|
792
|
+
// SUMMARIZER resolution: only matters for fresh-summarizer. Put the
|
|
793
|
+
// per-tab summarizer (if set) onto the synthesized message; the handler's
|
|
794
|
+
// chain is `msg.summarizer ?? settings.handoffSummarizer ?? primary`, so
|
|
795
|
+
// per-tab wins, global is the middle, primary is last. For original-worker
|
|
796
|
+
// we leave summarizer unset.
|
|
797
|
+
if (mode === 'fresh-summarizer' && wf.autoHandoff.summarizer) {
|
|
798
|
+
const s = wf.autoHandoff.summarizer;
|
|
799
|
+
synthMsg.summarizer = {
|
|
800
|
+
provider: s.provider,
|
|
801
|
+
model: s.model ?? wf.primary.model,
|
|
802
|
+
effort: s.effort ?? 'medium',
|
|
803
|
+
};
|
|
804
|
+
}
|
|
805
|
+
try {
|
|
806
|
+
const dummySession: Session = sessions.get(obs) ?? { id: 'auto', workflowIds: new Set([workflowId]), clusterIds: new Set(), clusterObserved: new Map() };
|
|
807
|
+
const done = await deps.handleHandoffRequest(obs, dummySession, synthMsg);
|
|
808
|
+
if (done && typeof done === 'object' && done.artifactName) {
|
|
809
|
+
const doc = path.join(workflowDir(cwd, workflowId), 'handoffs', done.artifactName);
|
|
810
|
+
broadcastWorkflow(workflowId, {
|
|
737
811
|
type: 'system_notice',
|
|
738
812
|
workflowId,
|
|
739
|
-
content: `
|
|
813
|
+
content: `Handed off after ${count} compaction${count === 1 ? '' : 's'}: [handoff document](${doc.split(path.sep).join('/')})`,
|
|
740
814
|
});
|
|
741
815
|
}
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
console.log(`[arco] [${workflowId.slice(0, 8)}] auto-handoff: context at ${percentOfWindow}%, firing`);
|
|
754
|
-
send(obs, {
|
|
755
|
-
type: 'system_notice',
|
|
756
|
-
workflowId,
|
|
757
|
-
content: `[AUTO-HANDOFF] Context at ${percentOfWindow}%. Rotating the session.`,
|
|
758
|
-
});
|
|
759
|
-
|
|
760
|
-
// Re-use the same handoff logic as the manual button by constructing
|
|
761
|
-
// a synthetic message and calling the handler.
|
|
762
|
-
//
|
|
763
|
-
// Per-tab override wins over the global default; quick is the fallback.
|
|
764
|
-
const cascade = await readSettings(cwd).catch(() => null);
|
|
765
|
-
const mode: 'quick' | 'original-worker' | 'fresh-summarizer' =
|
|
766
|
-
wf.autoHandoff.mode
|
|
767
|
-
?? cascade?.autoHandoffDefaults?.mode
|
|
768
|
-
?? 'quick';
|
|
769
|
-
// Keep mode resolution in sync with manual handoff: provider-specific
|
|
770
|
-
// resume capability is handled by handoffHandlers, which translates the
|
|
771
|
-
// original-worker choice where a live session cannot be reopened.
|
|
772
|
-
const synthMsg: import('@arco/shared').HandoffRequestMessage = {
|
|
773
|
-
type: 'handoff_request',
|
|
774
|
-
workflowId,
|
|
775
|
-
mode,
|
|
776
|
-
};
|
|
777
|
-
// SUMMARIZER resolution: only matters for fresh-summarizer. Put the
|
|
778
|
-
// per-tab summarizer (if set) onto the synthesized message; the handler's
|
|
779
|
-
// chain is `msg.summarizer ?? settings.handoffSummarizer ?? primary`, so
|
|
780
|
-
// per-tab wins, global is the middle, primary is last. For original-worker
|
|
781
|
-
// we leave summarizer unset.
|
|
782
|
-
if (mode === 'fresh-summarizer' && wf.autoHandoff.summarizer) {
|
|
783
|
-
const s = wf.autoHandoff.summarizer;
|
|
784
|
-
synthMsg.summarizer = {
|
|
785
|
-
provider: s.provider,
|
|
786
|
-
model: s.model ?? wf.primary.model,
|
|
787
|
-
effort: s.effort ?? 'medium',
|
|
788
|
-
};
|
|
789
|
-
}
|
|
790
|
-
try {
|
|
791
|
-
const dummySession: Session = sessions.get(obs) ?? { id: 'auto', workflowIds: new Set([workflowId]), clusterIds: new Set(), clusterObserved: new Map() };
|
|
792
|
-
await deps.handleHandoffRequest(obs, dummySession, synthMsg);
|
|
793
|
-
} catch (err) {
|
|
794
|
-
console.error(`[arco] [${workflowId.slice(0, 8)}] auto-handoff failed:`, err);
|
|
795
|
-
const obs2 = anyObserver(workflowId);
|
|
796
|
-
if (obs2) {
|
|
797
|
-
send(obs2, {
|
|
798
|
-
type: 'system_notice',
|
|
799
|
-
workflowId,
|
|
800
|
-
content: `[AUTO-HANDOFF FAILED] ${err instanceof Error ? err.message : String(err)}. Click HANDOFF manually.`,
|
|
801
|
-
});
|
|
802
|
-
}
|
|
816
|
+
// Not completed (cancelled, refused, or failed with its own notice): no
|
|
817
|
+
// retry in this conversation; HANDOFF stays available.
|
|
818
|
+
} catch (err) {
|
|
819
|
+
console.error(`[arco] [${workflowId.slice(0, 8)}] auto-handoff failed:`, err);
|
|
820
|
+
const obs2 = anyObserver(workflowId);
|
|
821
|
+
if (obs2) {
|
|
822
|
+
send(obs2, {
|
|
823
|
+
type: 'system_notice',
|
|
824
|
+
workflowId,
|
|
825
|
+
content: `[AUTO-HANDOFF FAILED] ${err instanceof Error ? err.message : String(err)}. Click HANDOFF manually.`,
|
|
826
|
+
});
|
|
803
827
|
}
|
|
804
828
|
}
|
|
829
|
+
return true;
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
// Whether auto-handoff can count compactions for this tab now (provider,
|
|
833
|
+
// transport and the resolved auto-compaction policy, worker over cluster).
|
|
834
|
+
export async function autoHandoffAvailableFor(workflowId: string, wf: WorkflowState, cwd: string, cascade?: Awaited<ReturnType<typeof readSettings>> | null): Promise<AutoHandoffAvailability> {
|
|
835
|
+
const settings = cascade === undefined ? await readSettings(cwd).catch(() => null) : cascade;
|
|
836
|
+
const provider = wf.primary.provider;
|
|
837
|
+
const claudeTransport = provider === 'claude' ? await resolveClaudeTransport(wf, cwd) : undefined;
|
|
838
|
+
const codexTransport = wf.config.codexTransport ?? (settings?.codex?.transport === 'appserver' ? 'appserver' : 'exec');
|
|
839
|
+
const clusterId = clusterStore.getClusterIdForWorkflow(workflowId);
|
|
840
|
+
const ollamaSaved = settings?.ollama?.compaction?.enabled !== undefined || settings?.ollama?.compaction?.threshold !== undefined;
|
|
841
|
+
const compaction = resolveProviderAutoCompaction(wf.config.autoCompaction, clusterId ? clusterStore.getAutoCompaction(clusterId) : undefined, provider, claudeTransport ?? '', wf.config.claudeNativeCompact === true, ollamaSaved);
|
|
842
|
+
return autoHandoffAvailability({
|
|
843
|
+
provider,
|
|
844
|
+
claudeTransport,
|
|
845
|
+
codexTransport,
|
|
846
|
+
chat: isChatWorkflow(wf.config),
|
|
847
|
+
compaction,
|
|
848
|
+
ollamaSavedEnabled: ollamaSaved ? settings?.ollama?.compaction?.enabled !== false : undefined,
|
|
849
|
+
});
|
|
805
850
|
}
|
|
806
851
|
|
|
807
852
|
export function freshAutoCompactionPercent(provider: string, transport: string, outcome: { error?: string; lastPromptTokens?: number; modelContextWindow?: number; freshContextWindow?: number }): number | undefined {
|
|
@@ -856,8 +901,11 @@ export async function runExplicitContextActions(
|
|
|
856
901
|
busyToken: number, ws?: WebSocket, session?: Session,
|
|
857
902
|
): Promise<'stale' | 'compact-attempted' | 'done'> {
|
|
858
903
|
if (lastBusyClaim.get(wf) !== busyToken) return 'stale';
|
|
859
|
-
//
|
|
860
|
-
//
|
|
904
|
+
// A due auto-handoff starts a fresh session, so this boundary needs no
|
|
905
|
+
// fold or compaction.
|
|
906
|
+
if (await maybeAutoHandoff(workflowId, wf, cwd)) return 'done';
|
|
907
|
+
if (lastBusyClaim.get(wf) !== busyToken) return 'stale';
|
|
908
|
+
// Ollama compacts at the next pre-dispatch boundary.
|
|
861
909
|
if (wf.primary.provider === 'ollama' && policy.enabled) return 'done';
|
|
862
910
|
let foldClaim: number | undefined;
|
|
863
911
|
const folded = await maybeAutoFold(workflowId, wf, cwd, (token) => { foldClaim = token; }, () => lastBusyClaim.get(wf) === busyToken);
|
|
@@ -866,7 +914,6 @@ export async function runExplicitContextActions(
|
|
|
866
914
|
if (folded) { wf.lastContextPercent = 0; wf.lastContextBudgetPct = undefined; }
|
|
867
915
|
if (foldClaim !== undefined) return 'done';
|
|
868
916
|
if (await maybeAutoCompactPolicy(workflowId, wf, cwd, policy, reading, busyToken, ws, session)) return 'compact-attempted';
|
|
869
|
-
await maybeAutoHandoff(workflowId, wf, cwd);
|
|
870
917
|
return 'done';
|
|
871
918
|
}
|
|
872
919
|
|
|
@@ -907,7 +954,15 @@ export async function maybeAutoContinueAfterCompact(
|
|
|
907
954
|
// turn starts while calibration is running, the pty is cancelled via
|
|
908
955
|
// wf.cancelCalibration (set by the primary turn handler in handleUserMessage).
|
|
909
956
|
export async function maybeCalibrate(workflowId: string, wf: WorkflowState, cwd: string): Promise<void> {
|
|
910
|
-
|
|
957
|
+
const sessionId = wf.primarySessionId;
|
|
958
|
+
const model = wf.primary.model;
|
|
959
|
+
const claim = lastBusyClaim.get(wf);
|
|
960
|
+
const revocation = busyRevocations.get(wf);
|
|
961
|
+
const stillIdle = () => workflows.get(workflowId) === wf && !wf.busy
|
|
962
|
+
&& wf.primary.provider === 'claude' && wf.primarySessionId === sessionId
|
|
963
|
+
&& wf.primary.model === model && lastBusyClaim.get(wf) === claim
|
|
964
|
+
&& busyRevocations.get(wf) === revocation;
|
|
965
|
+
if (!sessionId || !stillIdle() || wf.cancelCalibration) return;
|
|
911
966
|
// CLI transport only. Native gets exact token counts from the API
|
|
912
967
|
// (lastPromptTokens) — the byte-ratio estimator this tunes never runs for
|
|
913
968
|
// it. Worse than useless: the `--print "/context"` probe APPENDS synthetic
|
|
@@ -916,8 +971,7 @@ export async function maybeCalibrate(workflowId: string, wf: WorkflowState, cwd:
|
|
|
916
971
|
// CLI session that polluted a file the session watcher was treating as
|
|
917
972
|
// transcript truth.
|
|
918
973
|
if (await resolveClaudeTransport(wf, cwd) === 'native') return;
|
|
919
|
-
|
|
920
|
-
if (!sessionId) return;
|
|
974
|
+
if (!stillIdle()) return;
|
|
921
975
|
|
|
922
976
|
const cal: CalibrationState = wf.calibration ?? {
|
|
923
977
|
ratio: BYTES_PER_TOKEN_DEFAULT,
|
|
@@ -927,15 +981,15 @@ export async function maybeCalibrate(workflowId: string, wf: WorkflowState, cwd:
|
|
|
927
981
|
|
|
928
982
|
// Get current estimate to detect zone crossing
|
|
929
983
|
const est = await estimateContextFill(cwd, sessionId, wf.primary.model, cal).catch(() => null);
|
|
930
|
-
if (!est) return;
|
|
984
|
+
if (!est || !stillIdle()) return;
|
|
931
985
|
|
|
932
986
|
const currentPercent = est.percentOfWindow;
|
|
933
987
|
const prevPercent = wf.lastContextPercent;
|
|
934
988
|
wf.lastContextPercent = currentPercent;
|
|
935
989
|
|
|
936
|
-
// Don't calibrate
|
|
937
|
-
//
|
|
938
|
-
if (currentPercent >=
|
|
990
|
+
// Don't calibrate near a full window: not worth the latency when the CLI's
|
|
991
|
+
// own compaction is imminent.
|
|
992
|
+
if (currentPercent >= 90) return;
|
|
939
993
|
|
|
940
994
|
// Skip when the estimator already has ground truth from the JSONL usage
|
|
941
995
|
// blocks — calibration only exists to tune the byte-count ratio, and the
|
|
@@ -958,15 +1012,22 @@ export async function maybeCalibrate(workflowId: string, wf: WorkflowState, cwd:
|
|
|
958
1012
|
|
|
959
1013
|
console.log(`[arco] [${workflowId.slice(0, 8)}] calibrating zone ${zone} at ${currentPercent}%`);
|
|
960
1014
|
|
|
1015
|
+
if (!stillIdle() || wf.cancelCalibration) return;
|
|
1016
|
+
let cancelProbe: (() => void) | undefined;
|
|
1017
|
+
let cancelled = false;
|
|
1018
|
+
const cancel = () => { cancelled = true; cancelProbe?.(); };
|
|
1019
|
+
wf.cancelCalibration = cancel;
|
|
961
1020
|
let result: import('../contextCalibrator.js').CalibrationResult | null = null;
|
|
962
1021
|
try {
|
|
963
1022
|
result = await runCalibration(sessionId, wf.primary.model, cwd, est.jsonlBytes, (cancelFn) => {
|
|
964
|
-
|
|
1023
|
+
cancelProbe = cancelFn;
|
|
1024
|
+
if (cancelled || !stillIdle()) cancelFn();
|
|
965
1025
|
});
|
|
966
1026
|
} catch (err) {
|
|
967
1027
|
console.error(`[arco] [${workflowId.slice(0, 8)}] calibration error:`, err);
|
|
968
1028
|
}
|
|
969
|
-
wf.cancelCalibration = undefined;
|
|
1029
|
+
if (wf.cancelCalibration === cancel) wf.cancelCalibration = undefined;
|
|
1030
|
+
if (cancelled || !stillIdle()) return;
|
|
970
1031
|
|
|
971
1032
|
if (!result) {
|
|
972
1033
|
console.warn(`[arco] [${workflowId.slice(0, 8)}] calibration zone ${zone} failed or was cancelled`);
|
|
@@ -1007,7 +1068,7 @@ export async function maybeCalibrate(workflowId: string, wf: WorkflowState, cwd:
|
|
|
1007
1068
|
// Plan-less workflows receive a single-line note describing plan creation and
|
|
1008
1069
|
// attachment. It preserves the parseable phase and checkbox structure and can
|
|
1009
1070
|
// be stripped from session replay without duplicating the user message.
|
|
1010
|
-
function planAuthoringNote(cwd: string, workflowId: string): string {
|
|
1071
|
+
function planAuthoringNote(cwd: string, workflowId: string, publicProject = false): string {
|
|
1011
1072
|
return (
|
|
1012
1073
|
`[No project plan is attached to this Arco workflow. If asked to create/attach one, do NOT just write a ` +
|
|
1013
1074
|
`markdown file — a loose file is invisible to Arco. Prefer the \`plan_create\` tool (MCP server \`arco\`) ` +
|
|
@@ -1024,6 +1085,7 @@ function planAuthoringNote(cwd: string, workflowId: string): string {
|
|
|
1024
1085
|
`docs, which hold the specs/research/design detail. After creating the plan, write each doc with \`plan_ref_write\` ` +
|
|
1025
1086
|
`(or as files at .arco/plans/<planId>.refs/<slug>.md — not loose design files elsewhere in the repo) and link it ` +
|
|
1026
1087
|
`from every task that depends on it as \`[label](ref:slug)\`; whoever works that task reads the linked ref first. ` +
|
|
1088
|
+
(publicProject ? `This project is public. Include a Privacy and public safety section in any new plan, fitted to this project and its risks. ` : '') +
|
|
1027
1089
|
`Don't create a plan unless asked.]\n\n`
|
|
1028
1090
|
);
|
|
1029
1091
|
}
|
|
@@ -1034,7 +1096,10 @@ export async function buildPlanPrefix(
|
|
|
1034
1096
|
workflowId: string,
|
|
1035
1097
|
): Promise<string> {
|
|
1036
1098
|
if (!cwd) return '';
|
|
1037
|
-
if (!wf.planId)
|
|
1099
|
+
if (!wf.planId) {
|
|
1100
|
+
const isPublic = await getEffectivePublicProjectChoice(cwd).catch((error: NodeJS.ErrnoException) => { if (error.code === 'ENOENT') return null; throw error; });
|
|
1101
|
+
return planAuthoringNote(cwd, workflowId, isPublic === true);
|
|
1102
|
+
}
|
|
1038
1103
|
const plan = await readPlan(cwd, wf.planId).catch(() => null);
|
|
1039
1104
|
if (!plan) {
|
|
1040
1105
|
// Plan was deleted out from under us. Detach quietly so future turns
|
|
@@ -1090,9 +1155,10 @@ export async function buildPlanPrefix(
|
|
|
1090
1155
|
return header;
|
|
1091
1156
|
}
|
|
1092
1157
|
|
|
1093
|
-
export function projectQueue(items: QueueItem[]): Array<{ content: string; clientMessageId?: string; interrupt?: boolean }> {
|
|
1158
|
+
export function projectQueue(items: QueueItem[]): Array<{ content: string; clientMessageId?: string; interrupt?: boolean; automaticKind?: import('@arco/shared').AutomaticMessageKind }> {
|
|
1094
1159
|
return items.map((q) => ({
|
|
1095
1160
|
content: q.content,
|
|
1161
|
+
...(q.automaticKind ? { automaticKind: q.automaticKind } : {}),
|
|
1096
1162
|
...(q.interrupt ? { interrupt: true } : {}),
|
|
1097
1163
|
...(q.clientMessageId ? { clientMessageId: q.clientMessageId } : {}),
|
|
1098
1164
|
}));
|
|
@@ -1125,8 +1191,8 @@ export function broadcastQueueUpdate(workflowId: string): void {
|
|
|
1125
1191
|
// shape the post-turn drain uses. The `user_message_echo` was already
|
|
1126
1192
|
// emitted at enqueue time (handleUserMessage) so we don't re-echo here;
|
|
1127
1193
|
// the persisted echo at the original timestamp is the authoritative
|
|
1128
|
-
//
|
|
1129
|
-
//
|
|
1194
|
+
// audit record. Delivery attempt metadata places the input at its confirmed
|
|
1195
|
+
// boundary for provider replay and review, while the live chat keeps the echo.
|
|
1130
1196
|
//
|
|
1131
1197
|
// Retry safety: the drain is destructive (splice) so a same-iteration
|
|
1132
1198
|
// re-call would return []. Provider-side retry loops that call drainSteer
|
|
@@ -1134,37 +1200,48 @@ export function broadcastQueueUpdate(workflowId: string): void {
|
|
|
1134
1200
|
// results and the next streamOneTurn) cannot double-deliver. Recovery
|
|
1135
1201
|
// paths in llamacpp.ts inject their own synthetic user messages and skip
|
|
1136
1202
|
// past the hook — by design.
|
|
1137
|
-
|
|
1203
|
+
const originalSteerItems = new WeakMap<SteerItem, QueueItem>();
|
|
1204
|
+
|
|
1205
|
+
export function drainSteerForWorker(workflowId: string, ws: WebSocket, deliveryProvider?: WorkflowConfig['primaryProvider']): SteerItem[] {
|
|
1138
1206
|
const wf = workflows.get(workflowId);
|
|
1139
1207
|
if (!wf || wf.queue.steering.length === 0 || wf.primaryTurn?.holdSteer || wf.queue.steering.some((q) => q.interrupt)) return [];
|
|
1140
1208
|
const drained = wf.queue.steering.splice(0);
|
|
1209
|
+
const deliveryId = randomUUID();
|
|
1141
1210
|
broadcastQueueUpdate(workflowId);
|
|
1142
1211
|
const drainedClientIds = drained
|
|
1143
1212
|
.map((d) => d.clientMessageId)
|
|
1144
1213
|
.filter((id): id is string => typeof id === 'string' && id.length > 0);
|
|
1145
|
-
if (drainedClientIds.length > 0 && wf.primary.provider !== 'codex') {
|
|
1146
|
-
|
|
1214
|
+
if (drainedClientIds.length > 0 && (deliveryProvider ?? wf.primary.provider) !== 'codex') {
|
|
1215
|
+
broadcastWorkflow(workflowId, { type: 'turn_messages_delivered', workflowId, clientMessageIds: drainedClientIds, deliveryId });
|
|
1147
1216
|
}
|
|
1148
1217
|
if (drainedClientIds.length > 0) {
|
|
1149
1218
|
send(ws, {
|
|
1150
1219
|
type: 'queued_messages_drained',
|
|
1151
1220
|
workflowId,
|
|
1221
|
+
deliveryId,
|
|
1152
1222
|
clientMessageIds: drainedClientIds,
|
|
1153
1223
|
drainedAt: Date.now(),
|
|
1154
1224
|
});
|
|
1155
1225
|
}
|
|
1156
1226
|
console.log(`[arco] [${workflowId.slice(0, 8)}] mid-turn steer drained (${drained.length} item${drained.length === 1 ? '' : 's'}; follow-up bucket untouched)`);
|
|
1157
|
-
return drained.map((d) =>
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1227
|
+
return drained.map((d) => {
|
|
1228
|
+
const pending = clusterToolsPending(wf, clusterStore.getClusterIdForWorkflow(workflowId));
|
|
1229
|
+
const raw = d.expandedContext ? d.content + d.expandedContext : d.content;
|
|
1230
|
+
const item: SteerItem = {
|
|
1231
|
+
deliveryId,
|
|
1232
|
+
// §D1 — mid-turn steer is delivered as a single `content` string through
|
|
1233
|
+
// the provider steer APIs (SteerItem has no separate context block), so a
|
|
1234
|
+
// steer message's expanded `@`-refs ride appended to its content. The echo
|
|
1235
|
+
// already went out compact at enqueue; this only affects what the model
|
|
1236
|
+
// sees mid-turn. Post-turn drain (the loop in handleUserMessage) uses the
|
|
1237
|
+
// separate-block path instead.
|
|
1238
|
+
content: pending ? (d.clusterBusyReminder ? CLUSTER_TOOLS_PENDING_AGENT : `${CLUSTER_TOOLS_PENDING_AGENT}\n\n${raw}`) : raw,
|
|
1239
|
+
...(d.clientMessageId ? { clientMessageId: d.clientMessageId } : {}),
|
|
1240
|
+
...(d.attachments && d.attachments.length > 0 ? { attachments: d.attachments } : {}),
|
|
1241
|
+
};
|
|
1242
|
+
originalSteerItems.set(item, d);
|
|
1243
|
+
return item;
|
|
1244
|
+
});
|
|
1168
1245
|
}
|
|
1169
1246
|
|
|
1170
1247
|
// Phase 6b — re-enqueue support for the Codex app-server worker. The worker
|
|
@@ -1190,7 +1267,7 @@ export function requeueSteerForWorker(
|
|
|
1190
1267
|
if (!wf || items.length === 0) return;
|
|
1191
1268
|
const arr = bucket === 'steer' ? wf.queue.steering : wf.queue.followUp;
|
|
1192
1269
|
for (const item of items) {
|
|
1193
|
-
arr.push({
|
|
1270
|
+
arr.push(originalSteerItems.get(item) ?? {
|
|
1194
1271
|
content: item.content,
|
|
1195
1272
|
...(item.clientMessageId ? { clientMessageId: item.clientMessageId } : {}),
|
|
1196
1273
|
...(item.attachments && item.attachments.length > 0 ? { attachments: item.attachments } : {}),
|
|
@@ -1273,6 +1350,8 @@ export async function persistInitialMeta(
|
|
|
1273
1350
|
...(typeof config.claudeNativeForceInterleavedThinkingBeta === 'boolean'
|
|
1274
1351
|
? { claudeNativeForceInterleavedThinkingBeta: config.claudeNativeForceInterleavedThinkingBeta }
|
|
1275
1352
|
: {}),
|
|
1353
|
+
nativeSubagents: config.nativeSubagents,
|
|
1354
|
+
claudeNativeTaskDisabled: config.claudeNativeTaskDisabled,
|
|
1276
1355
|
...(config.claudeNativeThinkingDisplay === 'omitted' || config.claudeNativeThinkingDisplay === 'summarized' || config.claudeNativeThinkingDisplay === 'updates'
|
|
1277
1356
|
? { claudeNativeThinkingDisplay: config.claudeNativeThinkingDisplay }
|
|
1278
1357
|
: {}),
|
|
@@ -1305,12 +1384,10 @@ export async function persistInitialMeta(
|
|
|
1305
1384
|
...(config.reviewSafeMode === 'on' || config.reviewSafeMode === 'off'
|
|
1306
1385
|
? { reviewSafeMode: config.reviewSafeMode }
|
|
1307
1386
|
: {}),
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
? { outputStyle: 'terse' as const }
|
|
1313
|
-
: {}),
|
|
1387
|
+
// Only a style other than the default is written; unset means
|
|
1388
|
+
// DEFAULT_OUTPUT_STYLE. Legacy `lite` / `caveman` from a stale client are
|
|
1389
|
+
// written as `plain` / `terse` (plain being the default, it stays unset).
|
|
1390
|
+
...(storedOutputStyle(config.outputStyle) ? { outputStyle: storedOutputStyle(config.outputStyle) } : {}),
|
|
1314
1391
|
// docs/GOTCHAS.md - persist a north-star seeded before the first turn
|
|
1315
1392
|
// (e.g. a Spawn-from-here that inherited the parent's) so it survives a
|
|
1316
1393
|
// restart even if the operator never re-sets it. Blank ⇒ omitted.
|
|
@@ -1342,6 +1419,18 @@ export async function writeCalibrationToMeta(
|
|
|
1342
1419
|
});
|
|
1343
1420
|
}
|
|
1344
1421
|
|
|
1422
|
+
// Automatic busy reminders use the same steering queue as a manual nudge.
|
|
1423
|
+
// Losing the busy turn during async preparation drops the reminder instead
|
|
1424
|
+
// of creating a new turn or steering a newer generation.
|
|
1425
|
+
export async function enqueueBusyReminder(workflowId: string, content: string, allow?: () => boolean): Promise<boolean> {
|
|
1426
|
+
let accepted = false;
|
|
1427
|
+
const ws = { readyState: WebSocket.CLOSED, send: () => undefined } as unknown as WebSocket;
|
|
1428
|
+
const session = { id: 'busy-reminder', workflowIds: new Set([workflowId]), clusterIds: new Set<string>(), clusterObserved: new Map() } as Session;
|
|
1429
|
+
await handleUserMessage(ws,session,workflowId,content,undefined,undefined,true,'steer',undefined,undefined,
|
|
1430
|
+
{ automaticKind: 'auto-pickup', clusterBusyReminder: true, busyOnly: true, busyOnlyGuard: allow, onBusyQueued: () => { accepted = true; } });
|
|
1431
|
+
return accepted;
|
|
1432
|
+
}
|
|
1433
|
+
|
|
1345
1434
|
export async function handleUserMessage(
|
|
1346
1435
|
ws: WebSocket,
|
|
1347
1436
|
session: Session,
|
|
@@ -1352,10 +1441,10 @@ export async function handleUserMessage(
|
|
|
1352
1441
|
interjection: boolean,
|
|
1353
1442
|
kind: 'steer' | 'follow-up' | 'interrupt' | undefined,
|
|
1354
1443
|
primitive: 'docs' | 'git' | 'plan-review' | undefined,
|
|
1355
|
-
pickedSkills?: Array<{ scope: 'project' | 'global'; slug: string }>,
|
|
1444
|
+
pickedSkills?: Array<{ scope: 'project' | 'global' | 'builtin'; slug: string }>,
|
|
1356
1445
|
// drainQueueIfIdle only: take the prompt from wf.queue at claim time
|
|
1357
1446
|
// instead of `content` (items were echoed + expanded at enqueue).
|
|
1358
|
-
opts?: { fromQueue?: boolean; backgroundEvent?: boolean; onBackgroundSettled?: (error?: string) => void; claimGuard?: (claim: () => boolean) => Promise<boolean> },
|
|
1447
|
+
opts?: { clusterBusyReminder?: boolean; automaticKind?: import('@arco/shared').AutomaticMessageKind; fromQueue?: boolean; busyOnly?: boolean; busyOnlyGuard?: () => boolean; onBusyQueued?: () => void; backgroundEvent?: boolean; onBackgroundSettled?: (error?: string) => void; claimGuard?: (claim: () => boolean) => Promise<boolean> },
|
|
1359
1448
|
): Promise<void> {
|
|
1360
1449
|
const fromQueue = opts?.fromQueue === true;
|
|
1361
1450
|
const wf = workflows.get(workflowId);
|
|
@@ -1363,6 +1452,14 @@ export async function handleUserMessage(
|
|
|
1363
1452
|
send(ws, { type: 'error', message: `Unknown workflow ${workflowId.slice(0, 8)}` });
|
|
1364
1453
|
return;
|
|
1365
1454
|
}
|
|
1455
|
+
if (storageMigrations.has(wf)) {
|
|
1456
|
+
send(ws, { type: 'error', message: 'Message not sent: workflow storage is moving. Wait for the scaffold to finish, then resend.' });
|
|
1457
|
+
return;
|
|
1458
|
+
}
|
|
1459
|
+
incomingMessages.set(wf, (incomingMessages.get(wf) ?? 0) + 1);
|
|
1460
|
+
try {
|
|
1461
|
+
const busyOnlyClaim = lastBusyClaim.get(wf);
|
|
1462
|
+
if (opts?.busyOnly && !wf.busy) return;
|
|
1366
1463
|
const interruptEpoch = busyRevocations.get(wf) ?? 0;
|
|
1367
1464
|
const cwd = wf.config.workingDirectory;
|
|
1368
1465
|
if (!cwd) {
|
|
@@ -1373,7 +1470,7 @@ export async function handleUserMessage(
|
|
|
1373
1470
|
const chatMode = isChatWorkflow(wf.config);
|
|
1374
1471
|
const incognito = chatMode && wf.config.incognito === true;
|
|
1375
1472
|
const trackOllama = wf.primary.provider === 'ollama' && !chatMode;
|
|
1376
|
-
if (
|
|
1473
|
+
if (!clientMessageId) clientMessageId = randomUUID();
|
|
1377
1474
|
// Chat tabs expose no project tools; web_search/web_fetch is the one
|
|
1378
1475
|
// exception the operator can arm (default on for a saved Chat). Computed per
|
|
1379
1476
|
// turn so the header toggle takes effect on the next message, and passed
|
|
@@ -1401,6 +1498,26 @@ export async function handleUserMessage(
|
|
|
1401
1498
|
return;
|
|
1402
1499
|
}
|
|
1403
1500
|
|
|
1501
|
+
// Explicit built-in slash commands are resolved before queueing, so queued
|
|
1502
|
+
// turns retain the same pick. A trusted project or global copy takes priority.
|
|
1503
|
+
if (projectContextEnabled && !fromQueue) {
|
|
1504
|
+
const invocation = /^\/(grill-me|grill-with-docs|wait-what|retro|improve-codebase-architecture)(?:\s|$)/i.exec(content);
|
|
1505
|
+
if (invocation) {
|
|
1506
|
+
const requested = invocation[1].toLowerCase();
|
|
1507
|
+
const slug = requested === 'improve-codebase-architecture' ? 'architecture-review' : requested;
|
|
1508
|
+
const include = await projectTrust.resolveTrustStatus(managedTrustSource ?? cwd).catch(() => 'ask' as const) === 'always';
|
|
1509
|
+
const catalog = await listSkills(cwd, { includeProject: include });
|
|
1510
|
+
const own = [...catalog.project, ...catalog.global].find((s) => s.slug.toLowerCase() === requested || s.name.toLowerCase() === requested);
|
|
1511
|
+
const builtin = catalog.builtin.find((s) => s.slug === slug);
|
|
1512
|
+
if (own?.off || (!own && builtin?.off)) {
|
|
1513
|
+
send(ws, { type: 'error', workflowId, message: `/${requested} is turned off.` });
|
|
1514
|
+
return;
|
|
1515
|
+
}
|
|
1516
|
+
if (own) pickedSkills = [...(pickedSkills ?? []), { scope: own.scope, slug: own.slug }];
|
|
1517
|
+
else if (builtin && !builtin.replaced) pickedSkills = [...(pickedSkills ?? []), { scope: 'builtin', slug }];
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1404
1521
|
// DD10 — parameterized `/prompt` command expansion. Runs FIRST (before
|
|
1405
1522
|
// context-refs + before any echo/record) so events.jsonl carries the expanded
|
|
1406
1523
|
// turn, and so `@`-refs inside an expanded template still expand below. A
|
|
@@ -1445,7 +1562,7 @@ export async function handleUserMessage(
|
|
|
1445
1562
|
// for queued). A system_notice summarizes the expansion so it's visible +
|
|
1446
1563
|
// reviewable in events.jsonl (the four-question test). Never throws — the
|
|
1447
1564
|
// expander converts every failure to a notice.
|
|
1448
|
-
const contextExpansion = !projectContextEnabled || fromQueue
|
|
1565
|
+
const contextExpansion: ContextExpansion = !projectContextEnabled || fromQueue
|
|
1449
1566
|
? { block: '', notices: [], expandedCount: 0 }
|
|
1450
1567
|
: await expandContextRefs(cwd, content, { windowSize: lookupCtx(wf.primary.model) }).catch((err) => {
|
|
1451
1568
|
console.error(`[arco] [${workflowId.slice(0, 8)}] context-ref expansion failed:`, err);
|
|
@@ -1462,10 +1579,25 @@ export async function handleUserMessage(
|
|
|
1462
1579
|
});
|
|
1463
1580
|
}
|
|
1464
1581
|
let expandedContext = contextExpansion.block || undefined;
|
|
1582
|
+
const contextAttachments = contextExpansion.attachments ?? [];
|
|
1583
|
+
|
|
1584
|
+
const editPickedSkills = Array.isArray(pickedSkills)
|
|
1585
|
+
? pickedSkills.filter(p => p && ['project', 'global', 'builtin'].includes(p.scope) && typeof p.slug === 'string' && p.slug.length > 0)
|
|
1586
|
+
.filter((p, index, all) => all.findIndex(other => other.scope === p.scope && other.slug === p.slug) === index)
|
|
1587
|
+
.map(({ scope, slug }) => ({ scope, slug })) : undefined;
|
|
1588
|
+
pickedSkills = editPickedSkills;
|
|
1589
|
+
|
|
1590
|
+
// A synchronous provider drain cannot load one-shot skills. Resolve them
|
|
1591
|
+
// before admitting a busy send; both drain paths then carry the same block.
|
|
1592
|
+
if (wf.busy && pickedSkills?.length) {
|
|
1593
|
+
const selectedBlock = await resolvePickedSkillsBlock(pickedSkills);
|
|
1594
|
+
if (selectedBlock) expandedContext = `${expandedContext ?? ''}\n\n${selectedBlock}`;
|
|
1595
|
+
pickedSkills = undefined;
|
|
1596
|
+
}
|
|
1465
1597
|
|
|
1466
|
-
// STOP/removal during async ref/trust preparation
|
|
1467
|
-
//
|
|
1468
|
-
if (
|
|
1598
|
+
// STOP/removal during async ref/trust preparation revokes every pending
|
|
1599
|
+
// send, before it can claim a fresh busy token or enter either queue.
|
|
1600
|
+
if (workflows.get(workflowId) !== wf || (busyRevocations.get(wf) ?? 0) !== interruptEpoch) {
|
|
1469
1601
|
if (clientMessageId) send(ws, { type: 'queued_message_cancelled', workflowId, clientMessageId });
|
|
1470
1602
|
return;
|
|
1471
1603
|
}
|
|
@@ -1479,6 +1611,7 @@ export async function handleUserMessage(
|
|
|
1479
1611
|
// the closest fit). Phase 4 ships visible/rebindable; both kinds still
|
|
1480
1612
|
// drain post-turn — Phases 5–7 turn on real mid-turn delivery for steer
|
|
1481
1613
|
// per provider.
|
|
1614
|
+
if (opts?.busyOnly && (!wf.busy || wf.computerResetting || lastBusyClaim.get(wf) !== busyOnlyClaim || (opts.busyOnlyGuard && !opts.busyOnlyGuard()))) return;
|
|
1482
1615
|
if (opts?.claimGuard && (wf.busy || wf.computerResetting)) return;
|
|
1483
1616
|
if (wf.busy || wf.computerResetting) {
|
|
1484
1617
|
if (primitive === 'plan-review') {
|
|
@@ -1493,6 +1626,11 @@ export async function handleUserMessage(
|
|
|
1493
1626
|
// but we still queue rather than error — drops fewer operator messages.
|
|
1494
1627
|
console.warn(`[arco] [${workflowId.slice(0, 8)}] user_message while busy without interjection flag — queuing anyway`);
|
|
1495
1628
|
}
|
|
1629
|
+
const toolsPending = clusterToolsPending(wf, clusterStore.getClusterIdForWorkflow(workflowId));
|
|
1630
|
+
if (opts?.clusterBusyReminder && toolsPending) return;
|
|
1631
|
+
if (toolsPending && !opts?.clusterBusyReminder && opts?.automaticKind !== 'auto-pickup' && !opts?.backgroundEvent) broadcastWorkflow(workflowId, {
|
|
1632
|
+
type: 'system_notice', workflowId, content: CLUSTER_TOOLS_PENDING_NOTICE,
|
|
1633
|
+
});
|
|
1496
1634
|
const interrupt = kind === 'interrupt' && !wf.config.voiceOperator
|
|
1497
1635
|
&& (wf.primary.provider === 'claude' || wf.primary.provider === 'codex')
|
|
1498
1636
|
&& wf.primaryTurn !== undefined && ownsBusy(wf, wf.primaryTurn.token);
|
|
@@ -1503,16 +1641,20 @@ export async function handleUserMessage(
|
|
|
1503
1641
|
content: '[INTERRUPT & SEND] No interruptible Claude or Codex primary turn is running. Your message is queued as a follow-up.',
|
|
1504
1642
|
});
|
|
1505
1643
|
const arr = bucket === 'steer' ? wf.queue.steering : wf.queue.followUp;
|
|
1506
|
-
const
|
|
1644
|
+
const queuedAttachments = [...new Set([...(attachments ?? []), ...contextAttachments])];
|
|
1645
|
+
const queuedItem = { clusterBusyReminder: opts?.clusterBusyReminder, automaticKind: opts?.automaticKind, content, attachments: isolatedMember || !queuedAttachments.length ? undefined : queuedAttachments, clientMessageId, expandedContext, pickedSkills, editPickedSkills, ollamaInputSeq: undefined as number | undefined, ...(interrupt ? { interrupt: true } : {}) };
|
|
1507
1646
|
arr.push(queuedItem);
|
|
1647
|
+
opts?.onBusyQueued?.();
|
|
1508
1648
|
send(ws, {
|
|
1509
1649
|
type: 'user_message_echo',
|
|
1510
1650
|
workflowId,
|
|
1651
|
+
...(opts?.automaticKind ? { automaticKind: opts.automaticKind } : {}),
|
|
1511
1652
|
content,
|
|
1512
1653
|
attachments,
|
|
1513
1654
|
clientMessageId,
|
|
1514
1655
|
timestamp: Date.now(),
|
|
1515
1656
|
kind: interrupt ? 'interrupt' : bucket,
|
|
1657
|
+
deliveryTracked: true,
|
|
1516
1658
|
...(trackOllama ? { ollamaReplayInput: true } : {}),
|
|
1517
1659
|
});
|
|
1518
1660
|
if (trackOllama) queuedItem.ollamaInputSeq = currentWorkflowSeq(cwd, workflowId);
|
|
@@ -1557,6 +1699,7 @@ export async function handleUserMessage(
|
|
|
1557
1699
|
send(ws, {
|
|
1558
1700
|
type: 'user_message_echo',
|
|
1559
1701
|
workflowId,
|
|
1702
|
+
...(opts?.automaticKind ? { automaticKind: opts.automaticKind } : {}),
|
|
1560
1703
|
content,
|
|
1561
1704
|
attachments,
|
|
1562
1705
|
clientMessageId,
|
|
@@ -1579,6 +1722,7 @@ export async function handleUserMessage(
|
|
|
1579
1722
|
// must leave the queue available for an explicit later attempt.
|
|
1580
1723
|
assertCheckoutAvailable(workflowWritePaths(wf));
|
|
1581
1724
|
let activeOllamaInputSeqs: number[] = [];
|
|
1725
|
+
let activeInputClientIds: string[] = [];
|
|
1582
1726
|
if (fromQueue) {
|
|
1583
1727
|
const drained = takeQueuedTurn(wf.queue);
|
|
1584
1728
|
if (drained.length === 0) return;
|
|
@@ -1590,6 +1734,7 @@ export async function handleUserMessage(
|
|
|
1590
1734
|
if (drainedClientIds.length > 0) {
|
|
1591
1735
|
send(ws, { type: 'queued_messages_drained', workflowId, clientMessageIds: drainedClientIds, drainedAt: Date.now() });
|
|
1592
1736
|
}
|
|
1737
|
+
activeInputClientIds = drained.flatMap(item => item.clientMessageId ? [item.clientMessageId] : []);
|
|
1593
1738
|
activeOllamaInputSeqs = drained.every(d => d.ollamaInputSeq) ? drained.map(d => d.ollamaInputSeq!) : [];
|
|
1594
1739
|
content = drained.map((d) => d.content).join('\n\n');
|
|
1595
1740
|
const mergedAttachments = drained.flatMap((d) => d.attachments ?? []);
|
|
@@ -1608,7 +1753,7 @@ export async function handleUserMessage(
|
|
|
1608
1753
|
await opts.claimGuard(() => {
|
|
1609
1754
|
// Async preflight may have lost to STOP, a real operator turn or removal.
|
|
1610
1755
|
// Conditional nudges must never fall into the ordinary follow-up queue.
|
|
1611
|
-
if (workflows.get(workflowId) !== wf || wf.busy || wf.computerResetting || wf.queue.steering.length || wf.queue.followUp.length
|
|
1756
|
+
if (workflows.get(workflowId) !== wf || (busyRevocations.get(wf) ?? 0) !== interruptEpoch || wf.busy || wf.computerResetting || wf.queue.steering.length || wf.queue.followUp.length
|
|
1612
1757
|
|| (wf.lastForeignWriteAt && Date.now() - wf.lastForeignWriteAt < FOREIGN_WRITE_BLOCK_MS)) return false;
|
|
1613
1758
|
guardedToken = claimBusy(wf); return true;
|
|
1614
1759
|
});
|
|
@@ -1626,7 +1771,8 @@ export async function handleUserMessage(
|
|
|
1626
1771
|
if (opts?.backgroundEvent) setComputerBackgroundClaim(workflowId, busyToken);
|
|
1627
1772
|
let prompt: string = content;
|
|
1628
1773
|
let promptPickedSkills = pickedSkills;
|
|
1629
|
-
|
|
1774
|
+
const initialAttachments = [...new Set([...(attachments ?? []), ...contextAttachments])];
|
|
1775
|
+
let promptAttachments: string[] | undefined = isolatedMember || !initialAttachments.length ? undefined : initialAttachments;
|
|
1630
1776
|
let promptClientMessageId: string | undefined = clientMessageId;
|
|
1631
1777
|
// §D1 — expanded `@`-context-refs for the current iteration's prompt. First
|
|
1632
1778
|
// iteration uses the immediate-send expansion; drain iterations rebuild it
|
|
@@ -1654,6 +1800,7 @@ export async function handleUserMessage(
|
|
|
1654
1800
|
const ids = drained.flatMap((d) => d.clientMessageId ? [d.clientMessageId] : []);
|
|
1655
1801
|
if (ids.length) send(ws, { type: 'queued_messages_drained', workflowId,
|
|
1656
1802
|
clientMessageIds: ids, drainedAt: Date.now() });
|
|
1803
|
+
activeInputClientIds = [...(append ? activeInputClientIds : []), ...drained.flatMap(item => item.clientMessageId ? [item.clientMessageId] : [])];
|
|
1657
1804
|
activeOllamaInputSeqs = drained.every(d => d.ollamaInputSeq) ? [...(append ? activeOllamaInputSeqs : []), ...drained.map(d => d.ollamaInputSeq!)] : [];
|
|
1658
1805
|
prompt = [...(append ? [prompt] : []), ...drained.map((d) => d.content)].join('\n\n');
|
|
1659
1806
|
const files = [...(append ? promptAttachments ?? [] : []), ...drained.flatMap((d) => d.attachments ?? [])];
|
|
@@ -1716,10 +1863,25 @@ export async function handleUserMessage(
|
|
|
1716
1863
|
// unreadable skill is skipped with a notice rather than failing the turn.
|
|
1717
1864
|
async function resolvePickedSkillsBlock(picks: typeof pickedSkills): Promise<string> {
|
|
1718
1865
|
if (!projectContextEnabled || !picks?.length) return '';
|
|
1719
|
-
const resolved: Array<{ name: string; scope: 'project' | 'global'; body: string }> = [];
|
|
1866
|
+
const resolved: Array<{ name: string; scope: 'project' | 'global' | 'builtin'; body: string }> = [];
|
|
1720
1867
|
const missing: string[] = [];
|
|
1721
1868
|
for (const pick of picks) {
|
|
1722
1869
|
try {
|
|
1870
|
+
if (pick.scope === 'builtin') {
|
|
1871
|
+
// Built-in skills ship with Arco. The Architecture review also gets
|
|
1872
|
+
// the facts Arco gathers now and the project's recorded decisions.
|
|
1873
|
+
const builtin = readBuiltinSkill(pick.slug);
|
|
1874
|
+
if (!builtin) { missing.push(`builtin:${pick.slug}`); continue; }
|
|
1875
|
+
const trust = await projectTrust.resolveTrustStatus(managedTrustSource ?? cwd).catch(() => 'ask' as const);
|
|
1876
|
+
const catalog = await listSkills(cwd, { includeProject: trust === 'always' });
|
|
1877
|
+
const summary = catalog.builtin.find((s) => s.slug === builtin.slug);
|
|
1878
|
+
if (!summary || summary.off || summary.replaced) { missing.push(`builtin:${pick.slug}`); continue; }
|
|
1879
|
+
const extra = builtin.slug === ARCHITECTURE_REVIEW_SLUG
|
|
1880
|
+
? `\n\nArtifacts folder for this conversation: ${artifactsDir(cwd, workflowId)}\n\n${await architectureReviewFacts(cwd, wf?.planId ?? clusterStore.getPlanId(clusterStore.getClusterIdForWorkflow(workflowId) ?? ''))}`
|
|
1881
|
+
: `\n\nThe available skill files are listed in the skill manifest.`;
|
|
1882
|
+
resolved.push({ name: builtin.name, scope: 'builtin', body: builtin.body + extra });
|
|
1883
|
+
continue;
|
|
1884
|
+
}
|
|
1723
1885
|
const full = await readSkillBody(pick.scope, pick.slug, cwd);
|
|
1724
1886
|
if (full) resolved.push({ name: full.name, scope: full.scope, body: full.body });
|
|
1725
1887
|
else missing.push(`${pick.scope}:${pick.slug}`);
|
|
@@ -1772,103 +1934,36 @@ export async function handleUserMessage(
|
|
|
1772
1934
|
// update_primary_config so the operator's choice doesn't depend on a
|
|
1773
1935
|
// hand-edited settings.json.
|
|
1774
1936
|
const cascade = await readSettings(cwd, { includeProject }).catch(() => null);
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
//
|
|
1783
|
-
//
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
:
|
|
1791
|
-
|
|
1792
|
-
|
|
1937
|
+
// turnSettings.ts — which value wins for each per-turn setting (tab
|
|
1938
|
+
// choice, settings files, default; Native-only switches off elsewhere).
|
|
1939
|
+
const {
|
|
1940
|
+
codexTransport, ultracode, claudeTransport, claudeNativeCompact, claudeNativeForceInterleavedThinkingBeta,
|
|
1941
|
+
claudeNativeThinkingDisplay, nativeSubagents, efficiencyToolFilter, efficiencyFactForce, efficiencyConfigProtection,
|
|
1942
|
+
efficiencySandbox, reviewSafeMode, outputStyle, goal, ollamaParams,
|
|
1943
|
+
} = resolveTurnSettings({ provider: wf.primary.provider, config: wf.config, cascade, isolatedMember, primitive });
|
|
1944
|
+
// In-turn compaction follows the tab's or cluster's auto-compaction policy
|
|
1945
|
+
// (the plan-review step, a Chat-style request, leaves it off below).
|
|
1946
|
+
const inTurnClusterId = clusterStore.getClusterIdForWorkflow(workflowId);
|
|
1947
|
+
const claudeNativeInTurnCompactPercent = wf.primary.provider === 'claude'
|
|
1948
|
+
? resolveNativeInTurnCompactPercent({
|
|
1949
|
+
native: claudeTransport === 'native',
|
|
1950
|
+
chat: isChatWorkflow(wf.config),
|
|
1951
|
+
claudeNativeCompact,
|
|
1952
|
+
worker: wf.config.autoCompaction ?? undefined,
|
|
1953
|
+
cluster: inTurnClusterId ? clusterStore.getAutoCompaction(inTurnClusterId) : undefined,
|
|
1954
|
+
})
|
|
1955
|
+
: undefined;
|
|
1793
1956
|
const providerAccount = wf.primary.provider === 'codex'
|
|
1794
1957
|
? await resolveProviderAccount('codex', wf.config.providerAccountRef, cwd).catch(() => null)
|
|
1795
1958
|
: null;
|
|
1796
1959
|
if (providerAccount?.profile.id && wf.config.providerAccountRef !== providerAccount.profile.id) {
|
|
1797
1960
|
wf.config.providerAccountRef = providerAccount.profile.id;
|
|
1798
1961
|
}
|
|
1799
|
-
// Anthropic server-side compaction (`compact_20260112`). Defaults OFF for
|
|
1800
|
-
// Native tabs (NATIVE_COMPACTION_PLAN §1) — seeded into config at tab
|
|
1801
|
-
// creation, so by here it's a concrete boolean; an absent value also reads
|
|
1802
|
-
// as off. CLI Claude handles compaction inside the CLI process so the flag
|
|
1803
|
-
// is moot there.
|
|
1804
|
-
const claudeNativeCompact: boolean = claudeTransport === 'native'
|
|
1805
|
-
? wf.config.claudeNativeCompact === true
|
|
1806
|
-
: false;
|
|
1807
|
-
const claudeNativeForceInterleavedThinkingBeta: boolean = claudeTransport === 'native'
|
|
1808
|
-
? wf.config.claudeNativeForceInterleavedThinkingBeta === true
|
|
1809
|
-
: false;
|
|
1810
|
-
// Adaptive-thinking display for the Native worker. Absent ⇒ 'omitted'
|
|
1811
|
-
// (Claude-Code parity — no thinking streamed back); 'summarized' streams
|
|
1812
|
-
// summarized thinking into the Activity tab.
|
|
1813
|
-
const claudeNativeThinkingDisplay: 'omitted' | 'summarized' | 'updates' | undefined = claudeTransport === 'native'
|
|
1814
|
-
? wf.config.claudeNativeThinkingDisplay
|
|
1815
|
-
: undefined;
|
|
1816
|
-
// docs/PROVIDERS.md - Native tool-result filter mode. Only honored
|
|
1817
|
-
// on Native (the filter pipeline runs inside `claude-native/dispatchTool`;
|
|
1818
|
-
// CLI/Codex don't surface raw tool stdout to us). Default off until measured
|
|
1819
|
-
// per the §13.3 / §2.4 doc-discipline rule (no aggressive defaults).
|
|
1820
|
-
const efficiencyToolFilter: 'off' | 'conservative' | 'aggressive' = claudeTransport === 'native'
|
|
1821
|
-
? (wf.config.efficiencyToolFilter ?? 'off')
|
|
1822
|
-
: 'off';
|
|
1823
|
-
// docs/PROVIDERS.md - fact-force first-edit gate mode. It is
|
|
1824
|
-
// opt-in: new tabs and rehydrated tabs without the field stay 'off'. CLI
|
|
1825
|
-
// parity is deferred (master §3.3 F4), so hard-zero non-Native transports.
|
|
1826
|
-
const efficiencyFactForce: 'on' | 'off' = claudeTransport === 'native'
|
|
1827
|
-
? (wf.config.efficiencyFactForce ?? 'off')
|
|
1828
|
-
: 'off';
|
|
1829
|
-
// Config-protection write-gate. Default 'on' (safety gate); the operator
|
|
1830
|
-
// opts out per-tab. Native-only (the gate lives in the Native worker), so
|
|
1831
|
-
// we hard-zero non-Native transports to 'off' to avoid a meaningless flag.
|
|
1832
|
-
const efficiencyConfigProtection: 'on' | 'off' = claudeTransport === 'native'
|
|
1833
|
-
? (wf.config.efficiencyConfigProtection ?? 'on')
|
|
1834
|
-
: 'off';
|
|
1835
|
-
const efficiencySandbox: 'off' | 'on' = claudeTransport === 'native' && !isolatedMember
|
|
1836
|
-
? (wf.config.efficiencySandbox ?? 'off')
|
|
1837
|
-
: 'off';
|
|
1838
|
-
// docs/PROVIDERS.md - operator-armed durable review gate. Native-only (the gate
|
|
1839
|
-
// lives in the in-process worker's dispatchTool). Default 'off' so it stays
|
|
1840
|
-
// operator-opted-in and inert until armed.
|
|
1841
|
-
const reviewSafeMode: 'off' | 'on' = claudeTransport === 'native'
|
|
1842
|
-
? (wf.config.reviewSafeMode ?? 'off')
|
|
1843
|
-
: 'off';
|
|
1844
|
-
// docs/PROVIDERS.md - operator-armed terseness picker. Honored by
|
|
1845
|
-
const outputStyleSupported =
|
|
1846
|
-
(wf.primary.provider === 'claude' && claudeTransport === 'native') ||
|
|
1847
|
-
(wf.primary.provider === 'codex' && codexTransport === 'appserver');
|
|
1848
|
-
const outputStyle: 'normal' | 'lite' | 'terse' = primitive === 'docs' || primitive === 'git'
|
|
1849
|
-
? 'normal'
|
|
1850
|
-
: outputStyleSupported
|
|
1851
|
-
? (wf.config.outputStyle ?? 'normal')
|
|
1852
|
-
: 'normal';
|
|
1853
|
-
// docs/GOTCHAS.md - operator-set persistent north-star. Read straight
|
|
1854
|
-
// from wf.config, inherited on EVERY path including in-tab DOCS / GIT (the one
|
|
1855
|
-
// deliberate divergence from outputStyle's forced 'normal' for those two — a
|
|
1856
|
-
// DOCS/GIT prompt benefits from the goal context). Absent / blank ⇒ no block
|
|
1857
|
-
// on any transport; honored wherever clusterPlan is folded.
|
|
1858
|
-
const goal: string | undefined = isolatedMember ? undefined : wf.config.goal;
|
|
1859
|
-
// docs/PROVIDERS.md - per-tab Ollama param preset blob. Resolved
|
|
1860
|
-
// ONLY for Ollama tabs (the provider's request builder is the sole consumer;
|
|
1861
|
-
// every other provider ignores the field). Read straight from wf.config so
|
|
1862
|
-
// it is byte-stable across this workflow's turns — the prefix-cache
|
|
1863
|
-
// invariant. The operator-edit path (updatePrimaryConfig) is the only place
|
|
1864
|
-
// it changes between turns, and that's logged as a cache-invalidation event.
|
|
1865
|
-
const ollamaParams: Record<string, unknown> | undefined = wf.primary.provider === 'ollama'
|
|
1866
|
-
? wf.config.ollamaParams
|
|
1867
|
-
: undefined;
|
|
1868
1962
|
|
|
1869
1963
|
let activeTurnObservation: ReturnType<typeof observeCheckoutWriters> | undefined;
|
|
1870
1964
|
try {
|
|
1871
1965
|
while (true) {
|
|
1966
|
+
primaryTurn.clusterDispatch = undefined;
|
|
1872
1967
|
const pickedSkillsBlock = await resolvePickedSkillsBlock(promptPickedSkills);
|
|
1873
1968
|
console.log(`[arco] [${workflowId.slice(0, 8)}] user_message received; starting primary turn (${wf.primary.provider}:${wf.primary.model}, resume=${wf.primarySessionId?.slice(0, 8) || 'none'})`);
|
|
1874
1969
|
|
|
@@ -1916,12 +2011,15 @@ export async function handleUserMessage(
|
|
|
1916
2011
|
if (!fromQueue) send(ws, {
|
|
1917
2012
|
type: 'user_message_echo',
|
|
1918
2013
|
workflowId,
|
|
2014
|
+
...(opts?.automaticKind ? { automaticKind: opts.automaticKind } : {}),
|
|
1919
2015
|
content: prompt,
|
|
1920
2016
|
attachments: promptAttachments,
|
|
1921
2017
|
clientMessageId: promptClientMessageId,
|
|
2018
|
+
deliveryTracked: true,
|
|
1922
2019
|
timestamp: Date.now(),
|
|
1923
2020
|
...(trackOllama ? { ollamaReplayInput: true } : {}),
|
|
1924
2021
|
});
|
|
2022
|
+
if (!fromQueue) activeInputClientIds = promptClientMessageId ? [promptClientMessageId] : [];
|
|
1925
2023
|
if (!fromQueue && trackOllama) activeOllamaInputSeqs = [currentWorkflowSeq(cwd, workflowId)];
|
|
1926
2024
|
if (chatMode && !incognito) {
|
|
1927
2025
|
// Keep the global Past Chats list useful without rescanning a growing
|
|
@@ -1981,6 +2079,8 @@ export async function handleUserMessage(
|
|
|
1981
2079
|
// pending). Static text — no timestamps or random ids — so the prefix
|
|
1982
2080
|
// cache hits cleanly across turns.
|
|
1983
2081
|
let ollamaReplay: import('@arco/shared').WorkerConfig['ollamaReplay'];
|
|
2082
|
+
const retainLocalFiles = ['ollama', 'llamacpp', 'lmstudio', 'strata', 'deepseek'].includes(wf.primary.provider);
|
|
2083
|
+
let priorFiles: import('@arco/shared').WorkerConfig['priorFiles'] = retainLocalFiles || chatMode ? [] : undefined;
|
|
1984
2084
|
let primaryAppendSystemPrompt: string | undefined;
|
|
1985
2085
|
let primarySystemPrompt: string | undefined;
|
|
1986
2086
|
// The current user echo was just recorded above. Stateless providers
|
|
@@ -2010,6 +2110,7 @@ export async function handleUserMessage(
|
|
|
2010
2110
|
primarySkillsManifest = buildSkillsManifest({
|
|
2011
2111
|
project: catalog.project.filter((s) => !pinnedKeys.has(`project:${s.slug}`)),
|
|
2012
2112
|
global: catalog.global.filter((s) => !pinnedKeys.has(`global:${s.slug}`)),
|
|
2113
|
+
builtin: catalog.builtin,
|
|
2013
2114
|
});
|
|
2014
2115
|
} catch (err) {
|
|
2015
2116
|
console.error(`[arco] [${workflowId.slice(0, 8)}] skills scan failed:`, err);
|
|
@@ -2042,9 +2143,10 @@ export async function handleUserMessage(
|
|
|
2042
2143
|
const current = resolveProviderAutoCompaction(wf.config.autoCompaction, cluster ? clusterStore.getAutoCompaction(cluster) : undefined, 'ollama', '', false, savedOllamaPolicy);
|
|
2043
2144
|
return workflows.get(workflowId) === wf && ownsBusy(wf, busyToken) && wf.primary.provider === 'ollama' && JSON.stringify(current) === policyKey;
|
|
2044
2145
|
} };
|
|
2045
|
-
replayEvents = projectOllamaHistory(events, workflowId, activeOllamaInputSeqs).events;
|
|
2146
|
+
replayEvents = projectOllamaHistory(events, workflowId, activeOllamaInputSeqs, true).events;
|
|
2046
2147
|
}
|
|
2047
|
-
|
|
2148
|
+
priorFiles = projectLocalFileReferences(events, cwd, chatMode);
|
|
2149
|
+
const rendered = (wf.config.voiceOperator ? renderComputerHistory(replayEvents) : renderTranscript(replayEvents, { preserveThinking: !chatMode, separateFileContext: !chatMode, attachmentOnly: chatMode })).trim();
|
|
2048
2150
|
if (rendered) primaryAppendSystemPrompt = rendered;
|
|
2049
2151
|
} catch (err) {
|
|
2050
2152
|
console.error(`[arco] [${workflowId.slice(0, 8)}] ollama transcript build failed:`, err);
|
|
@@ -2075,8 +2177,9 @@ export async function handleUserMessage(
|
|
|
2075
2177
|
const events = priorIncognitoEvents ?? (wf.config.voiceOperator
|
|
2076
2178
|
? await computerReplayEvents(cwd, workflowId, wf.config.computerContext?.lastResetAt, wf.config.computerContext?.lastResetSeq)
|
|
2077
2179
|
: await replayWorkflowEvents(cwd, workflowId, 0));
|
|
2180
|
+
if (retainLocalFiles || chatMode) priorFiles = projectLocalFileReferences(events, cwd, chatMode);
|
|
2078
2181
|
const summary = chatMode ? '' : summarizePriorTurns(events);
|
|
2079
|
-
const rendered = (wf.config.voiceOperator ? renderComputerHistory(events) : renderTranscript(events, { preserveThinking: false })).trim();
|
|
2182
|
+
const rendered = (wf.config.voiceOperator ? renderComputerHistory(events) : renderTranscript(events, { preserveThinking: false, separateFileContext: !chatMode && (wf.primary.provider === 'llamacpp' || wf.primary.provider === 'lmstudio'), attachmentOnly: chatMode })).trim();
|
|
2080
2183
|
const parts: string[] = [];
|
|
2081
2184
|
if (summary) {
|
|
2082
2185
|
parts.push(`USER: [Workflow context]`);
|
|
@@ -2097,65 +2200,40 @@ export async function handleUserMessage(
|
|
|
2097
2200
|
if (rendered) primaryAppendSystemPrompt = `Conversation so far:\n\n${rendered}`;
|
|
2098
2201
|
}
|
|
2099
2202
|
|
|
2203
|
+
if (chatMode && (incognito || !wf.primarySessionId) && (wf.primary.provider === 'codex' || (wf.primary.provider === 'claude' && claudeTransport !== 'native'))) {
|
|
2204
|
+
try {
|
|
2205
|
+
const events = priorIncognitoEvents ?? await replayWorkflowEvents(cwd, workflowId, 0);
|
|
2206
|
+
priorFiles = projectLocalFileReferences(events, cwd, true);
|
|
2207
|
+
} catch (err) {
|
|
2208
|
+
console.error(`[arco] [${workflowId.slice(0, 8)}] chat attachment replay failed:`, err);
|
|
2209
|
+
}
|
|
2210
|
+
}
|
|
2211
|
+
|
|
2100
2212
|
// Local HTTP transports receive stable tool instructions through the
|
|
2101
2213
|
// provider system-prompt field; Claude and Codex transports fold them
|
|
2102
2214
|
// into their string-form prompt or native request blocks.
|
|
2103
|
-
|
|
2104
|
-
const primarySkillsContext = [pinnedSkillsBlock, primarySkillsManifest].filter(Boolean).join('\n\n');
|
|
2105
|
-
let finalSystemPrompt = usesSystemPromptForSkills && primarySkillsContext
|
|
2106
|
-
? (primarySystemPrompt ? `${primarySkillsContext}\n\n${primarySystemPrompt}` : primarySkillsContext)
|
|
2107
|
-
: primarySystemPrompt;
|
|
2108
|
-
const finalAppendBase = chatMode ? primaryAppendSystemPrompt : withPreviewNudge(primaryAppendSystemPrompt);
|
|
2109
|
-
const baseWithSkills = !usesSystemPromptForSkills && primarySkillsContext
|
|
2110
|
-
? `${primarySkillsContext}\n\n${finalAppendBase}`
|
|
2111
|
-
: finalAppendBase;
|
|
2112
|
-
// Phase 7a — fold discovered CLAUDE.md files into appendSystemPrompt
|
|
2113
|
-
// for Claude tabs (CLI + Native both benefit). Walks up from cwd
|
|
2114
|
-
// collecting CLAUDE.md, plus ~/.claude/CLAUDE.md.
|
|
2115
|
-
let finalAppend = baseWithSkills;
|
|
2116
|
-
// docs/VOICE.md - the Computer voice operator chat has its own
|
|
2117
|
-
// base instructions and real (arco-voice) tools; the generic Chat
|
|
2118
|
-
// preamble ("do not use backend tools… continue in an Agent tab") made
|
|
2119
|
-
// Luna refuse them (2026-10-17 smoke:voice-luna regression).
|
|
2120
|
-
if (chatMode && wf.config.voiceOperator === true) {
|
|
2121
|
-
if (usesSystemPromptForSkills) finalSystemPrompt = VOICE_OPERATOR_PROMPT;
|
|
2122
|
-
else if (wf.primary.provider !== 'codex') finalAppend = [VOICE_OPERATOR_PROMPT, finalAppend].filter(Boolean).join('\n\n');
|
|
2123
|
-
}
|
|
2124
|
-
if (chatMode && wf.config.voiceOperator !== true) {
|
|
2125
|
-
const chatPrompt = chatSystemPrompt(chatWeb);
|
|
2126
|
-
if (usesSystemPromptForSkills) {
|
|
2127
|
-
finalSystemPrompt = chatPrompt;
|
|
2128
|
-
} else {
|
|
2129
|
-
finalAppend = finalAppend ? `${chatPrompt}\n\n${finalAppend}` : chatPrompt;
|
|
2130
|
-
}
|
|
2131
|
-
}
|
|
2215
|
+
let claudeMd: string | null = null;
|
|
2132
2216
|
if (projectContextEnabled && (wf.primary.provider === 'claude') && cwd) {
|
|
2133
2217
|
try {
|
|
2134
|
-
|
|
2135
|
-
if (claudeMd) {
|
|
2136
|
-
finalAppend = baseWithSkills
|
|
2137
|
-
? `${claudeMd}\n\n${baseWithSkills}`
|
|
2138
|
-
: claudeMd;
|
|
2139
|
-
}
|
|
2218
|
+
claudeMd = (await discoverClaudeMdFiles(cwd, { includeProject })) || null;
|
|
2140
2219
|
} catch (err) {
|
|
2141
2220
|
console.warn(`[arco] [${workflowId.slice(0, 8)}] CLAUDE.md discovery failed:`, err);
|
|
2142
2221
|
}
|
|
2143
2222
|
}
|
|
2144
|
-
|
|
2145
|
-
//
|
|
2146
|
-
//
|
|
2147
|
-
//
|
|
2148
|
-
//
|
|
2149
|
-
//
|
|
2150
|
-
//
|
|
2151
|
-
//
|
|
2152
|
-
|
|
2153
|
-
// this READS operator-curated articles; nothing here writes the KB.
|
|
2223
|
+
// docs/ARCHITECTURE.md - the operator-curated knowledge base, as a
|
|
2224
|
+
// BOUNDED block. Provider-agnostic, only the always-include articles.
|
|
2225
|
+
// buildKnowledgeBlock hard-caps the combined body at
|
|
2226
|
+
// KNOWLEDGE_INJECT_BUDGET and appends a truncation notice when the set
|
|
2227
|
+
// overflows — the KB can NEVER silently bloat the turn. Emitted byte
|
|
2228
|
+
// counts land in events.jsonl (system_notice) for the four-question
|
|
2229
|
+
// test's context visibility. FENCE: this READS operator-curated
|
|
2230
|
+
// articles; nothing here writes the KB.
|
|
2231
|
+
let knowledge: string | null = null;
|
|
2154
2232
|
if (projectContextEnabled && cwd) {
|
|
2155
2233
|
try {
|
|
2156
2234
|
const kb = await buildKnowledgeBlock(cwd);
|
|
2157
2235
|
if (kb.text) {
|
|
2158
|
-
|
|
2236
|
+
knowledge = kb.text;
|
|
2159
2237
|
if (firstIteration) {
|
|
2160
2238
|
const truncNote = kb.truncated ? ` (truncated — exceeds injection budget)` : '';
|
|
2161
2239
|
send(ws, {
|
|
@@ -2169,6 +2247,20 @@ export async function handleUserMessage(
|
|
|
2169
2247
|
console.warn(`[arco] [${workflowId.slice(0, 8)}] knowledge-base injection failed:`, err);
|
|
2170
2248
|
}
|
|
2171
2249
|
}
|
|
2250
|
+
// turnPrompt.ts — skills, the Chat or Computer preamble, CLAUDE.md and
|
|
2251
|
+
// the knowledge base, in the order the model sees them.
|
|
2252
|
+
let { systemPrompt: finalSystemPrompt, appendSystemPrompt: finalAppend } = composeBasePrompts({
|
|
2253
|
+
provider: wf.primary.provider,
|
|
2254
|
+
chatMode,
|
|
2255
|
+
computerChat: wf.config.voiceOperator === true,
|
|
2256
|
+
chatWeb,
|
|
2257
|
+
systemPrompt: primarySystemPrompt,
|
|
2258
|
+
appendSystemPrompt: primaryAppendSystemPrompt,
|
|
2259
|
+
pinnedSkills: pinnedSkillsBlock,
|
|
2260
|
+
skillsManifest: primarySkillsManifest,
|
|
2261
|
+
claudeMd,
|
|
2262
|
+
knowledge,
|
|
2263
|
+
});
|
|
2172
2264
|
|
|
2173
2265
|
// Operator-initiated plan-mode entry. Resolved per turn from the
|
|
2174
2266
|
// pending flag the `enter_plan_mode_request` handler set. Only Claude
|
|
@@ -2208,6 +2300,7 @@ export async function handleUserMessage(
|
|
|
2208
2300
|
// the next turn's lookup returns undefined and the tools disappear
|
|
2209
2301
|
// from the worker's tool list.
|
|
2210
2302
|
const turnClusterId = clusterStore.getClusterIdForWorkflow(workflowId);
|
|
2303
|
+
primaryTurn.clusterDispatch = { clusterId: turnClusterId };
|
|
2211
2304
|
|
|
2212
2305
|
// Phase 2.6 — resolve the cluster's shared plan body + this member's
|
|
2213
2306
|
// role hint at turn start. Both ride into WorkerConfig so the Native
|
|
@@ -2267,7 +2360,7 @@ export async function handleUserMessage(
|
|
|
2267
2360
|
);
|
|
2268
2361
|
}
|
|
2269
2362
|
|
|
2270
|
-
if (turnClusterId && (wf.primary.provider === 'ollama' || wf.primary.provider === 'llamacpp')) {
|
|
2363
|
+
if (turnClusterId && (wf.primary.provider === 'ollama' || wf.primary.provider === 'llamacpp' || wf.primary.provider === 'lmstudio' || wf.primary.provider === 'strata' || wf.primary.provider === 'deepseek')) {
|
|
2271
2364
|
if (clusterAccessMode === 'standard') {
|
|
2272
2365
|
finalSystemPrompt = buildLocalClusterSystemPrompt({
|
|
2273
2366
|
base: finalSystemPrompt,
|
|
@@ -2392,7 +2485,7 @@ export async function handleUserMessage(
|
|
|
2392
2485
|
// scratch-dir path. buildGenesisSystemBlock folds in seed.projectContext for
|
|
2393
2486
|
// this case so the model stays anchored to what is really on disk.
|
|
2394
2487
|
const inGenesisCreative = !!genesisSeed && genesisSeed.creative === true;
|
|
2395
|
-
if ((inGenesisScratch || inGenesisCreative) && genesisSeed) {
|
|
2488
|
+
if ((inGenesisScratch || inGenesisCreative || genesisSeed?.planOnly) && genesisSeed) {
|
|
2396
2489
|
if (wf.primary.provider === 'ollama' || wf.primary.provider === 'llamacpp' || wf.primary.provider === 'lmstudio' || (wf.primary.provider === 'strata' || wf.primary.provider === 'deepseek')) {
|
|
2397
2490
|
finalSystemPrompt = buildGenesisSystemBlock(genesisSeed, { base: finalSystemPrompt });
|
|
2398
2491
|
} else {
|
|
@@ -2457,6 +2550,8 @@ export async function handleUserMessage(
|
|
|
2457
2550
|
try {
|
|
2458
2551
|
turnClusterMcpConfigPath = await mcpConfigWriter.writeFor(cwd, workflowId, {
|
|
2459
2552
|
planToolsCwd: cwd,
|
|
2553
|
+
handoffHistoryToken: !wf.primary.tools || wf.primary.tools.includes('handoff_history')
|
|
2554
|
+
? await mintHandoffHistoryCapability(workflowId) : undefined,
|
|
2460
2555
|
clusterId: turnClusterId,
|
|
2461
2556
|
taskBoardAttached: turnClusterTaskBoardAttached,
|
|
2462
2557
|
accessMode: clusterAccessMode,
|
|
@@ -2485,8 +2580,8 @@ export async function handleUserMessage(
|
|
|
2485
2580
|
// the operator's tree. The operator-turn loop in turnEngine.handleUserMessage
|
|
2486
2581
|
// is the only dispatch path that runs an operator-driven, file-mutating
|
|
2487
2582
|
// turn, so the checkpoint belongs at this call site. The ref suffix uses
|
|
2488
|
-
// the workflow's current event seq (the turn it guards)
|
|
2489
|
-
//
|
|
2583
|
+
// the workflow's current event seq (the turn it guards), carried as
|
|
2584
|
+
// `checkpointSeq`; the checkpoint_created event gets its own next seq.
|
|
2490
2585
|
// Upload-time image downscaling runs in the background; a send right
|
|
2491
2586
|
// after a paste can beat it. Wait (bounded) here so the sync providers
|
|
2492
2587
|
// (Claude CLI / Native, Codex exec) read the model copy too — they call
|
|
@@ -2501,12 +2596,18 @@ export async function handleUserMessage(
|
|
|
2501
2596
|
continue;
|
|
2502
2597
|
}
|
|
2503
2598
|
|
|
2599
|
+
let checkpointSkipNoticeSent = false;
|
|
2600
|
+
const onCheckpointSkipped = (content: string) => {
|
|
2601
|
+
if (checkpointSkipNoticeSent || workflows.get(workflowId) !== wf) return;
|
|
2602
|
+
checkpointSkipNoticeSent = true;
|
|
2603
|
+
broadcastWorkflow(workflowId, { type: 'system_notice', workflowId, content });
|
|
2604
|
+
};
|
|
2504
2605
|
let checkpoint: Awaited<ReturnType<typeof createCheckpoint>> = null;
|
|
2505
2606
|
let checkpointGuardSeq: number | undefined;
|
|
2506
2607
|
if (!(firstIteration && primitive === 'plan-review') && shouldCaptureTurn({ chatMode, planMode: armPlanMode, isolated: isolatedMember, provider: wf.primary.provider, tools: wf.primary.tools })) {
|
|
2507
2608
|
checkpointGuardSeq = currentWorkflowSeq(cwd, workflowId);
|
|
2508
2609
|
activeTurnObservation = observeCheckoutWriters(workflowWritePaths(wf), wf.manager);
|
|
2509
|
-
checkpoint = await timelyCheckpoint((deps.captureCheckpoint ?? createCheckpoint)({ cwd, workflowId, seq: checkpointGuardSeq }));
|
|
2610
|
+
checkpoint = await timelyCheckpoint((deps.captureCheckpoint ?? createCheckpoint)({ cwd, workflowId, seq: checkpointGuardSeq, onSkipped: onCheckpointSkipped }));
|
|
2510
2611
|
if (!checkpoint || !ownsBusy(wf, busyToken)) {
|
|
2511
2612
|
activeTurnObservation.stop(); activeTurnObservation = undefined;
|
|
2512
2613
|
checkpoint = null;
|
|
@@ -2522,24 +2623,34 @@ export async function handleUserMessage(
|
|
|
2522
2623
|
}
|
|
2523
2624
|
if (checkpoint && checkpointGuardSeq !== undefined) {
|
|
2524
2625
|
broadcastWorkflow(workflowId, {
|
|
2525
|
-
type: 'checkpoint_created', workflowId,
|
|
2626
|
+
type: 'checkpoint_created', workflowId, checkpointSeq: checkpointGuardSeq,
|
|
2526
2627
|
ref: checkpoint.ref, label: checkpoint.label, ts: checkpoint.ts, fileCount: checkpoint.fileCount,
|
|
2527
2628
|
...(checkpoint.skippedLargeFiles ? { skippedLargeFiles: checkpoint.skippedLargeFiles } : {}),
|
|
2629
|
+
...(checkpoint.limitation ? { limitation: checkpoint.limitation } : {}),
|
|
2528
2630
|
});
|
|
2529
2631
|
}
|
|
2530
2632
|
|
|
2531
2633
|
const policyTurnProvider = wf.primary.provider;
|
|
2532
2634
|
const ollamaExecutionId = trackOllama ? randomUUID() : undefined;
|
|
2533
2635
|
const executionInputSeqs = [...activeOllamaInputSeqs];
|
|
2636
|
+
const executionInputClientIds = [...activeInputClientIds];
|
|
2637
|
+
let dispatchedWorkerId: string | undefined;
|
|
2638
|
+
const dispatchCurrent = () => workflows.get(workflowId) === wf && ownsBusy(wf, busyToken) && (dispatchedWorkerId === undefined || primaryTurn.workerId === dispatchedWorkerId);
|
|
2534
2639
|
const turn = runPrimaryTurn(
|
|
2535
2640
|
{
|
|
2536
2641
|
workflowId,
|
|
2537
2642
|
cwd,
|
|
2538
2643
|
manager: wf.manager,
|
|
2539
|
-
broadcast: (msg) =>
|
|
2644
|
+
broadcast: (msg) => {
|
|
2645
|
+
// A Task child's final status still belongs to the card after STOP.
|
|
2646
|
+
if (!dispatchCurrent() && !deliverAfterTurnRevoked(msg)) return;
|
|
2647
|
+
const delivery = msg.type === 'primary_turn_started' && executionInputClientIds.length
|
|
2648
|
+
? { ...msg, inputClientMessageIds: executionInputClientIds } : msg;
|
|
2649
|
+
send(ws, ollamaExecutionId ? stampOllamaExecution(delivery, ollamaExecutionId, executionInputSeqs) : delivery);
|
|
2650
|
+
},
|
|
2540
2651
|
bgTracker: chatMode ? undefined : wf.bgTracker,
|
|
2541
|
-
notePotentialDevServerStart: chatMode ? undefined : (cmd, toolUseId) => deps.previewAutoDetect.notePotentialDevServerStart(workflowId, cmd, toolUseId),
|
|
2542
|
-
noteAgentText: chatMode ? undefined : (text) => deps.previewAutoDetect.noteAgentText(workflowId, text),
|
|
2652
|
+
notePotentialDevServerStart: chatMode ? undefined : (cmd, toolUseId) => { if (dispatchCurrent()) deps.previewAutoDetect.notePotentialDevServerStart(workflowId, cmd, toolUseId); },
|
|
2653
|
+
noteAgentText: chatMode ? undefined : (text) => { if (dispatchCurrent()) deps.previewAutoDetect.noteAgentText(workflowId, text); },
|
|
2543
2654
|
},
|
|
2544
2655
|
{
|
|
2545
2656
|
primary: wf.primary,
|
|
@@ -2554,11 +2665,16 @@ export async function handleUserMessage(
|
|
|
2554
2665
|
chatWebAccess: firstIteration && primitive === 'plan-review' ? false : chatWeb,
|
|
2555
2666
|
voiceOperator: chatMode && wf.config.voiceOperator === true,
|
|
2556
2667
|
incognito,
|
|
2557
|
-
drainSteer: () =>
|
|
2558
|
-
|
|
2668
|
+
drainSteer: () => {
|
|
2669
|
+
if (!dispatchCurrent()) return [];
|
|
2670
|
+
return drainSteerForWorker(workflowId, ws, policyTurnProvider);
|
|
2671
|
+
},
|
|
2672
|
+
requeueSteer: (items, bucket) => {
|
|
2673
|
+
if (workflows.get(workflowId) === wf && (busyRevocations.get(wf) ?? 0) === interruptEpoch) requeueSteerForWorker(workflowId, ws, items, bucket);
|
|
2674
|
+
},
|
|
2559
2675
|
onSteerDelivered: (items) => {
|
|
2560
2676
|
const clientMessageIds = items.flatMap((item) => item.clientMessageId ? [item.clientMessageId] : []);
|
|
2561
|
-
if (clientMessageIds.length)
|
|
2677
|
+
if (clientMessageIds.length && policyTurnProvider === 'codex') broadcastWorkflow(workflowId, { type: 'turn_messages_delivered', workflowId, clientMessageIds, ...(items[0]?.deliveryId ? { deliveryId: items[0].deliveryId } : {}) });
|
|
2562
2678
|
},
|
|
2563
2679
|
codexTransport,
|
|
2564
2680
|
codexContextPolicy: wf.config.codexContextPolicy,
|
|
@@ -2567,8 +2683,10 @@ export async function handleUserMessage(
|
|
|
2567
2683
|
claudeTransport,
|
|
2568
2684
|
ultracode,
|
|
2569
2685
|
claudeNativeCompact,
|
|
2686
|
+
claudeNativeTaskDisabled: wf.config.claudeNativeTaskDisabled,
|
|
2687
|
+
...(claudeNativeInTurnCompactPercent !== undefined && !(firstIteration && primitive === 'plan-review') ? { claudeNativeInTurnCompactPercent } : {}),
|
|
2570
2688
|
claudeNativeForceInterleavedThinkingBeta,
|
|
2571
|
-
claudeNativeThinkingDisplay,
|
|
2689
|
+
claudeNativeThinkingDisplay, nativeSubagents,
|
|
2572
2690
|
claudeNativePlanModeArmed: armPlanMode,
|
|
2573
2691
|
turnNotice: turnNoticeParts.length > 0 ? turnNoticeParts.join('\n\n') : undefined,
|
|
2574
2692
|
efficiencyToolFilter,
|
|
@@ -2605,12 +2723,16 @@ export async function handleUserMessage(
|
|
|
2605
2723
|
mcpDisallowedTools: turnMcpDisallowedTools,
|
|
2606
2724
|
ollamaParams,
|
|
2607
2725
|
ollamaReplay,
|
|
2726
|
+
priorFiles,
|
|
2727
|
+
fileContextCwd: retainLocalFiles ? cwd : undefined,
|
|
2728
|
+
fileContextInputIds: retainLocalFiles ? [...activeInputClientIds] : undefined,
|
|
2608
2729
|
// Per-tab Claude Native web budget (Anthropic server-tool max_uses).
|
|
2609
2730
|
// Native-only; the worker falls back to the server default when unset.
|
|
2610
2731
|
webSearchMaxUses: wf.config.webSearchMaxUses,
|
|
2611
2732
|
},
|
|
2612
2733
|
);
|
|
2613
2734
|
|
|
2735
|
+
dispatchedWorkerId = turn.workerId;
|
|
2614
2736
|
activeTurnObservation?.setPrimaryWorker(turn.workerId);
|
|
2615
2737
|
primaryTurn.workerId = turn.workerId;
|
|
2616
2738
|
|
|
@@ -2632,10 +2754,10 @@ export async function handleUserMessage(
|
|
|
2632
2754
|
|
|
2633
2755
|
// Codex emits thread_id at init. Capture on first fire, persist to meta.
|
|
2634
2756
|
turn.onSessionDiscovered((sid) => {
|
|
2635
|
-
if (incognito) return;
|
|
2757
|
+
if (incognito || !dispatchCurrent() || wf.primary.provider !== policyTurnProvider) return;
|
|
2636
2758
|
if (!wf.primarySessionId) wf.primarySessionId = sid;
|
|
2637
2759
|
|
|
2638
|
-
reconcileLatestCliSession(cwd, workflowId,
|
|
2760
|
+
reconcileLatestCliSession(cwd, workflowId, policyTurnProvider, sid, providerAccount?.profile.id).catch((err) => {
|
|
2639
2761
|
console.error(`[arco] [${workflowId.slice(0, 8)}] meta reconcile (${wf.primary.provider}) failed:`, err);
|
|
2640
2762
|
});
|
|
2641
2763
|
});
|
|
@@ -2681,7 +2803,7 @@ export async function handleUserMessage(
|
|
|
2681
2803
|
// otherwise a queued follow-up could alter the tree before the range ends.
|
|
2682
2804
|
const endSeq = currentWorkflowSeq(cwd, workflowId);
|
|
2683
2805
|
if (endSeq > checkpointGuardSeq) {
|
|
2684
|
-
const end = await (deps.captureCheckpoint ?? createCheckpoint)({ cwd, workflowId, seq: endSeq });
|
|
2806
|
+
const end = await (deps.captureCheckpoint ?? createCheckpoint)({ cwd, workflowId, seq: endSeq, onSkipped: onCheckpointSkipped });
|
|
2685
2807
|
if (end && ownsBusy(wf, busyToken)) {
|
|
2686
2808
|
const otherWriters = activeTurnObservation.hasOverlap();
|
|
2687
2809
|
activeTurnObservation.stop(); activeTurnObservation = undefined;
|
|
@@ -2727,9 +2849,8 @@ export async function handleUserMessage(
|
|
|
2727
2849
|
...est,
|
|
2728
2850
|
claudeSessionId: sid,
|
|
2729
2851
|
});
|
|
2730
|
-
// Keep the shared
|
|
2731
|
-
//
|
|
2732
|
-
// absorbs the one-turn lag).
|
|
2852
|
+
// Keep the shared context signal fresh (fire-and-forget, so it may
|
|
2853
|
+
// settle one turn late; nothing here acts on a single reading).
|
|
2733
2854
|
wf.lastContextPercent = est.percentOfWindow;
|
|
2734
2855
|
}).catch(() => { /* best-effort */ });
|
|
2735
2856
|
} else if (wf.primary.provider === 'claude' && claudeTransport === 'native' && typeof outcome.lastPromptTokens === 'number') {
|
|
@@ -2761,8 +2882,6 @@ export async function handleUserMessage(
|
|
|
2761
2882
|
const budget = computeContextBudget(outcome.lastPromptTokens, win, reserved);
|
|
2762
2883
|
wf.lastContextBudgetPct = budget.pct;
|
|
2763
2884
|
const thresholds = {
|
|
2764
|
-
warnAt: wf.autoHandoff.warnAt,
|
|
2765
|
-
autoAt: wf.autoHandoff.autoAt,
|
|
2766
2885
|
...(typeof wf.autoFold?.foldAt === 'number' ? { foldAt: wf.autoFold.foldAt } : {}),
|
|
2767
2886
|
};
|
|
2768
2887
|
broadcastTransient(workflowId, {
|
|
@@ -2895,40 +3014,43 @@ export async function handleUserMessage(
|
|
|
2895
3014
|
|
|
2896
3015
|
if (preserveQueue) return;
|
|
2897
3016
|
|
|
2898
|
-
//
|
|
2899
|
-
await
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
3017
|
+
// afterTurn.ts — the post-settle steps in their fixed order.
|
|
3018
|
+
await runAfterTurn({
|
|
3019
|
+
// Computer rotates only after the complete tool/queue turn has settled.
|
|
3020
|
+
computer: async () => {
|
|
3021
|
+
await maybeFreshComputerContext(workflowId, !lastTurnErrored);
|
|
3022
|
+
await announceComputerSettled(workflowId);
|
|
3023
|
+
},
|
|
3024
|
+
// Phase 2 calibration: per-session ratio/overhead from ground-truth /context output.
|
|
3025
|
+
calibrate: () => maybeCalibrate(workflowId, wf, cwd),
|
|
3026
|
+
// A due auto-handoff (N compactions this conversation) runs first and
|
|
3027
|
+
// replaces any fold or compaction of this boundary; otherwise the cheap
|
|
3028
|
+
// deterministic Fold, then the auto-compaction policy.
|
|
3029
|
+
context: async () => {
|
|
3030
|
+
const clusterIdForPolicy = clusterStore.getClusterIdForWorkflow(workflowId);
|
|
3031
|
+
const explicitPolicy = resolveProviderAutoCompaction(wf.config.autoCompaction, clusterIdForPolicy ? clusterStore.getAutoCompaction(clusterIdForPolicy) : undefined, wf.primary.provider, claudeTransport, wf.config.claudeNativeCompact === true, cascade?.ollama?.compaction?.enabled !== undefined || cascade?.ollama?.compaction?.threshold !== undefined);
|
|
3032
|
+
if (explicitPolicy) {
|
|
3033
|
+
const action = await runExplicitContextActions(workflowId, wf, cwd, explicitPolicy, policyReading, busyToken, ws, session);
|
|
3034
|
+
if (action === 'stale') return 'stop';
|
|
3035
|
+
if (action === 'compact-attempted') { await drainQueueIfIdle(workflowId); return 'stop'; }
|
|
3036
|
+
} else {
|
|
3037
|
+
// Work without an explicit policy: a due auto-handoff first, else
|
|
3038
|
+
// the cheap fold. Provider-owned compaction remains with the provider.
|
|
3039
|
+
if (!(await maybeAutoHandoff(workflowId, wf, cwd))) await maybeAutoFold(workflowId, wf, cwd);
|
|
3040
|
+
}
|
|
3041
|
+
return 'continue';
|
|
3042
|
+
},
|
|
3043
|
+
// Messages typed while auto-fold / auto-handoff held the tab are still
|
|
3044
|
+
// queued; that turn runs its own post-settle chain (goal run included).
|
|
3045
|
+
drainQueue: () => drainQueueIfIdle(workflowId),
|
|
3046
|
+
// docs/GOTCHAS.md - north-star auto-continue, last on purpose: fold,
|
|
3047
|
+
// handoff and compaction all reshape the context this tick would run against.
|
|
3048
|
+
goalRun: () => maybeGoalRun(workflowId, wf, ws, session, lastTurnErrored),
|
|
3049
|
+
});
|
|
3050
|
+
} finally {
|
|
3051
|
+
const remaining = (incomingMessages.get(wf) ?? 1) - 1;
|
|
3052
|
+
if (remaining) incomingMessages.set(wf, remaining); else incomingMessages.delete(wf);
|
|
2921
3053
|
}
|
|
2922
|
-
|
|
2923
|
-
// Messages typed while auto-fold / auto-handoff held the tab are still
|
|
2924
|
-
// queued. Flush them first; that turn runs its own post-settle chain (goal
|
|
2925
|
-
// run included), so this settle is done.
|
|
2926
|
-
if (await drainQueueIfIdle(workflowId)) return;
|
|
2927
|
-
|
|
2928
|
-
// docs/GOTCHAS.md - north-star auto-continue. Last of the post-settle armed
|
|
2929
|
-
// actions on purpose: fold / handoff / compaction all reshape the context
|
|
2930
|
-
// this tick would run against, so they get to act first.
|
|
2931
|
-
await maybeGoalRun(workflowId, wf, ws, session, lastTurnErrored);
|
|
2932
3054
|
}
|
|
2933
3055
|
|
|
2934
3056
|
// docs/GOTCHAS.md - one tick of an armed goal run. Every branch either
|