lunel-cli 0.1.27 → 0.1.29
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 +24 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1225,7 +1225,17 @@ async function handleAiGetMessages(payload) {
|
|
|
1225
1225
|
console.log("[ai] getMessages called, sessionId:", id);
|
|
1226
1226
|
try {
|
|
1227
1227
|
const response = await opencodeClient.session.messages({ path: { id } });
|
|
1228
|
-
|
|
1228
|
+
const raw = requireData(response, "session.messages");
|
|
1229
|
+
// Transform SDK shape { info: { id, sessionID, role, ... }, parts: [...] }
|
|
1230
|
+
// into app shape { id, role, parts }
|
|
1231
|
+
const messages = raw.map((m) => ({
|
|
1232
|
+
id: m.info.id,
|
|
1233
|
+
role: m.info.role,
|
|
1234
|
+
parts: m.parts || [],
|
|
1235
|
+
time: m.info.time,
|
|
1236
|
+
}));
|
|
1237
|
+
console.log("[ai] getMessages returned", messages.length, "messages");
|
|
1238
|
+
return { messages };
|
|
1229
1239
|
}
|
|
1230
1240
|
catch (err) {
|
|
1231
1241
|
console.error("[ai] getMessages exception:", err.message);
|
|
@@ -1529,6 +1539,19 @@ async function processMessage(message) {
|
|
|
1529
1539
|
error: { code: "EPROTO", message: `Unsupported protocol version: ${v}` },
|
|
1530
1540
|
};
|
|
1531
1541
|
}
|
|
1542
|
+
// Validate required fields
|
|
1543
|
+
if (!ns || !action) {
|
|
1544
|
+
console.warn("[router] Ignoring message with missing ns/action:", JSON.stringify(message).substring(0, 300));
|
|
1545
|
+
return {
|
|
1546
|
+
v: 1,
|
|
1547
|
+
id,
|
|
1548
|
+
ns,
|
|
1549
|
+
action,
|
|
1550
|
+
ok: false,
|
|
1551
|
+
payload: {},
|
|
1552
|
+
error: { code: "EINVAL", message: `Missing namespace or action` },
|
|
1553
|
+
};
|
|
1554
|
+
}
|
|
1532
1555
|
try {
|
|
1533
1556
|
let result;
|
|
1534
1557
|
switch (ns) {
|