@kodelyth/nextcloud-talk 2026.5.39 → 2026.5.42
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/api.ts +1 -0
- package/channel-plugin-api.ts +1 -0
- package/contract-api.ts +4 -0
- package/dist/api.js +2 -0
- package/dist/channel-ej3z6XJ5.js +2094 -0
- package/dist/channel-plugin-api.js +2 -0
- package/dist/contract-api.js +2 -0
- package/dist/doctor-contract-Dia7keG4.js +7 -0
- package/dist/doctor-contract-api.js +2 -0
- package/dist/index.js +22 -0
- package/dist/runtime-api-DCIDXlUd.js +14 -0
- package/dist/runtime-api.js +2 -0
- package/dist/secret-contract-DQ2wQ4m1.js +86 -0
- package/dist/secret-contract-api.js +2 -0
- package/dist/setup-entry.js +15 -0
- package/doctor-contract-api.ts +1 -0
- package/index.ts +20 -0
- package/klaw.plugin.json +2 -799
- package/package.json +4 -4
- package/runtime-api.ts +29 -0
- package/secret-contract-api.ts +5 -0
- package/setup-entry.ts +13 -0
- package/src/accounts.test.ts +31 -0
- package/src/accounts.ts +149 -0
- package/src/api-credentials.ts +31 -0
- package/src/approval-auth.test.ts +17 -0
- package/src/approval-auth.ts +27 -0
- package/src/bot-preflight.test.ts +135 -0
- package/src/bot-preflight.ts +183 -0
- package/src/channel-api.ts +5 -0
- package/src/channel.adapters.ts +52 -0
- package/src/channel.core.test.ts +75 -0
- package/src/channel.lifecycle.test.ts +91 -0
- package/src/channel.status.test.ts +28 -0
- package/src/channel.ts +225 -0
- package/src/config-schema.ts +79 -0
- package/src/core.test.ts +325 -0
- package/src/doctor-contract.ts +9 -0
- package/src/doctor.test.ts +87 -0
- package/src/doctor.ts +40 -0
- package/src/gateway.ts +109 -0
- package/src/inbound.authz.test.ts +146 -0
- package/src/inbound.behavior.test.ts +309 -0
- package/src/inbound.ts +392 -0
- package/src/message-actions.test.ts +270 -0
- package/src/message-actions.ts +82 -0
- package/src/message-adapter.ts +28 -0
- package/src/monitor-runtime.ts +138 -0
- package/src/monitor.replay.test.ts +276 -0
- package/src/monitor.test-fixtures.ts +30 -0
- package/src/monitor.test-harness.ts +59 -0
- package/src/monitor.ts +385 -0
- package/src/normalize.ts +44 -0
- package/src/policy.ts +111 -0
- package/src/replay-guard.ts +128 -0
- package/src/room-info.test.ts +160 -0
- package/src/room-info.ts +130 -0
- package/src/runtime.ts +9 -0
- package/src/secret-contract.ts +103 -0
- package/src/secret-input.ts +4 -0
- package/src/send.cfg-threading.test.ts +359 -0
- package/src/send.runtime.ts +8 -0
- package/src/send.ts +269 -0
- package/src/session-route.ts +40 -0
- package/src/setup-core.ts +250 -0
- package/src/setup-surface.ts +195 -0
- package/src/setup.test.ts +445 -0
- package/src/signature.ts +82 -0
- package/src/types.ts +195 -0
- package/tsconfig.json +16 -0
- package/api.js +0 -7
- package/channel-plugin-api.js +0 -7
- package/contract-api.js +0 -7
- package/doctor-contract-api.js +0 -7
- package/index.js +0 -7
- package/runtime-api.js +0 -7
- package/secret-contract-api.js +0 -7
- package/setup-entry.js +0 -7
package/src/types.ts
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import type { MessageReceipt } from "klaw/plugin-sdk/channel-message";
|
|
2
|
+
import type {
|
|
3
|
+
BlockStreamingCoalesceConfig,
|
|
4
|
+
DmConfig,
|
|
5
|
+
DmPolicy,
|
|
6
|
+
GroupPolicy,
|
|
7
|
+
SecretInput,
|
|
8
|
+
} from "../runtime-api.js";
|
|
9
|
+
|
|
10
|
+
export type NextcloudTalkRoomConfig = {
|
|
11
|
+
requireMention?: boolean;
|
|
12
|
+
/** Optional tool policy overrides for this room. */
|
|
13
|
+
tools?: { allow?: string[]; deny?: string[] };
|
|
14
|
+
/** If specified, only load these skills for this room. Omit = all skills; empty = no skills. */
|
|
15
|
+
skills?: string[];
|
|
16
|
+
/** If false, disable the bot for this room. */
|
|
17
|
+
enabled?: boolean;
|
|
18
|
+
/** Optional allowlist for room senders (user ids). */
|
|
19
|
+
allowFrom?: string[];
|
|
20
|
+
/** Optional system prompt snippet for this room. */
|
|
21
|
+
systemPrompt?: string;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
type NextcloudTalkNetworkConfig = {
|
|
25
|
+
/** Dangerous opt-in for self-hosted Nextcloud Talk on trusted private/internal hosts. */
|
|
26
|
+
dangerouslyAllowPrivateNetwork?: boolean;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export type NextcloudTalkAccountConfig = {
|
|
30
|
+
/** Optional display name for this account (used in CLI/UI lists). */
|
|
31
|
+
name?: string;
|
|
32
|
+
/** If false, do not start this Nextcloud Talk account. Default: true. */
|
|
33
|
+
enabled?: boolean;
|
|
34
|
+
/** Base URL of the Nextcloud instance (e.g., "https://cloud.example.com"). */
|
|
35
|
+
baseUrl?: string;
|
|
36
|
+
/** Bot shared secret from occ talk:bot:install output. */
|
|
37
|
+
botSecret?: SecretInput;
|
|
38
|
+
/** Path to file containing bot secret (for secret managers). */
|
|
39
|
+
botSecretFile?: string;
|
|
40
|
+
/** Optional API user for room lookups (DM detection). */
|
|
41
|
+
apiUser?: string;
|
|
42
|
+
/** Optional API password/app password for room lookups. */
|
|
43
|
+
apiPassword?: SecretInput;
|
|
44
|
+
/** Path to file containing API password/app password. */
|
|
45
|
+
apiPasswordFile?: string;
|
|
46
|
+
/** Direct message policy (default: pairing). */
|
|
47
|
+
dmPolicy?: DmPolicy;
|
|
48
|
+
/** Webhook server port. Default: 8788. */
|
|
49
|
+
webhookPort?: number;
|
|
50
|
+
/** Webhook server host. Default: "0.0.0.0". */
|
|
51
|
+
webhookHost?: string;
|
|
52
|
+
/** Webhook endpoint path. Default: "/nextcloud-talk-webhook". */
|
|
53
|
+
webhookPath?: string;
|
|
54
|
+
/** Public URL for the webhook (used if behind reverse proxy). */
|
|
55
|
+
webhookPublicUrl?: string;
|
|
56
|
+
/** Optional allowlist of user IDs allowed to DM the bot. */
|
|
57
|
+
allowFrom?: string[];
|
|
58
|
+
/** Optional allowlist for Nextcloud Talk room senders (user ids). */
|
|
59
|
+
groupAllowFrom?: string[];
|
|
60
|
+
/** Group message policy (default: allowlist). */
|
|
61
|
+
groupPolicy?: GroupPolicy;
|
|
62
|
+
/** Per-room configuration (key is room token). */
|
|
63
|
+
rooms?: Record<string, NextcloudTalkRoomConfig>;
|
|
64
|
+
/** Max group messages to keep as history context (0 disables). */
|
|
65
|
+
historyLimit?: number;
|
|
66
|
+
/** Max DM turns to keep as history context. */
|
|
67
|
+
dmHistoryLimit?: number;
|
|
68
|
+
/** Per-DM config overrides keyed by user ID. */
|
|
69
|
+
dms?: Record<string, DmConfig>;
|
|
70
|
+
/** Outbound text chunk size (chars). Default: 4000. */
|
|
71
|
+
textChunkLimit?: number;
|
|
72
|
+
/** Chunking mode: "length" (default) splits by size; "newline" splits on every newline. */
|
|
73
|
+
chunkMode?: "length" | "newline";
|
|
74
|
+
/** Disable block streaming for this account. */
|
|
75
|
+
blockStreaming?: boolean;
|
|
76
|
+
/** Merge streamed block replies before sending. */
|
|
77
|
+
blockStreamingCoalesce?: BlockStreamingCoalesceConfig;
|
|
78
|
+
/** Outbound response prefix override for this channel/account. */
|
|
79
|
+
responsePrefix?: string;
|
|
80
|
+
/** Media upload max size in MB. */
|
|
81
|
+
mediaMaxMb?: number;
|
|
82
|
+
/** Network policy overrides for self-hosted Nextcloud Talk on trusted private/internal hosts. */
|
|
83
|
+
network?: NextcloudTalkNetworkConfig;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
type NextcloudTalkConfig = {
|
|
87
|
+
/** Optional per-account Nextcloud Talk configuration (multi-account). */
|
|
88
|
+
accounts?: Record<string, NextcloudTalkAccountConfig>;
|
|
89
|
+
/** Optional default account id when multiple accounts are configured. */
|
|
90
|
+
defaultAccount?: string;
|
|
91
|
+
} & NextcloudTalkAccountConfig;
|
|
92
|
+
|
|
93
|
+
export type CoreConfig = {
|
|
94
|
+
channels?: {
|
|
95
|
+
"nextcloud-talk"?: NextcloudTalkConfig;
|
|
96
|
+
};
|
|
97
|
+
[key: string]: unknown;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Nextcloud Talk webhook payload types based on Activity Streams 2.0 format.
|
|
102
|
+
* Reference: https://nextcloud-talk.readthedocs.io/en/latest/bots/
|
|
103
|
+
*/
|
|
104
|
+
|
|
105
|
+
/** Actor in the activity (the message sender). */
|
|
106
|
+
type NextcloudTalkActor = {
|
|
107
|
+
type: "Person";
|
|
108
|
+
/** User ID in Nextcloud. */
|
|
109
|
+
id: string;
|
|
110
|
+
/** Display name of the user. */
|
|
111
|
+
name: string;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
/** The message object in the activity. */
|
|
115
|
+
type NextcloudTalkObject = {
|
|
116
|
+
type: "Note";
|
|
117
|
+
/** Message ID. */
|
|
118
|
+
id: string;
|
|
119
|
+
/** Message text (same as content for text/plain). */
|
|
120
|
+
name: string;
|
|
121
|
+
/** Message content. */
|
|
122
|
+
content: string;
|
|
123
|
+
/** Media type of the content. */
|
|
124
|
+
mediaType: string;
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
/** Target conversation/room. */
|
|
128
|
+
type NextcloudTalkTarget = {
|
|
129
|
+
type: "Collection";
|
|
130
|
+
/** Room token. */
|
|
131
|
+
id: string;
|
|
132
|
+
/** Room display name. */
|
|
133
|
+
name: string;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
/** Incoming webhook payload from Nextcloud Talk. */
|
|
137
|
+
export type NextcloudTalkWebhookPayload = {
|
|
138
|
+
type: "Create" | "Update" | "Delete";
|
|
139
|
+
actor: NextcloudTalkActor;
|
|
140
|
+
object: NextcloudTalkObject;
|
|
141
|
+
target: NextcloudTalkTarget;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
/** Result from sending a message to Nextcloud Talk. */
|
|
145
|
+
export type NextcloudTalkSendResult = {
|
|
146
|
+
messageId: string;
|
|
147
|
+
roomToken: string;
|
|
148
|
+
receipt: MessageReceipt;
|
|
149
|
+
timestamp?: number;
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
/** Parsed incoming message context. */
|
|
153
|
+
export type NextcloudTalkInboundMessage = {
|
|
154
|
+
messageId: string;
|
|
155
|
+
roomToken: string;
|
|
156
|
+
roomName: string;
|
|
157
|
+
senderId: string;
|
|
158
|
+
senderName: string;
|
|
159
|
+
text: string;
|
|
160
|
+
mediaType: string;
|
|
161
|
+
timestamp: number;
|
|
162
|
+
isGroupChat: boolean;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
/** Headers sent by Nextcloud Talk webhook. */
|
|
166
|
+
export type NextcloudTalkWebhookHeaders = {
|
|
167
|
+
/** HMAC-SHA256 signature of the request. */
|
|
168
|
+
signature: string;
|
|
169
|
+
/** Random string used in signature calculation. */
|
|
170
|
+
random: string;
|
|
171
|
+
/** Backend Nextcloud server URL. */
|
|
172
|
+
backend: string;
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
/** Options for the webhook server. */
|
|
176
|
+
export type NextcloudTalkWebhookServerOptions = {
|
|
177
|
+
port: number;
|
|
178
|
+
host: string;
|
|
179
|
+
path: string;
|
|
180
|
+
secret: string;
|
|
181
|
+
maxBodyBytes?: number;
|
|
182
|
+
authRateLimit?: {
|
|
183
|
+
maxRequests?: number;
|
|
184
|
+
windowMs?: number;
|
|
185
|
+
};
|
|
186
|
+
readBody?: (req: import("node:http").IncomingMessage, maxBodyBytes: number) => Promise<string>;
|
|
187
|
+
isBackendAllowed?: (backend: string) => boolean;
|
|
188
|
+
shouldProcessMessage?: (message: NextcloudTalkInboundMessage) => boolean | Promise<boolean>;
|
|
189
|
+
processMessage?: (
|
|
190
|
+
message: NextcloudTalkInboundMessage,
|
|
191
|
+
) => void | "processed" | "duplicate" | Promise<void | "processed" | "duplicate">;
|
|
192
|
+
onMessage: (message: NextcloudTalkInboundMessage) => void | Promise<void>;
|
|
193
|
+
onError?: (error: Error) => void;
|
|
194
|
+
abortSignal?: AbortSignal;
|
|
195
|
+
};
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../tsconfig.package-boundary.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"rootDir": "."
|
|
5
|
+
},
|
|
6
|
+
"include": ["./*.ts", "./src/**/*.ts"],
|
|
7
|
+
"exclude": [
|
|
8
|
+
"./**/*.test.ts",
|
|
9
|
+
"./dist/**",
|
|
10
|
+
"./node_modules/**",
|
|
11
|
+
"./src/test-support/**",
|
|
12
|
+
"./src/**/*test-helpers.ts",
|
|
13
|
+
"./src/**/*test-harness.ts",
|
|
14
|
+
"./src/**/*test-support.ts"
|
|
15
|
+
]
|
|
16
|
+
}
|
package/api.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * from "../../../dist/extensions/nextcloud-talk/api.js";
|
|
2
|
-
import * as module from "../../../dist/extensions/nextcloud-talk/api.js";
|
|
3
|
-
let defaultExport = "default" in module ? module.default : module;
|
|
4
|
-
for (let index = 0; index < 4 && defaultExport && typeof defaultExport === "object" && "default" in defaultExport; index += 1) {
|
|
5
|
-
defaultExport = defaultExport.default;
|
|
6
|
-
}
|
|
7
|
-
export { defaultExport as default };
|
package/channel-plugin-api.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * from "../../../dist/extensions/nextcloud-talk/channel-plugin-api.js";
|
|
2
|
-
import * as module from "../../../dist/extensions/nextcloud-talk/channel-plugin-api.js";
|
|
3
|
-
let defaultExport = "default" in module ? module.default : module;
|
|
4
|
-
for (let index = 0; index < 4 && defaultExport && typeof defaultExport === "object" && "default" in defaultExport; index += 1) {
|
|
5
|
-
defaultExport = defaultExport.default;
|
|
6
|
-
}
|
|
7
|
-
export { defaultExport as default };
|
package/contract-api.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * from "../../../dist/extensions/nextcloud-talk/contract-api.js";
|
|
2
|
-
import * as module from "../../../dist/extensions/nextcloud-talk/contract-api.js";
|
|
3
|
-
let defaultExport = "default" in module ? module.default : module;
|
|
4
|
-
for (let index = 0; index < 4 && defaultExport && typeof defaultExport === "object" && "default" in defaultExport; index += 1) {
|
|
5
|
-
defaultExport = defaultExport.default;
|
|
6
|
-
}
|
|
7
|
-
export { defaultExport as default };
|
package/doctor-contract-api.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * from "../../../dist/extensions/nextcloud-talk/doctor-contract-api.js";
|
|
2
|
-
import * as module from "../../../dist/extensions/nextcloud-talk/doctor-contract-api.js";
|
|
3
|
-
let defaultExport = "default" in module ? module.default : module;
|
|
4
|
-
for (let index = 0; index < 4 && defaultExport && typeof defaultExport === "object" && "default" in defaultExport; index += 1) {
|
|
5
|
-
defaultExport = defaultExport.default;
|
|
6
|
-
}
|
|
7
|
-
export { defaultExport as default };
|
package/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * from "../../../dist/extensions/nextcloud-talk/index.js";
|
|
2
|
-
import defaultModule from "../../../dist/extensions/nextcloud-talk/index.js";
|
|
3
|
-
let defaultExport = defaultModule;
|
|
4
|
-
for (let index = 0; index < 4 && defaultExport && typeof defaultExport === "object" && "default" in defaultExport; index += 1) {
|
|
5
|
-
defaultExport = defaultExport.default;
|
|
6
|
-
}
|
|
7
|
-
export { defaultExport as default };
|
package/runtime-api.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * from "../../../dist/extensions/nextcloud-talk/runtime-api.js";
|
|
2
|
-
import * as module from "../../../dist/extensions/nextcloud-talk/runtime-api.js";
|
|
3
|
-
let defaultExport = "default" in module ? module.default : module;
|
|
4
|
-
for (let index = 0; index < 4 && defaultExport && typeof defaultExport === "object" && "default" in defaultExport; index += 1) {
|
|
5
|
-
defaultExport = defaultExport.default;
|
|
6
|
-
}
|
|
7
|
-
export { defaultExport as default };
|
package/secret-contract-api.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * from "../../../dist/extensions/nextcloud-talk/secret-contract-api.js";
|
|
2
|
-
import * as module from "../../../dist/extensions/nextcloud-talk/secret-contract-api.js";
|
|
3
|
-
let defaultExport = "default" in module ? module.default : module;
|
|
4
|
-
for (let index = 0; index < 4 && defaultExport && typeof defaultExport === "object" && "default" in defaultExport; index += 1) {
|
|
5
|
-
defaultExport = defaultExport.default;
|
|
6
|
-
}
|
|
7
|
-
export { defaultExport as default };
|
package/setup-entry.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * from "../../../dist/extensions/nextcloud-talk/setup-entry.js";
|
|
2
|
-
import defaultModule from "../../../dist/extensions/nextcloud-talk/setup-entry.js";
|
|
3
|
-
let defaultExport = defaultModule;
|
|
4
|
-
for (let index = 0; index < 4 && defaultExport && typeof defaultExport === "object" && "default" in defaultExport; index += 1) {
|
|
5
|
-
defaultExport = defaultExport.default;
|
|
6
|
-
}
|
|
7
|
-
export { defaultExport as default };
|