@mushinjs/bot-plugin-flows 0.0.0-stage → 0.2.0-next.20261113103537
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/package.json +51 -3
- package/README.md +0 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Setobox
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Context } from "@mushinjs/core";
|
|
2
|
+
export declare const name = "flows";
|
|
3
|
+
export declare const inject: string[];
|
|
4
|
+
/** Flows run before plugins with the default priority, such as LLM chat. */
|
|
5
|
+
export declare const PRIORITY = 10;
|
|
6
|
+
export declare function apply(ctx: Context): void;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
const name = "flows";
|
|
3
|
+
const inject = ["bot", "flows"];
|
|
4
|
+
/** Flows run before plugins with the default priority, such as LLM chat. */
|
|
5
|
+
const PRIORITY = 10;
|
|
6
|
+
function apply(ctx) {
|
|
7
|
+
ctx.bot.middleware(async (session, next) => {
|
|
8
|
+
const { consumed } = await ctx.flows.dispatch(ctx, session);
|
|
9
|
+
if (!consumed) return next();
|
|
10
|
+
}, { priority: 10 });
|
|
11
|
+
ctx.bot.defineCommands(() => ctx.flows.commandsOn(ctx.bot.id));
|
|
12
|
+
ctx.flows.useRunner(ctx);
|
|
13
|
+
ctx.bot.onEvent((event) => {
|
|
14
|
+
ctx.flows.dispatchEvent(ctx, event).catch((error) => ctx.logger("flows").warn("event %s: %s", event.name ?? event.type, error));
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
export { PRIORITY, apply, inject, name };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { Context } from '@mushinjs/core'\nimport type {} from '@mushinjs/plugin-bots'\nimport type {} from '@mushinjs/plugin-flows'\n\nexport const name = 'flows'\nexport const inject = ['bot', 'flows']\n\n/** Flows run before plugins with the default priority, such as LLM chat. */\nexport const PRIORITY = 10\n\nexport function apply(ctx: Context) {\n ctx.bot.middleware(async (session, next) => {\n const { consumed } = await ctx.flows.dispatch(ctx, session)\n // A matched trigger keeps the message unless it lets other plugins answer too.\n if (!consumed) return next()\n }, { priority: PRIORITY })\n\n // Command nodes of the flows on this bot show in its /help and command list.\n ctx.bot.defineCommands(() => ctx.flows.commandsOn(ctx.bot.id))\n\n // Event triggers (a member joins, a poke…) and schedule triggers run through this bot.\n ctx.flows.useRunner(ctx)\n ctx.bot.onEvent((event) => {\n ctx.flows.dispatchEvent(ctx, event).catch((error) => ctx.logger('flows').warn('event %s: %s', event.name ?? event.type, error))\n })\n}\n"],"mappings":";AAIA,MAAa,OAAO;AACpB,MAAa,SAAS,CAAC,OAAO,OAAO;;AAGrC,MAAa,WAAW;AAExB,SAAgB,MAAM,KAAc;CAClC,IAAI,IAAI,WAAW,OAAO,SAAS,SAAS;EAC1C,MAAM,EAAE,aAAa,MAAM,IAAI,MAAM,SAAS,KAAK,OAAO;EAE1D,IAAI,CAAC,UAAU,OAAO,KAAK;CAC7B,GAAG,EAAE,UAAA,GAAmB,CAAC;CAGzB,IAAI,IAAI,qBAAqB,IAAI,MAAM,WAAW,IAAI,IAAI,EAAE,CAAC;CAG7D,IAAI,MAAM,UAAU,GAAG;CACvB,IAAI,IAAI,SAAS,UAAU;EACzB,IAAI,MAAM,cAAc,KAAK,KAAK,CAAC,CAAC,OAAO,UAAU,IAAI,OAAO,OAAO,CAAC,CAAC,KAAK,gBAAgB,MAAM,QAAQ,MAAM,MAAM,KAAK,CAAC;CAChI,CAAC;AACH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,54 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mushinjs/bot-plugin-flows",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.2.0-next.20261113103537",
|
|
4
|
+
"description": "Runs the conversation flows attached to a bot",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/mushinjs/mushin.git",
|
|
10
|
+
"directory": "packages/bot-plugin-flows"
|
|
11
|
+
},
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./package.json": "./package.json"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"mushin-plugin"
|
|
27
|
+
],
|
|
28
|
+
"mushin": {
|
|
29
|
+
"kind": "bot",
|
|
30
|
+
"platforms": [
|
|
31
|
+
"onebot"
|
|
32
|
+
],
|
|
33
|
+
"category": "flows",
|
|
34
|
+
"displayName": {
|
|
35
|
+
"en": "Conversation flows",
|
|
36
|
+
"zh-CN": "对话流程"
|
|
37
|
+
},
|
|
38
|
+
"description": {
|
|
39
|
+
"en": "Runs the flows attached to this bot, before other plugins see the message",
|
|
40
|
+
"zh-CN": "运行绑定到此机器人的流程,先于其他插件处理消息"
|
|
41
|
+
},
|
|
42
|
+
"requires": {
|
|
43
|
+
"plugins": {
|
|
44
|
+
"@mushinjs/plugin-bots": "*",
|
|
45
|
+
"@mushinjs/plugin-flows": "*"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@mushinjs/core": "0.2.0-next.20261113103537",
|
|
51
|
+
"@mushinjs/plugin-bots": "0.2.0-next.20261113103537",
|
|
52
|
+
"@mushinjs/plugin-flows": "0.2.0-next.20261113103537"
|
|
53
|
+
}
|
|
6
54
|
}
|
package/README.md
DELETED