arco-workbench 0.1.5 → 0.1.6
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 +9 -0
- package/README.md +11 -4
- package/client/dist/assets/{PhosphorBackdrop-D6cbmLNY.js → PhosphorBackdrop-BR-TgB5x.js} +1 -1
- package/client/dist/assets/{ThemedBackgroundShaderImpl-2dyerOi4.js → ThemedBackgroundShaderImpl-DgcFj6JN.js} +1 -1
- package/client/dist/assets/{XtermView-AIwo7O3D.js → XtermView-CflVBQgC.js} +1 -1
- package/client/dist/assets/{galleryEditor-DXAuxS8D.js → galleryEditor-BB-emfmi.js} +1 -1
- package/client/dist/assets/{index-8j6p-pmQ.js → index-B_EqHDz3.js} +242 -240
- package/client/dist/index.html +1 -1
- package/client/src/alerts/desktopAlerts.ts +13 -0
- package/client/src/components/ClusterRightPanel/AutoPickupControl.tsx +28 -5
- package/client/src/components/ClusterRightPanel/MemberRow.tsx +1 -1
- package/client/src/components/ClusterTaskBoardTab.tsx +54 -3
- package/client/src/components/ContextMeter.tsx +7 -0
- package/client/src/components/Home/HomeView.tsx +1 -1
- package/client/src/components/NeedsYouBadge.tsx +31 -16
- package/client/src/components/OperatorQuestionNotice.tsx +10 -1
- package/client/src/components/ProvidersPopover.tsx +23 -12
- package/client/src/components/TabBar.tsx +11 -8
- package/client/src/components/TabStatusChip.tsx +8 -7
- package/client/src/components/clusterNeedsYou.ts +27 -8
- package/client/src/help/content/cluster.tsx +34 -22
- package/client/src/help/content/composer.tsx +8 -1
- package/client/src/help/content/header.tsx +22 -13
- package/client/src/help/content/misc.tsx +8 -0
- package/client/src/help/content/tabbar.tsx +2 -1
- package/client/src/help/manualSections/clusters.tsx +61 -18
- package/client/src/help/manualSections/gettingStarted.tsx +10 -0
- package/client/src/help/manualSections/maintenance.tsx +38 -8
- package/client/src/help/manualSections/providers.tsx +10 -3
- package/client/src/help/manualSections/reference.tsx +1 -1
- package/client/src/help/manualSections/workflows.tsx +13 -0
- package/client/src/help/manualSections/workspace.tsx +7 -1
- package/client/src/questions/waitingQuestion.ts +3 -2
- package/client/src/stores/appStore.ts +1 -1
- package/client/src/stores/appStore.types.ts +1 -0
- package/client/src/stores/notificationStore.ts +2 -0
- package/client/src/utils/activityPresentation.ts +1 -1
- package/client/src/utils/tabStatus.ts +8 -0
- package/client/src/voice/commands.ts +4 -3
- package/client/src/voice/executor.ts +3 -3
- package/client/src/ws/handleServerMessage.ts +22 -2
- package/client/src/ws/operatorQuestions.ts +2 -0
- package/docs/CLIENT.md +3 -3
- package/docs/FEATURES.md +1 -1
- package/docs/GETTING_STARTED.md +11 -5
- package/docs/GLOSSARY.md +6 -2
- package/docs/GOTCHAS.md +17 -5
- package/docs/OPERATIONS.md +184 -5
- package/docs/PERSISTENCE.md +4 -0
- package/docs/PRIMITIVES.md +1 -1
- package/docs/PROTOCOL.md +1 -1
- package/docs/PROTOCOL_CLUSTER.md +9 -5
- package/docs/PROVIDERS.md +10 -5
- package/docs/SETTINGS.md +4 -2
- package/docs/TASK_LEDGER.md +6 -0
- package/docs/VOICE.md +2 -0
- package/native/win32-arm64/manifest.json +1 -1
- package/node_modules/@arco/shared/dist/clusterRolePresets.d.ts +1 -1
- package/node_modules/@arco/shared/dist/clusterRolePresets.js +10 -0
- package/node_modules/@arco/shared/dist/protocol/autoPickup.js +9 -1
- package/node_modules/@arco/shared/dist/protocol/clientMessages.d.ts +2 -2
- package/node_modules/@arco/shared/dist/protocol/models.d.ts +6 -0
- package/node_modules/@arco/shared/dist/protocol/notifications.d.ts +4 -0
- package/node_modules/@arco/shared/dist/protocol/operatorQuestions.d.ts +12 -0
- package/node_modules/@arco/shared/dist/protocol/serverMessages.d.ts +9 -3
- package/node_modules/@arco/shared/dist/protocol/workflows.d.ts +1 -0
- package/node_modules/@arco/shared/package.json +1 -1
- package/package.json +2 -2
- package/scripts/packaging/arco.mjs +1 -0
- package/server/dist/attention.d.ts +1 -1
- package/server/dist/attention.js +6 -4
- package/server/dist/capabilities.d.ts +9 -8
- package/server/dist/capabilities.js +71 -102
- package/server/dist/cliUpdateDecision.d.ts +34 -0
- package/server/dist/cliUpdateDecision.js +152 -0
- package/server/dist/clusterDirector.js +1 -0
- package/server/dist/clusterPeerOps.js +2 -2
- package/server/dist/defaults/models.md +1 -1
- package/server/dist/fileAccessPolicy.js +7 -5
- package/server/dist/http/workflowDataRoutes.js +1 -1
- package/server/dist/index.js +5 -1
- package/server/dist/primitives/seedWorker.d.ts +1 -0
- package/server/dist/primitives/seedWorker.js +2 -1
- package/server/dist/providerConversation.d.ts +9 -0
- package/server/dist/providerConversation.js +80 -0
- package/server/dist/providers/claude-native/retainedContext.d.ts +4 -0
- package/server/dist/providers/claude-native/retainedContext.js +20 -0
- package/server/dist/providers/claude-native/worker.d.ts +1 -0
- package/server/dist/providers/claude-native/worker.js +34 -6
- package/server/dist/providers/codex-appserver/operatorQuestions.d.ts +5 -0
- package/server/dist/providers/codex-appserver/operatorQuestions.js +30 -0
- package/server/dist/providers/codex-appserver/worker.js +9 -4
- package/server/dist/providers/ollama.js +2 -3
- package/server/dist/server/broadcast.d.ts +1 -1
- package/server/dist/smartPickupAdapters.d.ts +1 -0
- package/server/dist/smartPickupAdapters.js +18 -5
- package/server/dist/smartPickupObserver.js +45 -8
- package/server/dist/workers/WorkerManager.d.ts +1 -0
- package/server/dist/workers/WorkerManager.js +1 -0
- package/server/dist/workers/limits.js +6 -2
- package/server/dist/workflowMeta.d.ts +11 -1
- package/server/dist/workflowMeta.js +132 -6
- package/server/dist/workflows/types.d.ts +1 -0
- package/server/dist/ws/compactHandlers.d.ts +1 -1
- package/server/dist/ws/compactHandlers.js +11 -4
- package/server/dist/ws/handoffHandlers.js +16 -6
- package/server/dist/ws/operatorQuestionHandlers.d.ts +2 -1
- package/server/dist/ws/operatorQuestionHandlers.js +9 -1
- package/server/dist/ws/turnEngine.d.ts +2 -4
- package/server/dist/ws/turnEngine.js +88 -129
- package/server/package.json +1 -1
- package/server/src/attention.ts +5 -4
- package/server/src/capabilities.ts +70 -111
- package/server/src/cliUpdateDecision.ts +159 -0
- package/server/src/clusterDirector.ts +1 -0
- package/server/src/clusterPeerOps.ts +2 -2
- package/server/src/defaults/models.md +1 -1
- package/server/src/fileAccessPolicy.ts +7 -5
- package/server/src/http/workflowDataRoutes.ts +1 -1
- package/server/src/index.ts +5 -1
- package/server/src/primitives/seedWorker.ts +3 -1
- package/server/src/providerConversation.ts +71 -0
- package/server/src/providers/claude-native/retainedContext.ts +22 -0
- package/server/src/providers/claude-native/worker.ts +33 -5
- package/server/src/providers/codex-appserver/operatorQuestions.ts +24 -0
- package/server/src/providers/codex-appserver/worker.ts +8 -4
- package/server/src/providers/ollama.ts +2 -3
- package/server/src/smartPickupAdapters.ts +19 -5
- package/server/src/smartPickupObserver.ts +31 -6
- package/server/src/workers/WorkerManager.ts +2 -0
- package/server/src/workers/limits.ts +7 -2
- package/server/src/workflowMeta.ts +139 -5
- package/server/src/workflows/types.ts +1 -0
- package/server/src/ws/compactHandlers.ts +9 -3
- package/server/src/ws/handoffHandlers.ts +13 -6
- package/server/src/ws/operatorQuestionHandlers.ts +10 -2
- package/server/src/ws/turnEngine.ts +80 -135
- package/shared/dist/clusterRolePresets.d.ts +1 -1
- package/shared/dist/clusterRolePresets.js +10 -0
- package/shared/dist/protocol/autoPickup.js +9 -1
- package/shared/dist/protocol/clientMessages.d.ts +2 -2
- package/shared/dist/protocol/models.d.ts +6 -0
- package/shared/dist/protocol/notifications.d.ts +4 -0
- package/shared/dist/protocol/operatorQuestions.d.ts +12 -0
- package/shared/dist/protocol/serverMessages.d.ts +9 -3
- package/shared/dist/protocol/workflows.d.ts +1 -0
- package/shared/src/clusterRolePresets.ts +11 -1
- package/shared/src/protocol/autoPickup.ts +9 -1
- package/shared/src/protocol/clientMessages.ts +2 -1
- package/shared/src/protocol/models.ts +5 -2
- package/shared/src/protocol/notifications.ts +5 -0
- package/shared/src/protocol/operatorQuestions.ts +13 -0
- package/shared/src/protocol/serverMessages.ts +12 -2
- package/shared/src/protocol/workflows.ts +4 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { OutputSavedMessage } from '../outputs.js';
|
|
2
|
-
import type { OperatorQuestionMessage, OperatorQuestionReplyResultMessage, OperatorQuestionState } from './operatorQuestions.js';
|
|
2
|
+
import type { OperatorQuestionMessage, OperatorQuestionReplyResultMessage, OperatorQuestionDismissResultMessage, OperatorQuestionState } from './operatorQuestions.js';
|
|
3
3
|
import type { VoiceToolCallMessage, ComputerContextUpdatedMessage, ComputerActivityChangedMessage } from './voiceOperator.js';
|
|
4
4
|
import type { HubLinkStatusMessage } from './remoteManagement.js';
|
|
5
5
|
import type { BakeoffAttemptsRemovedMessage, BakeoffErrorMessage, BakeoffListResultMessage, BakeoffStateMessage } from './bakeoffs.js';
|
|
@@ -18,7 +18,7 @@ import type { DocEditStartedMessage, DocEditProposedMessage } from './docEdit.js
|
|
|
18
18
|
import type { MdTuneupStartedMessage, MdTuneupProposedMessage, MdTuneupAppliedMessage, MdTuneupCandidatesMessage, MdTuneupUndoneMessage } from './mdTuneup.js';
|
|
19
19
|
import type { KnowledgeDistillStartedMessage, KnowledgeDistillProposedMessage } from './knowledge.js';
|
|
20
20
|
import type { RecallSummaryReadyMessage } from './recall.js';
|
|
21
|
-
import type { WorkbenchNoticeMessage, NotificationMutesMessage, AttentionEventMessage } from './notifications.js';
|
|
21
|
+
import type { WorkbenchNoticeMessage, NotificationMutesMessage, AttentionEventMessage, AttentionQuestionClosedMessage } from './notifications.js';
|
|
22
22
|
import type { HandoffStartedMessage, HandoffArtifactReadyMessage, HandoffCompleteMessage, HandoffLockSnapshotMessage, SpawnFromHereCompleteMessage } from './handoffs.js';
|
|
23
23
|
import type { CheckpointCreatedMessage, CheckpointRevertedMessage, TurnChangesMessage } from './checkpoints.js';
|
|
24
24
|
import type { LiveChangesSnapshotMessage } from './liveChanges.js';
|
|
@@ -507,8 +507,14 @@ export interface ConversationChangedMessage {
|
|
|
507
507
|
newSessionId: string;
|
|
508
508
|
note: string;
|
|
509
509
|
}
|
|
510
|
+
export interface ProviderConversationStateMessage {
|
|
511
|
+
type: 'provider_conversation_state';
|
|
512
|
+
workflowId: string;
|
|
513
|
+
state: 'unavailable' | 'awaiting-reading' | 'ready';
|
|
514
|
+
}
|
|
510
515
|
export interface WorkflowStateSnapshotMessage {
|
|
511
516
|
type: 'workflow_state_snapshot';
|
|
517
|
+
providerConversation?: 'unavailable' | 'awaiting-reading';
|
|
512
518
|
workflowId: string;
|
|
513
519
|
workers: Record<string, WorkerState>;
|
|
514
520
|
busy: boolean;
|
|
@@ -818,7 +824,7 @@ export interface TurnMessagesDeliveredMessage {
|
|
|
818
824
|
workflowId: string;
|
|
819
825
|
clientMessageIds: string[];
|
|
820
826
|
}
|
|
821
|
-
export type ServerMessage = StorageWarningMessage | TurnMessagesDeliveredMessage | AppUpdateAvailableMessage | ComputerActivityChangedMessage | ComputerContextUpdatedMessage | ConnectedMessage | WorkflowCreatedMessage | WorkspaceSnapshotMessage | WorkflowConfigSyncedMessage | PrimaryTextMessage | PrimaryCompleteMessage | PrimaryTurnTokenUsageMessage | HookRewroteInputMessage | ToolGateTriggeredMessage | GateRequiredMessage | GateResolvedMessage | GateStandingMessage | ToolLoopWarningMessage | WorkerStuckMessage | ToolPostureSetMessage | GoalSetMessage | GoalRunStateMessage | PinnedSkillsSetMessage | ProjectTrustPromptMessage | ProjectTrustSetMessage | FileMutationQueuedMessage | ModelResolvedMessage | PrimaryRefusalMessage | CtxActionMessage | NativeCompactingMessage | ContextFoldedMessage | NativeCompactedMessage | PrimaryToolCounterMessage | SandboxChunkAddedMessage | SandboxDbClearedMessage | ToolFilteredMessage | ToolEvictedMessage | PeerMessageSentMessage | PeerMessageReceivedMessage | PeerSendRejectedMessage | PrimaryModelMessage | PrimaryThinkingMessage | PrimaryToolUseMessage | PrimaryTurnStartedMessage | PrimaryTurnEndedMessage | WorkerSpawnedMessage | WorkerTextMessage | WorkerThinkingMessage | WorkerToolUseMessage | WorkerFileContextMessage | FileContextMessage | WorkerCompleteMessage | WorkerActivityMessage | WorkerModelMessage | WorkerErrorMessage | FileUploadedMessage | CapabilitiesUpdatedMessage | CapabilitiesChangedMessage | SettingsUpdatedMessage | ConversationChangedMessage | PrimaryArtifactMessage | QuotaStatusMessage | TurnCancelledMessage | WorkflowStateSnapshotMessage | WorkflowSessionMetadataMessage | ReplayBatchMessage | ShutdownMessage | SystemErrorMessage | UserMessageEchoMessage | ReviewStartedMessage | ReviewArtifactReadyMessage | ResearchStartedMessage | ResearchProgressMessage | ResearchCompleteMessage | CompareStartedMessage | CompareLegDeltaMessage | CompareLegCompleteMessage | CompareCompleteMessage | CompareVoteRecordedMessage | ProviderFellBackMessage | DiagnosticsMessage | DocEditStartedMessage | DocEditProposedMessage | MdTuneupStartedMessage | MdTuneupProposedMessage | MdTuneupAppliedMessage | MdTuneupCandidatesMessage | MdTuneupUndoneMessage | KnowledgeDistillStartedMessage | KnowledgeDistillProposedMessage | RecallSummaryReadyMessage | HandoffStartedMessage | HandoffArtifactReadyMessage | HandoffCompleteMessage | HandoffLockSnapshotMessage | SpawnFromHereCompleteMessage | CheckpointCreatedMessage | TurnChangesMessage | CheckpointRevertedMessage | LiveChangesSnapshotMessage | GitOpResultMessage | BakeoffListResultMessage | BakeoffStateMessage | BakeoffErrorMessage | BakeoffAttemptsRemovedMessage | OutputSavedMessage | MediaOpResultMessage | MediaStemsResultMessage | SessionEntryMessage | ContextUsageMessage | UltracodeFleetProgressMessage | ContextBudgetMessage | OperatorQuestionMessage | OperatorQuestionReplyResultMessage | VoiceToolCallMessage | SystemNoticeMessage | ClaudeNativeQuestionSettledMessage | QueuedMessageCancelledMessage | QueuedMessageEditResultMessage | QueuedMessagesDrainedMessage | PrimaryActivityMessage | SessionHistoryStatusMessage | PlanAttachedMessage | PlanDetachedMessage | CodexTokenSnapshotMessage | PreviewSetMessage | PreviewClearedMessage | PreviewHistoryMessage | OperatorLabelMessage | LeafMoveMessage | QueueUpdateMessage | TodosUpdatedMessage | PlanSetMessage | PlanExitedMessage | PlanCandidateReadyMessage | TaskStartedMessage | TaskStatusMessage | BranchSummaryMessage | ClusterStateMessage | ClusterNotFoundMessage | ClusterCreatedMessage | ClusterCreationFinishedMessage | ClusterDeletedMessage | ClusterMemberAddedMessage | ClusterMemberRemovedMessage | ClusterMemberReplacedMessage | ClusterBroadcastDispatchedMessage | ClusterDispatchResultMessage | ClusterSwarmCreatedMessage | ClusterOrchestrationAssistStartedMessage | ClusterOrchestrationProposalStartedMessage | ClusterOrchestrationProposalSnapshotMessage | ClusterOrchestrationProposalProposedMessage | ClusterOrchestrationProposalRejectedMessage | ClusterOrchestrationProposalAppliedMessage | ClusterPlanChangedMessage | ClusterMemberNudgedMessage | WorkflowRenamedMessage | WorkflowRenameResultMessage | CodebaseMemoryStateMessage | ClusterAutoTurnFiredMessage | ClusterSnapshotListResultMessage | ClusterSnapshotSavedMessage | ClusterSnapshotConflictMessage | ClusterSnapshotErrorMessage | TerminalOpenedMessage | TerminalKilledMessage | TerminalCommandLoggedMessage | TerminalSessionsMessage | TaskLedgerSnapshotMessage | TaskLedgerEventMessage | McpRegistrySnapshotMessage | McpProbeResultMessage | McpAllowSnapshotMessage | McpMalwareWarningMessage | GenesisSeedUpdatedMessage | WorkflowCwdBoundMessage | GenesisScaffoldedMessage | GenesisPlanSavedMessage | GenesisCreativeArmedMessage | GenesisAssistStartedMessage | GenesisAssistProposedMessage | PreviewCaptureStartedMessage | PreviewCaptureReadyMessage | WorkbenchNoticeMessage | NotificationMutesMessage | AttentionEventMessage | HubLinkStatusMessage;
|
|
827
|
+
export type ServerMessage = StorageWarningMessage | TurnMessagesDeliveredMessage | AppUpdateAvailableMessage | ComputerActivityChangedMessage | ComputerContextUpdatedMessage | ConnectedMessage | WorkflowCreatedMessage | WorkspaceSnapshotMessage | WorkflowConfigSyncedMessage | PrimaryTextMessage | PrimaryCompleteMessage | PrimaryTurnTokenUsageMessage | HookRewroteInputMessage | ToolGateTriggeredMessage | GateRequiredMessage | GateResolvedMessage | GateStandingMessage | ToolLoopWarningMessage | WorkerStuckMessage | ToolPostureSetMessage | GoalSetMessage | GoalRunStateMessage | PinnedSkillsSetMessage | ProjectTrustPromptMessage | ProjectTrustSetMessage | FileMutationQueuedMessage | ModelResolvedMessage | PrimaryRefusalMessage | CtxActionMessage | NativeCompactingMessage | ContextFoldedMessage | NativeCompactedMessage | PrimaryToolCounterMessage | SandboxChunkAddedMessage | SandboxDbClearedMessage | ToolFilteredMessage | ToolEvictedMessage | PeerMessageSentMessage | PeerMessageReceivedMessage | PeerSendRejectedMessage | PrimaryModelMessage | PrimaryThinkingMessage | PrimaryToolUseMessage | PrimaryTurnStartedMessage | PrimaryTurnEndedMessage | WorkerSpawnedMessage | WorkerTextMessage | WorkerThinkingMessage | WorkerToolUseMessage | WorkerFileContextMessage | FileContextMessage | WorkerCompleteMessage | WorkerActivityMessage | WorkerModelMessage | WorkerErrorMessage | FileUploadedMessage | CapabilitiesUpdatedMessage | CapabilitiesChangedMessage | SettingsUpdatedMessage | ConversationChangedMessage | PrimaryArtifactMessage | QuotaStatusMessage | TurnCancelledMessage | WorkflowStateSnapshotMessage | ProviderConversationStateMessage | WorkflowSessionMetadataMessage | ReplayBatchMessage | ShutdownMessage | SystemErrorMessage | UserMessageEchoMessage | ReviewStartedMessage | ReviewArtifactReadyMessage | ResearchStartedMessage | ResearchProgressMessage | ResearchCompleteMessage | CompareStartedMessage | CompareLegDeltaMessage | CompareLegCompleteMessage | CompareCompleteMessage | CompareVoteRecordedMessage | ProviderFellBackMessage | DiagnosticsMessage | DocEditStartedMessage | DocEditProposedMessage | MdTuneupStartedMessage | MdTuneupProposedMessage | MdTuneupAppliedMessage | MdTuneupCandidatesMessage | MdTuneupUndoneMessage | KnowledgeDistillStartedMessage | KnowledgeDistillProposedMessage | RecallSummaryReadyMessage | HandoffStartedMessage | HandoffArtifactReadyMessage | HandoffCompleteMessage | HandoffLockSnapshotMessage | SpawnFromHereCompleteMessage | CheckpointCreatedMessage | TurnChangesMessage | CheckpointRevertedMessage | LiveChangesSnapshotMessage | GitOpResultMessage | BakeoffListResultMessage | BakeoffStateMessage | BakeoffErrorMessage | BakeoffAttemptsRemovedMessage | OutputSavedMessage | MediaOpResultMessage | MediaStemsResultMessage | SessionEntryMessage | ContextUsageMessage | UltracodeFleetProgressMessage | ContextBudgetMessage | OperatorQuestionMessage | OperatorQuestionDismissResultMessage | OperatorQuestionReplyResultMessage | VoiceToolCallMessage | SystemNoticeMessage | ClaudeNativeQuestionSettledMessage | QueuedMessageCancelledMessage | QueuedMessageEditResultMessage | QueuedMessagesDrainedMessage | PrimaryActivityMessage | SessionHistoryStatusMessage | PlanAttachedMessage | PlanDetachedMessage | CodexTokenSnapshotMessage | PreviewSetMessage | PreviewClearedMessage | PreviewHistoryMessage | OperatorLabelMessage | LeafMoveMessage | QueueUpdateMessage | TodosUpdatedMessage | PlanSetMessage | PlanExitedMessage | PlanCandidateReadyMessage | TaskStartedMessage | TaskStatusMessage | BranchSummaryMessage | ClusterStateMessage | ClusterNotFoundMessage | ClusterCreatedMessage | ClusterCreationFinishedMessage | ClusterDeletedMessage | ClusterMemberAddedMessage | ClusterMemberRemovedMessage | ClusterMemberReplacedMessage | ClusterBroadcastDispatchedMessage | ClusterDispatchResultMessage | ClusterSwarmCreatedMessage | ClusterOrchestrationAssistStartedMessage | ClusterOrchestrationProposalStartedMessage | ClusterOrchestrationProposalSnapshotMessage | ClusterOrchestrationProposalProposedMessage | ClusterOrchestrationProposalRejectedMessage | ClusterOrchestrationProposalAppliedMessage | ClusterPlanChangedMessage | ClusterMemberNudgedMessage | WorkflowRenamedMessage | WorkflowRenameResultMessage | CodebaseMemoryStateMessage | ClusterAutoTurnFiredMessage | ClusterSnapshotListResultMessage | ClusterSnapshotSavedMessage | ClusterSnapshotConflictMessage | ClusterSnapshotErrorMessage | TerminalOpenedMessage | TerminalKilledMessage | TerminalCommandLoggedMessage | TerminalSessionsMessage | TaskLedgerSnapshotMessage | TaskLedgerEventMessage | McpRegistrySnapshotMessage | McpProbeResultMessage | McpAllowSnapshotMessage | McpMalwareWarningMessage | GenesisSeedUpdatedMessage | WorkflowCwdBoundMessage | GenesisScaffoldedMessage | GenesisPlanSavedMessage | GenesisCreativeArmedMessage | GenesisAssistStartedMessage | GenesisAssistProposedMessage | PreviewCaptureStartedMessage | PreviewCaptureReadyMessage | WorkbenchNoticeMessage | NotificationMutesMessage | AttentionEventMessage | AttentionQuestionClosedMessage | HubLinkStatusMessage;
|
|
822
828
|
export type WorkflowEvent<M extends ServerMessage = ServerMessage> = M & {
|
|
823
829
|
seq: number;
|
|
824
830
|
parentEventSeq?: number;
|
|
@@ -223,6 +223,7 @@ export interface WorkerConfig {
|
|
|
223
223
|
attachments?: string[];
|
|
224
224
|
sandbox?: 'read-only' | 'workspace-write' | 'danger-full-access';
|
|
225
225
|
drainSteer?: () => SteerItem[];
|
|
226
|
+
peekSteer?: () => readonly SteerItem[];
|
|
226
227
|
requeueSteer?: (items: SteerItem[], bucket: 'steer' | 'follow-up') => void;
|
|
227
228
|
onSteerDelivered?: (items: SteerItem[]) => void;
|
|
228
229
|
workflowId?: string;
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"node-pty": "1.1.0"
|
|
5
5
|
},
|
|
6
6
|
"name": "arco-workbench",
|
|
7
|
-
"version": "0.1.
|
|
7
|
+
"version": "0.1.6",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "git+https://github.com/ghreprimand/arco.git"
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"word-extractor": "1.0.4",
|
|
67
67
|
"ws": "8.22.0",
|
|
68
68
|
"xlsx": "0.20.3",
|
|
69
|
-
"@arco/shared": "0.1.
|
|
69
|
+
"@arco/shared": "0.1.6"
|
|
70
70
|
},
|
|
71
71
|
"bundleDependencies": [
|
|
72
72
|
"@arco/shared",
|
|
@@ -68,6 +68,7 @@ async function main() {
|
|
|
68
68
|
await serviceAction(args[0]); if (args[0] === 'uninstall') shortcuts('remove'); return;
|
|
69
69
|
}
|
|
70
70
|
if (command === 'setup') {
|
|
71
|
+
console.log(`Arco v${manifest.version}`);
|
|
71
72
|
requireSupportedNode();
|
|
72
73
|
if (args.length && (args.length !== 1 || args[0] !== '--repair-native')) throw new Error('Unknown setup option.');
|
|
73
74
|
if (args.includes('--repair-native')) { repairNative(manifest); console.log('Native modules repaired. Restart Arco.'); return; }
|
|
@@ -32,7 +32,7 @@ interface WorkflowInfo {
|
|
|
32
32
|
name: string;
|
|
33
33
|
incognito: boolean;
|
|
34
34
|
}
|
|
35
|
-
export declare function raise(kind: AttentionKind, workflowId: string, info: WorkflowInfo, text?: string, longEnough?: boolean): void;
|
|
35
|
+
export declare function raise(kind: AttentionKind, workflowId: string, info: WorkflowInfo, text?: string, longEnough?: boolean, requestId?: string): void;
|
|
36
36
|
/** Feed every workflow-scoped server message through here. Cheap for messages it ignores. */
|
|
37
37
|
export declare function observeAttention(workflowId: string, message: ServerMessage, info: WorkflowInfo): void;
|
|
38
38
|
export {};
|
package/server/dist/attention.js
CHANGED
|
@@ -125,7 +125,7 @@ function shouldRaise(kind, workflowId) {
|
|
|
125
125
|
return true;
|
|
126
126
|
return isClusterDirector(clusterStore.getMemberRole(clusterId, workflowId));
|
|
127
127
|
}
|
|
128
|
-
export function raise(kind, workflowId, info, text, longEnough = true) {
|
|
128
|
+
export function raise(kind, workflowId, info, text, longEnough = true, requestId) {
|
|
129
129
|
if (info.incognito)
|
|
130
130
|
return;
|
|
131
131
|
const externalEligible = longEnough && shouldRaise(kind, workflowId);
|
|
@@ -134,12 +134,12 @@ export function raise(kind, workflowId, info, text, longEnough = true) {
|
|
|
134
134
|
// One alert per workflow and kind per few seconds, whatever produced it.
|
|
135
135
|
const key = `${workflowId}:${kind}`;
|
|
136
136
|
const now = Date.now();
|
|
137
|
-
if (now - (lastAlertAt.get(key) ?? 0) < 3000)
|
|
137
|
+
if (!requestId && now - (lastAlertAt.get(key) ?? 0) < 3000)
|
|
138
138
|
return;
|
|
139
139
|
lastAlertAt.set(key, now);
|
|
140
140
|
const name = noticeSourceFor(workflowId, info.name);
|
|
141
141
|
{
|
|
142
|
-
broadcastToClients({ type: 'attention_event', id: `at_${now.toString(36)}_${(idCounter++).toString(36)}`, kind, workflowId, workflowName: name, desktopEligible: wantDesktop });
|
|
142
|
+
broadcastToClients({ type: 'attention_event', id: requestId ? `question-${requestId}` : `at_${now.toString(36)}_${(idCounter++).toString(36)}`, kind, workflowId, workflowName: name, desktopEligible: wantDesktop });
|
|
143
143
|
}
|
|
144
144
|
if (target) {
|
|
145
145
|
const body = channels.phoneText && text ? ascii(text, TEXT_MAX) : `Open Arco to see it.`;
|
|
@@ -171,7 +171,9 @@ export function observeAttention(workflowId, message, info) {
|
|
|
171
171
|
}
|
|
172
172
|
case 'operator_question':
|
|
173
173
|
if (message.question.status === 'pending' && firstSighting(message.question.requestId))
|
|
174
|
-
raise('waiting', workflowId, info, message.question.questions.map((q) => q.question).join(' '));
|
|
174
|
+
raise('waiting', workflowId, info, message.question.questions.map((q) => q.question).join(' '), true, message.question.requestId);
|
|
175
|
+
else if (message.question.status !== 'pending' && !info.incognito)
|
|
176
|
+
broadcastToClients({ type: 'attention_question_closed', requestId: message.question.requestId });
|
|
175
177
|
break;
|
|
176
178
|
case 'gate_required':
|
|
177
179
|
if (firstSighting(message.gateId))
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { Capabilities } from '@arco/shared';
|
|
1
|
+
import type { Capabilities, CliUpdateOutcome } from '@arco/shared';
|
|
2
|
+
import { type CliUpdateDecision, type UpdateCommandResult } from './cliUpdateDecision.js';
|
|
2
3
|
export type CliProvider = 'claude' | 'codex';
|
|
3
4
|
export declare function probeVersion(bin: string, flags?: string[], timeoutMs?: number): Promise<string>;
|
|
4
5
|
export declare function probeCapabilities(): Promise<Capabilities>;
|
|
5
6
|
export declare function refreshRuntimeVersions(previous: Capabilities): Promise<Capabilities>;
|
|
6
|
-
export declare function probeLatestVersions(): Promise<Capabilities['latestVersions']>;
|
|
7
|
+
export declare function probeLatestVersions(codexDecision?: Promise<CliUpdateDecision>): Promise<Capabilities['latestVersions']>;
|
|
7
8
|
export interface UpdateResult {
|
|
8
9
|
provider: CliProvider;
|
|
9
10
|
updated: boolean;
|
|
@@ -11,16 +12,17 @@ export interface UpdateResult {
|
|
|
11
12
|
currentVersion: string;
|
|
12
13
|
capabilities: Capabilities;
|
|
13
14
|
output: string;
|
|
15
|
+
outcome: CliUpdateOutcome;
|
|
16
|
+
message: string;
|
|
14
17
|
error?: string;
|
|
15
18
|
notice?: string;
|
|
16
19
|
}
|
|
17
20
|
/**
|
|
18
|
-
* Run the
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
+
* Run the updater for the installation Arco actually launches. Claude uses its
|
|
22
|
+
* built-in updater; Codex shares one installation decision with its version flag.
|
|
23
|
+
* Re-probe afterwards: a successful command alone does not prove a working CLI.
|
|
21
24
|
*/
|
|
22
|
-
export declare function runCliUpdate(previous: Capabilities, provider?: CliProvider, runCommand?:
|
|
23
|
-
declare function runUpdateCommand(cmd: string, args: string[]): Promise<string>;
|
|
25
|
+
export declare function runCliUpdate(previous: Capabilities, provider?: CliProvider, runCommand?: (cmd: string, args: string[]) => Promise<UpdateCommandResult>): Promise<UpdateResult>;
|
|
24
26
|
export interface CliChange {
|
|
25
27
|
provider: CliProvider;
|
|
26
28
|
fromVersion: string;
|
|
@@ -38,4 +40,3 @@ export interface CliChange {
|
|
|
38
40
|
*/
|
|
39
41
|
export declare function detectCliChanges(caps: Capabilities): Promise<CliChange[]>;
|
|
40
42
|
export declare function cliSnapshotDir(): string;
|
|
41
|
-
export {};
|
|
@@ -8,7 +8,8 @@ import { getStrataBase } from './providers/strata.js';
|
|
|
8
8
|
import { getDeepSeekBase } from './providers/deepseek.js';
|
|
9
9
|
import { probeStrataVersion, installedXolotlRevision, strataEngineReleaseVersion } from './providers/runtimeVersions.js';
|
|
10
10
|
import { atomicWriteFile } from './atomicFile.js';
|
|
11
|
-
import {
|
|
11
|
+
import { probeCodexUpdate, describeCliUpdate } from './cliUpdateDecision.js';
|
|
12
|
+
import { compareVersions } from './updateCheck.js';
|
|
12
13
|
import { arcoHome } from './arcoHome.js';
|
|
13
14
|
import { commandArgs } from './windowsCommand.js';
|
|
14
15
|
const execFileAsync = promisify(execFile);
|
|
@@ -67,21 +68,24 @@ export async function probeCapabilities() {
|
|
|
67
68
|
catch {
|
|
68
69
|
// Keep fallback
|
|
69
70
|
}
|
|
70
|
-
const
|
|
71
|
+
const codexDecision = npmLatest('@openai/codex').then(probeCodexUpdate);
|
|
72
|
+
const [cliVersion, codexVersion, cursorVersion, strataVersion, xolotlRevision, latestVersions, codexUpdate] = await Promise.all([
|
|
71
73
|
probeVersion('claude'),
|
|
72
74
|
probeVersion('codex'),
|
|
73
75
|
probeVersion('cursor-agent'),
|
|
74
76
|
probeStrataVersion(await getStrataBase()),
|
|
75
77
|
installedXolotlRevision(await getDeepSeekBase()),
|
|
76
|
-
probeLatestVersions(),
|
|
78
|
+
probeLatestVersions(codexDecision),
|
|
79
|
+
codexDecision,
|
|
77
80
|
]);
|
|
78
|
-
return { efforts, models: MODELS, cliVersion, codexVersion, cursorVersion, strataVersion, xolotlRevision, latestVersions
|
|
81
|
+
return { efforts, models: MODELS, cliVersion, codexVersion, cursorVersion, strataVersion, xolotlRevision, latestVersions,
|
|
82
|
+
codexUpdate: { kind: codexUpdate.kind, updateAvailable: !!codexUpdate.targetVersion && (compareVersions(codexVersion, codexUpdate.targetVersion) ?? 0) < 0, instruction: codexUpdate.message ?? codexUpdate.notice } };
|
|
79
83
|
}
|
|
80
84
|
// ── Upstream latest-version probes ──
|
|
81
85
|
//
|
|
82
|
-
// Source of truth for "is the operator running the latest CLI?"
|
|
83
|
-
// npm
|
|
84
|
-
// Releases since it's not npm-installed. All
|
|
86
|
+
// Source of truth for "is the operator running the latest CLI?" Claude reads
|
|
87
|
+
// npm; Codex uses its installation decision and npm publication metadata;
|
|
88
|
+
// Ollama queries GitHub Releases since it's not npm-installed. All are best-effort: any
|
|
85
89
|
// failure (offline, rate-limited, schema drift) leaves that key undefined
|
|
86
90
|
// and the UI falls back to displaying the installed version with no
|
|
87
91
|
// outdated indicator. Caller decides cadence — boot + the existing 4h
|
|
@@ -130,10 +134,10 @@ async function strataLatestRelease() {
|
|
|
130
134
|
]);
|
|
131
135
|
return strataEngineReleaseVersion(feed, release);
|
|
132
136
|
}
|
|
133
|
-
export async function probeLatestVersions() {
|
|
137
|
+
export async function probeLatestVersions(codexDecision = npmLatest('@openai/codex').then(probeCodexUpdate)) {
|
|
134
138
|
const [claude, codex, ollama, strata, xolotl] = await Promise.all([
|
|
135
139
|
npmLatest('@anthropic-ai/claude-code'),
|
|
136
|
-
|
|
140
|
+
codexDecision.then((decision) => decision.targetVersion),
|
|
137
141
|
ollamaLatestRelease(),
|
|
138
142
|
strataLatestRelease(),
|
|
139
143
|
fetchJson('https://api.github.com/repos/Indras-Mirror/Xolotl/commits/HEAD').then((data) => {
|
|
@@ -143,125 +147,90 @@ export async function probeLatestVersions() {
|
|
|
143
147
|
]);
|
|
144
148
|
return { claude, codex, ollama, strata, xolotl };
|
|
145
149
|
}
|
|
146
|
-
const UPDATE_COMMAND = {
|
|
147
|
-
claude: { cmd: 'claude', args: ['update'] },
|
|
148
|
-
codex: { cmd: 'npm', args: ['install', '-g', '@openai/codex@latest'] },
|
|
149
|
-
};
|
|
150
|
-
// npm package behind each CLI, for the pre-flight platform-build check. Claude
|
|
151
|
-
// is absent on purpose: it self-updates via `claude update`, so there is no
|
|
152
|
-
// `npm install` for us to aim at a specific version.
|
|
153
|
-
const NPM_PACKAGE = {
|
|
154
|
-
codex: '@openai/codex',
|
|
155
|
-
};
|
|
156
150
|
function versionForProvider(caps, provider) {
|
|
157
|
-
|
|
158
|
-
return caps.cliVersion;
|
|
159
|
-
return caps.codexVersion ?? 'unknown';
|
|
151
|
+
return provider === 'claude' ? caps.cliVersion : caps.codexVersion ?? 'unknown';
|
|
160
152
|
}
|
|
161
153
|
/**
|
|
162
|
-
* Run the
|
|
163
|
-
*
|
|
164
|
-
*
|
|
154
|
+
* Run the updater for the installation Arco actually launches. Claude uses its
|
|
155
|
+
* built-in updater; Codex shares one installation decision with its version flag.
|
|
156
|
+
* Re-probe afterwards: a successful command alone does not prove a working CLI.
|
|
165
157
|
*/
|
|
166
|
-
export async function runCliUpdate(previous, provider = 'claude', runCommand = runUpdateCommand) {
|
|
167
|
-
const previousVersion = versionForProvider(previous, provider);
|
|
158
|
+
export async function runCliUpdate(previous, provider = 'claude', runCommand = (cmd, args) => runUpdateCommand(cmd, args, provider)) {
|
|
159
|
+
const previousVersion = provider === 'codex' ? await probeVersion('codex') : versionForProvider(previous, provider);
|
|
168
160
|
// Pre-flight: for npm-installed CLIs, work out which version can actually run
|
|
169
161
|
// on this machine before installing anything. `@latest` is not automatically
|
|
170
162
|
// installable — a package whose binary ships as a platform-specific
|
|
171
163
|
// optionalDependency is broken-on-arrival during the window between the
|
|
172
164
|
// wrapper being tagged `latest` and that platform's tarball being published,
|
|
173
165
|
// and npm reports that as success. See npmPlatformResolve.ts.
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
...(notice ? { notice } : {}),
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
args = ['install', '-g', `${pkg}@${resolved.version}`];
|
|
196
|
-
// Already on the version we would install, and it runs — skip the install
|
|
197
|
-
// entirely so a no-op click can't churn a working CLI into a broken one.
|
|
198
|
-
if (resolved.version === previousVersion && previousVersion !== 'broken' && previousVersion !== 'unknown') {
|
|
199
|
-
return {
|
|
200
|
-
provider,
|
|
201
|
-
updated: false,
|
|
202
|
-
previousVersion,
|
|
203
|
-
currentVersion: previousVersion,
|
|
204
|
-
capabilities: previous,
|
|
205
|
-
output: `${pkg}@${previousVersion} is already installed`,
|
|
206
|
-
...(notice ? { notice } : {}),
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
}
|
|
166
|
+
const decision = provider === 'codex'
|
|
167
|
+
? await probeCodexUpdate(await npmLatest('@openai/codex'))
|
|
168
|
+
: { kind: 'unknown', command: { cmd: 'claude', args: ['update'] }, targetVersion: previous.latestVersions?.claude };
|
|
169
|
+
const notice = decision.notice;
|
|
170
|
+
const capabilities = provider === 'codex'
|
|
171
|
+
? { ...previous, codexVersion: previousVersion, latestVersions: { ...previous.latestVersions, codex: decision.targetVersion }, codexUpdate: { kind: decision.kind, updateAvailable: !!decision.targetVersion && (compareVersions(previousVersion, decision.targetVersion) ?? 0) < 0, instruction: decision.message ?? decision.notice } }
|
|
172
|
+
: previous;
|
|
173
|
+
if (!decision.command) {
|
|
174
|
+
const message = decision.message ?? 'Update deferred; the current CLI was not changed.';
|
|
175
|
+
return { provider, previousVersion, currentVersion: previousVersion, capabilities, updated: false,
|
|
176
|
+
outcome: decision.outcome ?? 'deferred', message, output: message, notice: message };
|
|
177
|
+
}
|
|
178
|
+
// Already on the version we would install, and it runs — skip the install
|
|
179
|
+
// entirely so a no-op click can't churn a working CLI into a broken one.
|
|
180
|
+
if (provider === 'codex' && decision.targetVersion && (compareVersions(previousVersion, decision.targetVersion) ?? -1) >= 0) {
|
|
181
|
+
return { provider, previousVersion, currentVersion: previousVersion, capabilities, output: '',
|
|
182
|
+
...describeCliUpdate(provider, previousVersion, previousVersion, decision.targetVersion, { exitCode: 0, output: '' }, notice),
|
|
183
|
+
...(notice ? { notice } : {}) };
|
|
210
184
|
}
|
|
211
|
-
|
|
185
|
+
const { cmd, args } = decision.command;
|
|
186
|
+
let commandResult = await runCommand(cmd, args);
|
|
212
187
|
let next = await probeCapabilities();
|
|
213
188
|
let currentVersion = versionForProvider(next, provider);
|
|
214
189
|
// Post-flight repair. The pre-flight check closes the common case, but npm can
|
|
215
190
|
// still skip an optional dep that does exist (a mid-install network failure,
|
|
216
191
|
// a poisoned cache), and that also exits 0. One retry with a clean cache is
|
|
217
|
-
// cheap next to leaving the operator's CLI dead.
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
192
|
+
// cheap next to leaving the operator's CLI dead. Only a proven npm install
|
|
193
|
+
// with a successful updater exit can reach this npm repair path.
|
|
194
|
+
if (commandResult.exitCode === 0 && (currentVersion === 'broken' || currentVersion === 'unknown') && decision.repairArgs) {
|
|
195
|
+
const repairArgs = [...decision.repairArgs, '--force'];
|
|
196
|
+
const repaired = await runCommand('npm', repairArgs);
|
|
197
|
+
commandResult = { exitCode: repaired.exitCode, output: `${commandResult.output}\n\n[arco] ${provider} did not run after the update — retrying: npm ${repairArgs.join(' ')}\n${repaired.output}` };
|
|
222
198
|
next = await probeCapabilities();
|
|
223
199
|
currentVersion = versionForProvider(next, provider);
|
|
224
200
|
}
|
|
225
201
|
// A post-update probe that can't report a version means the command left the
|
|
226
202
|
// CLI unusable, however cleanly it exited. Deciding `updated` purely on the
|
|
227
|
-
// version string differing is how a silently-failed
|
|
228
|
-
//
|
|
229
|
-
// the
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
output,
|
|
238
|
-
error: (await probeFailureReason(provider)) ?? `${provider} did not run after the update`,
|
|
239
|
-
...(notice ? { notice } : {}),
|
|
240
|
-
};
|
|
203
|
+
// version string differing is how a silently-failed npm install surfaced
|
|
204
|
+
// as a cheerful "→ vunknown". Nonzero exits are also failures, even when
|
|
205
|
+
// the previous executable still runs and reports the same version.
|
|
206
|
+
const report = describeCliUpdate(provider, previousVersion, currentVersion, next.latestVersions?.[provider], commandResult, notice);
|
|
207
|
+
if (report.outcome === 'failed' && commandResult.exitCode === 0) {
|
|
208
|
+
const reason = await probeFailureReason(provider);
|
|
209
|
+
if (reason) {
|
|
210
|
+
report.error = reason;
|
|
211
|
+
report.message = reason;
|
|
212
|
+
}
|
|
241
213
|
}
|
|
242
|
-
return {
|
|
243
|
-
|
|
244
|
-
updated: currentVersion !== previousVersion,
|
|
245
|
-
previousVersion,
|
|
246
|
-
currentVersion,
|
|
247
|
-
capabilities: next,
|
|
248
|
-
output,
|
|
249
|
-
...(notice ? { notice } : {}),
|
|
250
|
-
};
|
|
214
|
+
return { provider, previousVersion, currentVersion, capabilities: next, output: commandResult.output,
|
|
215
|
+
...report, ...(notice ? { notice } : {}) };
|
|
251
216
|
}
|
|
252
|
-
//
|
|
253
|
-
//
|
|
254
|
-
|
|
255
|
-
|
|
217
|
+
// Keep the command status as well as its captured output. npm can exit zero
|
|
218
|
+
// after skipping an optional dep, but a nonzero updater exit is always failure.
|
|
219
|
+
async function runUpdateCommand(cmd, args, provider) {
|
|
220
|
+
const env = { ...process.env };
|
|
221
|
+
if (provider === 'codex') {
|
|
222
|
+
// Native Codex must detect its own install; an enclosing agent's package
|
|
223
|
+
// manager provenance must not turn a standalone update into an npm install.
|
|
224
|
+
for (const name of ['CODEX_MANAGED_BY_NPM', 'CODEX_MANAGED_BY_BUN', 'CODEX_MANAGED_BY_PNPM', 'CODEX_MANAGED_BY_VITE_PLUS', 'CODEX_MANAGED_PACKAGE_ROOT', 'npm_config_user_agent', 'npm_execpath'])
|
|
225
|
+
delete env[name];
|
|
226
|
+
}
|
|
256
227
|
try {
|
|
257
|
-
const { stdout, stderr } = await execFileAsync(...commandArgs(cmd, args), {
|
|
258
|
-
|
|
259
|
-
timeout: 180_000,
|
|
260
|
-
});
|
|
261
|
-
return (stdout + stderr).trim();
|
|
228
|
+
const { stdout, stderr } = await execFileAsync(...commandArgs(cmd, args), { env, maxBuffer: 4 * 1024 * 1024, timeout: 180_000 });
|
|
229
|
+
return { output: (stdout + stderr).trim(), exitCode: 0 };
|
|
262
230
|
}
|
|
263
231
|
catch (err) {
|
|
264
|
-
|
|
232
|
+
const error = err;
|
|
233
|
+
return { output: (error.stderr || error.stdout || error.message || String(err)).trim(), exitCode: typeof error.code === 'number' ? error.code : 1 };
|
|
265
234
|
}
|
|
266
235
|
}
|
|
267
236
|
// ── CLI help snapshots + change detection ──
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { CliUpdateOutcome } from '@arco/shared';
|
|
2
|
+
import { type ResolvedInstall } from './npmPlatformResolve.js';
|
|
3
|
+
export interface CodexInstallation {
|
|
4
|
+
kind: 'standalone' | 'npm' | 'unknown';
|
|
5
|
+
launcher?: string;
|
|
6
|
+
supportsUpdate: boolean;
|
|
7
|
+
npmRootMatches?: boolean;
|
|
8
|
+
instruction?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface CliUpdateDecision {
|
|
11
|
+
kind: CodexInstallation['kind'];
|
|
12
|
+
targetVersion?: string;
|
|
13
|
+
command?: {
|
|
14
|
+
cmd: string;
|
|
15
|
+
args: string[];
|
|
16
|
+
};
|
|
17
|
+
repairArgs?: string[];
|
|
18
|
+
outcome?: 'manual' | 'deferred';
|
|
19
|
+
message?: string;
|
|
20
|
+
notice?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function inspectCodexInstallation(): Promise<CodexInstallation>;
|
|
23
|
+
export declare function decideCodexUpdate(installation: CodexInstallation, published?: string, resolved?: ResolvedInstall | null): CliUpdateDecision;
|
|
24
|
+
export declare function probeCodexUpdate(published?: string): Promise<CliUpdateDecision>;
|
|
25
|
+
export interface UpdateCommandResult {
|
|
26
|
+
output: string;
|
|
27
|
+
exitCode: number;
|
|
28
|
+
}
|
|
29
|
+
export declare function describeCliUpdate(provider: string, previous: string, current: string, target: string | undefined, command: UpdateCommandResult, notice?: string): {
|
|
30
|
+
outcome: CliUpdateOutcome;
|
|
31
|
+
message: string;
|
|
32
|
+
updated: boolean;
|
|
33
|
+
error?: string;
|
|
34
|
+
};
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { execFile } from 'node:child_process';
|
|
2
|
+
import { promises as fs, constants, statSync } from 'node:fs';
|
|
3
|
+
import { homedir } from 'node:os';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { promisify } from 'node:util';
|
|
6
|
+
import { commandArgs, findWindowsCommand, npmShimTarget } from './windowsCommand.js';
|
|
7
|
+
import { resolveInstallableVersion } from './npmPlatformResolve.js';
|
|
8
|
+
import { compareVersions } from './updateCheck.js';
|
|
9
|
+
const exec = promisify(execFile);
|
|
10
|
+
const options = { timeout: 5_000, maxBuffer: 256 * 1024, killSignal: 'SIGKILL' };
|
|
11
|
+
function inside(root, file) {
|
|
12
|
+
const relative = path.relative(root, file);
|
|
13
|
+
return relative !== '' && relative !== '..' && !relative.startsWith(`..${path.sep}`) && !path.isAbsolute(relative);
|
|
14
|
+
}
|
|
15
|
+
async function canonical(file) {
|
|
16
|
+
try {
|
|
17
|
+
return await fs.realpath(file);
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
async function launcherOnPath() {
|
|
24
|
+
if (process.platform === 'win32') {
|
|
25
|
+
return findWindowsCommand('codex', process.env, (file) => {
|
|
26
|
+
try {
|
|
27
|
+
return requireFile(file);
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
}) ?? undefined;
|
|
33
|
+
}
|
|
34
|
+
for (const dir of (process.env.PATH ?? '').split(path.delimiter).filter(Boolean)) {
|
|
35
|
+
const file = path.resolve(dir, 'codex');
|
|
36
|
+
try {
|
|
37
|
+
await fs.access(file, constants.X_OK);
|
|
38
|
+
if ((await fs.stat(file)).isFile())
|
|
39
|
+
return file;
|
|
40
|
+
}
|
|
41
|
+
catch { /* try the next PATH entry */ }
|
|
42
|
+
}
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
// Windows command lookup is synchronous so it can use the same PATH/PATHEXT
|
|
46
|
+
// selection as the provider launcher, including npm's .cmd wrapper.
|
|
47
|
+
function requireFile(file) { return statSync(file).isFile(); }
|
|
48
|
+
export async function inspectCodexInstallation() {
|
|
49
|
+
const launcher = await launcherOnPath();
|
|
50
|
+
if (!launcher)
|
|
51
|
+
return { kind: 'unknown', supportsUpdate: false };
|
|
52
|
+
let entry = launcher;
|
|
53
|
+
if (process.platform === 'win32' && /\.(?:cmd|bat)$/i.test(launcher)) {
|
|
54
|
+
try {
|
|
55
|
+
entry = npmShimTarget(launcher, await fs.readFile(launcher, 'utf8')) ?? launcher;
|
|
56
|
+
}
|
|
57
|
+
catch { /* leave an unreadable wrapper unknown */ }
|
|
58
|
+
}
|
|
59
|
+
const real = await canonical(entry);
|
|
60
|
+
if (!real)
|
|
61
|
+
return { kind: 'unknown', launcher, supportsUpdate: false };
|
|
62
|
+
let supportsUpdate = false;
|
|
63
|
+
try {
|
|
64
|
+
const { stdout } = await exec(...commandArgs(launcher, ['--help']), options);
|
|
65
|
+
supportsUpdate = /^\s+update\s+/m.test(stdout);
|
|
66
|
+
}
|
|
67
|
+
catch { /* an older or broken CLI can still have a proven npm repair path */ }
|
|
68
|
+
if (path.basename(real) === 'codex.js') {
|
|
69
|
+
const packageRoot = path.dirname(path.dirname(real));
|
|
70
|
+
try {
|
|
71
|
+
const manifest = JSON.parse(await fs.readFile(path.join(packageRoot, 'package.json'), 'utf8'));
|
|
72
|
+
if (manifest.name === '@openai/codex') {
|
|
73
|
+
const { stdout } = await exec(...commandArgs('npm', ['root', '-g']), options);
|
|
74
|
+
const target = await canonical(path.join(stdout.trim(), '@openai', 'codex'));
|
|
75
|
+
return { kind: 'npm', launcher, supportsUpdate, npmRootMatches: !!target && path.relative(target, packageRoot) === '' };
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
catch { /* ownership could not be proved; never guess a global npm target */ }
|
|
79
|
+
return { kind: 'unknown', launcher, supportsUpdate, instruction: 'Arco could not confirm the npm update target. No update was run. Use the package manager that installed this Codex.' };
|
|
80
|
+
}
|
|
81
|
+
const home = process.env.CODEX_HOME || path.join(homedir(), '.codex');
|
|
82
|
+
const releases = await canonical(path.join(home, 'packages', 'standalone', 'releases'));
|
|
83
|
+
if (releases && inside(releases, real)) {
|
|
84
|
+
const defaultBin = process.platform === 'win32'
|
|
85
|
+
? process.env.LOCALAPPDATA && path.join(process.env.LOCALAPPDATA, 'Programs', 'OpenAI', 'Codex', 'bin')
|
|
86
|
+
: path.join(homedir(), '.local', 'bin');
|
|
87
|
+
const installBin = process.env.CODEX_INSTALL_DIR || defaultBin;
|
|
88
|
+
// The updater reruns the installer. Its destination must still be the
|
|
89
|
+
// active command directory, including a retained custom install directory.
|
|
90
|
+
if (!installBin || path.relative(path.resolve(path.dirname(launcher)), path.resolve(installBin)) !== '') {
|
|
91
|
+
return { kind: 'unknown', launcher, supportsUpdate, instruction: 'This Codex was not installed through npm. No update was run because its installer destination could not be confirmed. Open codex in a terminal and use its update prompt with the original install directory.' };
|
|
92
|
+
}
|
|
93
|
+
return { kind: 'standalone', launcher, supportsUpdate };
|
|
94
|
+
}
|
|
95
|
+
return { kind: 'unknown', launcher, supportsUpdate };
|
|
96
|
+
}
|
|
97
|
+
export function decideCodexUpdate(installation, published, resolved) {
|
|
98
|
+
const base = { kind: installation.kind };
|
|
99
|
+
if (installation.kind === 'unknown' || !installation.launcher) {
|
|
100
|
+
return { ...base, outcome: 'manual', message: installation.instruction ?? 'Arco could not identify how this Codex was installed. No update was run. Open codex in a terminal and use its update prompt or the package manager that installed it.' };
|
|
101
|
+
}
|
|
102
|
+
if (installation.kind === 'standalone') {
|
|
103
|
+
return installation.supportsUpdate
|
|
104
|
+
? { ...base, targetVersion: published, command: { cmd: installation.launcher, args: ['update'] } }
|
|
105
|
+
: { ...base, targetVersion: published, outcome: 'manual', message: 'This Codex was not installed through npm and does not support codex update. No update was run. Open codex in a terminal and use its update prompt.' };
|
|
106
|
+
}
|
|
107
|
+
if (!installation.npmRootMatches) {
|
|
108
|
+
return { ...base, outcome: 'manual', message: 'The npm update would target a different Codex installation. No update was run. Use the package manager that installed this Codex.' };
|
|
109
|
+
}
|
|
110
|
+
if (!resolved) {
|
|
111
|
+
return { ...base, outcome: 'deferred', message: 'Arco could not confirm an installable Codex npm build. The current installation was not changed.' };
|
|
112
|
+
}
|
|
113
|
+
if (resolved.blocked || (installation.supportsUpdate && resolved.degraded)) {
|
|
114
|
+
return { ...base, outcome: 'deferred', message: `Codex v${resolved.latest} has no ${process.platform}-${process.arch} build available yet. The current installation was not changed.` };
|
|
115
|
+
}
|
|
116
|
+
const args = ['install', '-g', `@openai/codex@${resolved.version}`];
|
|
117
|
+
return {
|
|
118
|
+
...base, targetVersion: resolved.version,
|
|
119
|
+
command: installation.supportsUpdate ? { cmd: installation.launcher, args: ['update'] } : { cmd: 'npm', args },
|
|
120
|
+
repairArgs: args,
|
|
121
|
+
...(resolved.degraded ? { notice: `Codex v${resolved.latest} has no ${process.platform}-${process.arch} build available yet. The newest installable npm version is v${resolved.version}.` } : {}),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
export async function probeCodexUpdate(published) {
|
|
125
|
+
const installation = await inspectCodexInstallation();
|
|
126
|
+
const resolved = installation.kind === 'npm' && installation.npmRootMatches
|
|
127
|
+
? await resolveInstallableVersion('@openai/codex') : undefined;
|
|
128
|
+
return decideCodexUpdate(installation, published, resolved);
|
|
129
|
+
}
|
|
130
|
+
export function describeCliUpdate(provider, previous, current, target, command, notice) {
|
|
131
|
+
const name = provider === 'codex' ? 'Codex' : 'Claude CLI';
|
|
132
|
+
if (command.exitCode !== 0) {
|
|
133
|
+
const error = `${name} update failed: ${command.output.trim().slice(0, 2000) || `exit code ${command.exitCode}`}`;
|
|
134
|
+
return { outcome: 'failed', message: error, updated: false, error };
|
|
135
|
+
}
|
|
136
|
+
if (current === 'unknown' || current === 'broken') {
|
|
137
|
+
const error = `${name} did not run after the update.`;
|
|
138
|
+
return { outcome: 'failed', message: error, updated: false, error };
|
|
139
|
+
}
|
|
140
|
+
if (previous !== current && (compareVersions(current, previous) ?? 1) > 0) {
|
|
141
|
+
return { outcome: 'updated', message: `Updated ${name} from v${previous} to v${current}.${notice ? ` ${notice}` : ''}`, updated: true };
|
|
142
|
+
}
|
|
143
|
+
if (notice)
|
|
144
|
+
return { outcome: 'deferred', message: notice, updated: false };
|
|
145
|
+
const comparison = target ? compareVersions(current, target) : null;
|
|
146
|
+
if (comparison !== null && comparison >= 0)
|
|
147
|
+
return { outcome: 'current', message: `${name} v${current} is up to date for this installation.`, updated: false };
|
|
148
|
+
return { outcome: 'unchanged', updated: false, message: comparison !== null
|
|
149
|
+
? `${name} did not change; v${target} is still available.`
|
|
150
|
+
: `The ${name} version did not change. Arco could not check whether it is up to date.` };
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=cliUpdateDecision.js.map
|