arco-workbench 0.1.7 → 0.1.8

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.
Files changed (210) hide show
  1. package/CONTRIBUTING.md +52 -12
  2. package/README.md +14 -12
  3. package/client/dist/assets/{PhosphorBackdrop-DVQdBrTw.js → PhosphorBackdrop-D7jdAV_G.js} +1 -1
  4. package/client/dist/assets/{ThemedBackgroundShaderImpl-BfSs2tB4.js → ThemedBackgroundShaderImpl-DrDm60h8.js} +1 -1
  5. package/client/dist/assets/{XtermView-DaMjC8Ny.js → XtermView-BGFujb1e.js} +1 -1
  6. package/client/dist/assets/{galleryEditor-BCQnXj7R.js → galleryEditor-D951A2sE.js} +1 -1
  7. package/client/dist/assets/{index-COfbHCYv.js → index-CsVy3eZm.js} +246 -246
  8. package/client/dist/index.html +1 -1
  9. package/client/src/components/ClusterRightPanel/ReplaceMemberDialog.tsx +65 -15
  10. package/client/src/components/ClusterRightPanel/SkillsControl.tsx +107 -0
  11. package/client/src/components/ClusterRightPanel/index.tsx +4 -0
  12. package/client/src/components/ClusterTaskBoardTab.tsx +9 -22
  13. package/client/src/components/NeedsYouBadge.tsx +3 -3
  14. package/client/src/components/ProviderReleasesModal.tsx +8 -4
  15. package/client/src/components/ProvidersPopover.tsx +28 -23
  16. package/client/src/components/SettingsPanel.tsx +2 -2
  17. package/client/src/components/SkillsSettings.tsx +5 -0
  18. package/client/src/components/TabBar.tsx +91 -9
  19. package/client/src/components/TerminalInput.tsx +12 -10
  20. package/client/src/components/TranscriptSendDialog.tsx +12 -8
  21. package/client/src/components/TranscriptWorkerDialog.tsx +119 -0
  22. package/client/src/components/clusterNeedsYou.ts +11 -18
  23. package/client/src/help/content/cluster.tsx +38 -17
  24. package/client/src/help/content/composer.tsx +22 -0
  25. package/client/src/help/content/header.tsx +16 -0
  26. package/client/src/help/content/misc.tsx +8 -0
  27. package/client/src/help/content/settings.tsx +18 -4
  28. package/client/src/help/content/tabbar.tsx +5 -0
  29. package/client/src/help/manualSections/actions.tsx +31 -0
  30. package/client/src/help/manualSections/clusters.tsx +41 -20
  31. package/client/src/help/manualSections/configuration.tsx +18 -0
  32. package/client/src/help/manualSections/maintenance.tsx +18 -0
  33. package/client/src/help/manualSections/providers.tsx +32 -8
  34. package/client/src/help/manualSections/troubleshooting.tsx +2 -1
  35. package/client/src/help/manualSections/workflows.tsx +12 -0
  36. package/client/src/help/manualSections/workspace.tsx +6 -0
  37. package/client/src/utils/transcriptWorkerRequest.ts +24 -0
  38. package/client/src/ws/handleServerMessage.ts +8 -2
  39. package/docs/ARCHITECTURE.md +1 -1
  40. package/docs/CLIENT.md +9 -8
  41. package/docs/FEATURES.md +8 -5
  42. package/docs/GETTING_STARTED.md +4 -3
  43. package/docs/GOTCHAS.md +2 -1
  44. package/docs/OPERATIONS.md +14 -4
  45. package/docs/PERSISTENCE.md +7 -2
  46. package/docs/PRIMITIVES.md +42 -0
  47. package/docs/PROTOCOL_CLUSTER.md +42 -3
  48. package/docs/PROTOCOL_PRIMITIVES.md +39 -0
  49. package/docs/PROVIDERS.md +50 -13
  50. package/docs/SETTINGS.md +27 -3
  51. package/docs/TASK_LEDGER.md +7 -15
  52. package/native/darwin-arm64/manifest.json +1 -1
  53. package/node_modules/@arco/shared/dist/clusterCoordination.d.ts +2 -0
  54. package/node_modules/@arco/shared/dist/clusterCoordination.js +5 -1
  55. package/node_modules/@arco/shared/dist/protocol/clientMessages.d.ts +3 -2
  56. package/node_modules/@arco/shared/dist/protocol/clusters.d.ts +13 -1
  57. package/node_modules/@arco/shared/dist/protocol/index.d.ts +1 -0
  58. package/node_modules/@arco/shared/dist/protocol/index.js +1 -0
  59. package/node_modules/@arco/shared/dist/protocol/models.d.ts +4 -3
  60. package/node_modules/@arco/shared/dist/protocol/models.js +26 -2
  61. package/node_modules/@arco/shared/dist/protocol/serverMessages.d.ts +2 -1
  62. package/node_modules/@arco/shared/dist/protocol/tasks.d.ts +4 -0
  63. package/node_modules/@arco/shared/dist/protocol/transcriptWorker.d.ts +47 -0
  64. package/node_modules/@arco/shared/dist/protocol/transcriptWorker.js +2 -0
  65. package/node_modules/@arco/shared/dist/runtimeVersions.d.ts +1 -0
  66. package/node_modules/@arco/shared/dist/runtimeVersions.js +14 -0
  67. package/node_modules/@arco/shared/package.json +1 -1
  68. package/package.json +2 -2
  69. package/scripts/packaging/arco.mjs +1 -1
  70. package/scripts/packaging/native-repair.mjs +32 -4
  71. package/server/dist/atomicFile.js +1 -2
  72. package/server/dist/capabilities.d.ts +5 -2
  73. package/server/dist/capabilities.js +59 -9
  74. package/server/dist/cliUpdateDecision.d.ts +1 -1
  75. package/server/dist/cliUpdateDecision.js +5 -3
  76. package/server/dist/clusterDirector.js +1 -1
  77. package/server/dist/clusterPeerOps.js +10 -7
  78. package/server/dist/clusterProgress.js +1 -1
  79. package/server/dist/clusterSkills.d.ts +13 -0
  80. package/server/dist/clusterSkills.js +81 -0
  81. package/server/dist/clusterSnapshots.js +2 -0
  82. package/server/dist/clusterStore.d.ts +7 -2
  83. package/server/dist/clusterStore.js +42 -1
  84. package/server/dist/diagnostics/codeSkew.js +1 -0
  85. package/server/dist/eventLog.d.ts +7 -0
  86. package/server/dist/eventLog.js +70 -13
  87. package/server/dist/historyLimits.d.ts +1 -0
  88. package/server/dist/historyLimits.js +3 -0
  89. package/server/dist/http/router.js +1 -1
  90. package/server/dist/index.js +24 -1
  91. package/server/dist/jsonlLines.d.ts +4 -0
  92. package/server/dist/jsonlLines.js +53 -0
  93. package/server/dist/management/identity.js +1 -0
  94. package/server/dist/mcp/clusterMcpTools.js +4 -4
  95. package/server/dist/project/taskLedger.d.ts +4 -0
  96. package/server/dist/project/taskLedger.js +7 -4
  97. package/server/dist/providerConversation.d.ts +1 -0
  98. package/server/dist/providerConversation.js +17 -0
  99. package/server/dist/providers/claude-native/resumeSummary.d.ts +9 -0
  100. package/server/dist/providers/claude-native/resumeSummary.js +102 -49
  101. package/server/dist/providers/claude-native/worker.js +8 -4
  102. package/server/dist/providers/claude.js +2 -1
  103. package/server/dist/providers/clusterTaskToolDefinitions.js +4 -4
  104. package/server/dist/providers/codex-appserver/catalog.js +16 -1
  105. package/server/dist/providers/codex.js +2 -1
  106. package/server/dist/providers/codexCodeMode.d.ts +1 -1
  107. package/server/dist/providers/codexCodeMode.js +4 -3
  108. package/server/dist/providers/cursor/print.js +2 -1
  109. package/server/dist/providers/cursor/worker.js +2 -1
  110. package/server/dist/providers/llamacpp.js +17 -8
  111. package/server/dist/providers/ollamaRecovery.js +6 -6
  112. package/server/dist/providers/ollamaResilience.js +3 -3
  113. package/server/dist/providers/ollamaTokens.js +1 -1
  114. package/server/dist/quota.d.ts +0 -18
  115. package/server/dist/quota.js +0 -44
  116. package/server/dist/replacementHistory.d.ts +19 -0
  117. package/server/dist/replacementHistory.js +49 -0
  118. package/server/dist/server/broadcast.d.ts +2 -1
  119. package/server/dist/server/broadcast.js +1 -0
  120. package/server/dist/server/prompts.d.ts +1 -0
  121. package/server/dist/server/prompts.js +6 -1
  122. package/server/dist/sessionJsonl.d.ts +1 -1
  123. package/server/dist/sessionJsonl.js +115 -40
  124. package/server/dist/smartPickupAdapters.js +15 -2
  125. package/server/dist/transcriptWorker.d.ts +34 -0
  126. package/server/dist/transcriptWorker.js +201 -0
  127. package/server/dist/workflowStore.d.ts +1 -0
  128. package/server/dist/workflowStore.js +31 -0
  129. package/server/dist/ws/clusterHandlers.d.ts +1 -0
  130. package/server/dist/ws/clusterHandlers.js +62 -26
  131. package/server/dist/ws/handoffHandlers.js +5 -2
  132. package/server/dist/ws/transcriptWorkerHandlers.d.ts +25 -0
  133. package/server/dist/ws/transcriptWorkerHandlers.js +139 -0
  134. package/server/dist/ws/turnEngine.js +23 -9
  135. package/server/dist/ws/updatePrimaryConfig.js +27 -8
  136. package/server/dist/ws/workflowHandlers.d.ts +4 -1
  137. package/server/dist/ws/workflowHandlers.js +3 -1
  138. package/server/package.json +1 -1
  139. package/server/src/atomicFile.ts +1 -2
  140. package/server/src/capabilities.ts +58 -17
  141. package/server/src/cliUpdateDecision.ts +5 -4
  142. package/server/src/clusterDirector.ts +1 -1
  143. package/server/src/clusterPeerOps.ts +11 -8
  144. package/server/src/clusterProgress.ts +1 -1
  145. package/server/src/clusterSkills.ts +79 -0
  146. package/server/src/clusterSnapshots.ts +1 -0
  147. package/server/src/clusterStore.ts +38 -0
  148. package/server/src/diagnostics/codeSkew.ts +1 -0
  149. package/server/src/eventLog.ts +73 -13
  150. package/server/src/historyLimits.ts +2 -0
  151. package/server/src/http/router.ts +1 -1
  152. package/server/src/index.ts +23 -0
  153. package/server/src/jsonlLines.ts +52 -0
  154. package/server/src/management/identity.ts +1 -0
  155. package/server/src/mcp/clusterMcpTools.ts +4 -4
  156. package/server/src/project/taskLedger.ts +7 -5
  157. package/server/src/providerConversation.ts +15 -0
  158. package/server/src/providers/claude-native/resumeSummary.ts +98 -50
  159. package/server/src/providers/claude-native/worker.ts +8 -4
  160. package/server/src/providers/claude.ts +2 -1
  161. package/server/src/providers/clusterTaskToolDefinitions.ts +4 -4
  162. package/server/src/providers/codex-appserver/catalog.ts +14 -1
  163. package/server/src/providers/codex.ts +2 -1
  164. package/server/src/providers/codexCodeMode.ts +4 -4
  165. package/server/src/providers/cursor/print.ts +2 -1
  166. package/server/src/providers/cursor/worker.ts +2 -1
  167. package/server/src/providers/llamacpp.ts +18 -7
  168. package/server/src/providers/llamacppRecovery.ts +2 -0
  169. package/server/src/providers/ollamaRecovery.ts +6 -6
  170. package/server/src/providers/ollamaResilience.ts +3 -3
  171. package/server/src/providers/ollamaTokens.ts +1 -1
  172. package/server/src/providers/ollamaToolSubset.ts +3 -3
  173. package/server/src/quota.ts +0 -50
  174. package/server/src/replacementHistory.ts +44 -0
  175. package/server/src/server/broadcast.ts +2 -0
  176. package/server/src/server/prompts.ts +8 -1
  177. package/server/src/sessionJsonl.ts +92 -32
  178. package/server/src/smartPickupAdapters.ts +17 -3
  179. package/server/src/transcriptWorker.ts +182 -0
  180. package/server/src/workflowStore.ts +21 -0
  181. package/server/src/ws/clusterHandlers.ts +43 -25
  182. package/server/src/ws/handoffHandlers.ts +5 -1
  183. package/server/src/ws/transcriptWorkerHandlers.ts +126 -0
  184. package/server/src/ws/turnEngine.ts +20 -8
  185. package/server/src/ws/updatePrimaryConfig.ts +25 -6
  186. package/server/src/ws/workflowHandlers.ts +3 -1
  187. package/shared/dist/clusterCoordination.d.ts +2 -0
  188. package/shared/dist/clusterCoordination.js +5 -1
  189. package/shared/dist/protocol/clientMessages.d.ts +3 -2
  190. package/shared/dist/protocol/clusters.d.ts +13 -1
  191. package/shared/dist/protocol/index.d.ts +1 -0
  192. package/shared/dist/protocol/index.js +1 -0
  193. package/shared/dist/protocol/models.d.ts +4 -3
  194. package/shared/dist/protocol/models.js +26 -2
  195. package/shared/dist/protocol/serverMessages.d.ts +2 -1
  196. package/shared/dist/protocol/tasks.d.ts +4 -0
  197. package/shared/dist/protocol/transcriptWorker.d.ts +47 -0
  198. package/shared/dist/protocol/transcriptWorker.js +2 -0
  199. package/shared/dist/runtimeVersions.d.ts +1 -0
  200. package/shared/dist/runtimeVersions.js +14 -0
  201. package/shared/src/clusterCoordination.ts +7 -1
  202. package/shared/src/protocol/clientMessages.ts +5 -0
  203. package/shared/src/protocol/clusters.ts +16 -1
  204. package/shared/src/protocol/index.ts +1 -0
  205. package/shared/src/protocol/models.ts +31 -5
  206. package/shared/src/protocol/serverMessages.ts +2 -0
  207. package/shared/src/protocol/settings.ts +2 -3
  208. package/shared/src/protocol/tasks.ts +4 -7
  209. package/shared/src/protocol/transcriptWorker.ts +49 -0
  210. package/shared/src/runtimeVersions.ts +14 -0
