@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.
Files changed (175) hide show
  1. package/dist/config.js +380 -0
  2. package/dist/execution/executionDispatcher.js +3810 -0
  3. package/dist/main.js +90 -0
  4. package/dist/nodeEventHistory.js +206 -0
  5. package/dist/scheduler/dreamLogic.js +50 -0
  6. package/dist/scheduler/dreamScheduler.js +65 -0
  7. package/dist/services/agentFileAccessService.js +1913 -0
  8. package/dist/services/agentRuntimeCleanupBroker.js +62 -0
  9. package/dist/services/agentSkillsBroker.js +118 -0
  10. package/dist/services/agentSkillsService.js +83 -0
  11. package/dist/services/agentWorkspaceBroker.js +937 -0
  12. package/dist/services/agentWorkspaceService.js +70 -0
  13. package/dist/services/appVersion.js +14 -0
  14. package/dist/services/auth.js +586 -0
  15. package/dist/services/claudeControlBroker.js +154 -0
  16. package/dist/services/claudeTranscriptBroker.js +100 -0
  17. package/dist/services/claudeTranscriptService.js +359 -0
  18. package/dist/services/codexAppServerBroker.js +155 -0
  19. package/dist/services/codexTranscriptBroker.js +98 -0
  20. package/dist/services/codexTranscriptService.js +961 -0
  21. package/dist/services/droidMissionBroker.js +124 -0
  22. package/dist/services/droidMissionImporter.js +630 -0
  23. package/dist/services/droidModelOptions.js +165 -0
  24. package/dist/services/hubServerRegistrationService.js +268 -0
  25. package/dist/services/libraryManifest.js +43 -0
  26. package/dist/services/libraryScaffold.js +26 -0
  27. package/dist/services/libraryService.js +2263 -0
  28. package/dist/services/memoryService.js +386 -0
  29. package/dist/services/missionEvidence.js +377 -0
  30. package/dist/services/missionService.js +2361 -0
  31. package/dist/services/missionTrace.js +158 -0
  32. package/dist/services/nativeMissionBriefParser.js +120 -0
  33. package/dist/services/nativeMissionOrchestrator.js +2045 -0
  34. package/dist/services/nativeMissionReportGenerator.js +227 -0
  35. package/dist/services/nativeMissionValidationRunner.js +452 -0
  36. package/dist/services/nativeMissionWorkerBroker.js +190 -0
  37. package/dist/services/nodeRegistry.js +34 -0
  38. package/dist/services/nodeStateReconciler.js +97 -0
  39. package/dist/services/panelMediaScanner.js +119 -0
  40. package/dist/services/persistentRuntimeJsonlClient.js +153 -0
  41. package/dist/services/platformAgentPolicy.js +180 -0
  42. package/dist/services/platformAgentService.js +2041 -0
  43. package/dist/services/projectAccessResolver.js +93 -0
  44. package/dist/services/projectService.js +392 -0
  45. package/dist/services/resourceSpaceService.js +140 -0
  46. package/dist/services/scenarioRuntimeService.js +1130 -0
  47. package/dist/services/suggestedPlannerService.js +868 -0
  48. package/dist/services/workbenchGitBroker.js +161 -0
  49. package/dist/services/workbenchGitService.js +69 -0
  50. package/dist/services/workbenchInspectBroker.js +65 -0
  51. package/dist/services/workbenchNodePathService.js +79 -0
  52. package/dist/services/workbenchRegistryService.js +240 -0
  53. package/dist/services/workbenchRootService.js +181 -0
  54. package/dist/services/workbenchTerminalBroker.js +378 -0
  55. package/dist/services/workspaceRunOwnership.js +60 -0
  56. package/dist/services/workspaceScaffold.js +105 -0
  57. package/dist/services/workspaceSessionRuntimeService.js +576 -0
  58. package/dist/services/workspaceSessionService.js +245 -0
  59. package/dist/services/workspaceToolActionRunner.js +1582 -0
  60. package/dist/services/workspaceToolErrors.js +10 -0
  61. package/dist/services/workspaceToolExecutionUtils.js +895 -0
  62. package/dist/services/workspaceToolLatestStateProjector.js +91 -0
  63. package/dist/services/workspaceToolManifest.js +572 -0
  64. package/dist/services/workspaceToolMutationQueue.js +43 -0
  65. package/dist/services/workspaceToolPanelProjection.js +460 -0
  66. package/dist/services/workspaceToolPromotion.js +255 -0
  67. package/dist/services/workspaceToolPromotionState.js +224 -0
  68. package/dist/services/workspaceToolPublishDiagnostics.js +189 -0
  69. package/dist/services/workspaceToolPublishIdentityResolver.js +146 -0
  70. package/dist/services/workspaceToolReadModel.js +378 -0
  71. package/dist/services/workspaceToolRunLedger.js +239 -0
  72. package/dist/services/workspaceToolService.js +3067 -0
  73. package/dist/services/workspaceToolSnapshotPanelSync.js +293 -0
  74. package/dist/services/workspaceToolTerminalLifecycle.js +283 -0
  75. package/dist/services/workspaceToolTypes.js +1 -0
  76. package/dist/services/workspaceToolUploadMaterializer.js +228 -0
  77. package/dist/web/actionCardRoutes.js +129 -0
  78. package/dist/web/actionCards.js +469 -0
  79. package/dist/web/activationContext.js +684 -0
  80. package/dist/web/agentChannelGuards.js +48 -0
  81. package/dist/web/agentMentionCooldowns.js +32 -0
  82. package/dist/web/agentReminders.js +1668 -0
  83. package/dist/web/agentRuntimePresence.js +197 -0
  84. package/dist/web/agentSelfState.js +494 -0
  85. package/dist/web/agentTaskLinks.js +26 -0
  86. package/dist/web/agentVisibility.js +79 -0
  87. package/dist/web/assets.js +95 -0
  88. package/dist/web/channelActivationPrompt.js +395 -0
  89. package/dist/web/channelMemoryNotes.js +127 -0
  90. package/dist/web/channelMentions.js +10 -0
  91. package/dist/web/channelMessageSequences.js +19 -0
  92. package/dist/web/channelSubscriptions.js +26 -0
  93. package/dist/web/clearedTaskRoots.js +10 -0
  94. package/dist/web/collaborationPromptGuidance.js +36 -0
  95. package/dist/web/collaborationSurfaceState.js +140 -0
  96. package/dist/web/contextBundleRanking.js +154 -0
  97. package/dist/web/contextBundleResolver.js +488 -0
  98. package/dist/web/conversationBuiltinSkillRoots.js +50 -0
  99. package/dist/web/conversationControls.js +232 -0
  100. package/dist/web/conversationHandoffs.js +612 -0
  101. package/dist/web/conversationManager.js +2511 -0
  102. package/dist/web/conversationSummaries.js +876 -0
  103. package/dist/web/conversationSurfaceKinds.js +17 -0
  104. package/dist/web/conversationTargets.js +173 -0
  105. package/dist/web/directActivationPrompt.js +122 -0
  106. package/dist/web/directReplyTargets.js +69 -0
  107. package/dist/web/directThreadResolver.js +129 -0
  108. package/dist/web/dmTaskHandoffPrompt.js +120 -0
  109. package/dist/web/dmTaskThreadStatusProjection.js +229 -0
  110. package/dist/web/ftsQuery.js +33 -0
  111. package/dist/web/internalAgentRouter.js +11341 -0
  112. package/dist/web/libraryCuratorScheduler.js +58 -0
  113. package/dist/web/libraryDocumentPromptGuidance.js +8 -0
  114. package/dist/web/messageCheckpoints.js +19 -0
  115. package/dist/web/nodeWsHandler.js +2495 -0
  116. package/dist/web/notificationRounds.js +1061 -0
  117. package/dist/web/panelActionMessages.js +108 -0
  118. package/dist/web/panelActivationPrompt.js +18 -0
  119. package/dist/web/panelAudit.js +273 -0
  120. package/dist/web/panelLifecycle.js +222 -0
  121. package/dist/web/panelMediaPolicy.js +43 -0
  122. package/dist/web/panelPathPolicy.js +63 -0
  123. package/dist/web/panelPreviews.js +175 -0
  124. package/dist/web/panelQueryHandles.js +2749 -0
  125. package/dist/web/panelRoutes.js +2147 -0
  126. package/dist/web/panels.js +904 -0
  127. package/dist/web/peerInboxAggregates.js +1247 -0
  128. package/dist/web/planApprovalState.js +92 -0
  129. package/dist/web/platformAgentScheduler.js +66 -0
  130. package/dist/web/proactiveOpportunities.js +452 -0
  131. package/dist/web/promptContextSections.js +242 -0
  132. package/dist/web/promptHistorySanitizer.js +26 -0
  133. package/dist/web/promptSlashCommands.js +158 -0
  134. package/dist/web/rollingConversationSummary.js +453 -0
  135. package/dist/web/routeHelpers.js +11 -0
  136. package/dist/web/routes/handoff.js +288 -0
  137. package/dist/web/routes/history.js +345 -0
  138. package/dist/web/routes/memory.js +258 -0
  139. package/dist/web/routes/selfState.js +171 -0
  140. package/dist/web/routes/workspace.js +154 -0
  141. package/dist/web/runSurfaceWatermarks.js +431 -0
  142. package/dist/web/runtimeCapabilities.js +48 -0
  143. package/dist/web/sameAgentHandoffs.js +494 -0
  144. package/dist/web/server.js +15567 -0
  145. package/dist/web/sharedCollaborationCapsules.js +163 -0
  146. package/dist/web/soloSessionRelay.js +42 -0
  147. package/dist/web/soloWsHandler.js +138 -0
  148. package/dist/web/suggestedPlannerScheduler.js +56 -0
  149. package/dist/web/surfaceActivationPolicy.js +108 -0
  150. package/dist/web/surfaceCollaborators.js +61 -0
  151. package/dist/web/surfaceSystemStatus.js +263 -0
  152. package/dist/web/targetParticipants.js +77 -0
  153. package/dist/web/taskEvents.js +49 -0
  154. package/dist/web/taskLifecycleMessages.js +165 -0
  155. package/dist/web/taskLoops.js +732 -0
  156. package/dist/web/taskMemoryNotes.js +224 -0
  157. package/dist/web/taskNumbers.js +16 -0
  158. package/dist/web/taskOwnerGuards.js +49 -0
  159. package/dist/web/taskParticipantResolver.js +42 -0
  160. package/dist/web/taskParticipants.js +97 -0
  161. package/dist/web/taskSourceDetails.js +20 -0
  162. package/dist/web/taskStateViews.js +210 -0
  163. package/dist/web/taskStatusTransitions.js +9 -0
  164. package/dist/web/taskThreadFollowups.js +599 -0
  165. package/dist/web/taskThreadRuntimeClosure.js +685 -0
  166. package/dist/web/taskUpdateDelivery.js +104 -0
  167. package/dist/web/threadReplyContentHeuristics.js +30 -0
  168. package/dist/web/threadRoots.js +61 -0
  169. package/dist/web/threadTaskBindings.js +365 -0
  170. package/dist/web/uiPanelPromptGuidance.js +27 -0
  171. package/dist/web/workspaceMemoryHints.js +143 -0
  172. package/dist/web/workspaceToolPromptGuidance.js +30 -0
  173. package/dist/web/wsHandler.js +397 -0
  174. package/dist/web/wsSink.js +116 -0
  175. package/package.json +54 -0
