feat(mesh): mesh-AI assistant scheduler + config panel (#50)
Adds the assistant scheduler, MeshAssistantPanel UI, and the remaining config-RPC / live-toggle / Ollama-detect wiring on top of Phase 1.x. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
0947ecee11
commit
7a76d32e4b
@@ -122,6 +122,26 @@ export interface BlockHeader {
|
||||
announced_by: string
|
||||
}
|
||||
|
||||
export interface AssistantStatus {
|
||||
enabled: boolean
|
||||
model: string | null
|
||||
trusted_only: boolean
|
||||
backend: string
|
||||
default_model: string
|
||||
ollama_detected: boolean
|
||||
claude_available: boolean
|
||||
models: string[]
|
||||
}
|
||||
|
||||
export interface ScheduledMessage {
|
||||
id: number
|
||||
contact_id: number | null
|
||||
channel: number | null
|
||||
body: string
|
||||
fire_at: number
|
||||
attempts: number
|
||||
}
|
||||
|
||||
export interface NodePosition {
|
||||
lat: number
|
||||
lng: number
|
||||
@@ -574,6 +594,59 @@ export const useMeshStore = defineStore('mesh', () => {
|
||||
const blockHeaders = ref<BlockHeader[]>([])
|
||||
const latestBlockHeight = ref(0)
|
||||
|
||||
// Mesh-AI assistant (issue #50)
|
||||
const assistantStatus = ref<AssistantStatus | null>(null)
|
||||
|
||||
async function fetchAssistantStatus() {
|
||||
try {
|
||||
assistantStatus.value = await rpcClient.call<AssistantStatus>({ method: 'mesh.assistant-status' })
|
||||
} catch {
|
||||
// Assistant not available (mesh service down)
|
||||
}
|
||||
}
|
||||
|
||||
async function configureAssistant(config: {
|
||||
enabled?: boolean
|
||||
model?: string | null
|
||||
trusted_only?: boolean
|
||||
backend?: string
|
||||
}) {
|
||||
const res = await rpcClient.call<Partial<AssistantStatus>>({
|
||||
method: 'mesh.assistant-configure',
|
||||
params: config,
|
||||
})
|
||||
await fetchAssistantStatus()
|
||||
return res
|
||||
}
|
||||
|
||||
// Scheduled / queued mesh messages (issue #50, phase 1.7)
|
||||
const scheduledMessages = ref<ScheduledMessage[]>([])
|
||||
|
||||
async function fetchScheduledMessages() {
|
||||
try {
|
||||
const res = await rpcClient.call<{ messages: ScheduledMessage[] }>({ method: 'mesh.list-scheduled' })
|
||||
scheduledMessages.value = res.messages || []
|
||||
} catch {
|
||||
scheduledMessages.value = []
|
||||
}
|
||||
}
|
||||
|
||||
async function scheduleMessage(params: {
|
||||
contact_id?: number
|
||||
channel?: number
|
||||
body: string
|
||||
fire_at: number
|
||||
}) {
|
||||
const res = await rpcClient.call<ScheduledMessage>({ method: 'mesh.schedule-message', params })
|
||||
await fetchScheduledMessages()
|
||||
return res
|
||||
}
|
||||
|
||||
async function cancelScheduledMessage(id: number) {
|
||||
await rpcClient.call({ method: 'mesh.cancel-scheduled', params: { id } })
|
||||
await fetchScheduledMessages()
|
||||
}
|
||||
|
||||
async function fetchDeadmanStatus() {
|
||||
try {
|
||||
deadmanStatus.value = await rpcClient.call<AlertStatus>({ method: 'mesh.deadman-status' })
|
||||
@@ -693,6 +766,13 @@ export const useMeshStore = defineStore('mesh', () => {
|
||||
fetchDeadmanStatus,
|
||||
configureDeadman,
|
||||
deadmanCheckin,
|
||||
assistantStatus,
|
||||
fetchAssistantStatus,
|
||||
configureAssistant,
|
||||
scheduledMessages,
|
||||
fetchScheduledMessages,
|
||||
scheduleMessage,
|
||||
cancelScheduledMessage,
|
||||
fetchBlockHeaders,
|
||||
relayTransaction,
|
||||
relayLightning,
|
||||
|
||||
Reference in New Issue
Block a user