@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,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OutboundSink that broadcasts ServerEvents to WebSocket clients.
|
|
3
|
+
* The broadcast function is injected by wsHandler to fan out to all
|
|
4
|
+
* connected clients for a given conversation.
|
|
5
|
+
*/
|
|
6
|
+
export class WsSink {
|
|
7
|
+
broadcast;
|
|
8
|
+
constructor(broadcast) {
|
|
9
|
+
this.broadcast = broadcast;
|
|
10
|
+
}
|
|
11
|
+
async sendAgentText(text) {
|
|
12
|
+
this.broadcast({ type: 'content.delta', text });
|
|
13
|
+
}
|
|
14
|
+
async sendActivityText(text) {
|
|
15
|
+
this.broadcast({ type: 'activity.delta', text });
|
|
16
|
+
}
|
|
17
|
+
async sendText(text) {
|
|
18
|
+
this.broadcast({ type: 'content.delta', text });
|
|
19
|
+
}
|
|
20
|
+
async sendThinkingText(text) {
|
|
21
|
+
this.broadcast({ type: 'thinking.delta', text });
|
|
22
|
+
}
|
|
23
|
+
async requestPermission(req) {
|
|
24
|
+
this.broadcast({
|
|
25
|
+
type: 'approval.request',
|
|
26
|
+
requestId: req.requestId,
|
|
27
|
+
toolName: req.toolName ?? req.toolTitle,
|
|
28
|
+
toolArgs: req.toolArgs ?? null,
|
|
29
|
+
toolKind: req.toolKind,
|
|
30
|
+
...(req.approvalKind ? { approvalKind: req.approvalKind } : {}),
|
|
31
|
+
...(req.title ? { title: req.title } : {}),
|
|
32
|
+
...(req.description ? { description: req.description } : {}),
|
|
33
|
+
...(req.input !== undefined ? { input: req.input } : {}),
|
|
34
|
+
...(req.actions?.length ? { actions: req.actions } : {}),
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
async sendUi(event) {
|
|
38
|
+
if (event.kind === 'tool') {
|
|
39
|
+
const toolEvent = event;
|
|
40
|
+
if (event.stage === 'complete') {
|
|
41
|
+
const normalizedStatus = event.status === 'cancelled'
|
|
42
|
+
? 'cancelled'
|
|
43
|
+
: event.status === 'error' || event.status === 'failed' || event.status === 'declined'
|
|
44
|
+
? 'failed'
|
|
45
|
+
: 'completed';
|
|
46
|
+
const isError = normalizedStatus === 'failed';
|
|
47
|
+
// 工具执行完成 → 发送 tool.result
|
|
48
|
+
this.broadcast({
|
|
49
|
+
type: 'tool.result',
|
|
50
|
+
toolCallId: event.toolCallId ?? '',
|
|
51
|
+
output: toolEvent.output ?? event.detail ?? event.status ?? 'done',
|
|
52
|
+
detail: event.detail,
|
|
53
|
+
error: isError,
|
|
54
|
+
status: normalizedStatus,
|
|
55
|
+
metadata: event.metadata,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
const normalizedStatus = event.status === 'cancelled'
|
|
60
|
+
? 'cancelled'
|
|
61
|
+
: event.status === 'error' || event.status === 'failed' || event.status === 'declined'
|
|
62
|
+
? 'failed'
|
|
63
|
+
: event.status === 'completed'
|
|
64
|
+
? 'completed'
|
|
65
|
+
: 'running';
|
|
66
|
+
// 工具开始或更新 → 发送 tool.call
|
|
67
|
+
this.broadcast({
|
|
68
|
+
type: 'tool.call',
|
|
69
|
+
toolCallId: event.toolCallId ?? '',
|
|
70
|
+
name: event.title,
|
|
71
|
+
input: toolEvent.input ?? event.detail ?? null,
|
|
72
|
+
detail: event.detail,
|
|
73
|
+
status: normalizedStatus,
|
|
74
|
+
metadata: event.metadata,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (event.kind === 'usage') {
|
|
79
|
+
this.broadcast({
|
|
80
|
+
type: 'run.usage',
|
|
81
|
+
inputTokens: event.inputTokens,
|
|
82
|
+
cachedInputTokens: event.cachedInputTokens,
|
|
83
|
+
outputTokens: event.outputTokens,
|
|
84
|
+
reasoningOutputTokens: event.reasoningOutputTokens,
|
|
85
|
+
totalTokens: event.totalTokens,
|
|
86
|
+
currentInputTokens: event.currentInputTokens,
|
|
87
|
+
currentCachedInputTokens: event.currentCachedInputTokens,
|
|
88
|
+
modelContextWindow: event.modelContextWindow,
|
|
89
|
+
createdAt: Date.now(),
|
|
90
|
+
metadata: event.metadata,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
// plan/task events → content delta for now
|
|
94
|
+
if (event.kind === 'plan' || event.kind === 'task') {
|
|
95
|
+
const createdAt = Date.now();
|
|
96
|
+
this.broadcast({
|
|
97
|
+
type: event.kind === 'plan' ? 'plan.update' : 'task.update',
|
|
98
|
+
title: event.title,
|
|
99
|
+
detail: event.detail,
|
|
100
|
+
createdAt,
|
|
101
|
+
});
|
|
102
|
+
if (event.silent)
|
|
103
|
+
return;
|
|
104
|
+
const text = event.detail
|
|
105
|
+
? `\n[${event.kind}] ${event.title}\n${event.detail}\n`
|
|
106
|
+
: `\n[${event.kind}] ${event.title}\n`;
|
|
107
|
+
this.broadcast({ type: 'content.delta', text });
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
async breakTextStream() {
|
|
111
|
+
// no-op for WebSocket
|
|
112
|
+
}
|
|
113
|
+
async flush() {
|
|
114
|
+
// no-op for WebSocket
|
|
115
|
+
}
|
|
116
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bbigbang/core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Central collaboration server — HTTP + WebSocket gateway",
|
|
6
|
+
"main": "dist/main.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"bigbang-core": "dist/main.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"!dist/**/__tests__/**",
|
|
13
|
+
"!dist/**/*.test.*",
|
|
14
|
+
"!dist/**/*.map",
|
|
15
|
+
"package.json"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"dev": "tsx src/main.ts",
|
|
19
|
+
"build": "tsc -p tsconfig.json",
|
|
20
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
21
|
+
"lint": "echo 'No lint configured'",
|
|
22
|
+
"start": "node dist/main.js",
|
|
23
|
+
"test": "vitest run",
|
|
24
|
+
"test:scenarios": "vitest run src/__tests__/collaborationScenarios.test.ts",
|
|
25
|
+
"test:watch": "vitest"
|
|
26
|
+
},
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=18"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@bbigbang/memory": "workspace:*",
|
|
32
|
+
"@bbigbang/protocol": "workspace:*",
|
|
33
|
+
"@bbigbang/runtime-acp": "workspace:*",
|
|
34
|
+
"@fastify/cors": "^10.0.2",
|
|
35
|
+
"@fastify/multipart": "^9.4.0",
|
|
36
|
+
"@fastify/static": "^8.1.0",
|
|
37
|
+
"@fastify/websocket": "^11.2.0",
|
|
38
|
+
"bcryptjs": "^3.0.3",
|
|
39
|
+
"better-sqlite3": "^12.6.2",
|
|
40
|
+
"dotenv": "^16.6.1",
|
|
41
|
+
"fastify": "^5.3.3",
|
|
42
|
+
"zod": "^4.3.6"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@types/bcryptjs": "^3.0.0",
|
|
46
|
+
"@types/better-sqlite3": "^7.6.13",
|
|
47
|
+
"@types/node": "^25.3.3",
|
|
48
|
+
"@types/ws": "^8.18.1",
|
|
49
|
+
"tsx": "^4.21.0",
|
|
50
|
+
"typescript": "^5.9.3",
|
|
51
|
+
"vitest": "^3.2.1",
|
|
52
|
+
"ws": "^8.18.1"
|
|
53
|
+
}
|
|
54
|
+
}
|