@@ -43,6 +43,13 @@ export declare function readLogLines(dir: string, opts?: {
43
43
  fromSeq?: number;
44
44
  }): AsyncGenerator<string>;
45
45
  export declare function readLogText(dir: string): Promise<string>;
46
+ export interface LogByteSource {
47
+ size: number;
48
+ chunks(start: number, length: number): AsyncGenerator<Buffer>;
49
+ read(start: number, length: number): Promise<string>;
50
+ close(): Promise<void>;
51
+ }
52
+ export declare function openLogByteSource(dir: string): Promise<LogByteSource | null>;
46
53
  export declare function readLogTextSync(dir: string): string;
47
54
  export declare function readLogTail(dir: string, maxBytes: number): Promise<{
48
55
  text: string;
@@ -19,7 +19,7 @@
19
19
  // live records only up to the newest sequence number they actually read from
20
20
  // a segment, or that a checked segment holds.
21
21
  import { promises as fs, createReadStream, closeSync, fstatSync, openSync, readFileSync, readSync, readdirSync, statSync, constants as fsConstants } from 'node:fs';
22
- import { createInterface } from 'node:readline';
22
+ import { jsonlLines } from './jsonlLines.js';
23
23
  import { brotliCompress, brotliDecompress, brotliDecompressSync, createBrotliDecompress, constants as zc } from 'node:zlib';
24
24
  import { promisify } from 'node:util';
25
25
  import { randomUUID } from 'node:crypto';
@@ -287,7 +287,7 @@ async function firstLiveSeq(file) {
287
287
  if (!fh)
288
288
  return null;
289
289
  try {
290
- for await (const line of handleLines(fh)) {
290
+ for await (const line of handleLines(fh, file)) {
291
291
  const seq = lineSeq(line);
292
292
  if (seq !== null)
293
293
  return seq;
@@ -310,14 +310,13 @@ function reportUnreadable(err) {
310
310
  console.error(`[arco] ${err instanceof Error ? err.message : String(err)}; skipping it, the rest of the history stays readable`);
311
311
  }
312
312
  async function* segmentLines(seg) {
313
- const input = createReadStream(seg.file);
313
+ const input = createReadStream(seg.file, { highWaterMark: 64 * 1024 });
314
314
  const decompressed = createBrotliDecompress();
315
315
  // An error opening or reading the file (a segment removed or replaced since
316
316
  // it was listed) reaches the reader below instead of going unhandled.
317
317
  input.on('error', (err) => decompressed.destroy(err));
318
- const rl = createInterface({ input: input.pipe(decompressed), crlfDelay: Infinity });
319
318
  try {
320
- for await (const line of rl)
319
+ for await (const line of jsonlLines(input.pipe(decompressed), seg.file))
321
320
  if (line)
322
321
  yield line;
323
322
  }
@@ -325,8 +324,8 @@ async function* segmentLines(seg) {
325
324
  throw new SegmentReadError(seg.file, err);
326
325
  }
327
326
  finally {
328
- rl.close();
329
327
  input.destroy();
328
+ decompressed.destroy();
330
329
  }
331
330
  }
332
331
  async function openLive(file) {
@@ -339,16 +338,14 @@ async function openLive(file) {
339
338
  throw err;
340
339
  }
341
340
  }
342
- async function* handleLines(fh) {
343
- const input = fh.createReadStream({ autoClose: false });
344
- const rl = createInterface({ input, crlfDelay: Infinity });
341
+ async function* handleLines(fh, source) {
342
+ const input = fh.createReadStream({ autoClose: false, highWaterMark: 64 * 1024 });
345
343
  try {
346
- for await (const line of rl)
344
+ for await (const line of jsonlLines(input, source))
347
345
  if (line)
348
346
  yield line;
349
347
  }
350
348
  finally {
351
- rl.close();
352
349
  input.destroy();
353
350
  }
354
351
  }
@@ -357,7 +354,7 @@ async function* liveLines(file) {
357
354
  if (!fh)
358
355
  return;
359
356
  try {
360
- yield* handleLines(fh);
357
+ yield* handleLines(fh, file);
361
358
  }
362
359
  finally {
363
360
  await fh.close();
@@ -416,7 +413,7 @@ export async function* readLogLines(dir, opts = {}) {
416
413
  yield* drainSegments();
417
414
  if (!fh)
418
415
  return;
419
- for await (const line of handleLines(fh))
416
+ for await (const line of handleLines(fh, path.join(dir, LIVE_LOG)))
420
417
  if (!copies.drop(line))
421
418
  yield line;
422
419
  }
@@ -432,6 +429,66 @@ export async function readLogText(dir) {
432
429
  parts.push(line);
433
430
  return parts.length ? parts.join('\n') + '\n' : '';
434
431
  }
432
+ export async function openLogByteSource(dir) {
433
+ let size = 0;
434
+ let chunks;
435
+ let close = async () => { };
436
+ if ((await listSegments(dir)).length) {
437
+ for await (const line of readLogLines(dir))
438
+ size += Buffer.byteLength(line, 'utf8') + 1;
439
+ chunks = async function* (start, length) {
440
+ const end = Math.min(size, start + length);
441
+ let position = 0;
442
+ for await (const line of readLogLines(dir)) {
443
+ const next = position + Buffer.byteLength(line, 'utf8') + 1;
444
+ if (next > start && position < end) {
445
+ const buffer = Buffer.from(line + '\n', 'utf8');
446
+ const from = Math.max(0, start - position), through = Math.min(buffer.length, end - position);
447
+ for (let offset = from; offset < through; offset += 64 * 1024) {
448
+ yield buffer.subarray(offset, Math.min(through, offset + 64 * 1024));
449
+ }
450
+ }
451
+ position = next;
452
+ if (position >= end)
453
+ break;
454
+ }
455
+ };
456
+ }
457
+ else {
458
+ const file = path.join(dir, LIVE_LOG);
459
+ const fh = await openLive(file);
460
+ if (!fh)
461
+ return null;
462
+ try {
463
+ const stat = await fh.stat();
464
+ if (!stat.isFile())
465
+ throw new Error(`Expected a history file at ${file}`);
466
+ size = stat.size;
467
+ }
468
+ catch (err) {
469
+ await fh.close();
470
+ throw err;
471
+ }
472
+ close = () => fh.close();
473
+ chunks = async function* (start, length) {
474
+ const end = Math.min(size, start + length);
475
+ for (let position = start; position < end;) {
476
+ const buffer = Buffer.alloc(Math.min(64 * 1024, end - position));
477
+ const { bytesRead } = await fh.read(buffer, 0, buffer.length, position);
478
+ if (!bytesRead)
479
+ break;
480
+ position += bytesRead;
481
+ yield buffer.subarray(0, bytesRead);
482
+ }
483
+ };
484
+ }
485
+ return { size, chunks, close, read: async (start, length) => {
486
+ const parts = [];
487
+ for await (const chunk of chunks(start, length))
488
+ parts.push(chunk);
489
+ return Buffer.concat(parts).toString('utf8');
490
+ } };
491
+ }
435
492
  function decompressSegmentSync(seg) {
436
493
  try {
437
494
  return brotliDecompressSync(readFileSync(seg.file)).toString('utf8');
@@ -0,0 +1 @@
1
+ export declare const RECENT_HISTORY_MAX_BYTES: number;
@@ -0,0 +1,3 @@
1
+ // Shared byte budget for recent replacement history and Native resume digests.
2
+ export const RECENT_HISTORY_MAX_BYTES = 128 * 1024;
3
+ //# sourceMappingURL=historyLimits.js.map
@@ -1850,7 +1850,7 @@ export async function handleHttpRequest(req, res, deps) {
1850
1850
  res.end(JSON.stringify({ error: retired }));
1851
1851
  return;
1852
1852
  }
1853
- const provider = providerParam === 'codex'
1853
+ const provider = providerParam === 'codex' || providerParam === 'cursor'
1854
1854
  ? providerParam
1855
1855
  : 'claude';
1856
1856
  const result = await runCliUpdate(deps.getCapabilities(), provider);
@@ -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,4 @@
1
+ export declare function jsonlLines(input: AsyncIterable<Buffer>, source: string, options?: {
2
+ finalLine?: boolean;
3
+ carriageReturns?: boolean;
4
+ }): AsyncGenerator<string>;
@@ -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
@@ -58,6 +58,7 @@ function shortGitRevision(repoRoot) {
58
58
  return execFileSync('git', ['rev-parse', '--short', 'HEAD'], {
59
59
  cwd: repoRoot,
60
60
  encoding: 'utf8',
61
+ stdio: 'pipe',
61
62
  }).trim();
62
63
  }
63
64
  catch {
@@ -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; done/archived remain operator-only. 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.',
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. Change its `status` (triage / todo / ready / in_progress / blocked / review), replace `notes`, and/or record a `signoff` verdict. IMPORTANT: `done` and `archived` are OPERATOR-ONLY — those statuses are REJECTED here (operator_gated). When you finish work, move the task to review or report completion via peer_send to the director; the operator marks done from the LEDGER tab.\n\nSIGN-OFF (director): when you review a peer's completed task, set `signoff` to your verdict — `met`, `not_met`, or `partial` — with a one-line `summary`. ADVISORY only: it does NOT mark the task done; it surfaces a recommendation on the board so the operator can accept at a glance. Only the reviewing member (the director) should set this.",
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('Advisory director verdict on whether the task met its target. Does NOT mark it done.'),
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 NOT mark done; done remains operator-only.",
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.'),
@@ -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
- // LOAD-BEARING INVARIANT (§D1 acceptance): there is NO code path that sets
18
- // status: 'done' except an explicit operator-originated update (applyUpdate
19
- // below). create() never accepts a status; rebuildFromEvents only replays
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
  };