@siftd/connect-agent 0.2.55 → 0.2.56
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/orchestrator.js +18 -12
- package/package.json +1 -1
package/dist/orchestrator.js
CHANGED
|
@@ -721,9 +721,14 @@ export class MasterOrchestrator {
|
|
|
721
721
|
return lines.join('\n');
|
|
722
722
|
}
|
|
723
723
|
stripTodoSnapshot(message) {
|
|
724
|
-
const
|
|
725
|
-
const
|
|
726
|
-
|
|
724
|
+
const markers = ['\n\nTODO SNAPSHOT', '\n\nRECENT CONVERSATION'];
|
|
725
|
+
const indices = markers
|
|
726
|
+
.map((marker) => message.indexOf(marker))
|
|
727
|
+
.filter((index) => index !== -1);
|
|
728
|
+
if (indices.length === 0)
|
|
729
|
+
return message;
|
|
730
|
+
const earliest = Math.min(...indices);
|
|
731
|
+
return message.slice(0, earliest);
|
|
727
732
|
}
|
|
728
733
|
hasTodoMutation(message) {
|
|
729
734
|
const lower = this.stripTodoSnapshot(message).toLowerCase();
|
|
@@ -950,14 +955,15 @@ export class MasterOrchestrator {
|
|
|
950
955
|
* Process a user message
|
|
951
956
|
*/
|
|
952
957
|
async processMessage(message, conversationHistory = [], sendMessage) {
|
|
953
|
-
|
|
958
|
+
const cleanMessage = this.stripTodoSnapshot(message);
|
|
959
|
+
this.lastUserMessage = cleanMessage;
|
|
954
960
|
// Handle slash commands first
|
|
955
|
-
const slashResponse = this.handleSlashCommand(
|
|
961
|
+
const slashResponse = this.handleSlashCommand(cleanMessage);
|
|
956
962
|
if (slashResponse) {
|
|
957
963
|
return slashResponse;
|
|
958
964
|
}
|
|
959
|
-
this.updateFileScope(
|
|
960
|
-
const wantsTodoOrCal = this.hasTodoMutation(
|
|
965
|
+
this.updateFileScope(cleanMessage);
|
|
966
|
+
const wantsTodoOrCal = this.hasTodoMutation(cleanMessage) || this.hasCalendarMutation(cleanMessage);
|
|
961
967
|
if (wantsTodoOrCal) {
|
|
962
968
|
this.attachmentContext = this.extractAttachmentContext(message);
|
|
963
969
|
const toolMessages = [{ role: 'user', content: message }];
|
|
@@ -979,11 +985,11 @@ export class MasterOrchestrator {
|
|
|
979
985
|
// return quickWrite;
|
|
980
986
|
// }
|
|
981
987
|
// Load hub context (AGENTS.md identity, LANDMARKS.md state, project bio if relevant)
|
|
982
|
-
const hubContext = loadHubContext(
|
|
988
|
+
const hubContext = loadHubContext(cleanMessage);
|
|
983
989
|
const hubContextStr = formatHubContext(hubContext);
|
|
984
990
|
this.attachmentContext = this.extractAttachmentContext(message);
|
|
985
991
|
// Build context from memory
|
|
986
|
-
const memoryContext = await this.getMemoryContext(
|
|
992
|
+
const memoryContext = await this.getMemoryContext(cleanMessage);
|
|
987
993
|
// Build system prompt with hub context, genesis knowledge, and memory context
|
|
988
994
|
const genesisKnowledge = getKnowledgeForPrompt();
|
|
989
995
|
let systemWithContext = SYSTEM_PROMPT;
|
|
@@ -1021,11 +1027,11 @@ ${hubContextStr}
|
|
|
1021
1027
|
try {
|
|
1022
1028
|
const response = await this.runAgentLoop(messages, systemWithContext, sendMessage);
|
|
1023
1029
|
// Auto-remember important things from the conversation
|
|
1024
|
-
await this.autoRemember(
|
|
1025
|
-
void this.autoCaptureContext(
|
|
1030
|
+
await this.autoRemember(cleanMessage, response);
|
|
1031
|
+
void this.autoCaptureContext(cleanMessage);
|
|
1026
1032
|
// Log significant actions to hub
|
|
1027
1033
|
if (response.length > 100) {
|
|
1028
|
-
const action =
|
|
1034
|
+
const action = cleanMessage.length > 50 ? cleanMessage.slice(0, 50) + '...' : cleanMessage;
|
|
1029
1035
|
logAction(action, hubContext.projectName || undefined, `Response: ${response.length} chars`);
|
|
1030
1036
|
}
|
|
1031
1037
|
return response;
|