@bbigbang/core 0.1.0
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/dist/config.js +380 -0
- package/dist/execution/executionDispatcher.js +3810 -0
- package/dist/main.js +90 -0
- package/dist/nodeEventHistory.js +206 -0
- package/dist/scheduler/dreamLogic.js +50 -0
- package/dist/scheduler/dreamScheduler.js +65 -0
- package/dist/services/agentFileAccessService.js +1913 -0
- package/dist/services/agentRuntimeCleanupBroker.js +62 -0
- package/dist/services/agentSkillsBroker.js +118 -0
- package/dist/services/agentSkillsService.js +83 -0
- package/dist/services/agentWorkspaceBroker.js +937 -0
- package/dist/services/agentWorkspaceService.js +70 -0
- package/dist/services/appVersion.js +14 -0
- package/dist/services/auth.js +586 -0
- package/dist/services/claudeControlBroker.js +154 -0
- package/dist/services/claudeTranscriptBroker.js +100 -0
- package/dist/services/claudeTranscriptService.js +359 -0
- package/dist/services/codexAppServerBroker.js +155 -0
- package/dist/services/codexTranscriptBroker.js +98 -0
- package/dist/services/codexTranscriptService.js +961 -0
- package/dist/services/droidMissionBroker.js +124 -0
- package/dist/services/droidMissionImporter.js +630 -0
- package/dist/services/droidModelOptions.js +165 -0
- package/dist/services/hubServerRegistrationService.js +268 -0
- package/dist/services/libraryManifest.js +43 -0
- package/dist/services/libraryScaffold.js +26 -0
- package/dist/services/libraryService.js +2263 -0
- package/dist/services/memoryService.js +386 -0
- package/dist/services/missionEvidence.js +377 -0
- package/dist/services/missionService.js +2361 -0
- package/dist/services/missionTrace.js +158 -0
- package/dist/services/nativeMissionBriefParser.js +120 -0
- package/dist/services/nativeMissionOrchestrator.js +2045 -0
- package/dist/services/nativeMissionReportGenerator.js +227 -0
- package/dist/services/nativeMissionValidationRunner.js +452 -0
- package/dist/services/nativeMissionWorkerBroker.js +190 -0
- package/dist/services/nodeRegistry.js +34 -0
- package/dist/services/nodeStateReconciler.js +97 -0
- package/dist/services/panelMediaScanner.js +119 -0
- package/dist/services/persistentRuntimeJsonlClient.js +153 -0
- package/dist/services/platformAgentPolicy.js +180 -0
- package/dist/services/platformAgentService.js +2041 -0
- package/dist/services/projectAccessResolver.js +93 -0
- package/dist/services/projectService.js +392 -0
- package/dist/services/resourceSpaceService.js +140 -0
- package/dist/services/scenarioRuntimeService.js +1130 -0
- package/dist/services/suggestedPlannerService.js +868 -0
- package/dist/services/workbenchGitBroker.js +161 -0
- package/dist/services/workbenchGitService.js +69 -0
- package/dist/services/workbenchInspectBroker.js +65 -0
- package/dist/services/workbenchNodePathService.js +79 -0
- package/dist/services/workbenchRegistryService.js +240 -0
- package/dist/services/workbenchRootService.js +181 -0
- package/dist/services/workbenchTerminalBroker.js +378 -0
- package/dist/services/workspaceRunOwnership.js +60 -0
- package/dist/services/workspaceScaffold.js +105 -0
- package/dist/services/workspaceSessionRuntimeService.js +576 -0
- package/dist/services/workspaceSessionService.js +245 -0
- package/dist/services/workspaceToolActionRunner.js +1582 -0
- package/dist/services/workspaceToolErrors.js +10 -0
- package/dist/services/workspaceToolExecutionUtils.js +895 -0
- package/dist/services/workspaceToolLatestStateProjector.js +91 -0
- package/dist/services/workspaceToolManifest.js +572 -0
- package/dist/services/workspaceToolMutationQueue.js +43 -0
- package/dist/services/workspaceToolPanelProjection.js +460 -0
- package/dist/services/workspaceToolPromotion.js +255 -0
- package/dist/services/workspaceToolPromotionState.js +224 -0
- package/dist/services/workspaceToolPublishDiagnostics.js +189 -0
- package/dist/services/workspaceToolPublishIdentityResolver.js +146 -0
- package/dist/services/workspaceToolReadModel.js +378 -0
- package/dist/services/workspaceToolRunLedger.js +239 -0
- package/dist/services/workspaceToolService.js +3067 -0
- package/dist/services/workspaceToolSnapshotPanelSync.js +293 -0
- package/dist/services/workspaceToolTerminalLifecycle.js +283 -0
- package/dist/services/workspaceToolTypes.js +1 -0
- package/dist/services/workspaceToolUploadMaterializer.js +228 -0
- package/dist/web/actionCardRoutes.js +129 -0
- package/dist/web/actionCards.js +469 -0
- package/dist/web/activationContext.js +684 -0
- package/dist/web/agentChannelGuards.js +48 -0
- package/dist/web/agentMentionCooldowns.js +32 -0
- package/dist/web/agentReminders.js +1668 -0
- package/dist/web/agentRuntimePresence.js +197 -0
- package/dist/web/agentSelfState.js +494 -0
- package/dist/web/agentTaskLinks.js +26 -0
- package/dist/web/agentVisibility.js +79 -0
- package/dist/web/assets.js +95 -0
- package/dist/web/channelActivationPrompt.js +395 -0
- package/dist/web/channelMemoryNotes.js +127 -0
- package/dist/web/channelMentions.js +10 -0
- package/dist/web/channelMessageSequences.js +19 -0
- package/dist/web/channelSubscriptions.js +26 -0
- package/dist/web/clearedTaskRoots.js +10 -0
- package/dist/web/collaborationPromptGuidance.js +36 -0
- package/dist/web/collaborationSurfaceState.js +140 -0
- package/dist/web/contextBundleRanking.js +154 -0
- package/dist/web/contextBundleResolver.js +488 -0
- package/dist/web/conversationBuiltinSkillRoots.js +50 -0
- package/dist/web/conversationControls.js +232 -0
- package/dist/web/conversationHandoffs.js +612 -0
- package/dist/web/conversationManager.js +2511 -0
- package/dist/web/conversationSummaries.js +876 -0
- package/dist/web/conversationSurfaceKinds.js +17 -0
- package/dist/web/conversationTargets.js +173 -0
- package/dist/web/directActivationPrompt.js +122 -0
- package/dist/web/directReplyTargets.js +69 -0
- package/dist/web/directThreadResolver.js +129 -0
- package/dist/web/dmTaskHandoffPrompt.js +120 -0
- package/dist/web/dmTaskThreadStatusProjection.js +229 -0
- package/dist/web/ftsQuery.js +33 -0
- package/dist/web/internalAgentRouter.js +11341 -0
- package/dist/web/libraryCuratorScheduler.js +58 -0
- package/dist/web/libraryDocumentPromptGuidance.js +8 -0
- package/dist/web/messageCheckpoints.js +19 -0
- package/dist/web/nodeWsHandler.js +2495 -0
- package/dist/web/notificationRounds.js +1061 -0
- package/dist/web/panelActionMessages.js +108 -0
- package/dist/web/panelActivationPrompt.js +18 -0
- package/dist/web/panelAudit.js +273 -0
- package/dist/web/panelLifecycle.js +222 -0
- package/dist/web/panelMediaPolicy.js +43 -0
- package/dist/web/panelPathPolicy.js +63 -0
- package/dist/web/panelPreviews.js +175 -0
- package/dist/web/panelQueryHandles.js +2749 -0
- package/dist/web/panelRoutes.js +2147 -0
- package/dist/web/panels.js +904 -0
- package/dist/web/peerInboxAggregates.js +1247 -0
- package/dist/web/planApprovalState.js +92 -0
- package/dist/web/platformAgentScheduler.js +66 -0
- package/dist/web/proactiveOpportunities.js +452 -0
- package/dist/web/promptContextSections.js +242 -0
- package/dist/web/promptHistorySanitizer.js +26 -0
- package/dist/web/promptSlashCommands.js +158 -0
- package/dist/web/rollingConversationSummary.js +453 -0
- package/dist/web/routeHelpers.js +11 -0
- package/dist/web/routes/handoff.js +288 -0
- package/dist/web/routes/history.js +345 -0
- package/dist/web/routes/memory.js +258 -0
- package/dist/web/routes/selfState.js +171 -0
- package/dist/web/routes/workspace.js +154 -0
- package/dist/web/runSurfaceWatermarks.js +431 -0
- package/dist/web/runtimeCapabilities.js +48 -0
- package/dist/web/sameAgentHandoffs.js +494 -0
- package/dist/web/server.js +15567 -0
- package/dist/web/sharedCollaborationCapsules.js +163 -0
- package/dist/web/soloSessionRelay.js +42 -0
- package/dist/web/soloWsHandler.js +138 -0
- package/dist/web/suggestedPlannerScheduler.js +56 -0
- package/dist/web/surfaceActivationPolicy.js +108 -0
- package/dist/web/surfaceCollaborators.js +61 -0
- package/dist/web/surfaceSystemStatus.js +263 -0
- package/dist/web/targetParticipants.js +77 -0
- package/dist/web/taskEvents.js +49 -0
- package/dist/web/taskLifecycleMessages.js +165 -0
- package/dist/web/taskLoops.js +732 -0
- package/dist/web/taskMemoryNotes.js +224 -0
- package/dist/web/taskNumbers.js +16 -0
- package/dist/web/taskOwnerGuards.js +49 -0
- package/dist/web/taskParticipantResolver.js +42 -0
- package/dist/web/taskParticipants.js +97 -0
- package/dist/web/taskSourceDetails.js +20 -0
- package/dist/web/taskStateViews.js +210 -0
- package/dist/web/taskStatusTransitions.js +9 -0
- package/dist/web/taskThreadFollowups.js +599 -0
- package/dist/web/taskThreadRuntimeClosure.js +685 -0
- package/dist/web/taskUpdateDelivery.js +104 -0
- package/dist/web/threadReplyContentHeuristics.js +30 -0
- package/dist/web/threadRoots.js +61 -0
- package/dist/web/threadTaskBindings.js +365 -0
- package/dist/web/uiPanelPromptGuidance.js +27 -0
- package/dist/web/workspaceMemoryHints.js +143 -0
- package/dist/web/workspaceToolPromptGuidance.js +30 -0
- package/dist/web/wsHandler.js +397 -0
- package/dist/web/wsSink.js +116 -0
- package/package.json +54 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { log } from '@bbigbang/runtime-acp';
|
|
2
|
+
import { blockActiveTaskThreadRunsAfterReopen, closeTaskThreadRuntimeState, sealTaskThreadRuntimeState, } from './taskThreadRuntimeClosure.js';
|
|
3
|
+
const AUDIT_REDACTED_FIELD_PATTERN = /prompt|content|context|text/i;
|
|
4
|
+
const AUDIT_STRING_LIMIT = 500;
|
|
5
|
+
function sanitizeAuditMetadata(metadata) {
|
|
6
|
+
if (!metadata)
|
|
7
|
+
return {};
|
|
8
|
+
const sanitized = {};
|
|
9
|
+
for (const [key, value] of Object.entries(metadata)) {
|
|
10
|
+
if (AUDIT_REDACTED_FIELD_PATTERN.test(key) && typeof value === 'string') {
|
|
11
|
+
sanitized[key] = '[redacted]';
|
|
12
|
+
}
|
|
13
|
+
else if (AUDIT_REDACTED_FIELD_PATTERN.test(key) && value != null && typeof value === 'object') {
|
|
14
|
+
sanitized[key] = '[redacted]';
|
|
15
|
+
}
|
|
16
|
+
else if (typeof value === 'string' && value.length > AUDIT_STRING_LIMIT) {
|
|
17
|
+
sanitized[key] = `${value.slice(0, AUDIT_STRING_LIMIT)}...[truncated]`;
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
sanitized[key] = value;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return sanitized;
|
|
24
|
+
}
|
|
25
|
+
function formatAuditError(error) {
|
|
26
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
27
|
+
return message.trim() || 'unknown error';
|
|
28
|
+
}
|
|
29
|
+
export function createConversationControl(params) {
|
|
30
|
+
const audit = (command, result) => {
|
|
31
|
+
const suppressReplyContract = command.intent === 'memory_notice'
|
|
32
|
+
|| (command.intent === 'deliver_prompt'
|
|
33
|
+
|| command.intent === 'steer_preferred'
|
|
34
|
+
|| command.intent === 'queue_prompt'
|
|
35
|
+
|| command.intent === 'handoff_dispatch'
|
|
36
|
+
? command.suppressReplyContract === true
|
|
37
|
+
: undefined);
|
|
38
|
+
log.info('[conversation-control] command', {
|
|
39
|
+
intent: command.intent,
|
|
40
|
+
conversationId: 'conversationId' in command ? command.conversationId : undefined,
|
|
41
|
+
taskId: 'taskId' in command ? command.taskId : undefined,
|
|
42
|
+
reason: 'reason' in command ? command.reason : undefined,
|
|
43
|
+
visibility: command.visibility,
|
|
44
|
+
delivery: command.delivery,
|
|
45
|
+
activeRunPolicy: command.activeRunPolicy,
|
|
46
|
+
activationContextMode: 'activationContextMode' in command ? command.activationContextMode : undefined,
|
|
47
|
+
allowActiveSteer: 'allowActiveSteer' in command ? command.allowActiveSteer : undefined,
|
|
48
|
+
allowQueue: 'allowQueue' in command ? command.allowQueue : undefined,
|
|
49
|
+
suppressReplyContract,
|
|
50
|
+
...sanitizeAuditMetadata(command.audit),
|
|
51
|
+
...sanitizeAuditMetadata(result),
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
const runPromptControl = (command) => {
|
|
55
|
+
return params.conversationManager.submitPrompt(command.conversationId, command.promptText, {
|
|
56
|
+
recordAsUserMessage: command.recordAsUserMessage,
|
|
57
|
+
activationContextMode: command.activationContextMode,
|
|
58
|
+
allowActiveSteer: command.allowActiveSteer,
|
|
59
|
+
allowQueue: command.allowQueue,
|
|
60
|
+
suppressReplyContract: command.suppressReplyContract,
|
|
61
|
+
}).then((result) => {
|
|
62
|
+
audit(command, {
|
|
63
|
+
ok: true,
|
|
64
|
+
queued: result.queued,
|
|
65
|
+
steered: result.steered,
|
|
66
|
+
runId: result.runId,
|
|
67
|
+
});
|
|
68
|
+
return result;
|
|
69
|
+
}).catch((error) => {
|
|
70
|
+
audit(command, {
|
|
71
|
+
ok: false,
|
|
72
|
+
error: formatAuditError(error),
|
|
73
|
+
});
|
|
74
|
+
throw error;
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
const runCancelControl = (command) => {
|
|
78
|
+
try {
|
|
79
|
+
const result = params.conversationManager.cancelConversationRun(command.conversationId, command.expectedRunId);
|
|
80
|
+
audit(command, { ok: result.ok, runId: result.runId, message: result.message });
|
|
81
|
+
return result;
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
audit(command, { ok: false, error: formatAuditError(error) });
|
|
85
|
+
throw error;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
const runSealTaskThreadControl = (command) => {
|
|
89
|
+
try {
|
|
90
|
+
const result = sealTaskThreadRuntimeState({
|
|
91
|
+
db: params.db,
|
|
92
|
+
taskId: command.taskId,
|
|
93
|
+
reason: command.reason,
|
|
94
|
+
dmUserId: command.dmUserId,
|
|
95
|
+
ownerConversationId: command.ownerConversationId,
|
|
96
|
+
ownerRunId: command.ownerRunId,
|
|
97
|
+
ownerAgentId: command.ownerAgentId,
|
|
98
|
+
onConversationStatusChange: params.onConversationStatusChange,
|
|
99
|
+
});
|
|
100
|
+
audit(command, {
|
|
101
|
+
ok: true,
|
|
102
|
+
sealed: result.sealed,
|
|
103
|
+
conversationCount: result.conversationIds.length,
|
|
104
|
+
preservedActiveRunCount: result.preservedActiveRuns.length,
|
|
105
|
+
clearedQueuedPromptCount: result.clearedQueuedPromptCount,
|
|
106
|
+
clearedAggregateCount: result.clearedAggregateCount,
|
|
107
|
+
clearedCooldownCount: result.clearedCooldownCount,
|
|
108
|
+
clearedFollowupCount: result.clearedFollowupCount,
|
|
109
|
+
});
|
|
110
|
+
return result;
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
audit(command, { ok: false, error: formatAuditError(error) });
|
|
114
|
+
throw error;
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
const runHardCloseTaskThreadControl = (command) => {
|
|
118
|
+
try {
|
|
119
|
+
const result = closeTaskThreadRuntimeState({
|
|
120
|
+
db: params.db,
|
|
121
|
+
conversationManager: params.conversationManager,
|
|
122
|
+
taskId: command.taskId,
|
|
123
|
+
reason: command.reason,
|
|
124
|
+
onConversationStatusChange: params.onConversationStatusChange,
|
|
125
|
+
});
|
|
126
|
+
audit(command, {
|
|
127
|
+
ok: true,
|
|
128
|
+
closed: result.closed,
|
|
129
|
+
conversationCount: result.conversationIds.length,
|
|
130
|
+
cancelledRunCount: result.cancelledRunIds.length,
|
|
131
|
+
clearedQueuedPromptCount: result.clearedQueuedPromptCount,
|
|
132
|
+
clearedAggregateCount: result.clearedAggregateCount,
|
|
133
|
+
clearedCooldownCount: result.clearedCooldownCount,
|
|
134
|
+
clearedFollowupCount: result.clearedFollowupCount,
|
|
135
|
+
});
|
|
136
|
+
return result;
|
|
137
|
+
}
|
|
138
|
+
catch (error) {
|
|
139
|
+
audit(command, { ok: false, error: formatAuditError(error) });
|
|
140
|
+
throw error;
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
const runReopenTaskThreadControl = (command) => {
|
|
144
|
+
try {
|
|
145
|
+
const closeResult = closeTaskThreadRuntimeState({
|
|
146
|
+
db: params.db,
|
|
147
|
+
conversationManager: params.conversationManager,
|
|
148
|
+
taskId: command.taskId,
|
|
149
|
+
reason: 'in_review',
|
|
150
|
+
onConversationStatusChange: params.onConversationStatusChange,
|
|
151
|
+
});
|
|
152
|
+
const blockedRuns = blockActiveTaskThreadRunsAfterReopen(params.db, command.taskId);
|
|
153
|
+
audit(command, {
|
|
154
|
+
ok: true,
|
|
155
|
+
closed: closeResult.closed,
|
|
156
|
+
conversationCount: closeResult.conversationIds.length,
|
|
157
|
+
cancelledRunCount: closeResult.cancelledRunIds.length,
|
|
158
|
+
blockedRunCount: blockedRuns.length,
|
|
159
|
+
});
|
|
160
|
+
return { closeResult, blockedRuns };
|
|
161
|
+
}
|
|
162
|
+
catch (error) {
|
|
163
|
+
audit(command, { ok: false, error: formatAuditError(error) });
|
|
164
|
+
throw error;
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
const execute = (command) => {
|
|
168
|
+
switch (command.intent) {
|
|
169
|
+
case 'deliver_prompt':
|
|
170
|
+
case 'memory_notice':
|
|
171
|
+
case 'steer_preferred':
|
|
172
|
+
case 'queue_prompt':
|
|
173
|
+
case 'handoff_dispatch': {
|
|
174
|
+
return runPromptControl(command);
|
|
175
|
+
}
|
|
176
|
+
case 'cancel_run': {
|
|
177
|
+
return runCancelControl(command);
|
|
178
|
+
}
|
|
179
|
+
case 'seal_task_thread': {
|
|
180
|
+
return runSealTaskThreadControl(command);
|
|
181
|
+
}
|
|
182
|
+
case 'hard_close_task_thread': {
|
|
183
|
+
return runHardCloseTaskThreadControl(command);
|
|
184
|
+
}
|
|
185
|
+
case 'reopen_task_thread': {
|
|
186
|
+
return runReopenTaskThreadControl(command);
|
|
187
|
+
}
|
|
188
|
+
default: {
|
|
189
|
+
const exhaustive = command;
|
|
190
|
+
throw new Error(`Unhandled conversation control intent: ${String(exhaustive)}`);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
const submitMemoryNotice = (command) => runPromptControl({
|
|
195
|
+
...command,
|
|
196
|
+
intent: 'memory_notice',
|
|
197
|
+
visibility: 'memory_only',
|
|
198
|
+
delivery: 'steer_preferred',
|
|
199
|
+
recordAsUserMessage: false,
|
|
200
|
+
activationContextMode: 'resume_only',
|
|
201
|
+
allowActiveSteer: command.allowActiveSteer ?? true,
|
|
202
|
+
suppressReplyContract: true,
|
|
203
|
+
});
|
|
204
|
+
const sealTaskThread = (command) => runSealTaskThreadControl({
|
|
205
|
+
...command,
|
|
206
|
+
intent: 'seal_task_thread',
|
|
207
|
+
visibility: 'system_hidden',
|
|
208
|
+
delivery: 'resume_only',
|
|
209
|
+
activeRunPolicy: command.reason === 'in_review' && command.ownerRunId ? 'allow_owner_final' : 'block_outputs',
|
|
210
|
+
});
|
|
211
|
+
const hardCloseTaskThread = (command) => runHardCloseTaskThreadControl({
|
|
212
|
+
...command,
|
|
213
|
+
intent: 'hard_close_task_thread',
|
|
214
|
+
visibility: 'system_hidden',
|
|
215
|
+
delivery: 'drop_if_busy',
|
|
216
|
+
activeRunPolicy: 'cancel',
|
|
217
|
+
});
|
|
218
|
+
const reopenTaskThread = (command) => runReopenTaskThreadControl({
|
|
219
|
+
...command,
|
|
220
|
+
intent: 'reopen_task_thread',
|
|
221
|
+
visibility: 'system_hidden',
|
|
222
|
+
delivery: 'dispatch_now',
|
|
223
|
+
activeRunPolicy: 'block_outputs',
|
|
224
|
+
});
|
|
225
|
+
return {
|
|
226
|
+
execute,
|
|
227
|
+
submitMemoryNotice,
|
|
228
|
+
sealTaskThread,
|
|
229
|
+
hardCloseTaskThread,
|
|
230
|
+
reopenTaskThread,
|
|
231
|
+
};
|
|
232
|
+
}
|