arco-workbench 0.1.3 → 0.1.4
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/README.md +5 -1
- package/client/dist/assets/{PhosphorBackdrop-CkVIGkeX.js → PhosphorBackdrop-CNumba2X.js} +1 -1
- package/client/dist/assets/{ThemedBackgroundShaderImpl-DHF7CnpE.js → ThemedBackgroundShaderImpl-DX5KyCt3.js} +1 -1
- package/client/dist/assets/{XtermView-SY0UcZUS.js → XtermView-DhS5g8Rt.js} +1 -1
- package/client/dist/assets/{galleryEditor-Ca4F8HiM.js → galleryEditor-fPb76Cjv.js} +1 -1
- package/client/dist/assets/index-CjkHb-_n.js +592 -0
- package/client/dist/assets/index-DIbh3ae5.css +1 -0
- package/client/dist/index.html +2 -2
- package/client/src/App.tsx +2 -0
- package/client/src/alerts/desktopAlerts.ts +13 -1
- package/client/src/brief/briefFacts.ts +22 -0
- package/client/src/brief/briefFromStore.ts +7 -2
- package/client/src/components/ArtifactMoveDialog.tsx +64 -0
- package/client/src/components/BriefControl.tsx +38 -47
- package/client/src/components/CatchMeUp.tsx +25 -25
- package/client/src/components/CheckpointActions.tsx +7 -4
- package/client/src/components/ClusterComposerButtons.tsx +6 -3
- package/client/src/components/ClusterPlanTab.tsx +15 -1
- package/client/src/components/ClusterRightPanel/AutoPickupControl.tsx +6 -2
- package/client/src/components/ClusterTab.tsx +33 -3
- package/client/src/components/ClusterTaskBoardTab.tsx +62 -8
- package/client/src/components/DialogShell.tsx +115 -0
- package/client/src/components/DocsUpdateDialog.tsx +16 -42
- package/client/src/components/ForwardMessages.tsx +28 -32
- package/client/src/components/GitDialog.tsx +52 -52
- package/client/src/components/GitOtherWork.tsx +4 -2
- package/client/src/components/HandoffDialog.tsx +19 -45
- package/client/src/components/Home/HomeView.tsx +36 -8
- package/client/src/components/Home/home.css +7 -0
- package/client/src/components/KeepButton.tsx +23 -0
- package/client/src/components/MdTuneupDialog.tsx +52 -51
- package/client/src/components/MemberCard.tsx +4 -1
- package/client/src/components/MemberPane.tsx +1 -1
- package/client/src/components/NotificationCenter.tsx +4 -3
- package/client/src/components/NotificationChannelsSettings.tsx +25 -7
- package/client/src/components/PlanCandidateBanner.tsx +111 -57
- package/client/src/components/PlanComposerDialog.tsx +55 -87
- package/client/src/components/ProjectStateNotice.tsx +60 -0
- package/client/src/components/PublicProjectBox.tsx +25 -0
- package/client/src/components/ResearchDialog.tsx +15 -24
- package/client/src/components/ReviewDialog.tsx +32 -57
- package/client/src/components/RightPanel/OutputsPanel.tsx +4 -0
- package/client/src/components/RightPanel/PlanTab.tsx +24 -2
- package/client/src/components/RightPanel/UsageTab.tsx +77 -1
- package/client/src/components/SkillEditorDialog.tsx +38 -73
- package/client/src/components/SpawnDialog.tsx +19 -41
- package/client/src/components/StorageWarnings.tsx +21 -0
- package/client/src/components/SystemHeader.tsx +2 -2
- package/client/src/components/TerminalInput.tsx +6 -2
- package/client/src/components/TidyComposer.tsx +24 -41
- package/client/src/components/TranscriptSendDialog.tsx +151 -202
- package/client/src/components/UtilityAgentPicker.tsx +4 -2
- package/client/src/components/WorkflowCreator/index.tsx +2 -0
- package/client/src/components/WorkflowView.tsx +4 -1
- package/client/src/components/clusterNeedsYou.ts +35 -3
- package/client/src/components/compare/CompareDialog.tsx +26 -2
- package/client/src/components/terminalInput/planDraft.ts +33 -4
- package/client/src/components/utilityResult.ts +5 -1
- package/client/src/explorer/ExplorerApp.tsx +5 -2
- package/client/src/explorer/PlansLens.tsx +60 -19
- package/client/src/explorer/StorageLens.tsx +275 -0
- package/client/src/explorer/launch.ts +3 -3
- package/client/src/explorer/plansGrouping.ts +15 -0
- package/client/src/help/content/cluster.tsx +42 -7
- package/client/src/help/content/composer.tsx +26 -6
- package/client/src/help/content/header.tsx +16 -14
- package/client/src/help/content/misc.tsx +141 -6
- package/client/src/help/content/rightPanel.tsx +16 -0
- package/client/src/help/content/settings.tsx +4 -4
- package/client/src/help/manualSections/actions.tsx +19 -4
- package/client/src/help/manualSections/clusters.tsx +29 -16
- package/client/src/help/manualSections/configuration.tsx +6 -4
- package/client/src/help/manualSections/maintenance.tsx +27 -5
- package/client/src/help/manualSections/plans.tsx +96 -2
- package/client/src/help/manualSections/powerFeatures.tsx +2 -2
- package/client/src/help/manualSections/reference.tsx +6 -0
- package/client/src/help/manualSections/workspace.tsx +9 -5
- package/client/src/stores/appStore.ts +10 -1
- package/client/src/stores/appStore.types.ts +2 -0
- package/client/src/stores/mdTuneupStore.ts +5 -4
- package/client/src/stores/memoryTrim.ts +18 -2
- package/client/src/stores/storageWarningStore.ts +18 -0
- package/client/src/utils/gitDialogMemory.ts +26 -0
- package/client/src/utils/historyEvents.ts +1 -0
- package/client/src/utils/homeModel.ts +19 -0
- package/client/src/utils/publicProject.ts +56 -0
- package/client/src/ws/handleServerMessage.ts +7 -2
- package/docs/ARCHITECTURE.md +1 -1
- package/docs/CHECKPOINTS.md +2 -0
- package/docs/CLIENT.md +29 -11
- package/docs/FEATURES.md +14 -11
- package/docs/GETTING_STARTED.md +7 -7
- package/docs/GLOSSARY.md +3 -3
- package/docs/GOTCHAS.md +3 -2
- package/docs/HTTP_API.md +31 -1
- package/docs/NOTIFICATIONS.md +13 -14
- package/docs/OPERATIONS.md +27 -1
- package/docs/OPERATOR_ACTIONS.md +1 -1
- package/docs/OUTPUTS.md +9 -0
- package/docs/PERSISTENCE.md +34 -4
- package/docs/PLAN_OR_BOARD.md +7 -0
- package/docs/PRIMITIVES.md +3 -3
- package/docs/PROTOCOL.md +14 -4
- package/docs/PROTOCOL_CLUSTER.md +3 -2
- package/docs/SERVICE_MODE.md +5 -1
- package/docs/SETTINGS.md +8 -6
- package/docs/STORAGE_PLAN.md +324 -0
- package/docs/TASK_LEDGER.md +5 -4
- package/native/linux-arm64/manifest.json +1 -1
- package/node_modules/@arco/shared/dist/index.d.ts +2 -0
- package/node_modules/@arco/shared/dist/index.js +2 -0
- package/node_modules/@arco/shared/dist/protocol/autoPickup.d.ts +1 -1
- package/node_modules/@arco/shared/dist/protocol/autoPickup.js +1 -1
- package/node_modules/@arco/shared/dist/protocol/checkpoints.d.ts +1 -0
- package/node_modules/@arco/shared/dist/protocol/clusters.d.ts +2 -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/mdTuneup.d.ts +6 -0
- package/node_modules/@arco/shared/dist/protocol/notifications.d.ts +2 -1
- package/node_modules/@arco/shared/dist/protocol/notifications.js +3 -2
- package/node_modules/@arco/shared/dist/protocol/plans.d.ts +2 -0
- package/node_modules/@arco/shared/dist/protocol/serverMessages.d.ts +2 -1
- package/node_modules/@arco/shared/dist/protocol/storage.d.ts +21 -0
- package/node_modules/@arco/shared/dist/protocol/storage.js +3 -0
- package/node_modules/@arco/shared/dist/protocol/tasks.d.ts +3 -0
- package/node_modules/@arco/shared/dist/protocol/utilityAgent.d.ts +2 -2
- package/node_modules/@arco/shared/dist/protocol/utilityAgent.js +2 -2
- package/node_modules/@arco/shared/dist/publicGuardrails.d.ts +7 -0
- package/node_modules/@arco/shared/dist/publicGuardrails.js +47 -0
- package/node_modules/@arco/shared/dist/publicSafetyRules.d.ts +1 -0
- package/node_modules/@arco/shared/dist/publicSafetyRules.js +6 -0
- package/node_modules/@arco/shared/package.json +1 -1
- package/package.json +3 -2
- package/scripts/packaging/arco.mjs +17 -1
- package/scripts/packaging/services.mjs +35 -5
- package/scripts/packaging/storage.mjs +125 -0
- package/scripts/packaging/update.mjs +3 -3
- package/server/dist/artifactCopy.d.ts +26 -0
- package/server/dist/artifactCopy.js +398 -0
- package/server/dist/atomicFile.d.ts +1 -0
- package/server/dist/atomicFile.js +1 -1
- package/server/dist/attention.d.ts +1 -1
- package/server/dist/attention.js +10 -13
- package/server/dist/catchUp.d.ts +2 -0
- package/server/dist/catchUp.js +46 -23
- package/server/dist/clusterPeerOps.d.ts +2 -0
- package/server/dist/clusterPeerOps.js +2 -0
- package/server/dist/clusterSnapshots.js +22 -12
- package/server/dist/eventLog.d.ts +55 -0
- package/server/dist/eventLog.js +792 -0
- package/server/dist/explorerLaunch.d.ts +4 -1
- package/server/dist/explorerLaunch.js +3 -2
- package/server/dist/explorerPlans.d.ts +4 -0
- package/server/dist/explorerPlans.js +27 -2
- package/server/dist/http/clusterRoutes.js +2 -0
- package/server/dist/http/explorerRoutes.js +2 -1
- package/server/dist/http/publicProjectRoutes.d.ts +2 -0
- package/server/dist/http/publicProjectRoutes.js +68 -0
- package/server/dist/http/router.js +6 -0
- package/server/dist/http/storageRoutes.d.ts +2 -0
- package/server/dist/http/storageRoutes.js +254 -0
- package/server/dist/http/usageStatsRoutes.js +3 -12
- package/server/dist/index.js +4 -0
- package/server/dist/keepStore.d.ts +16 -0
- package/server/dist/keepStore.js +119 -0
- package/server/dist/management/clusterActivity.js +6 -20
- package/server/dist/management/initHubLink.js +10 -43
- package/server/dist/mcp/clusterMcpTools.js +8 -1
- package/server/dist/notifications.d.ts +3 -1
- package/server/dist/notifications.js +5 -4
- package/server/dist/outputStore.d.ts +1 -0
- package/server/dist/outputStore.js +1 -1
- package/server/dist/outputs.js +39 -8
- package/server/dist/planHistory.d.ts +3 -0
- package/server/dist/planHistory.js +60 -0
- package/server/dist/primitives/runMdTuneup.d.ts +5 -1
- package/server/dist/primitives/runMdTuneup.js +43 -2
- package/server/dist/project/taskLedger.d.ts +4 -0
- package/server/dist/project/taskLedger.js +19 -0
- package/server/dist/providers/claude-native/peerTools.js +4 -0
- package/server/dist/providers/claude-native/resumeSummary.js +30 -19
- package/server/dist/providers/index.js +8 -13
- package/server/dist/providers/localProviderQueue.d.ts +2 -0
- package/server/dist/providers/localProviderQueue.js +11 -0
- package/server/dist/publicProject.d.ts +54 -0
- package/server/dist/publicProject.js +135 -0
- package/server/dist/recall/index.js +22 -23
- package/server/dist/server/broadcast.d.ts +2 -1
- package/server/dist/server/broadcast.js +56 -1
- package/server/dist/smartPickupAdapters.d.ts +7 -0
- package/server/dist/smartPickupAdapters.js +172 -8
- package/server/dist/storageActions.d.ts +50 -0
- package/server/dist/storageActions.js +326 -0
- package/server/dist/storageArchive.d.ts +24 -0
- package/server/dist/storageArchive.js +358 -0
- package/server/dist/storageOverview.d.ts +47 -0
- package/server/dist/storageOverview.js +197 -0
- package/server/dist/storageReport.d.ts +48 -0
- package/server/dist/storageReport.js +185 -0
- package/server/dist/storageWarnings.d.ts +4 -0
- package/server/dist/storageWarnings.js +96 -0
- package/server/dist/workers/limits.js +4 -1
- package/server/dist/workflowStore.d.ts +2 -0
- package/server/dist/workflowStore.js +88 -72
- package/server/dist/workflows/purgeWorkflow.d.ts +1 -0
- package/server/dist/workflows/purgeWorkflow.js +15 -2
- package/server/dist/workflows/sessionDiscovery.js +5 -17
- package/server/dist/workflows/sessionIndex.js +22 -17
- package/server/dist/ws/taskLedgerHandlers.js +8 -3
- package/server/dist/ws/workflowHandlers.js +5 -4
- package/server/package.json +1 -1
- package/server/src/artifactCopy.ts +254 -0
- package/server/src/atomicFile.ts +1 -1
- package/server/src/attention.ts +9 -10
- package/server/src/catchUp.ts +37 -15
- package/server/src/clusterPeerOps.ts +5 -0
- package/server/src/clusterSnapshots.ts +20 -13
- package/server/src/eventLog.ts +571 -0
- package/server/src/explorerLaunch.ts +3 -2
- package/server/src/explorerPlans.ts +22 -2
- package/server/src/http/clusterRoutes.ts +4 -1
- package/server/src/http/explorerRoutes.ts +2 -1
- package/server/src/http/publicProjectRoutes.ts +54 -0
- package/server/src/http/router.ts +4 -0
- package/server/src/http/storageRoutes.ts +187 -0
- package/server/src/http/usageStatsRoutes.ts +3 -11
- package/server/src/index.ts +4 -0
- package/server/src/keepStore.ts +102 -0
- package/server/src/management/clusterActivity.ts +6 -16
- package/server/src/management/initHubLink.ts +10 -39
- package/server/src/mcp/clusterMcpTools.ts +8 -2
- package/server/src/notifications.ts +4 -3
- package/server/src/outputStore.ts +5 -2
- package/server/src/outputs.ts +30 -6
- package/server/src/planHistory.ts +48 -0
- package/server/src/primitives/runMdTuneup.ts +32 -2
- package/server/src/project/taskLedger.ts +20 -0
- package/server/src/providers/claude-native/peerTools.ts +4 -0
- package/server/src/providers/claude-native/resumeSummary.ts +32 -18
- package/server/src/providers/index.ts +2 -16
- package/server/src/providers/localProviderQueue.ts +13 -0
- package/server/src/publicProject.ts +142 -0
- package/server/src/recall/index.ts +4 -9
- package/server/src/server/broadcast.ts +53 -1
- package/server/src/smartPickupAdapters.ts +128 -5
- package/server/src/storageActions.ts +216 -0
- package/server/src/storageArchive.ts +277 -0
- package/server/src/storageOverview.ts +184 -0
- package/server/src/storageReport.ts +210 -0
- package/server/src/storageWarnings.ts +84 -0
- package/server/src/workers/limits.ts +4 -1
- package/server/src/workflowStore.ts +78 -61
- package/server/src/workflows/purgeWorkflow.ts +12 -3
- package/server/src/workflows/sessionDiscovery.ts +5 -13
- package/server/src/workflows/sessionIndex.ts +5 -9
- package/server/src/ws/taskLedgerHandlers.ts +8 -3
- package/server/src/ws/workflowHandlers.ts +5 -4
- package/shared/dist/index.d.ts +2 -0
- package/shared/dist/index.js +2 -0
- package/shared/dist/protocol/autoPickup.d.ts +1 -1
- package/shared/dist/protocol/autoPickup.js +1 -1
- package/shared/dist/protocol/checkpoints.d.ts +1 -0
- package/shared/dist/protocol/clusters.d.ts +2 -1
- package/shared/dist/protocol/index.d.ts +1 -0
- package/shared/dist/protocol/index.js +1 -0
- package/shared/dist/protocol/mdTuneup.d.ts +6 -0
- package/shared/dist/protocol/notifications.d.ts +2 -1
- package/shared/dist/protocol/notifications.js +3 -2
- package/shared/dist/protocol/plans.d.ts +2 -0
- package/shared/dist/protocol/serverMessages.d.ts +2 -1
- package/shared/dist/protocol/storage.d.ts +21 -0
- package/shared/dist/protocol/storage.js +3 -0
- package/shared/dist/protocol/tasks.d.ts +3 -0
- package/shared/dist/protocol/utilityAgent.d.ts +2 -2
- package/shared/dist/protocol/utilityAgent.js +2 -2
- package/shared/dist/publicGuardrails.d.ts +7 -0
- package/shared/dist/publicGuardrails.js +47 -0
- package/shared/dist/publicSafetyRules.d.ts +1 -0
- package/shared/dist/publicSafetyRules.js +6 -0
- package/shared/src/index.ts +3 -0
- package/shared/src/protocol/autoPickup.ts +1 -1
- package/shared/src/protocol/checkpoints.ts +4 -0
- package/shared/src/protocol/clusters.ts +6 -1
- package/shared/src/protocol/index.ts +1 -0
- package/shared/src/protocol/mdTuneup.ts +5 -0
- package/shared/src/protocol/notifications.ts +6 -2
- package/shared/src/protocol/plans.ts +2 -0
- package/shared/src/protocol/serverMessages.ts +2 -0
- package/shared/src/protocol/storage.ts +35 -0
- package/shared/src/protocol/tasks.ts +6 -0
- package/shared/src/protocol/utilityAgent.ts +2 -2
- package/shared/src/publicGuardrails.ts +50 -0
- package/shared/src/publicSafetyRules.ts +5 -0
- package/client/dist/assets/index-CcNtMA2y.js +0 -546
- package/client/dist/assets/index-Dl8tYsSp.css +0 -1
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// events.jsonl — read-only, deterministic, capped. Tool calls are folded into
|
|
7
7
|
// their turn's completion row (a count, not one row per call) so the feed
|
|
8
8
|
// stays scannable on a phone.
|
|
9
|
-
import {
|
|
9
|
+
import { readLogTailSync } from '../eventLog.js';
|
|
10
10
|
import { join } from 'node:path';
|
|
11
11
|
const TAIL_BYTES = 256 * 1024; // per member
|
|
12
12
|
const PREVIEW_CHARS = 160;
|
|
@@ -14,19 +14,13 @@ export const ACTIVITY_MAX_ROWS = 200; // merged cap (most recent kept)
|
|
|
14
14
|
// Bounded tail read of one member's events.jsonl → activity rows. Best-effort:
|
|
15
15
|
// unreadable/absent logs yield []. Exported for the unit test.
|
|
16
16
|
export function readMemberActivity(cwd, wfid) {
|
|
17
|
-
let fd;
|
|
18
17
|
try {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
if (size === 0)
|
|
18
|
+
// Live tail, plus sealed segments when the live file is short (P7.3).
|
|
19
|
+
const tail = readLogTailSync(join(cwd, '.arco', 'workflows', wfid), TAIL_BYTES);
|
|
20
|
+
if (!tail.text)
|
|
23
21
|
return [];
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
const buf = Buffer.allocUnsafe(len);
|
|
27
|
-
readSync(fd, buf, 0, len, start);
|
|
28
|
-
const lines = buf.toString('utf8').split('\n');
|
|
29
|
-
if (start > 0)
|
|
22
|
+
const lines = tail.text.split('\n');
|
|
23
|
+
if (tail.truncated)
|
|
30
24
|
lines.shift(); // drop the partial first line
|
|
31
25
|
const rows = [];
|
|
32
26
|
let toolCount = 0;
|
|
@@ -84,14 +78,6 @@ export function readMemberActivity(cwd, wfid) {
|
|
|
84
78
|
catch {
|
|
85
79
|
return [];
|
|
86
80
|
}
|
|
87
|
-
finally {
|
|
88
|
-
if (fd !== undefined) {
|
|
89
|
-
try {
|
|
90
|
-
closeSync(fd);
|
|
91
|
-
}
|
|
92
|
-
catch { /* ignore */ }
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
81
|
}
|
|
96
82
|
// Merge every member's rows chronologically, keeping the most recent
|
|
97
83
|
// ACTIVITY_MAX_ROWS. Pure so the unit test can drive it with canned rows.
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
// registers to the hub as a 'service', pushes its workflow snapshot, and applies
|
|
8
8
|
// routed reply/stop/continue actions — re-validating against current state.
|
|
9
9
|
import { WebSocket } from 'ws';
|
|
10
|
-
import { openSync, fstatSync, readSync, closeSync } from 'node:fs';
|
|
11
10
|
import { join } from 'node:path';
|
|
12
11
|
import { workflows, workflowCwds } from '../server/state.js';
|
|
13
12
|
import { handleUserMessage } from '../ws/turnEngine.js';
|
|
@@ -31,6 +30,7 @@ import { mergeActivity, readMemberActivity } from './clusterActivity.js';
|
|
|
31
30
|
import * as taskLedger from '../project/taskLedger.js';
|
|
32
31
|
import { createHubLink } from './hubLink.js';
|
|
33
32
|
import { buildServiceInstanceDescriptor } from './identity.js';
|
|
33
|
+
import { readLogTailSync } from '../eventLog.js';
|
|
34
34
|
// Bounded read of the events.jsonl tail. Generous because ledger-snapshot
|
|
35
35
|
// events (task_ledger_snapshot can be large + frequent) crowd the tail and push
|
|
36
36
|
// the last assistant message back; 1MB covers a lot of that noise AND lets us
|
|
@@ -44,19 +44,13 @@ const MAX_MESSAGE_CHARS = 200_000;
|
|
|
44
44
|
// tail. The assistant's words are `primary_text` events between the most recent
|
|
45
45
|
// `primary_turn_started` and the turn end. Bounded + best-effort — never throws.
|
|
46
46
|
function readLastMessage(cwd, wfid) {
|
|
47
|
-
let fd;
|
|
48
47
|
try {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (size === 0)
|
|
48
|
+
// Live tail, plus sealed segments when the live file is short (P7.3).
|
|
49
|
+
const tail = readLogTailSync(join(cwd, '.arco', 'workflows', wfid), TAIL_BYTES);
|
|
50
|
+
if (!tail.text)
|
|
53
51
|
return undefined;
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
const buf = Buffer.allocUnsafe(len);
|
|
57
|
-
readSync(fd, buf, 0, len, start);
|
|
58
|
-
const lines = buf.toString('utf8').split('\n');
|
|
59
|
-
if (start > 0)
|
|
52
|
+
const lines = tail.text.split('\n');
|
|
53
|
+
if (tail.truncated)
|
|
60
54
|
lines.shift(); // drop the partial first line
|
|
61
55
|
const chunks = [];
|
|
62
56
|
let at = 0;
|
|
@@ -101,16 +95,6 @@ function readLastMessage(cwd, wfid) {
|
|
|
101
95
|
catch {
|
|
102
96
|
return undefined;
|
|
103
97
|
}
|
|
104
|
-
finally {
|
|
105
|
-
if (fd !== undefined) {
|
|
106
|
-
try {
|
|
107
|
-
closeSync(fd);
|
|
108
|
-
}
|
|
109
|
-
catch {
|
|
110
|
-
/* ignore */
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
98
|
}
|
|
115
99
|
// R1 — context pressure for the phone's WHEN-to-compact/handoff judgment.
|
|
116
100
|
// 2026-07-18 fix: PRIMARY source is the stashed context_usage numbers — the
|
|
@@ -478,19 +462,12 @@ function readFullTranscript(wfid) {
|
|
|
478
462
|
const cwd = workflowCwds.get(wfid) ?? wf?.config.workingDirectory;
|
|
479
463
|
if (!cwd)
|
|
480
464
|
return { ...(title ? { title } : {}), turns: [] };
|
|
481
|
-
let fd;
|
|
482
465
|
try {
|
|
483
|
-
const
|
|
484
|
-
|
|
485
|
-
const size = fstatSync(fd).size;
|
|
486
|
-
if (size === 0)
|
|
466
|
+
const tail = readLogTailSync(join(cwd, '.arco', 'workflows', wfid), MAX_TRANSCRIPT_BYTES);
|
|
467
|
+
if (!tail.text)
|
|
487
468
|
return { ...(title ? { title } : {}), turns: [] };
|
|
488
|
-
const
|
|
489
|
-
|
|
490
|
-
const buf = Buffer.allocUnsafe(len);
|
|
491
|
-
readSync(fd, buf, 0, len, start);
|
|
492
|
-
const lines = buf.toString('utf8').split('\n');
|
|
493
|
-
if (start > 0)
|
|
469
|
+
const lines = tail.text.split('\n');
|
|
470
|
+
if (tail.truncated)
|
|
494
471
|
lines.shift();
|
|
495
472
|
const turns = [];
|
|
496
473
|
let asst = [];
|
|
@@ -533,16 +510,6 @@ function readFullTranscript(wfid) {
|
|
|
533
510
|
catch {
|
|
534
511
|
return { ...(title ? { title } : {}), turns: [] };
|
|
535
512
|
}
|
|
536
|
-
finally {
|
|
537
|
-
if (fd !== undefined) {
|
|
538
|
-
try {
|
|
539
|
-
closeSync(fd);
|
|
540
|
-
}
|
|
541
|
-
catch {
|
|
542
|
-
/* ignore */
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
513
|
}
|
|
547
514
|
const LEDGER_STATUSES = [
|
|
548
515
|
'triage', 'todo', 'ready', 'in_progress', 'blocked', 'review', 'done', 'archived',
|
|
@@ -121,6 +121,8 @@ export function registerClusterTools(server, ctx) {
|
|
|
121
121
|
payload.goalMode = args.goalMode;
|
|
122
122
|
if (typeof args.goalMaxTurns === 'number')
|
|
123
123
|
payload.goalMaxTurns = args.goalMaxTurns;
|
|
124
|
+
if (typeof args.release === 'string')
|
|
125
|
+
payload.release = args.release;
|
|
124
126
|
const r = await fetch(`${BASE_URL}/task-create`, {
|
|
125
127
|
method: 'POST',
|
|
126
128
|
headers: { 'Content-Type': 'application/json' },
|
|
@@ -148,6 +150,8 @@ export function registerClusterTools(server, ctx) {
|
|
|
148
150
|
payload.status = args.status;
|
|
149
151
|
if (typeof args.notes === 'string')
|
|
150
152
|
payload.notes = args.notes;
|
|
153
|
+
if (typeof args.release === 'string')
|
|
154
|
+
payload.release = args.release;
|
|
151
155
|
if (args.signoff && typeof args.signoff === 'object')
|
|
152
156
|
payload.signoff = args.signoff;
|
|
153
157
|
const r = await fetch(`${BASE_URL}/task-update`, {
|
|
@@ -389,6 +393,7 @@ export function registerClusterTools(server, ctx) {
|
|
|
389
393
|
reviewRequired: z.boolean().optional(),
|
|
390
394
|
goalMode: z.boolean().optional(),
|
|
391
395
|
goalMaxTurns: z.number().optional(),
|
|
396
|
+
release: z.string().optional().describe('Optional release label such as 0.1.4.'),
|
|
392
397
|
},
|
|
393
398
|
}, async (args) => {
|
|
394
399
|
try {
|
|
@@ -403,6 +408,7 @@ export function registerClusterTools(server, ctx) {
|
|
|
403
408
|
reviewRequired: args.reviewRequired,
|
|
404
409
|
goalMode: args.goalMode,
|
|
405
410
|
goalMaxTurns: args.goalMaxTurns,
|
|
411
|
+
release: args.release,
|
|
406
412
|
});
|
|
407
413
|
if (!r.ok) {
|
|
408
414
|
const detail = r.err.message ?? r.err.error ?? 'unknown_error';
|
|
@@ -459,6 +465,7 @@ export function registerClusterTools(server, ctx) {
|
|
|
459
465
|
id: z.string().min(1).describe('Task id from cluster_task_list.'),
|
|
460
466
|
status: z.enum(['triage', 'todo', 'ready', 'in_progress', 'blocked', 'review']).optional().describe("New status. 'done' and 'archived' are rejected — operator-only."),
|
|
461
467
|
notes: z.string().optional().describe('Replacement notes body for the task.'),
|
|
468
|
+
release: z.string().optional().describe('Release label such as 0.1.4; an empty string clears it.'),
|
|
462
469
|
signoff: z.object({
|
|
463
470
|
state: z.enum(['met', 'not_met', 'partial']).describe('Your verdict: met / not_met / partial.'),
|
|
464
471
|
summary: z.string().optional().describe('One-line reason shown on the board card.'),
|
|
@@ -466,7 +473,7 @@ export function registerClusterTools(server, ctx) {
|
|
|
466
473
|
},
|
|
467
474
|
}, async (args) => {
|
|
468
475
|
try {
|
|
469
|
-
const r = await callTaskUpdate({ id: args.id, status: args.status, notes: args.notes, signoff: args.signoff });
|
|
476
|
+
const r = await callTaskUpdate({ id: args.id, status: args.status, notes: args.notes, release: args.release, signoff: args.signoff });
|
|
470
477
|
if (!r.ok) {
|
|
471
478
|
const detail = r.err.message ?? r.err.error ?? 'unknown_error';
|
|
472
479
|
return textResult(`[error] ${r.err.error ?? 'task_update_failed'}: ${detail}`, true);
|
|
@@ -17,8 +17,10 @@ export declare function setMutes(muted: WorkbenchNoticeCategory[]): void;
|
|
|
17
17
|
*/
|
|
18
18
|
export declare function emit(n: Omit<WorkbenchNotice, 'id' | 'ts'> & {
|
|
19
19
|
ts?: number;
|
|
20
|
+
}, options?: {
|
|
21
|
+
transportOnly?: boolean;
|
|
20
22
|
}): WorkbenchNotice | null;
|
|
21
|
-
/**
|
|
23
|
+
/** Keep long-turn events for legacy external transports, without a second BELL entry. */
|
|
22
24
|
export declare function onTurnStarted(workflowId: string): void;
|
|
23
25
|
export declare function onTurnEnded(workflowId: string, opts?: {
|
|
24
26
|
provider?: ProviderName;
|
|
@@ -79,7 +79,7 @@ export function setMutes(muted) {
|
|
|
79
79
|
* is muted (suppressed before it reaches any client). The id + ts are filled in
|
|
80
80
|
* here so callers pass only the semantic fields.
|
|
81
81
|
*/
|
|
82
|
-
export function emit(n) {
|
|
82
|
+
export function emit(n, options = {}) {
|
|
83
83
|
if (mutedCategories.has(n.category))
|
|
84
84
|
return null;
|
|
85
85
|
const notice = {
|
|
@@ -87,7 +87,8 @@ export function emit(n) {
|
|
|
87
87
|
id: `wn_${Date.now().toString(36)}_${(idCounter++).toString(36)}`,
|
|
88
88
|
ts: n.ts ?? Date.now(),
|
|
89
89
|
};
|
|
90
|
-
|
|
90
|
+
if (!options.transportOnly)
|
|
91
|
+
broadcast?.({ type: 'workbench_notice', notice });
|
|
91
92
|
// Fan out to external transports AFTER the in-app broadcast and only for
|
|
92
93
|
// non-muted notices (muted ones returned above). Fire-and-forget: a slow or
|
|
93
94
|
// failing transport must never delay or break the in-app surface.
|
|
@@ -104,7 +105,7 @@ export function emit(n) {
|
|
|
104
105
|
// ── Source helpers ─────────────────────────────────────────────────────────
|
|
105
106
|
// Thin wrappers so callsites stay a one-liner and the category/severity/copy
|
|
106
107
|
// conventions live in one place.
|
|
107
|
-
/**
|
|
108
|
+
/** Keep long-turn events for legacy external transports, without a second BELL entry. */
|
|
108
109
|
export function onTurnStarted(workflowId) {
|
|
109
110
|
turnStarts.set(workflowId, Date.now());
|
|
110
111
|
}
|
|
@@ -126,7 +127,7 @@ export function onTurnEnded(workflowId, opts) {
|
|
|
126
127
|
body: `Ran ${dur}.`,
|
|
127
128
|
workflowId,
|
|
128
129
|
provider: opts?.provider,
|
|
129
|
-
});
|
|
130
|
+
}, { transportOnly: true });
|
|
130
131
|
}
|
|
131
132
|
/** A throttled provider became available again. */
|
|
132
133
|
export function notifyQuotaRecovered(provider) {
|
|
@@ -11,6 +11,7 @@ export interface StoredOutput extends Omit<WorkflowOutput, 'missing' | 'size'> {
|
|
|
11
11
|
export interface OutputIndex {
|
|
12
12
|
version: 1;
|
|
13
13
|
offset: number;
|
|
14
|
+
seq?: number;
|
|
14
15
|
entries: StoredOutput[];
|
|
15
16
|
}
|
|
16
17
|
export declare function outputDirectory(cwd: string, workflowId: string): Promise<string>;
|
|
@@ -24,7 +24,7 @@ export async function readOutputIndex(cwd, workflowId) {
|
|
|
24
24
|
if (!st.isFile() || st.isSymbolicLink() || st.size > 8 * 1024 * 1024)
|
|
25
25
|
throw new Error();
|
|
26
26
|
const index = JSON.parse(await readFile(file, 'utf8'));
|
|
27
|
-
if (index.version !== 1 || !Number.isSafeInteger(index.offset) || index.offset < 0 || !Array.isArray(index.entries) || index.entries.length > 2000
|
|
27
|
+
if (index.version !== 1 || !Number.isSafeInteger(index.offset) || index.offset < 0 || (index.seq !== undefined && (!Number.isSafeInteger(index.seq) || index.seq < 0)) || !Array.isArray(index.entries) || index.entries.length > 2000
|
|
28
28
|
|| index.entries.some(e => !e || !/^[a-f0-9]{32}$/.test(e.id) || e.workflowId !== workflowId || typeof e.title !== 'string'
|
|
29
29
|
|| typeof e.name !== 'string' || typeof e.cwd !== 'string' || typeof e.producer !== 'string' || typeof e.source !== 'string'
|
|
30
30
|
|| !['images', 'documents', 'audio', 'video', 'other'].includes(e.category) || !Number.isFinite(e.createdAt) || !Number.isFinite(e.updatedAt)
|
package/server/dist/outputs.js
CHANGED
|
@@ -10,6 +10,7 @@ import { knownRoots, resolveBoundCwd } from './http/writeConfinement.js';
|
|
|
10
10
|
import { workflows } from './server/state.js';
|
|
11
11
|
import { matchFileEvent } from './recentFilesLedger.js';
|
|
12
12
|
import { outputDirectory, readOutputIndex, writeOutputIndex, mappedOutputPath } from './outputStore.js';
|
|
13
|
+
import { readLogLines, sealedThroughSeq } from './eventLog.js';
|
|
13
14
|
const LIMIT = 2000;
|
|
14
15
|
const EXTENSIONS = {
|
|
15
16
|
images: ['png', 'jpg', 'jpeg', 'webp', 'gif', 'bmp', 'svg', 'ico'],
|
|
@@ -220,6 +221,41 @@ async function reconcile(ctx, index) {
|
|
|
220
221
|
}
|
|
221
222
|
};
|
|
222
223
|
await walk(root);
|
|
224
|
+
const handle = async (event, fallbackTime) => {
|
|
225
|
+
const timestamp = typeof event.ts === 'number' ? event.ts : fallbackTime;
|
|
226
|
+
for (const output of outputEventPaths(event, ctx.cwd, root)) {
|
|
227
|
+
if (output.path)
|
|
228
|
+
await record(output.path, output.title, output.source, timestamp, output.inputPath);
|
|
229
|
+
else if (output.inline && !index.entries.some(e => e.id === idFor(`inline:${output.key}`)) && index.entries.length < LIMIT)
|
|
230
|
+
index.entries.push({ ...ctx, id: idFor(`inline:${output.key}`), title: output.title || 'Inline artifact', name: output.title || 'Inline artifact', category: 'documents', createdAt: timestamp, updatedAt: timestamp, inline: output.inline, source: output.source });
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
const noteSeq = (event) => { if (typeof event.seq === 'number' && event.seq > (index.seq ?? 0))
|
|
234
|
+
index.seq = event.seq; };
|
|
235
|
+
// Records sealed into compressed segments since the last read (P7.3): read
|
|
236
|
+
// them by sequence number, then restart the live file from its beginning.
|
|
237
|
+
const sealedThrough = await sealedThroughSeq(dir);
|
|
238
|
+
if (sealedThrough > (index.seq ?? 0)) {
|
|
239
|
+
const after = index.seq ?? 0;
|
|
240
|
+
for await (const line of readLogLines(dir, { fromSeq: after })) {
|
|
241
|
+
if (Buffer.byteLength(line) > 2 * 1024 * 1024)
|
|
242
|
+
continue;
|
|
243
|
+
let event = null;
|
|
244
|
+
try {
|
|
245
|
+
event = JSON.parse(line);
|
|
246
|
+
}
|
|
247
|
+
catch { /* malformed event */ }
|
|
248
|
+
if (!event || typeof event.seq !== 'number' || event.seq <= after)
|
|
249
|
+
continue;
|
|
250
|
+
if (event.seq > sealedThrough)
|
|
251
|
+
break;
|
|
252
|
+
await handle(event, Date.now());
|
|
253
|
+
noteSeq(event);
|
|
254
|
+
}
|
|
255
|
+
index.seq = Math.max(index.seq ?? 0, sealedThrough);
|
|
256
|
+
index.offset = 0;
|
|
257
|
+
}
|
|
258
|
+
const skipThrough = index.seq ?? 0;
|
|
223
259
|
const events = path.join(dir, 'events.jsonl');
|
|
224
260
|
let info;
|
|
225
261
|
try {
|
|
@@ -258,14 +294,9 @@ async function reconcile(ctx, index) {
|
|
|
258
294
|
event = JSON.parse(Buffer.concat(pending).toString('utf8'));
|
|
259
295
|
}
|
|
260
296
|
catch { /* malformed event */ }
|
|
261
|
-
if (event) {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
if (output.path)
|
|
265
|
-
await record(output.path, output.title, output.source, timestamp, output.inputPath);
|
|
266
|
-
else if (output.inline && !index.entries.some(e => e.id === idFor(`inline:${output.key}`)) && index.entries.length < LIMIT)
|
|
267
|
-
index.entries.push({ ...ctx, id: idFor(`inline:${output.key}`), title: output.title || 'Inline artifact', name: output.title || 'Inline artifact', category: 'documents', createdAt: timestamp, updatedAt: timestamp, inline: output.inline, source: output.source });
|
|
268
|
-
}
|
|
297
|
+
if (event && !(typeof event.seq === 'number' && event.seq <= skipThrough)) {
|
|
298
|
+
await handle(event, info.mtimeMs);
|
|
299
|
+
noteSeq(event);
|
|
269
300
|
}
|
|
270
301
|
}
|
|
271
302
|
consumed += lineBytes;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { createHash, randomUUID } from 'node:crypto';
|
|
2
|
+
import { closeSync, fsyncSync, lstatSync, mkdirSync, openSync, renameSync, unlinkSync, writeSync } from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { ensureProjectStateIgnore } from './projectStateIgnore.js';
|
|
5
|
+
// Content-addressed plan history (P7.2, docs/STORAGE_PLAN.md). Each distinct
|
|
6
|
+
// cluster plan body is written once to <cwd>/.arco/plans/.history/<sha256>.md
|
|
7
|
+
// so the per-member audit copy of `cluster_plan_changed` can carry the hash
|
|
8
|
+
// instead of the whole body. The folder sits inside plans/, which no cleanup,
|
|
9
|
+
// archive or delete ever touches. Plan listing reads index.json and the plans
|
|
10
|
+
// watcher only reacts to top-level <id>.md files, so history files never show
|
|
11
|
+
// up as plans.
|
|
12
|
+
export function planHistoryDir(cwd) {
|
|
13
|
+
return path.join(cwd, '.arco', 'plans', '.history');
|
|
14
|
+
}
|
|
15
|
+
export function planBodyHash(body) {
|
|
16
|
+
return createHash('sha256').update(body, 'utf8').digest('hex');
|
|
17
|
+
}
|
|
18
|
+
// Write the body once (temporary file, flush, rename) and return its hash.
|
|
19
|
+
// Returns null for an empty body (a cleared plan) or when the write fails;
|
|
20
|
+
// callers then keep the body in the logged event so nothing is lost.
|
|
21
|
+
export function rememberPlanBody(cwd, body) {
|
|
22
|
+
if (!cwd || !body)
|
|
23
|
+
return null;
|
|
24
|
+
const hash = planBodyHash(body);
|
|
25
|
+
const dir = planHistoryDir(cwd);
|
|
26
|
+
const file = path.join(dir, `${hash}.md`);
|
|
27
|
+
try {
|
|
28
|
+
const st = lstatSync(file);
|
|
29
|
+
if (st.isFile())
|
|
30
|
+
return hash;
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
catch (err) {
|
|
34
|
+
if (err.code !== 'ENOENT')
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
const tmp = path.join(dir, `.${hash}.${randomUUID()}.tmp`);
|
|
38
|
+
try {
|
|
39
|
+
ensureProjectStateIgnore(cwd);
|
|
40
|
+
mkdirSync(dir, { recursive: true });
|
|
41
|
+
const fd = openSync(tmp, 'wx', 0o600);
|
|
42
|
+
try {
|
|
43
|
+
writeSync(fd, body, null, 'utf8');
|
|
44
|
+
fsyncSync(fd);
|
|
45
|
+
}
|
|
46
|
+
finally {
|
|
47
|
+
closeSync(fd);
|
|
48
|
+
}
|
|
49
|
+
renameSync(tmp, file);
|
|
50
|
+
return hash;
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
try {
|
|
54
|
+
unlinkSync(tmp);
|
|
55
|
+
}
|
|
56
|
+
catch { /* not created */ }
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=planHistory.js.map
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { FileHandle } from 'fs/promises';
|
|
2
2
|
import { WorkerManager } from '../workers/WorkerManager.js';
|
|
3
|
-
import { type ServerMessage, type ProviderName, type ModelName, type EffortLevel, type MdTuneupCandidate } from '@arco/shared';
|
|
3
|
+
import { type ServerMessage, type ProviderName, type ModelName, type EffortLevel, type MdTuneupCandidate, type MdTuneupSkippedLink } from '@arco/shared';
|
|
4
4
|
export declare function instructionMetrics(text: string, bytes: number): Pick<MdTuneupCandidate, 'lines' | 'approximateTokens' | 'hints'>;
|
|
5
|
+
export declare function discoverInstructionFilesWithLinks(cwd: string): Promise<{
|
|
6
|
+
candidates: MdTuneupCandidate[];
|
|
7
|
+
skippedLinks: MdTuneupSkippedLink[];
|
|
8
|
+
}>;
|
|
5
9
|
export declare function discoverInstructionFiles(cwd: string): Promise<MdTuneupCandidate[]>;
|
|
6
10
|
export interface MdTuneupEditorConfig {
|
|
7
11
|
provider: ProviderName;
|
|
@@ -71,8 +71,10 @@ async function candidateMetrics(abs, bytes) {
|
|
|
71
71
|
// Discover recognized instruction files at the project root and in nested
|
|
72
72
|
// folders. Results use project-relative paths and sort shallowest-first so
|
|
73
73
|
// likely top-level guidance appears before files scoped to subdirectories.
|
|
74
|
-
export async function
|
|
74
|
+
export async function discoverInstructionFilesWithLinks(cwd) {
|
|
75
75
|
const found = [];
|
|
76
|
+
const links = [];
|
|
77
|
+
const root = await fs.realpath(cwd);
|
|
76
78
|
const walk = async (dir, depth) => {
|
|
77
79
|
if (depth > DISCOVERY_MAX_DEPTH)
|
|
78
80
|
return;
|
|
@@ -89,6 +91,9 @@ export async function discoverInstructionFiles(cwd) {
|
|
|
89
91
|
continue;
|
|
90
92
|
await walk(path.join(dir, ent.name), depth + 1);
|
|
91
93
|
}
|
|
94
|
+
else if (ent.isSymbolicLink() && INSTRUCTION_NAME_SET.has(ent.name)) {
|
|
95
|
+
links.push(path.join(dir, ent.name));
|
|
96
|
+
}
|
|
92
97
|
else if (ent.isFile() && INSTRUCTION_NAME_SET.has(ent.name)) {
|
|
93
98
|
const abs = path.join(dir, ent.name);
|
|
94
99
|
let bytes = 0;
|
|
@@ -108,7 +113,43 @@ export async function discoverInstructionFiles(cwd) {
|
|
|
108
113
|
const db = b.path.split(path.sep).length;
|
|
109
114
|
return da !== db ? da - db : a.path.localeCompare(b.path);
|
|
110
115
|
});
|
|
111
|
-
|
|
116
|
+
const targets = new Map();
|
|
117
|
+
for (const candidate of found) {
|
|
118
|
+
const abs = path.join(cwd, candidate.path);
|
|
119
|
+
try {
|
|
120
|
+
const stat = await fs.lstat(abs), real = await fs.realpath(abs);
|
|
121
|
+
if (stat.isFile() && !stat.isSymbolicLink() && withinRoot(root, real))
|
|
122
|
+
targets.set(real, candidate);
|
|
123
|
+
}
|
|
124
|
+
catch { /* candidate disappeared during the scan */ }
|
|
125
|
+
}
|
|
126
|
+
const skippedLinks = [];
|
|
127
|
+
for (const link of links) {
|
|
128
|
+
const relative = path.relative(cwd, link);
|
|
129
|
+
try {
|
|
130
|
+
const real = await fs.realpath(link);
|
|
131
|
+
if (!withinRoot(root, real)) {
|
|
132
|
+
skippedLinks.push({ path: relative, reason: 'Target is outside this project.' });
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
const target = targets.get(real);
|
|
136
|
+
if (!target) {
|
|
137
|
+
skippedLinks.push({ path: relative, reason: 'Target is not a discovered instruction file.' });
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
(target.alsoReadAs ??= []).push(relative);
|
|
141
|
+
}
|
|
142
|
+
catch {
|
|
143
|
+
skippedLinks.push({ path: relative, reason: 'Target cannot be resolved.' });
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
for (const candidate of found)
|
|
147
|
+
candidate.alsoReadAs?.sort();
|
|
148
|
+
skippedLinks.sort((a, b) => a.path.localeCompare(b.path));
|
|
149
|
+
return { candidates: found, skippedLinks };
|
|
150
|
+
}
|
|
151
|
+
export async function discoverInstructionFiles(cwd) {
|
|
152
|
+
return (await discoverInstructionFilesWithLinks(cwd)).candidates;
|
|
112
153
|
}
|
|
113
154
|
// Read-only local tool sets — same posture as runDocEdit. The agent gets NO
|
|
114
155
|
// Write/Edit/Bash; it may Read/Grep/Glob to confirm a referenced file still
|
|
@@ -6,6 +6,8 @@ interface TaskKernelState {
|
|
|
6
6
|
comments: TaskComment[];
|
|
7
7
|
runs: TaskRun[];
|
|
8
8
|
}
|
|
9
|
+
export declare const RELEASE_MAX = 24;
|
|
10
|
+
export declare function sanitizeRelease(value: unknown): string;
|
|
9
11
|
export declare function load(cwd: string, boardKey?: TaskBoardKey): Promise<LedgerTask[]>;
|
|
10
12
|
export declare function save(cwd: string, tasks: LedgerTask[], boardKey?: TaskBoardKey): Promise<void>;
|
|
11
13
|
export declare function loadKernel(cwd: string, boardKey?: TaskBoardKey): Promise<TaskKernelState>;
|
|
@@ -27,6 +29,7 @@ export declare function newTask(input: {
|
|
|
27
29
|
goalMode?: boolean;
|
|
28
30
|
goalMaxTurns?: number;
|
|
29
31
|
worktreeRequired?: boolean;
|
|
32
|
+
release?: string;
|
|
30
33
|
createdBy?: string;
|
|
31
34
|
}): LedgerTask;
|
|
32
35
|
export declare function newTaskComment(input: {
|
|
@@ -69,6 +72,7 @@ export declare function applyUpdate(tasks: LedgerTask[], id: string, patch: {
|
|
|
69
72
|
goalMaxTurns?: number | null;
|
|
70
73
|
assignee?: string;
|
|
71
74
|
worktreeRequired?: boolean;
|
|
75
|
+
release?: string;
|
|
72
76
|
worktree?: TaskWorktree | null;
|
|
73
77
|
signoff?: TaskSignoff | null;
|
|
74
78
|
updatedBy?: string;
|
|
@@ -131,6 +131,11 @@ function sanitizeParentIds(parentIds) {
|
|
|
131
131
|
function sanitizePriority(priority) {
|
|
132
132
|
return typeof priority === 'number' && Number.isFinite(priority) ? Math.trunc(priority) : 0;
|
|
133
133
|
}
|
|
134
|
+
export const RELEASE_MAX = 24;
|
|
135
|
+
// Release label: one trimmed line, bounded. Empty means no label.
|
|
136
|
+
export function sanitizeRelease(value) {
|
|
137
|
+
return typeof value === 'string' ? value.replace(/\s+/g, ' ').trim().slice(0, RELEASE_MAX) : '';
|
|
138
|
+
}
|
|
134
139
|
function sanitizeGoalMaxTurns(value) {
|
|
135
140
|
return typeof value === 'number' && Number.isFinite(value) && value > 0
|
|
136
141
|
? { goalMaxTurns: Math.trunc(value) }
|
|
@@ -168,6 +173,11 @@ function normalizeTask(task) {
|
|
|
168
173
|
...sanitizeGoalMaxTurns(raw.goalMaxTurns),
|
|
169
174
|
...sanitizeAssignee(raw.assignee),
|
|
170
175
|
};
|
|
176
|
+
const release = sanitizeRelease(raw.release);
|
|
177
|
+
if (release)
|
|
178
|
+
next.release = release;
|
|
179
|
+
else
|
|
180
|
+
delete next.release;
|
|
171
181
|
if (!(typeof raw.assignee === 'string' && raw.assignee.trim().length > 0))
|
|
172
182
|
delete next.assignee;
|
|
173
183
|
if (!(typeof raw.goalMaxTurns === 'number' && Number.isFinite(raw.goalMaxTurns) && raw.goalMaxTurns > 0)) {
|
|
@@ -388,6 +398,7 @@ function toBoardRow(t) {
|
|
|
388
398
|
...(t.parentIds?.length ? { parentIds: t.parentIds } : {}),
|
|
389
399
|
...(t.links?.length ? { links: t.links } : {}),
|
|
390
400
|
...(t.reviewRequired ? { reviewRequired: true } : {}),
|
|
401
|
+
...(t.release ? { release: t.release } : {}),
|
|
391
402
|
...(preview ? { notesPreview: preview } : {}),
|
|
392
403
|
...(notes.length > BOARD_NOTES_PREVIEW ? { notesLength: notes.length } : {}),
|
|
393
404
|
createdAt: t.createdAt,
|
|
@@ -532,6 +543,7 @@ export function newTask(input) {
|
|
|
532
543
|
goalMode: input.goalMode === true,
|
|
533
544
|
worktreeRequired: input.worktreeRequired === true,
|
|
534
545
|
...sanitizeGoalMaxTurns(input.goalMaxTurns),
|
|
546
|
+
...(sanitizeRelease(input.release) ? { release: sanitizeRelease(input.release) } : {}),
|
|
535
547
|
...(typeof input.createdBy === 'string' && input.createdBy.trim().length > 0
|
|
536
548
|
? { createdBy: input.createdBy.trim(), updatedBy: input.createdBy.trim() }
|
|
537
549
|
: {}),
|
|
@@ -651,6 +663,13 @@ patch) {
|
|
|
651
663
|
: {}),
|
|
652
664
|
updatedAt: Date.now(),
|
|
653
665
|
};
|
|
666
|
+
if (typeof patch.release === 'string') {
|
|
667
|
+
const label = sanitizeRelease(patch.release);
|
|
668
|
+
if (label)
|
|
669
|
+
next.release = label;
|
|
670
|
+
else
|
|
671
|
+
delete next.release;
|
|
672
|
+
}
|
|
654
673
|
if (patch.goalMaxTurns !== undefined) {
|
|
655
674
|
if (patch.goalMaxTurns === null)
|
|
656
675
|
delete next.goalMaxTurns;
|
|
@@ -156,6 +156,7 @@ export function getPeerToolDefinitions(opts) {
|
|
|
156
156
|
reviewRequired: { type: 'boolean' },
|
|
157
157
|
goalMode: { type: 'boolean' },
|
|
158
158
|
goalMaxTurns: { type: 'number' },
|
|
159
|
+
release: { type: 'string', description: 'Optional release label such as 0.1.4.' },
|
|
159
160
|
},
|
|
160
161
|
required: ['title'],
|
|
161
162
|
},
|
|
@@ -180,6 +181,7 @@ export function getPeerToolDefinitions(opts) {
|
|
|
180
181
|
id: { type: 'string', description: 'Task id from cluster_task_list.' },
|
|
181
182
|
status: { type: 'string', enum: ['triage', 'todo', 'ready', 'in_progress', 'blocked', 'review'], description: "New status. 'done' and 'archived' are rejected — operator-only." },
|
|
182
183
|
notes: { type: 'string', description: 'Replacement notes body for the task.' },
|
|
184
|
+
release: { type: 'string', description: 'Release label such as 0.1.4; an empty string clears it.' },
|
|
183
185
|
signoff: {
|
|
184
186
|
type: 'object',
|
|
185
187
|
description: 'Advisory director verdict on whether the task met its target. Does NOT mark it done.',
|
|
@@ -386,6 +388,7 @@ export async function executePeerTool(name, args, ctx) {
|
|
|
386
388
|
...(typeof args.reviewRequired === 'boolean' ? { reviewRequired: args.reviewRequired } : {}),
|
|
387
389
|
...(typeof args.goalMode === 'boolean' ? { goalMode: args.goalMode } : {}),
|
|
388
390
|
...(typeof args.goalMaxTurns === 'number' ? { goalMaxTurns: args.goalMaxTurns } : {}),
|
|
391
|
+
...(typeof args.release === 'string' ? { release: args.release } : {}),
|
|
389
392
|
...(typeof args.status === 'string' ? { status: args.status } : {}),
|
|
390
393
|
}, bcastCluster);
|
|
391
394
|
if (!result.ok)
|
|
@@ -462,6 +465,7 @@ export async function executePeerTool(name, args, ctx) {
|
|
|
462
465
|
// non-status string falls through to applyUpdate's VALID_STATUS gate).
|
|
463
466
|
...(typeof args.status === 'string' ? { status: args.status } : {}),
|
|
464
467
|
...(typeof args.notes === 'string' ? { notes: args.notes } : {}),
|
|
468
|
+
...(typeof args.release === 'string' ? { release: args.release } : {}),
|
|
465
469
|
// §D3 — advisory sign-off; peerTaskUpdate validates state + stamps author.
|
|
466
470
|
...(args.signoff !== undefined ? { signoff: args.signoff } : {}),
|
|
467
471
|
}, bcastCluster);
|