feat(stage-ui,airi-plugin-vscode,server-shared): added spark:notify, spark:emit, spark:command events

This commit is contained in:
Neko Ayaka
2025-12-27 21:20:06 +08:00
parent f07964d307
commit ca7194284b
7 changed files with 129 additions and 19 deletions
+5 -2
View File
@@ -4,6 +4,7 @@ import type { Events } from './types'
import { useLogger } from '@guiiai/logg'
import { ContextUpdateStrategy, Client as ServerClient } from '@proj-airi/server-sdk'
import { nanoid } from 'nanoid'
export class Client {
private client: ServerClient<Events> | null = null
@@ -45,11 +46,13 @@ export class Client {
}
async replaceContext(context: string): Promise<void> {
this.send({ type: 'context:update', data: { strategy: ContextUpdateStrategy.ReplaceSelf, text: context } })
const id = nanoid()
this.send({ type: 'context:update', data: { strategy: ContextUpdateStrategy.ReplaceSelf, text: context, id, contextId: id } })
}
async appendContext(context: string): Promise<void> {
this.send({ type: 'context:update', data: { strategy: ContextUpdateStrategy.AppendSelf, text: context } })
const id = nanoid()
this.send({ type: 'context:update', data: { strategy: ContextUpdateStrategy.AppendSelf, text: context, id, contextId: id } })
}
isConnected(): boolean {