arco-workbench 0.2.2 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +1 -1
- package/THIRD_PARTY_NOTICES +2 -2
- package/client/dist/assets/{PhosphorBackdrop-BbR3xmfD.js → PhosphorBackdrop-CLILIwOQ.js} +1 -1
- package/client/dist/assets/{ThemedBackgroundShaderImpl-UMjbs9ZN.js → ThemedBackgroundShaderImpl-B87chcb5.js} +1 -1
- package/client/dist/assets/{XtermView-n135qz-f.js → XtermView-BP_j7WSN.js} +1 -1
- package/client/dist/assets/{galleryEditor-CFSke4by.js → galleryEditor-B90phoBI.js} +1 -1
- package/client/dist/assets/{index-DeoJbjI3.js → index-BfPp1Oup.js} +270 -270
- package/client/dist/index.html +1 -1
- package/client/dist/manifest-mobile.webmanifest +1 -0
- package/client/src/App.tsx +2 -2
- package/client/src/components/AuthReloginNotice.tsx +7 -6
- package/client/src/components/ChatMessage.tsx +41 -29
- package/client/src/components/ChatPanel.tsx +17 -4
- package/client/src/components/ClaudeNativeAccountPicker.tsx +32 -0
- package/client/src/components/ClaudeNativeAuthRow.tsx +71 -19
- package/client/src/components/ClusterRightPanel/AddWorkerSection.tsx +11 -281
- package/client/src/components/ClusterRightPanel/AutoPickupControl.tsx +1 -1
- package/client/src/components/ClusterRightPanel/FreshMemberForm.tsx +315 -0
- package/client/src/components/ClusterRightPanel/ReplaceMemberDialog.tsx +17 -7
- package/client/src/components/ClusterRightPanel/index.tsx +1 -1
- package/client/src/components/ClusterRightPanel/useFreshMemberPicker.ts +6 -4
- package/client/src/components/ClusterTab.tsx +2 -2
- package/client/src/components/Connections/Connections.tsx +7 -11
- package/client/src/components/Connections/model.ts +3 -1
- package/client/src/components/FileViewerModal.tsx +54 -17
- package/client/src/components/GitHubPanel/index.tsx +9 -5
- package/client/src/components/HandoffDialog.tsx +5 -3
- package/client/src/components/MobileShell.tsx +1 -33
- package/client/src/components/OperatorQuestionNotice.tsx +5 -4
- package/client/src/components/ProvidersPopover.tsx +6 -2
- package/client/src/components/RightPanel/ActivityTab.tsx +2 -1
- package/client/src/components/RightPanel/ConfigTab.tsx +23 -5
- package/client/src/components/RightPanel/OutputsPanel.tsx +21 -9
- package/client/src/components/RightPanel/outputsReconcile.ts +31 -0
- package/client/src/components/SettingsPanel.tsx +7 -10
- package/client/src/components/SpawnDialog.tsx +14 -3
- package/client/src/components/TabBar.tsx +2 -2
- package/client/src/components/TabContextMenu.tsx +73 -133
- package/client/src/components/TerminalInput.tsx +4 -3
- package/client/src/components/TranscriptWorkerDialog.tsx +14 -4
- package/client/src/components/UsageBar.tsx +37 -18
- package/client/src/components/WorkflowCreator/ClusterMembersSection.tsx +29 -3
- package/client/src/components/WorkflowCreator/index.tsx +29 -15
- package/client/src/components/WorkflowView.tsx +1 -1
- package/client/src/components/providerIndicator.ts +7 -3
- package/client/src/components/research/QuickResearchOverview.tsx +7 -3
- package/client/src/components/research/SavedQuickKeep.tsx +7 -3
- package/client/src/components/settings/GitHubAuthRow.tsx +34 -0
- package/client/src/explorer/ArtifactsLens.tsx +17 -8
- package/client/src/explorer/ExplorerApp.tsx +3 -3
- package/client/src/explorer/types.ts +3 -1
- package/client/src/help/content/cluster.tsx +10 -4
- package/client/src/help/content/composer.tsx +3 -2
- package/client/src/help/content/header.tsx +6 -3
- package/client/src/help/content/misc.tsx +9 -7
- package/client/src/help/content/rightPanel.tsx +11 -6
- package/client/src/help/content/settings.tsx +14 -3
- package/client/src/help/content/tabbar.tsx +1 -1
- package/client/src/help/manualSections/actions.tsx +5 -1
- package/client/src/help/manualSections/clusters.tsx +21 -15
- package/client/src/help/manualSections/configuration.tsx +6 -4
- package/client/src/help/manualSections/gettingStarted.tsx +4 -2
- package/client/src/help/manualSections/maintenance.tsx +24 -0
- package/client/src/help/manualSections/powerFeatures.tsx +4 -2
- package/client/src/help/manualSections/providers.tsx +11 -4
- package/client/src/help/manualSections/workspace.tsx +3 -3
- package/client/src/hooks/useClaudeNativeCatalog.ts +26 -0
- package/client/src/hooks/useClaudeNativeLogin.ts +16 -11
- package/client/src/hooks/useWebSocket.ts +4 -2
- package/client/src/layout/layoutRange.ts +14 -5
- package/client/src/main.tsx +2 -0
- package/client/src/questions/waitingQuestion.ts +2 -0
- package/client/src/stores/appStore.ts +5 -1
- package/client/src/stores/appStore.types.ts +2 -0
- package/client/src/stores/replayContext.ts +20 -0
- package/client/src/utils/chatFileLinks.ts +34 -3
- package/client/src/utils/claudeAuth.ts +9 -1
- package/client/src/ws/handleServerMessage.ts +11 -3
- package/docs/ARCHITECTURE.md +3 -3
- package/docs/BACKUP.md +1 -1
- package/docs/CHECKPOINTS.md +67 -3
- package/docs/CLIENT.md +11 -6
- package/docs/EXTENDING.md +1 -1
- package/docs/FEATURES.md +3 -3
- package/docs/GETTING_STARTED.md +5 -4
- package/docs/GIT_WORKBENCH.md +8 -0
- package/docs/GLOSSARY.md +2 -2
- package/docs/GOTCHAS.md +4 -4
- package/docs/HTTP_API.md +63 -30
- package/docs/OPERATIONS.md +11 -0
- package/docs/OPERATOR_ACTIONS.md +2 -2
- package/docs/OUTPUTS.md +48 -6
- package/docs/PERSISTENCE.md +1 -1
- package/docs/PRIMITIVES.md +4 -2
- package/docs/PROTOCOL_CLUSTER.md +12 -6
- package/docs/PROTOCOL_PRIMITIVES.md +1 -1
- package/docs/PROVIDERS.md +47 -10
- package/docs/RESEARCH.md +3 -3
- package/docs/SETTINGS.md +9 -4
- package/node_modules/@arco/shared/dist/protocol/clusters.d.ts +15 -3
- package/node_modules/@arco/shared/dist/protocol/clusters.js +1 -1
- package/node_modules/@arco/shared/dist/protocol/models.d.ts +6 -1
- package/node_modules/@arco/shared/dist/protocol/operatorQuestions.d.ts +2 -1
- package/node_modules/@arco/shared/dist/protocol/settings.d.ts +3 -0
- package/node_modules/@arco/shared/dist/protocol/settings.js +5 -0
- package/node_modules/@arco/shared/dist/protocol/workflows.d.ts +1 -0
- package/node_modules/@arco/shared/dist/protocol/workflows.js +0 -2
- package/node_modules/@arco/shared/package.json +1 -1
- package/package.json +2 -2
- package/scripts/packaging/services.mjs +20 -1
- package/scripts/packaging/update.mjs +37 -2
- package/server/dist/attention.d.ts +6 -0
- package/server/dist/attention.js +6 -0
- package/server/dist/auth.d.ts +5 -0
- package/server/dist/auth.js +31 -20
- package/server/dist/clusterAutoTurn.d.ts +5 -1
- package/server/dist/clusterAutoTurn.js +31 -9
- package/server/dist/clusterPresets.js +3 -3
- package/server/dist/effortValidation.d.ts +2 -2
- package/server/dist/effortValidation.js +4 -4
- package/server/dist/explorerArtifacts.d.ts +1 -0
- package/server/dist/explorerArtifacts.js +12 -1
- package/server/dist/explorerDocs.d.ts +1 -0
- package/server/dist/explorerDocs.js +4 -4
- package/server/dist/geminiMembers.d.ts +7 -1
- package/server/dist/geminiMembers.js +28 -14
- package/server/dist/gitSnapshots.d.ts +1 -0
- package/server/dist/gitSnapshots.js +547 -83
- package/server/dist/http/clusterRoutes.js +9 -3
- package/server/dist/http/conversationFiles.d.ts +36 -0
- package/server/dist/http/conversationFiles.js +222 -0
- package/server/dist/http/fileBytes.d.ts +3 -0
- package/server/dist/http/fileBytes.js +33 -0
- package/server/dist/http/fileContentRoute.d.ts +2 -0
- package/server/dist/http/fileContentRoute.js +139 -0
- package/server/dist/http/fileRead.d.ts +54 -2
- package/server/dist/http/fileRead.js +31 -24
- package/server/dist/http/outputRoutes.js +14 -21
- package/server/dist/http/readConfinement.d.ts +0 -11
- package/server/dist/http/readConfinement.js +4 -30
- package/server/dist/http/router.js +41 -66
- package/server/dist/index.js +26 -12
- package/server/dist/management/initHubLink.js +1 -1
- package/server/dist/outputs.js +8 -0
- package/server/dist/primitives/exportContext.d.ts +2 -0
- package/server/dist/primitives/exportContext.js +13 -2
- package/server/dist/primitives/runCompare.d.ts +7 -1
- package/server/dist/primitives/runCompare.js +44 -20
- package/server/dist/project/taskLedger.js +46 -34
- package/server/dist/providerAccounts.d.ts +4 -0
- package/server/dist/providerAccounts.js +20 -1
- package/server/dist/providers/antigravity/artifacts.d.ts +23 -0
- package/server/dist/providers/antigravity/artifacts.js +140 -0
- package/server/dist/providers/antigravity/index.js +85 -7
- package/server/dist/providers/antigravity/questions.d.ts +2 -0
- package/server/dist/providers/antigravity/questions.js +58 -0
- package/server/dist/providers/claude-native/auth.d.ts +9 -8
- package/server/dist/providers/claude-native/auth.js +50 -58
- package/server/dist/providers/claude-native/authStatus.d.ts +2 -2
- package/server/dist/providers/claude-native/authStatus.js +9 -7
- package/server/dist/providers/claude-native/catalog.d.ts +6 -5
- package/server/dist/providers/claude-native/catalog.js +50 -39
- package/server/dist/providers/claude-native/oauth.d.ts +10 -9
- package/server/dist/providers/claude-native/oauth.js +120 -96
- package/server/dist/providers/claude-native/worker.d.ts +1 -0
- package/server/dist/providers/claude-native/worker.js +38 -23
- package/server/dist/providers/codex-appserver/operatorQuestions.d.ts +5 -3
- package/server/dist/providers/codex-appserver/operatorQuestions.js +27 -13
- package/server/dist/providers/codexChatBoundary.js +6 -1
- package/server/dist/research/quickPromotion.d.ts +3 -0
- package/server/dist/research/quickPromotion.js +26 -9
- package/server/dist/research/savedQuickPromotion.js +2 -11
- package/server/dist/server/broadcast.js +6 -0
- package/server/dist/settings.d.ts +1 -0
- package/server/dist/settings.js +39 -7
- package/server/dist/skills.js +1 -1
- package/server/dist/smartPickupAdapters.d.ts +1 -0
- package/server/dist/smartPickupAdapters.js +2 -2
- package/server/dist/smartPickupObserver.js +8 -5
- package/server/dist/thirdPartySkills.js +11 -5
- package/server/dist/turnChanges.d.ts +1 -1
- package/server/dist/turnChanges.js +5 -4
- package/server/dist/usage.d.ts +1 -1
- package/server/dist/usage.js +39 -27
- package/server/dist/workers/WorkerManager.d.ts +1 -0
- package/server/dist/workers/WorkerManager.js +1 -0
- package/server/dist/workers/processKill.js +37 -24
- package/server/dist/workflowMeta.js +2 -2
- package/server/dist/ws/clusterHandlers.d.ts +2 -2
- package/server/dist/ws/clusterHandlers.js +127 -113
- package/server/dist/ws/clusterMembers.d.ts +1 -1
- package/server/dist/ws/clusterMembers.js +34 -4
- package/server/dist/ws/compactHandlers.js +30 -14
- package/server/dist/ws/compareHandlers.js +53 -21
- package/server/dist/ws/gateHandlers.js +2 -0
- package/server/dist/ws/genesisHandlers.js +5 -3
- package/server/dist/ws/handoffHandlers.d.ts +1 -1
- package/server/dist/ws/handoffHandlers.js +115 -39
- package/server/dist/ws/transcriptWorkerHandlers.js +7 -2
- package/server/dist/ws/turnEngine.js +37 -19
- package/server/dist/ws/updatePrimaryConfig.d.ts +3 -2
- package/server/dist/ws/updatePrimaryConfig.js +236 -133
- package/server/dist/ws/workflowHandlers.js +21 -4
- package/server/package.json +1 -1
- package/server/src/attention.ts +7 -0
- package/server/src/auth.ts +33 -20
- package/server/src/clusterAutoTurn.ts +31 -11
- package/server/src/clusterPresets.ts +2 -2
- package/server/src/effortValidation.ts +4 -4
- package/server/src/explorerArtifacts.ts +12 -1
- package/server/src/explorerDocs.ts +5 -5
- package/server/src/geminiMembers.ts +26 -15
- package/server/src/gitSnapshots.ts +538 -82
- package/server/src/http/clusterRoutes.ts +10 -3
- package/server/src/http/conversationFiles.ts +231 -0
- package/server/src/http/fileBytes.ts +34 -0
- package/server/src/http/fileContentRoute.ts +123 -0
- package/server/src/http/fileRead.ts +30 -25
- package/server/src/http/outputRoutes.ts +13 -13
- package/server/src/http/readConfinement.ts +3 -30
- package/server/src/http/router.ts +39 -62
- package/server/src/index.ts +27 -18
- package/server/src/management/initHubLink.ts +1 -1
- package/server/src/outputs.ts +8 -0
- package/server/src/primitives/exportContext.ts +14 -2
- package/server/src/primitives/runCompare.ts +73 -46
- package/server/src/project/taskLedger.ts +47 -30
- package/server/src/providerAccounts.ts +20 -1
- package/server/src/providers/antigravity/artifacts.ts +121 -0
- package/server/src/providers/antigravity/index.ts +64 -6
- package/server/src/providers/antigravity/questions.ts +52 -0
- package/server/src/providers/claude-native/auth.ts +45 -60
- package/server/src/providers/claude-native/authStatus.ts +9 -8
- package/server/src/providers/claude-native/catalog.ts +52 -35
- package/server/src/providers/claude-native/oauth.ts +101 -77
- package/server/src/providers/claude-native/worker.ts +38 -22
- package/server/src/providers/codex-appserver/operatorQuestions.ts +26 -12
- package/server/src/providers/codexChatBoundary.ts +6 -1
- package/server/src/research/quickPromotion.ts +24 -6
- package/server/src/research/savedQuickPromotion.ts +2 -8
- package/server/src/server/broadcast.ts +4 -0
- package/server/src/settings.ts +36 -8
- package/server/src/skills.ts +1 -1
- package/server/src/smartPickupAdapters.ts +3 -2
- package/server/src/smartPickupObserver.ts +8 -5
- package/server/src/thirdPartySkills.ts +11 -5
- package/server/src/turnChanges.ts +5 -4
- package/server/src/usage.ts +30 -22
- package/server/src/workers/WorkerManager.ts +2 -0
- package/server/src/workers/processKill.ts +37 -23
- package/server/src/workflowMeta.ts +2 -2
- package/server/src/ws/clusterHandlers.ts +107 -104
- package/server/src/ws/clusterMembers.ts +25 -6
- package/server/src/ws/compactHandlers.ts +29 -15
- package/server/src/ws/compareHandlers.ts +59 -25
- package/server/src/ws/gateHandlers.ts +2 -0
- package/server/src/ws/genesisHandlers.ts +5 -4
- package/server/src/ws/handoffHandlers.ts +105 -37
- package/server/src/ws/transcriptWorkerHandlers.ts +6 -2
- package/server/src/ws/turnEngine.ts +36 -18
- package/server/src/ws/updatePrimaryConfig.ts +230 -132
- package/server/src/ws/workflowHandlers.ts +20 -4
- package/shared/dist/protocol/clusters.d.ts +15 -3
- package/shared/dist/protocol/clusters.js +1 -1
- package/shared/dist/protocol/models.d.ts +6 -1
- package/shared/dist/protocol/operatorQuestions.d.ts +2 -1
- package/shared/dist/protocol/settings.d.ts +3 -0
- package/shared/dist/protocol/settings.js +5 -0
- package/shared/dist/protocol/workflows.d.ts +1 -0
- package/shared/dist/protocol/workflows.js +0 -2
- package/shared/src/protocol/clusters.ts +23 -5
- package/shared/src/protocol/compare.ts +2 -2
- package/shared/src/protocol/models.ts +8 -4
- package/shared/src/protocol/operatorQuestions.ts +2 -1
- package/shared/src/protocol/settings.ts +8 -1
- package/shared/src/protocol/workflows.ts +1 -1
|
@@ -26,17 +26,32 @@ function parseQuestions(value) {
|
|
|
26
26
|
export function pendingOperatorQuestions(workflowId) {
|
|
27
27
|
return [...pending.values()].filter((p) => p.workflowId === workflowId).map((p) => p.state);
|
|
28
28
|
}
|
|
29
|
+
export function openGeminiOperatorQuestion(workflowId, sessionId, questions, respond) {
|
|
30
|
+
const requestId = randomUUID();
|
|
31
|
+
const state = { requestId, provider: 'antigravity-cli', threadId: sessionId, turnId: requestId,
|
|
32
|
+
itemId: requestId, mode: 'blocking', questions, status: 'pending', createdAt: Date.now() };
|
|
33
|
+
const publish = (next) => publisher?.(workflowId, next);
|
|
34
|
+
const finish = (next) => { pending.delete(requestId); publish(next); };
|
|
35
|
+
pending.set(requestId, { workflowId, state, respond, publish, finish, sending: false });
|
|
36
|
+
publish(state);
|
|
37
|
+
return () => {
|
|
38
|
+
if (pending.has(requestId))
|
|
39
|
+
finish({ ...state, status: 'cancelled', reason: 'Gemini closed this question.' });
|
|
40
|
+
};
|
|
41
|
+
}
|
|
29
42
|
export async function replyToOperatorQuestion(workflowId, requestId, value, sendInput) {
|
|
30
43
|
const entry = pending.get(requestId);
|
|
31
44
|
if (!entry || entry.workflowId !== workflowId)
|
|
32
45
|
return { ok: false, error: 'This question is no longer pending.' };
|
|
33
46
|
if (entry.sending)
|
|
34
47
|
return { ok: false, error: 'An answer is already being delivered.' };
|
|
35
|
-
if (!record(value) || Object.keys(value).
|
|
36
|
-
return { ok: false, error: 'Answer every question.' };
|
|
48
|
+
if (!record(value) || Object.keys(value).some(id => !entry.state.questions.some(q => q.id === id)))
|
|
49
|
+
return { ok: false, error: 'Answer every required question.' };
|
|
37
50
|
const answers = Object.create(null);
|
|
38
51
|
for (const q of entry.state.questions) {
|
|
39
52
|
const a = Object.hasOwn(value, q.id) ? value[q.id] : undefined;
|
|
53
|
+
if (a === undefined && q.optional)
|
|
54
|
+
continue;
|
|
40
55
|
if (!Array.isArray(a) || a.length !== 1 || !text(a[0], 16384) || !a[0].trim())
|
|
41
56
|
return { ok: false, error: 'Each question needs an answer.' };
|
|
42
57
|
if (q.options?.length && !q.allowOther && !q.options.some((o) => o.label === a[0]))
|
|
@@ -46,9 +61,8 @@ export async function replyToOperatorQuestion(workflowId, requestId, value, send
|
|
|
46
61
|
entry.sending = true;
|
|
47
62
|
try {
|
|
48
63
|
if (entry.respond) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
throw new Error('Codex connection closed.');
|
|
64
|
+
if (entry.respond(answers) === false)
|
|
65
|
+
throw new Error('Agent connection closed.');
|
|
52
66
|
}
|
|
53
67
|
else {
|
|
54
68
|
if (!sendInput)
|
|
@@ -58,8 +72,8 @@ export async function replyToOperatorQuestion(workflowId, requestId, value, send
|
|
|
58
72
|
await sendInput('Answers to your questions:\n' + entry.state.questions.map((q) => `${q.question}\nAnswer: ${answers[q.id][0]}`).join('\n\n'), entry.state);
|
|
59
73
|
}
|
|
60
74
|
if (pending.get(requestId) === entry) {
|
|
61
|
-
const publicAnswers = Object.fromEntries(entry.state.questions.
|
|
62
|
-
entry.
|
|
75
|
+
const publicAnswers = Object.fromEntries(entry.state.questions.filter(q => Object.hasOwn(answers, q.id)).map(q => [q.id, q.secret ? ['[redacted]'] : answers[q.id]]));
|
|
76
|
+
entry.finish({ ...entry.state, status: 'answered', answers: publicAnswers });
|
|
63
77
|
}
|
|
64
78
|
return { ok: true };
|
|
65
79
|
}
|
|
@@ -78,11 +92,11 @@ export function dismissOperatorQuestion(workflowId, requestId) {
|
|
|
78
92
|
return { ok: false, error: 'An answer is already being delivered.' };
|
|
79
93
|
entry.sending = true;
|
|
80
94
|
try {
|
|
81
|
-
if (entry.respond
|
|
82
|
-
throw new Error('
|
|
95
|
+
if (entry.respond?.(null) === false)
|
|
96
|
+
throw new Error('Agent connection closed.');
|
|
83
97
|
if (pending.get(requestId) !== entry)
|
|
84
98
|
return { ok: false, error: 'This question is no longer pending.' };
|
|
85
|
-
entry.
|
|
99
|
+
entry.finish({ ...entry.state, status: 'cancelled', reason: 'Dismissed by the operator.' });
|
|
86
100
|
return { ok: true };
|
|
87
101
|
}
|
|
88
102
|
catch {
|
|
@@ -112,7 +126,7 @@ export class CodexOperatorQuestions {
|
|
|
112
126
|
if ([...this.ids].some((id) => pending.get(id)?.rpcId === req.id))
|
|
113
127
|
throw new Error('Duplicate question request.');
|
|
114
128
|
const questions = parseQuestions(p.questions);
|
|
115
|
-
this.add({ threadId: p.threadId, turnId: p.turnId, itemId: p.itemId, mode: p.isBlocking === false ? 'async' : 'blocking', questions }, respond, req.id);
|
|
129
|
+
this.add({ threadId: p.threadId, turnId: p.turnId, itemId: p.itemId, mode: p.isBlocking === false ? 'async' : 'blocking', questions }, (answers) => respond({ answers: Object.fromEntries(Object.entries(answers ?? {}).map(([id, a]) => [id, { answers: a }])) }), req.id);
|
|
116
130
|
}
|
|
117
131
|
acceptAsync(threadId, turnId, item) {
|
|
118
132
|
if (this.asyncItems.has(item.id) || !Array.isArray(item.questions) || !item.questions.length)
|
|
@@ -136,7 +150,7 @@ export class CodexOperatorQuestions {
|
|
|
136
150
|
if (this.ids.size >= 16)
|
|
137
151
|
throw new Error('Too many pending questions.');
|
|
138
152
|
const state = { ...data, requestId: randomUUID(), provider: this.provider, status: 'pending', createdAt: Date.now() };
|
|
139
|
-
const entry = { workflowId: this.workflowId, state, respond, rpcId, publish: this.publish,
|
|
153
|
+
const entry = { workflowId: this.workflowId, state, respond, rpcId, publish: this.publish, finish: (next) => this.finish(entry, next), sending: false };
|
|
140
154
|
this.ids.add(state.requestId);
|
|
141
155
|
pending.set(state.requestId, entry);
|
|
142
156
|
this.publish(state);
|
|
@@ -167,7 +181,7 @@ export class CodexOperatorQuestions {
|
|
|
167
181
|
if (!p || (rpcOnly && p.rpcId === undefined))
|
|
168
182
|
continue;
|
|
169
183
|
this.finish(p, { ...p.state, status: 'cancelled', reason });
|
|
170
|
-
p.respond?.(
|
|
184
|
+
p.respond?.(null);
|
|
171
185
|
}
|
|
172
186
|
}
|
|
173
187
|
}
|
|
@@ -25,7 +25,12 @@ export function supportsCodexChat(probe, web = false) {
|
|
|
25
25
|
}
|
|
26
26
|
catch { /* Unsupported or failed strict configuration probe. */ }
|
|
27
27
|
return supportedVersion && validated && (!web || listed(probe.listedFeatures ?? '', 'code_mode_host')) && requiredFeatures.every(name => listed(probe.listedFeatures ?? '', name))
|
|
28
|
-
&& disabledFeatures.filter(name => requiredFeatures.includes(name) || listed(probe.listedFeatures ?? '', name)).every(name =>
|
|
28
|
+
&& disabledFeatures.filter(name => requiredFeatures.includes(name) || listed(probe.listedFeatures ?? '', name)).every(name => {
|
|
29
|
+
const enabled = web && name === 'code_mode_host';
|
|
30
|
+
const activeStages = 'stable|experimental|under development';
|
|
31
|
+
const stages = requiredFeatures.includes(name) || enabled ? activeStages : `${activeStages}|deprecated|removed`;
|
|
32
|
+
return new RegExp(`^${name}\\s+(?:${stages})\\s+${enabled}\\s*$`, 'm').test(probe.features ?? '');
|
|
33
|
+
})
|
|
29
34
|
&& [probe.execHelp, probe.resumeHelp].every(help => help?.includes('--ignore-user-config') && help.includes('--ignore-rules') && help.includes('--strict-config'));
|
|
30
35
|
}
|
|
31
36
|
const cache = new Map();
|
|
@@ -18,6 +18,9 @@ export declare function beginQuickPromotion(workflowId: string): ActivePromotion
|
|
|
18
18
|
export declare function finishQuickPromotion(workflowId: string, active: ActivePromotion, ready: boolean): void;
|
|
19
19
|
export declare function yieldQuickPromotionToMessage(workflowId: string): Promise<boolean>;
|
|
20
20
|
export declare function readQuickPromotion(clusterId: string): Promise<QuickPromotionJournal | null>;
|
|
21
|
+
export declare class QuickPromotionFolderMissingError extends Error {
|
|
22
|
+
}
|
|
23
|
+
export declare function resolveQuickPromotionRoot(source: string, folderRoot?: string): Promise<string>;
|
|
21
24
|
export declare function requestQuickPromotion(clusterId: string, folderRoot?: string): Promise<QuickPromotionJournal>;
|
|
22
25
|
export declare function recoverQuickPromotion(journal: QuickPromotionJournal): Promise<QuickPromotionJournal>;
|
|
23
26
|
export declare function stopQuickPromotionTimer(clusterId: string): boolean;
|
|
@@ -65,6 +65,31 @@ function schedule(clusterId) {
|
|
|
65
65
|
timer.unref();
|
|
66
66
|
timers.set(clusterId, timer);
|
|
67
67
|
}
|
|
68
|
+
export class QuickPromotionFolderMissingError extends Error {
|
|
69
|
+
}
|
|
70
|
+
export async function resolveQuickPromotionRoot(source, folderRoot) {
|
|
71
|
+
const settings = await readSettings();
|
|
72
|
+
const selected = folderRoot?.trim();
|
|
73
|
+
const requested = selected || settings.researchFolder;
|
|
74
|
+
if (!requested || !isAbsolute(requested))
|
|
75
|
+
throw new Error('Choose a research folder.');
|
|
76
|
+
let root;
|
|
77
|
+
try {
|
|
78
|
+
root = safeDirectory(requested);
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
if (error.code !== 'ENOENT')
|
|
82
|
+
throw error;
|
|
83
|
+
throw new QuickPromotionFolderMissingError(selected
|
|
84
|
+
? 'The folder you chose is gone. Choose another folder.'
|
|
85
|
+
: 'The saved research folder is gone. Choose a new folder to keep this research.');
|
|
86
|
+
}
|
|
87
|
+
if (isPathWithin(source, root) || isPathWithin(root, source))
|
|
88
|
+
throw new Error('Choose a research folder outside the Quick research workspace.');
|
|
89
|
+
if (selected && root !== settings.researchFolder)
|
|
90
|
+
await patchSettings({ researchFolder: root });
|
|
91
|
+
return root;
|
|
92
|
+
}
|
|
68
93
|
export async function requestQuickPromotion(clusterId, folderRoot) {
|
|
69
94
|
return withFileLock(journalPath(clusterId), async () => {
|
|
70
95
|
const current = await readQuickPromotion(clusterId);
|
|
@@ -75,15 +100,7 @@ export async function requestQuickPromotion(clusterId, folderRoot) {
|
|
|
75
100
|
throw new Error('This is not an open Quick research.');
|
|
76
101
|
if (!/^[0-9a-f-]{36}$/i.test(state.projectId) || resolve(state.folder) !== resolve(join(await fs.realpath(arcoHome()), 'chat-workspaces', state.projectId)) || (await fs.lstat(state.folder)).isSymbolicLink())
|
|
77
102
|
throw new Error('The Quick research workspace is unavailable.');
|
|
78
|
-
const
|
|
79
|
-
const requested = settings.researchFolder || folderRoot?.trim();
|
|
80
|
-
if (!requested || !isAbsolute(requested))
|
|
81
|
-
throw new Error('Choose a research folder.');
|
|
82
|
-
const root = safeDirectory(requested);
|
|
83
|
-
if (isPathWithin(state.folder, root) || isPathWithin(root, state.folder))
|
|
84
|
-
throw new Error('Choose a research folder outside the Quick research workspace.');
|
|
85
|
-
if (!settings.researchFolder)
|
|
86
|
-
await patchSettings({ researchFolder: root });
|
|
103
|
+
const root = await resolveQuickPromotionRoot(state.folder, folderRoot);
|
|
87
104
|
const journal = { clusterId, projectId: state.projectId, directorWorkflowId: state.directorWorkflowId, source: state.folder, root, phase: 'waiting' };
|
|
88
105
|
await save(journal);
|
|
89
106
|
schedule(clusterId);
|
|
@@ -6,13 +6,12 @@ import { arcoHome } from '../arcoHome.js';
|
|
|
6
6
|
import { antigravityChatWorkspace, chatStorageDir } from '../chatMode.js';
|
|
7
7
|
import { readLogLines } from '../eventLog.js';
|
|
8
8
|
import { isPathWithin, safeDirectory } from '../fileAccessPolicy.js';
|
|
9
|
-
import { readSettings, patchSettings } from '../settings.js';
|
|
10
9
|
import { workflows } from '../server/state.js';
|
|
11
10
|
import { flushWorkflowBuffer } from '../workflowStore.js';
|
|
12
11
|
import { createResearchFolder, writeProjectFiles } from './researchFolder.js';
|
|
13
12
|
import { closedResearchRecordPath } from './researchClose.js';
|
|
14
13
|
import { addToLibrary, readClosedRecord } from './researchLibrary.js';
|
|
15
|
-
import { beginQuickPromotion, copyWorkspace, finishQuickPromotion, yieldQuickPromotionToMessage } from './quickPromotion.js';
|
|
14
|
+
import { beginQuickPromotion, copyWorkspace, finishQuickPromotion, resolveQuickPromotionRoot, yieldQuickPromotionToMessage } from './quickPromotion.js';
|
|
16
15
|
const validId = (id) => /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(id);
|
|
17
16
|
const pathFor = (id) => join(arcoHome(), 'research', 'closed-promotions', `${id}.json`);
|
|
18
17
|
const timers = new Map();
|
|
@@ -71,15 +70,7 @@ export async function requestSavedQuickPromotion(id, folderRoot) {
|
|
|
71
70
|
const source = antigravityChatWorkspace(id);
|
|
72
71
|
if (!state?.quick || !state.closedAt || resolve(state.folder) !== resolve(source) || (await fs.lstat(source)).isSymbolicLink())
|
|
73
72
|
throw new Error('This saved Chat has no Quick research to keep.');
|
|
74
|
-
const
|
|
75
|
-
const chosen = settings.researchFolder || folderRoot?.trim();
|
|
76
|
-
if (!chosen || !isAbsolute(chosen))
|
|
77
|
-
throw new Error('Choose a research folder.');
|
|
78
|
-
const root = safeDirectory(chosen);
|
|
79
|
-
if (isPathWithin(source, root) || isPathWithin(root, source))
|
|
80
|
-
throw new Error('Choose a research folder outside the Quick research workspace.');
|
|
81
|
-
if (!settings.researchFolder)
|
|
82
|
-
await patchSettings({ researchFolder: root });
|
|
73
|
+
const root = await resolveQuickPromotionRoot(source, folderRoot);
|
|
83
74
|
const journal = { projectId: id, source, root, phase: 'waiting' };
|
|
84
75
|
await save(journal);
|
|
85
76
|
schedule(id);
|
|
@@ -475,6 +475,12 @@ function observeTurnBoundary(workflowId, wf, message) {
|
|
|
475
475
|
// attention.ts sees every message (questions, gates and errors too) and
|
|
476
476
|
// ignores a repeated start or end itself.
|
|
477
477
|
attention.observeAttention(workflowId, message, { name: wf.config.name ?? '', incognito: !!wf.config.incognito });
|
|
478
|
+
// A finished handoff or fold leaves a smaller conversation in the same member: automatic pickup may resume.
|
|
479
|
+
if (message.type === 'handoff_complete' || message.type === 'context_folded')
|
|
480
|
+
clusterAutoTurn.noteTurnOutcome(workflowId, null);
|
|
481
|
+
// A terminal request_too_large stops automatic pickup for this member before its turn-end sweep.
|
|
482
|
+
if (message.type === 'error' && typeof message.message === 'string' && clusterAutoTurn.isOversizeError(message.message))
|
|
483
|
+
clusterAutoTurn.noteTurnOutcome(workflowId, message.message);
|
|
478
484
|
if (message.type === 'primary_turn_started') {
|
|
479
485
|
if (turnBoundaryState.get(workflowId) === 'open')
|
|
480
486
|
return;
|
|
@@ -8,6 +8,7 @@ export declare function readSettings(cwd?: string, opts?: {
|
|
|
8
8
|
export declare function writeSettings(next: ArcoSettings): Promise<void>;
|
|
9
9
|
export declare function initializeProviderSettings(detect: () => Promise<ArcoSettings['enabledProviders']>): Promise<boolean>;
|
|
10
10
|
export declare function patchSettings(patch: Partial<ArcoSettings>): Promise<ArcoSettings>;
|
|
11
|
+
export declare function saveClaudeNativeProfile(label: string, id?: string): Promise<ArcoSettings>;
|
|
11
12
|
type SettingsChangeKind = 'global' | 'project';
|
|
12
13
|
type SettingsChangeListener = (kind: SettingsChangeKind, cwd?: string) => void;
|
|
13
14
|
export declare function onSettingsChange(listener: SettingsChangeListener): () => void;
|
package/server/dist/settings.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { randomBytes } from 'node:crypto';
|
|
1
2
|
import { sanitizeNativeSubagents } from '@arco/shared';
|
|
2
3
|
import { scanBeforeDeadline } from './scanDeadline.js';
|
|
3
4
|
import { parsePreviewPorts } from './previewProxy.js';
|
|
@@ -22,7 +23,7 @@ import { promises as fs } from 'fs';
|
|
|
22
23
|
import { mkdirSync, realpathSync, watch as fsWatch } from 'fs';
|
|
23
24
|
import path from 'path';
|
|
24
25
|
import { homedir } from 'os';
|
|
25
|
-
import { VALID_THEME_IDS, VALID_FONT_PACK_IDS, normalizeLegacyThemeId, DEFAULT_UI_SCALE, normalizeUiScale } from '@arco/shared';
|
|
26
|
+
import { isClaudeNativeProfileId, VALID_THEME_IDS, VALID_FONT_PACK_IDS, normalizeLegacyThemeId, DEFAULT_UI_SCALE, normalizeUiScale } from '@arco/shared';
|
|
26
27
|
import { describeConfigValue } from './configValue.js';
|
|
27
28
|
import { atomicWriteFile, withFileLock } from './atomicFile.js';
|
|
28
29
|
import { arcoHome } from './arcoHome.js';
|
|
@@ -309,7 +310,7 @@ function sanitizeAccountProfile(raw, provider) {
|
|
|
309
310
|
return null;
|
|
310
311
|
const r = raw;
|
|
311
312
|
const id = typeof r.id === 'string' ? r.id.trim() : '';
|
|
312
|
-
if (!ACCOUNT_ID_PATTERN.test(id))
|
|
313
|
+
if (provider === 'claudeNative' ? !isClaudeNativeProfileId(id) : !ACCOUNT_ID_PATTERN.test(id))
|
|
313
314
|
return null;
|
|
314
315
|
const labelRaw = typeof r.label === 'string' ? r.label.trim().replace(/[\r\n\t]+/g, ' ') : id;
|
|
315
316
|
const label = (labelRaw || id).slice(0, 32);
|
|
@@ -324,7 +325,7 @@ function sanitizeAccountProfile(raw, provider) {
|
|
|
324
325
|
if (codexHome && codexHome.length <= 512 && !/[\r\n]/.test(codexHome))
|
|
325
326
|
out.codexHome = codexHome;
|
|
326
327
|
}
|
|
327
|
-
const authBrowser = sanitizeAccountBrowser(r.authBrowser);
|
|
328
|
+
const authBrowser = provider === 'claudeNative' ? undefined : sanitizeAccountBrowser(r.authBrowser);
|
|
328
329
|
if (authBrowser)
|
|
329
330
|
out.authBrowser = authBrowser;
|
|
330
331
|
return out;
|
|
@@ -334,7 +335,7 @@ function sanitizeProviderAccounts(raw) {
|
|
|
334
335
|
return undefined;
|
|
335
336
|
const r = raw;
|
|
336
337
|
const out = {};
|
|
337
|
-
for (const provider of ['codex', 'claude']) {
|
|
338
|
+
for (const provider of ['codex', 'claude', 'claudeNative']) {
|
|
338
339
|
const arr = r[provider];
|
|
339
340
|
if (!Array.isArray(arr))
|
|
340
341
|
continue;
|
|
@@ -933,8 +934,21 @@ export async function readSettings(cwd, opts) {
|
|
|
933
934
|
if (opts?.includeProject === false)
|
|
934
935
|
return mergeWithDefaults(global);
|
|
935
936
|
const project = await readJsonFile(projectSettingsPath(cwd), 'project');
|
|
936
|
-
const merged = deepMerge(global, project);
|
|
937
|
-
|
|
937
|
+
const merged = mergeWithDefaults(deepMerge(global, project));
|
|
938
|
+
// A project can tune its transport. The Native profile names and IDs are
|
|
939
|
+
// global operator settings because the same IDs select paid credentials.
|
|
940
|
+
const operatorAccounts = sanitizeProviderAccounts(global.providerAccounts);
|
|
941
|
+
if (merged.providerAccounts || operatorAccounts) {
|
|
942
|
+
const accounts = { ...merged.providerAccounts };
|
|
943
|
+
delete accounts.claude;
|
|
944
|
+
delete accounts.claudeNative;
|
|
945
|
+
if (operatorAccounts?.claude)
|
|
946
|
+
accounts.claude = operatorAccounts.claude;
|
|
947
|
+
if (operatorAccounts?.claudeNative)
|
|
948
|
+
accounts.claudeNative = operatorAccounts.claudeNative;
|
|
949
|
+
merged.providerAccounts = Object.keys(accounts).length ? accounts : undefined;
|
|
950
|
+
}
|
|
951
|
+
return merged;
|
|
938
952
|
}
|
|
939
953
|
export async function writeSettings(next) {
|
|
940
954
|
await atomicWriteFile(GLOBAL_SETTINGS_PATH, JSON.stringify(next, null, 2) + '\n');
|
|
@@ -992,7 +1006,7 @@ async function patchSettingsUnlocked(patch) {
|
|
|
992
1006
|
merged.localClusterCapacity = current.localClusterCapacity;
|
|
993
1007
|
}
|
|
994
1008
|
if ('providerAccounts' in patch) {
|
|
995
|
-
const sanitized = sanitizeProviderAccounts(patch.providerAccounts);
|
|
1009
|
+
const sanitized = sanitizeProviderAccounts(patch.providerAccounts ? { ...current.providerAccounts, ...patch.providerAccounts } : patch.providerAccounts);
|
|
996
1010
|
if (sanitized)
|
|
997
1011
|
merged.providerAccounts = sanitized;
|
|
998
1012
|
}
|
|
@@ -1395,6 +1409,24 @@ export async function patchSettings(patch) {
|
|
|
1395
1409
|
parsePreviewPorts(patch.previewPorts, Math.min(await hostTemporaryPortStart(), 32768));
|
|
1396
1410
|
return withFileLock(GLOBAL_SETTINGS_PATH, () => patchSettingsUnlocked(patch));
|
|
1397
1411
|
}
|
|
1412
|
+
export async function saveClaudeNativeProfile(label, id) {
|
|
1413
|
+
const cleanLabel = label.trim();
|
|
1414
|
+
if (!cleanLabel || cleanLabel.length > 32 || /[\r\n\t]/.test(cleanLabel))
|
|
1415
|
+
throw new Error('Enter an account name of 1 to 32 characters.');
|
|
1416
|
+
return withFileLock(GLOBAL_SETTINGS_PATH, async () => {
|
|
1417
|
+
const current = await readSettings();
|
|
1418
|
+
const accounts = current.providerAccounts ?? {};
|
|
1419
|
+
const profiles = accounts.claudeNative ?? [];
|
|
1420
|
+
if (id && !profiles.some(profile => profile.id === id))
|
|
1421
|
+
throw new Error('Claude Native account unavailable.');
|
|
1422
|
+
if (!id && profiles.length >= 8)
|
|
1423
|
+
throw new Error('Up to 8 additional Claude Native accounts are supported.');
|
|
1424
|
+
const next = id
|
|
1425
|
+
? profiles.map(profile => profile.id === id ? { ...profile, label: cleanLabel } : profile)
|
|
1426
|
+
: [...profiles, { id: `native-${randomBytes(12).toString('hex')}`, label: cleanLabel }];
|
|
1427
|
+
return patchSettingsUnlocked({ providerAccounts: { ...accounts, claudeNative: next } });
|
|
1428
|
+
});
|
|
1429
|
+
}
|
|
1398
1430
|
const listeners = new Set();
|
|
1399
1431
|
export function onSettingsChange(listener) {
|
|
1400
1432
|
listeners.add(listener);
|
package/server/dist/skills.js
CHANGED
|
@@ -29,7 +29,7 @@ import { ARCHITECTURE_REVIEW_SKILL } from './architectureSkill.js';
|
|
|
29
29
|
import { PROPORTIONATE_TESTING_SKILL } from './proportionateTestingSkill.js';
|
|
30
30
|
import { THIRD_PARTY_SKILL_FILES } from './thirdPartySkills.js';
|
|
31
31
|
const ARCO_BUILTIN_SKILLS = [ARCHITECTURE_REVIEW_SKILL, PROPORTIONATE_TESTING_SKILL];
|
|
32
|
-
const OPERATOR_BUILTINS = new Set(['grill-me', 'grill-with-docs', 'wait-what', 'retro']);
|
|
32
|
+
const OPERATOR_BUILTINS = new Set(['grill-me', 'grill-with-docs', 'wait-what', 'retro', 'code-review']);
|
|
33
33
|
export function listBuiltinSkills() {
|
|
34
34
|
return [...ARCO_BUILTIN_SKILLS.map(s => ({ slug: s.slug, name: s.name, description: s.description, scope: 'builtin', operatorOnly: s.operatorOnly })), ...THIRD_PARTY_SKILL_FILES.map(({ slug, files }) => {
|
|
35
35
|
const parsed = parseSkillFile(files['SKILL.md']);
|
|
@@ -152,7 +152,7 @@ export function claudeAdapter(opts = {}) {
|
|
|
152
152
|
async evaluate(req) {
|
|
153
153
|
const { signal, done } = deadline(req);
|
|
154
154
|
try {
|
|
155
|
-
const { accessToken } = await tokens().catch(() => { throw new EvaluatorRefused('not_signed_in'); });
|
|
155
|
+
const { accessToken } = await tokens(req.providerAccountRef).catch(() => { throw new EvaluatorRefused('not_signed_in'); });
|
|
156
156
|
const client = new Anthropic({
|
|
157
157
|
authToken: accessToken,
|
|
158
158
|
apiKey: null,
|
|
@@ -161,7 +161,7 @@ export function claudeAdapter(opts = {}) {
|
|
|
161
161
|
defaultHeaders: { 'anthropic-beta': 'claude-code-20250219,oauth-2025-04-20', 'anthropic-dangerous-direct-browser-access': 'true', 'user-agent': CLAUDE_CLI_USER_AGENT, 'x-app': 'cli' },
|
|
162
162
|
...(opts.fetchImpl ? { fetch: opts.fetchImpl } : {}),
|
|
163
163
|
});
|
|
164
|
-
const model = resolveClaudeAliasFromCatalog(req.model);
|
|
164
|
+
const model = resolveClaudeAliasFromCatalog(req.model, req.providerAccountRef);
|
|
165
165
|
const resp = await client.messages.create({
|
|
166
166
|
model,
|
|
167
167
|
...shortTextRequestParams(model, req.maxOutputTokens),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { workflows } from './server/state.js';
|
|
1
2
|
// Smart AUTO-PICKUP observer: decides, for one idle member at a time, what
|
|
2
3
|
// the chosen evaluator proposes for its waiting mail, and records it. In
|
|
3
4
|
// Observe-only mode that record is the whole effect. In Automatic mode a wake
|
|
@@ -20,7 +21,7 @@ import { withFileLock } from './atomicFile.js';
|
|
|
20
21
|
import { buildClusterAutoPickup } from '@arco/shared';
|
|
21
22
|
import { evaluatorAdapter, isStartupFailure } from './smartPickupAdapters.js';
|
|
22
23
|
import { recentSentTo } from './smartPickupThread.js';
|
|
23
|
-
import { isGeminiMember } from './geminiMembers.js';
|
|
24
|
+
import { geminiPickupAllowed, isGeminiMember } from './geminiMembers.js';
|
|
24
25
|
const defaultDebounce = (() => {
|
|
25
26
|
const raw = Number(process.env.ARCO_SMART_PICKUP_DEBOUNCE_MS);
|
|
26
27
|
return Number.isInteger(raw) && raw >= 0 ? raw : 2000;
|
|
@@ -177,9 +178,7 @@ export async function evaluateOnce(clusterId, workflowId) {
|
|
|
177
178
|
if (!deferLapsed && !prior.retryEvaluation)
|
|
178
179
|
return null;
|
|
179
180
|
}
|
|
180
|
-
|
|
181
|
-
// NUDGE; Smart pickup neither evaluates nor wakes it.
|
|
182
|
-
if (isGeminiMember(workflowId)) {
|
|
181
|
+
if (isGeminiMember(workflowId) && !geminiPickupAllowed(workflowId)) {
|
|
183
182
|
const d = { ...base, action: null, reason: 'operator_send_only', outcome: 'skipped' };
|
|
184
183
|
await record(d);
|
|
185
184
|
return d;
|
|
@@ -219,7 +218,11 @@ export async function evaluateOnce(clusterId, workflowId) {
|
|
|
219
218
|
return null;
|
|
220
219
|
}
|
|
221
220
|
try {
|
|
221
|
+
const recipient = workflows.get(workflowId);
|
|
222
|
+
const providerAccountRef = evaluator.provider === 'claude' && recipient?.primary.provider === 'claude'
|
|
223
|
+
&& recipient.config.claudeTransport !== 'cli' && !recipient.config.ultracode ? recipient.config.providerAccountRef : undefined;
|
|
222
224
|
raw = await evaluatorAdapter(evaluator.provider).evaluate({
|
|
225
|
+
providerAccountRef,
|
|
223
226
|
model: evaluator.model,
|
|
224
227
|
instructions: EVALUATOR_INSTRUCTIONS,
|
|
225
228
|
prompt: evaluatorUserPrompt(snapshot.payload),
|
|
@@ -282,7 +285,7 @@ export async function evaluateOnce(clusterId, workflowId) {
|
|
|
282
285
|
return d;
|
|
283
286
|
}
|
|
284
287
|
// Conditions that pass with time; a wake blocked by one stays owed.
|
|
285
|
-
const TRANSIENT = new Set(['busy', 'cooldown', 'rate_capped', 'limit_wakes_member_hour']);
|
|
288
|
+
const TRANSIENT = new Set(['busy', 'cooldown', 'rate_capped', 'limit_wakes_member_hour', 'member_blocked']);
|
|
286
289
|
async function gateAndRecord(proposal, arm) {
|
|
287
290
|
const result = await gateWake(proposal, arm);
|
|
288
291
|
const fallback = proposal.action === null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: https://github.com/mattpocock/skills at
|
|
1
|
+
// Source: https://github.com/mattpocock/skills at fe3b143d813e0d9f0b22531e4e4c5f239745d643. MIT; see THIRD_PARTY_NOTICES.
|
|
2
2
|
export const THIRD_PARTY_SKILL_FILES = [
|
|
3
3
|
{
|
|
4
4
|
"slug": "grill-me",
|
|
@@ -24,6 +24,12 @@ export const THIRD_PARTY_SKILL_FILES = [
|
|
|
24
24
|
"SKILL.md": "---\nname: retro\ndescription: \"Conduct a retrospective on a coding session.\"\ndisable-model-invocation: true\n---\n\nThe user has asked for a **retrospective**. You are suggesting improvements to the coding agent's **environment** to improve future runs.\n\n## Steps\n\n1. Read the `writing-for-agents` skill listed in the skill manifest for the writing style guide.\n\n2. Read the primary sources for the session the user specifies. This may mean searching through session logs on this machine. If the user doesn't specify a session, default to the current one.\n\n3. Look for candidates for improvement in these categories.\n\n- **Navigation**: how easy was it for the agent to find the right files? Are there hidden dependencies between files? Would a **navigation pointer** make it easier? _Use when_ the session took a long time to find a piece of information.\n- **Automated checks**: are there automated checks that could catch errors the agent made? Linting, typing, tests, filesystem linters? Read the repo's own check command first (its `package.json`/build-tool `lint`/`check` scripts, its CI workflow), so a check that already exists but sits unwired or silently broken is the finding, not a reinvention. A repo with no **guardrail** (no pre-commit hook and no CI job running its lint/typecheck/test command) is itself a finding: an un-linted repo is a standing missed opportunity, not a neutral default. _Use when_ the agent made a mistake an automated check could have caught, or the repo has no guardrail at all.\n- **Coding standards**: should the **reviewer agent** be given a new rule to enforce? Should an existing rule be removed or clarified? Classify the violation first: a **mechanical** one (a fixed syntactic pattern, a banned API, an import shape, a file-location rule) gets a deterministic check, full stop: a custom rule in the repo's own linter, a new pre-commit hook, or a new CI job, whichever the repo's language and existing guardrail make cheapest. Default to building the check over writing the rule. Reserve `CODING_STANDARDS.md` for genuine **judgement calls** (cross-file consistency, \"matches the surrounding style,\" anything no guardrail could ever substitute for). _Use when_ the reviewer agent failed to catch a mistake.\n- **Global AGENTS.md**: are there any steering instructions that should be moved to coding standards (or automated checks) instead? _Use when_ the AGENTS.md file is particularly large - in the repo OR the user's global scope.\n- **Tool economy**: did the agent make expensive tool calls that could be streamlined? Is there any custom tooling (CLI's, MCP's) that is particularly token-inefficient? _Use when_ the agent made an expensive tool call.\n- **No-ops**: look for instructions in steering files that don't modify the agent's behavior. _Use when_ the steering files are large and unwieldy.\n- **Information access**: look for opportunities to increase the agent's access to information. Teeing dev server logs, readonly access to third-party services. _Use when_ a crucial piece of information was not available to the agent.\n\n4. Present these candidates to the user, in order of severity.\n\n## Reference\n\n### Implementation vs Review\n\nRemember that all work goes through two stages: implementation and review. The implementation agent has the most **context pressure**. They are responsible for exploration, writing code, and debugging failures.\n\nThe review agent has the least context pressure - it receives a diff, so no exploration needed. It often does not need to write code or debug.\n\nThis means that the review agent should be responsible for imposing coding standards, not the implementation agent.\n\n### Files\n\nYou have access to several files in the repo:\n\n- `CLAUDE.md`/`AGENTS.md`: these files are pushed to the context window of any agent working in this repo. They should be used incredibly sparingly, usually only for **navigation pointers** to other files.\n- `CODING_STANDARDS.md`: this file is read during review, not implementation. Add **navigation pointers** to docs folders if the standards file gets more than 1,000 lines long.\n- Docs: use docs as references files, pointed to by other files. Look for existing docs before writing new ones.\n- Skills: use skills for docs (since their description goes into the agent's context window), or for user-invoked commands. Follow the advice in the `writing-for-agents` skill.\n\n\nSource: mattpocock/skills (MIT); see THIRD_PARTY_NOTICES.\n"
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
|
+
{
|
|
28
|
+
"slug": "code-review",
|
|
29
|
+
"files": {
|
|
30
|
+
"SKILL.md": "---\nname: code-review\ndescription: Review a specific change against its spec and project standards.\ndisable-model-invocation: true\n---\n\n# Code review\n\nReview the requested change on two axes: standards and spec. This review is read-only: inspect files and history and report findings. Do not modify files, commit, land, publish, or create issues or pull requests. Follow the project's role and delegation rules; the Director retains landing. A single reviewer can perform both axes.\n\n1. Establish the change. Use the supplied or established Git base and diff, including uncommitted changes if requested. Resolve the base and inspect the complete diff and relevant surrounding code. If the base is ambiguous, ask for it. Report an empty or unavailable diff instead of inventing a review.\n2. Establish the spec. Read the relevant Arco board task and linked plan references when available. Otherwise use the supplied spec and project instructions. If no spec is available, say so and report the spec review as incomplete.\n3. Establish the standards. Read applicable project instructions and contribution or coding standards. Consider design smells as judgement calls, not automatic defects; project rules take precedence.\n4. Review the full change against both axes. Trace affected behavior and checks far enough to identify concrete faults, missing requirements and relevant project-rule violations. Do not claim an unrun check or an inferred behavior was observed.\n5. Report actionable findings with severity, file and line, supporting rule or requirement, and the user impact. Separate Standards and Spec findings. State missing evidence and unverified claims; if an axis has no findings, say so and note its coverage limits. Keep architecture-review for broader structural exploration.\n\nSource: mattpocock/skills (MIT), adapted for Arco; see THIRD_PARTY_NOTICES.\n"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
27
33
|
{
|
|
28
34
|
"slug": "grilling",
|
|
29
35
|
"files": {
|
|
@@ -33,9 +39,9 @@ export const THIRD_PARTY_SKILL_FILES = [
|
|
|
33
39
|
{
|
|
34
40
|
"slug": "domain-modeling",
|
|
35
41
|
"files": {
|
|
36
|
-
"SKILL.md": "---\nname: domain-modeling\ndescription: Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.\n---\n\n# Domain Modeling\n\nActively build and sharpen the project's domain model as you design. This is the *active* discipline: challenging terms, inventing edge-case scenarios, and writing the glossary and decisions down the moment they crystallise. (Merely *reading* `GLOSSARY.md` for vocabulary is not this skill: that's a one-line habit any skill can do. This skill is for when you're changing the model, not just consuming it.)\n\n## File structure\n\nMost repos have a single context:\n\n```\n/\n
|
|
37
|
-
"GLOSSARY-FORMAT.md": "# GLOSSARY.md Format\n\n## Structure\n\n```md\n# {Context Name}\n\n{One or two sentence description of what this context is and why it exists.}\n\n## Language\n\n**Order**:\n{A one or two sentence description of the term}\n_Avoid_: Purchase, transaction\n\n**Invoice**:\nA request for payment sent to
|
|
38
|
-
"ADR-FORMAT.md": "# ADR Format\n\nADRs live in `docs/adr/` and use sequential numbering: `0001-slug.md`, `0002-slug.md`, etc.\n\nCreate the `docs/adr/` directory lazily: only when the first ADR is needed.\n\n## Template\n\n```md\n# {Short title of the decision}\n\n{1-3 sentences: what's the context, what did we decide, and why.}\n```\n\nThat's it. An ADR can be a single paragraph. The value is in recording *that* a decision was made and *why*, not in filling out sections.\n\n## Optional sections\n\nOnly include these when they add genuine value. Most ADRs won't need them.\n\n- **Status** frontmatter (`proposed | accepted | deprecated | superseded by ADR-NNNN`): useful when decisions are revisited\n- **Considered Options**: only when the rejected alternatives are worth remembering\n- **Consequences**: only when non-obvious downstream effects need to be called out\n\n## Numbering\n\nScan `docs/adr/` for the highest existing number and increment by one.\n\n## When to offer an ADR\n\nAll three of these must be true:\n\n1. **Hard to reverse**: the cost of changing your mind later is meaningful\n2. **Surprising without context**: a future reader will look at the code and wonder \"why on earth did they do it this way?\"\n3. **The result of a real trade-off**: there were genuine alternatives and you picked one for specific reasons\n\nIf a decision is easy to reverse, skip it: you'll just reverse it. If it's not surprising, nobody will wonder why. If there was no real alternative, there's nothing to record beyond \"we did the obvious thing.\"\n\n### What qualifies\n\n- **Architectural shape.** \"We're using a monorepo.\" \"The write model is event-sourced, the read model is projected into Postgres.\"\n- **Integration patterns between contexts.** \"Ordering and Billing communicate via domain events, not synchronous HTTP.\"\n- **Technology choices that carry lock-in.** Database, message bus, auth provider, deployment target. Not every library: just the ones that would take a quarter to swap out.\n- **Boundary and scope decisions.** \"Customer data is owned by the Customer context; other contexts reference it by ID only.\" The explicit no-s are as valuable as the yes-s.\n- **Deliberate deviations from the obvious path.** \"We're using manual SQL instead of an ORM because X.\" Anything where a reasonable reader would assume the opposite. These stop the next engineer from \"fixing\" something that was deliberate.\n- **Constraints not visible in the code.** \"We can't use AWS because of compliance requirements.\" \"Response times must be under 200ms because of the partner API contract.\"\n- **Rejected alternatives when the rejection is non-obvious.** If you considered GraphQL and picked REST for subtle reasons, record it; otherwise someone will suggest GraphQL again in six months.\n"
|
|
42
|
+
"SKILL.md": "---\nname: domain-modeling\ndescription: Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.\n---\n\n# Domain Modeling\n\nActively build and sharpen the project's domain model as you design. This is the *active* discipline: challenging terms, inventing edge-case scenarios, and writing the glossary and decisions down the moment they crystallise. (Merely *reading* `GLOSSARY.md` for vocabulary is not this skill: that's a one-line habit any skill can do. This skill is for when you're changing the model, not just consuming it.)\n\n## File structure\n\nMost repos have a single context:\n\n```\n/\n├── GLOSSARY.md\n├── docs/\n│ └── adr/\n│ ├── 0001-event-sourced-orders.md\n│ └── 0002-postgres-for-write-model.md\n└── src/\n```\n\nIf a `GLOSSARY-MAP.md` exists at the root, the repo has multiple contexts. The map points to where each one lives:\n\n```\n/\n├── GLOSSARY-MAP.md\n├── docs/\n│ └── adr/ <- system-wide decisions\n├── src/\n│ ├── ordering/\n│ │ ├── GLOSSARY.md\n│ │ └── docs/adr/ <- context-specific decisions\n│ └── billing/\n│ ├── GLOSSARY.md\n│ └── docs/adr/\n```\n\nCreate files lazily: only when you have something to write. If no `GLOSSARY.md` exists, create one when the first term is resolved. If no `docs/adr/` exists, create it when the first ADR is needed.\n\n## During the session\n\n### Challenge against the glossary\n\nWhen the user uses a term that conflicts with the existing language in `GLOSSARY.md`, call it out immediately. \"Your glossary defines 'cancellation' as X, but you seem to mean Y. Which is it?\"\n\n### Sharpen fuzzy language\n\nWhen the user uses vague or overloaded terms, propose a precise canonical term. \"You're saying 'account': do you mean the Customer or the User? Those are different things.\"\n\n### Discuss concrete scenarios\n\nWhen domain relationships are being discussed, stress-test them with specific scenarios. Invent scenarios that probe edge cases and force the user to be precise about the boundaries between concepts.\n\n### Cross-reference with code\n\nWhen the user states how something works, check whether the code agrees. If you find a contradiction, surface it: \"Your code cancels entire Orders, but you just said partial cancellation is possible. Which is right?\"\n\n### Update GLOSSARY.md inline\n\nWhen a term is resolved, update `GLOSSARY.md` right there. Don't batch these up: capture them as they happen. Use the format in [GLOSSARY-FORMAT.md](./GLOSSARY-FORMAT.md).\n\n`GLOSSARY.md` should be totally devoid of implementation details. Do not treat `GLOSSARY.md` as a spec, a scratch pad, or a repository for implementation decisions. It is a glossary and nothing else.\n\n### Offer ADRs sparingly\n\nOnly offer to create an ADR when all three are true:\n\n1. **Hard to reverse**: the cost of changing your mind later is meaningful\n2. **Surprising without context**: a future reader will wonder \"why did they do it this way?\"\n3. **The result of a real trade-off**: there were genuine alternatives and you picked one for specific reasons\n\nIf any of the three is missing, skip the ADR. Use the format in [ADR-FORMAT.md](./ADR-FORMAT.md).\n\n\nSource: mattpocock/skills (MIT); see THIRD_PARTY_NOTICES.\n\nFor public projects, exclude private material from project files. Do not stage or commit changes.\n",
|
|
43
|
+
"GLOSSARY-FORMAT.md": "# GLOSSARY.md Format\n\n## Structure\n\n```md\n# {Context Name}\n\n{One or two sentence description of what this context is and why it exists.}\n\n## Language\n\n**Order**:\n{A one or two sentence description of the term}\n_Avoid_: Purchase, transaction\n\n**Invoice**:\nA request for payment for an **Order**, sent to its **Customer** after delivery.\n_Avoid_: Bill, payment request\n\n**Customer**:\nA person or organization that places an **Order**.\n_Avoid_: Client, buyer, account\n```\n\n## Rules\n\n- **Be opinionated.** When multiple words exist for the same concept, pick the best one and list the others under `_Avoid_`.\n- **Keep definitions tight.** One or two sentences max. Define what it IS, not what it does.\n- **Bold other glossary terms inside a definition.** Write related terms as `**Order**` and describe how the terms relate.\n- **Only include terms specific to this project's context.** General programming concepts (timeouts, error types, utility patterns) don't belong even if the project uses them extensively. Before adding a term, ask: is this a concept unique to this context, or a general programming concept? Only the former belongs.\n- **Group terms under subheadings** when natural clusters emerge. If all terms belong to a single cohesive area, a flat list is fine.\n\n## Single vs multi-context repos\n\n**Single context (most repos):** One `GLOSSARY.md` at the repo root.\n\n**Multiple contexts:** A `GLOSSARY-MAP.md` at the repo root lists the contexts, where they live, and how they relate to each other:\n\n```md\n# Glossary Map\n\n## Contexts\n\n- [Ordering](./src/ordering/GLOSSARY.md): receives and tracks customer orders\n- [Billing](./src/billing/GLOSSARY.md): generates invoices and processes payments\n- [Fulfillment](./src/fulfillment/GLOSSARY.md): manages warehouse picking and shipping\n\n## Relationships\n\n- **Ordering -> Fulfillment**: Ordering emits `OrderPlaced` events; Fulfillment consumes them to start picking\n- **Fulfillment -> Billing**: Fulfillment emits `ShipmentDispatched` events; Billing consumes them to generate invoices\n- **Ordering ↔ Billing**: Shared types for `CustomerId` and `Money`\n```\n\nThe skill infers which structure applies:\n\n- If `GLOSSARY-MAP.md` exists, read it to find contexts\n- If only a root `GLOSSARY.md` exists, single context\n- If neither exists, create a root `GLOSSARY.md` lazily when the first term is resolved\n\nWhen multiple contexts exist, infer which one the current topic relates to. If unclear, ask.\n",
|
|
44
|
+
"ADR-FORMAT.md": "# ADR Format\n\nADRs live in `docs/adr/` and use sequential numbering: `0001-slug.md`, `0002-slug.md`, etc.\n\nCreate the `docs/adr/` directory lazily: only when the first ADR is needed.\n\n## Template\n\n```md\n# {Short title of the decision}\n\n{1-3 sentences: what's the context, what did we decide, and why.}\n```\n\nThat's it. An ADR can be a single paragraph. The value is in recording *that* a decision was made and *why*, not in filling out sections.\n\n## Optional sections\n\nOnly include these when they add genuine value. Most ADRs won't need them.\n\n- **Status** frontmatter (`proposed | accepted | deprecated | superseded by ADR-NNNN`): useful when decisions are revisited\n- **Considered Options**: only when the rejected alternatives are worth remembering\n- **Consequences**: only when non-obvious downstream effects need to be called out\n\n## When a decision changes\n\nWrite a new ADR explaining the new decision and why the old approach was replaced. Follow the project's convention for retaining, marking or linking superseded records.\n\n## Numbering\n\nScan `docs/adr/` for the highest existing number and increment by one.\n\n## When to offer an ADR\n\nAll three of these must be true:\n\n1. **Hard to reverse**: the cost of changing your mind later is meaningful\n2. **Surprising without context**: a future reader will look at the code and wonder \"why on earth did they do it this way?\"\n3. **The result of a real trade-off**: there were genuine alternatives and you picked one for specific reasons\n\nIf a decision is easy to reverse, skip it: you'll just reverse it. If it's not surprising, nobody will wonder why. If there was no real alternative, there's nothing to record beyond \"we did the obvious thing.\"\n\n### What qualifies\n\n- **Architectural shape.** \"We're using a monorepo.\" \"The write model is event-sourced, the read model is projected into Postgres.\"\n- **Integration patterns between contexts.** \"Ordering and Billing communicate via domain events, not synchronous HTTP.\"\n- **Technology choices that carry lock-in.** Database, message bus, auth provider, deployment target. Not every library: just the ones that would take a quarter to swap out.\n- **Boundary and scope decisions.** \"Customer data is owned by the Customer context; other contexts reference it by ID only.\" The explicit no-s are as valuable as the yes-s.\n- **Deliberate deviations from the obvious path.** \"We're using manual SQL instead of an ORM because X.\" Anything where a reasonable reader would assume the opposite. These stop the next engineer from \"fixing\" something that was deliberate.\n- **Constraints not visible in the code.** \"We can't use AWS because of compliance requirements.\" \"Response times must be under 200ms because of the partner API contract.\"\n- **Rejected alternatives when the rejection is non-obvious.** If you considered GraphQL and picked REST for subtle reasons, record it; otherwise someone will suggest GraphQL again in six months.\n"
|
|
39
45
|
}
|
|
40
46
|
},
|
|
41
47
|
{
|
|
@@ -56,7 +62,7 @@ export const THIRD_PARTY_SKILL_FILES = [
|
|
|
56
62
|
{
|
|
57
63
|
"slug": "codebase-design",
|
|
58
64
|
"files": {
|
|
59
|
-
"SKILL.md": "---\nname: codebase-design\ndescription: Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.\n---\n\n# Codebase Design\n\nDesign **deep modules**: a lot of behaviour behind a small interface, placed at a clean seam, testable through that interface. Use this language and these principles wherever code is being designed or restructured. The aim is leverage for callers, locality for maintainers, and testability for everyone.\n\n## Glossary\n\nUse these terms exactly: don't substitute \"component,\" \"service,\" \"API,\" or \"boundary.\" Consistent language is the whole point.\n\n**Module**: anything with an interface and an implementation. Deliberately scale-agnostic: a function, class, package, or tier-spanning slice. _Avoid_: unit, component, service.\n\n**Interface**: everything a caller must know to use the module correctly: the type signature, but also invariants, ordering constraints, error modes, required configuration, and performance characteristics. _Avoid_: API, signature (too narrow, they refer only to the type-level surface).\n\n**Implementation**: what's inside a module, its body of code. Distinct from **Adapter**: a thing can be a small adapter with a large implementation (a Postgres repo) or a large adapter with a small implementation (an in-memory fake). Reach for \"adapter\" when the seam is the topic; \"implementation\" otherwise.\n\n**Depth**: leverage at the interface. The amount of behaviour a caller (or test) can exercise per unit of interface they have to learn. A module is **deep** when a large amount of behaviour sits behind a small interface, **shallow** when the interface is nearly as complex as the implementation.\n\n**Seam** _(Michael Feathers)_: a place where you can alter behaviour without editing in that place; the *location* at which a module's interface lives. Where to put the seam is its own design decision, distinct from what goes behind it. _Avoid_: boundary (overloaded with DDD's bounded context).\n\n**Adapter**: a concrete thing that satisfies an interface at a seam. Describes *role* (what slot it fills), not substance (what's inside).\n\n**Leverage**: what callers get from depth. More capability per unit of interface they learn. One implementation pays back across N call sites and M tests.\n\n**Locality**: what maintainers get from depth. Change, bugs, knowledge, and verification concentrate in one place rather than spreading across callers. Fix once, fixed everywhere.\n\n## Deep vs shallow\n\n**Deep module** = small interface + lots of implementation:\n\n```\n
|
|
65
|
+
"SKILL.md": "---\nname: codebase-design\ndescription: Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.\n---\n\n# Codebase Design\n\nDesign **deep modules**: a lot of behaviour behind a small interface, placed at a clean seam, testable through that interface. Use this language and these principles wherever code is being designed or restructured. The aim is leverage for callers, locality for maintainers, and testability for everyone.\n\n## Glossary\n\nUse these terms exactly: don't substitute \"component,\" \"service,\" \"API,\" or \"boundary.\" Consistent language is the whole point.\n\n**Module**: anything with an interface and an implementation. Deliberately scale-agnostic: a function, class, package, or tier-spanning slice. _Avoid_: unit, component, service.\n\n**Interface**: everything a caller must know to use the module correctly: the type signature, but also invariants, ordering constraints, error modes, required configuration, and performance characteristics. _Avoid_: API, signature (too narrow, they refer only to the type-level surface).\n\n**Implementation**: what's inside a module, its body of code. Distinct from **Adapter**: a thing can be a small adapter with a large implementation (a Postgres repo) or a large adapter with a small implementation (an in-memory fake). Reach for \"adapter\" when the seam is the topic; \"implementation\" otherwise.\n\n**Depth**: leverage at the interface. The amount of behaviour a caller (or test) can exercise per unit of interface they have to learn. A module is **deep** when a large amount of behaviour sits behind a small interface, **shallow** when the interface is nearly as complex as the implementation.\n\n**Seam** _(Michael Feathers)_: a place where you can alter behaviour without editing in that place; the *location* at which a module's interface lives. Where to put the seam is its own design decision, distinct from what goes behind it. _Avoid_: boundary (overloaded with DDD's bounded context).\n\n**Adapter**: a concrete thing that satisfies an interface at a seam. Describes *role* (what slot it fills), not substance (what's inside).\n\n**Leverage**: what callers get from depth. More capability per unit of interface they learn. One implementation pays back across N call sites and M tests.\n\n**Locality**: what maintainers get from depth. Change, bugs, knowledge, and verification concentrate in one place rather than spreading across callers. Fix once, fixed everywhere.\n\n## Deep vs shallow\n\n**Deep module** = small interface + lots of implementation:\n\n```\n┌─────────────────────┐\n│ Small Interface │ <- Few methods, simple params\n├─────────────────────┤\n│ │\n│ Deep Implementation│ <- Complex logic hidden\n│ │\n└─────────────────────┘\n```\n\n**Shallow module** = large interface + little implementation (avoid):\n\n```\n┌─────────────────────────────────┐\n│ Large Interface │ <- Many methods, complex params\n├─────────────────────────────────┤\n│ Thin Implementation │ <- Just passes through\n└─────────────────────────────────┘\n```\n\nWhen designing an interface, ask:\n\n- Can I reduce the number of methods?\n- Can I simplify the parameters?\n- Can I hide more complexity inside?\n\n## Principles\n\n- **Depth is a property of the interface, not the implementation.** A deep module can be internally composed of small, mockable, swappable parts; they just aren't part of the interface. A module can have **internal seams** (private to its implementation, used by its own tests) as well as the **external seam** at its interface.\n- **The deletion test.** Imagine deleting the module. If complexity vanishes, it was a pass-through. If complexity reappears across N callers, it was earning its keep.\n- **The interface is the test surface.** Callers and tests cross the same seam. If you want to test *past* the interface, the module is probably the wrong shape.\n- **One adapter means a hypothetical seam. Two adapters means a real one.** Don't introduce a seam unless something actually varies across it.\n\n## Designing for testability\n\nGood interfaces make testing natural:\n\n1. **Accept dependencies, don't create them.**\n\n ```typescript\n // Testable\n function processOrder(order, paymentGateway) {}\n\n // Hard to test\n function processOrder(order) {\n const gateway = new StripeGateway();\n }\n ```\n\n2. **Return results, don't produce side effects.**\n\n ```typescript\n // Testable\n function calculateDiscount(cart): Discount {}\n\n // Hard to test\n function applyDiscount(cart): void {\n cart.total -= discount;\n }\n ```\n\n3. **Small surface area.** Fewer methods = fewer tests needed. Fewer params = simpler test setup.\n\n## Relationships\n\n- A **Module** has exactly one **Interface** (the surface it presents to callers and tests).\n- **Depth** is a property of a **Module**, measured against its **Interface**.\n- A **Seam** is where a **Module**'s **Interface** lives.\n- An **Adapter** sits at a **Seam** and satisfies the **Interface**.\n- **Depth** produces **Leverage** for callers and **Locality** for maintainers.\n\n## Rejected framings\n\n- **Depth as ratio of implementation-lines to interface-lines** (Ousterhout): rewards padding the implementation. We use depth-as-leverage instead.\n- **\"Interface\" as the TypeScript `interface` keyword or a class's public methods**: too narrow: interface here includes every fact a caller must know.\n- **\"Boundary\"**: overloaded with DDD's bounded context. Say **seam** or **interface**.\n\n## Going deeper\n\n- **Deepening a cluster given its dependencies**, see [DEEPENING.md](DEEPENING.md): dependency categories, seam discipline, and replace-don't-layer testing.\n- **Exploring alternative interfaces**, see [DESIGN-IT-TWICE.md](DESIGN-IT-TWICE.md): spin up parallel sub-agents to design the interface several radically different ways, then compare on depth, locality, and seam placement.\n\n\nSource: mattpocock/skills (MIT); see THIRD_PARTY_NOTICES.\n",
|
|
60
66
|
"DESIGN-IT-TWICE.md": "# Design It Twice\n\nWhen the user wants to explore alternative interfaces for a chosen deepening candidate, use this parallel sub-agent pattern. Based on \"Design It Twice\" (Ousterhout): your first idea is unlikely to be the best.\n\nUses the vocabulary in [SKILL.md](SKILL.md): **module**, **interface**, **seam**, **adapter**, **leverage**.\n\n## Process\n\n### 1. Frame the problem space\n\nBefore spawning sub-agents, write a user-facing explanation of the problem space for the chosen candidate:\n\n- The constraints any new interface would need to satisfy\n- The dependencies it would rely on, and which category they fall into (see [DEEPENING.md](DEEPENING.md))\n- A rough illustrative code sketch to ground the constraints, not a proposal, just a way to make the constraints concrete\n\nShow this to the user, then immediately proceed to Step 2. The user reads and thinks while the sub-agents work in parallel.\n\n### 2. Spawn sub-agents\n\nSpawn 3+ sub-agents in parallel, each with a fresh context window. Each must produce a **radically different** interface for the deepened module.\n\nPrompt each sub-agent with a separate technical brief (file paths, coupling details, dependency category from [DEEPENING.md](DEEPENING.md), what sits behind the seam). The brief is independent of the user-facing problem-space explanation in Step 1. Give each agent a different design constraint:\n\n- Agent 1: \"Minimize the interface: aim for 1-3 entry points max. Maximise leverage per entry point.\"\n- Agent 2: \"Maximise flexibility: support many use cases and extension.\"\n- Agent 3: \"Optimise for the most common caller: make the default case trivial.\"\n- Agent 4 (if applicable): \"Design around ports & adapters for cross-seam dependencies.\"\n\nInclude both [SKILL.md](SKILL.md) vocabulary and GLOSSARY.md vocabulary in the brief so each sub-agent names things consistently with the architecture language and the project's domain language.\n\nEach sub-agent outputs:\n\n1. Interface (types, methods, params, plus invariants, ordering, error modes)\n2. Usage example showing how callers use it\n3. What the implementation hides behind the seam\n4. Dependency strategy and adapters (see [DEEPENING.md](DEEPENING.md))\n5. Trade-offs: where leverage is high, where it's thin\n\n### 3. Present and compare\n\nPresent designs sequentially so the user can absorb each one, then compare them in prose. Contrast by **depth** (leverage at the interface), **locality** (where change concentrates), and **seam placement**.\n\nAfter comparing, give your own recommendation: which design you think is strongest and why. If elements from different designs would combine well, propose a hybrid. Be opinionated: the user wants a strong read, not a menu.\n",
|
|
61
67
|
"DEEPENING.md": "# Deepening\n\nHow to deepen a cluster of shallow modules safely, given its dependencies. Assumes the vocabulary in [SKILL.md](SKILL.md): **module**, **interface**, **seam**, **adapter**.\n\n## Dependency categories\n\nWhen assessing a candidate for deepening, classify its dependencies. The category determines how the deepened module is tested across its seam.\n\n### 1. In-process\n\nPure computation, in-memory state, no I/O. Always deepenable: merge the modules and test through the new interface directly. No adapter needed.\n\n### 2. Local-substitutable\n\nDependencies that have local test stand-ins (PGLite for Postgres, in-memory filesystem). Deepenable if the stand-in exists. The deepened module is tested with the stand-in running in the test suite. The seam is internal; no port at the module's external interface.\n\n### 3. Remote but owned (Ports & Adapters)\n\nYour own services across a network boundary (microservices, internal APIs). Define a **port** (interface) at the seam. The deep module owns the logic; the transport is injected as an **adapter**. Tests use an in-memory adapter. Production uses an HTTP/gRPC/queue adapter.\n\nRecommendation shape: *\"Define a port at the seam, implement an HTTP adapter for production and an in-memory adapter for testing, so the logic sits in one deep module even though it's deployed across a network.\"*\n\n### 4. True external (Mock)\n\nThird-party services (Stripe, Twilio, etc.) you don't control. The deepened module takes the external dependency as an injected port; tests provide a mock adapter.\n\n## Seam discipline\n\n- **One adapter means a hypothetical seam. Two adapters means a real one.** Don't introduce a port unless at least two adapters are justified (typically production + test). A single-adapter seam is just indirection.\n- **Internal seams vs external seams.** A deep module can have internal seams (private to its implementation, used by its own tests) as well as the external seam at its interface. Don't expose internal seams through the interface just because tests use them.\n\n## Testing strategy: replace, don't layer\n\n- Old unit tests on shallow modules become waste once tests at the deepened module's interface exist; delete them.\n- Write new tests at the deepened module's interface. The **interface is the test surface**.\n- Tests assert on observable outcomes through the interface, not internal state.\n- Tests should survive internal refactors, since they describe behaviour, not implementation. If a test has to change when the implementation changes, it's testing past the interface.\n"
|
|
62
68
|
}
|
|
@@ -8,7 +8,7 @@ export interface TurnChangeSummary {
|
|
|
8
8
|
}
|
|
9
9
|
export declare function parseTurnNumstat(output: string): TurnChangeSummary | null;
|
|
10
10
|
export declare function summarizeTurnChanges(cwd: string, from: string, to: string): Promise<TurnChangeSummary | null>;
|
|
11
|
-
export declare function timelyCheckpoint<T>(capture: Promise<T | null>, timeoutMs?: number): Promise<T | null>;
|
|
11
|
+
export declare function timelyCheckpoint<T>(capture: Promise<T | null>, timeoutMs?: number, onTimeout?: () => void): Promise<T | null>;
|
|
12
12
|
export declare function shouldCaptureTurn(opts: {
|
|
13
13
|
chatMode: boolean;
|
|
14
14
|
planMode: boolean;
|
|
@@ -62,14 +62,15 @@ export async function summarizeTurnChanges(cwd, from, to) {
|
|
|
62
62
|
return null;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
// A timed-out pre-turn capture
|
|
66
|
-
//
|
|
67
|
-
|
|
65
|
+
// A timed-out pre-turn capture is never used: the worker can already be
|
|
66
|
+
// editing by then and the ref is not a safe baseline. `onTimeout` lets the
|
|
67
|
+
// caller cancel it so it stops and publishes nothing.
|
|
68
|
+
export async function timelyCheckpoint(capture, timeoutMs = 2000, onTimeout) {
|
|
68
69
|
let timer;
|
|
69
70
|
try {
|
|
70
71
|
return await Promise.race([
|
|
71
72
|
capture.catch(() => null),
|
|
72
|
-
new Promise(resolve => { timer = setTimeout(() => resolve(null), timeoutMs); }),
|
|
73
|
+
new Promise(resolve => { timer = setTimeout(() => { onTimeout?.(); resolve(null); }, timeoutMs); }),
|
|
73
74
|
]);
|
|
74
75
|
}
|
|
75
76
|
finally {
|
package/server/dist/usage.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ClaudeCredentialBinding, UsageInfo } from '@arco/shared';
|
|
2
2
|
export declare function getCliUsageBinding(): Promise<ClaudeCredentialBinding>;
|
|
3
|
-
export declare function getUsage(force?: boolean): Promise<UsageInfo>;
|
|
3
|
+
export declare function getUsage(force?: boolean, requestedAccount?: string): Promise<UsageInfo>;
|