@marswave/cola-plugin-sdk
Advanced tools
@@ -1,2 +0,2 @@ | ||
| export { type Plugin, type PluginMeta, type PluginLogger, type PluginErrorOrigin, type PluginErrorClassification, type PluginRuntime, type PluginEvents, type PluginSessionEvent, type PluginEventHandler, type SessionId, type ChannelSender, type InboundDeliveryContext, type DeliveryContext, type PluginCommandContext, type PluginCommandResult, type PluginCommandDefinition, type ChannelDefinition, type ChannelMeta, type ChannelCapabilities, type ChannelGatewayAdapter, type ChannelStatusResult, type GatewayContext, type ChannelOutboundAdapter, type OutboundContext, type ReactionAction, type ReactionContext, type ChannelAuthAdapter, type AuthContext, type ChannelConfigAdapter, type ChannelConfigField, type ChannelConfigFieldOption, type ChannelConfigSchema, type ChannelAgentPromptAdapter, type ChannelAgentTool, type ChannelAgentToolContext, type ChannelAgentToolResult, type PluginTool, type PluginToolScope, type PluginToolContext, type PluginToolResult, type PluginStartContext, type PluginEventScope, type PluginEventSubscribeOptions, type PluginSessionEventOrigin, type PluginToolContent, type PromptContext, type DeliverPayload, type DeliverFn, type SttLanguage, type SttStream, type PluginStt, type TtsLanguage, type PluginTts } from './types.js'; | ||
| export { type Plugin, type PluginMeta, type PluginLogger, type PluginErrorOrigin, type PluginErrorClassification, type PluginRuntime, type PluginEvents, type PluginSessionEvent, type PluginEventHandler, type SessionId, type ChannelSender, type InboundDeliveryContext, type DeliveryContext, type PluginCommandContext, type PluginCommandResult, type PluginCommandDefinition, type ChannelDefinition, type ChannelMeta, type ChannelCapabilities, type ChannelGatewayAdapter, type ChannelStatusResult, type GatewayContext, type ChannelMediaKind, type ChannelMediaCapabilities, type ChannelOutboundAdapter, type OutboundContext, type ReactionAction, type ReactionContext, type ChannelAuthAdapter, type AuthContext, type ChannelConfigAdapter, type ChannelConfigField, type ChannelConfigFieldOption, type ChannelConfigSchema, type ChannelAgentPromptAdapter, type ChannelAgentTool, type ChannelAgentToolContext, type ChannelAgentToolResult, type PluginTool, type PluginToolScope, type PluginToolContext, type PluginToolResult, type PluginStartContext, type PluginEventScope, type PluginEventSubscribeOptions, type PluginSessionEventOrigin, type PluginToolContent, type PromptContext, type DeliverPayload, type DeliverFn, type SttLanguage, type SttStream, type PluginStt, type TtsLanguage, type PluginTts } from './types.js'; | ||
| export { createPollLoop, withBackoff } from './helpers.js'; | ||
@@ -3,0 +3,0 @@ import type { Plugin, ChannelDefinition, PluginCommandDefinition } from './types.js'; |
@@ -303,2 +303,9 @@ export type PluginErrorOrigin = 'app' | 'infra' | 'agent' | 'unknown'; | ||
| }; | ||
| export type ChannelMediaKind = 'image' | 'video' | 'audio' | 'file'; | ||
| export type ChannelMediaCapabilities = { | ||
| maxBytesPerFile?: number; | ||
| maxBytesTotal?: number; | ||
| maxCount?: number; | ||
| supportedKinds?: ChannelMediaKind[]; | ||
| }; | ||
| export type ChannelOutboundAdapter = { | ||
@@ -310,2 +317,3 @@ sendText(ctx: OutboundContext): Promise<void>; | ||
| }): Promise<void>; | ||
| mediaCapabilities?: ChannelMediaCapabilities; | ||
| sendTyping?(ctx: OutboundContext & { | ||
@@ -312,0 +320,0 @@ active: boolean; |
+6
-7
| { | ||
| "name": "@marswave/cola-plugin-sdk", | ||
| "version": "0.0.3-beta.0", | ||
| "version": "0.0.3", | ||
| "description": "SDK for building Cola channel plugins that connect external messaging platforms to Cola.", | ||
@@ -25,7 +25,2 @@ "license": "MIT", | ||
| ], | ||
| "scripts": { | ||
| "prepublishOnly": "node --run build", | ||
| "build": "del-cli distribution && tsc", | ||
| "test": "tsc --noEmit" | ||
| }, | ||
| "devDependencies": { | ||
@@ -36,3 +31,7 @@ "@sindresorhus/tsconfig": "^8.1.0", | ||
| "typescript": "^6.0.3" | ||
| }, | ||
| "scripts": { | ||
| "build": "del-cli distribution && tsc", | ||
| "test": "tsc --noEmit" | ||
| } | ||
| } | ||
| } |
+15
-3
@@ -104,3 +104,3 @@ # Cola Plugin SDK | ||
| "dependencies": { | ||
| "@marswave/cola-plugin-sdk": "^0.0.2" | ||
| "@marswave/cola-plugin-sdk": "^0.0.3" | ||
| }, | ||
@@ -110,3 +110,4 @@ "cola": { | ||
| "id": "example", | ||
| "entry": "./dist/index.js" | ||
| "entry": "./dist/index.js", | ||
| "minColaVersion": "0.9.10" | ||
| }, | ||
@@ -126,2 +127,7 @@ "channel": { | ||
| Set `cola.plugin.minColaVersion`, for example `"0.9.10"`, only when the plugin | ||
| uses runtime features that require a specific Cola app release. The plugin's own | ||
| package version and `@marswave/cola-plugin-sdk` dependency version do not force | ||
| users to update Cola by themselves. | ||
| ## Core Concepts | ||
@@ -146,2 +152,8 @@ | ||
| For media delivery, implement `sendMedia()` and declare `mediaCapabilities`. | ||
| `supportedKinds` narrows uploads to `'image'`, `'video'`, `'audio'`, and/or | ||
| `'file'`; omit it to accept every kind already enabled in `capabilities.send`. | ||
| Use `maxBytesPerFile`, `maxBytesTotal`, and `maxCount` to publish the platform | ||
| limits Cola should enforce before calling your adapter. | ||
| ### Auth And Identity | ||
@@ -181,3 +193,3 @@ | ||
| Unauthorized DMs, and groups that @mention the bot but are not authorized, | ||
| receive a rate-limited guidance hint naming the command to run. Override the text | ||
| receive a guidance hint naming the command to run. Override the text | ||
| with `channel.unauthorizedHint(target)`. Manage authorization with | ||
@@ -184,0 +196,0 @@ `cola channel allow / revoke / allow-group / revoke-group / allowlist`. |
+12
-2
@@ -49,2 +49,6 @@ # Cola Plugin SDK 中文说明 | ||
| 只有当插件使用了某个 Cola 版本才提供的运行时能力时,才需要在 | ||
| `cola.plugin.minColaVersion` 声明最低 Cola app 版本,例如 `"0.9.10"`。插件自身版本和 | ||
| `@marswave/cola-plugin-sdk` 依赖版本本身不会要求用户升级 Cola。 | ||
| ## 核心概念 | ||
@@ -66,2 +70,8 @@ | ||
| 如果要发送媒体或文件,实现 `sendMedia()` 并声明 `mediaCapabilities`。 | ||
| `supportedKinds` 可以把上传限制在 `'image'`、`'video'`、`'audio'` 和/或 | ||
| `'file'`;不填则接受 `capabilities.send` 已启用的所有类型。 | ||
| `maxBytesPerFile`、`maxBytesTotal` 和 `maxCount` 用来发布平台限制,Cola 会在 | ||
| 调用 adapter 前先按这些限制筛选。 | ||
| ### Auth 与身份绑定 | ||
@@ -98,4 +108,4 @@ | ||
| 未授信的私聊,以及 @提及了机器人但未授权的群组,会收到限流(默认 10 分钟冷却)的 | ||
| 引导提示,提示里会写明要执行的命令。可用 `channel.unauthorizedHint(target)` 覆盖文案。授权管理 | ||
| 未授信的私聊,以及 @提及了机器人但未授权的群组,会收到引导提示,提示里会写明 | ||
| 要执行的命令。可用 `channel.unauthorizedHint(target)` 覆盖文案。授权管理 | ||
| 命令:`cola channel allow / revoke / allow-group / revoke-group / allowlist`。 | ||
@@ -102,0 +112,0 @@ |
41844
3.9%585
1.39%302
4.14%