codebolt 1.12.8 → 1.12.10
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/index.js
CHANGED
|
@@ -526525,6 +526525,10 @@ async function initializeDatabase() {
|
|
|
526525
526525
|
settingService_1.projectSetting.user_active_project_path = startupProjectPath;
|
|
526526
526526
|
appLogger_1.default.info(`[INIT] Overrode projectSetting.user_active_project_path with startup path: ${startupProjectPath}`);
|
|
526527
526527
|
}
|
|
526528
|
+
else if (startupProjectPath && !settingService_1.projectSetting) {
|
|
526529
|
+
// No-op: handled by threadFileStore fallback to getProjectPath()
|
|
526530
|
+
appLogger_1.default.info(`[INIT] No DB profile, startup path available: ${startupProjectPath}`);
|
|
526531
|
+
}
|
|
526528
526532
|
else if (!startupProjectPath && settingService_1.projectSetting?.user_active_project_path) {
|
|
526529
526533
|
// If no startup projectPath was provided (e.g. CLI mode), seed getProjectPath()
|
|
526530
526534
|
// from the DB value so that callers of getProjectPath() also work.
|
|
@@ -556972,6 +556976,7 @@ const registerEnvironmentProviderConnection = async (connectionId, socket, envir
|
|
|
556972
556976
|
environmentName,
|
|
556973
556977
|
timestamp: new Date().toISOString(),
|
|
556974
556978
|
projectPath: settingService_1.projectSetting.user_active_project_path,
|
|
556979
|
+
projectName: path.basename(settingService_1.projectSetting.user_active_project_path),
|
|
556975
556980
|
archivePath: snapshotResult?.archivePath,
|
|
556976
556981
|
snapshotId: snapshotResult?.snapshotId,
|
|
556977
556982
|
};
|
|
@@ -557246,8 +557251,16 @@ const sendProviderAgentStartToEnvironment = async (environmentId, userMessage, t
|
|
|
557246
557251
|
} : {}),
|
|
557247
557252
|
};
|
|
557248
557253
|
if (message.userMessage.message.selectedAgent) {
|
|
557254
|
+
const resolvedAgentId = message.agentId; // already resolved with fallback above
|
|
557249
557255
|
message.userMessage.message.selectedAgent.agentType = 'marketplace';
|
|
557250
|
-
message.userMessage.message.selectedAgent.agentDetails =
|
|
557256
|
+
message.userMessage.message.selectedAgent.agentDetails = resolvedAgentId;
|
|
557257
|
+
// Ensure id is populated (remote sandbox needs it to find the agent)
|
|
557258
|
+
if (!message.userMessage.message.selectedAgent.id) {
|
|
557259
|
+
message.userMessage.message.selectedAgent.id = resolvedAgentId;
|
|
557260
|
+
}
|
|
557261
|
+
if (!message.userMessage.message.selectedAgent.name) {
|
|
557262
|
+
message.userMessage.message.selectedAgent.name = resolvedAgentId;
|
|
557263
|
+
}
|
|
557251
557264
|
}
|
|
557252
557265
|
// Store the pending request using environmentId as key (without timeout)
|
|
557253
557266
|
pendingAgentStartRequests.set(environmentId, {
|
|
@@ -592881,12 +592894,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
592881
592894
|
};
|
|
592882
592895
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
592883
592896
|
exports.settingService = exports.clearAllTokens = exports.removeThreadToken = exports.getTokenFromThreadId = exports.getThreadIdFromToken = exports.generateThreadToken = exports.threadId = exports.activeAgentConfig = exports.activeAgent = exports.activeUser = exports.projectSetting = void 0;
|
|
592897
|
+
exports.setProjectSetting = setProjectSetting;
|
|
592884
592898
|
const db_1 = __importDefault(__webpack_require__(12202));
|
|
592885
592899
|
const uuid_1 = __webpack_require__(47333);
|
|
592886
592900
|
const appLogger_1 = __importDefault(__webpack_require__(8479));
|
|
592887
592901
|
const HookManager_1 = __webpack_require__(46994);
|
|
592888
592902
|
const categorizedLogger_1 = __webpack_require__(77819);
|
|
592889
592903
|
const focusedLogCategories_1 = __webpack_require__(54293);
|
|
592904
|
+
function setProjectSetting(setting) {
|
|
592905
|
+
exports.projectSetting = setting;
|
|
592906
|
+
}
|
|
592890
592907
|
// Token mapping storage: threadId -> token
|
|
592891
592908
|
const threadTokenMap = new Map();
|
|
592892
592909
|
// Reverse mapping: token -> threadId
|
|
@@ -612489,6 +612506,7 @@ exports.ChatThreadManager = void 0;
|
|
|
612489
612506
|
const threadFileStore_1 = __webpack_require__(58962);
|
|
612490
612507
|
const appLogger_1 = __importDefault(__webpack_require__(8479));
|
|
612491
612508
|
const socket_constants_1 = __webpack_require__(91836);
|
|
612509
|
+
const agentHelper_1 = __webpack_require__(5069);
|
|
612492
612510
|
class ChatThreadManager {
|
|
612493
612511
|
/**
|
|
612494
612512
|
* Get or create thread ID from incoming message
|
|
@@ -612595,8 +612613,11 @@ class ChatThreadManager {
|
|
|
612595
612613
|
incomingMessage.data = {
|
|
612596
612614
|
text: incomingMessage?.message?.userMessage || ""
|
|
612597
612615
|
};
|
|
612598
|
-
// Ensure messageId
|
|
612599
|
-
if (incomingMessage?.message?.messageId
|
|
612616
|
+
// Ensure messageId exists - generate one if the client didn't provide it
|
|
612617
|
+
if (!incomingMessage?.message?.messageId) {
|
|
612618
|
+
incomingMessage.message.messageId = (0, agentHelper_1.getMessageId)();
|
|
612619
|
+
}
|
|
612620
|
+
if (!incomingMessage.messageId) {
|
|
612600
612621
|
incomingMessage.messageId = incomingMessage.message.messageId;
|
|
612601
612622
|
}
|
|
612602
612623
|
// Add timestamp if missing
|
|
@@ -614894,8 +614915,11 @@ chatSocket.handleMessage = async (_ws, payload) => {
|
|
|
614894
614915
|
return;
|
|
614895
614916
|
}
|
|
614896
614917
|
try {
|
|
614918
|
+
console.log('[ChatSocket:mux] prepareMessage...');
|
|
614897
614919
|
incomingMessage = chatThreadManager.prepareMessage(incomingMessage);
|
|
614920
|
+
console.log('[ChatSocket:mux] getOrCreateThreadId...');
|
|
614898
614921
|
let messageThreadId = await chatThreadManager.getOrCreateThreadId(incomingMessage);
|
|
614922
|
+
console.log('[ChatSocket:mux] threadId:', messageThreadId);
|
|
614899
614923
|
global.globalThreadId = messageThreadId;
|
|
614900
614924
|
await chatThreadManager.processActiveStep(incomingMessage, messageThreadId);
|
|
614901
614925
|
chatThreadManager.logThreadInfo(incomingMessage, messageThreadId);
|
|
@@ -614906,10 +614930,13 @@ chatSocket.handleMessage = async (_ws, payload) => {
|
|
|
614906
614930
|
// Broadcast incoming user message to all connected plugins
|
|
614907
614931
|
(0, broadcastChatToPlugins_1.broadcastChatToPlugins)(incomingMessage, 'incoming');
|
|
614908
614932
|
chatManager_1.default.addChat(messageThreadId, incomingMessage);
|
|
614933
|
+
console.log('[ChatSocket:mux] routing message, type:', incomingMessage.type, 'hasEnvironment:', !!incomingMessage?.message?.environment, 'isRemoteTask:', incomingMessage?.message?.isRemoteTask);
|
|
614909
614934
|
const messageRouter = new handlers_1.MessageRouter(messageThreadId);
|
|
614910
614935
|
await messageRouter.routeMessage(incomingMessage);
|
|
614936
|
+
console.log('[ChatSocket:mux] routeMessage done');
|
|
614911
614937
|
}
|
|
614912
614938
|
catch (error) {
|
|
614939
|
+
console.error('[ChatSocket:mux] ERROR:', error?.message || error);
|
|
614913
614940
|
utils_1.ErrorHandler.handleMessageError(error, 'ChatSocket', incomingMessage);
|
|
614914
614941
|
}
|
|
614915
614942
|
};
|
|
@@ -621540,6 +621567,7 @@ const path_1 = __importDefault(__webpack_require__(16928));
|
|
|
621540
621567
|
const uuid_1 = __webpack_require__(47333);
|
|
621541
621568
|
const logger_1 = __webpack_require__(19622);
|
|
621542
621569
|
const settingService_1 = __webpack_require__(26152);
|
|
621570
|
+
const serverPaths_1 = __webpack_require__(52047);
|
|
621543
621571
|
const logger = (0, logger_1.createLogger)();
|
|
621544
621572
|
var ThreadStepStatus;
|
|
621545
621573
|
(function (ThreadStepStatus) {
|
|
@@ -622237,7 +622265,7 @@ class ThreadFileStore {
|
|
|
622237
622265
|
// ========================================================================
|
|
622238
622266
|
_ensureInitialized() {
|
|
622239
622267
|
if (!this._initialized) {
|
|
622240
|
-
const projectPath = settingService_1.projectSetting?.user_active_project_path;
|
|
622268
|
+
const projectPath = settingService_1.projectSetting?.user_active_project_path || (0, serverPaths_1.getProjectPath)();
|
|
622241
622269
|
if (projectPath) {
|
|
622242
622270
|
this.init(projectPath);
|
|
622243
622271
|
}
|