@pipes.bot/pipes-bot-channel 0.1.6 → 0.1.7
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/package.json +1 -1
- package/src/channel.ts +19 -11
- package/src/config-schema.ts +6 -0
package/package.json
CHANGED
package/src/channel.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import type { ChannelPlugin, OpenClawConfig } from "openclaw/plugin-sdk";
|
|
1
|
+
import type { ChannelPlugin, ChannelSetupInput, OpenClawConfig } from "openclaw/plugin-sdk";
|
|
2
|
+
import { buildChannelConfigSchema } from "openclaw/plugin-sdk";
|
|
2
3
|
import { getConnectionStatus } from "./status-store.js";
|
|
4
|
+
import { PipesBotConfigSchema } from "./config-schema.js";
|
|
3
5
|
|
|
4
|
-
|
|
6
|
+
type PipesBotSetupInput = ChannelSetupInput & {
|
|
7
|
+
apiKey?: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const CHANNEL_KEY = "pipes-bot";
|
|
5
11
|
|
|
6
12
|
function getChannelConfig(cfg: OpenClawConfig): Record<string, unknown> {
|
|
7
13
|
return ((cfg.channels as Record<string, unknown>)?.[CHANNEL_KEY] ?? {}) as Record<string, unknown>;
|
|
@@ -16,17 +22,13 @@ export function resolveApiKey(cfg: OpenClawConfig): string | undefined {
|
|
|
16
22
|
export const pipesBotChannelPlugin: ChannelPlugin = {
|
|
17
23
|
id: CHANNEL_KEY,
|
|
18
24
|
configSchema: {
|
|
19
|
-
|
|
20
|
-
type: "object",
|
|
21
|
-
properties: {
|
|
22
|
-
token: { type: "string" },
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
+
...buildChannelConfigSchema(PipesBotConfigSchema),
|
|
25
26
|
uiHints: {
|
|
26
|
-
|
|
27
|
+
apiKey: {
|
|
27
28
|
label: "PipesBot API Key",
|
|
28
29
|
sensitive: true,
|
|
29
30
|
placeholder: "pk_...",
|
|
31
|
+
help: "Your PipesBot API key (starts with pk_)",
|
|
30
32
|
},
|
|
31
33
|
},
|
|
32
34
|
},
|
|
@@ -47,8 +49,13 @@ export const pipesBotChannelPlugin: ChannelPlugin = {
|
|
|
47
49
|
config: {
|
|
48
50
|
listAccountIds: () => ["default"],
|
|
49
51
|
resolveAccount: (cfg) => {
|
|
52
|
+
const channelCfg = getChannelConfig(cfg);
|
|
50
53
|
const apiKey = resolveApiKey(cfg);
|
|
51
|
-
return {
|
|
54
|
+
return {
|
|
55
|
+
apiKey,
|
|
56
|
+
enabled: channelCfg.enabled !== false,
|
|
57
|
+
configured: Boolean(apiKey),
|
|
58
|
+
};
|
|
52
59
|
},
|
|
53
60
|
isConfigured: (account) => account.configured,
|
|
54
61
|
},
|
|
@@ -56,6 +63,7 @@ export const pipesBotChannelPlugin: ChannelPlugin = {
|
|
|
56
63
|
setup: {
|
|
57
64
|
resolveAccountId: () => "default",
|
|
58
65
|
applyAccountConfig: ({ cfg, input }) => {
|
|
66
|
+
const setupInput = input as PipesBotSetupInput;
|
|
59
67
|
const base = getChannelConfig(cfg);
|
|
60
68
|
return {
|
|
61
69
|
...cfg,
|
|
@@ -64,7 +72,7 @@ export const pipesBotChannelPlugin: ChannelPlugin = {
|
|
|
64
72
|
[CHANNEL_KEY]: {
|
|
65
73
|
...base,
|
|
66
74
|
enabled: true,
|
|
67
|
-
...(
|
|
75
|
+
...(setupInput.apiKey ? { apiKey: setupInput.apiKey } : {}),
|
|
68
76
|
},
|
|
69
77
|
},
|
|
70
78
|
} as OpenClawConfig;
|