@aexol/spectral 0.2.20 → 0.2.21
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/server/pi-bridge.js
CHANGED
|
@@ -724,6 +724,7 @@ export class PiBridge {
|
|
|
724
724
|
e.type === "tool_result");
|
|
725
725
|
if (!finalContent && !hasMeaningfulEvent) {
|
|
726
726
|
console.debug("[pi-bridge] skipping empty intermediate message");
|
|
727
|
+
this.opts.onAssistantMessageSkipped?.(messageId);
|
|
727
728
|
return;
|
|
728
729
|
}
|
|
729
730
|
const eventsJsonl = wireEvents.map((e) => JSON.stringify(e)).join("\n");
|
|
@@ -195,6 +195,9 @@ export class SessionStreamManager {
|
|
|
195
195
|
console.error(`[spectral] error: failed to persist assistant message: ${err instanceof Error ? err.message : String(err)}`);
|
|
196
196
|
}
|
|
197
197
|
},
|
|
198
|
+
onAssistantMessageSkipped: (messageId) => {
|
|
199
|
+
this.store.deleteMessage(messageId);
|
|
200
|
+
},
|
|
198
201
|
onError: (err) => {
|
|
199
202
|
console.error(`[spectral] error: pi bridge error: ${err.message}`);
|
|
200
203
|
},
|
|
@@ -499,6 +502,9 @@ export class SessionStreamManager {
|
|
|
499
502
|
console.error(`[spectral] error: failed to persist assistant message: ${err instanceof Error ? err.message : String(err)}`);
|
|
500
503
|
}
|
|
501
504
|
},
|
|
505
|
+
onAssistantMessageSkipped: (messageId) => {
|
|
506
|
+
this.store.deleteMessage(messageId);
|
|
507
|
+
},
|
|
502
508
|
onError: (err) => {
|
|
503
509
|
console.error(`[spectral] error: pi bridge error: ${err.message}`);
|
|
504
510
|
},
|
package/dist/server/storage.js
CHANGED
|
@@ -147,6 +147,7 @@ export class SessionStore {
|
|
|
147
147
|
stmtDeleteSession;
|
|
148
148
|
stmtListMessages;
|
|
149
149
|
stmtAppendMessage;
|
|
150
|
+
stmtDeleteMessage;
|
|
150
151
|
stmtTouchSession;
|
|
151
152
|
stmtRenameSession;
|
|
152
153
|
stmtSessionWithCount;
|
|
@@ -265,6 +266,7 @@ export class SessionStore {
|
|
|
265
266
|
FROM messages WHERE session_id = ? ORDER BY created_at ASC, id ASC`);
|
|
266
267
|
this.stmtAppendMessage = this.db.prepare(`INSERT OR REPLACE INTO messages (id, session_id, role, content, events_jsonl, images_json, created_at)
|
|
267
268
|
VALUES (?, ?, ?, ?, ?, ?, ?)`);
|
|
269
|
+
this.stmtDeleteMessage = this.db.prepare(`DELETE FROM messages WHERE id = ?`);
|
|
268
270
|
this.stmtTouchSession = this.db.prepare(`UPDATE sessions SET updated_at = ? WHERE id = ?`);
|
|
269
271
|
this.stmtRenameSession = this.db.prepare(`UPDATE sessions SET title = ?, updated_at = ? WHERE id = ?`);
|
|
270
272
|
this.stmtSessionWithCount = this.db.prepare(`
|
|
@@ -435,6 +437,10 @@ export class SessionStore {
|
|
|
435
437
|
* Append a message and bump the session's updated_at in one transaction.
|
|
436
438
|
* Throws if the session doesn't exist (FK violation).
|
|
437
439
|
*/
|
|
440
|
+
/** Delete a message by id. No-op if the message doesn't exist. */
|
|
441
|
+
deleteMessage(id) {
|
|
442
|
+
this.stmtDeleteMessage.run(id);
|
|
443
|
+
}
|
|
438
444
|
appendMessage(sessionId, msg) {
|
|
439
445
|
const id = msg.id ?? randomUUID();
|
|
440
446
|
const createdAt = msg.createdAt ?? Date.now();
|