feat(plugin-sdk): many more initial impl

This commit is contained in:
Neko Ayaka
2026-02-07 03:31:43 +08:00
parent dd92fb8f1c
commit 795e12f13b
30 changed files with 867 additions and 3 deletions
@@ -0,0 +1,2 @@
export { channels } from '../../../channels'
export * from './resources'
@@ -0,0 +1 @@
export { providers } from './providers'
@@ -0,0 +1,13 @@
import { defineInvoke } from '@moeru/eventa'
import { channels } from '../../../../../channels'
import { protocolListProviders } from '../../../protocol/resources/providers'
export async function listProviders() {
const func = defineInvoke(channels.data, protocolListProviders)
return func()
}
export const providers = {
listProviders,
}
@@ -0,0 +1,2 @@
export * from './client'
export * from './protocol'
@@ -0,0 +1 @@
export * from './resources'
@@ -0,0 +1 @@
export { protocolProviders } from './providers'
@@ -0,0 +1,7 @@
import { defineInvokeEventa } from '@moeru/eventa'
export const protocolListProviders = defineInvokeEventa<{ name: string }[]>('proj-airi:plugin-sdk:apis:protocol:resources:providers:list-providers')
export const protocolProviders = {
listProviders: protocolListProviders,
}
+13
View File
@@ -0,0 +1,13 @@
import type { Plugin } from './shared'
export function definePlugin(name: string, version: string, setup: () => Promise<Plugin> | Plugin): {
name: string
version: string
setup: () => Promise<Plugin> | Plugin
} {
return {
name,
version,
setup,
}
}
+2
View File
@@ -0,0 +1,2 @@
export * from './apis'
export * from './define'
@@ -0,0 +1,9 @@
/**
* Setup the local plugin scope.
*
* TODO: now sure how this should be implemented, but perhaps it should call packages/plugin-sdk/src/channels to setup local channels
* first? Then probably some other initialization steps.
*/
export async function setupLocalPluginScope() {
}
@@ -0,0 +1,9 @@
/**
* Setup the remote plugin scope.
*
* TODO: now sure how this should be implemented, but perhaps it should call packages/plugin-sdk/src/channels to setup remote channels
* first? Then probably some other initialization steps.
*/
export async function setupRemotePluginScope() {
}
+16
View File
@@ -0,0 +1,16 @@
import type { ChannelControlPlane } from '../channels/shared'
export interface ContextInit {
host: ChannelControlPlane
}
export interface Plugin {
/**
*
*/
init?: (initContext: ContextInit) => Promise<void | undefined | false>
/**
*
*/
setupModules?: () => Promise<void | undefined>
}