arco-workbench 0.2.2 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +1 -1
- package/THIRD_PARTY_NOTICES +2 -2
- package/client/dist/assets/{PhosphorBackdrop-BbR3xmfD.js → PhosphorBackdrop-CLILIwOQ.js} +1 -1
- package/client/dist/assets/{ThemedBackgroundShaderImpl-UMjbs9ZN.js → ThemedBackgroundShaderImpl-B87chcb5.js} +1 -1
- package/client/dist/assets/{XtermView-n135qz-f.js → XtermView-BP_j7WSN.js} +1 -1
- package/client/dist/assets/{galleryEditor-CFSke4by.js → galleryEditor-B90phoBI.js} +1 -1
- package/client/dist/assets/{index-DeoJbjI3.js → index-BfPp1Oup.js} +270 -270
- package/client/dist/index.html +1 -1
- package/client/dist/manifest-mobile.webmanifest +1 -0
- 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 +7 -11
- 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/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/research/QuickResearchOverview.tsx +7 -3
- package/client/src/components/research/SavedQuickKeep.tsx +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 +6 -3
- package/client/src/help/content/misc.tsx +9 -7
- package/client/src/help/content/rightPanel.tsx +11 -6
- package/client/src/help/content/settings.tsx +14 -3
- 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 +21 -15
- 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 +24 -0
- package/client/src/help/manualSections/powerFeatures.tsx +4 -2
- 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 +14 -5
- package/client/src/main.tsx +2 -0
- 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/CHECKPOINTS.md +67 -3
- package/docs/CLIENT.md +11 -6
- 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 +63 -30
- package/docs/OPERATIONS.md +11 -0
- 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 +47 -10
- package/docs/RESEARCH.md +3 -3
- 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/explorerDocs.d.ts +1 -0
- package/server/dist/explorerDocs.js +4 -4
- package/server/dist/geminiMembers.d.ts +7 -1
- package/server/dist/geminiMembers.js +28 -14
- package/server/dist/gitSnapshots.d.ts +1 -0
- package/server/dist/gitSnapshots.js +547 -83
- package/server/dist/http/clusterRoutes.js +9 -3
- 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 +41 -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/providers/codexChatBoundary.js +6 -1
- package/server/dist/research/quickPromotion.d.ts +3 -0
- package/server/dist/research/quickPromotion.js +26 -9
- package/server/dist/research/savedQuickPromotion.js +2 -11
- 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/turnChanges.d.ts +1 -1
- package/server/dist/turnChanges.js +5 -4
- 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 +37 -19
- 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/explorerDocs.ts +5 -5
- package/server/src/geminiMembers.ts +26 -15
- package/server/src/gitSnapshots.ts +538 -82
- package/server/src/http/clusterRoutes.ts +10 -3
- 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 +39 -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/providers/codexChatBoundary.ts +6 -1
- package/server/src/research/quickPromotion.ts +24 -6
- package/server/src/research/savedQuickPromotion.ts +2 -8
- 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/turnChanges.ts +5 -4
- 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 +36 -18
- 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
|
@@ -3,7 +3,7 @@ import { spawnSync } from 'node:child_process';
|
|
|
3
3
|
import { closeSync, cpSync, existsSync, lstatSync, mkdtempSync, mkdirSync, openSync, readFileSync, renameSync, rmSync, unlinkSync, writeFileSync } from 'node:fs';
|
|
4
4
|
import { basename, dirname, join, resolve } from 'node:path';
|
|
5
5
|
import { npmCliPath } from './native-repair.mjs';
|
|
6
|
-
import { readWindowsServicePid, runWindowsProbe, serviceAction, servicePaths } from './services.mjs';
|
|
6
|
+
import { linuxServiceState, readWindowsServicePid, runWindowsProbe, serviceAction, servicePaths } from './services.mjs';
|
|
7
7
|
|
|
8
8
|
export function compareVersions(a, b) {
|
|
9
9
|
const pattern = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
@@ -132,7 +132,15 @@ export async function updatePackage(manifest, packageRoot, deps = {}) {
|
|
|
132
132
|
const config = deps.config ?? servicePaths(platform, env).config;
|
|
133
133
|
const managed = deps.managed ?? existsSync(config);
|
|
134
134
|
const servicePid = platform === 'win32' && managed ? readWindowsServicePid(home) : null;
|
|
135
|
-
|
|
135
|
+
// On Linux, record whether the service ran before the stop. A stop can be
|
|
136
|
+
// canceled by another start or restart of the service while it waits.
|
|
137
|
+
const linuxState = platform === 'linux' && managed ? deps.serviceState ?? (deps.service ? null : () => linuxServiceState()) : null;
|
|
138
|
+
const before = linuxState ? await linuxState() : null;
|
|
139
|
+
if (managed) {
|
|
140
|
+
try { await service('stop'); }
|
|
141
|
+
catch (error) { if (linuxState) throw await afterFailedStop(error, before, linuxState, service, deps); throw error; }
|
|
142
|
+
stopped = true;
|
|
143
|
+
}
|
|
136
144
|
if (platform === 'win32') {
|
|
137
145
|
const running = servicePid ? await waitForRecordedPid(servicePid, deps) : await windowsRunning();
|
|
138
146
|
if (running) throw new Error(servicePid ? `The Arco service process ${servicePid} is still running. Stop it before updating on Windows.` : 'Stop all Arco processes before updating on Windows.');
|
|
@@ -191,6 +199,33 @@ export async function updatePackage(manifest, packageRoot, deps = {}) {
|
|
|
191
199
|
}
|
|
192
200
|
}
|
|
193
201
|
|
|
202
|
+
const settlingStates = new Set(['activating', 'deactivating', 'reloading', 'refreshing']);
|
|
203
|
+
// A failed stop leaves the package untouched. Wait a bounded time for queued
|
|
204
|
+
// service jobs to finish, then report the settled state. Start the service only
|
|
205
|
+
// when it was confirmed active before the update, is now stopped and no job is
|
|
206
|
+
// pending. An unread or transitional earlier state is reported, not acted on.
|
|
207
|
+
export async function afterFailedStop(error, before, readState, service, deps = {}) {
|
|
208
|
+
const now = deps.now ?? (() => performance.now());
|
|
209
|
+
const sleep = deps.sleep ?? ((ms) => new Promise((done) => setTimeout(done, ms)));
|
|
210
|
+
const deadline = now() + (deps.settleMs ?? 120_000);
|
|
211
|
+
let state = await readState();
|
|
212
|
+
while (state && (state.job || settlingStates.has(state.active)) && now() < deadline) {
|
|
213
|
+
await sleep(Math.max(0, Math.min(1000, deadline - now())));
|
|
214
|
+
state = await readState();
|
|
215
|
+
}
|
|
216
|
+
const cause = `${String(error.message).replace(/[.\s]+$/, '')}. The installed package was left unchanged`;
|
|
217
|
+
if (!state) return new Error(`${cause}. The service state could not be read. Run arco service status, and arco service start if Arco is stopped`);
|
|
218
|
+
if (state.active === 'active' && !state.job) return new Error(`${cause} and Arco is still running. The stop was canceled or did not finish, which happens when Arco is started or restarted during an update. Try the update again and do not start or restart Arco until it finishes`);
|
|
219
|
+
if ((state.active === 'inactive' || state.active === 'failed') && !state.job) {
|
|
220
|
+
if (before?.active === 'inactive' || before?.active === 'failed') return new Error(`${cause}. Arco was not running before the update and was left stopped`);
|
|
221
|
+
if (before?.active !== 'active') return new Error(`${cause}. Arco is stopped, and whether it ran before the update could not be confirmed, so it was not started. Run arco service status, and arco service start if Arco should be running`);
|
|
222
|
+
try { await service('start'); }
|
|
223
|
+
catch { return new Error(`${cause}. Arco is stopped and could not be started. Run arco service start`); }
|
|
224
|
+
return new Error(`${cause}. Arco was started again on the installed version. Try the update again`);
|
|
225
|
+
}
|
|
226
|
+
return new Error(`${cause}. The service is still ${state.active}${state.job ? ` with a pending ${state.job} job` : ''}, so it was not started or stopped again. Run arco service status, and arco service start if Arco stays stopped`);
|
|
227
|
+
}
|
|
228
|
+
|
|
194
229
|
export async function waitForRecordedPid(pid, deps = {}) {
|
|
195
230
|
const now = deps.now ?? (() => performance.now());
|
|
196
231
|
const sleep = deps.sleep ?? ((ms) => new Promise((done) => setTimeout(done, ms)));
|
|
@@ -2,6 +2,12 @@ import type { AttentionKind, NotificationChannels, NotificationChannelsView, Ser
|
|
|
2
2
|
export declare const MIN_FINISHED_TURN_MS = 15000;
|
|
3
3
|
export declare function _setChannelsPathForTest(p: string): void;
|
|
4
4
|
export declare function _setFetchForTest(f: typeof fetch): void;
|
|
5
|
+
/**
|
|
6
|
+
* A question or gate Arco announced before a restart and shows again now. It is
|
|
7
|
+
* marked seen so the restored card does not raise a second desktop or phone
|
|
8
|
+
* alert (the BELL entry and the phone message went out the first time).
|
|
9
|
+
*/
|
|
10
|
+
export declare function acknowledgeSighting(id: string): void;
|
|
5
11
|
export declare function loadChannels(): Promise<NotificationChannels>;
|
|
6
12
|
export declare function getChannels(): NotificationChannels;
|
|
7
13
|
export declare function saveChannels(value: unknown): Promise<NotificationChannels>;
|
package/server/dist/attention.js
CHANGED
|
@@ -37,6 +37,12 @@ function firstSighting(id) {
|
|
|
37
37
|
seenRequests.add(id);
|
|
38
38
|
return true;
|
|
39
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* A question or gate Arco announced before a restart and shows again now. It is
|
|
42
|
+
* marked seen so the restored card does not raise a second desktop or phone
|
|
43
|
+
* alert (the BELL entry and the phone message went out the first time).
|
|
44
|
+
*/
|
|
45
|
+
export function acknowledgeSighting(id) { firstSighting(id); }
|
|
40
46
|
export async function loadChannels() {
|
|
41
47
|
try {
|
|
42
48
|
const parsed = JSON.parse(await readFile(channelsPath, 'utf-8'));
|
package/server/dist/auth.d.ts
CHANGED
|
@@ -2,8 +2,10 @@ import type { LoginSessionTarget, AuthLoginTarget, AuthLoginResult, ClaudeCliAut
|
|
|
2
2
|
export interface AuthStatus {
|
|
3
3
|
loggedIn: boolean;
|
|
4
4
|
native?: ClaudeNativeAuthStatus;
|
|
5
|
+
nativeAccounts?: Record<string, ClaudeNativeAuthStatus>;
|
|
5
6
|
cli?: ClaudeCliAuthStatus;
|
|
6
7
|
probeFailed?: boolean;
|
|
8
|
+
githubState?: 'missing' | 'signed-out' | 'probe-failed';
|
|
7
9
|
email?: string;
|
|
8
10
|
subscriptionType?: string;
|
|
9
11
|
orgName?: string;
|
|
@@ -44,6 +46,9 @@ export interface AuthStatusByProvider {
|
|
|
44
46
|
'antigravity-cli'?: AuthStatus;
|
|
45
47
|
}
|
|
46
48
|
export declare function getClaudeAuthStatus(): Promise<AuthStatus>;
|
|
49
|
+
export declare function githubStatusFromProbe(stdout: string, stderr: string, failure?: {
|
|
50
|
+
code?: unknown;
|
|
51
|
+
}): AuthStatus;
|
|
47
52
|
export declare function getAuthStatus(): Promise<AuthStatusByProvider>;
|
|
48
53
|
export declare function getConnectionStatus(provider: AuthLoginTarget): Promise<AuthStatus>;
|
|
49
54
|
export declare function triggerAuthLogin(provider?: LoginSessionTarget, accountRef?: string): Promise<AuthLoginResult>;
|
package/server/dist/auth.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { readSettings } from './settings.js';
|
|
1
2
|
import { antigravityStatus } from './providers/antigravity/status.js';
|
|
2
3
|
import { authLoginInstructions } from './authLoginInstructions.js';
|
|
3
4
|
import { execFile } from 'child_process';
|
|
@@ -59,10 +60,15 @@ async function probeClaudeAuthStatus() {
|
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
62
|
export async function getClaudeAuthStatus() {
|
|
62
|
-
const [status, native] = await Promise.all([
|
|
63
|
+
const [status, native, settings] = await Promise.all([
|
|
63
64
|
probeClaudeAuthStatus().then(async (result) => result ?? await probeClaudeAuthStatus()),
|
|
64
65
|
getClaudeNativeAuthStatus(),
|
|
66
|
+
readSettings(),
|
|
65
67
|
]);
|
|
68
|
+
const legacyIds = new Set(settings.providerAccounts?.claude?.map(profile => profile.id));
|
|
69
|
+
const nativeAccounts = Object.fromEntries(await Promise.all((settings.providerAccounts?.claudeNative ?? [])
|
|
70
|
+
.filter(profile => !legacyIds.has(profile.id))
|
|
71
|
+
.map(async (profile) => [profile.id, await getClaudeNativeAuthStatus(profile.id)])));
|
|
66
72
|
const binding = await getCliUsageBinding();
|
|
67
73
|
const cli = status
|
|
68
74
|
? { ...status, binding, checkedAt: Date.now() }
|
|
@@ -71,40 +77,45 @@ export async function getClaudeAuthStatus() {
|
|
|
71
77
|
cli.bindingCheckedAt = Date.now();
|
|
72
78
|
if (status)
|
|
73
79
|
lastClaudeStatus = cli;
|
|
74
|
-
const nativeAvailable = native.credentialsPresent &&
|
|
80
|
+
const nativeAvailable = [native, ...Object.values(nativeAccounts)].some(account => account.credentialsPresent && account.state !== 'needs-attention');
|
|
75
81
|
const probeFailed = (cli.probeFailed && !nativeAvailable) || (native.probeFailed && !cli.loggedIn);
|
|
76
82
|
return {
|
|
77
|
-
native, cli,
|
|
83
|
+
native, cli, ...(Object.keys(nativeAccounts).length ? { nativeAccounts } : {}),
|
|
78
84
|
email: cli.email, subscriptionType: cli.subscriptionType, orgName: cli.orgName, apiProvider: cli.apiProvider,
|
|
79
85
|
loggedIn: cli.loggedIn || nativeAvailable,
|
|
80
86
|
probeFailed: probeFailed || undefined,
|
|
81
87
|
error: nativeAvailable ? undefined : cli.error ?? native.error,
|
|
82
88
|
};
|
|
83
89
|
}
|
|
84
|
-
//
|
|
85
|
-
//
|
|
86
|
-
|
|
87
|
-
|
|
90
|
+
// Human-readable gh status has appeared on either stream in supported versions.
|
|
91
|
+
// Never turn an unrecognized error or output into a signed-out verdict.
|
|
92
|
+
export function githubStatusFromProbe(stdout, stderr, failure) {
|
|
93
|
+
if (failure?.code === 'ENOENT')
|
|
94
|
+
return { loggedIn: false, githubState: 'missing', error: 'GitHub CLI was not found. Install gh in the Arco server environment, then check again.' };
|
|
95
|
+
const output = `${stdout}\n${stderr}`;
|
|
96
|
+
if (!failure) {
|
|
97
|
+
const account = output.match(/Logged in to \S+ (?:account|as) (\S+)/)?.[1];
|
|
98
|
+
if (account) {
|
|
99
|
+
const scopes = output.match(/Token scopes: (.+)/)?.[1];
|
|
100
|
+
return { loggedIn: true, email: account, apiProvider: 'github-cli', subscriptionType: scopes ? `gh (${scopes.replace(/'/g, '')})` : 'gh' };
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (/You are not logged into any (?:GitHub hosts|accounts)/i.test(output) || /Failed to log in to \S+ (?:account|using token)/i.test(output) && /token .* invalid/i.test(output)) {
|
|
104
|
+
return { loggedIn: false, githubState: 'signed-out', error: 'GitHub CLI is not signed in. Sign in, then check again.' };
|
|
105
|
+
}
|
|
106
|
+
return { loggedIn: false, githubState: 'probe-failed', probeFailed: true, error: 'GitHub CLI status could not be checked. Run gh auth status in the Arco server environment, then check again.' };
|
|
107
|
+
}
|
|
88
108
|
async function getGithubAuthStatus() {
|
|
89
109
|
try {
|
|
90
|
-
const { stdout } = await execFileAsync('gh', ['auth', 'status', '--active'], {
|
|
110
|
+
const { stdout, stderr } = await execFileAsync('gh', ['auth', 'status', '--active'], {
|
|
91
111
|
maxBuffer: 256 * 1024,
|
|
92
112
|
timeout: 10_000,
|
|
93
113
|
});
|
|
94
|
-
|
|
95
|
-
const scopes = stdout.match(/Token scopes: (.+)/)?.[1];
|
|
96
|
-
return {
|
|
97
|
-
loggedIn: Boolean(account),
|
|
98
|
-
email: account,
|
|
99
|
-
apiProvider: 'github-cli',
|
|
100
|
-
subscriptionType: scopes ? `gh (${scopes.replace(/'/g, '')})` : 'gh',
|
|
101
|
-
};
|
|
114
|
+
return githubStatusFromProbe(stdout, stderr);
|
|
102
115
|
}
|
|
103
116
|
catch (err) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
error: err instanceof Error && 'stderr' in err ? String(err.stderr).slice(0, 200) : 'gh auth status failed',
|
|
107
|
-
};
|
|
117
|
+
const failure = err;
|
|
118
|
+
return githubStatusFromProbe(failure.stdout ?? '', failure.stderr ?? '', failure);
|
|
108
119
|
}
|
|
109
120
|
}
|
|
110
121
|
// Ollama is auth-less — there's no login flow. The "loggedIn" semantics here
|
|
@@ -4,6 +4,10 @@ export declare const GEMINI_MAIL_SKIP = "Mail from a Gemini member waits for you
|
|
|
4
4
|
export declare const AUTO_TURN_COOLDOWN_MS: number;
|
|
5
5
|
export declare const AUTO_TURN_RATE_CAP_PER_MINUTE: number;
|
|
6
6
|
export declare const AUTO_TURN_MAX_CHAIN_DEPTH: number;
|
|
7
|
+
export declare const MEMBER_BLOCKED_NOTICE = "Its conversation is too large for the provider. Hand off or replace this member, then NUDGE it; its mail is kept.";
|
|
8
|
+
export declare function isOversizeError(error: string): boolean;
|
|
9
|
+
export declare function noteTurnOutcome(workflowId: string, error?: string | null): void;
|
|
10
|
+
export declare function isMemberBlocked(workflowId: string): boolean;
|
|
7
11
|
export declare function resumeRulePickup(clusterId: string): void;
|
|
8
12
|
export declare function resetRulePickup(clusterId: string): void;
|
|
9
13
|
export declare function interruptRulePickup(clusterId: string, member?: string): void;
|
|
@@ -56,7 +60,7 @@ export declare function debugRulePickup(opts: {
|
|
|
56
60
|
incomingChainDepth: number;
|
|
57
61
|
}): void;
|
|
58
62
|
export declare function smartChainDepthLimit(configured: number): number;
|
|
59
|
-
export declare function sharedGuardProblem(clusterId: string, recipientWfid: string, incomingChainDepth: number, now?: number, depthLimit?: number): 'depth_capped' | 'cooldown' | 'rate_capped' | null;
|
|
63
|
+
export declare function sharedGuardProblem(clusterId: string, recipientWfid: string, incomingChainDepth: number, now?: number, depthLimit?: number): 'depth_capped' | 'cooldown' | 'rate_capped' | 'member_blocked' | null;
|
|
60
64
|
export declare function stampSharedGuards(clusterId: string, recipientWfid: string, incomingChainDepth: number, now?: number): void;
|
|
61
65
|
export declare function _peekState(): {
|
|
62
66
|
clusters: Array<{
|
|
@@ -43,7 +43,7 @@ import { join } from 'node:path';
|
|
|
43
43
|
// outbound peer_message_sent.
|
|
44
44
|
import * as clusterStore from './clusterStore.js';
|
|
45
45
|
import * as clusterMailbox from './clusterMailbox.js';
|
|
46
|
-
import { isGeminiMember } from './geminiMembers.js';
|
|
46
|
+
import { geminiPickupAllowed, isGeminiMember } from './geminiMembers.js';
|
|
47
47
|
export const GEMINI_AUTO_PICKUP_SKIP = 'Skipped a Gemini member: its mail waits for your NUDGE.';
|
|
48
48
|
export const GEMINI_MAIL_SKIP = 'Mail from a Gemini member waits for your NUDGE.';
|
|
49
49
|
// Per-recipient cooldown — once an auto-turn fires for R, the next auto-turn
|
|
@@ -101,6 +101,23 @@ catch (error) {
|
|
|
101
101
|
throw error;
|
|
102
102
|
} }, (cluster, content) => { atomicWriteFileSync(join(clusterStore.clusterDir(cluster), 'rule-pickup-ledger.json'), content, { mode: 0o600 }); });
|
|
103
103
|
const pendingChecks = new Set();
|
|
104
|
+
// Members whose last turn ended in a terminal request_too_large. Automatic
|
|
105
|
+
// pickup stops waking them (their mail stays unread) until a turn succeeds or
|
|
106
|
+
// the member is dropped; a wake only adds to a history that is already too big.
|
|
107
|
+
const tooLargeMembers = new Set();
|
|
108
|
+
export const MEMBER_BLOCKED_NOTICE = 'Its conversation is too large for the provider. Hand off or replace this member, then NUDGE it; its mail is kept.';
|
|
109
|
+
// Provider rejections that repeat for as long as the stored conversation stays
|
|
110
|
+
// the same size: Anthropic's request_too_large (413), its total-text-bytes
|
|
111
|
+
// limit (400 invalid_request_error), and context-window overflows.
|
|
112
|
+
const OVERSIZE_ERROR = /request_too_large|too many total text bytes|prompt is too long|context[ _]length|exceeds? the (?:maximum )?context/i;
|
|
113
|
+
export function isOversizeError(error) { return OVERSIZE_ERROR.test(error); }
|
|
114
|
+
export function noteTurnOutcome(workflowId, error) {
|
|
115
|
+
if (error && isOversizeError(error))
|
|
116
|
+
tooLargeMembers.add(workflowId);
|
|
117
|
+
else if (!error)
|
|
118
|
+
tooLargeMembers.delete(workflowId);
|
|
119
|
+
}
|
|
120
|
+
export function isMemberBlocked(workflowId) { return tooLargeMembers.has(workflowId); }
|
|
104
121
|
export function resumeRulePickup(clusterId) { ruleGuard.resume(clusterId); }
|
|
105
122
|
export function resetRulePickup(clusterId) { ruleGuard.reset(clusterId); }
|
|
106
123
|
export function interruptRulePickup(clusterId, member) { if (clusterStore.isAutoTurnOnMailboxEnabled(clusterId)) {
|
|
@@ -204,7 +221,7 @@ export async function pickupWaitingMail(clusterId, liveMembers = resolveMembersF
|
|
|
204
221
|
return;
|
|
205
222
|
for (const m of liveMembers) {
|
|
206
223
|
if (m.busy) {
|
|
207
|
-
if (dispatchBusyReminderFn)
|
|
224
|
+
if (!isGeminiMember(m.workflowId) && dispatchBusyReminderFn)
|
|
208
225
|
await remindBusyMember(clusterId, m.workflowId, { isBusy: isBusyFn, hasClusterTools: hasClusterToolsFn, dispatch: dispatchBusyReminderFn });
|
|
209
226
|
continue;
|
|
210
227
|
}
|
|
@@ -265,6 +282,7 @@ export function clearAutoTurnDepth(workflowId) {
|
|
|
265
282
|
export function dropMember(workflowId) {
|
|
266
283
|
memberState.delete(workflowId);
|
|
267
284
|
pendingDepth.delete(workflowId);
|
|
285
|
+
tooLargeMembers.delete(workflowId);
|
|
268
286
|
}
|
|
269
287
|
// Chain depth the resume sweeps use for a member's pending mail.
|
|
270
288
|
export function pendingChainDepth(workflowId) {
|
|
@@ -326,17 +344,15 @@ function emitSkip(clusterId, recipientWfid, senderWfid, chainDepth, reason, now,
|
|
|
326
344
|
// `currentAutoTurnDepth(senderWfid)`). The detector treats undefined as 0
|
|
327
345
|
// per the operator-initiated default.
|
|
328
346
|
export function onPeerMessageSent(opts) {
|
|
329
|
-
// docs/PROTOCOL_CLUSTER.md "Gemini members": mail to or from a Gemini
|
|
330
|
-
// member waits for the operator's NUDGE on the recipient; no automatic
|
|
331
|
-
// wake or busy reminder.
|
|
332
347
|
const geminiRecipient = isGeminiMember(opts.recipientWfid);
|
|
333
|
-
|
|
348
|
+
const recipientHeld = geminiRecipient && !geminiPickupAllowed(opts.recipientWfid);
|
|
349
|
+
if (recipientHeld || isGeminiMember(opts.senderWfid)) {
|
|
334
350
|
if (clusterStore.isAutoTurnOnMailboxEnabled(opts.clusterId) && !clusterStore.isAutoPickupPaused(opts.clusterId)) {
|
|
335
|
-
emitSkip(opts.clusterId, opts.recipientWfid, opts.senderWfid, opts.incomingChainDepth,
|
|
351
|
+
emitSkip(opts.clusterId, opts.recipientWfid, opts.senderWfid, opts.incomingChainDepth, recipientHeld ? 'operator_send_only' : 'gemini_mail', Date.now(), recipientHeld ? GEMINI_AUTO_PICKUP_SKIP : GEMINI_MAIL_SKIP);
|
|
336
352
|
}
|
|
337
353
|
return;
|
|
338
354
|
}
|
|
339
|
-
if (isBusyFn && dispatchBusyReminderFn)
|
|
355
|
+
if (!geminiRecipient && isBusyFn && dispatchBusyReminderFn)
|
|
340
356
|
void remindBusyMember(opts.clusterId, opts.recipientWfid, { isBusy: isBusyFn, hasClusterTools: hasClusterToolsFn, dispatch: dispatchBusyReminderFn });
|
|
341
357
|
if (!clusterStore.isAutoTurnOnMailboxEnabled(opts.clusterId))
|
|
342
358
|
return;
|
|
@@ -372,10 +388,14 @@ function fireRulePickup(opts) {
|
|
|
372
388
|
return;
|
|
373
389
|
const { clusterId, senderWfid, recipientWfid, incomingChainDepth } = opts;
|
|
374
390
|
const now = Date.now();
|
|
375
|
-
if (isGeminiMember(recipientWfid)) {
|
|
391
|
+
if (isGeminiMember(recipientWfid) && !geminiPickupAllowed(recipientWfid)) {
|
|
376
392
|
emitSkip(clusterId, recipientWfid, senderWfid, incomingChainDepth, 'operator_send_only', now, GEMINI_AUTO_PICKUP_SKIP);
|
|
377
393
|
return;
|
|
378
394
|
}
|
|
395
|
+
if (isMemberBlocked(recipientWfid)) {
|
|
396
|
+
emitSkip(clusterId, recipientWfid, senderWfid, incomingChainDepth, 'member_blocked', now, MEMBER_BLOCKED_NOTICE);
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
379
399
|
// Guard 0: cluster toggle armed. Most clusters won't have this on; the
|
|
380
400
|
// gate is the first check so the hot path is one map lookup when off.
|
|
381
401
|
if (!clusterStore.isAutoTurnOnMailboxEnabled(clusterId) || clusterStore.isAutoPickupPaused(clusterId))
|
|
@@ -476,6 +496,8 @@ export function smartChainDepthLimit(configured) {
|
|
|
476
496
|
return process.env.ARCO_CLUSTER_AUTO_TURN_MAX_CHAIN_DEPTH ? AUTO_TURN_MAX_CHAIN_DEPTH : configured;
|
|
477
497
|
}
|
|
478
498
|
export function sharedGuardProblem(clusterId, recipientWfid, incomingChainDepth, now = Date.now(), depthLimit = AUTO_TURN_MAX_CHAIN_DEPTH) {
|
|
499
|
+
if (isMemberBlocked(recipientWfid))
|
|
500
|
+
return 'member_blocked';
|
|
479
501
|
if (incomingChainDepth >= depthLimit)
|
|
480
502
|
return 'depth_capped';
|
|
481
503
|
const ms = getMemberState(recipientWfid);
|
|
@@ -90,7 +90,7 @@ function normalizeMember(raw, idx) {
|
|
|
90
90
|
const out = { provider, model };
|
|
91
91
|
if (typeof r.effort === 'string' && r.effort.trim().length > 0)
|
|
92
92
|
out.effort = r.effort.trim();
|
|
93
|
-
if (provider === 'codex' && typeof r.providerAccountRef === 'string' && r.providerAccountRef.trim().length > 0) {
|
|
93
|
+
if ((provider === 'codex' || provider === 'claude') && typeof r.providerAccountRef === 'string' && r.providerAccountRef.trim().length > 0) {
|
|
94
94
|
out.providerAccountRef = r.providerAccountRef.trim();
|
|
95
95
|
}
|
|
96
96
|
if (typeof r.role === 'string') {
|
|
@@ -150,9 +150,9 @@ function normalizeMember(raw, idx) {
|
|
|
150
150
|
if (out.accessMode === 'isolated') {
|
|
151
151
|
if (r.webAccess === false)
|
|
152
152
|
out.webAccess = false;
|
|
153
|
-
if (provider === 'claude' && (r.claudeTransport === 'native' || r.claudeTransport === 'cli'))
|
|
154
|
-
out.claudeTransport = r.claudeTransport;
|
|
155
153
|
}
|
|
154
|
+
if (provider === 'claude' && (r.claudeTransport === 'native' || r.claudeTransport === 'cli'))
|
|
155
|
+
out.claudeTransport = r.claudeTransport;
|
|
156
156
|
// Research panels keep each researcher's ADVANCED limits (docs/RESEARCH.md).
|
|
157
157
|
if (out.accessMode === 'researcher') {
|
|
158
158
|
if (r.webAccess === false)
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type EffortLevel, type ProviderName } from '@arco/shared';
|
|
2
|
-
export declare function allowedWorkflowEfforts(provider: ProviderName | undefined, model: string): EffortLevel[];
|
|
3
|
-
export declare function normalizedWorkflowEffort(provider: ProviderName | undefined, model: string, effort: unknown): EffortLevel;
|
|
2
|
+
export declare function allowedWorkflowEfforts(provider: ProviderName | undefined, model: string, providerAccountRef?: string): EffortLevel[];
|
|
3
|
+
export declare function normalizedWorkflowEffort(provider: ProviderName | undefined, model: string, effort: unknown, providerAccountRef?: string): EffortLevel;
|
|
@@ -2,10 +2,10 @@ import { CLAUDE_EFFORTS, CLAUDE_MODEL_EFFORTS, CODEX_MODEL_INFO, EFFORT_RANK } f
|
|
|
2
2
|
import { getCachedClaudeModelEfforts } from './providers/claude-native/catalog.js';
|
|
3
3
|
import { getCachedCodexModelCapabilities } from './providers/codex-appserver/catalog.js';
|
|
4
4
|
// Follow the model catalog and the same static overrides as the picker.
|
|
5
|
-
export function allowedWorkflowEfforts(provider, model) {
|
|
5
|
+
export function allowedWorkflowEfforts(provider, model, providerAccountRef) {
|
|
6
6
|
if (!provider || provider === 'claude') {
|
|
7
7
|
const known = CLAUDE_MODEL_EFFORTS[model];
|
|
8
|
-
const live = getCachedClaudeModelEfforts(model);
|
|
8
|
+
const live = getCachedClaudeModelEfforts(model, providerAccountRef);
|
|
9
9
|
if (live?.length)
|
|
10
10
|
return known ? CLAUDE_EFFORTS.filter((level) => known.includes(level) || live.includes(level)) : live;
|
|
11
11
|
return known ?? CLAUDE_EFFORTS;
|
|
@@ -21,8 +21,8 @@ export function allowedWorkflowEfforts(provider, model) {
|
|
|
21
21
|
}
|
|
22
22
|
return Object.keys(EFFORT_RANK);
|
|
23
23
|
}
|
|
24
|
-
export function normalizedWorkflowEffort(provider, model, effort) {
|
|
25
|
-
const levels = allowedWorkflowEfforts(provider, model);
|
|
24
|
+
export function normalizedWorkflowEffort(provider, model, effort, providerAccountRef) {
|
|
25
|
+
const levels = allowedWorkflowEfforts(provider, model, providerAccountRef);
|
|
26
26
|
if (typeof effort === 'string' && levels.includes(effort))
|
|
27
27
|
return effort;
|
|
28
28
|
if (typeof effort === 'string' && Object.hasOwn(EFFORT_RANK, effort)) {
|
|
@@ -17,6 +17,7 @@ import { constants } from 'fs';
|
|
|
17
17
|
import { lstat, open, readFile, readdir, realpath, stat } from 'fs/promises';
|
|
18
18
|
import { basename, join, resolve, sep } from 'path';
|
|
19
19
|
import { homedir } from 'os';
|
|
20
|
+
import { listGeminiArtifacts } from './providers/antigravity/artifacts.js';
|
|
20
21
|
import { arcoHome } from './arcoHome.js';
|
|
21
22
|
import { assertSafePath, confinedPath } from './fileAccessPolicy.js';
|
|
22
23
|
const KNOWN_CWDS = join(arcoHome(), 'known-cwds.json');
|
|
@@ -139,9 +140,19 @@ async function collectForCwd(cwd) {
|
|
|
139
140
|
const wfid = wf.name;
|
|
140
141
|
const files = [];
|
|
141
142
|
await walkArtifactFiles(join(workflowsDir, wfid, 'artifacts'), 0, files);
|
|
142
|
-
|
|
143
|
+
let gemini = await listGeminiArtifacts(cwd, wfid);
|
|
144
|
+
if (gemini.length) {
|
|
145
|
+
const { outputContext } = await import('./outputs.js');
|
|
146
|
+
const ctx = await outputContext(cwd, wfid).catch(() => null);
|
|
147
|
+
if (!ctx || await realpath(ctx.cwd) !== cwd)
|
|
148
|
+
gemini = [];
|
|
149
|
+
}
|
|
150
|
+
if (files.length + gemini.length === 0)
|
|
143
151
|
continue; // empty artifact dir → skipped (the ~90%)
|
|
144
152
|
const meta = await readWorkflowMeta(cwd, wfid);
|
|
153
|
+
for (const file of gemini) {
|
|
154
|
+
results.push({ ...file, workflowId: wfid, ...meta, project, cwd });
|
|
155
|
+
}
|
|
145
156
|
for (const f of files) {
|
|
146
157
|
const rp = await realpathWithinHome(f);
|
|
147
158
|
if (!rp)
|
|
@@ -21,6 +21,7 @@ export declare function collectProjectDocsPage(project: string, limit?: number,
|
|
|
21
21
|
export declare function collectProjectDocs(project: string, limit?: number): Promise<DocEntry[]>;
|
|
22
22
|
export declare function collectDocsPage(opts?: {
|
|
23
23
|
project?: string;
|
|
24
|
+
budget?: ScanBudget;
|
|
24
25
|
}): Promise<DocsPage>;
|
|
25
26
|
export declare function collectDocs(opts?: {
|
|
26
27
|
project?: string;
|
|
@@ -71,8 +71,7 @@ export async function collectProjectDocsPage(project, limit = 1000, global) {
|
|
|
71
71
|
export async function collectProjectDocs(project, limit = 1000) {
|
|
72
72
|
return (await collectProjectDocsPage(project, limit)).entries;
|
|
73
73
|
}
|
|
74
|
-
async function collectScopedDocs(project) {
|
|
75
|
-
const budget = scanBudget();
|
|
74
|
+
async function collectScopedDocs(project, budget = scanBudget()) {
|
|
76
75
|
const out = [];
|
|
77
76
|
const root = await scanBeforeDeadline(realpathWithinHome(project), budget);
|
|
78
77
|
if (root)
|
|
@@ -109,10 +108,11 @@ async function collectScopedDocs(project) {
|
|
|
109
108
|
}
|
|
110
109
|
// Global doc scan across known projects, bounded per-project so a home load over
|
|
111
110
|
// dozens of projects stays responsive. `project` scopes to one (full limit).
|
|
111
|
+
// `budget` replaces the default scan budget; routes always use the defaults.
|
|
112
112
|
export async function collectDocsPage(opts = {}) {
|
|
113
113
|
if (opts.project)
|
|
114
|
-
return collectScopedDocs(opts.project);
|
|
115
|
-
const global = scanBudget(50_000, 650);
|
|
114
|
+
return collectScopedDocs(opts.project, opts.budget);
|
|
115
|
+
const global = opts.budget ?? scanBudget(50_000, 650);
|
|
116
116
|
const known = await scanBeforeDeadline(readKnownCwds(), global);
|
|
117
117
|
if (!known)
|
|
118
118
|
return { entries: [], partial: true };
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
export declare const GEMINI_PROVIDER = "antigravity-cli";
|
|
2
|
-
export declare const GEMINI_OPERATOR_ONLY_REFUSAL = "
|
|
2
|
+
export declare const GEMINI_OPERATOR_ONLY_REFUSAL = "Use NUDGE or the member's composer to start a Gemini turn, or enable AUTO-PICKUP for eligible cluster mail.";
|
|
3
3
|
export declare function isGeminiMember(workflowId: string): boolean;
|
|
4
|
+
export declare function geminiPickupAllowed(workflowId: string): boolean;
|
|
4
5
|
export declare function issueGeminiSend(workflowId: string, content: string, now?: number): string;
|
|
5
6
|
export declare function geminiSendValid(ticket: string | undefined, workflowId: string, content: string, now?: number): boolean;
|
|
6
7
|
export declare function consumeGeminiSend(ticket: string | undefined, workflowId: string, content: string, now?: number): boolean;
|
|
7
8
|
export declare function geminiClusterInstructions(clusterId: string, workflowId: string): Promise<string>;
|
|
8
9
|
export declare function geminiNudgeText(workflowId: string, nudge: string): Promise<string>;
|
|
10
|
+
export declare function prepareGeminiPickup(workflowId: string, prompt: string, mode: 'rule' | 'smart-auto'): Promise<{
|
|
11
|
+
content: string;
|
|
12
|
+
ticket: string;
|
|
13
|
+
isCurrent: () => boolean;
|
|
14
|
+
} | undefined>;
|
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
// typed in its composer. Mail to it waits in its mailbox, where the operator
|
|
4
|
-
// may read, edit or cancel it before pressing NUDGE; the member then reads it
|
|
5
|
-
// with peer_read like any other member. Each operator action gets a
|
|
6
|
-
// single-use ticket bound to the member and the exact text, and
|
|
7
|
-
// handleUserMessage (ws/turnEngine.ts) starts a Gemini member turn only with
|
|
8
|
-
// a valid ticket, checked again when a queued message is taken. Automatic
|
|
9
|
-
// turns (AUTO-PICKUP, Smart pickup, busy reminders, task dispatch,
|
|
10
|
-
// broadcasts, CONTINUE DIRECTOR, timers, retries) carry no ticket and never
|
|
11
|
-
// start one.
|
|
1
|
+
// Gemini member turns require a single-use ticket for the exact input.
|
|
2
|
+
// Operator input, previewed replacement history and an admitted AUTO-PICKUP wake can obtain one.
|
|
12
3
|
import { createHash, randomUUID } from 'node:crypto';
|
|
13
4
|
import { buildMessageGuardPolicy } from '@arco/shared';
|
|
14
5
|
import * as clusterStore from './clusterStore.js';
|
|
@@ -23,11 +14,20 @@ import { workflows } from './server/state.js';
|
|
|
23
14
|
import { listSkills, buildSkillsManifest } from './skills.js';
|
|
24
15
|
import { gateProjectResources } from './projectTrust.js';
|
|
25
16
|
export const GEMINI_PROVIDER = 'antigravity-cli';
|
|
26
|
-
export const GEMINI_OPERATOR_ONLY_REFUSAL =
|
|
17
|
+
export const GEMINI_OPERATOR_ONLY_REFUSAL = "Use NUDGE or the member's composer to start a Gemini turn, or enable AUTO-PICKUP for eligible cluster mail.";
|
|
27
18
|
export function isGeminiMember(workflowId) {
|
|
28
19
|
return workflows.get(workflowId)?.config.primaryProvider === GEMINI_PROVIDER
|
|
29
20
|
&& clusterStore.getClusterIdForWorkflow(workflowId) !== undefined;
|
|
30
21
|
}
|
|
22
|
+
// Research has a separate mailbox and wake policy. Ordinary pickup cannot
|
|
23
|
+
// cross into it or into a member with an isolated access mode.
|
|
24
|
+
export function geminiPickupAllowed(workflowId) {
|
|
25
|
+
const clusterId = clusterStore.getClusterIdForWorkflow(workflowId);
|
|
26
|
+
if (!clusterId || !isGeminiMember(workflowId))
|
|
27
|
+
return false;
|
|
28
|
+
const cluster = clusterStore.getClusterCached(clusterId);
|
|
29
|
+
return !!cluster && !cluster.research && clusterStore.getMemberAccessMode(clusterId, workflowId) === 'standard';
|
|
30
|
+
}
|
|
31
31
|
// A queued message may wait behind a long turn; six hours bounds memory
|
|
32
32
|
// without expiring an operator message that is still waiting its turn.
|
|
33
33
|
const TICKET_TTL_MS = 6 * 60 * 60 * 1000;
|
|
@@ -40,8 +40,7 @@ function prune(now) {
|
|
|
40
40
|
if (t.expiresAt <= now)
|
|
41
41
|
tickets.delete(id);
|
|
42
42
|
}
|
|
43
|
-
//
|
|
44
|
-
// message) for a Gemini member.
|
|
43
|
+
// Issued by the server for Gemini operator input, previewed replacement history or an eligible AUTO-PICKUP wake.
|
|
45
44
|
export function issueGeminiSend(workflowId, content, now = Date.now()) {
|
|
46
45
|
prune(now);
|
|
47
46
|
const id = randomUUID();
|
|
@@ -110,4 +109,19 @@ export async function geminiNudgeText(workflowId, nudge) {
|
|
|
110
109
|
}
|
|
111
110
|
return [instructions, skills, reminder, nudge].filter(part => part.trim()).join('\n\n---\n\n');
|
|
112
111
|
}
|
|
112
|
+
export async function prepareGeminiPickup(workflowId, prompt, mode) {
|
|
113
|
+
const clusterId = clusterStore.getClusterIdForWorkflow(workflowId);
|
|
114
|
+
if (!clusterId)
|
|
115
|
+
return undefined;
|
|
116
|
+
const isCurrent = () => geminiPickupAllowed(workflowId)
|
|
117
|
+
&& clusterStore.getClusterIdForWorkflow(workflowId) === clusterId
|
|
118
|
+
&& clusterStore.getAutoPickupMode(clusterId) === mode
|
|
119
|
+
&& !clusterStore.isAutoPickupPaused(clusterId);
|
|
120
|
+
if (!isCurrent())
|
|
121
|
+
return undefined;
|
|
122
|
+
const content = await geminiNudgeText(workflowId, prompt);
|
|
123
|
+
if (!isCurrent())
|
|
124
|
+
return undefined;
|
|
125
|
+
return { content, ticket: issueGeminiSend(workflowId, content), isCurrent };
|
|
126
|
+
}
|
|
113
127
|
//# sourceMappingURL=geminiMembers.js.map
|