arco-workbench 0.1.7 → 0.1.9
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 +63 -12
- package/README.md +21 -17
- package/client/dist/assets/{PhosphorBackdrop-DVQdBrTw.js → PhosphorBackdrop-DRu16-Is.js} +1 -1
- package/client/dist/assets/{ThemedBackgroundShaderImpl-BfSs2tB4.js → ThemedBackgroundShaderImpl-BLdwwQ4D.js} +1 -1
- package/client/dist/assets/{XtermView-DaMjC8Ny.js → XtermView-Xk7_9JaH.js} +1 -1
- package/client/dist/assets/{galleryEditor-BCQnXj7R.js → galleryEditor-CI8ClzBa.js} +1 -1
- package/client/dist/assets/{index-DD9kFGsF.css → index-BEFgrUJJ.css} +1 -1
- package/client/dist/assets/{index-COfbHCYv.js → index-C7WzZfsr.js} +257 -255
- package/client/dist/index.html +2 -2
- package/client/src/App.tsx +2 -0
- package/client/src/components/ChatMessage.tsx +33 -8
- package/client/src/components/ChatModeView.tsx +2 -0
- package/client/src/components/ClusterRightPanel/ReplaceMemberDialog.tsx +65 -15
- package/client/src/components/ClusterRightPanel/SkillsControl.tsx +124 -0
- package/client/src/components/ClusterRightPanel/index.tsx +4 -0
- package/client/src/components/ClusterTaskBoardTab.tsx +9 -22
- package/client/src/components/CodexLateCommand.tsx +34 -0
- package/client/src/components/DialogShell.tsx +2 -0
- package/client/src/components/MemberCard.tsx +4 -1
- package/client/src/components/MemberPane.tsx +3 -1
- package/client/src/components/NeedsYouBadge.tsx +3 -3
- package/client/src/components/PhoneUpload.tsx +288 -0
- package/client/src/components/PrimaryStatus.tsx +14 -6
- package/client/src/components/ProviderReleasesModal.tsx +8 -4
- package/client/src/components/ProvidersPopover.tsx +28 -23
- package/client/src/components/RuntimeStateBanner.tsx +5 -0
- package/client/src/components/SettingsPanel.tsx +2 -2
- package/client/src/components/SkillEditorDialog.tsx +2 -2
- package/client/src/components/SkillsSettings.tsx +21 -4
- package/client/src/components/TabBar.tsx +91 -9
- package/client/src/components/TerminalInput.tsx +15 -11
- package/client/src/components/TranscriptSendDialog.tsx +12 -8
- package/client/src/components/TranscriptWorkerDialog.tsx +119 -0
- package/client/src/components/WorkflowView.tsx +2 -0
- package/client/src/components/clusterNeedsYou.ts +11 -18
- package/client/src/explorer/ArtifactsLens.tsx +37 -28
- package/client/src/explorer/ExplorerApp.tsx +5 -4
- package/client/src/explorer/types.ts +8 -3
- package/client/src/help/content/cluster.tsx +48 -17
- package/client/src/help/content/composer.tsx +40 -1
- package/client/src/help/content/header.tsx +18 -1
- package/client/src/help/content/misc.tsx +9 -1
- package/client/src/help/content/settings.tsx +18 -4
- package/client/src/help/content/tabbar.tsx +5 -0
- package/client/src/help/manualSections/actions.tsx +31 -0
- package/client/src/help/manualSections/clusters.tsx +44 -20
- package/client/src/help/manualSections/configuration.tsx +20 -0
- package/client/src/help/manualSections/gettingStarted.tsx +4 -4
- package/client/src/help/manualSections/maintenance.tsx +25 -6
- package/client/src/help/manualSections/powerFeatures.tsx +3 -2
- package/client/src/help/manualSections/providers.tsx +32 -8
- package/client/src/help/manualSections/troubleshooting.tsx +2 -1
- package/client/src/help/manualSections/workflows.tsx +12 -0
- package/client/src/help/manualSections/workspace.tsx +36 -0
- package/client/src/stores/appStore.ts +7 -0
- package/client/src/stores/appStore.types.ts +4 -0
- package/client/src/styles/global.css +109 -0
- package/client/src/utils/phoneTheme.ts +38 -0
- package/client/src/utils/phoneUploadApi.ts +10 -0
- package/client/src/utils/transcriptWorkerRequest.ts +24 -0
- package/client/src/ws/handleServerMessage.ts +31 -8
- package/docs/ARCHITECTURE.md +1 -1
- package/docs/CLIENT.md +16 -9
- package/docs/FEATURES.md +13 -7
- package/docs/GETTING_STARTED.md +12 -6
- package/docs/GOTCHAS.md +2 -1
- package/docs/INDEX.md +1 -1
- package/docs/OPERATIONS.md +213 -52
- package/docs/PERSISTENCE.md +7 -2
- package/docs/PRIMITIVES.md +42 -0
- package/docs/PROTOCOL_CLUSTER.md +51 -4
- package/docs/PROTOCOL_PRIMITIVES.md +39 -0
- package/docs/PROVIDERS.md +84 -13
- package/docs/SETTINGS.md +29 -3
- package/docs/TASK_LEDGER.md +7 -15
- package/native/linux-x64/manifest.json +1 -1
- package/native/win32-x64/manifest.json +1 -1
- package/node_modules/@arco/shared/dist/clusterCoordination.d.ts +2 -0
- package/node_modules/@arco/shared/dist/clusterCoordination.js +5 -1
- package/node_modules/@arco/shared/dist/protocol/chat.d.ts +1 -0
- package/node_modules/@arco/shared/dist/protocol/clientMessages.d.ts +3 -2
- package/node_modules/@arco/shared/dist/protocol/clusters.d.ts +15 -1
- package/node_modules/@arco/shared/dist/protocol/index.d.ts +1 -0
- package/node_modules/@arco/shared/dist/protocol/index.js +1 -0
- package/node_modules/@arco/shared/dist/protocol/models.d.ts +4 -3
- package/node_modules/@arco/shared/dist/protocol/models.js +26 -2
- package/node_modules/@arco/shared/dist/protocol/serverMessages.d.ts +13 -1
- package/node_modules/@arco/shared/dist/protocol/tasks.d.ts +4 -0
- package/node_modules/@arco/shared/dist/protocol/transcriptWorker.d.ts +47 -0
- package/node_modules/@arco/shared/dist/protocol/transcriptWorker.js +2 -0
- package/node_modules/@arco/shared/dist/protocol/workflows.d.ts +1 -0
- package/node_modules/@arco/shared/dist/runtimeVersions.d.ts +1 -0
- package/node_modules/@arco/shared/dist/runtimeVersions.js +14 -0
- package/node_modules/@arco/shared/package.json +1 -1
- package/package.json +2 -2
- package/scripts/packaging/arco.mjs +1 -1
- package/scripts/packaging/native-repair.mjs +32 -4
- package/server/dist/atomicFile.js +1 -2
- package/server/dist/capabilities.d.ts +5 -2
- package/server/dist/capabilities.js +59 -9
- package/server/dist/cliUpdateDecision.d.ts +1 -1
- package/server/dist/cliUpdateDecision.js +5 -3
- package/server/dist/clusterDirector.js +2 -1
- package/server/dist/clusterPeerOps.js +14 -8
- package/server/dist/clusterProgress.js +1 -1
- package/server/dist/clusterRehydrate.js +2 -0
- package/server/dist/clusterSkills.d.ts +13 -0
- package/server/dist/clusterSkills.js +81 -0
- package/server/dist/clusterSnapshots.js +2 -0
- package/server/dist/clusterStore.d.ts +7 -2
- package/server/dist/clusterStore.js +42 -1
- package/server/dist/diagnostics/codeSkew.js +1 -0
- package/server/dist/eventLog.d.ts +7 -0
- package/server/dist/eventLog.js +70 -13
- package/server/dist/explorerDocs.d.ts +10 -6
- package/server/dist/explorerDocs.js +75 -34
- package/server/dist/historyLimits.d.ts +1 -0
- package/server/dist/historyLimits.js +3 -0
- package/server/dist/http/attachmentUpload.d.ts +13 -0
- package/server/dist/http/attachmentUpload.js +38 -0
- package/server/dist/http/browserWorktrees.d.ts +23 -0
- package/server/dist/http/browserWorktrees.js +120 -0
- package/server/dist/http/phoneUploadDrafts.d.ts +13 -0
- package/server/dist/http/phoneUploadDrafts.js +125 -0
- package/server/dist/http/phoneUploadListener.d.ts +17 -0
- package/server/dist/http/phoneUploadListener.js +81 -0
- package/server/dist/http/phoneUploadNetwork.d.ts +9 -0
- package/server/dist/http/phoneUploadNetwork.js +106 -0
- package/server/dist/http/phoneUploadPage.d.ts +2 -0
- package/server/dist/http/phoneUploadPage.js +136 -0
- package/server/dist/http/phoneUploadRouteHistory.d.ts +4 -0
- package/server/dist/http/phoneUploadRouteHistory.js +72 -0
- package/server/dist/http/phoneUploadRoutes.d.ts +4 -0
- package/server/dist/http/phoneUploadRoutes.js +419 -0
- package/server/dist/http/phoneUploadTheme.d.ts +17 -0
- package/server/dist/http/phoneUploadTheme.js +96 -0
- package/server/dist/http/projectBinding.d.ts +1 -0
- package/server/dist/http/projectBinding.js +3 -2
- package/server/dist/http/readConfinement.js +5 -1
- package/server/dist/http/router.js +14 -25
- package/server/dist/http/writeConfinement.js +19 -2
- package/server/dist/index.js +24 -1
- package/server/dist/jsonlLines.d.ts +4 -0
- package/server/dist/jsonlLines.js +53 -0
- package/server/dist/management/identity.js +1 -0
- package/server/dist/mcp/clusterMcpTools.js +4 -4
- package/server/dist/primitives/seedWorker.d.ts +1 -0
- package/server/dist/primitives/seedWorker.js +2 -1
- package/server/dist/project/taskLedger.d.ts +4 -0
- package/server/dist/project/taskLedger.js +7 -4
- package/server/dist/providerConversation.d.ts +1 -0
- package/server/dist/providerConversation.js +17 -0
- package/server/dist/providers/claude-native/resumeSummary.d.ts +9 -0
- package/server/dist/providers/claude-native/resumeSummary.js +102 -49
- package/server/dist/providers/claude-native/worker.js +8 -4
- package/server/dist/providers/claude.js +2 -1
- package/server/dist/providers/clusterTaskToolDefinitions.js +4 -4
- package/server/dist/providers/codex-appserver/catalog.js +16 -1
- package/server/dist/providers/codex-appserver/heldCommands.d.ts +14 -0
- package/server/dist/providers/codex-appserver/heldCommands.js +54 -0
- package/server/dist/providers/codex-appserver/index.d.ts +52 -2
- package/server/dist/providers/codex-appserver/index.js +239 -21
- package/server/dist/providers/codex-appserver/lateCommands.d.ts +62 -0
- package/server/dist/providers/codex-appserver/lateCommands.js +195 -0
- package/server/dist/providers/codex-appserver/worker.d.ts +23 -1
- package/server/dist/providers/codex-appserver/worker.js +89 -20
- package/server/dist/providers/codex.js +2 -1
- package/server/dist/providers/codexCodeMode.d.ts +2 -1
- package/server/dist/providers/codexCodeMode.js +8 -3
- package/server/dist/providers/cursor/print.js +2 -1
- package/server/dist/providers/cursor/worker.js +2 -1
- package/server/dist/providers/llamacpp.js +17 -8
- package/server/dist/providers/ollamaRecovery.js +6 -6
- package/server/dist/providers/ollamaResilience.js +3 -3
- package/server/dist/providers/ollamaTokens.js +1 -1
- package/server/dist/quota.d.ts +0 -18
- package/server/dist/quota.js +0 -44
- package/server/dist/replacementHistory.d.ts +19 -0
- package/server/dist/replacementHistory.js +49 -0
- package/server/dist/server/broadcast.d.ts +2 -1
- package/server/dist/server/broadcast.js +1 -0
- package/server/dist/server/prompts.d.ts +1 -0
- package/server/dist/server/prompts.js +6 -1
- package/server/dist/sessionJsonl.d.ts +1 -1
- package/server/dist/sessionJsonl.js +115 -40
- package/server/dist/smartPickupAdapters.js +15 -2
- package/server/dist/transcriptWorker.d.ts +34 -0
- package/server/dist/transcriptWorker.js +201 -0
- package/server/dist/workers/WorkerManager.d.ts +1 -0
- package/server/dist/workers/WorkerManager.js +1 -0
- package/server/dist/workers/processKill.d.ts +9 -1
- package/server/dist/workers/processKill.js +26 -10
- package/server/dist/workflowStore.d.ts +1 -0
- package/server/dist/workflowStore.js +31 -0
- package/server/dist/ws/clusterHandlers.d.ts +1 -0
- package/server/dist/ws/clusterHandlers.js +62 -26
- package/server/dist/ws/handoffHandlers.js +7 -2
- package/server/dist/ws/transcriptWorkerHandlers.d.ts +25 -0
- package/server/dist/ws/transcriptWorkerHandlers.js +139 -0
- package/server/dist/ws/turnEngine.js +40 -9
- package/server/dist/ws/updatePrimaryConfig.js +27 -8
- package/server/dist/ws/workflowHandlers.d.ts +4 -1
- package/server/dist/ws/workflowHandlers.js +3 -1
- package/server/package.json +1 -1
- package/server/src/atomicFile.ts +1 -2
- package/server/src/capabilities.ts +58 -17
- package/server/src/cliUpdateDecision.ts +5 -4
- package/server/src/clusterDirector.ts +2 -1
- package/server/src/clusterPeerOps.ts +15 -9
- package/server/src/clusterProgress.ts +1 -1
- package/server/src/clusterRehydrate.ts +2 -0
- package/server/src/clusterSkills.ts +79 -0
- package/server/src/clusterSnapshots.ts +1 -0
- package/server/src/clusterStore.ts +38 -0
- package/server/src/diagnostics/codeSkew.ts +1 -0
- package/server/src/eventLog.ts +73 -13
- package/server/src/explorerDocs.ts +75 -34
- package/server/src/historyLimits.ts +2 -0
- package/server/src/http/attachmentUpload.ts +49 -0
- package/server/src/http/browserWorktrees.ts +124 -0
- package/server/src/http/phoneUploadDrafts.ts +118 -0
- package/server/src/http/phoneUploadListener.ts +96 -0
- package/server/src/http/phoneUploadNetwork.ts +117 -0
- package/server/src/http/phoneUploadPage.ts +137 -0
- package/server/src/http/phoneUploadRouteHistory.ts +73 -0
- package/server/src/http/phoneUploadRoutes.ts +398 -0
- package/server/src/http/phoneUploadTheme.ts +97 -0
- package/server/src/http/projectBinding.ts +3 -2
- package/server/src/http/readConfinement.ts +5 -1
- package/server/src/http/router.ts +12 -26
- package/server/src/http/writeConfinement.ts +13 -2
- package/server/src/index.ts +23 -0
- package/server/src/jsonlLines.ts +52 -0
- package/server/src/management/identity.ts +1 -0
- package/server/src/mcp/clusterMcpTools.ts +4 -4
- package/server/src/primitives/seedWorker.ts +3 -1
- package/server/src/project/taskLedger.ts +7 -5
- package/server/src/providerConversation.ts +15 -0
- package/server/src/providers/claude-native/resumeSummary.ts +98 -50
- package/server/src/providers/claude-native/worker.ts +8 -4
- package/server/src/providers/claude.ts +2 -1
- package/server/src/providers/clusterTaskToolDefinitions.ts +4 -4
- package/server/src/providers/codex-appserver/catalog.ts +14 -1
- package/server/src/providers/codex-appserver/heldCommands.ts +58 -0
- package/server/src/providers/codex-appserver/index.ts +222 -20
- package/server/src/providers/codex-appserver/lateCommands.ts +225 -0
- package/server/src/providers/codex-appserver/worker.ts +85 -21
- package/server/src/providers/codex.ts +2 -1
- package/server/src/providers/codexCodeMode.ts +9 -4
- package/server/src/providers/cursor/print.ts +2 -1
- package/server/src/providers/cursor/worker.ts +2 -1
- package/server/src/providers/llamacpp.ts +18 -7
- package/server/src/providers/llamacppRecovery.ts +2 -0
- package/server/src/providers/ollamaRecovery.ts +6 -6
- package/server/src/providers/ollamaResilience.ts +3 -3
- package/server/src/providers/ollamaTokens.ts +1 -1
- package/server/src/providers/ollamaToolSubset.ts +3 -3
- package/server/src/quota.ts +0 -50
- package/server/src/replacementHistory.ts +44 -0
- package/server/src/server/broadcast.ts +2 -0
- package/server/src/server/prompts.ts +8 -1
- package/server/src/sessionJsonl.ts +92 -32
- package/server/src/smartPickupAdapters.ts +17 -3
- package/server/src/transcriptWorker.ts +182 -0
- package/server/src/workers/WorkerManager.ts +2 -0
- package/server/src/workers/processKill.ts +35 -7
- package/server/src/workflowStore.ts +21 -0
- package/server/src/ws/clusterHandlers.ts +43 -25
- package/server/src/ws/handoffHandlers.ts +7 -1
- package/server/src/ws/transcriptWorkerHandlers.ts +126 -0
- package/server/src/ws/turnEngine.ts +35 -8
- package/server/src/ws/updatePrimaryConfig.ts +25 -6
- package/server/src/ws/workflowHandlers.ts +3 -1
- package/shared/dist/clusterCoordination.d.ts +2 -0
- package/shared/dist/clusterCoordination.js +5 -1
- package/shared/dist/protocol/chat.d.ts +1 -0
- package/shared/dist/protocol/clientMessages.d.ts +3 -2
- package/shared/dist/protocol/clusters.d.ts +15 -1
- package/shared/dist/protocol/index.d.ts +1 -0
- package/shared/dist/protocol/index.js +1 -0
- package/shared/dist/protocol/models.d.ts +4 -3
- package/shared/dist/protocol/models.js +26 -2
- package/shared/dist/protocol/serverMessages.d.ts +13 -1
- package/shared/dist/protocol/tasks.d.ts +4 -0
- package/shared/dist/protocol/transcriptWorker.d.ts +47 -0
- package/shared/dist/protocol/transcriptWorker.js +2 -0
- package/shared/dist/protocol/workflows.d.ts +1 -0
- package/shared/dist/runtimeVersions.d.ts +1 -0
- package/shared/dist/runtimeVersions.js +14 -0
- package/shared/src/clusterCoordination.ts +7 -1
- package/shared/src/protocol/chat.ts +1 -0
- package/shared/src/protocol/clientMessages.ts +5 -0
- package/shared/src/protocol/clusters.ts +20 -6
- package/shared/src/protocol/index.ts +1 -0
- package/shared/src/protocol/models.ts +31 -5
- package/shared/src/protocol/serverMessages.ts +13 -0
- package/shared/src/protocol/settings.ts +2 -3
- package/shared/src/protocol/tasks.ts +4 -7
- package/shared/src/protocol/transcriptWorker.ts +49 -0
- package/shared/src/protocol/workflows.ts +4 -0
- package/shared/src/runtimeVersions.ts +14 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { localRuntimeStatusService } from '../localRuntimeStatus.js';
|
|
2
2
|
import { tryHandleHandoffHistoryRoute } from './handoffHistoryRoutes.js';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { UnsafeStorageRootError } from '../storageRoot.js';
|
|
4
|
+
import { readAttachmentBody, storeAttachment } from './attachmentUpload.js';
|
|
5
|
+
import { tryHandlePhoneOperator, tryHandlePhonePage } from './phoneUploadRoutes.js';
|
|
5
6
|
import { requireProjectBinding } from './projectBinding.js';
|
|
6
7
|
import { tryHandleStorageRoutes } from './storageRoutes.js';
|
|
7
8
|
import { tryHandleArchitectureReviewRoutes } from './architectureReviewRoutes.js';
|
|
@@ -24,9 +25,9 @@ import { tryHandleDeepSeekRoutes } from './deepseekRoutes.js';
|
|
|
24
25
|
import { tryHandleVoiceRoutes } from './voiceRoutes.js';
|
|
25
26
|
import { spawn } from 'child_process';
|
|
26
27
|
import { chmodSync, writeFileSync } from 'fs';
|
|
27
|
-
import { mkdir, readdir, readFile
|
|
28
|
+
import { mkdir, readdir, readFile } from 'fs/promises';
|
|
28
29
|
import { homedir, tmpdir } from 'os';
|
|
29
|
-
import {
|
|
30
|
+
import { extname, join, resolve, sep } from 'path';
|
|
30
31
|
import { unloadLocalModels } from '../localModels.js';
|
|
31
32
|
import { getAuthStatus, triggerAuthLogin } from '../auth.js';
|
|
32
33
|
import { cliSnapshotDir, runCliUpdate, refreshRuntimeVersions } from '../capabilities.js';
|
|
@@ -56,8 +57,7 @@ import { probeOllamaLive, aggregateOllamaPs, unloadOllamaModel } from '../provid
|
|
|
56
57
|
import { computeVramReport, computeOllamaFit } from '../providers/ollamaVram.js';
|
|
57
58
|
import { markAvailable as quotaMarkAvailable, markThrottled as quotaMarkThrottled, wireSnapshot as quotaWireSnapshot } from '../quota.js';
|
|
58
59
|
import { broadcastWorkflow, send } from '../server/broadcast.js';
|
|
59
|
-
import { compareDirectoryNames, PORT, PROJECT_ROOT
|
|
60
|
-
import { queueModelImage } from '../providers/attachments.js';
|
|
60
|
+
import { compareDirectoryNames, PORT, PROJECT_ROOT } from '../server/constants.js';
|
|
61
61
|
import { sessions, workflows } from '../server/state.js';
|
|
62
62
|
import { patchSettings, readSettings, readListingSettings } from '../settings.js';
|
|
63
63
|
import { deleteSkill, isValidSlug, listSkills, readSkillBody, readBuiltinSkill, copyBuiltinSkill, writeSkill } from '../skills.js';
|
|
@@ -155,6 +155,8 @@ export async function handleHttpRequest(req, res, deps) {
|
|
|
155
155
|
res.end(JSON.stringify({ error: 'Forbidden origin' }));
|
|
156
156
|
return;
|
|
157
157
|
}
|
|
158
|
+
if (await tryHandlePhonePage(req, res))
|
|
159
|
+
return;
|
|
158
160
|
if (guard.origin) {
|
|
159
161
|
res.setHeader('Access-Control-Allow-Origin', guard.origin);
|
|
160
162
|
res.setHeader('Vary', 'Origin');
|
|
@@ -230,6 +232,8 @@ export async function handleHttpRequest(req, res, deps) {
|
|
|
230
232
|
}
|
|
231
233
|
// Operator routes in their own modules: behind the session gate like every
|
|
232
234
|
// other /api route (they read or change settings and can call providers).
|
|
235
|
+
if (await tryHandlePhoneOperator(req, res))
|
|
236
|
+
return;
|
|
233
237
|
if (await tryHandleProviderThrottleRoutes(req, res))
|
|
234
238
|
return;
|
|
235
239
|
if (await tryHandleSmartPickupRoutes(req, res))
|
|
@@ -323,10 +327,7 @@ export async function handleHttpRequest(req, res, deps) {
|
|
|
323
327
|
}
|
|
324
328
|
if (req.url === '/upload' && req.method === 'POST') {
|
|
325
329
|
try {
|
|
326
|
-
const
|
|
327
|
-
for await (const chunk of req)
|
|
328
|
-
chunks.push(chunk);
|
|
329
|
-
const body = Buffer.concat(chunks);
|
|
330
|
+
const body = await readAttachmentBody(req);
|
|
330
331
|
// Reject empty uploads so they cannot produce invalid image blocks in
|
|
331
332
|
// a worker's persistent history.
|
|
332
333
|
if (body.length === 0) {
|
|
@@ -338,21 +339,9 @@ export async function handleHttpRequest(req, res, deps) {
|
|
|
338
339
|
? req.headers['x-filename'].trim()
|
|
339
340
|
: `upload-${Date.now()}`;
|
|
340
341
|
const contentType = typeof req.headers['content-type'] === 'string' ? req.headers['content-type'].split(';')[0].trim().toLowerCase() : '';
|
|
341
|
-
const
|
|
342
|
-
const inferredExt = !ext && contentType ? UPLOAD_IMAGE_EXT[contentType] : undefined;
|
|
343
|
-
const filename = basename(rawFilename) + (inferredExt ?? '');
|
|
344
|
-
const fileId = crypto.randomUUID().slice(0, 8);
|
|
345
|
-
const uploadRoot = await ensureStorageRoot(UPLOADS_DIR);
|
|
346
|
-
const savePath = join(uploadRoot, `${fileId}-${filename}`);
|
|
347
|
-
await writeFile(savePath, body, { flag: 'wx' });
|
|
348
|
-
console.log(`[arco] File uploaded: ${filename} -> ${savePath}`);
|
|
349
|
-
// Finish upload-only replacement before publishing the stable path.
|
|
350
|
-
// Failure retains the original; project files never enter this path.
|
|
351
|
-
await shrinkUploadedImage(savePath);
|
|
352
|
-
// Other formats still use a separate model-compatible copy.
|
|
353
|
-
queueModelImage(savePath);
|
|
342
|
+
const stored = await storeAttachment(body, rawFilename, contentType);
|
|
354
343
|
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
355
|
-
res.end(JSON.stringify(
|
|
344
|
+
res.end(JSON.stringify(stored));
|
|
356
345
|
}
|
|
357
346
|
catch (error) {
|
|
358
347
|
res.writeHead(500, { 'Content-Type': 'application/json' });
|
|
@@ -1850,7 +1839,7 @@ export async function handleHttpRequest(req, res, deps) {
|
|
|
1850
1839
|
res.end(JSON.stringify({ error: retired }));
|
|
1851
1840
|
return;
|
|
1852
1841
|
}
|
|
1853
|
-
const provider = providerParam === 'codex'
|
|
1842
|
+
const provider = providerParam === 'codex' || providerParam === 'cursor'
|
|
1854
1843
|
? providerParam
|
|
1855
1844
|
: 'claude';
|
|
1856
1845
|
const result = await runCliUpdate(deps.getCapabilities(), provider);
|
|
@@ -112,7 +112,7 @@ export async function resolveBoundCwd(callerCwd, workflowId) {
|
|
|
112
112
|
...clusterStore.listKnownClusterIds().map(id => clusterStore.getClusterCached(id)?.cwd)];
|
|
113
113
|
for (const root of live) {
|
|
114
114
|
try {
|
|
115
|
-
if (root &&
|
|
115
|
+
if (root && sameDirectory(canonical, root))
|
|
116
116
|
return { ok: true, cwd: callerCwd };
|
|
117
117
|
}
|
|
118
118
|
catch { /* protected or stale root */ }
|
|
@@ -120,13 +120,30 @@ export async function resolveBoundCwd(callerCwd, workflowId) {
|
|
|
120
120
|
const roots = await knownRoots();
|
|
121
121
|
for (const root of roots) {
|
|
122
122
|
try {
|
|
123
|
-
if (
|
|
123
|
+
if (sameDirectory(canonical, root))
|
|
124
124
|
return { ok: true, cwd: callerCwd };
|
|
125
125
|
}
|
|
126
126
|
catch { /* protected or stale root */ }
|
|
127
127
|
}
|
|
128
128
|
return { ok: false, reason: 'unknown-cwd' };
|
|
129
129
|
}
|
|
130
|
+
// Node's JavaScript realpath keeps a Windows 8.3 short name and the letter
|
|
131
|
+
// case as written, while the native resolver (used by the document list)
|
|
132
|
+
// expands both. A known root and a caller cwd that name the same directory in
|
|
133
|
+
// different spellings still match; both sides pass safeDirectory first.
|
|
134
|
+
function sameDirectory(canonical, root) {
|
|
135
|
+
const other = safeDirectory(root);
|
|
136
|
+
if (other === canonical)
|
|
137
|
+
return true;
|
|
138
|
+
if (process.platform !== 'win32')
|
|
139
|
+
return false;
|
|
140
|
+
try {
|
|
141
|
+
return realpathSync.native(other) === realpathSync.native(canonical);
|
|
142
|
+
}
|
|
143
|
+
catch {
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
130
147
|
export function boundCwdError(reason) {
|
|
131
148
|
switch (reason) {
|
|
132
149
|
case 'none': return 'cwd or a workflow id with a bound cwd is required';
|
package/server/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { releaseProjectSettingsWatcher } from './settings.js';
|
|
2
|
+
import { initTranscriptWorkerHandlers, handleTranscriptWorkerPreview, handleTranscriptWorkerCreate } from './ws/transcriptWorkerHandlers.js';
|
|
2
3
|
import { NativeTaskAdmission, assertNativeTaskAllowed } from './providers/claude-native/taskAdmission.js';
|
|
3
4
|
import { resolveNativeSubagents, CLAUDE_MODELS } from '@arco/shared';
|
|
4
5
|
import { getCatalog as getNativeTaskCatalog } from './providers/claude-native/catalog.js';
|
|
@@ -70,7 +71,7 @@ import { startMemoryMonitor, logMemorySample } from './memoryMonitor.js';
|
|
|
70
71
|
import { listeningPortsForPidFamily } from './workers/procListening.js';
|
|
71
72
|
import { updateMeta, } from './workflowMeta.js';
|
|
72
73
|
import { flushAll as flushAllWorkflowEvents, initWorkflowStore } from './workflowStore.js';
|
|
73
|
-
import { detachClusterObservers, handleClusterAddFreshWorkers, handleClusterAutoTurnToggle, handleClusterAutoPickupSet, handleClusterBroadcast, handleClusterCreate, handleClusterCreateFromScratch, handleClusterCreateWithFreshWorkers, handleClusterDelete, handleClusterDispatchSettingsUpdate, handleClusterDispatchOnce, handleClusterDispatchToggle, handleClusterSwarmCreate, handleClusterOrchestrationAssistRequest, handleClusterOrchestrationProposalApply, handleClusterOrchestrationProposalList, handleClusterOrchestrationProposalReject, handleClusterIdleNudgerToggle, handleClusterEfficiencySet, handleClusterAutoCompactionSet, handleClusterRemoteSet, handleClusterGatesSet, handleClusterMemberReorder, handleClusterProgressSet, handleClusterTaskBoardAttachSet, handleClusterTaskBoardModeSet, handleClusterMemberAdd, handleClusterMemberFocusSet, handleClusterMemberRemove, handleClusterMemberReplace, handleClusterMemberRoleSet, handleClusterMemberTierSet, handleClusterPlanAttach, handleClusterPlanClear, handleClusterPlanSet, handleClusterRename, handleClusterSnapshotSave, handleClusterSnapshotList, handleClusterSnapshotRestore, handleClusterSnapshotDelete, handleClusterSubscribe, handleOperatorPeerSend, dispatchTaskTurnSynthetic, broadcastTaskDispatchResult, initClusterHandlers, } from './ws/clusterHandlers.js';
|
|
74
|
+
import { detachClusterObservers, handleClusterAddFreshWorkers, handleClusterAutoTurnToggle, handleClusterAutoPickupSet, handleClusterBroadcast, handleClusterCreate, handleClusterCreateFromScratch, handleClusterCreateWithFreshWorkers, handleClusterDelete, handleClusterDispatchSettingsUpdate, handleClusterDispatchOnce, handleClusterDispatchToggle, handleClusterSwarmCreate, handleClusterOrchestrationAssistRequest, handleClusterOrchestrationProposalApply, handleClusterOrchestrationProposalList, handleClusterOrchestrationProposalReject, handleClusterIdleNudgerToggle, handleClusterEfficiencySet, handleClusterSkillsSet, handleClusterAutoCompactionSet, handleClusterRemoteSet, handleClusterGatesSet, handleClusterMemberReorder, handleClusterProgressSet, handleClusterTaskBoardAttachSet, handleClusterTaskBoardModeSet, handleClusterMemberAdd, handleClusterMemberFocusSet, handleClusterMemberRemove, handleClusterMemberReplace, handleClusterMemberRoleSet, handleClusterMemberTierSet, handleClusterPlanAttach, handleClusterPlanClear, handleClusterPlanSet, handleClusterRename, handleClusterSnapshotSave, handleClusterSnapshotList, handleClusterSnapshotRestore, handleClusterSnapshotDelete, handleClusterSubscribe, handleOperatorPeerSend, dispatchTaskTurnSynthetic, broadcastTaskDispatchResult, initClusterHandlers, } from './ws/clusterHandlers.js';
|
|
74
75
|
import { deriveAutoHandoff, derivePrimaryConfig, handleUserMessage, enqueueBusyReminder, initTurnEngine, maybeAutoCompactPolicy, claimBusy, releaseBusy, persistInitialMeta, writeCalibrationToMeta, broadcastQueueUpdate, drainQueueIfIdle } from './ws/turnEngine.js';
|
|
75
76
|
import { handleBakeoffCleanup, handleBakeoffList, handleBakeoffPromote, handleBakeoffStart, initBakeoffHandlers, } from './ws/bakeoffHandlers.js';
|
|
76
77
|
import { createBlankNativeWorkflow, handleAttachCodebaseMemory, handleCancel, handleCancelQueuedMessage, handleCancelResearch, handleCancelReview, handleClearPreviewPort, handleCreateLabelRequest, handleCreateWorkflow, handleDetachCodebaseMemory, handleDocEditRequest, handleMdTuneupRequest, handleMdTuneupAccept, handleMdTuneupUndo, handleMdTuneupCandidatesRequest, handleHandoffCancel, handleHandoffLockClear, handleLoadEarlierMessages, handleRemoveWorkflow, handleRenameWorkflow, handleRevertToCheckpoint, handleRevertToPointRequest, handleResearchRequest, handleRecallSummaryRequest, handleReviewRequest, handleSetPreviewPort, handleUpdatePrimaryConfig, initWorkflowHandlers, } from './ws/workflowHandlers.js';
|
|
@@ -424,6 +425,19 @@ const previewAutoDetect = new PreviewAutoDetect({
|
|
|
424
425
|
});
|
|
425
426
|
initTurnEngine({ previewAutoDetect, handleCreateWorkflow, handleHandoffRequest, handleCompactWorkflow });
|
|
426
427
|
initWorkflowHandlers({ previewAutoDetect, handleRehydrateWorkflows });
|
|
428
|
+
initTranscriptWorkerHandlers({
|
|
429
|
+
create: async (ws, session, config) => {
|
|
430
|
+
let id;
|
|
431
|
+
await handleCreateWorkflow(ws, session, config, { backgroundCreated: true, onCreated: created => { id = created; } });
|
|
432
|
+
if (!id)
|
|
433
|
+
throw new Error('The new worker could not be created. Review its settings and try again.');
|
|
434
|
+
return id;
|
|
435
|
+
},
|
|
436
|
+
seed: (ws, session, workflowId, content) => {
|
|
437
|
+
void handleUserMessage(ws, session, workflowId, content, crypto.randomUUID(), undefined, false, undefined, undefined)
|
|
438
|
+
.catch(() => send(ws, { type: 'error', workflowId, message: 'Could not start the new worker. Open its tab to review the request and retry.' }));
|
|
439
|
+
},
|
|
440
|
+
});
|
|
427
441
|
setStrataSwitchActivityCheck(() => [...workflows.values()].some((wf) => (wf.busy && ['ollama', 'llamacpp', 'lmstudio', 'deepseek'].includes(wf.primary.provider)) ||
|
|
428
442
|
Object.values(wf.manager.snapshotWorkers()).some((w) => ['ollama', 'llamacpp', 'lmstudio', 'deepseek'].includes(w.provider ?? '') && (w.status === 'running' || w.status === 'spawning'))));
|
|
429
443
|
setDeepSeekActivityCheck((includeDeepSeek) => [...workflows.values()].some((wf) => (wf.busy && ['ollama', 'llamacpp', 'lmstudio', 'strata', ...(includeDeepSeek ? ['deepseek'] : [])].includes(wf.primary.provider)) ||
|
|
@@ -532,6 +546,12 @@ wss.on('connection', (ws) => {
|
|
|
532
546
|
return;
|
|
533
547
|
}
|
|
534
548
|
switch (msg.type) {
|
|
549
|
+
case 'transcript_worker_preview':
|
|
550
|
+
void handleTranscriptWorkerPreview(ws, msg);
|
|
551
|
+
break;
|
|
552
|
+
case 'transcript_worker_create':
|
|
553
|
+
void handleTranscriptWorkerCreate(ws, session, msg);
|
|
554
|
+
break;
|
|
535
555
|
case 'create_workflow':
|
|
536
556
|
(msg.config.incognito ? withoutOperationalLogging : (fn) => fn())(() => handleCreateWorkflow(ws, session, msg.config).catch((err) => {
|
|
537
557
|
console.error('[arco] create_workflow handler failed:', err);
|
|
@@ -1121,6 +1141,9 @@ wss.on('connection', (ws) => {
|
|
|
1121
1141
|
console.error('[arco] cluster_efficiency_set handler failed:', err);
|
|
1122
1142
|
});
|
|
1123
1143
|
break;
|
|
1144
|
+
case 'cluster_skills_set':
|
|
1145
|
+
void handleClusterSkillsSet(ws, msg.clusterId, msg.pins);
|
|
1146
|
+
break;
|
|
1124
1147
|
case 'cluster_remote_set':
|
|
1125
1148
|
handleClusterRemoteSet(ws, msg.clusterId, msg.enabled).catch((err) => {
|
|
1126
1149
|
console.error('[arco] cluster_remote_set handler failed:', err);
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { basename } from 'node:path';
|
|
2
|
+
const LARGE_RECORD_BYTES = 16 * 1024 * 1024;
|
|
3
|
+
const warnedSources = new Set();
|
|
4
|
+
// Retain only the current record's bytes. Decode once at its boundary so a
|
|
5
|
+
// split UTF-8 character is never replaced and a long record does not build a
|
|
6
|
+
// chain of decoded string fragments. Large records stay readable as before.
|
|
7
|
+
export async function* jsonlLines(input, source, options = {}) {
|
|
8
|
+
let parts = [];
|
|
9
|
+
let bytes = 0;
|
|
10
|
+
let afterCr = false;
|
|
11
|
+
const add = (part) => {
|
|
12
|
+
if (!part.length)
|
|
13
|
+
return;
|
|
14
|
+
parts.push(part);
|
|
15
|
+
bytes += part.length;
|
|
16
|
+
if (bytes > LARGE_RECORD_BYTES && !warnedSources.has(source)) {
|
|
17
|
+
warnedSources.add(source);
|
|
18
|
+
console.warn(`[arco] A record in ${basename(source)} exceeds 16 MiB; reading it in full.`);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const take = () => {
|
|
22
|
+
const line = parts.length === 1 ? parts[0].toString('utf8') : Buffer.concat(parts, bytes).toString('utf8');
|
|
23
|
+
parts = [];
|
|
24
|
+
bytes = 0;
|
|
25
|
+
return line;
|
|
26
|
+
};
|
|
27
|
+
for await (const chunk of input) {
|
|
28
|
+
let start = 0;
|
|
29
|
+
const hasCr = options.carriageReturns !== false && chunk.includes(0x0d);
|
|
30
|
+
while (start < chunk.length) {
|
|
31
|
+
if (afterCr) {
|
|
32
|
+
afterCr = false;
|
|
33
|
+
if (chunk[start] === 0x0a) {
|
|
34
|
+
start++;
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const lf = chunk.indexOf(0x0a, start);
|
|
39
|
+
const cr = hasCr ? chunk.indexOf(0x0d, start) : -1;
|
|
40
|
+
const end = lf < 0 ? cr : cr < 0 ? lf : Math.min(lf, cr);
|
|
41
|
+
if (end < 0)
|
|
42
|
+
break;
|
|
43
|
+
add(chunk.subarray(start, end));
|
|
44
|
+
yield take();
|
|
45
|
+
afterCr = chunk[end] === 0x0d;
|
|
46
|
+
start = end + 1;
|
|
47
|
+
}
|
|
48
|
+
add(chunk.subarray(start));
|
|
49
|
+
}
|
|
50
|
+
if (bytes && options.finalLine !== false)
|
|
51
|
+
yield take();
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=jsonlLines.js.map
|
|
@@ -376,7 +376,7 @@ export function registerClusterTools(server, ctx) {
|
|
|
376
376
|
}
|
|
377
377
|
});
|
|
378
378
|
registerTool('cluster_task_create', {
|
|
379
|
-
description: 'Create a non-terminal task on the shared cluster board. New tasks start as todo;
|
|
379
|
+
description: 'Create a non-terminal task on the shared cluster board. New tasks start as todo; terminal statuses cannot be set when creating a task. Use title plus optional body/notes, assignee, priority, parentIds, links, reviewRequired, goalMode, and goalMaxTurns. parentIds must refer to existing tasks. When the task implements a plan item, start the title with that item\'s id or text (e.g. \'P6.9 Live tab drag follow on X11\'): cluster_task_show then resolves the item\'s reference docs (its own ref links, its sub-bullets, its phase intro) for whoever works it. Add any extra ref:slug links the task needs to notes.',
|
|
380
380
|
inputSchema: {
|
|
381
381
|
title: z.string().min(1).describe('Task title. Required and non-empty.'),
|
|
382
382
|
body: z.string().optional().describe('Initial task body. Alias for notes when notes is absent.'),
|
|
@@ -459,7 +459,7 @@ export function registerClusterTools(server, ctx) {
|
|
|
459
459
|
}
|
|
460
460
|
});
|
|
461
461
|
registerTool('cluster_task_update', {
|
|
462
|
-
description: "Update a task on the shared cluster board.
|
|
462
|
+
description: "Update a task on the shared cluster board. Workers move completed work to review. Only the director signs off: set signoff to met, partial, or not_met with a plain one-line summary for the operator, without commit hashes. A director's met sign-off closes the task unless Board auto-done is off in Settings; partial and not_met leave the task status unchanged unless you set a status. Tell the operator in chat what to try. Direct status changes to done or archived remain operator-only.",
|
|
463
463
|
inputSchema: {
|
|
464
464
|
id: z.string().min(1).describe('Task id from cluster_task_list.'),
|
|
465
465
|
status: z.enum(['triage', 'todo', 'ready', 'in_progress', 'blocked', 'review']).optional().describe("New status. 'done' and 'archived' are rejected — operator-only."),
|
|
@@ -468,7 +468,7 @@ export function registerClusterTools(server, ctx) {
|
|
|
468
468
|
signoff: z.object({
|
|
469
469
|
state: z.enum(['met', 'not_met', 'partial']).describe('Your verdict: met / not_met / partial.'),
|
|
470
470
|
summary: z.string().optional().describe('One-line reason shown on the board card.'),
|
|
471
|
-
}).optional().describe('
|
|
471
|
+
}).optional().describe('Director verdict: met closes the task unless Board auto-done is off.'),
|
|
472
472
|
},
|
|
473
473
|
}, async (args) => {
|
|
474
474
|
try {
|
|
@@ -570,7 +570,7 @@ export function registerClusterTools(server, ctx) {
|
|
|
570
570
|
}
|
|
571
571
|
});
|
|
572
572
|
registerTool('cluster_task_complete', {
|
|
573
|
-
description: "Submit a completion report for a task. Moves the task to review and appends a durable COMPLETION REPORT comment. It does
|
|
573
|
+
description: "Submit a completion report for a task. Moves the task to review and appends a durable COMPLETION REPORT comment. It does not mark done; the director reviews the report.",
|
|
574
574
|
inputSchema: {
|
|
575
575
|
id: z.string().min(1).describe('Task id from cluster_task_list.'),
|
|
576
576
|
summary: z.string().min(1).describe('What changed, tests run, files touched, and follow-ups.'),
|
|
@@ -50,6 +50,7 @@ export declare function runPrimaryTurn(ctx: TurnContext, args: {
|
|
|
50
50
|
incognito?: boolean;
|
|
51
51
|
drainSteer?: () => SteerItem[];
|
|
52
52
|
peekSteer?: () => readonly SteerItem[];
|
|
53
|
+
pendingInput?: WorkerConfig['pendingInput'];
|
|
53
54
|
requeueSteer?: (items: SteerItem[], bucket: 'steer' | 'follow-up') => void;
|
|
54
55
|
onSteerDelivered?: (items: SteerItem[]) => void;
|
|
55
56
|
codexTransport?: 'exec' | 'appserver';
|
|
@@ -129,7 +129,7 @@ function emitWorkerStuck(ctx, toolName, verdict) {
|
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
export function runPrimaryTurn(ctx, args) {
|
|
132
|
-
const { primary, prompt, resumeSessionId, attachments, disableRssGuard, appendSystemPrompt, systemPrompt, interactionMode, disableProviderHooks, chatWebAccess, voiceOperator, incognito, drainSteer, peekSteer, requeueSteer, onSteerDelivered, codexTransport, codexContextPolicy, providerAccountRef, codexHome, claudeTransport, ultracode, claudeNativeTaskDisabled, claudeNativeSubagent, claudeNativeCompact, claudeNativeInTurnCompactPercent, claudeNativeForceInterleavedThinkingBeta, claudeNativeThinkingDisplay, nativeSubagents, claudeNativePlanModeArmed, turnNotice, efficiencyToolFilter, efficiencyFactForce, efficiencyConfigProtection, efficiencySandbox, reviewSafeMode, outputStyle, goal, toolPosture, clusterId, clusterAccessMode, executionCwd, persistenceCwd, clusterTaskBoardAttached, clusterPlan, clusterRole, clusterEfficiencyDoctrine, clusterProgressDoctrine, clusterMcpConfigPath, codebaseMemoryAttached, codebaseMemoryIndexPath, mcpRegistryServers, mcpDisallowedTools, ollamaParams, webSearchMaxUses } = args;
|
|
132
|
+
const { primary, prompt, resumeSessionId, attachments, disableRssGuard, appendSystemPrompt, systemPrompt, interactionMode, disableProviderHooks, chatWebAccess, voiceOperator, incognito, drainSteer, peekSteer, pendingInput, requeueSteer, onSteerDelivered, codexTransport, codexContextPolicy, providerAccountRef, codexHome, claudeTransport, ultracode, claudeNativeTaskDisabled, claudeNativeSubagent, claudeNativeCompact, claudeNativeInTurnCompactPercent, claudeNativeForceInterleavedThinkingBeta, claudeNativeThinkingDisplay, nativeSubagents, claudeNativePlanModeArmed, turnNotice, efficiencyToolFilter, efficiencyFactForce, efficiencyConfigProtection, efficiencySandbox, reviewSafeMode, outputStyle, goal, toolPosture, clusterId, clusterAccessMode, executionCwd, persistenceCwd, clusterTaskBoardAttached, clusterPlan, clusterRole, clusterEfficiencyDoctrine, clusterProgressDoctrine, clusterMcpConfigPath, codebaseMemoryAttached, codebaseMemoryIndexPath, mcpRegistryServers, mcpDisallowedTools, ollamaParams, webSearchMaxUses } = args;
|
|
133
133
|
const workerId = `primary-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 6)}`;
|
|
134
134
|
// Claude: pre-mint on first turn so meta.json can pin it before the CLI
|
|
135
135
|
// even starts. Codex mints its own; we'll learn it via the init event.
|
|
@@ -169,6 +169,7 @@ export function runPrimaryTurn(ctx, args) {
|
|
|
169
169
|
disableRssGuard,
|
|
170
170
|
drainSteer,
|
|
171
171
|
peekSteer,
|
|
172
|
+
pendingInput,
|
|
172
173
|
requeueSteer,
|
|
173
174
|
onSteerDelivered,
|
|
174
175
|
codexTransport,
|
|
@@ -76,6 +76,10 @@ export declare function applyUpdate(tasks: LedgerTask[], id: string, patch: {
|
|
|
76
76
|
release?: string;
|
|
77
77
|
worktree?: TaskWorktree | null;
|
|
78
78
|
signoff?: TaskSignoff | null;
|
|
79
|
+
directorClosure?: {
|
|
80
|
+
byWorkflowId: string;
|
|
81
|
+
at: number;
|
|
82
|
+
};
|
|
79
83
|
updatedBy?: string;
|
|
80
84
|
}): {
|
|
81
85
|
tasks: LedgerTask[];
|
|
@@ -14,10 +14,9 @@ import { ensureProjectStateIgnore } from '../projectStateIgnore.js';
|
|
|
14
14
|
// need — is documented in docs/TASK_LEDGER.md, not assumed). The working set is
|
|
15
15
|
// small + single-writer, so query() is load-all + filter-in-JS.
|
|
16
16
|
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
// recorded operator events; there is no auto-done / no inference anywhere.
|
|
17
|
+
// Direct terminal-status updates are operator-controlled. A director's met
|
|
18
|
+
// sign-off may close a task when Board auto-done is enabled; replay uses the
|
|
19
|
+
// recorded result and never infers a new status.
|
|
21
20
|
import { promises as fs, existsSync } from 'fs';
|
|
22
21
|
import path from 'path';
|
|
23
22
|
import { randomUUID } from 'crypto';
|
|
@@ -711,6 +710,10 @@ patch) {
|
|
|
711
710
|
else
|
|
712
711
|
delete next.signoff;
|
|
713
712
|
}
|
|
713
|
+
if (patch.directorClosure)
|
|
714
|
+
next.directorClosure = patch.directorClosure;
|
|
715
|
+
else if (patch.status && patch.status !== 'done')
|
|
716
|
+
delete next.directorClosure;
|
|
714
717
|
const out = [...tasks];
|
|
715
718
|
out[i] = next;
|
|
716
719
|
return { tasks: out, updated: next };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ProviderName } from '@arco/shared';
|
|
2
2
|
import type { WorkflowState } from './workflows/types.js';
|
|
3
|
+
export declare function reportHistoryLoadFailure(workflowId: string, owner: object, provider: 'native' | 'cli', emit?: (content: string) => void, nativeLimitBytes?: number): void;
|
|
3
4
|
export declare function hasConversationHistory(cwd: string, workflowId: string, afterSeq?: number): Promise<boolean>;
|
|
4
5
|
export declare function reportConversationSaveFailure(workflowId: string, err: unknown): void;
|
|
5
6
|
export declare function ensureWorkflowMetadata(cwd: string, workflowId: string, wf: WorkflowState): Promise<void>;
|
|
@@ -2,6 +2,23 @@ import { resolveClaudeTransport } from './claudeTransport.js';
|
|
|
2
2
|
import { readMeta, persistInitialMeta, reconcileLatestCliSession, workflowMetaSeed, updateMeta } from './workflowMeta.js';
|
|
3
3
|
import { scanEventsOfTypes } from './workflowStore.js';
|
|
4
4
|
import { broadcastWorkflow, broadcastTransient } from './server/broadcast.js';
|
|
5
|
+
const historyLoadNotices = new WeakMap();
|
|
6
|
+
export function reportHistoryLoadFailure(workflowId, owner, provider, emit, nativeLimitBytes) {
|
|
7
|
+
const shown = historyLoadNotices.get(owner) ?? new Set();
|
|
8
|
+
if (shown.has(provider))
|
|
9
|
+
return;
|
|
10
|
+
shown.add(provider);
|
|
11
|
+
historyLoadNotices.set(owner, shown);
|
|
12
|
+
const content = provider === 'native'
|
|
13
|
+
? nativeLimitBytes !== undefined
|
|
14
|
+
? `Earlier context could not be rebuilt within the ${nativeLimitBytes / (1024 * 1024)} MiB reconstruction limit, so the agent continues without it. Earlier messages remain in this tab.`
|
|
15
|
+
: 'Earlier context could not be rebuilt for this conversation, so the agent continues without it. Earlier messages remain in this tab.'
|
|
16
|
+
: 'Earlier Claude CLI session history could not be loaded in this tab. The saved conversation is intact; new session messages will appear when the file can be read.';
|
|
17
|
+
if (emit)
|
|
18
|
+
emit(content);
|
|
19
|
+
else
|
|
20
|
+
broadcastWorkflow(workflowId, { type: 'system_notice', workflowId, content });
|
|
21
|
+
}
|
|
5
22
|
export async function hasConversationHistory(cwd, workflowId, afterSeq = 0) {
|
|
6
23
|
let found = false;
|
|
7
24
|
await scanEventsOfTypes(cwd, workflowId, ['primary_complete', 'primary_text'], event => { if ((('seq' in event && typeof event.seq === 'number') ? event.seq : 0) > afterSeq)
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { type ServerCompactionBlock } from './serverFold.js';
|
|
2
|
+
export declare const NATIVE_RECONSTRUCTION_MAX_BYTES: number;
|
|
3
|
+
export declare class NativeReconstructionLimitError extends Error {
|
|
4
|
+
readonly rangeBytes: number;
|
|
5
|
+
readonly code = "NATIVE_RECONSTRUCTION_LIMIT";
|
|
6
|
+
readonly limitBytes: number;
|
|
7
|
+
constructor(rangeBytes: number);
|
|
8
|
+
}
|
|
2
9
|
export declare const RESUME_EXACT_REPLAY_BYTES: number;
|
|
3
10
|
export declare const RESUME_RECENT_TAIL_BYTES: number;
|
|
4
11
|
export type ClaudeResumeMessage = {
|
|
@@ -57,10 +64,12 @@ export type ResumeReplayResult = {
|
|
|
57
64
|
summaryThroughSeq?: number;
|
|
58
65
|
summaryBytes?: number;
|
|
59
66
|
tailEvents?: number;
|
|
67
|
+
summaryNotice?: string;
|
|
60
68
|
reconstructed?: boolean;
|
|
61
69
|
};
|
|
62
70
|
type SummaryBuild = {
|
|
63
71
|
summary: string;
|
|
72
|
+
summaryNotice?: string;
|
|
64
73
|
throughSeq: number | null;
|
|
65
74
|
lastHandoffSeq: number | null;
|
|
66
75
|
};
|