@celljs/ta-secops 0.0.0-stage → 4.33.0
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.en.md +13 -0
- package/README.md +12 -2
- package/extension/index.mjs +589 -0
- package/host/index.mjs +2369 -0
- package/package.json +77 -4
- package/web/index.js +741 -0
package/web/index.js
ADDED
|
@@ -0,0 +1,741 @@
|
|
|
1
|
+
// ../ta-protocol/esm/common/language.js
|
|
2
|
+
var TaLanguageUtil;
|
|
3
|
+
(function(TaLanguageUtil2) {
|
|
4
|
+
TaLanguageUtil2.ALL = ["zh-CN", "zh-TW", "en-US", "ja-JP"];
|
|
5
|
+
TaLanguageUtil2.NAMES = { "zh-CN": "简体中文", "zh-TW": "繁體中文", "en-US": "English", "ja-JP": "日本語" };
|
|
6
|
+
function of(tag) {
|
|
7
|
+
const said = (tag !== null && tag !== undefined ? tag : "").toLowerCase().replace(/_/g, "-");
|
|
8
|
+
if (/^zh(\b|-)/.test(said)) {
|
|
9
|
+
return /-hant\b/.test(said) || !/-hans\b/.test(said) && /-(tw|hk|mo)\b/.test(said) ? "zh-TW" : "zh-CN";
|
|
10
|
+
}
|
|
11
|
+
return /^ja(\b|-)/.test(said) ? "ja-JP" : "en-US";
|
|
12
|
+
}
|
|
13
|
+
TaLanguageUtil2.of = of;
|
|
14
|
+
function server(env = typeof process === "undefined" ? {} : process.env) {
|
|
15
|
+
return of(env.TA_LANGUAGE || env.LC_ALL || env.LC_MESSAGES || env.LANG);
|
|
16
|
+
}
|
|
17
|
+
TaLanguageUtil2.server = server;
|
|
18
|
+
function pick(language, words) {
|
|
19
|
+
return words[of(language)];
|
|
20
|
+
}
|
|
21
|
+
TaLanguageUtil2.pick = pick;
|
|
22
|
+
function say(words) {
|
|
23
|
+
return words[server()];
|
|
24
|
+
}
|
|
25
|
+
TaLanguageUtil2.say = say;
|
|
26
|
+
function chinese(language) {
|
|
27
|
+
return of(language).startsWith("zh");
|
|
28
|
+
}
|
|
29
|
+
TaLanguageUtil2.chinese = chinese;
|
|
30
|
+
function cjk(language) {
|
|
31
|
+
return of(language) !== "en-US";
|
|
32
|
+
}
|
|
33
|
+
TaLanguageUtil2.cjk = cjk;
|
|
34
|
+
function list(language, items) {
|
|
35
|
+
return items.join(cjk(language) ? "、" : ", ");
|
|
36
|
+
}
|
|
37
|
+
TaLanguageUtil2.list = list;
|
|
38
|
+
})(TaLanguageUtil || (TaLanguageUtil = {}));
|
|
39
|
+
|
|
40
|
+
// web-src/i18n.ts
|
|
41
|
+
var EN = {
|
|
42
|
+
malicious: "Malicious",
|
|
43
|
+
benign: "Benign",
|
|
44
|
+
uncertain: "Cannot tell",
|
|
45
|
+
confidence: "{n}% sure",
|
|
46
|
+
findings: "What happened",
|
|
47
|
+
missing: "What would tell",
|
|
48
|
+
evidence: "Evidence",
|
|
49
|
+
evidenceLine: "{source} · {total} rows · {hash}",
|
|
50
|
+
recheck: "Run again",
|
|
51
|
+
rechecking: "Running…",
|
|
52
|
+
same: "Same rows",
|
|
53
|
+
changed: "Rows changed since",
|
|
54
|
+
actions: "Actions",
|
|
55
|
+
approve: "Approve",
|
|
56
|
+
reject: "Reject",
|
|
57
|
+
pending: "Waiting for you",
|
|
58
|
+
approved: "Approved",
|
|
59
|
+
rejected: "Rejected",
|
|
60
|
+
done: "Done",
|
|
61
|
+
blocked: "Not allowed",
|
|
62
|
+
change: "Change of the rules",
|
|
63
|
+
release: "Approve and release",
|
|
64
|
+
released: "Released v{n}",
|
|
65
|
+
unsafe: "Misses what the rules catch now",
|
|
66
|
+
coverage: "Attack records seen",
|
|
67
|
+
caught: "Attacks caught",
|
|
68
|
+
falseEvents: "Events of nothing",
|
|
69
|
+
ledger: "{n} queries recorded in the ledger",
|
|
70
|
+
gone: "This case is no longer kept.",
|
|
71
|
+
toolQuery: "Query",
|
|
72
|
+
toolReplay: "Replay rules",
|
|
73
|
+
toolVerdict: "Conclude",
|
|
74
|
+
review: "Review {n}",
|
|
75
|
+
period: "{from} – {to}",
|
|
76
|
+
casesN: "Cases",
|
|
77
|
+
agreedRate: "Agreed",
|
|
78
|
+
minutes: "Min to verdict",
|
|
79
|
+
went: "What went right",
|
|
80
|
+
wrong: "What went wrong",
|
|
81
|
+
lessons: "For the playbook",
|
|
82
|
+
keep: "Keep",
|
|
83
|
+
drop: "Drop",
|
|
84
|
+
kept: "Kept",
|
|
85
|
+
dropped: "Dropped",
|
|
86
|
+
correct: "See it otherwise",
|
|
87
|
+
corrected: "Corrected to {verdict}",
|
|
88
|
+
reviewing: "Reviewing…",
|
|
89
|
+
toolReview: "Review",
|
|
90
|
+
folder: "Security operations"
|
|
91
|
+
};
|
|
92
|
+
var ZH = {
|
|
93
|
+
malicious: "恶意",
|
|
94
|
+
benign: "良性",
|
|
95
|
+
uncertain: "无法确定",
|
|
96
|
+
confidence: "置信 {n}%",
|
|
97
|
+
findings: "发生了什么",
|
|
98
|
+
missing: "还缺什么证据",
|
|
99
|
+
evidence: "证据",
|
|
100
|
+
evidenceLine: "{source} · {total} 条 · {hash}",
|
|
101
|
+
recheck: "重放",
|
|
102
|
+
rechecking: "重放中…",
|
|
103
|
+
same: "结果一致",
|
|
104
|
+
changed: "结果已变化",
|
|
105
|
+
actions: "处置",
|
|
106
|
+
approve: "批准",
|
|
107
|
+
reject: "驳回",
|
|
108
|
+
pending: "等你批准",
|
|
109
|
+
approved: "已批准",
|
|
110
|
+
rejected: "已驳回",
|
|
111
|
+
done: "已执行",
|
|
112
|
+
blocked: "不允许",
|
|
113
|
+
change: "规则修改",
|
|
114
|
+
release: "批准上线",
|
|
115
|
+
released: "已上线 v{n}",
|
|
116
|
+
unsafe: "会漏掉现在能抓到的",
|
|
117
|
+
coverage: "攻击记录覆盖",
|
|
118
|
+
caught: "抓到的攻击",
|
|
119
|
+
falseEvents: "误报事件",
|
|
120
|
+
ledger: "{n} 次查询已记入账本",
|
|
121
|
+
gone: "这个案件已不再保留。",
|
|
122
|
+
toolQuery: "查询",
|
|
123
|
+
toolReplay: "回放规则",
|
|
124
|
+
toolVerdict: "给出结论",
|
|
125
|
+
review: "复盘 {n}",
|
|
126
|
+
period: "{from} – {to}",
|
|
127
|
+
casesN: "案件",
|
|
128
|
+
agreedRate: "结论被认可",
|
|
129
|
+
minutes: "定性用时(分)",
|
|
130
|
+
went: "做得好的",
|
|
131
|
+
wrong: "做得不好的",
|
|
132
|
+
lessons: "写进调查手册",
|
|
133
|
+
keep: "采纳",
|
|
134
|
+
drop: "不采纳",
|
|
135
|
+
kept: "已采纳",
|
|
136
|
+
dropped: "未采纳",
|
|
137
|
+
correct: "改判",
|
|
138
|
+
corrected: "已改判为{verdict}",
|
|
139
|
+
reviewing: "复盘中…",
|
|
140
|
+
toolReview: "记录复盘",
|
|
141
|
+
folder: "安全运营"
|
|
142
|
+
};
|
|
143
|
+
var ZH_TW = {
|
|
144
|
+
malicious: "惡意",
|
|
145
|
+
benign: "良性",
|
|
146
|
+
uncertain: "無法確定",
|
|
147
|
+
confidence: "信心 {n}%",
|
|
148
|
+
findings: "發生了什麼",
|
|
149
|
+
missing: "還缺什麼證據",
|
|
150
|
+
evidence: "證據",
|
|
151
|
+
evidenceLine: "{source} · {total} 筆 · {hash}",
|
|
152
|
+
recheck: "重放",
|
|
153
|
+
rechecking: "重放中…",
|
|
154
|
+
same: "結果一致",
|
|
155
|
+
changed: "結果已變化",
|
|
156
|
+
actions: "處置",
|
|
157
|
+
approve: "同意",
|
|
158
|
+
reject: "駁回",
|
|
159
|
+
pending: "等你同意",
|
|
160
|
+
approved: "已同意",
|
|
161
|
+
rejected: "已駁回",
|
|
162
|
+
done: "已執行",
|
|
163
|
+
blocked: "不允許",
|
|
164
|
+
change: "規則修改",
|
|
165
|
+
release: "同意上線",
|
|
166
|
+
released: "已上線 v{n}",
|
|
167
|
+
unsafe: "會漏掉現在能抓到的",
|
|
168
|
+
coverage: "攻擊紀錄覆蓋",
|
|
169
|
+
caught: "抓到的攻擊",
|
|
170
|
+
falseEvents: "誤報事件",
|
|
171
|
+
ledger: "{n} 次查詢已記入帳本",
|
|
172
|
+
gone: "這個案件已不再保留。",
|
|
173
|
+
toolQuery: "查詢",
|
|
174
|
+
toolReplay: "回放規則",
|
|
175
|
+
toolVerdict: "給出結論",
|
|
176
|
+
review: "復盤 {n}",
|
|
177
|
+
period: "{from} – {to}",
|
|
178
|
+
casesN: "案件",
|
|
179
|
+
agreedRate: "結論被認可",
|
|
180
|
+
minutes: "定性用時(分)",
|
|
181
|
+
went: "做得好的",
|
|
182
|
+
wrong: "做得不好的",
|
|
183
|
+
lessons: "寫進調查手冊",
|
|
184
|
+
keep: "採納",
|
|
185
|
+
drop: "不採納",
|
|
186
|
+
kept: "已採納",
|
|
187
|
+
dropped: "未採納",
|
|
188
|
+
correct: "改判",
|
|
189
|
+
corrected: "已改判為{verdict}",
|
|
190
|
+
reviewing: "復盤中…",
|
|
191
|
+
toolReview: "記錄復盤",
|
|
192
|
+
folder: "安全營運"
|
|
193
|
+
};
|
|
194
|
+
var JA = {
|
|
195
|
+
malicious: "悪意あり",
|
|
196
|
+
benign: "正常",
|
|
197
|
+
uncertain: "判断できない",
|
|
198
|
+
confidence: "確度 {n}%",
|
|
199
|
+
findings: "何が起きたか",
|
|
200
|
+
missing: "足りない証拠",
|
|
201
|
+
evidence: "証拠",
|
|
202
|
+
evidenceLine: "{source} · {total} 件 · {hash}",
|
|
203
|
+
recheck: "再実行",
|
|
204
|
+
rechecking: "再実行中…",
|
|
205
|
+
same: "結果は同じ",
|
|
206
|
+
changed: "結果が変わった",
|
|
207
|
+
actions: "対処",
|
|
208
|
+
approve: "承認",
|
|
209
|
+
reject: "却下",
|
|
210
|
+
pending: "承認待ち",
|
|
211
|
+
approved: "承認済み",
|
|
212
|
+
rejected: "却下済み",
|
|
213
|
+
done: "実行済み",
|
|
214
|
+
blocked: "許可されない",
|
|
215
|
+
change: "ルールの変更",
|
|
216
|
+
release: "承認して反映",
|
|
217
|
+
released: "v{n} を反映済み",
|
|
218
|
+
unsafe: "今検知できるものを見逃す",
|
|
219
|
+
coverage: "攻撃ログの検知",
|
|
220
|
+
caught: "検知した攻撃",
|
|
221
|
+
falseEvents: "誤検知イベント",
|
|
222
|
+
ledger: "{n} 件のクエリを台帳に記録",
|
|
223
|
+
gone: "この案件はもう保存されていません。",
|
|
224
|
+
toolQuery: "クエリ",
|
|
225
|
+
toolReplay: "ルールを再生",
|
|
226
|
+
toolVerdict: "結論を出す",
|
|
227
|
+
review: "振り返り {n}",
|
|
228
|
+
period: "{from} – {to}",
|
|
229
|
+
casesN: "案件",
|
|
230
|
+
agreedRate: "結論の一致",
|
|
231
|
+
minutes: "判定まで(分)",
|
|
232
|
+
went: "うまくいったこと",
|
|
233
|
+
wrong: "うまくいかなかったこと",
|
|
234
|
+
lessons: "調査手順書へ",
|
|
235
|
+
keep: "採用",
|
|
236
|
+
drop: "見送り",
|
|
237
|
+
kept: "採用済み",
|
|
238
|
+
dropped: "見送り済み",
|
|
239
|
+
correct: "判定を直す",
|
|
240
|
+
corrected: "{verdict}に修正済み",
|
|
241
|
+
reviewing: "振り返り中…",
|
|
242
|
+
toolReview: "振り返りを記録",
|
|
243
|
+
folder: "セキュリティ運用"
|
|
244
|
+
};
|
|
245
|
+
var WORDS = { "zh-CN": ZH, "zh-TW": ZH_TW, "en-US": EN, "ja-JP": JA };
|
|
246
|
+
var SecopsWords;
|
|
247
|
+
((SecopsWords) => {
|
|
248
|
+
function of(language) {
|
|
249
|
+
return TaLanguageUtil.pick(language, WORDS);
|
|
250
|
+
}
|
|
251
|
+
SecopsWords.of = of;
|
|
252
|
+
function format(text, values) {
|
|
253
|
+
return text.replace(/\{(\w+)\}/g, (whole, key) => (key in values) ? String(values[key]) : whole);
|
|
254
|
+
}
|
|
255
|
+
SecopsWords.format = format;
|
|
256
|
+
})(SecopsWords ||= {});
|
|
257
|
+
|
|
258
|
+
// web-src/react.ts
|
|
259
|
+
var React;
|
|
260
|
+
function bind(react) {
|
|
261
|
+
React = react;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// web-src/secops-protocol.ts
|
|
265
|
+
var CASE_TYPE = "ta-secops-case";
|
|
266
|
+
var REVIEW_TYPE = "ta-secops-review";
|
|
267
|
+
var TOOLS = {
|
|
268
|
+
QUERY: "secops_query",
|
|
269
|
+
REPLAY: "secops_replay",
|
|
270
|
+
VERDICT: "secops_verdict",
|
|
271
|
+
REVIEW: "secops_review"
|
|
272
|
+
};
|
|
273
|
+
var OWN_TOOLS = Object.values(TOOLS);
|
|
274
|
+
var CASE_TOOLS = [TOOLS.QUERY, TOOLS.REPLAY, TOOLS.VERDICT];
|
|
275
|
+
var REVIEW_TOOLS = [TOOLS.REPLAY, TOOLS.REVIEW];
|
|
276
|
+
var Keys;
|
|
277
|
+
((Keys) => {
|
|
278
|
+
Keys.CASES = "cases";
|
|
279
|
+
Keys.SETTINGS = "settings";
|
|
280
|
+
Keys.HOOK = "hook";
|
|
281
|
+
Keys.BUDGET = "budget";
|
|
282
|
+
Keys.REVIEWS = "reviews";
|
|
283
|
+
})(Keys ||= {});
|
|
284
|
+
var Limits;
|
|
285
|
+
((Limits) => {
|
|
286
|
+
Limits.SIGNALS = 60;
|
|
287
|
+
Limits.EVIDENCE = 40;
|
|
288
|
+
Limits.SAMPLE = 5;
|
|
289
|
+
Limits.ROWS = 50;
|
|
290
|
+
Limits.MATCHED = 1e4;
|
|
291
|
+
Limits.TURNS = 4;
|
|
292
|
+
Limits.QUERIES = 25;
|
|
293
|
+
})(Limits ||= {});
|
|
294
|
+
var DEFAULT_SCORING = { windowMs: 30 * 60000, threshold: 60, stageBonus: 10, entity: "host.name" };
|
|
295
|
+
|
|
296
|
+
// web-src/case-card.tsx
|
|
297
|
+
function useCases(pi) {
|
|
298
|
+
const [cases, setCases] = React.useState();
|
|
299
|
+
React.useEffect(() => {
|
|
300
|
+
let live = true;
|
|
301
|
+
const read = () => void pi.storage.get(Keys.CASES).then((value) => live && setCases(Array.isArray(value) ? value : [])).catch(() => live && setCases([]));
|
|
302
|
+
read();
|
|
303
|
+
const stop = pi.storage.onChange((keys) => keys.includes(Keys.CASES) && read());
|
|
304
|
+
return () => {
|
|
305
|
+
live = false;
|
|
306
|
+
stop();
|
|
307
|
+
};
|
|
308
|
+
}, [pi]);
|
|
309
|
+
return cases;
|
|
310
|
+
}
|
|
311
|
+
function caseCard(pi) {
|
|
312
|
+
return function CaseCard({ message }) {
|
|
313
|
+
const words = SecopsWords.of(pi.ui.language);
|
|
314
|
+
const id = message.details?.id;
|
|
315
|
+
const cases = useCases(pi);
|
|
316
|
+
const [open, setOpen] = React.useState();
|
|
317
|
+
const [busy, setBusy] = React.useState();
|
|
318
|
+
if (typeof id !== "string" || !cases) {
|
|
319
|
+
return null;
|
|
320
|
+
}
|
|
321
|
+
const found = cases.find((candidate) => candidate.id === id);
|
|
322
|
+
if (!found?.verdict) {
|
|
323
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
324
|
+
className: "ta-secops-case ta-secops-note"
|
|
325
|
+
}, words.gone);
|
|
326
|
+
}
|
|
327
|
+
const verdict = found.verdict;
|
|
328
|
+
const tone = verdict.verdict === "malicious" ? "ta-bad" : verdict.verdict === "benign" ? "ta-good" : "ta-warn";
|
|
329
|
+
const decide = (ref, approve) => {
|
|
330
|
+
setBusy(ref);
|
|
331
|
+
pi.callHost("decide", found.id, ref, approve).catch((error) => pi.ui.notify(error instanceof Error ? error.message : String(error), "error")).finally(() => setBusy(undefined));
|
|
332
|
+
};
|
|
333
|
+
const evidence = found.evidence.find((candidate) => candidate.id === open);
|
|
334
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
335
|
+
className: "ta-secops-case"
|
|
336
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
337
|
+
className: "ta-secops-head"
|
|
338
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
339
|
+
className: "ta-secops-title"
|
|
340
|
+
}, "#", found.n, " ", found.entity.id), /* @__PURE__ */ React.createElement("span", {
|
|
341
|
+
className: `ta-secops-pill ${tone}`
|
|
342
|
+
}, words[verdict.verdict]), /* @__PURE__ */ React.createElement("span", {
|
|
343
|
+
className: "ta-secops-sure"
|
|
344
|
+
}, SecopsWords.format(words.confidence, { n: Math.round(verdict.confidence * 100) }))), verdict.summary && /* @__PURE__ */ React.createElement("div", {
|
|
345
|
+
className: "ta-secops-summary"
|
|
346
|
+
}, verdict.summary), verdict.findings.length > 0 && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
347
|
+
className: "ta-secops-label"
|
|
348
|
+
}, words.findings), /* @__PURE__ */ React.createElement("ul", {
|
|
349
|
+
className: "ta-secops-list"
|
|
350
|
+
}, verdict.findings.map((finding, index) => /* @__PURE__ */ React.createElement("li", {
|
|
351
|
+
key: index,
|
|
352
|
+
className: "ta-secops-finding"
|
|
353
|
+
}, finding.text, finding.evidence.map((ref) => /* @__PURE__ */ React.createElement("button", {
|
|
354
|
+
key: ref,
|
|
355
|
+
type: "button",
|
|
356
|
+
className: `ta-secops-ref${open === ref ? " ta-on" : ""}`,
|
|
357
|
+
"aria-pressed": open === ref,
|
|
358
|
+
onClick: () => setOpen(open === ref ? undefined : ref)
|
|
359
|
+
}, ref)))))), evidence && /* @__PURE__ */ React.createElement(EvidenceView, {
|
|
360
|
+
pi,
|
|
361
|
+
found,
|
|
362
|
+
evidence
|
|
363
|
+
}), verdict.missing?.length ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
364
|
+
className: "ta-secops-label"
|
|
365
|
+
}, words.missing), /* @__PURE__ */ React.createElement("ul", {
|
|
366
|
+
className: "ta-secops-list"
|
|
367
|
+
}, verdict.missing.map((item) => /* @__PURE__ */ React.createElement("li", {
|
|
368
|
+
key: item,
|
|
369
|
+
className: "ta-secops-finding"
|
|
370
|
+
}, item)))) : null, found.actions.length > 0 && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
371
|
+
className: "ta-secops-label"
|
|
372
|
+
}, words.actions), /* @__PURE__ */ React.createElement("ul", {
|
|
373
|
+
className: "ta-secops-list"
|
|
374
|
+
}, found.actions.map((action) => /* @__PURE__ */ React.createElement(ActionRow, {
|
|
375
|
+
key: action.id,
|
|
376
|
+
action,
|
|
377
|
+
words,
|
|
378
|
+
busy: busy === action.id,
|
|
379
|
+
decide
|
|
380
|
+
})))), found.proposal && /* @__PURE__ */ React.createElement(ProposalView, {
|
|
381
|
+
proposal: found.proposal,
|
|
382
|
+
words,
|
|
383
|
+
busy: busy === found.proposal.id,
|
|
384
|
+
decide
|
|
385
|
+
}), /* @__PURE__ */ React.createElement(Correction, {
|
|
386
|
+
pi,
|
|
387
|
+
found,
|
|
388
|
+
words
|
|
389
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
390
|
+
className: "ta-secops-note"
|
|
391
|
+
}, SecopsWords.format(words.ledger, { n: found.evidence.length })));
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
function ActionRow({ action, words, busy, decide }) {
|
|
395
|
+
if (action.status === "pending") {
|
|
396
|
+
return /* @__PURE__ */ React.createElement("li", {
|
|
397
|
+
className: "ta-secops-item"
|
|
398
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
399
|
+
className: "ta-secops-row-text"
|
|
400
|
+
}, /* @__PURE__ */ React.createElement("b", null, action.type), " ", action.target, action.why ? ` · ${action.why}` : ""), /* @__PURE__ */ React.createElement("span", {
|
|
401
|
+
className: "ta-secops-item-buttons"
|
|
402
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
403
|
+
type: "button",
|
|
404
|
+
className: "ta-secops-button",
|
|
405
|
+
disabled: busy,
|
|
406
|
+
onClick: () => decide(action.id, false)
|
|
407
|
+
}, words.reject), /* @__PURE__ */ React.createElement("button", {
|
|
408
|
+
type: "button",
|
|
409
|
+
className: "ta-secops-button ta-primary",
|
|
410
|
+
disabled: busy,
|
|
411
|
+
onClick: () => decide(action.id, true)
|
|
412
|
+
}, words.approve)));
|
|
413
|
+
}
|
|
414
|
+
return /* @__PURE__ */ React.createElement("li", {
|
|
415
|
+
className: "ta-secops-row"
|
|
416
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
417
|
+
className: "ta-secops-row-text"
|
|
418
|
+
}, /* @__PURE__ */ React.createElement("b", null, action.type), " ", action.target, action.why ? ` · ${action.why}` : ""), /* @__PURE__ */ React.createElement("span", {
|
|
419
|
+
className: "ta-secops-state"
|
|
420
|
+
}, words[action.status]));
|
|
421
|
+
}
|
|
422
|
+
function ProposalView({
|
|
423
|
+
proposal,
|
|
424
|
+
words,
|
|
425
|
+
busy,
|
|
426
|
+
decide
|
|
427
|
+
}) {
|
|
428
|
+
const { before, after, safe } = proposal.replay;
|
|
429
|
+
const stat = (label, pick, better, a, b) => /* @__PURE__ */ React.createElement("div", {
|
|
430
|
+
className: "ta-secops-stat"
|
|
431
|
+
}, /* @__PURE__ */ React.createElement("b", null, pick(before), " → ", /* @__PURE__ */ React.createElement("span", {
|
|
432
|
+
className: b === a ? "" : b > a === (better === "up") ? "ta-up" : "ta-down"
|
|
433
|
+
}, pick(after))), /* @__PURE__ */ React.createElement("span", null, label));
|
|
434
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
435
|
+
className: "ta-secops-label"
|
|
436
|
+
}, words.change), /* @__PURE__ */ React.createElement("div", {
|
|
437
|
+
className: "ta-secops-row-text"
|
|
438
|
+
}, proposal.change.why), /* @__PURE__ */ React.createElement("div", {
|
|
439
|
+
className: "ta-secops-stats"
|
|
440
|
+
}, stat(words.coverage, (stats) => `${stats.covered}/${stats.attackRecords}`, "up", before.covered, after.covered), stat(words.caught, (stats) => `${stats.chainsCaught}/${stats.chains}`, "up", before.chainsCaught, after.chainsCaught), stat(words.falseEvents, (stats) => stats.falseEvents, "down", before.falseEvents, after.falseEvents)), /* @__PURE__ */ React.createElement("div", {
|
|
441
|
+
className: "ta-secops-foot"
|
|
442
|
+
}, proposal.status === "proposed" ? safe ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("button", {
|
|
443
|
+
type: "button",
|
|
444
|
+
className: "ta-secops-button",
|
|
445
|
+
disabled: busy,
|
|
446
|
+
onClick: () => decide(proposal.id, false)
|
|
447
|
+
}, words.reject), /* @__PURE__ */ React.createElement("button", {
|
|
448
|
+
type: "button",
|
|
449
|
+
className: "ta-secops-button ta-primary",
|
|
450
|
+
disabled: busy,
|
|
451
|
+
onClick: () => decide(proposal.id, true)
|
|
452
|
+
}, words.release)) : /* @__PURE__ */ React.createElement("span", {
|
|
453
|
+
className: "ta-secops-state ta-wait"
|
|
454
|
+
}, words.unsafe) : /* @__PURE__ */ React.createElement("span", {
|
|
455
|
+
className: "ta-secops-state"
|
|
456
|
+
}, proposal.status === "released" ? SecopsWords.format(words.released, { n: proposal.version ?? 0 }) : words.rejected)));
|
|
457
|
+
}
|
|
458
|
+
function EvidenceView({ pi, found, evidence }) {
|
|
459
|
+
const words = SecopsWords.of(pi.ui.language);
|
|
460
|
+
const [check, setCheck] = React.useState();
|
|
461
|
+
React.useEffect(() => setCheck(undefined), [evidence.id]);
|
|
462
|
+
const recheck = () => {
|
|
463
|
+
setCheck("running");
|
|
464
|
+
pi.callHost("recheck", found.id, evidence.id).then((result) => setCheck(result.same ? "same" : "changed")).catch((error) => {
|
|
465
|
+
setCheck(undefined);
|
|
466
|
+
pi.ui.notify(error instanceof Error ? error.message : String(error), "error");
|
|
467
|
+
});
|
|
468
|
+
};
|
|
469
|
+
const { source: _, ...query } = evidence.query;
|
|
470
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
471
|
+
className: "ta-secops-evidence"
|
|
472
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
473
|
+
className: "ta-secops-evidence-line"
|
|
474
|
+
}, /* @__PURE__ */ React.createElement("span", null, evidence.id, " ·", " ", SecopsWords.format(words.evidenceLine, { source: evidence.source, total: evidence.total, hash: evidence.hash.slice(0, 10) })), check === "same" || check === "changed" ? /* @__PURE__ */ React.createElement("span", {
|
|
475
|
+
className: `ta-secops-state${check === "changed" ? " ta-wait" : ""}`
|
|
476
|
+
}, check === "same" ? words.same : words.changed) : /* @__PURE__ */ React.createElement("button", {
|
|
477
|
+
type: "button",
|
|
478
|
+
className: "ta-secops-button",
|
|
479
|
+
disabled: check === "running",
|
|
480
|
+
onClick: recheck
|
|
481
|
+
}, check === "running" ? words.rechecking : words.recheck)), /* @__PURE__ */ React.createElement("pre", null, JSON.stringify(query)), evidence.sample.length > 0 && /* @__PURE__ */ React.createElement("pre", null, evidence.sample.map((row) => JSON.stringify(row)).join(`
|
|
482
|
+
`)));
|
|
483
|
+
}
|
|
484
|
+
function Correction({ pi, found, words }) {
|
|
485
|
+
const [open, setOpen] = React.useState(false);
|
|
486
|
+
const [busy, setBusy] = React.useState(false);
|
|
487
|
+
if (found.correction) {
|
|
488
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
489
|
+
className: "ta-secops-note"
|
|
490
|
+
}, SecopsWords.format(words.corrected, { verdict: words[found.correction.verdict] }));
|
|
491
|
+
}
|
|
492
|
+
const correct = (verdict) => {
|
|
493
|
+
setBusy(true);
|
|
494
|
+
pi.callHost("correct", found.id, verdict, "").catch((error) => pi.ui.notify(error instanceof Error ? error.message : String(error), "error")).finally(() => setBusy(false));
|
|
495
|
+
};
|
|
496
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
497
|
+
className: "ta-secops-foot"
|
|
498
|
+
}, open ? ["malicious", "benign", "uncertain"].filter((verdict) => verdict !== found.verdict?.verdict).map((verdict) => /* @__PURE__ */ React.createElement("button", {
|
|
499
|
+
key: verdict,
|
|
500
|
+
type: "button",
|
|
501
|
+
className: "ta-secops-button",
|
|
502
|
+
disabled: busy,
|
|
503
|
+
onClick: () => correct(verdict)
|
|
504
|
+
}, words[verdict])) : /* @__PURE__ */ React.createElement("button", {
|
|
505
|
+
type: "button",
|
|
506
|
+
className: "ta-secops-button",
|
|
507
|
+
onClick: () => setOpen(true)
|
|
508
|
+
}, words.correct));
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
// web-src/chat-icons.ts
|
|
512
|
+
class SecopsChatIcons {
|
|
513
|
+
pi;
|
|
514
|
+
files = new Set;
|
|
515
|
+
listeners = new Set;
|
|
516
|
+
constructor(pi) {
|
|
517
|
+
this.pi = pi;
|
|
518
|
+
this.read();
|
|
519
|
+
pi.storage.onChange((keys) => (keys.includes(Keys.CASES) || keys.includes(Keys.REVIEWS)) && void this.read());
|
|
520
|
+
}
|
|
521
|
+
icon(chat) {
|
|
522
|
+
const icon = this.pi.ui.icons.Shield ?? this.pi.ui.icons.ShieldCheck;
|
|
523
|
+
return chat.sessionFile && this.files.has(chat.sessionFile) && icon ? { icon, tint: "ta-secops", folder: SecopsWords.of(this.pi.ui.language).folder } : undefined;
|
|
524
|
+
}
|
|
525
|
+
subscribe(listener) {
|
|
526
|
+
this.listeners.add(listener);
|
|
527
|
+
return () => this.listeners.delete(listener);
|
|
528
|
+
}
|
|
529
|
+
async read() {
|
|
530
|
+
const [cases, reviews] = await Promise.all([
|
|
531
|
+
this.pi.storage.get(Keys.CASES).catch(() => {
|
|
532
|
+
return;
|
|
533
|
+
}),
|
|
534
|
+
this.pi.storage.get(Keys.REVIEWS).catch(() => {
|
|
535
|
+
return;
|
|
536
|
+
})
|
|
537
|
+
]);
|
|
538
|
+
const files = new Set([...Array.isArray(cases) ? cases : [], ...Array.isArray(reviews) ? reviews : []].flatMap((item) => item.sessionFile ? [item.sessionFile] : []));
|
|
539
|
+
if (files.size === this.files.size && [...files].every((file) => this.files.has(file))) {
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
542
|
+
this.files = files;
|
|
543
|
+
for (const listener of this.listeners) {
|
|
544
|
+
listener();
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
// web-src/review-card.tsx
|
|
550
|
+
function useReviews(pi) {
|
|
551
|
+
const [reviews, setReviews] = React.useState();
|
|
552
|
+
React.useEffect(() => {
|
|
553
|
+
let live = true;
|
|
554
|
+
const read = () => void pi.storage.get(Keys.REVIEWS).then((value) => live && setReviews(Array.isArray(value) ? value : [])).catch(() => live && setReviews([]));
|
|
555
|
+
read();
|
|
556
|
+
const stop = pi.storage.onChange((keys) => keys.includes(Keys.REVIEWS) && read());
|
|
557
|
+
return () => {
|
|
558
|
+
live = false;
|
|
559
|
+
stop();
|
|
560
|
+
};
|
|
561
|
+
}, [pi]);
|
|
562
|
+
return reviews;
|
|
563
|
+
}
|
|
564
|
+
function reviewCard(pi) {
|
|
565
|
+
return function ReviewCard({ message }) {
|
|
566
|
+
const words = SecopsWords.of(pi.ui.language);
|
|
567
|
+
const id = message.details?.id;
|
|
568
|
+
const reviews = useReviews(pi);
|
|
569
|
+
const [busy, setBusy] = React.useState();
|
|
570
|
+
if (typeof id !== "string" || !reviews) {
|
|
571
|
+
return null;
|
|
572
|
+
}
|
|
573
|
+
const review = reviews.find((candidate) => candidate.id === id);
|
|
574
|
+
if (!review) {
|
|
575
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
576
|
+
className: "ta-secops-case ta-secops-note"
|
|
577
|
+
}, words.gone);
|
|
578
|
+
}
|
|
579
|
+
const decide = (ref, approve) => {
|
|
580
|
+
setBusy(ref);
|
|
581
|
+
pi.callHost("decide", review.id, ref, approve).catch((error) => pi.ui.notify(error instanceof Error ? error.message : String(error), "error")).finally(() => setBusy(undefined));
|
|
582
|
+
};
|
|
583
|
+
const { stats } = review;
|
|
584
|
+
const decided = stats.verdicts.malicious + stats.verdicts.benign + stats.verdicts.uncertain;
|
|
585
|
+
const day = (at) => new Date(at).toLocaleDateString(pi.ui.language, { month: "numeric", day: "numeric" });
|
|
586
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
587
|
+
className: "ta-secops-case"
|
|
588
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
589
|
+
className: "ta-secops-head"
|
|
590
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
591
|
+
className: "ta-secops-title"
|
|
592
|
+
}, SecopsWords.format(words.review, { n: review.n })), /* @__PURE__ */ React.createElement("span", {
|
|
593
|
+
className: "ta-secops-sure"
|
|
594
|
+
}, SecopsWords.format(words.period, { from: day(stats.from), to: day(stats.to) }))), review.summary && /* @__PURE__ */ React.createElement("div", {
|
|
595
|
+
className: "ta-secops-summary"
|
|
596
|
+
}, review.summary), /* @__PURE__ */ React.createElement("div", {
|
|
597
|
+
className: "ta-secops-stats"
|
|
598
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
599
|
+
className: "ta-secops-stat"
|
|
600
|
+
}, /* @__PURE__ */ React.createElement("b", null, stats.cases), /* @__PURE__ */ React.createElement("span", null, words.casesN, " · ", stats.verdicts.malicious, "/", stats.verdicts.benign, "/", stats.verdicts.uncertain)), /* @__PURE__ */ React.createElement("div", {
|
|
601
|
+
className: "ta-secops-stat"
|
|
602
|
+
}, /* @__PURE__ */ React.createElement("b", null, decided ? `${Math.round(stats.agreed / decided * 100)}%` : "–"), /* @__PURE__ */ React.createElement("span", null, words.agreedRate)), /* @__PURE__ */ React.createElement("div", {
|
|
603
|
+
className: "ta-secops-stat"
|
|
604
|
+
}, /* @__PURE__ */ React.createElement("b", null, stats.minutesToVerdict ?? "–"), /* @__PURE__ */ React.createElement("span", null, words.minutes))), /* @__PURE__ */ React.createElement(Lines, {
|
|
605
|
+
label: words.went,
|
|
606
|
+
lines: review.went
|
|
607
|
+
}), /* @__PURE__ */ React.createElement(Lines, {
|
|
608
|
+
label: words.wrong,
|
|
609
|
+
lines: review.wrong
|
|
610
|
+
}), review.lessons.length > 0 && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
611
|
+
className: "ta-secops-label"
|
|
612
|
+
}, words.lessons), /* @__PURE__ */ React.createElement("ul", {
|
|
613
|
+
className: "ta-secops-list"
|
|
614
|
+
}, review.lessons.map((lesson) => /* @__PURE__ */ React.createElement(LessonRow, {
|
|
615
|
+
key: lesson.id,
|
|
616
|
+
lesson,
|
|
617
|
+
words,
|
|
618
|
+
busy: busy === lesson.id,
|
|
619
|
+
decide
|
|
620
|
+
})))), review.proposals.map((proposal) => /* @__PURE__ */ React.createElement(ProposalView, {
|
|
621
|
+
key: proposal.id,
|
|
622
|
+
proposal,
|
|
623
|
+
words,
|
|
624
|
+
busy: busy === proposal.id,
|
|
625
|
+
decide
|
|
626
|
+
})));
|
|
627
|
+
};
|
|
628
|
+
}
|
|
629
|
+
function Lines({ label, lines }) {
|
|
630
|
+
return lines?.length ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
631
|
+
className: "ta-secops-label"
|
|
632
|
+
}, label), /* @__PURE__ */ React.createElement("ul", {
|
|
633
|
+
className: "ta-secops-list"
|
|
634
|
+
}, lines.map((line) => /* @__PURE__ */ React.createElement("li", {
|
|
635
|
+
key: line,
|
|
636
|
+
className: "ta-secops-finding"
|
|
637
|
+
}, line)))) : null;
|
|
638
|
+
}
|
|
639
|
+
function LessonRow({ lesson, words, busy, decide }) {
|
|
640
|
+
const text = /* @__PURE__ */ React.createElement("span", {
|
|
641
|
+
className: "ta-secops-row-text"
|
|
642
|
+
}, lesson.text, lesson.why ? /* @__PURE__ */ React.createElement("span", {
|
|
643
|
+
className: "ta-secops-sure"
|
|
644
|
+
}, " · ", lesson.why) : null);
|
|
645
|
+
return lesson.status === "proposed" ? /* @__PURE__ */ React.createElement("li", {
|
|
646
|
+
className: "ta-secops-item"
|
|
647
|
+
}, text, /* @__PURE__ */ React.createElement("span", {
|
|
648
|
+
className: "ta-secops-item-buttons"
|
|
649
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
650
|
+
type: "button",
|
|
651
|
+
className: "ta-secops-button",
|
|
652
|
+
disabled: busy,
|
|
653
|
+
onClick: () => decide(lesson.id, false)
|
|
654
|
+
}, words.drop), /* @__PURE__ */ React.createElement("button", {
|
|
655
|
+
type: "button",
|
|
656
|
+
className: "ta-secops-button ta-primary",
|
|
657
|
+
disabled: busy,
|
|
658
|
+
onClick: () => decide(lesson.id, true)
|
|
659
|
+
}, words.keep))) : /* @__PURE__ */ React.createElement("li", {
|
|
660
|
+
className: "ta-secops-row"
|
|
661
|
+
}, text, /* @__PURE__ */ React.createElement("span", {
|
|
662
|
+
className: "ta-secops-state"
|
|
663
|
+
}, lesson.status === "kept" ? words.kept : words.dropped));
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
// web-src/style.ts
|
|
667
|
+
var STYLE = `
|
|
668
|
+
.ta-secops-case { margin: 4px 0; padding: 12px 14px; border: 1px solid var(--ta-border-muted); border-radius: 12px; background: var(--ta-card); font-size: calc(13px * var(--ta-font-scale)); color: var(--ta-text); }
|
|
669
|
+
.ta-secops-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
|
|
670
|
+
.ta-secops-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
|
|
671
|
+
.ta-secops-pill { flex: none; padding: 1px 8px; border-radius: 999px; font-size: calc(12px * var(--ta-font-scale)); font-weight: 500; }
|
|
672
|
+
.ta-secops-pill.ta-bad { color: var(--ta-red); background: color-mix(in srgb, var(--ta-red) 12%, transparent); }
|
|
673
|
+
.ta-secops-pill.ta-good { color: var(--ta-green); background: color-mix(in srgb, var(--ta-green) 12%, transparent); }
|
|
674
|
+
.ta-secops-pill.ta-warn { color: color-mix(in srgb, var(--ta-yellow) 80%, var(--ta-text)); background: color-mix(in srgb, var(--ta-yellow) 14%, transparent); }
|
|
675
|
+
.ta-secops-sure { flex: none; color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); }
|
|
676
|
+
.ta-secops-summary { margin-top: 8px; line-height: 1.55; overflow-wrap: anywhere; }
|
|
677
|
+
.ta-secops-label { margin-top: 12px; margin-bottom: 4px; color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); }
|
|
678
|
+
.ta-secops-list { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
|
|
679
|
+
.ta-secops-finding { line-height: 1.5; overflow-wrap: anywhere; }
|
|
680
|
+
.ta-secops-ref { display: inline-flex; align-items: center; height: 18px; margin-left: 4px; padding: 0 6px; border: 1px solid var(--ta-border); border-radius: 6px; background: transparent; color: var(--ta-muted); font: inherit; font-size: calc(11px * var(--ta-font-scale)); cursor: pointer; vertical-align: 1px; }
|
|
681
|
+
.ta-secops-ref.ta-on { border-color: var(--ta-accent); color: var(--ta-accent); }
|
|
682
|
+
.ta-secops-evidence { margin-top: 6px; padding: 8px 10px; border-radius: 8px; background: var(--ta-hover); font-size: calc(12px * var(--ta-font-scale)); }
|
|
683
|
+
.ta-secops-evidence-line { display: flex; align-items: center; gap: 8px; color: var(--ta-muted); }
|
|
684
|
+
.ta-secops-evidence-line > span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
685
|
+
.ta-secops-evidence pre { margin: 6px 0 0; max-height: 160px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: calc(11px * var(--ta-font-scale)); color: var(--ta-text); }
|
|
686
|
+
.ta-secops-row { display: flex; align-items: center; gap: 8px; min-height: 32px; }
|
|
687
|
+
.ta-secops-item { display: flex; flex-direction: column; gap: 6px; padding: 2px 0; }
|
|
688
|
+
.ta-secops-item-buttons { display: flex; justify-content: flex-end; gap: 8px; }
|
|
689
|
+
.ta-secops-row-text { flex: 1; min-width: 0; overflow-wrap: anywhere; line-height: 1.45; }
|
|
690
|
+
.ta-secops-state { flex: none; color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); }
|
|
691
|
+
.ta-secops-state.ta-wait { color: color-mix(in srgb, var(--ta-yellow) 80%, var(--ta-text)); }
|
|
692
|
+
.ta-secops-button { flex: none; min-height: 28px; padding: 0 10px; border: 1px solid var(--ta-border); border-radius: 8px; background: transparent; color: var(--ta-text); font: inherit; font-size: calc(12px * var(--ta-font-scale)); font-weight: 500; cursor: pointer; transition: background 120ms, opacity 120ms; }
|
|
693
|
+
.ta-secops-button:hover:not(:disabled) { background: var(--ta-hover); }
|
|
694
|
+
.ta-secops-button.ta-primary { border-color: var(--ta-accent); background: var(--ta-accent); color: var(--ta-accent-text, #fff); }
|
|
695
|
+
.ta-secops-button:disabled { opacity: 0.45; cursor: default; }
|
|
696
|
+
.ta-secops-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
|
|
697
|
+
.ta-secops-stat { padding: 6px 8px; border-radius: 8px; background: var(--ta-hover); }
|
|
698
|
+
.ta-secops-stat b { display: block; font-size: calc(13px * var(--ta-font-scale)); font-weight: 600; }
|
|
699
|
+
.ta-secops-stat span { color: var(--ta-muted); font-size: calc(11px * var(--ta-font-scale)); }
|
|
700
|
+
.ta-secops-stat .ta-up { color: var(--ta-green); }
|
|
701
|
+
.ta-secops-stat .ta-down { color: var(--ta-red); }
|
|
702
|
+
.ta-secops-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
|
|
703
|
+
.ta-secops-note { margin-top: 10px; color: var(--ta-muted); font-size: calc(11px * var(--ta-font-scale)); }
|
|
704
|
+
[data-touch] .ta-secops-button { min-height: 34px; padding: 0 14px; }
|
|
705
|
+
[data-touch] .ta-secops-ref { height: 22px; }
|
|
706
|
+
`;
|
|
707
|
+
function injectStyle() {
|
|
708
|
+
const element = document.createElement("style");
|
|
709
|
+
element.dataset.taPackage = "ta-secops";
|
|
710
|
+
element.textContent = STYLE;
|
|
711
|
+
document.head.appendChild(element);
|
|
712
|
+
return () => element.remove();
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
// web-src/index.tsx
|
|
716
|
+
function activate(pi) {
|
|
717
|
+
bind(pi.React);
|
|
718
|
+
const removeStyle = injectStyle();
|
|
719
|
+
pi.registerMessageRenderer(CASE_TYPE, caseCard(pi));
|
|
720
|
+
pi.registerMessageRenderer(REVIEW_TYPE, reviewCard(pi));
|
|
721
|
+
pi.registerChatIcon?.(new SecopsChatIcons(pi));
|
|
722
|
+
pi.registerToolRenderer?.((name, next) => {
|
|
723
|
+
const words = SecopsWords.of(pi.ui.language);
|
|
724
|
+
switch (name) {
|
|
725
|
+
case TOOLS.QUERY:
|
|
726
|
+
return { renderCall: (args) => ({ verb: words.toolQuery, target: typeof args.source === "string" ? args.source : "" }) };
|
|
727
|
+
case TOOLS.REPLAY:
|
|
728
|
+
return { renderCall: () => ({ verb: words.toolReplay, target: "" }) };
|
|
729
|
+
case TOOLS.REVIEW:
|
|
730
|
+
return { renderCall: (args) => ({ verb: words.toolReview, target: typeof args.summary === "string" ? args.summary : "" }) };
|
|
731
|
+
case TOOLS.VERDICT:
|
|
732
|
+
return { renderCall: (args) => ({ verb: words.toolVerdict, target: typeof args.summary === "string" ? args.summary : "" }) };
|
|
733
|
+
default:
|
|
734
|
+
return next();
|
|
735
|
+
}
|
|
736
|
+
});
|
|
737
|
+
return removeStyle;
|
|
738
|
+
}
|
|
739
|
+
export {
|
|
740
|
+
activate as default
|
|
741
|
+
};
|