plugin-sensitive-filter-xr 0.1.20 → 0.1.22
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/README.md +3 -5
- package/dist/lib/sensitiveFilter.d.ts.map +1 -1
- package/dist/lib/sensitiveFilter.js +72 -58
- package/dist/lib/types.d.ts +26 -63
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/lib/types.js +0 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
- `beforeAgent`: evaluates and optionally rewrites/blocks input
|
|
11
11
|
- `wrapModelCall`: evaluates and optionally rewrites/blocks output
|
|
12
|
-
- `afterAgent`: sends matched alerts to configured WeCom group webhooks
|
|
12
|
+
- `afterAgent`: writes audit snapshot and sends matched alerts to configured WeCom group webhooks
|
|
13
13
|
|
|
14
14
|
## Configuration
|
|
15
15
|
|
|
@@ -29,9 +29,7 @@
|
|
|
29
29
|
| Field | Type | Required | Default | Description |
|
|
30
30
|
| --- | --- | --- | --- | --- |
|
|
31
31
|
| `enabled` | `boolean` | No | `true` | Turn notification on/off. |
|
|
32
|
-
| `groups` | `Array<{
|
|
33
|
-
| `mentionedList` | `string[]` | No | `[]` | Optional `@member` list. |
|
|
34
|
-
| `mentionedMobileList` | `string[]` | No | `[]` | Optional `@mobile` list. |
|
|
32
|
+
| `groups` | `Array<{webhookUrl}>` | Runtime-required for sending | `[]` | One or more WeCom group webhook targets. |
|
|
35
33
|
| `timeoutMs` | `number` | No | `10000` | Per webhook request timeout (max `120000`). |
|
|
36
34
|
|
|
37
35
|
### Rule Mode (`mode=rule`)
|
|
@@ -102,6 +100,6 @@ Current behavior:
|
|
|
102
100
|
- Ensure `model/scope/rulePrompt` are all present.
|
|
103
101
|
|
|
104
102
|
3. Unexpected rewrites in LLM mode:
|
|
105
|
-
- Check runtime logs for entries with `source=error-policy` and `reason` starting with `llm-error:`.
|
|
103
|
+
- Check audit records or runtime logs for entries with `source=error-policy` and `reason` starting with `llm-error:`.
|
|
106
104
|
|
|
107
105
|
## Validation Commands
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sensitiveFilter.d.ts","sourceRoot":"","sources":["../../src/lib/sensitiveFilter.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAa,oBAAoB,EAA8B,MAAM,kBAAkB,CAAA;AAGnG,OAAO,EACL,eAAe,EAGf,uBAAuB,EACvB,wBAAwB,EAEzB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAML,qBAAqB,EAMtB,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"sensitiveFilter.d.ts","sourceRoot":"","sources":["../../src/lib/sensitiveFilter.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAa,oBAAoB,EAA8B,MAAM,kBAAkB,CAAA;AAGnG,OAAO,EACL,eAAe,EAGf,uBAAuB,EACvB,wBAAwB,EAEzB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAML,qBAAqB,EAMtB,MAAM,YAAY,CAAA;AA07BnB,qBAEa,yBAA0B,YAAW,wBAAwB,CAAC,qBAAqB,CAAC;IAE/F,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAY;IAEvC,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAmQlC;IAEK,gBAAgB,CACpB,OAAO,EAAE,qBAAqB,EAC9B,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,eAAe,CAAC;IAa3B,OAAO,CAAC,wBAAwB;IA2UhC,OAAO,CAAC,uBAAuB;CAwhBhC;AAED,YAAY,EAAE,qBAAqB,EAAE,CAAA"}
|
|
@@ -33,19 +33,6 @@ function toNonEmptyString(value) {
|
|
|
33
33
|
const trimmed = value.trim();
|
|
34
34
|
return trimmed ? trimmed : null;
|
|
35
35
|
}
|
|
36
|
-
function normalizeStringList(value) {
|
|
37
|
-
if (!Array.isArray(value)) {
|
|
38
|
-
return [];
|
|
39
|
-
}
|
|
40
|
-
const unique = new Set();
|
|
41
|
-
for (const item of value) {
|
|
42
|
-
const normalized = toNonEmptyString(item);
|
|
43
|
-
if (normalized) {
|
|
44
|
-
unique.add(normalized);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return [...unique];
|
|
48
|
-
}
|
|
49
36
|
function resolveRuntimeWecomConfig(config) {
|
|
50
37
|
if (!isRecord(config) || config.enabled === false) {
|
|
51
38
|
return null;
|
|
@@ -61,7 +48,6 @@ function resolveRuntimeWecomConfig(config) {
|
|
|
61
48
|
continue;
|
|
62
49
|
}
|
|
63
50
|
groups.push({
|
|
64
|
-
name: toNonEmptyString(item.name) ?? undefined,
|
|
65
51
|
webhookUrl,
|
|
66
52
|
});
|
|
67
53
|
}
|
|
@@ -74,8 +60,6 @@ function resolveRuntimeWecomConfig(config) {
|
|
|
74
60
|
return {
|
|
75
61
|
groups,
|
|
76
62
|
timeoutMs,
|
|
77
|
-
mentionedList: normalizeStringList(config.mentionedList),
|
|
78
|
-
mentionedMobileList: normalizeStringList(config.mentionedMobileList),
|
|
79
63
|
};
|
|
80
64
|
}
|
|
81
65
|
function buildInternalModelConfig(model) {
|
|
@@ -134,22 +118,59 @@ function extractInputText(state, runtime) {
|
|
|
134
118
|
return '';
|
|
135
119
|
}
|
|
136
120
|
function buildMatchedNotificationMessage(input) {
|
|
121
|
+
const modeLabel = input.mode === 'rule' ? '规则模式' : 'LLM 模式';
|
|
122
|
+
const finalActionLabel = input.finalAction === 'block' ? '已拦截' : input.finalAction === 'rewrite' ? '已改写' : '放行';
|
|
123
|
+
const phaseLabel = (phase) => (phase === 'input' ? '输入' : '输出');
|
|
124
|
+
const actionLabel = (action) => {
|
|
125
|
+
if (action === 'block') {
|
|
126
|
+
return '拦截';
|
|
127
|
+
}
|
|
128
|
+
if (action === 'rewrite') {
|
|
129
|
+
return '改写';
|
|
130
|
+
}
|
|
131
|
+
return '未指定';
|
|
132
|
+
};
|
|
133
|
+
const sourceLabel = (source) => {
|
|
134
|
+
if (source === 'rule') {
|
|
135
|
+
return '规则';
|
|
136
|
+
}
|
|
137
|
+
if (source === 'llm') {
|
|
138
|
+
return 'LLM';
|
|
139
|
+
}
|
|
140
|
+
return '异常兜底策略';
|
|
141
|
+
};
|
|
142
|
+
const reasonLabel = (reason) => {
|
|
143
|
+
if (!reason) {
|
|
144
|
+
return '无';
|
|
145
|
+
}
|
|
146
|
+
if (reason.startsWith('rule:')) {
|
|
147
|
+
return `命中规则 ${reason.replace('rule:', '')}`;
|
|
148
|
+
}
|
|
149
|
+
if (reason.startsWith('llm-error:')) {
|
|
150
|
+
return `LLM判定异常: ${reason.replace('llm-error:', '')}`;
|
|
151
|
+
}
|
|
152
|
+
if (reason.startsWith('llm-fail-open:')) {
|
|
153
|
+
return `LLM故障放行: ${reason.replace('llm-fail-open:', '')}`;
|
|
154
|
+
}
|
|
155
|
+
return reason;
|
|
156
|
+
};
|
|
137
157
|
const matched = input.records.filter((entry) => entry.matched);
|
|
138
158
|
const lines = [
|
|
139
|
-
'
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
159
|
+
'【敏感内容告警】',
|
|
160
|
+
`节点:${input.nodeTitle || SENSITIVE_FILTER_MIDDLEWARE_NAME}`,
|
|
161
|
+
`模式:${modeLabel}`,
|
|
162
|
+
`处理结果:${finalActionLabel}`,
|
|
163
|
+
`命中数量:${matched.length}`,
|
|
144
164
|
];
|
|
145
165
|
if (input.runtimeConfigurable?.thread_id) {
|
|
146
|
-
lines.push(
|
|
166
|
+
lines.push(`会话ID:${input.runtimeConfigurable.thread_id}`);
|
|
147
167
|
}
|
|
148
168
|
if (input.runtimeConfigurable?.executionId) {
|
|
149
|
-
lines.push(
|
|
169
|
+
lines.push(`执行ID:${input.runtimeConfigurable.executionId}`);
|
|
150
170
|
}
|
|
171
|
+
lines.push('命中详情:');
|
|
151
172
|
matched.forEach((entry, index) => {
|
|
152
|
-
lines.push(`${index + 1}.
|
|
173
|
+
lines.push(`${index + 1}. 阶段=${phaseLabel(entry.phase)},来源=${sourceLabel(entry.source)},动作=${actionLabel(entry.action)},依据=${reasonLabel(entry.reason)}`);
|
|
153
174
|
});
|
|
154
175
|
return lines.join('\n');
|
|
155
176
|
}
|
|
@@ -612,8 +633,6 @@ async function dispatchWecomNotification(wecomConfig, message) {
|
|
|
612
633
|
msgtype: 'text',
|
|
613
634
|
text: {
|
|
614
635
|
content: message,
|
|
615
|
-
mentioned_list: wecomConfig.mentionedList,
|
|
616
|
-
mentioned_mobile_list: wecomConfig.mentionedMobileList,
|
|
617
636
|
},
|
|
618
637
|
};
|
|
619
638
|
for (const group of wecomConfig.groups) {
|
|
@@ -637,9 +656,8 @@ async function dispatchWecomNotification(wecomConfig, message) {
|
|
|
637
656
|
}
|
|
638
657
|
}
|
|
639
658
|
catch (error) {
|
|
640
|
-
const target = group.name ? `${group.name}(${group.webhookUrl})` : group.webhookUrl;
|
|
641
659
|
// Notify failure should not break model execution.
|
|
642
|
-
console.warn(`[${SENSITIVE_FILTER_MIDDLEWARE_NAME}] Failed to send WeCom notification to ${
|
|
660
|
+
console.warn(`[${SENSITIVE_FILTER_MIDDLEWARE_NAME}] Failed to send WeCom notification to ${group.webhookUrl}: ${getErrorText(error)}`);
|
|
643
661
|
}
|
|
644
662
|
}
|
|
645
663
|
}
|
|
@@ -925,30 +943,12 @@ let SensitiveFilterMiddleware = class SensitiveFilterMiddleware {
|
|
|
925
943
|
type: 'number',
|
|
926
944
|
title: { en_US: 'Timeout (ms)', zh_Hans: '请求超时(毫秒)' },
|
|
927
945
|
},
|
|
928
|
-
mentionedList: {
|
|
929
|
-
type: 'array',
|
|
930
|
-
title: { en_US: 'Mentioned List', zh_Hans: '@成员列表' },
|
|
931
|
-
items: {
|
|
932
|
-
type: 'string',
|
|
933
|
-
},
|
|
934
|
-
},
|
|
935
|
-
mentionedMobileList: {
|
|
936
|
-
type: 'array',
|
|
937
|
-
title: { en_US: 'Mentioned Mobile List', zh_Hans: '@手机号列表' },
|
|
938
|
-
items: {
|
|
939
|
-
type: 'string',
|
|
940
|
-
},
|
|
941
|
-
},
|
|
942
946
|
groups: {
|
|
943
947
|
type: 'array',
|
|
944
948
|
title: { en_US: 'Group Webhooks', zh_Hans: '群聊 Webhook 配置' },
|
|
945
949
|
items: {
|
|
946
950
|
type: 'object',
|
|
947
951
|
properties: {
|
|
948
|
-
name: {
|
|
949
|
-
type: 'string',
|
|
950
|
-
title: { en_US: 'Group Name', zh_Hans: '群名称(可选)' },
|
|
951
|
-
},
|
|
952
952
|
webhookUrl: {
|
|
953
953
|
type: 'string',
|
|
954
954
|
title: { en_US: 'Webhook URL', zh_Hans: 'Webhook 地址' },
|
|
@@ -1243,18 +1243,25 @@ let SensitiveFilterMiddleware = class SensitiveFilterMiddleware {
|
|
|
1243
1243
|
},
|
|
1244
1244
|
afterAgent: async () => {
|
|
1245
1245
|
const matchedRecords = auditEntries.filter((entry) => entry.matched);
|
|
1246
|
-
|
|
1247
|
-
|
|
1246
|
+
const notification = matchedRecords.length > 0
|
|
1247
|
+
? buildMatchedNotificationMessage({
|
|
1248
1248
|
mode: 'rule',
|
|
1249
1249
|
nodeTitle: context.node.title ?? SENSITIVE_FILTER_MIDDLEWARE_NAME,
|
|
1250
1250
|
finalAction,
|
|
1251
1251
|
records: matchedRecords,
|
|
1252
1252
|
runtimeConfigurable,
|
|
1253
|
-
})
|
|
1254
|
-
|
|
1253
|
+
})
|
|
1254
|
+
: null;
|
|
1255
|
+
const [persistResult, notifyResult] = await Promise.allSettled([
|
|
1256
|
+
persistAuditSnapshot(),
|
|
1257
|
+
notification ? dispatchWecomNotification(wecomConfig, notification) : Promise.resolve(undefined),
|
|
1258
|
+
]);
|
|
1259
|
+
if (persistResult.status === 'rejected') {
|
|
1260
|
+
console.warn(`[${SENSITIVE_FILTER_MIDDLEWARE_NAME}] Failed to persist audit snapshot: ${getErrorText(persistResult.reason)}`);
|
|
1261
|
+
}
|
|
1262
|
+
if (notifyResult.status === 'rejected') {
|
|
1263
|
+
console.warn(`[${SENSITIVE_FILTER_MIDDLEWARE_NAME}] Failed to dispatch WeCom notification: ${getErrorText(notifyResult.reason)}`);
|
|
1255
1264
|
}
|
|
1256
|
-
// Keep audit persistence implementation for future fallback.
|
|
1257
|
-
// await persistAuditSnapshot()
|
|
1258
1265
|
return undefined;
|
|
1259
1266
|
},
|
|
1260
1267
|
};
|
|
@@ -1674,18 +1681,25 @@ let SensitiveFilterMiddleware = class SensitiveFilterMiddleware {
|
|
|
1674
1681
|
},
|
|
1675
1682
|
afterAgent: async () => {
|
|
1676
1683
|
const matchedRecords = auditEntries.filter((entry) => entry.matched);
|
|
1677
|
-
|
|
1678
|
-
|
|
1684
|
+
const notification = matchedRecords.length > 0
|
|
1685
|
+
? buildMatchedNotificationMessage({
|
|
1679
1686
|
mode: 'llm',
|
|
1680
1687
|
nodeTitle: context.node.title ?? SENSITIVE_FILTER_MIDDLEWARE_NAME,
|
|
1681
1688
|
finalAction,
|
|
1682
1689
|
records: matchedRecords,
|
|
1683
1690
|
runtimeConfigurable,
|
|
1684
|
-
})
|
|
1685
|
-
|
|
1691
|
+
})
|
|
1692
|
+
: null;
|
|
1693
|
+
const [persistResult, notifyResult] = await Promise.allSettled([
|
|
1694
|
+
persistAuditSnapshot(),
|
|
1695
|
+
notification ? dispatchWecomNotification(wecomConfig, notification) : Promise.resolve(undefined),
|
|
1696
|
+
]);
|
|
1697
|
+
if (persistResult.status === 'rejected') {
|
|
1698
|
+
console.warn(`[${SENSITIVE_FILTER_MIDDLEWARE_NAME}] Failed to persist audit snapshot: ${getErrorText(persistResult.reason)}`);
|
|
1699
|
+
}
|
|
1700
|
+
if (notifyResult.status === 'rejected') {
|
|
1701
|
+
console.warn(`[${SENSITIVE_FILTER_MIDDLEWARE_NAME}] Failed to dispatch WeCom notification: ${getErrorText(notifyResult.reason)}`);
|
|
1686
1702
|
}
|
|
1687
|
-
// Keep audit persistence implementation for future fallback.
|
|
1688
|
-
// await persistAuditSnapshot()
|
|
1689
1703
|
return undefined;
|
|
1690
1704
|
},
|
|
1691
1705
|
};
|
package/dist/lib/types.d.ts
CHANGED
|
@@ -40,14 +40,11 @@ export type LlmModeConfig = {
|
|
|
40
40
|
};
|
|
41
41
|
export type SensitiveFilterConfig = RuleModeConfig | LlmModeConfig;
|
|
42
42
|
export type WecomNotifyGroup = {
|
|
43
|
-
name?: string | null;
|
|
44
43
|
webhookUrl?: string | null;
|
|
45
44
|
};
|
|
46
45
|
export type WecomNotifyConfig = {
|
|
47
46
|
enabled?: boolean;
|
|
48
47
|
groups?: Array<WecomNotifyGroup | null>;
|
|
49
|
-
mentionedList?: string[] | null;
|
|
50
|
-
mentionedMobileList?: string[] | null;
|
|
51
48
|
timeoutMs?: number | null;
|
|
52
49
|
};
|
|
53
50
|
export type LlmDecision = {
|
|
@@ -96,41 +93,29 @@ export declare const sensitiveFilterConfigSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
96
93
|
wecom: z.ZodDefault<z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
97
94
|
enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
98
95
|
groups: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodNullable<z.ZodObject<{
|
|
99
|
-
name: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
100
96
|
webhookUrl: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
101
97
|
}, "strip", z.ZodTypeAny, {
|
|
102
|
-
name?: string;
|
|
103
98
|
webhookUrl?: string;
|
|
104
99
|
}, {
|
|
105
|
-
name?: string;
|
|
106
100
|
webhookUrl?: string;
|
|
107
101
|
}>>, "many">>>;
|
|
108
|
-
mentionedList: z.ZodDefault<z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>>;
|
|
109
|
-
mentionedMobileList: z.ZodDefault<z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>>;
|
|
110
102
|
timeoutMs: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
111
103
|
}, "strip", z.ZodTypeAny, {
|
|
112
|
-
timeoutMs?: number;
|
|
113
104
|
enabled?: boolean;
|
|
114
105
|
groups?: {
|
|
115
|
-
name?: string;
|
|
116
106
|
webhookUrl?: string;
|
|
117
107
|
}[];
|
|
118
|
-
mentionedList?: string[];
|
|
119
|
-
mentionedMobileList?: string[];
|
|
120
|
-
}, {
|
|
121
108
|
timeoutMs?: number;
|
|
109
|
+
}, {
|
|
122
110
|
enabled?: boolean;
|
|
123
111
|
groups?: {
|
|
124
|
-
name?: string;
|
|
125
112
|
webhookUrl?: string;
|
|
126
113
|
}[];
|
|
127
|
-
|
|
128
|
-
mentionedMobileList?: string[];
|
|
114
|
+
timeoutMs?: number;
|
|
129
115
|
}>>>>;
|
|
130
116
|
llm: z.ZodOptional<z.ZodUnknown>;
|
|
131
117
|
generalPack: z.ZodOptional<z.ZodUnknown>;
|
|
132
118
|
}, "strip", z.ZodTypeAny, {
|
|
133
|
-
llm?: unknown;
|
|
134
119
|
mode?: "rule";
|
|
135
120
|
rules?: {
|
|
136
121
|
id?: string;
|
|
@@ -144,18 +129,15 @@ export declare const sensitiveFilterConfigSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
144
129
|
caseSensitive?: boolean;
|
|
145
130
|
normalize?: boolean;
|
|
146
131
|
wecom?: {
|
|
147
|
-
timeoutMs?: number;
|
|
148
132
|
enabled?: boolean;
|
|
149
133
|
groups?: {
|
|
150
|
-
name?: string;
|
|
151
134
|
webhookUrl?: string;
|
|
152
135
|
}[];
|
|
153
|
-
|
|
154
|
-
mentionedMobileList?: string[];
|
|
136
|
+
timeoutMs?: number;
|
|
155
137
|
};
|
|
138
|
+
llm?: unknown;
|
|
156
139
|
generalPack?: unknown;
|
|
157
140
|
}, {
|
|
158
|
-
llm?: unknown;
|
|
159
141
|
mode?: "rule";
|
|
160
142
|
rules?: {
|
|
161
143
|
id?: string;
|
|
@@ -169,15 +151,13 @@ export declare const sensitiveFilterConfigSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
169
151
|
caseSensitive?: boolean;
|
|
170
152
|
normalize?: boolean;
|
|
171
153
|
wecom?: {
|
|
172
|
-
timeoutMs?: number;
|
|
173
154
|
enabled?: boolean;
|
|
174
155
|
groups?: {
|
|
175
|
-
name?: string;
|
|
176
156
|
webhookUrl?: string;
|
|
177
157
|
}[];
|
|
178
|
-
|
|
179
|
-
mentionedMobileList?: string[];
|
|
158
|
+
timeoutMs?: number;
|
|
180
159
|
};
|
|
160
|
+
llm?: unknown;
|
|
181
161
|
generalPack?: unknown;
|
|
182
162
|
}>, z.ZodObject<{
|
|
183
163
|
mode: z.ZodLiteral<"llm">;
|
|
@@ -194,6 +174,7 @@ export declare const sensitiveFilterConfigSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
194
174
|
timeoutMs: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
195
175
|
}, "strip", z.ZodTypeAny, {
|
|
196
176
|
scope?: "input" | "output" | "both";
|
|
177
|
+
timeoutMs?: number;
|
|
197
178
|
model?: ICopilotModel;
|
|
198
179
|
rulePrompt?: string;
|
|
199
180
|
systemPrompt?: string;
|
|
@@ -202,9 +183,9 @@ export declare const sensitiveFilterConfigSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
202
183
|
errorRewriteText?: string;
|
|
203
184
|
blockMessage?: string;
|
|
204
185
|
rewriteFallbackText?: string;
|
|
205
|
-
timeoutMs?: number;
|
|
206
186
|
}, {
|
|
207
187
|
scope?: "input" | "output" | "both";
|
|
188
|
+
timeoutMs?: number;
|
|
208
189
|
model?: ICopilotModel;
|
|
209
190
|
rulePrompt?: string;
|
|
210
191
|
systemPrompt?: string;
|
|
@@ -213,49 +194,49 @@ export declare const sensitiveFilterConfigSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
213
194
|
errorRewriteText?: string;
|
|
214
195
|
blockMessage?: string;
|
|
215
196
|
rewriteFallbackText?: string;
|
|
216
|
-
timeoutMs?: number;
|
|
217
197
|
}>>>>;
|
|
218
198
|
wecom: z.ZodDefault<z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
219
199
|
enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
220
200
|
groups: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodNullable<z.ZodObject<{
|
|
221
|
-
name: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
222
201
|
webhookUrl: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
223
202
|
}, "strip", z.ZodTypeAny, {
|
|
224
|
-
name?: string;
|
|
225
203
|
webhookUrl?: string;
|
|
226
204
|
}, {
|
|
227
|
-
name?: string;
|
|
228
205
|
webhookUrl?: string;
|
|
229
206
|
}>>, "many">>>;
|
|
230
|
-
mentionedList: z.ZodDefault<z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>>;
|
|
231
|
-
mentionedMobileList: z.ZodDefault<z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>>;
|
|
232
207
|
timeoutMs: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
233
208
|
}, "strip", z.ZodTypeAny, {
|
|
234
|
-
timeoutMs?: number;
|
|
235
209
|
enabled?: boolean;
|
|
236
210
|
groups?: {
|
|
237
|
-
name?: string;
|
|
238
211
|
webhookUrl?: string;
|
|
239
212
|
}[];
|
|
240
|
-
mentionedList?: string[];
|
|
241
|
-
mentionedMobileList?: string[];
|
|
242
|
-
}, {
|
|
243
213
|
timeoutMs?: number;
|
|
214
|
+
}, {
|
|
244
215
|
enabled?: boolean;
|
|
245
216
|
groups?: {
|
|
246
|
-
name?: string;
|
|
247
217
|
webhookUrl?: string;
|
|
248
218
|
}[];
|
|
249
|
-
|
|
250
|
-
mentionedMobileList?: string[];
|
|
219
|
+
timeoutMs?: number;
|
|
251
220
|
}>>>>;
|
|
252
221
|
rules: z.ZodOptional<z.ZodUnknown>;
|
|
253
222
|
caseSensitive: z.ZodOptional<z.ZodUnknown>;
|
|
254
223
|
normalize: z.ZodOptional<z.ZodUnknown>;
|
|
255
224
|
generalPack: z.ZodOptional<z.ZodUnknown>;
|
|
256
225
|
}, "strip", z.ZodTypeAny, {
|
|
226
|
+
mode?: "llm";
|
|
227
|
+
rules?: unknown;
|
|
228
|
+
caseSensitive?: unknown;
|
|
229
|
+
normalize?: unknown;
|
|
230
|
+
wecom?: {
|
|
231
|
+
enabled?: boolean;
|
|
232
|
+
groups?: {
|
|
233
|
+
webhookUrl?: string;
|
|
234
|
+
}[];
|
|
235
|
+
timeoutMs?: number;
|
|
236
|
+
};
|
|
257
237
|
llm?: {
|
|
258
238
|
scope?: "input" | "output" | "both";
|
|
239
|
+
timeoutMs?: number;
|
|
259
240
|
model?: ICopilotModel;
|
|
260
241
|
rulePrompt?: string;
|
|
261
242
|
systemPrompt?: string;
|
|
@@ -264,26 +245,23 @@ export declare const sensitiveFilterConfigSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
264
245
|
errorRewriteText?: string;
|
|
265
246
|
blockMessage?: string;
|
|
266
247
|
rewriteFallbackText?: string;
|
|
267
|
-
timeoutMs?: number;
|
|
268
248
|
};
|
|
249
|
+
generalPack?: unknown;
|
|
250
|
+
}, {
|
|
269
251
|
mode?: "llm";
|
|
270
252
|
rules?: unknown;
|
|
271
253
|
caseSensitive?: unknown;
|
|
272
254
|
normalize?: unknown;
|
|
273
255
|
wecom?: {
|
|
274
|
-
timeoutMs?: number;
|
|
275
256
|
enabled?: boolean;
|
|
276
257
|
groups?: {
|
|
277
|
-
name?: string;
|
|
278
258
|
webhookUrl?: string;
|
|
279
259
|
}[];
|
|
280
|
-
|
|
281
|
-
mentionedMobileList?: string[];
|
|
260
|
+
timeoutMs?: number;
|
|
282
261
|
};
|
|
283
|
-
generalPack?: unknown;
|
|
284
|
-
}, {
|
|
285
262
|
llm?: {
|
|
286
263
|
scope?: "input" | "output" | "both";
|
|
264
|
+
timeoutMs?: number;
|
|
287
265
|
model?: ICopilotModel;
|
|
288
266
|
rulePrompt?: string;
|
|
289
267
|
systemPrompt?: string;
|
|
@@ -292,21 +270,6 @@ export declare const sensitiveFilterConfigSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
292
270
|
errorRewriteText?: string;
|
|
293
271
|
blockMessage?: string;
|
|
294
272
|
rewriteFallbackText?: string;
|
|
295
|
-
timeoutMs?: number;
|
|
296
|
-
};
|
|
297
|
-
mode?: "llm";
|
|
298
|
-
rules?: unknown;
|
|
299
|
-
caseSensitive?: unknown;
|
|
300
|
-
normalize?: unknown;
|
|
301
|
-
wecom?: {
|
|
302
|
-
timeoutMs?: number;
|
|
303
|
-
enabled?: boolean;
|
|
304
|
-
groups?: {
|
|
305
|
-
name?: string;
|
|
306
|
-
webhookUrl?: string;
|
|
307
|
-
}[];
|
|
308
|
-
mentionedList?: string[];
|
|
309
|
-
mentionedMobileList?: string[];
|
|
310
273
|
};
|
|
311
274
|
generalPack?: unknown;
|
|
312
275
|
}>]>;
|
package/dist/lib/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAE1B,MAAM,MAAM,aAAa,GAAG;IAC1B,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,SAAS,GAAG,OAAO,CAAA;IACzB,KAAK,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAA;IAClC,QAAQ,EAAE,MAAM,GAAG,QAAQ,CAAA;IAC3B,MAAM,EAAE,OAAO,GAAG,SAAS,CAAA;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,CAAC,EAAE,MAAM,C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A2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAuD,CAAA;AAE/F,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;EAM5B,CAAA"}
|
package/dist/lib/types.js
CHANGED
|
@@ -26,15 +26,12 @@ const llmConfigSchema = z
|
|
|
26
26
|
});
|
|
27
27
|
const wecomNotifyGroupSchema = z
|
|
28
28
|
.object({
|
|
29
|
-
name: z.string().optional().nullable(),
|
|
30
29
|
webhookUrl: z.string().optional().nullable(),
|
|
31
30
|
})
|
|
32
31
|
.nullable();
|
|
33
32
|
const wecomNotifyConfigSchema = z.object({
|
|
34
33
|
enabled: z.boolean().optional().default(true),
|
|
35
34
|
groups: z.array(wecomNotifyGroupSchema).optional().default([]),
|
|
36
|
-
mentionedList: z.array(z.string()).optional().nullable().default([]),
|
|
37
|
-
mentionedMobileList: z.array(z.string()).optional().nullable().default([]),
|
|
38
35
|
timeoutMs: z.number().int().positive().max(120000).optional().nullable(),
|
|
39
36
|
});
|
|
40
37
|
const ruleModeConfigSchema = z.object({
|