@zbruceli/openclaw-dchat 0.1.10 → 0.1.11
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 +29 -2
package/package.json
CHANGED
package/src/channel.ts
CHANGED
|
@@ -5,15 +5,42 @@ import {
|
|
|
5
5
|
buildChannelConfigSchema,
|
|
6
6
|
collectStatusIssuesFromLastError,
|
|
7
7
|
createDefaultChannelRuntimeState,
|
|
8
|
-
createScopedPairingAccess,
|
|
9
8
|
DEFAULT_ACCOUNT_ID,
|
|
10
9
|
deleteAccountFromConfigSection,
|
|
11
|
-
formatPairingApproveHint,
|
|
12
10
|
normalizeAccountId,
|
|
13
11
|
resolveSenderCommandAuthorization,
|
|
14
12
|
setAccountEnabledInConfigSection,
|
|
15
13
|
type ChannelPlugin,
|
|
16
14
|
} from "openclaw/plugin-sdk";
|
|
15
|
+
import type { PluginRuntime } from "openclaw/plugin-sdk";
|
|
16
|
+
|
|
17
|
+
/* ── Inline helpers that may not exist in older OpenClaw versions ── */
|
|
18
|
+
|
|
19
|
+
function createScopedPairingAccess(params: {
|
|
20
|
+
core: PluginRuntime;
|
|
21
|
+
channel: string;
|
|
22
|
+
accountId: string;
|
|
23
|
+
}) {
|
|
24
|
+
const resolvedAccountId = normalizeAccountId(params.accountId);
|
|
25
|
+
return {
|
|
26
|
+
accountId: resolvedAccountId,
|
|
27
|
+
readAllowFromStore: () =>
|
|
28
|
+
params.core.channel.pairing.readAllowFromStore({
|
|
29
|
+
channel: params.channel,
|
|
30
|
+
accountId: resolvedAccountId,
|
|
31
|
+
}),
|
|
32
|
+
upsertPairingRequest: (input: { id: string; meta?: Record<string, unknown> }) =>
|
|
33
|
+
params.core.channel.pairing.upsertPairingRequest({
|
|
34
|
+
channel: params.channel,
|
|
35
|
+
accountId: resolvedAccountId,
|
|
36
|
+
...input,
|
|
37
|
+
}),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function formatPairingApproveHint(channelId: string): string {
|
|
42
|
+
return `Approve via: openclaw pairing list ${channelId} / openclaw pairing approve ${channelId} <code>`;
|
|
43
|
+
}
|
|
17
44
|
import {
|
|
18
45
|
type CoreConfig,
|
|
19
46
|
DchatConfigSchema,
|