arco-workbench 0.2.4 → 0.2.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 +1 -1
- package/THIRD_PARTY_NOTICES +2 -2
- package/client/dist/assets/{PhosphorBackdrop-CHXVFLGT.js → PhosphorBackdrop-YsHTmZJh.js} +1 -1
- package/client/dist/assets/{ThemedBackgroundShaderImpl-Bhs4I9jA.js → ThemedBackgroundShaderImpl-BEjpgoBW.js} +1 -1
- package/client/dist/assets/{XtermView-CdfurwFx.js → XtermView-wh7jNKvk.js} +1 -1
- package/client/dist/assets/{galleryEditor-DYjZZ4cf.js → galleryEditor-CaOS2mmM.js} +1 -1
- package/client/dist/assets/{index-BjDmFvqG.js → index-j68SfA-l.js} +271 -271
- package/client/dist/index.html +1 -1
- package/client/src/App.tsx +2 -2
- package/client/src/components/AuthReloginNotice.tsx +7 -6
- package/client/src/components/ChatMessage.tsx +41 -29
- package/client/src/components/ChatPanel.tsx +17 -4
- package/client/src/components/ClaudeNativeAccountPicker.tsx +32 -0
- package/client/src/components/ClaudeNativeAuthRow.tsx +71 -19
- package/client/src/components/ClusterRightPanel/AddWorkerSection.tsx +11 -281
- package/client/src/components/ClusterRightPanel/AutoPickupControl.tsx +1 -1
- package/client/src/components/ClusterRightPanel/FreshMemberForm.tsx +315 -0
- package/client/src/components/ClusterRightPanel/ReplaceMemberDialog.tsx +17 -7
- package/client/src/components/ClusterRightPanel/index.tsx +1 -1
- package/client/src/components/ClusterRightPanel/useFreshMemberPicker.ts +6 -4
- package/client/src/components/ClusterTab.tsx +2 -2
- package/client/src/components/Connections/Connections.tsx +5 -9
- package/client/src/components/Connections/model.ts +3 -1
- package/client/src/components/FileViewerModal.tsx +54 -17
- package/client/src/components/GitHubPanel/index.tsx +9 -5
- package/client/src/components/HandoffDialog.tsx +5 -3
- package/client/src/components/MobileShell.tsx +1 -33
- package/client/src/components/OperatorQuestionNotice.tsx +5 -4
- package/client/src/components/ProvidersPopover.tsx +6 -2
- package/client/src/components/RightPanel/ActivityTab.tsx +2 -1
- package/client/src/components/RightPanel/ConfigTab.tsx +23 -5
- package/client/src/components/RightPanel/OutputsPanel.tsx +21 -9
- package/client/src/components/RightPanel/outputsReconcile.ts +31 -0
- package/client/src/components/SettingsPanel.tsx +7 -10
- package/client/src/components/SpawnDialog.tsx +14 -3
- package/client/src/components/TabBar.tsx +2 -2
- package/client/src/components/TabContextMenu.tsx +73 -133
- package/client/src/components/TerminalInput.tsx +4 -3
- package/client/src/components/TranscriptWorkerDialog.tsx +14 -4
- package/client/src/components/UpdateAction.tsx +30 -7
- package/client/src/components/UsageBar.tsx +37 -18
- package/client/src/components/WorkflowCreator/ClusterMembersSection.tsx +29 -3
- package/client/src/components/WorkflowCreator/index.tsx +29 -15
- package/client/src/components/WorkflowView.tsx +1 -1
- package/client/src/components/providerIndicator.ts +7 -3
- package/client/src/components/settings/GitHubAuthRow.tsx +34 -0
- package/client/src/explorer/ArtifactsLens.tsx +17 -8
- package/client/src/explorer/ExplorerApp.tsx +3 -3
- package/client/src/explorer/types.ts +3 -1
- package/client/src/help/content/cluster.tsx +10 -4
- package/client/src/help/content/composer.tsx +3 -2
- package/client/src/help/content/header.tsx +11 -4
- package/client/src/help/content/misc.tsx +7 -5
- package/client/src/help/content/rightPanel.tsx +8 -4
- package/client/src/help/content/settings.tsx +15 -4
- package/client/src/help/content/tabbar.tsx +1 -1
- package/client/src/help/manualSections/actions.tsx +5 -1
- package/client/src/help/manualSections/clusters.tsx +20 -14
- package/client/src/help/manualSections/configuration.tsx +6 -4
- package/client/src/help/manualSections/gettingStarted.tsx +4 -2
- package/client/src/help/manualSections/maintenance.tsx +31 -0
- package/client/src/help/manualSections/powerFeatures.tsx +1 -0
- package/client/src/help/manualSections/providers.tsx +11 -4
- package/client/src/help/manualSections/workspace.tsx +3 -3
- package/client/src/hooks/useClaudeNativeCatalog.ts +26 -0
- package/client/src/hooks/useClaudeNativeLogin.ts +16 -11
- package/client/src/hooks/useWebSocket.ts +4 -2
- package/client/src/layout/layoutRange.ts +4 -5
- package/client/src/questions/waitingQuestion.ts +2 -0
- package/client/src/stores/appStore.ts +5 -1
- package/client/src/stores/appStore.types.ts +2 -0
- package/client/src/stores/replayContext.ts +20 -0
- package/client/src/utils/chatFileLinks.ts +34 -3
- package/client/src/utils/claudeAuth.ts +9 -1
- package/client/src/ws/handleServerMessage.ts +11 -3
- package/docs/ARCHITECTURE.md +3 -3
- package/docs/BACKUP.md +1 -1
- package/docs/CLIENT.md +10 -5
- package/docs/EXTENDING.md +1 -1
- package/docs/FEATURES.md +3 -3
- package/docs/GETTING_STARTED.md +5 -4
- package/docs/GIT_WORKBENCH.md +8 -0
- package/docs/GLOSSARY.md +2 -2
- package/docs/GOTCHAS.md +4 -4
- package/docs/HTTP_API.md +54 -23
- package/docs/OPERATIONS.md +17 -1
- package/docs/OPERATOR_ACTIONS.md +2 -2
- package/docs/OUTPUTS.md +48 -6
- package/docs/PERSISTENCE.md +1 -1
- package/docs/PRIMITIVES.md +4 -2
- package/docs/PROTOCOL_CLUSTER.md +12 -6
- package/docs/PROTOCOL_PRIMITIVES.md +1 -1
- package/docs/PROVIDERS.md +46 -9
- package/docs/RESEARCH.md +1 -1
- package/docs/SETTINGS.md +9 -4
- package/node_modules/@arco/shared/dist/protocol/clusters.d.ts +15 -3
- package/node_modules/@arco/shared/dist/protocol/clusters.js +1 -1
- package/node_modules/@arco/shared/dist/protocol/models.d.ts +6 -1
- package/node_modules/@arco/shared/dist/protocol/operatorQuestions.d.ts +2 -1
- package/node_modules/@arco/shared/dist/protocol/settings.d.ts +3 -0
- package/node_modules/@arco/shared/dist/protocol/settings.js +5 -0
- package/node_modules/@arco/shared/dist/protocol/workflows.d.ts +1 -0
- package/node_modules/@arco/shared/dist/protocol/workflows.js +0 -2
- package/node_modules/@arco/shared/package.json +1 -1
- package/package.json +2 -2
- package/scripts/packaging/services.mjs +20 -1
- package/scripts/packaging/update.mjs +37 -2
- package/server/dist/attention.d.ts +6 -0
- package/server/dist/attention.js +6 -0
- package/server/dist/auth.d.ts +5 -0
- package/server/dist/auth.js +31 -20
- package/server/dist/clusterAutoTurn.d.ts +5 -1
- package/server/dist/clusterAutoTurn.js +31 -9
- package/server/dist/clusterPresets.js +3 -3
- package/server/dist/effortValidation.d.ts +2 -2
- package/server/dist/effortValidation.js +4 -4
- package/server/dist/explorerArtifacts.d.ts +1 -0
- package/server/dist/explorerArtifacts.js +12 -1
- package/server/dist/geminiMembers.d.ts +7 -1
- package/server/dist/geminiMembers.js +28 -14
- package/server/dist/http/conversationFiles.d.ts +36 -0
- package/server/dist/http/conversationFiles.js +222 -0
- package/server/dist/http/fileBytes.d.ts +3 -0
- package/server/dist/http/fileBytes.js +33 -0
- package/server/dist/http/fileContentRoute.d.ts +2 -0
- package/server/dist/http/fileContentRoute.js +139 -0
- package/server/dist/http/fileRead.d.ts +54 -2
- package/server/dist/http/fileRead.js +31 -24
- package/server/dist/http/outputRoutes.js +14 -21
- package/server/dist/http/readConfinement.d.ts +0 -11
- package/server/dist/http/readConfinement.js +4 -30
- package/server/dist/http/router.js +40 -66
- package/server/dist/index.js +26 -12
- package/server/dist/management/initHubLink.js +1 -1
- package/server/dist/outputs.js +8 -0
- package/server/dist/primitives/exportContext.d.ts +2 -0
- package/server/dist/primitives/exportContext.js +13 -2
- package/server/dist/primitives/runCompare.d.ts +7 -1
- package/server/dist/primitives/runCompare.js +44 -20
- package/server/dist/project/taskLedger.js +46 -34
- package/server/dist/providerAccounts.d.ts +4 -0
- package/server/dist/providerAccounts.js +20 -1
- package/server/dist/providers/antigravity/artifacts.d.ts +23 -0
- package/server/dist/providers/antigravity/artifacts.js +140 -0
- package/server/dist/providers/antigravity/index.js +85 -7
- package/server/dist/providers/antigravity/questions.d.ts +2 -0
- package/server/dist/providers/antigravity/questions.js +58 -0
- package/server/dist/providers/claude-native/auth.d.ts +9 -8
- package/server/dist/providers/claude-native/auth.js +50 -58
- package/server/dist/providers/claude-native/authStatus.d.ts +2 -2
- package/server/dist/providers/claude-native/authStatus.js +9 -7
- package/server/dist/providers/claude-native/catalog.d.ts +6 -5
- package/server/dist/providers/claude-native/catalog.js +50 -39
- package/server/dist/providers/claude-native/oauth.d.ts +10 -9
- package/server/dist/providers/claude-native/oauth.js +120 -96
- package/server/dist/providers/claude-native/worker.d.ts +1 -0
- package/server/dist/providers/claude-native/worker.js +38 -23
- package/server/dist/providers/codex-appserver/operatorQuestions.d.ts +5 -3
- package/server/dist/providers/codex-appserver/operatorQuestions.js +27 -13
- package/server/dist/server/broadcast.js +6 -0
- package/server/dist/settings.d.ts +1 -0
- package/server/dist/settings.js +39 -7
- package/server/dist/skills.js +1 -1
- package/server/dist/smartPickupAdapters.d.ts +1 -0
- package/server/dist/smartPickupAdapters.js +2 -2
- package/server/dist/smartPickupObserver.js +8 -5
- package/server/dist/thirdPartySkills.js +11 -5
- package/server/dist/usage.d.ts +1 -1
- package/server/dist/usage.js +39 -27
- package/server/dist/workers/WorkerManager.d.ts +1 -0
- package/server/dist/workers/WorkerManager.js +1 -0
- package/server/dist/workers/processKill.js +37 -24
- package/server/dist/workflowMeta.js +2 -2
- package/server/dist/ws/clusterHandlers.d.ts +2 -2
- package/server/dist/ws/clusterHandlers.js +127 -113
- package/server/dist/ws/clusterMembers.d.ts +1 -1
- package/server/dist/ws/clusterMembers.js +34 -4
- package/server/dist/ws/compactHandlers.js +30 -14
- package/server/dist/ws/compareHandlers.js +53 -21
- package/server/dist/ws/gateHandlers.js +2 -0
- package/server/dist/ws/genesisHandlers.js +5 -3
- package/server/dist/ws/handoffHandlers.d.ts +1 -1
- package/server/dist/ws/handoffHandlers.js +115 -39
- package/server/dist/ws/transcriptWorkerHandlers.js +7 -2
- package/server/dist/ws/turnEngine.js +33 -18
- package/server/dist/ws/updatePrimaryConfig.d.ts +3 -2
- package/server/dist/ws/updatePrimaryConfig.js +236 -133
- package/server/dist/ws/workflowHandlers.js +21 -4
- package/server/package.json +1 -1
- package/server/src/attention.ts +7 -0
- package/server/src/auth.ts +33 -20
- package/server/src/clusterAutoTurn.ts +31 -11
- package/server/src/clusterPresets.ts +2 -2
- package/server/src/effortValidation.ts +4 -4
- package/server/src/explorerArtifacts.ts +12 -1
- package/server/src/geminiMembers.ts +26 -15
- package/server/src/http/conversationFiles.ts +231 -0
- package/server/src/http/fileBytes.ts +34 -0
- package/server/src/http/fileContentRoute.ts +123 -0
- package/server/src/http/fileRead.ts +30 -25
- package/server/src/http/outputRoutes.ts +13 -13
- package/server/src/http/readConfinement.ts +3 -30
- package/server/src/http/router.ts +38 -62
- package/server/src/index.ts +27 -18
- package/server/src/management/initHubLink.ts +1 -1
- package/server/src/outputs.ts +8 -0
- package/server/src/primitives/exportContext.ts +14 -2
- package/server/src/primitives/runCompare.ts +73 -46
- package/server/src/project/taskLedger.ts +47 -30
- package/server/src/providerAccounts.ts +20 -1
- package/server/src/providers/antigravity/artifacts.ts +121 -0
- package/server/src/providers/antigravity/index.ts +64 -6
- package/server/src/providers/antigravity/questions.ts +52 -0
- package/server/src/providers/claude-native/auth.ts +45 -60
- package/server/src/providers/claude-native/authStatus.ts +9 -8
- package/server/src/providers/claude-native/catalog.ts +52 -35
- package/server/src/providers/claude-native/oauth.ts +101 -77
- package/server/src/providers/claude-native/worker.ts +38 -22
- package/server/src/providers/codex-appserver/operatorQuestions.ts +26 -12
- package/server/src/server/broadcast.ts +4 -0
- package/server/src/settings.ts +36 -8
- package/server/src/skills.ts +1 -1
- package/server/src/smartPickupAdapters.ts +3 -2
- package/server/src/smartPickupObserver.ts +8 -5
- package/server/src/thirdPartySkills.ts +11 -5
- package/server/src/usage.ts +30 -22
- package/server/src/workers/WorkerManager.ts +2 -0
- package/server/src/workers/processKill.ts +37 -23
- package/server/src/workflowMeta.ts +2 -2
- package/server/src/ws/clusterHandlers.ts +107 -104
- package/server/src/ws/clusterMembers.ts +25 -6
- package/server/src/ws/compactHandlers.ts +29 -15
- package/server/src/ws/compareHandlers.ts +59 -25
- package/server/src/ws/gateHandlers.ts +2 -0
- package/server/src/ws/genesisHandlers.ts +5 -4
- package/server/src/ws/handoffHandlers.ts +105 -37
- package/server/src/ws/transcriptWorkerHandlers.ts +6 -2
- package/server/src/ws/turnEngine.ts +32 -17
- package/server/src/ws/updatePrimaryConfig.ts +230 -132
- package/server/src/ws/workflowHandlers.ts +20 -4
- package/shared/dist/protocol/clusters.d.ts +15 -3
- package/shared/dist/protocol/clusters.js +1 -1
- package/shared/dist/protocol/models.d.ts +6 -1
- package/shared/dist/protocol/operatorQuestions.d.ts +2 -1
- package/shared/dist/protocol/settings.d.ts +3 -0
- package/shared/dist/protocol/settings.js +5 -0
- package/shared/dist/protocol/workflows.d.ts +1 -0
- package/shared/dist/protocol/workflows.js +0 -2
- package/shared/src/protocol/clusters.ts +23 -5
- package/shared/src/protocol/compare.ts +2 -2
- package/shared/src/protocol/models.ts +8 -4
- package/shared/src/protocol/operatorQuestions.ts +2 -1
- package/shared/src/protocol/settings.ts +8 -1
- package/shared/src/protocol/workflows.ts +1 -1
|
@@ -5,7 +5,10 @@ import { send, broadcastWorkflow, broadcastTransient } from '../server/broadcast
|
|
|
5
5
|
import { workflows } from '../server/state.js';
|
|
6
6
|
import { capGoal } from '../providers/goalBlock.js';
|
|
7
7
|
import { normalizeGoalRunArm } from '../goalRun.js';
|
|
8
|
-
import { deriveAutoFold, deriveAutoHandoff, startSessionWatcher } from './turnEngine.js';
|
|
8
|
+
import { claimBusy, deriveAutoFold, deriveAutoHandoff, drainQueueIfIdle, releaseBusy, startSessionWatcher } from './turnEngine.js';
|
|
9
|
+
import { requireClaudeNativeAccount } from '../providerAccounts.js';
|
|
10
|
+
import { effectiveClaudeTransport } from '../claudeTransport.js';
|
|
11
|
+
import { readSettings } from '../settings.js';
|
|
9
12
|
import { updateMeta } from '../workflowMeta.js';
|
|
10
13
|
import { withFileLock } from '../atomicFile.js';
|
|
11
14
|
import { disposeProviderResources } from '../providers/index.js';
|
|
@@ -13,99 +16,198 @@ import { refreshHubReporting } from '../management/initHubLink.js';
|
|
|
13
16
|
import { buildPinnedSkillsBlock, resolvePinnedSkills, isValidSlug } from '../skills.js';
|
|
14
17
|
import { withClusterSkillLock } from '../clusterStore.js';
|
|
15
18
|
import { assertWorkflowSkillPins, uniqueSkillRefs } from '../clusterSkills.js';
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
// STOP must not release an in-flight account save and let a new turn race it.
|
|
20
|
+
const updatingNativeAccount = new WeakSet();
|
|
21
|
+
export function isUpdatingNativeAccount(wf) {
|
|
22
|
+
return updatingNativeAccount.has(wf);
|
|
23
|
+
}
|
|
24
|
+
export async function handleUpdatePrimaryConfig(ws, _session, msg) {
|
|
25
|
+
await withFileLock(`primary-config:${msg.workflowId}`, async () => {
|
|
26
|
+
const wf = workflows.get(msg.workflowId);
|
|
27
|
+
if (!wf) {
|
|
28
|
+
send(ws, { type: 'error', message: `Unknown workflow ${msg.workflowId.slice(0, 8)}` });
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const update = (account) => {
|
|
32
|
+
const apply = () => applyPrimaryConfig(ws, wf, msg, account);
|
|
33
|
+
// Keep pin validation and publication under the cluster's pin lock.
|
|
34
|
+
return msg.pinnedSkills !== undefined ? withClusterSkillLock(msg.workflowId, apply) : apply();
|
|
35
|
+
};
|
|
36
|
+
if (msg.providerAccountRef === undefined || wf.primary.provider !== 'claude') {
|
|
37
|
+
await update();
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
let token;
|
|
41
|
+
try {
|
|
42
|
+
if (typeof msg.providerAccountRef !== 'string' || !msg.providerAccountRef)
|
|
43
|
+
throw new Error('Choose a Claude Native account.');
|
|
44
|
+
if (wf.busy)
|
|
45
|
+
throw new Error('Wait for the current turn to finish before changing its account.');
|
|
46
|
+
token = claimBusy(wf, false);
|
|
47
|
+
updatingNativeAccount.add(wf);
|
|
48
|
+
const account = await requireClaudeNativeAccount(msg.providerAccountRef);
|
|
49
|
+
const settings = await readSettings(wf.config.workingDirectory);
|
|
50
|
+
if (effectiveClaudeTransport({ ...wf.config, claudeTransport: msg.claudeTransport ?? wf.config.claudeTransport, ultracode: msg.ultracode ?? wf.config.ultracode }, settings) !== 'native') {
|
|
51
|
+
throw new Error('Choose Claude Native before changing its account.');
|
|
52
|
+
}
|
|
53
|
+
if (workflows.get(msg.workflowId) !== wf)
|
|
54
|
+
return;
|
|
55
|
+
await update(account);
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
send(ws, { type: 'error', workflowId: msg.workflowId, message: err instanceof Error ? err.message : 'Could not select the Claude Native account.' });
|
|
59
|
+
if (!wf.bootMaterialized)
|
|
60
|
+
broadcastTransient(msg.workflowId, { type: 'workflow_config_synced', workflowId: msg.workflowId, config: wf.config });
|
|
61
|
+
}
|
|
62
|
+
finally {
|
|
63
|
+
if (token !== undefined) {
|
|
64
|
+
updatingNativeAccount.delete(wf);
|
|
65
|
+
if (releaseBusy(wf, token, 'finished', false) && workflows.get(msg.workflowId) === wf) {
|
|
66
|
+
void drainQueueIfIdle(msg.workflowId);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
async function applyPrimaryConfig(ws, wf, msg, nativeAccount) {
|
|
73
|
+
// A Native account switch publishes the account and all accompanying edits
|
|
74
|
+
// only after validation and the single metadata write have succeeded.
|
|
75
|
+
const config = nativeAccount === undefined
|
|
76
|
+
? wf.config
|
|
77
|
+
: { ...wf.config, providerAccountRef: nativeAccount, claudeTransport: 'native' };
|
|
78
|
+
const primary = nativeAccount === undefined ? wf.primary : { ...wf.primary };
|
|
79
|
+
const proposedModel = msg.model ?? primary.model;
|
|
80
|
+
const allowedEfforts = allowedWorkflowEfforts(primary.provider, proposedModel, config.providerAccountRef);
|
|
24
81
|
if (msg.effort !== undefined && !allowedEfforts.includes(msg.effort)) {
|
|
25
|
-
const label =
|
|
26
|
-
|
|
27
|
-
|
|
82
|
+
const label = primary.provider === 'claude' ? 'Claude' : 'Provider';
|
|
83
|
+
const message = `${label} effort must be ${allowedEfforts.join(', ')}; no settings were changed.`;
|
|
84
|
+
if (nativeAccount !== undefined)
|
|
85
|
+
throw new Error(message);
|
|
86
|
+
send(ws, { type: 'error', workflowId: msg.workflowId, message });
|
|
28
87
|
return;
|
|
29
88
|
}
|
|
30
|
-
if (msg.model !== undefined && msg.effort === undefined) {
|
|
31
|
-
const next = normalizedWorkflowEffort(
|
|
32
|
-
if (next !==
|
|
89
|
+
if ((msg.model !== undefined || nativeAccount !== undefined) && msg.effort === undefined) {
|
|
90
|
+
const next = normalizedWorkflowEffort(primary.provider, proposedModel, primary.effort, config.providerAccountRef);
|
|
91
|
+
if (next !== primary.effort)
|
|
33
92
|
msg = { ...msg, effort: next };
|
|
34
93
|
}
|
|
35
|
-
const proposedGoal = msg.goal === undefined ?
|
|
94
|
+
const proposedGoal = msg.goal === undefined ? config.goal : capGoal(msg.goal);
|
|
36
95
|
const proposedGoalRun = msg.goalRun === undefined ? undefined : normalizeGoalRunArm(msg.goalRun, !!proposedGoal?.trim());
|
|
37
96
|
if (typeof proposedGoalRun === 'string') {
|
|
97
|
+
if (nativeAccount !== undefined)
|
|
98
|
+
throw new Error(proposedGoalRun);
|
|
38
99
|
send(ws, { type: 'error', workflowId: msg.workflowId, message: proposedGoalRun });
|
|
39
100
|
return;
|
|
40
101
|
}
|
|
41
102
|
if (msg.autoCompaction !== undefined && msg.autoCompaction !== null && !isAutoCompactionPolicy(msg.autoCompaction)) {
|
|
42
|
-
|
|
103
|
+
const message = 'Auto-compaction requires a boolean and an integer threshold from 30 to 95.';
|
|
104
|
+
if (nativeAccount !== undefined)
|
|
105
|
+
throw new Error(message);
|
|
106
|
+
send(ws, { type: 'error', message });
|
|
43
107
|
if (!wf.bootMaterialized)
|
|
44
|
-
broadcastTransient(msg.workflowId, { type: 'workflow_config_synced', workflowId: msg.workflowId, config
|
|
108
|
+
broadcastTransient(msg.workflowId, { type: 'workflow_config_synced', workflowId: msg.workflowId, config });
|
|
45
109
|
return;
|
|
46
110
|
}
|
|
47
|
-
|
|
111
|
+
const previousCompaction = config.autoCompaction;
|
|
112
|
+
if (msg.autoCompaction !== undefined && nativeAccount !== undefined) {
|
|
113
|
+
config.autoCompaction = msg.autoCompaction === null ? undefined : { ...msg.autoCompaction };
|
|
114
|
+
}
|
|
115
|
+
else if (msg.autoCompaction !== undefined) {
|
|
48
116
|
const saved = await withFileLock(`auto-compaction:${msg.workflowId}`, async () => {
|
|
49
117
|
const next = msg.autoCompaction === null ? undefined : { ...msg.autoCompaction };
|
|
50
|
-
const previous =
|
|
118
|
+
const previous = config.autoCompaction;
|
|
51
119
|
const changed = next?.enabled !== previous?.enabled || next?.thresholdPercent !== previous?.thresholdPercent;
|
|
52
120
|
if (!changed)
|
|
53
121
|
return true;
|
|
54
|
-
if (
|
|
122
|
+
if (config.workingDirectory && !config.incognito) {
|
|
55
123
|
try {
|
|
56
|
-
const updated = await updateMeta(
|
|
124
|
+
const updated = await updateMeta(config.workingDirectory, msg.workflowId, (meta) => { meta.autoCompaction = next; });
|
|
57
125
|
if (!updated)
|
|
58
126
|
throw new Error('workflow metadata unavailable');
|
|
59
127
|
}
|
|
60
128
|
catch {
|
|
61
129
|
send(ws, { type: 'error', workflowId: msg.workflowId, message: 'Could not save auto-compaction policy; the previous policy remains active.' });
|
|
62
130
|
if (!wf.bootMaterialized)
|
|
63
|
-
broadcastTransient(msg.workflowId, { type: 'workflow_config_synced', workflowId: msg.workflowId, config
|
|
131
|
+
broadcastTransient(msg.workflowId, { type: 'workflow_config_synced', workflowId: msg.workflowId, config });
|
|
64
132
|
return false;
|
|
65
133
|
}
|
|
66
134
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
content: next ? `[AUTO-COMPACT] Worker policy ${next.enabled ? `enabled at ${next.thresholdPercent}%` : 'disabled'}.` : '[AUTO-COMPACT] Worker policy cleared; cluster or legacy behavior applies.' });
|
|
135
|
+
config.autoCompaction = next;
|
|
136
|
+
announceAutoCompaction(msg.workflowId, next);
|
|
70
137
|
return true;
|
|
71
138
|
});
|
|
72
139
|
if (!saved)
|
|
73
140
|
return;
|
|
74
141
|
}
|
|
142
|
+
// Standing skill pins are a whole-set replacement. Resolve before persisting
|
|
143
|
+
// so malformed / missing references never become durable config, and report
|
|
144
|
+
// current prompt bytes for cost visibility. Bodies remain on disk and are
|
|
145
|
+
// re-read at every turn; this snapshot is only the pin acknowledgement.
|
|
146
|
+
let pinnedSkillsBroadcast;
|
|
147
|
+
if (msg.pinnedSkills !== undefined) {
|
|
148
|
+
const requested = uniqueSkillRefs((Array.isArray(msg.pinnedSkills) ? msg.pinnedSkills : []).filter(ref => ref && (ref.scope === 'project' || ref.scope === 'global') && isValidSlug(ref.slug)));
|
|
149
|
+
let resolved;
|
|
150
|
+
try {
|
|
151
|
+
await assertWorkflowSkillPins(msg.workflowId, config.workingDirectory, requested);
|
|
152
|
+
resolved = await resolvePinnedSkills(requested, config.workingDirectory);
|
|
153
|
+
const refs = resolved.skills.map(s => ({ scope: s.scope, slug: s.slug }));
|
|
154
|
+
if (refs.length)
|
|
155
|
+
config.pinnedSkills = refs;
|
|
156
|
+
else
|
|
157
|
+
delete config.pinnedSkills;
|
|
158
|
+
}
|
|
159
|
+
catch (err) {
|
|
160
|
+
if (nativeAccount !== undefined)
|
|
161
|
+
throw err;
|
|
162
|
+
send(ws, { type: 'error', workflowId: msg.workflowId, message: err instanceof Error ? err.message : String(err) });
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
const block = buildPinnedSkillsBlock(resolved.skills);
|
|
166
|
+
pinnedSkillsBroadcast = {
|
|
167
|
+
skills: resolved.skills.map((s) => ({ scope: s.scope, slug: s.slug, name: s.name })),
|
|
168
|
+
bytes: block.bytes,
|
|
169
|
+
missing: [...resolved.missing, ...resolved.truncated],
|
|
170
|
+
};
|
|
171
|
+
}
|
|
75
172
|
if (msg.model !== undefined)
|
|
76
|
-
|
|
173
|
+
primary.model = msg.model;
|
|
77
174
|
if (msg.effort !== undefined)
|
|
78
|
-
|
|
79
|
-
if (msg.providerAccountRef !== undefined) {
|
|
175
|
+
primary.effort = msg.effort;
|
|
176
|
+
if (msg.providerAccountRef !== undefined && nativeAccount === undefined) {
|
|
80
177
|
if (wf.busy) {
|
|
81
178
|
send(ws, { type: 'error', message: 'Cannot change account profile while a turn is running.' });
|
|
82
179
|
return;
|
|
83
180
|
}
|
|
84
|
-
|
|
181
|
+
config.providerAccountRef = msg.providerAccountRef || undefined;
|
|
85
182
|
disposeProviderResources(msg.workflowId);
|
|
86
183
|
console.log(`[arco] [${msg.workflowId.slice(0, 8)}] provider.account updated → ${msg.providerAccountRef || 'default'}`);
|
|
87
184
|
}
|
|
88
|
-
// Update the auto-handoff config. Mirrors into
|
|
185
|
+
// Update the auto-handoff config. Mirrors into config so the client
|
|
89
186
|
// receives the updated config on next rehydrate. The compaction count of
|
|
90
187
|
// the current conversation is kept: lowering N to or below it hands off at
|
|
91
188
|
// the next turn boundary. A malformed value is ignored. The 0.1.4
|
|
92
189
|
// percentages the tab already has are kept when the update leaves them out.
|
|
93
|
-
const previous =
|
|
190
|
+
const previous = config.autoHandoff;
|
|
94
191
|
const raw = msg.autoHandoff;
|
|
95
192
|
const autoHandoff = raw === undefined ? undefined
|
|
96
193
|
: normalizeAutoHandoff(raw && typeof raw === 'object' ? { warnAt: previous?.warnAt, autoAt: previous?.autoAt, ...raw } : raw);
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const live = deriveAutoHandoff(wf.config);
|
|
194
|
+
const applyAutoHandoff = () => {
|
|
195
|
+
const live = deriveAutoHandoff(config);
|
|
100
196
|
wf.autoHandoff = { ...live, compactions: wf.autoHandoff?.compactions ?? 0, session: wf.autoHandoff?.session, fired: wf.autoHandoff?.fired ?? false };
|
|
101
|
-
|
|
197
|
+
};
|
|
198
|
+
if (autoHandoff) {
|
|
199
|
+
config.autoHandoff = autoHandoff;
|
|
200
|
+
if (nativeAccount === undefined)
|
|
201
|
+
applyAutoHandoff();
|
|
202
|
+
console.log(`[arco] [${msg.workflowId.slice(0, 8)}] auto-handoff updated → enabled=${autoHandoff.enabled} after=${autoHandoff.afterCompactions} compactions`);
|
|
102
203
|
}
|
|
103
204
|
// §2.1 — auto-fold config. Mirror into the live state (deriveAutoFold carries
|
|
104
205
|
// the runtime fired/anti-thrash counters) so the next post-turn check honors
|
|
105
206
|
// it without a reload.
|
|
106
207
|
if (msg.autoFold !== undefined) {
|
|
107
|
-
|
|
108
|
-
|
|
208
|
+
config.autoFold = { ...msg.autoFold };
|
|
209
|
+
if (nativeAccount === undefined)
|
|
210
|
+
wf.autoFold = deriveAutoFold(config);
|
|
109
211
|
console.log(`[arco] [${msg.workflowId.slice(0, 8)}] auto-fold updated → enabled=${msg.autoFold.enabled} foldAt=${msg.autoFold.foldAt}%`);
|
|
110
212
|
}
|
|
111
213
|
// docs/GOTCHAS.md - arm / re-arm / disarm the north-star auto-continue.
|
|
@@ -116,10 +218,10 @@ export async function handleUpdatePrimaryConfig(ws, session, msg) {
|
|
|
116
218
|
if (msg.goalRun !== undefined) {
|
|
117
219
|
const next = proposedGoalRun;
|
|
118
220
|
if (next.enabled) {
|
|
119
|
-
|
|
221
|
+
config.goalRun = next;
|
|
120
222
|
}
|
|
121
223
|
else {
|
|
122
|
-
delete
|
|
224
|
+
delete config.goalRun;
|
|
123
225
|
}
|
|
124
226
|
goalRunBroadcast = next;
|
|
125
227
|
console.log(`[arco] [${msg.workflowId.slice(0, 8)}] goal run ${next.enabled ? `armed → ${next.total} iteration(s)` : 'disarmed'}`);
|
|
@@ -128,7 +230,7 @@ export async function handleUpdatePrimaryConfig(ws, session, msg) {
|
|
|
128
230
|
// read it) so the toggle survives a provider swap on the same tab. Takes
|
|
129
231
|
// effect on the next message — each turn recomputes chatWebArmed().
|
|
130
232
|
if (msg.chatWebAccess !== undefined) {
|
|
131
|
-
|
|
233
|
+
config.chatWebAccess = msg.chatWebAccess;
|
|
132
234
|
console.log(`[arco] [${msg.workflowId.slice(0, 8)}] chat.web updated → ${msg.chatWebAccess ? 'armed' : 'off'}`);
|
|
133
235
|
}
|
|
134
236
|
// Phase 6e — per-tab Codex transport. handleUserMessage prefers this over
|
|
@@ -137,45 +239,27 @@ export async function handleUpdatePrimaryConfig(ws, session, msg) {
|
|
|
137
239
|
// provider so a Handoff that swaps from claude→codex on the same tab still
|
|
138
240
|
// sees the operator's pinned choice.
|
|
139
241
|
if (msg.codexTransport !== undefined) {
|
|
140
|
-
|
|
242
|
+
config.codexTransport = msg.codexTransport;
|
|
141
243
|
console.log(`[arco] [${msg.workflowId.slice(0, 8)}] codex.transport updated → ${msg.codexTransport}`);
|
|
142
244
|
}
|
|
143
245
|
if (msg.codexContextPolicy !== undefined) {
|
|
144
|
-
|
|
246
|
+
config.codexContextPolicy = msg.codexContextPolicy;
|
|
145
247
|
console.log(`[arco] [${msg.workflowId.slice(0, 8)}] codex.context updated → ${msg.codexContextPolicy}`);
|
|
146
248
|
}
|
|
147
249
|
// Phase 7a — same shape for Claude. Honored only on Claude tabs but written
|
|
148
250
|
// unconditionally so a Handoff that swaps from codex→claude on the same
|
|
149
251
|
// tab still sees the operator's pinned choice.
|
|
150
|
-
if (msg.claudeTransport !== undefined) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
// transcript truth is events.jsonl; watching a stale CLI file painted
|
|
154
|
-
// calibration-probe entries over real answers). A live
|
|
155
|
-
// swap must move the watcher NOW, not at the next restart: stop it on the
|
|
156
|
-
// native direction, (re)start it on the cli direction — nothing on the
|
|
157
|
-
// normal turn path starts it (only create/rehydrate and handoff rotation
|
|
158
|
-
// do), so without this a cli→native→cli round trip leaves it dead.
|
|
159
|
-
if (msg.claudeTransport === 'native') {
|
|
160
|
-
if (wf.sessionWatcher) {
|
|
161
|
-
try {
|
|
162
|
-
wf.sessionWatcher();
|
|
163
|
-
}
|
|
164
|
-
catch { /* already disposed */ }
|
|
165
|
-
wf.sessionWatcher = null;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
else if (wf.config.workingDirectory) {
|
|
169
|
-
startSessionWatcher(msg.workflowId, wf, wf.config.workingDirectory, ws);
|
|
170
|
-
}
|
|
252
|
+
if (msg.claudeTransport !== undefined && nativeAccount === undefined) {
|
|
253
|
+
config.claudeTransport = msg.claudeTransport;
|
|
254
|
+
applyClaudeTransportWatcher(ws, msg.workflowId, wf);
|
|
171
255
|
console.log(`[arco] [${msg.workflowId.slice(0, 8)}] claude.transport updated → ${msg.claudeTransport}`);
|
|
172
256
|
}
|
|
173
257
|
// docs/PROVIDERS.md - sticky ultracode toggle. We deliberately do NOT mutate
|
|
174
|
-
//
|
|
258
|
+
// config.claudeTransport here: turnEngine forces 'cli' at turn time while
|
|
175
259
|
// this is on, so the stored base transport stays intact and restores itself
|
|
176
260
|
// when ultracode flips off. Takes effect on the next turn; reversible.
|
|
177
261
|
if (msg.ultracode !== undefined) {
|
|
178
|
-
|
|
262
|
+
config.ultracode = msg.ultracode;
|
|
179
263
|
console.log(`[arco] [${msg.workflowId.slice(0, 8)}] ultracode → ${msg.ultracode ? 'ON (CLI + Workflow + xhigh forced next turn)' : 'OFF'}`);
|
|
180
264
|
}
|
|
181
265
|
// Per-tab Claude Native web budget (server-tool max_uses). Clamp to a sane
|
|
@@ -183,74 +267,74 @@ export async function handleUpdatePrimaryConfig(ws, session, msg) {
|
|
|
183
267
|
// posture picker is for — keep at least 1. Takes effect next turn.
|
|
184
268
|
if (msg.webSearchMaxUses !== undefined) {
|
|
185
269
|
const clamped = Math.max(1, Math.min(50, Math.round(msg.webSearchMaxUses)));
|
|
186
|
-
|
|
270
|
+
config.webSearchMaxUses = clamped;
|
|
187
271
|
console.log(`[arco] [${msg.workflowId.slice(0, 8)}] web search budget → ${clamped}/turn`);
|
|
188
272
|
}
|
|
189
273
|
// Phase 7c-followup — Claude Native server-side compaction. Honored on
|
|
190
274
|
// Native tabs only, but stored unconditionally so a transport flip
|
|
191
275
|
// back to Native picks up the operator's last pinned value.
|
|
192
276
|
if (msg.claudeNativeCompact !== undefined) {
|
|
193
|
-
|
|
277
|
+
config.claudeNativeCompact = msg.claudeNativeCompact;
|
|
194
278
|
console.log(`[arco] [${msg.workflowId.slice(0, 8)}] claude.native.compact updated → ${msg.claudeNativeCompact}`);
|
|
195
279
|
}
|
|
196
280
|
if (msg.claudeNativeForceInterleavedThinkingBeta !== undefined) {
|
|
197
|
-
|
|
281
|
+
config.claudeNativeForceInterleavedThinkingBeta = msg.claudeNativeForceInterleavedThinkingBeta;
|
|
198
282
|
console.log(`[arco] [${msg.workflowId.slice(0, 8)}] claude.native.force-interleaved-beta updated → ${msg.claudeNativeForceInterleavedThinkingBeta}`);
|
|
199
283
|
}
|
|
200
284
|
// Native Task defaults are captured at the next parent turn.
|
|
201
285
|
if (msg.nativeSubagents !== undefined) {
|
|
202
286
|
if (msg.nativeSubagents === null)
|
|
203
|
-
delete
|
|
287
|
+
delete config.nativeSubagents;
|
|
204
288
|
else
|
|
205
|
-
|
|
289
|
+
config.nativeSubagents = sanitizeNativeSubagents(msg.nativeSubagents);
|
|
206
290
|
}
|
|
207
291
|
// Adaptive-thinking display. Stored unconditionally so a CLI→Native
|
|
208
292
|
// transport flip picks up the operator's last pinned value; only the
|
|
209
293
|
// Native worker's buildThinkingParams reads it. Takes effect next turn.
|
|
210
294
|
if (msg.claudeNativeThinkingDisplay !== undefined) {
|
|
211
|
-
|
|
295
|
+
config.claudeNativeThinkingDisplay = msg.claudeNativeThinkingDisplay;
|
|
212
296
|
console.log(`[arco] [${msg.workflowId.slice(0, 8)}] claude.native.thinking-display updated → ${msg.claudeNativeThinkingDisplay}`);
|
|
213
297
|
}
|
|
214
298
|
// NATIVE_COMPACTION_PLAN Phase 3 — opt-in auto-continue after compaction.
|
|
215
299
|
// Stored unconditionally so a transport flip back to Native picks up the
|
|
216
300
|
// operator's last pinned value; only the Native compaction paths read it.
|
|
217
301
|
if (msg.nativeCompactAutoContinue !== undefined) {
|
|
218
|
-
|
|
302
|
+
config.nativeCompactAutoContinue = msg.nativeCompactAutoContinue;
|
|
219
303
|
console.log(`[arco] [${msg.workflowId.slice(0, 8)}] native.compact.auto-continue updated → ${msg.nativeCompactAutoContinue}`);
|
|
220
304
|
}
|
|
221
305
|
// docs/PROVIDERS.md - Native tool-result filter mode. Stored
|
|
222
306
|
// unconditionally so a CLI→Native transport flip picks up the operator's
|
|
223
307
|
// last pinned value; only honored on Native turns at handleUserMessage.
|
|
224
308
|
if (msg.efficiencyToolFilter !== undefined) {
|
|
225
|
-
|
|
309
|
+
config.efficiencyToolFilter = msg.efficiencyToolFilter;
|
|
226
310
|
console.log(`[arco] [${msg.workflowId.slice(0, 8)}] efficiency.tool-filter updated → ${msg.efficiencyToolFilter}`);
|
|
227
311
|
}
|
|
228
312
|
// docs/PROVIDERS.md - fact-force first-edit gate. Stored
|
|
229
313
|
// unconditionally so a CLI→Native transport flip picks up the operator's
|
|
230
314
|
// last pinned value; only honored on Native turns at handleUserMessage.
|
|
231
315
|
if (msg.efficiencyFactForce !== undefined) {
|
|
232
|
-
|
|
316
|
+
config.efficiencyFactForce = msg.efficiencyFactForce;
|
|
233
317
|
console.log(`[arco] [${msg.workflowId.slice(0, 8)}] efficiency.fact-force updated → ${msg.efficiencyFactForce}`);
|
|
234
318
|
}
|
|
235
319
|
// Config-protection write-gate. Stored unconditionally so a CLI→Native
|
|
236
320
|
// transport flip picks up the operator's last pinned value; only honored
|
|
237
321
|
// on Native turns (the gate lives in the Native worker's dispatchTool).
|
|
238
322
|
if (msg.efficiencyConfigProtection !== undefined) {
|
|
239
|
-
|
|
323
|
+
config.efficiencyConfigProtection = msg.efficiencyConfigProtection;
|
|
240
324
|
console.log(`[arco] [${msg.workflowId.slice(0, 8)}] efficiency.config-protection updated → ${msg.efficiencyConfigProtection}`);
|
|
241
325
|
}
|
|
242
326
|
// docs/PROVIDERS.md - opt-in sandbox tools. Stored
|
|
243
327
|
// unconditionally so a CLI→Native flip picks up the last pinned
|
|
244
328
|
// value; honored only on Native turns at handleUserMessage.
|
|
245
329
|
if (msg.efficiencySandbox !== undefined) {
|
|
246
|
-
|
|
330
|
+
config.efficiencySandbox = msg.efficiencySandbox;
|
|
247
331
|
console.log(`[arco] [${msg.workflowId.slice(0, 8)}] efficiency.sandbox updated → ${msg.efficiencySandbox}`);
|
|
248
332
|
}
|
|
249
333
|
// docs/PROVIDERS.md - operator-armed durable review gate. Stored unconditionally
|
|
250
334
|
// so a transport flip picks up the last pinned value; honored only on Native
|
|
251
335
|
// turns (the gate lives in the Native worker's dispatchTool).
|
|
252
336
|
if (msg.reviewSafeMode !== undefined) {
|
|
253
|
-
|
|
337
|
+
config.reviewSafeMode = msg.reviewSafeMode;
|
|
254
338
|
console.log(`[arco] [${msg.workflowId.slice(0, 8)}] review-safe-mode updated → ${msg.reviewSafeMode}`);
|
|
255
339
|
}
|
|
256
340
|
// docs/PROVIDERS.md - operator-armed terseness picker. Stored
|
|
@@ -260,12 +344,12 @@ export async function handleUpdatePrimaryConfig(ws, session, msg) {
|
|
|
260
344
|
// so 0.1.4 never reads a value it does not know.
|
|
261
345
|
const outputStyle = msg.outputStyle !== undefined ? normalizeOutputStyle(msg.outputStyle) : undefined;
|
|
262
346
|
if (outputStyle) {
|
|
263
|
-
|
|
347
|
+
config.outputStyle = outputStyle;
|
|
264
348
|
console.log(`[arco] [${msg.workflowId.slice(0, 8)}] output-style updated → ${outputStyle}`);
|
|
265
349
|
}
|
|
266
350
|
// docs/GOTCHAS.md - operator-set persistent north-star. Trim + byte-cap;
|
|
267
351
|
// empty / whitespace-only ⇒ clear (delete the field so pre-feature meta.json
|
|
268
|
-
// stays byte-clean). We mutate
|
|
352
|
+
// stays byte-clean). We mutate config now (the next turn reads it) but DEFER
|
|
269
353
|
// the goal_set broadcast until AFTER the meta.json write below — persist-then-
|
|
270
354
|
// announce, so "goal_set observed ⇒ value already durable" holds and a client
|
|
271
355
|
// (or the smoke) that reads meta.json on the event never races the disk write.
|
|
@@ -275,56 +359,25 @@ export async function handleUpdatePrimaryConfig(ws, session, msg) {
|
|
|
275
359
|
if (msg.goal !== undefined) {
|
|
276
360
|
const capped = capGoal(msg.goal);
|
|
277
361
|
if (capped)
|
|
278
|
-
|
|
362
|
+
config.goal = capped;
|
|
279
363
|
else
|
|
280
|
-
delete
|
|
364
|
+
delete config.goal;
|
|
281
365
|
goalBroadcast = { goal: capped || null, byteLen: capped ? Buffer.byteLength(capped, 'utf8') : 0 };
|
|
282
366
|
}
|
|
283
|
-
// Standing skill pins are a whole-set replacement. Resolve before persisting
|
|
284
|
-
// so malformed / missing references never become durable config, and report
|
|
285
|
-
// current prompt bytes for cost visibility. Bodies remain on disk and are
|
|
286
|
-
// re-read at every turn; this snapshot is only the pin acknowledgement.
|
|
287
|
-
let pinnedSkillsBroadcast;
|
|
288
|
-
if (msg.pinnedSkills !== undefined) {
|
|
289
|
-
const requested = uniqueSkillRefs((Array.isArray(msg.pinnedSkills) ? msg.pinnedSkills : []).filter(ref => ref && (ref.scope === 'project' || ref.scope === 'global') && isValidSlug(ref.slug)));
|
|
290
|
-
let resolved;
|
|
291
|
-
try {
|
|
292
|
-
resolved = await withClusterSkillLock(msg.workflowId, async () => {
|
|
293
|
-
await assertWorkflowSkillPins(msg.workflowId, wf.config.workingDirectory, requested);
|
|
294
|
-
const result = await resolvePinnedSkills(requested, wf.config.workingDirectory);
|
|
295
|
-
const refs = result.skills.map(s => ({ scope: s.scope, slug: s.slug }));
|
|
296
|
-
if (refs.length)
|
|
297
|
-
wf.config.pinnedSkills = refs;
|
|
298
|
-
else
|
|
299
|
-
delete wf.config.pinnedSkills;
|
|
300
|
-
return result;
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
catch (err) {
|
|
304
|
-
send(ws, { type: 'error', workflowId: msg.workflowId, message: err instanceof Error ? err.message : String(err) });
|
|
305
|
-
return;
|
|
306
|
-
}
|
|
307
|
-
const block = buildPinnedSkillsBlock(resolved.skills);
|
|
308
|
-
pinnedSkillsBroadcast = {
|
|
309
|
-
skills: resolved.skills.map((s) => ({ scope: s.scope, slug: s.slug, name: s.name })),
|
|
310
|
-
bytes: block.bytes,
|
|
311
|
-
missing: [...resolved.missing, ...resolved.truncated],
|
|
312
|
-
};
|
|
313
|
-
}
|
|
314
367
|
// REMOTE_MANAGEMENT.md §1.4 — per-workflow hub opt-in (`REMOTE CONTINUATION`).
|
|
315
368
|
// Default OFF. Flipping it re-pushes the hub snapshot + re-broadcasts
|
|
316
369
|
// hub_link_status below so the VPS console and the header monitored-count
|
|
317
370
|
// update immediately.
|
|
318
371
|
let remoteEnabledChanged = false;
|
|
319
|
-
if (msg.remoteEnabled !== undefined && msg.remoteEnabled !==
|
|
320
|
-
|
|
372
|
+
if (msg.remoteEnabled !== undefined && msg.remoteEnabled !== config.remoteEnabled) {
|
|
373
|
+
config.remoteEnabled = msg.remoteEnabled;
|
|
321
374
|
remoteEnabledChanged = true;
|
|
322
375
|
console.log(`[arco] [${msg.workflowId.slice(0, 8)}] remote-enabled updated → ${msg.remoteEnabled}`);
|
|
323
376
|
}
|
|
324
377
|
// R1 §9.2 — remote-gates arming shares remoteEnabled's re-push semantics so
|
|
325
378
|
// the console's gate buttons track the flip without waiting for the 4s tick.
|
|
326
|
-
if (msg.remoteGatesEnabled !== undefined && msg.remoteGatesEnabled !==
|
|
327
|
-
|
|
379
|
+
if (msg.remoteGatesEnabled !== undefined && msg.remoteGatesEnabled !== config.remoteGatesEnabled) {
|
|
380
|
+
config.remoteGatesEnabled = msg.remoteGatesEnabled;
|
|
328
381
|
remoteEnabledChanged = true;
|
|
329
382
|
console.log(`[arco] [${msg.workflowId.slice(0, 8)}] remote-gates updated → ${msg.remoteGatesEnabled}`);
|
|
330
383
|
}
|
|
@@ -340,7 +393,7 @@ export async function handleUpdatePrimaryConfig(ws, session, msg) {
|
|
|
340
393
|
// way the effort switch is logged. The next Ollama turn re-prefills its
|
|
341
394
|
// prompt (one-time cost the operator opted into).
|
|
342
395
|
if (msg.ollamaParams !== undefined) {
|
|
343
|
-
|
|
396
|
+
config.ollamaParams = msg.ollamaParams;
|
|
344
397
|
const keys = Object.keys(msg.ollamaParams).join(', ') || '(cleared)';
|
|
345
398
|
console.log(`[arco] [${msg.workflowId.slice(0, 8)}] ollama.params updated → ${keys} (prefix cache invalidates next turn)`);
|
|
346
399
|
}
|
|
@@ -348,12 +401,14 @@ export async function handleUpdatePrimaryConfig(ws, session, msg) {
|
|
|
348
401
|
// change; fields on WorkflowConfig and PrimaryConfig are the source of
|
|
349
402
|
// truth together (derivePrimaryConfig reads from config).
|
|
350
403
|
if (msg.model !== undefined)
|
|
351
|
-
|
|
404
|
+
config.primaryModel = msg.model;
|
|
352
405
|
if (msg.effort !== undefined)
|
|
353
|
-
|
|
354
|
-
const cwd =
|
|
406
|
+
config.primaryEffort = msg.effort;
|
|
407
|
+
const cwd = config.workingDirectory;
|
|
355
408
|
const hasOtherConfig = Object.keys(msg).some((key) => key !== 'type' && key !== 'workflowId' && key !== 'autoCompaction');
|
|
356
|
-
if (
|
|
409
|
+
if (nativeAccount !== undefined && workflows.get(msg.workflowId) !== wf)
|
|
410
|
+
return;
|
|
411
|
+
if (cwd && hasOtherConfig && !config.incognito) {
|
|
357
412
|
try {
|
|
358
413
|
const saved = await updateMeta(cwd, msg.workflowId, (meta) => {
|
|
359
414
|
if (msg.model !== undefined)
|
|
@@ -361,7 +416,7 @@ export async function handleUpdatePrimaryConfig(ws, session, msg) {
|
|
|
361
416
|
if (msg.effort !== undefined)
|
|
362
417
|
meta.primaryEffort = msg.effort;
|
|
363
418
|
if (msg.providerAccountRef !== undefined)
|
|
364
|
-
meta.providerAccountRef =
|
|
419
|
+
meta.providerAccountRef = config.providerAccountRef;
|
|
365
420
|
if (autoHandoff)
|
|
366
421
|
meta.autoHandoff = { ...autoHandoff };
|
|
367
422
|
if (msg.autoFold !== undefined)
|
|
@@ -370,12 +425,14 @@ export async function handleUpdatePrimaryConfig(ws, session, msg) {
|
|
|
370
425
|
meta.codexTransport = msg.codexTransport;
|
|
371
426
|
if (msg.codexContextPolicy !== undefined)
|
|
372
427
|
meta.codexContextPolicy = msg.codexContextPolicy;
|
|
373
|
-
if (msg.claudeTransport !== undefined)
|
|
374
|
-
meta.claudeTransport =
|
|
428
|
+
if (nativeAccount !== undefined || msg.claudeTransport !== undefined)
|
|
429
|
+
meta.claudeTransport = config.claudeTransport;
|
|
430
|
+
if (nativeAccount !== undefined && msg.autoCompaction !== undefined)
|
|
431
|
+
meta.autoCompaction = config.autoCompaction;
|
|
375
432
|
if (msg.ultracode !== undefined)
|
|
376
433
|
meta.ultracode = msg.ultracode;
|
|
377
434
|
if (msg.webSearchMaxUses !== undefined)
|
|
378
|
-
meta.webSearchMaxUses =
|
|
435
|
+
meta.webSearchMaxUses = config.webSearchMaxUses;
|
|
379
436
|
if (msg.chatWebAccess !== undefined)
|
|
380
437
|
meta.chatWebAccess = msg.chatWebAccess;
|
|
381
438
|
if (msg.claudeNativeCompact !== undefined) {
|
|
@@ -393,7 +450,7 @@ export async function handleUpdatePrimaryConfig(ws, session, msg) {
|
|
|
393
450
|
if (msg.nativeSubagents === null)
|
|
394
451
|
delete meta.nativeSubagents;
|
|
395
452
|
else
|
|
396
|
-
meta.nativeSubagents =
|
|
453
|
+
meta.nativeSubagents = config.nativeSubagents;
|
|
397
454
|
}
|
|
398
455
|
if (msg.claudeNativeThinkingDisplay !== undefined)
|
|
399
456
|
meta.claudeNativeThinkingDisplay = msg.claudeNativeThinkingDisplay;
|
|
@@ -412,7 +469,7 @@ export async function handleUpdatePrimaryConfig(ws, session, msg) {
|
|
|
412
469
|
if (outputStyle)
|
|
413
470
|
meta.outputStyle = storedOutputStyle(outputStyle);
|
|
414
471
|
if (msg.goal !== undefined) {
|
|
415
|
-
// Mirror the
|
|
472
|
+
// Mirror the config decision above: capped text persists, blank clears.
|
|
416
473
|
const capped = capGoal(msg.goal);
|
|
417
474
|
if (capped)
|
|
418
475
|
meta.goal = capped;
|
|
@@ -420,8 +477,8 @@ export async function handleUpdatePrimaryConfig(ws, session, msg) {
|
|
|
420
477
|
delete meta.goal;
|
|
421
478
|
}
|
|
422
479
|
if (msg.pinnedSkills !== undefined) {
|
|
423
|
-
if (
|
|
424
|
-
meta.pinnedSkills =
|
|
480
|
+
if (config.pinnedSkills?.length) {
|
|
481
|
+
meta.pinnedSkills = config.pinnedSkills.map((s) => ({ ...s }));
|
|
425
482
|
}
|
|
426
483
|
else {
|
|
427
484
|
delete meta.pinnedSkills;
|
|
@@ -440,16 +497,37 @@ export async function handleUpdatePrimaryConfig(ws, session, msg) {
|
|
|
440
497
|
}
|
|
441
498
|
catch (err) {
|
|
442
499
|
console.error(`[arco] [${msg.workflowId.slice(0, 8)}] update_primary_config meta write failed:`, err);
|
|
500
|
+
if (nativeAccount !== undefined) {
|
|
501
|
+
throw new Error('Workflow settings could not be saved. The previous account and settings are still active.');
|
|
502
|
+
}
|
|
443
503
|
const message = 'Workflow settings could not be saved. Changes are temporary for this running tab and may be lost after restart. Retry the save when storage is available.';
|
|
444
504
|
send(ws, { type: 'error', workflowId: msg.workflowId, message });
|
|
445
505
|
broadcastWorkflow(msg.workflowId, { type: 'system_notice', workflowId: msg.workflowId, content: message });
|
|
446
506
|
if (!wf.bootMaterialized)
|
|
447
|
-
broadcastTransient(msg.workflowId, { type: 'workflow_config_synced', workflowId: msg.workflowId, config
|
|
507
|
+
broadcastTransient(msg.workflowId, { type: 'workflow_config_synced', workflowId: msg.workflowId, config });
|
|
448
508
|
if (remoteEnabledChanged)
|
|
449
509
|
refreshHubReporting();
|
|
450
510
|
return;
|
|
451
511
|
}
|
|
452
512
|
}
|
|
513
|
+
if (nativeAccount !== undefined) {
|
|
514
|
+
if (workflows.get(msg.workflowId) !== wf)
|
|
515
|
+
return;
|
|
516
|
+
wf.config = config;
|
|
517
|
+
wf.primary = primary;
|
|
518
|
+
if (autoHandoff)
|
|
519
|
+
applyAutoHandoff();
|
|
520
|
+
if (msg.autoFold !== undefined)
|
|
521
|
+
wf.autoFold = deriveAutoFold(config);
|
|
522
|
+
applyClaudeTransportWatcher(ws, msg.workflowId, wf);
|
|
523
|
+
await disposeProviderResources(msg.workflowId).catch((err) => {
|
|
524
|
+
console.error('Could not dispose previous provider resources:', err);
|
|
525
|
+
});
|
|
526
|
+
if (msg.autoCompaction !== undefined && (config.autoCompaction?.enabled !== previousCompaction?.enabled
|
|
527
|
+
|| config.autoCompaction?.thresholdPercent !== previousCompaction?.thresholdPercent)) {
|
|
528
|
+
announceAutoCompaction(msg.workflowId, config.autoCompaction);
|
|
529
|
+
}
|
|
530
|
+
}
|
|
453
531
|
// Persist-then-announce (see the north-star note above): the meta.json write
|
|
454
532
|
// is durable now, so emit the goal_set event. Storage failures return above with an explicit temporary-setting notice.
|
|
455
533
|
if (goalBroadcast) {
|
|
@@ -498,8 +576,33 @@ export async function handleUpdatePrimaryConfig(ws, session, msg) {
|
|
|
498
576
|
// config replayed after later non-config edits would regress the job; a
|
|
499
577
|
// reconnecting browser takes the live config from workspace_snapshot instead.
|
|
500
578
|
if (!wf.bootMaterialized) {
|
|
501
|
-
broadcastTransient(msg.workflowId, { type: 'workflow_config_synced', workflowId: msg.workflowId, config
|
|
579
|
+
broadcastTransient(msg.workflowId, { type: 'workflow_config_synced', workflowId: msg.workflowId, config });
|
|
580
|
+
}
|
|
581
|
+
console.log(`[arco] [${msg.workflowId.slice(0, 8)}] primary updated → ${primary.provider}:${primary.model}@${primary.effort}`);
|
|
582
|
+
}
|
|
583
|
+
function announceAutoCompaction(workflowId, next) {
|
|
584
|
+
broadcastWorkflow(workflowId, { type: 'system_notice', workflowId,
|
|
585
|
+
content: next ? `[AUTO-COMPACT] Worker policy ${next.enabled ? `enabled at ${next.thresholdPercent}%` : 'disabled'}.` : '[AUTO-COMPACT] Worker policy cleared; cluster or legacy behavior applies.' });
|
|
586
|
+
}
|
|
587
|
+
function applyClaudeTransportWatcher(ws, workflowId, wf) {
|
|
588
|
+
// The CLI-session JSONL watcher is CLI-transport-only (a Native tab's
|
|
589
|
+
// transcript truth is events.jsonl; watching a stale CLI file painted
|
|
590
|
+
// calibration-probe entries over real answers). A live
|
|
591
|
+
// swap must move the watcher NOW, not at the next restart: stop it on the
|
|
592
|
+
// native direction, (re)start it on the cli direction — nothing on the
|
|
593
|
+
// normal turn path starts it (only create/rehydrate and handoff rotation
|
|
594
|
+
// do), so without this a cli→native→cli round trip leaves it dead.
|
|
595
|
+
if (wf.config.claudeTransport === 'native') {
|
|
596
|
+
if (wf.sessionWatcher) {
|
|
597
|
+
try {
|
|
598
|
+
wf.sessionWatcher();
|
|
599
|
+
}
|
|
600
|
+
catch { /* already disposed */ }
|
|
601
|
+
wf.sessionWatcher = null;
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
else if (wf.config.workingDirectory) {
|
|
605
|
+
startSessionWatcher(workflowId, wf, wf.config.workingDirectory, ws);
|
|
502
606
|
}
|
|
503
|
-
console.log(`[arco] [${msg.workflowId.slice(0, 8)}] primary updated → ${wf.primary.provider}:${wf.primary.model}@${wf.primary.effort}`);
|
|
504
607
|
}
|
|
505
608
|
//# sourceMappingURL=updatePrimaryConfig.js.map
|