ei-tui 1.6.3 → 1.6.4
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/package.json +1 -1
- package/src/cli/install.ts +708 -0
- package/src/cli/session-context.ts +98 -0
- package/src/cli.ts +2 -808
- package/src/core/bootstrap-tools.ts +486 -0
- package/src/core/handlers/document-segmentation.ts +1 -2
- package/src/core/handlers/heartbeat.ts +3 -2
- package/src/core/handlers/persona-response.ts +5 -4
- package/src/core/handlers/rooms.ts +6 -5
- package/src/core/integration-sync-manager.ts +482 -0
- package/src/core/message-manager.ts +2 -1
- package/src/core/migrations.ts +297 -0
- package/src/core/orchestrators/ceremony.ts +2 -1
- package/src/core/processor.ts +17 -1220
- package/src/core/room-manager.ts +17 -4
- package/src/core/state-manager.ts +2 -1
- package/src/integrations/slack/importer.ts +1 -1
- package/tui/src/components/PromptInput.tsx +5 -1
package/src/core/room-manager.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ContextStatus, LLMNextStep, LLMPriority, LLMRequestType, RoomMode } from "./types.js";
|
|
2
2
|
import type { RoomCreationInput, RoomEntity, RoomMessage, RoomSummary, EiError } from "./types.js";
|
|
3
|
+
import { qualifyEiMessage } from "./utils/message-id.js";
|
|
3
4
|
import type { StateManager } from "./state-manager.js";
|
|
4
5
|
import { buildRoomResponsePromptData } from "./prompt-context-builder.js";
|
|
5
6
|
import { buildRoomJudgePrompt } from "../prompts/room/index.js";
|
|
@@ -117,7 +118,7 @@ export function submitHumanRoomMessage(
|
|
|
117
118
|
}
|
|
118
119
|
|
|
119
120
|
const msg: RoomMessage = {
|
|
120
|
-
id: crypto.randomUUID(),
|
|
121
|
+
id: qualifyEiMessage(crypto.randomUUID()),
|
|
121
122
|
parent_id: room.active_node_id,
|
|
122
123
|
role: "human",
|
|
123
124
|
content: content ?? undefined,
|
|
@@ -160,12 +161,17 @@ export async function sendFfaMessage(
|
|
|
160
161
|
}
|
|
161
162
|
const ffaParentId = ffaRootMsg.id;
|
|
162
163
|
|
|
163
|
-
const
|
|
164
|
+
const allMessages = sm.getRoomMessages(roomId);
|
|
165
|
+
const existing = allMessages.find(
|
|
164
166
|
m => m.role === "human" && m.id === room.active_node_id && m.parent_id === ffaParentId
|
|
165
167
|
);
|
|
166
168
|
|
|
167
169
|
let humanMsgId: string;
|
|
168
|
-
|
|
170
|
+
const existingHasChildren = existing
|
|
171
|
+
? allMessages.some(m => m.parent_id === existing.id && m.role === "persona")
|
|
172
|
+
: false;
|
|
173
|
+
|
|
174
|
+
if (existing && !existingHasChildren) {
|
|
169
175
|
sm.updateRoomMessage(roomId, existing.id, {
|
|
170
176
|
content: content ?? undefined,
|
|
171
177
|
silence_reason: content ? undefined : (silenceReason ?? "passed"),
|
|
@@ -174,7 +180,7 @@ export async function sendFfaMessage(
|
|
|
174
180
|
humanMsgId = existing.id;
|
|
175
181
|
} else {
|
|
176
182
|
const msg: RoomMessage = {
|
|
177
|
-
id: crypto.randomUUID(),
|
|
183
|
+
id: qualifyEiMessage(crypto.randomUUID()),
|
|
178
184
|
parent_id: ffaParentId,
|
|
179
185
|
role: "human",
|
|
180
186
|
content: content ?? undefined,
|
|
@@ -192,6 +198,12 @@ export async function sendFfaMessage(
|
|
|
192
198
|
onRoomUpdated(roomId);
|
|
193
199
|
|
|
194
200
|
const updatedRoom = sm.getRoom(roomId)!;
|
|
201
|
+
const alreadyAnswered = new Set(
|
|
202
|
+
sm.getRoomMessages(roomId)
|
|
203
|
+
.filter(m => m.parent_id === humanMsgId && m.role === "persona" && m.persona_id)
|
|
204
|
+
.map(m => m.persona_id!)
|
|
205
|
+
);
|
|
206
|
+
|
|
195
207
|
const alreadyQueued = new Set(
|
|
196
208
|
sm.queue_getAllActiveItems()
|
|
197
209
|
.filter(q =>
|
|
@@ -205,6 +217,7 @@ export async function sendFfaMessage(
|
|
|
205
217
|
const shuffledIds = [...updatedRoom.persona_ids].sort(() => Math.random() - 0.5);
|
|
206
218
|
|
|
207
219
|
for (const personaId of shuffledIds) {
|
|
220
|
+
if (alreadyAnswered.has(personaId)) continue;
|
|
208
221
|
if (alreadyQueued.has(personaId)) continue;
|
|
209
222
|
const persona = sm.persona_getById(personaId);
|
|
210
223
|
if (!persona || persona.is_archived || persona.is_paused) continue;
|
|
@@ -19,6 +19,7 @@ import type {
|
|
|
19
19
|
} from "./types.js";
|
|
20
20
|
import { RoomMode } from "./types.js";
|
|
21
21
|
import { BUILT_IN_FACT_NAMES } from './constants/built-in-facts.js';
|
|
22
|
+
import { qualifyEiMessage } from './utils/message-id.js';
|
|
22
23
|
import type { ThemeDefinition } from './types/entities.js';
|
|
23
24
|
import type { Storage } from "../storage/interface.js";
|
|
24
25
|
import {
|
|
@@ -446,7 +447,7 @@ export class StateManager {
|
|
|
446
447
|
addRoom(input: RoomCreationInput): RoomEntity {
|
|
447
448
|
const now = new Date().toISOString();
|
|
448
449
|
const initialMessage: RoomMessage = {
|
|
449
|
-
id: crypto.randomUUID(),
|
|
450
|
+
id: qualifyEiMessage(crypto.randomUUID()),
|
|
450
451
|
parent_id: null,
|
|
451
452
|
role: "human",
|
|
452
453
|
content: input.initial_message,
|
|
@@ -267,7 +267,7 @@ export async function importSlackChannel(opts: {
|
|
|
267
267
|
...updatedHuman.settings?.slack?.workspaces,
|
|
268
268
|
[workspaceId]: {
|
|
269
269
|
...workspaceConfig,
|
|
270
|
-
channels: { ...
|
|
270
|
+
channels: { ...channelStates, [channelId]: updatedState },
|
|
271
271
|
},
|
|
272
272
|
},
|
|
273
273
|
},
|
|
@@ -334,7 +334,11 @@ export function PromptInput() {
|
|
|
334
334
|
registerEditorHandler(handleEditor);
|
|
335
335
|
|
|
336
336
|
const getPlaceholder = () => {
|
|
337
|
-
if (activeRoomId() && humanRoomMessagePending())
|
|
337
|
+
if (activeRoomId() && humanRoomMessagePending()) {
|
|
338
|
+
const room = getRoom(activeRoomId()!);
|
|
339
|
+
if (room?.mode !== RoomMode.FreeForAll) return "Response Submitted - Press [Up] to recall";
|
|
340
|
+
return "Response Submitted";
|
|
341
|
+
}
|
|
338
342
|
if (!activePersonaId()) return "Select a persona...";
|
|
339
343
|
return "Type your message... (Enter to send, Ctrl+E for editor)";
|
|
340
344
|
};
|