feat: add remote channels and richer notes

This commit is contained in:
lofyer
2026-08-09 15:48:52 +08:00
parent 417a9fccb6
commit 6c891f3522
69 changed files with 13012 additions and 499 deletions
+45
View File
@@ -0,0 +1,45 @@
import type { AssistantDatabase } from '../assistant/assistant-database'
import type {
DedupStore,
Outbox,
OutboxEntry
} from './channel-driver'
import type { ChannelResultMessage } from '../../shared/channel-contracts'
export class SqliteChannelDedupStore implements DedupStore {
constructor(private readonly database: AssistantDatabase) {}
claim(channel: string, eventId: string): boolean {
return this.database.claimChannelEvent(channel, eventId)
}
release(channel: string, eventId: string): void {
this.database.releaseChannelEvent(channel, eventId)
}
}
export class SqliteChannelOutbox implements Outbox {
constructor(private readonly database: AssistantDatabase) {}
enqueue(message: ChannelResultMessage): OutboxEntry {
return this.database.enqueueChannelResult(message)
}
markDelivered(id: string): void {
this.database.markChannelResult(id, 'delivered')
}
markFailed(id: string): void {
this.database.markChannelResult(id, 'failed')
}
listUndelivered(
channel?: string,
limit?: number
): readonly OutboxEntry[] {
return this.database.listUndeliveredChannelResults(
channel,
limit
)
}
}