ei-tui 1.3.0 → 1.3.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ei-tui",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "author": "Flare576",
5
5
  "repository": {
6
6
  "type": "git",
@@ -251,15 +251,15 @@ export class Processor {
251
251
  registerFetchMemoryExecutor(createFetchMemoryExecutor(this.stateManager.getHuman.bind(this.stateManager)));
252
252
  if (this.isTUI) {
253
253
  await registerFileReadExecutor();
254
- const { createOpenCodeReader } = await import("../integrations/opencode/reader-factory.js");
255
- const openCodeReader = await createOpenCodeReader().catch(() => null);
254
+ const retrievalPath = "../cli/retrieval.js";
255
+ const { resolveExternalMessage } = await import(/* @vite-ignore */ retrievalPath);
256
256
  registerFetchMessageExecutor(createFetchMessageExecutor(
257
257
  this.stateManager.persona_getAll.bind(this.stateManager),
258
258
  this.stateManager.messages_get.bind(this.stateManager),
259
259
  this.stateManager.getRoomList.bind(this.stateManager),
260
260
  this.stateManager.getRoomMessages.bind(this.stateManager),
261
261
  (roomId: string) => this.stateManager.getRoom(roomId)?.display_name ?? null,
262
- openCodeReader ? (id, before, after) => openCodeReader.getMessageById(id, before, after) : undefined
262
+ resolveExternalMessage
263
263
  ));
264
264
  } else {
265
265
  registerFetchMessageExecutor(createFetchMessageExecutor(
@@ -2,7 +2,6 @@ import type { ToolExecutor } from "../types.js";
2
2
  import type { Message } from "../../types.js";
3
3
  import type { RoomMessage, RoomSummary } from "../../types/rooms.js";
4
4
  import type { PersonaEntity } from "../../types/entities.js";
5
- import type { OpenCodeMessageWindow } from "../../../integrations/opencode/types.js";
6
5
 
7
6
  interface CleanMessage {
8
7
  id: string;
@@ -18,9 +17,7 @@ type GetPersonaMessages = (personaId: string) => Message[];
18
17
  type GetRoomList = () => RoomSummary[];
19
18
  type GetRoomMessages = (roomId: string) => RoomMessage[];
20
19
  type GetRoomDisplayName = (roomId: string) => string | null;
21
- type GetOpenCodeMessage = (id: string, before: number, after: number) => Promise<OpenCodeMessageWindow | null>;
22
-
23
- const OPENCODE_MESSAGE_ID = /^msg_[a-zA-Z0-9]+$/;
20
+ type ResolveExternalMessage = (id: string, before: number, after: number) => Promise<Record<string, unknown> | null>;
24
21
 
25
22
  function stripMessage(m: Message): CleanMessage {
26
23
  return {
@@ -50,7 +47,7 @@ export function createFetchMessageExecutor(
50
47
  getRoomList: GetRoomList,
51
48
  getRoomMessages: GetRoomMessages,
52
49
  getRoomDisplayName: GetRoomDisplayName,
53
- getOpenCodeMessage?: GetOpenCodeMessage
50
+ resolveExternalMessage?: ResolveExternalMessage
54
51
  ): ToolExecutor {
55
52
  return {
56
53
  name: "fetch_message",
@@ -67,27 +64,6 @@ export function createFetchMessageExecutor(
67
64
  return JSON.stringify({ error: "Missing required argument: id" });
68
65
  }
69
66
 
70
- if (OPENCODE_MESSAGE_ID.test(id)) {
71
- if (!getOpenCodeMessage) {
72
- return JSON.stringify({ error: "OpenCode message lookup not available in this runtime", id });
73
- }
74
- const window = await getOpenCodeMessage(id, before, after);
75
- if (!window) {
76
- return JSON.stringify({
77
- error: "OpenCode message not found on this machine. It may exist on another device.",
78
- id,
79
- hint: "Check the linked topic's sources for the originating machine and session.",
80
- });
81
- }
82
- return JSON.stringify({
83
- message: { id: window.message.id, role: window.message.role, content: window.message.content, timestamp: window.message.timestamp, agent: window.message.agent },
84
- before: window.before.map(m => ({ id: m.id, role: m.role, content: m.content, timestamp: m.timestamp, agent: m.agent })),
85
- after: window.after.map(m => ({ id: m.id, role: m.role, content: m.content, timestamp: m.timestamp, agent: m.agent })),
86
- session: { id: window.session.id, title: window.session.title, directory: window.session.directory },
87
- source: "opencode",
88
- });
89
- }
90
-
91
67
  const personas = getAllPersonas();
92
68
 
93
69
  // TODO: add persona access gate when calling context is available —
@@ -142,6 +118,14 @@ export function createFetchMessageExecutor(
142
118
  });
143
119
  }
144
120
 
121
+ if (resolveExternalMessage) {
122
+ const external = await resolveExternalMessage(id, before, after);
123
+ if (external) {
124
+ if ("error" in external) return JSON.stringify(external);
125
+ return JSON.stringify(external);
126
+ }
127
+ }
128
+
145
129
  console.log(`[fetch_message] message not found for id="${id}"`);
146
130
  return JSON.stringify({ error: "Message not found" });
147
131
  },