@@ -0,0 +1,62 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ export class AgentRuntimeCleanupBroker {
3
+ pending = new Map();
4
+ nodeRegistry;
5
+ timeoutMs;
6
+ constructor(params) {
7
+ this.nodeRegistry = params.nodeRegistry;
8
+ this.timeoutMs = params.timeoutMs ?? 15_000;
9
+ }
10
+ cleanupAgentRuntime(params) {
11
+ const hostKeys = [...new Set(params.hostKeys.filter(Boolean))];
12
+ const sessionKeys = [...new Set((params.sessionKeys ?? []).filter(Boolean))];
13
+ if (hostKeys.length === 0 && sessionKeys.length === 0)
14
+ return Promise.resolve();
15
+ const requestId = randomUUID();
16
+ return new Promise((resolve, reject) => {
17
+ const timer = setTimeout(() => {
18
+ this.pending.delete(requestId);
19
+ reject(new Error('Agent runtime cleanup timed out.'));
20
+ }, this.timeoutMs);
21
+ this.pending.set(requestId, {
22
+ nodeId: params.nodeId,
23
+ resolve,
24
+ reject,
25
+ timer,
26
+ });
27
+ const sent = this.nodeRegistry.send(params.nodeId, {
28
+ type: 'agent.cleanup.request',
29
+ requestId,
30
+ agentId: params.agentId,
31
+ hostKeys,
32
+ ...(sessionKeys.length > 0 ? { sessionKeys } : {}),
33
+ });
34
+ if (!sent) {
35
+ clearTimeout(timer);
36
+ this.pending.delete(requestId);
37
+ reject(new Error('Agent node is offline.'));
38
+ }
39
+ });
40
+ }
41
+ handleCleanupResponse(msg) {
42
+ const pending = this.pending.get(msg.requestId);
43
+ if (!pending)
44
+ return;
45
+ this.pending.delete(msg.requestId);
46
+ clearTimeout(pending.timer);
47
+ if (msg.error || !msg.ok) {
48
+ pending.reject(new Error(msg.error ?? 'Agent runtime cleanup failed.'));
49
+ return;
50
+ }
51
+ pending.resolve();
52
+ }
53
+ rejectPendingForNode(nodeId) {
54
+ for (const [requestId, pending] of this.pending.entries()) {
55
+ if (pending.nodeId !== nodeId)
56
+ continue;
57
+ clearTimeout(pending.timer);
58
+ pending.reject(new Error(`Agent node disconnected: ${nodeId}`));
59
+ this.pending.delete(requestId);
60
+ }
61
+ }
62
+ }
@@ -0,0 +1,118 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ export class AgentSkillsBroker {
3
+ pending = new Map();
4
+ nodeRegistry;
5
+ timeoutMs;
6
+ constructor(params) {
7
+ this.nodeRegistry = params.nodeRegistry;
8
+ this.timeoutMs = params.timeoutMs ?? 5_000;
9
+ }
10
+ listSkills(nodeId, skillRoots, params, skillPath) {
11
+ const requestId = randomUUID();
12
+ return new Promise((resolve, reject) => {
13
+ const timer = setTimeout(() => {
14
+ this.pending.delete(requestId);
15
+ reject(new Error('Skill request timed out.'));
16
+ }, this.timeoutMs);
17
+ this.pending.set(requestId, {
18
+ kind: 'list',
19
+ nodeId,
20
+ resolve,
21
+ reject,
22
+ timer,
23
+ });
24
+ const sent = this.nodeRegistry.send(nodeId, {
25
+ type: 'skills.list.request',
26
+ requestId,
27
+ skillRoots,
28
+ path: skillPath ?? null,
29
+ agentType: params?.agentType,
30
+ workspaceRoot: params?.workspaceRoot ?? null,
31
+ });
32
+ if (!sent) {
33
+ clearTimeout(timer);
34
+ this.pending.delete(requestId);
35
+ reject(new Error('Agent node is offline.'));
36
+ }
37
+ });
38
+ }
39
+ readSkillFile(nodeId, skillRoots, params, skillPath) {
40
+ const requestId = randomUUID();
41
+ return new Promise((resolve, reject) => {
42
+ const timer = setTimeout(() => {
43
+ this.pending.delete(requestId);
44
+ reject(new Error('Skill request timed out.'));
45
+ }, this.timeoutMs);
46
+ this.pending.set(requestId, {
47
+ kind: 'read',
48
+ nodeId,
49
+ resolve,
50
+ reject,
51
+ timer,
52
+ });
53
+ const sent = this.nodeRegistry.send(nodeId, {
54
+ type: 'skills.read.request',
55
+ requestId,
56
+ skillRoots,
57
+ path: skillPath,
58
+ agentType: params.agentType,
59
+ workspaceRoot: params.workspaceRoot ?? null,
60
+ });
61
+ if (!sent) {
62
+ clearTimeout(timer);
63
+ this.pending.delete(requestId);
64
+ reject(new Error('Agent node is offline.'));
65
+ }
66
+ });
67
+ }
68
+ handleSkillsListResponse(msg) {
69
+ const pending = this.pending.get(msg.requestId);
70
+ if (!pending || pending.kind !== 'list')
71
+ return;
72
+ this.pending.delete(msg.requestId);
73
+ clearTimeout(pending.timer);
74
+ if (msg.error || !msg.skills || !msg.entries) {
75
+ pending.reject(new Error(formatErrorMessage(msg.errorCode, msg.error)));
76
+ return;
77
+ }
78
+ pending.resolve({
79
+ path: msg.path ?? null,
80
+ roots: msg.roots,
81
+ skills: msg.skills,
82
+ entries: msg.entries,
83
+ });
84
+ }
85
+ handleSkillsReadResponse(msg) {
86
+ const pending = this.pending.get(msg.requestId);
87
+ if (!pending || pending.kind !== 'read')
88
+ return;
89
+ this.pending.delete(msg.requestId);
90
+ clearTimeout(pending.timer);
91
+ if (msg.error || msg.content === undefined || !msg.mimeType || msg.size === undefined) {
92
+ pending.reject(new Error(formatErrorMessage(msg.errorCode, msg.error)));
93
+ return;
94
+ }
95
+ pending.resolve({
96
+ path: msg.path,
97
+ content: msg.content,
98
+ mimeType: msg.mimeType,
99
+ size: msg.size,
100
+ modifiedAt: msg.modifiedAt ?? null,
101
+ });
102
+ }
103
+ rejectPendingForNode(nodeId) {
104
+ for (const [requestId, pending] of this.pending.entries()) {
105
+ if (pending.nodeId !== nodeId)
106
+ continue;
107
+ clearTimeout(pending.timer);
108
+ pending.reject(new Error(`Agent node disconnected: ${nodeId}`));
109
+ this.pending.delete(requestId);
110
+ }
111
+ }
112
+ }
113
+ function formatErrorMessage(errorCode, error) {
114
+ if (errorCode) {
115
+ return `${errorCode}:${error ?? 'skill request failed'}`;
116
+ }
117
+ return error ?? 'skill request failed';
118
+ }
@@ -0,0 +1,83 @@
1
+ export class AgentSkillsServiceError extends Error {
2
+ statusCode;
3
+ constructor(statusCode, message) {
4
+ super(message);
5
+ this.statusCode = statusCode;
6
+ }
7
+ }
8
+ export class AgentSkillsService {
9
+ getAgentById;
10
+ broker;
11
+ constructor(params) {
12
+ this.getAgentById = params.getAgentById;
13
+ this.broker = params.broker;
14
+ }
15
+ async listSkills(agentId, skillPath) {
16
+ const agent = this.getAgentById(agentId);
17
+ if (!agent)
18
+ throw new AgentSkillsServiceError(404, 'Agent not found.');
19
+ if (!agent.nodeId)
20
+ throw new AgentSkillsServiceError(409, 'Agent is not assigned to a remote node.');
21
+ const skillRoots = normalizeSkillRoots(agent.skillRoots);
22
+ if (skillRoots.length === 0) {
23
+ throw new AgentSkillsServiceError(409, 'Agent has no skill roots configured.');
24
+ }
25
+ try {
26
+ return await this.broker.listSkills(agent.nodeId, skillRoots, {
27
+ agentType: agent.agentType,
28
+ workspaceRoot: agent.workspacePath ?? null,
29
+ }, skillPath ?? null);
30
+ }
31
+ catch (error) {
32
+ throw mapSkillError(error);
33
+ }
34
+ }
35
+ async readSkillFile(agentId, skillPath) {
36
+ const agent = this.getAgentById(agentId);
37
+ if (!agent)
38
+ throw new AgentSkillsServiceError(404, 'Agent not found.');
39
+ if (!agent.nodeId)
40
+ throw new AgentSkillsServiceError(409, 'Agent is not assigned to a remote node.');
41
+ const skillRoots = normalizeSkillRoots(agent.skillRoots);
42
+ if (skillRoots.length === 0) {
43
+ throw new AgentSkillsServiceError(409, 'Agent has no skill roots configured.');
44
+ }
45
+ try {
46
+ return await this.broker.readSkillFile(agent.nodeId, skillRoots, {
47
+ agentType: agent.agentType,
48
+ workspaceRoot: agent.workspacePath ?? null,
49
+ }, skillPath);
50
+ }
51
+ catch (error) {
52
+ throw mapSkillError(error);
53
+ }
54
+ }
55
+ }
56
+ function normalizeSkillRoots(skillRoots) {
57
+ return (skillRoots ?? []).map((value) => value.trim()).filter(Boolean);
58
+ }
59
+ function mapSkillError(error) {
60
+ const message = String(error?.message ?? error);
61
+ if (message === 'Agent node is offline.') {
62
+ return new AgentSkillsServiceError(409, message);
63
+ }
64
+ if (message === 'Skill request timed out.') {
65
+ return new AgentSkillsServiceError(504, message);
66
+ }
67
+ if (message.startsWith('not_found:')) {
68
+ return new AgentSkillsServiceError(404, message.slice('not_found:'.length));
69
+ }
70
+ if (message.startsWith('path_outside_workspace:')) {
71
+ return new AgentSkillsServiceError(400, message.slice('path_outside_workspace:'.length));
72
+ }
73
+ if (message.startsWith('binary_file:')) {
74
+ return new AgentSkillsServiceError(415, message.slice('binary_file:'.length));
75
+ }
76
+ if (message.startsWith('file_too_large:')) {
77
+ return new AgentSkillsServiceError(413, message.slice('file_too_large:'.length));
78
+ }
79
+ if (message.startsWith('not_directory:') || message.startsWith('not_file:')) {
80
+ return new AgentSkillsServiceError(400, message.slice(message.indexOf(':') + 1));
81
+ }
82
+ return new AgentSkillsServiceError(500, message);
83
+ }