refactor: trim nextcloud talk helper exports

This commit is contained in:
Peter Steinberger
2026-05-01 16:50:12 +01:00
parent 51affb81b9
commit e7f47f61ab
7 changed files with 21 additions and 28 deletions

View File

@@ -10,7 +10,7 @@ import { requireChannelOpenAllowFrom } from "openclaw/plugin-sdk/extension-share
import { z } from "openclaw/plugin-sdk/zod";
import { buildSecretInputSchema } from "./secret-input.js";
export const NextcloudTalkRoomSchema = z
const NextcloudTalkRoomSchema = z
.object({
requireMention: z.boolean().optional(),
tools: ToolPolicySchema,
@@ -29,7 +29,7 @@ const NextcloudTalkNetworkSchema = z
.strict()
.optional();
export const NextcloudTalkAccountSchemaBase = z
const NextcloudTalkAccountSchemaBase = z
.object({
name: z.string().optional(),
enabled: z.boolean().optional(),
@@ -55,17 +55,15 @@ export const NextcloudTalkAccountSchemaBase = z
})
.strict();
export const NextcloudTalkAccountSchema = NextcloudTalkAccountSchemaBase.superRefine(
(value, ctx) => {
requireChannelOpenAllowFrom({
channel: "nextcloud-talk",
policy: value.dmPolicy,
allowFrom: value.allowFrom,
ctx,
requireOpenAllowFrom,
});
},
);
const NextcloudTalkAccountSchema = NextcloudTalkAccountSchemaBase.superRefine((value, ctx) => {
requireChannelOpenAllowFrom({
channel: "nextcloud-talk",
policy: value.dmPolicy,
allowFrom: value.allowFrom,
ctx,
requireOpenAllowFrom,
});
});
export const NextcloudTalkConfigSchema = NextcloudTalkAccountSchemaBase.extend({
accounts: z.record(z.string(), NextcloudTalkAccountSchema.optional()).optional(),

View File

@@ -24,7 +24,7 @@ function normalizeOrigin(value: string): string | null {
}
}
export type NextcloudTalkMonitorOptions = {
type NextcloudTalkMonitorOptions = {
accountId?: string;
config?: CoreConfig;
runtime?: RuntimeEnv;

View File

@@ -3,7 +3,7 @@ import { afterEach } from "vitest";
import { createNextcloudTalkWebhookServer } from "./monitor.js";
import type { NextcloudTalkWebhookServerOptions } from "./types.js";
export type WebhookHarness = {
type WebhookHarness = {
webhookUrl: string;
stop: () => Promise<void>;
};
@@ -19,7 +19,7 @@ afterEach(async () => {
}
});
export type StartWebhookServerParams = Omit<
type StartWebhookServerParams = Omit<
NextcloudTalkWebhookServerOptions,
"port" | "host" | "path" | "secret"
> & {

View File

@@ -44,7 +44,7 @@ export function resolveNextcloudTalkAllowlistMatch(params: {
return { allowed: false };
}
export type NextcloudTalkRoomMatch = {
type NextcloudTalkRoomMatch = {
roomConfig?: NextcloudTalkRoomConfig;
wildcardConfig?: NextcloudTalkRoomConfig;
roomKey?: string;

View File

@@ -22,7 +22,7 @@ function buildReplayKey(params: { roomToken: string; messageId: string }): strin
return `${roomToken}:${messageId}`;
}
export type NextcloudTalkReplayGuardOptions = {
type NextcloudTalkReplayGuardOptions = {
stateDir?: string;
ttlMs?: number;
memoryMaxSize?: number;

View File

@@ -11,7 +11,6 @@ import { resolveNextcloudTalkAccount } from "./accounts.js";
import {
clearNextcloudTalkAccountFields,
nextcloudTalkDmPolicy,
nextcloudTalkSetupAdapter,
normalizeNextcloudTalkBaseUrl,
setNextcloudTalkAccountConfig,
validateNextcloudTalkBaseUrl,
@@ -189,5 +188,3 @@ export const nextcloudTalkSetupWizard: ChannelSetupWizard = {
dmPolicy: nextcloudTalkDmPolicy,
disable: (cfg) => setSetupChannelEnabled(cfg, channel, false),
};
export { nextcloudTalkSetupAdapter };

View File

@@ -6,8 +6,6 @@ import type {
SecretInput,
} from "../runtime-api.js";
export type { DmPolicy, GroupPolicy };
export type NextcloudTalkRoomConfig = {
requireMention?: boolean;
/** Optional tool policy overrides for this room. */
@@ -22,7 +20,7 @@ export type NextcloudTalkRoomConfig = {
systemPrompt?: string;
};
export type NextcloudTalkNetworkConfig = {
type NextcloudTalkNetworkConfig = {
/** Dangerous opt-in for self-hosted Nextcloud Talk on trusted private/internal hosts. */
dangerouslyAllowPrivateNetwork?: boolean;
};
@@ -84,7 +82,7 @@ export type NextcloudTalkAccountConfig = {
network?: NextcloudTalkNetworkConfig;
};
export type NextcloudTalkConfig = {
type NextcloudTalkConfig = {
/** Optional per-account Nextcloud Talk configuration (multi-account). */
accounts?: Record<string, NextcloudTalkAccountConfig>;
/** Optional default account id when multiple accounts are configured. */
@@ -104,7 +102,7 @@ export type CoreConfig = {
*/
/** Actor in the activity (the message sender). */
export type NextcloudTalkActor = {
type NextcloudTalkActor = {
type: "Person";
/** User ID in Nextcloud. */
id: string;
@@ -113,7 +111,7 @@ export type NextcloudTalkActor = {
};
/** The message object in the activity. */
export type NextcloudTalkObject = {
type NextcloudTalkObject = {
type: "Note";
/** Message ID. */
id: string;
@@ -126,7 +124,7 @@ export type NextcloudTalkObject = {
};
/** Target conversation/room. */
export type NextcloudTalkTarget = {
type NextcloudTalkTarget = {
type: "Collection";
/** Room token. */
id: string;