@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,155 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ export class CodexAppServerBroker {
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
+ listModels(nodeId, params) {
11
+ return this.sendRequest('models', nodeId, (requestId) => ({
12
+ type: 'codex.model.list.request',
13
+ requestId,
14
+ workspaceRoot: params?.workspaceRoot ?? null,
15
+ cursor: params?.cursor ?? null,
16
+ limit: params?.limit ?? null,
17
+ includeHidden: params?.includeHidden ?? null,
18
+ }));
19
+ }
20
+ listSkills(nodeId, params) {
21
+ return this.sendRequest('skills', nodeId, (requestId) => ({
22
+ type: 'codex.skills.list.request',
23
+ requestId,
24
+ workspaceRoot: params.workspaceRoot,
25
+ skillRoots: params.skillRoots ?? [],
26
+ forceReload: params.forceReload,
27
+ }));
28
+ }
29
+ listThreads(nodeId, params) {
30
+ return this.sendRequest('thread-list', nodeId, (requestId) => ({
31
+ type: 'codex.thread.list.request',
32
+ requestId,
33
+ workspaceRoot: params.workspaceRoot,
34
+ cursor: params.cursor ?? null,
35
+ limit: params.limit ?? null,
36
+ archived: params.archived ?? null,
37
+ searchTerm: params.searchTerm ?? null,
38
+ useStateDbOnly: params.useStateDbOnly,
39
+ }));
40
+ }
41
+ readThread(nodeId, params) {
42
+ return this.sendRequest('thread-read', nodeId, (requestId) => ({
43
+ type: 'codex.thread.read.request',
44
+ requestId,
45
+ workspaceRoot: params.workspaceRoot,
46
+ threadId: params.threadId,
47
+ includeTurns: params.includeTurns,
48
+ }));
49
+ }
50
+ summarizeConversation(nodeId, params) {
51
+ return this.sendRequest('conversation-summary', nodeId, (requestId) => ({
52
+ type: 'codex.conversation.summary.request',
53
+ requestId,
54
+ prompt: params.prompt,
55
+ envVars: params.envVars,
56
+ }));
57
+ }
58
+ handleModelListResponse(msg) {
59
+ const pending = this.takePending(msg.requestId, 'models');
60
+ if (!pending)
61
+ return;
62
+ if (msg.error || !msg.models) {
63
+ pending.reject(new Error(msg.error ?? 'Codex model list request failed.'));
64
+ return;
65
+ }
66
+ pending.resolve({
67
+ models: msg.models,
68
+ nextCursor: msg.nextCursor ?? null,
69
+ defaultModel: msg.defaultModel ?? null,
70
+ });
71
+ }
72
+ handleSkillsListResponse(msg) {
73
+ const pending = this.takePending(msg.requestId, 'skills');
74
+ if (!pending)
75
+ return;
76
+ if (msg.error || !msg.data) {
77
+ pending.reject(new Error(msg.error ?? 'Codex skills list request failed.'));
78
+ return;
79
+ }
80
+ pending.resolve({ data: msg.data });
81
+ }
82
+ handleThreadListResponse(msg) {
83
+ const pending = this.takePending(msg.requestId, 'thread-list');
84
+ if (!pending)
85
+ return;
86
+ if (msg.error || !msg.threads) {
87
+ pending.reject(new Error(msg.error ?? 'Codex thread list request failed.'));
88
+ return;
89
+ }
90
+ pending.resolve({
91
+ threads: msg.threads,
92
+ nextCursor: msg.nextCursor ?? null,
93
+ backwardsCursor: msg.backwardsCursor ?? null,
94
+ });
95
+ }
96
+ handleThreadReadResponse(msg) {
97
+ const pending = this.takePending(msg.requestId, 'thread-read');
98
+ if (!pending)
99
+ return;
100
+ if (msg.error || !msg.thread) {
101
+ pending.reject(new Error(msg.error ?? 'Codex thread read request failed.'));
102
+ return;
103
+ }
104
+ pending.resolve({ thread: msg.thread });
105
+ }
106
+ handleConversationSummaryResponse(msg) {
107
+ const pending = this.takePending(msg.requestId, 'conversation-summary');
108
+ if (!pending)
109
+ return;
110
+ if (msg.error || typeof msg.content !== 'string') {
111
+ pending.reject(new Error(msg.error ?? 'Codex conversation summary request failed.'));
112
+ return;
113
+ }
114
+ pending.resolve(msg.content);
115
+ }
116
+ rejectPendingForNode(nodeId) {
117
+ for (const [requestId, pending] of this.pending.entries()) {
118
+ if (pending.nodeId !== nodeId)
119
+ continue;
120
+ clearTimeout(pending.timer);
121
+ pending.reject(new Error(`Agent node disconnected: ${nodeId}`));
122
+ this.pending.delete(requestId);
123
+ }
124
+ }
125
+ sendRequest(kind, nodeId, buildMessage) {
126
+ const requestId = randomUUID();
127
+ return new Promise((resolve, reject) => {
128
+ const timer = setTimeout(() => {
129
+ this.pending.delete(requestId);
130
+ reject(new Error('Codex app-server request timed out.'));
131
+ }, this.timeoutMs);
132
+ this.pending.set(requestId, {
133
+ kind,
134
+ nodeId,
135
+ resolve,
136
+ reject,
137
+ timer,
138
+ });
139
+ const sent = this.nodeRegistry.send(nodeId, buildMessage(requestId));
140
+ if (!sent) {
141
+ clearTimeout(timer);
142
+ this.pending.delete(requestId);
143
+ reject(new Error('Agent node is offline.'));
144
+ }
145
+ });
146
+ }
147
+ takePending(requestId, kind) {
148
+ const pending = this.pending.get(requestId);
149
+ if (!pending || pending.kind !== kind)
150
+ return null;
151
+ this.pending.delete(requestId);
152
+ clearTimeout(pending.timer);
153
+ return pending;
154
+ }
155
+ }
@@ -0,0 +1,98 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ export class CodexTranscriptBroker {
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
+ listFiles(nodeId, maxFiles = 1000) {
11
+ const requestId = randomUUID();
12
+ return new Promise((resolve, reject) => {
13
+ const timer = setTimeout(() => {
14
+ this.pending.delete(requestId);
15
+ reject(new Error('Codex transcript request timed out.'));
16
+ }, this.timeoutMs);
17
+ this.pending.set(requestId, { nodeId, kind: 'list', resolve, reject, timer });
18
+ const sent = this.nodeRegistry.send(nodeId, {
19
+ type: 'codex.transcript.list.request',
20
+ requestId,
21
+ maxFiles,
22
+ });
23
+ if (!sent) {
24
+ clearTimeout(timer);
25
+ this.pending.delete(requestId);
26
+ reject(new Error('Agent node is offline.'));
27
+ }
28
+ });
29
+ }
30
+ readFile(nodeId, transcriptPath) {
31
+ const requestId = randomUUID();
32
+ return new Promise((resolve, reject) => {
33
+ const timer = setTimeout(() => {
34
+ this.pending.delete(requestId);
35
+ reject(new Error('Codex transcript request timed out.'));
36
+ }, this.timeoutMs);
37
+ this.pending.set(requestId, { nodeId, kind: 'read', resolve, reject, timer });
38
+ const sent = this.nodeRegistry.send(nodeId, {
39
+ type: 'codex.transcript.read.request',
40
+ requestId,
41
+ path: transcriptPath,
42
+ });
43
+ if (!sent) {
44
+ clearTimeout(timer);
45
+ this.pending.delete(requestId);
46
+ reject(new Error('Agent node is offline.'));
47
+ }
48
+ });
49
+ }
50
+ handleListResponse(msg) {
51
+ const pending = this.pending.get(msg.requestId);
52
+ if (!pending || pending.kind !== 'list')
53
+ return;
54
+ this.pending.delete(msg.requestId);
55
+ clearTimeout(pending.timer);
56
+ if (msg.error || !msg.rootPath || !msg.files) {
57
+ pending.reject(new Error(formatErrorMessage(msg.errorCode, msg.error)));
58
+ return;
59
+ }
60
+ pending.resolve({
61
+ rootPath: msg.rootPath,
62
+ files: msg.files,
63
+ truncated: Boolean(msg.truncated),
64
+ });
65
+ }
66
+ handleReadResponse(msg) {
67
+ const pending = this.pending.get(msg.requestId);
68
+ if (!pending || pending.kind !== 'read')
69
+ return;
70
+ this.pending.delete(msg.requestId);
71
+ clearTimeout(pending.timer);
72
+ if (msg.error || !msg.rootPath || msg.content === undefined || msg.size === undefined) {
73
+ pending.reject(new Error(formatErrorMessage(msg.errorCode, msg.error)));
74
+ return;
75
+ }
76
+ pending.resolve({
77
+ rootPath: msg.rootPath,
78
+ path: msg.path,
79
+ content: msg.content,
80
+ size: msg.size,
81
+ modifiedAt: msg.modifiedAt ?? null,
82
+ });
83
+ }
84
+ rejectPendingForNode(nodeId) {
85
+ for (const [requestId, pending] of this.pending.entries()) {
86
+ if (pending.nodeId !== nodeId)
87
+ continue;
88
+ clearTimeout(pending.timer);
89
+ pending.reject(new Error(`Agent node disconnected: ${nodeId}`));
90
+ this.pending.delete(requestId);
91
+ }
92
+ }
93
+ }
94
+ function formatErrorMessage(errorCode, error) {
95
+ if (errorCode)
96
+ return `${errorCode}:${error ?? 'codex transcript request failed'}`;
97
+ return error ?? 'codex transcript request failed';
98
+ }