dsh-textru-unique 0.0.0-stage → 1.0.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 DSH Plugins contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,64 @@
1
- # Temporary Holding Version
1
+ # Text.ru uniqueness
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Host plugin for DeepSeek Harness that checks text uniqueness through the
4
+ [text.ru](https://text.ru) API and tells the agent what exactly to rewrite.
5
+
6
+ ## Tools
7
+
8
+ | Tool | What it returns |
9
+ |---|---|
10
+ | `textru_unique` | uniqueness score, report link, matching sources with their percentage, and the fragments of your text that are not unique |
11
+ | `textru_balance` | characters left on the account |
12
+
13
+ Because the API returns the word indexes of every match, the plugin turns them back into
14
+ sentences of the original text — so the agent rewrites the flagged fragments instead of
15
+ guessing.
16
+
17
+ ## Install
18
+
19
+ 1. Get a `userkey` in your text.ru account (API section).
20
+ 2. Store it in the DSH credential store as `TEXT_RU_KEY`.
21
+ 3. Install the bundle and use the tools: ask the agent to check uniqueness, or call
22
+ `textru_unique` directly.
23
+
24
+ The key is read from the credential store on every call; it is never written into this
25
+ package or into the configuration.
26
+
27
+ ## Configuration
28
+
29
+ | Field | Default | Meaning |
30
+ |---|---|---|
31
+ | `apiKeyEnv` | `TEXT_RU_KEY` | credential name holding the text.ru key |
32
+ | `pollIntervalMs` | `4000` | first poll delay, growing to 10 s |
33
+ | `timeoutMs` | `300000` | how long one check may take |
34
+
35
+ ## Limits and costs
36
+
37
+ - Minimum 100 characters per check; longer texts are accepted up to 150 000.
38
+ - Every check spends characters from your balance, including repeated checks after a rewrite.
39
+ - The service allows up to 10 texts per second and 3 000 000 characters per hour.
40
+ - Text.ru compares against the open web, not against closed university databases.
41
+
42
+ ## Example
43
+
44
+ ```text
45
+ Agent: textru_unique({ text: "..." })
46
+ → 43.51% · 2 sources · 4 fragments
47
+ ```
48
+
49
+ ## API-ключ
50
+
51
+ В карточке «Настройки → text.ru» есть поле «Ключ text.ru». Значение сохраняется в защищённом
52
+ хранилище креденшелов профиля (`DSH_HOME/.credentials.yaml`), а не в `cordis.patch.yml`
53
+ плагина, поэтому в контекст модели ключ не попадает. Хостовые инструменты читают его по имени
54
+ `TEXT_RU_KEY` (или из переменной окружения с этим именем; имя можно изменить полем
55
+ `apiKeyEnv` в конфиге плагина). Подсказка «?» рядом с полем предупреждает, что хранилище — файл
56
+ на диске, и перечисляет альтернативные способы передачи ключа.
57
+
58
+ ## License
59
+
60
+ MIT.
61
+
62
+ ---
63
+
64
+ Сделано в [SEO Fortuna](https://seofortuna.ru) — агентство SEO и AI-автоматизации; здесь же лежат остальные плагины DSH.
@@ -0,0 +1,7 @@
1
+ - insert:
2
+ - id: textru-unique
3
+ name: 'dsh-textru-unique'
4
+ config:
5
+ apiKeyEnv: TEXT_RU_KEY
6
+ pollIntervalMs: 4000
7
+ timeoutMs: 300000
package/icon.svg ADDED
@@ -0,0 +1,7 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64" role="img" aria-label="Text.ru uniqueness">
2
+ <rect x="2" y="2" width="60" height="60" rx="14" fill="#0f766e"/>
3
+ <path d="M16 22 H48" stroke="#ecfeff" stroke-width="4" stroke-linecap="round"/>
4
+ <path d="M26 22 V46" stroke="#ecfeff" stroke-width="4" stroke-linecap="round"/>
5
+ <path d="M36 34 L48 46" stroke="#a5f3fc" stroke-width="4" stroke-linecap="round"/>
6
+ <path d="M48 34 L36 46" stroke="#a5f3fc" stroke-width="4" stroke-linecap="round"/>
7
+ </svg>
package/index.js ADDED
@@ -0,0 +1,255 @@
1
+ /**
2
+ * Text.ru uniqueness checks for DeepSeek Harness.
3
+ *
4
+ * Registers two tools:
5
+ * textru_unique — submit text, wait for the check, return score, sources and flagged fragments
6
+ * textru_balance — remaining characters on the account
7
+ *
8
+ * The API key is read per call from the credential store (default name TEXT_RU_KEY) and never
9
+ * stored in configuration. Protocol: POST https://api.text.ru/post, then poll the same endpoint
10
+ * with the uid until `text_unique` arrives.
11
+ */
12
+
13
+ const API = 'https://api.text.ru'
14
+
15
+ const FATAL = {
16
+ 110: 'text is missing',
17
+ 111: 'text is empty',
18
+ 112: 'text is too short (100 characters minimum)',
19
+ 113: 'text is too long — split it into parts',
20
+ 120: 'API key is missing',
21
+ 121: 'API key is empty',
22
+ 141: 'unknown API key',
23
+ 142: 'not enough characters on the balance',
24
+ 146: 'access is restricted',
25
+ 150: 'text is too short to find shingles',
26
+ 180: 'key/uid pair is unknown',
27
+ 182: 'the check failed, characters are refunded',
28
+ 429: 'rate limit reached (10 texts/second, 3M characters/hour)',
29
+ }
30
+
31
+ function fail(code, desc) {
32
+ return new Error(`text.ru ${code}: ${FATAL[code] ?? desc ?? 'unknown error'}`)
33
+ }
34
+
35
+ async function post(body) {
36
+ const res = await fetch(`${API}/post`, {
37
+ method: 'POST',
38
+ headers: { 'content-type': 'application/json' },
39
+ body: JSON.stringify(body),
40
+ })
41
+ const data = await res.json().catch(() => ({}))
42
+ return data
43
+ }
44
+
45
+ function asObject(value) {
46
+ if (!value) return null
47
+ if (typeof value === 'object') return value
48
+ try {
49
+ const parsed = JSON.parse(value)
50
+ return typeof parsed === 'object' && parsed !== null ? parsed : null
51
+ } catch {
52
+ return null
53
+ }
54
+ }
55
+
56
+ function tokenize(text) {
57
+ const out = []
58
+ const re = /[A-Za-zА-Яа-яЁё0-9]+(?:[-'][A-Za-zА-Яа-яЁё0-9]+)*/g
59
+ let m
60
+ while ((m = re.exec(text))) out.push({ start: m.index, end: m.index + m[0].length })
61
+ return out
62
+ }
63
+
64
+ /** Turn text.ru word indexes into sentence-sized fragments of the original text. */
65
+ function fragmentsOf(text, resultJson) {
66
+ const urls = resultJson?.urls ?? []
67
+ if (!urls.length) return []
68
+ const tokens = tokenize(text)
69
+ const clearCount = String(resultJson.clear_text ?? '').split(/\s+/).filter(Boolean).length
70
+ if (!tokens.length) return []
71
+ if (clearCount && Math.abs(tokens.length - clearCount) > Math.max(3, tokens.length * 0.05)) return []
72
+
73
+ const byToken = new Map()
74
+ for (const entry of urls) {
75
+ const indexes = String(entry.words ?? '').split(/\s+/).filter(Boolean).map(Number)
76
+ for (const index of indexes) {
77
+ const token = tokens[index]
78
+ if (!token) continue
79
+ const existing = byToken.get(token.start)
80
+ if (existing) existing.sources.push({ url: entry.url, plagiat: entry.plagiat })
81
+ else byToken.set(token.start, { start: token.start, sources: [{ url: entry.url, plagiat: entry.plagiat }] })
82
+ }
83
+ }
84
+
85
+ const sentenceStart = (pos) => {
86
+ for (let i = pos - 1; i >= 0; i -= 1) if (/[.!?\n]/.test(text[i])) return i + 1
87
+ return 0
88
+ }
89
+ const sentenceEnd = (pos) => {
90
+ for (let i = pos; i < text.length; i += 1) if (/[.!?\n]/.test(text[i])) return i + 1
91
+ return text.length
92
+ }
93
+
94
+ const ranges = []
95
+ for (const start of [...byToken.keys()].sort((a, b) => a - b)) {
96
+ const from = sentenceStart(start)
97
+ const to = sentenceEnd(start)
98
+ const last = ranges[ranges.length - 1]
99
+ if (last && from <= last.to) {
100
+ last.to = Math.max(last.to, to)
101
+ for (const source of byToken.get(start).sources) {
102
+ if (!last.sources.some((s) => s.url === source.url)) last.sources.push(source)
103
+ }
104
+ } else {
105
+ ranges.push({ from, to, sources: [...byToken.get(start).sources] })
106
+ }
107
+ }
108
+
109
+ return ranges
110
+ .map((range) => ({ text: text.slice(range.from, range.to).trim(), sources: range.sources }))
111
+ .filter((fragment) => fragment.text.length > 30)
112
+ }
113
+
114
+ export const name = 'textru-unique'
115
+
116
+ export const inject = ['tools']
117
+
118
+ export function apply(ctx, config = {}) {
119
+ const apiKeyEnv = typeof config.apiKeyEnv === 'string' && config.apiKeyEnv ? config.apiKeyEnv : 'TEXT_RU_KEY'
120
+ const pollIntervalMs = Number(config.pollIntervalMs) > 0 ? Number(config.pollIntervalMs) : 4000
121
+ const timeoutMs = Number(config.timeoutMs) > 0 ? Number(config.timeoutMs) : 300000
122
+
123
+ async function apiKey() {
124
+ const credentials = ctx.get('credentials')
125
+ if (credentials) {
126
+ const resolved = await credentials.resolve(apiKeyEnv)
127
+ if (resolved?.value) return resolved.value
128
+ }
129
+ const fromEnv = process.env[apiKeyEnv]
130
+ if (fromEnv) return fromEnv
131
+ throw new Error(
132
+ `text.ru API key is not configured: store it as ${apiKeyEnv} in the DSH credential store`,
133
+ )
134
+ }
135
+
136
+ async function submit(text, options) {
137
+ const body = { userkey: await apiKey(), text }
138
+ if (options?.exceptdomain) body.exceptdomain = options.exceptdomain
139
+ if (options?.excepturl) body.excepturl = options.excepturl
140
+ const result = await post(body)
141
+ if (result.error_code) throw fail(result.error_code, result.error_desc)
142
+ if (!result.text_uid) throw new Error('text.ru returned no uid')
143
+ return result.text_uid
144
+ }
145
+
146
+ async function poll(uid, signal) {
147
+ const started = Date.now()
148
+ let delay = 2000
149
+ for (;;) {
150
+ if (signal?.aborted) throw new Error('aborted')
151
+ const result = await post({ userkey: await apiKey(), uid, jsonvisible: 'detail' })
152
+ if (!result.error_code) return result
153
+ if (result.error_code !== 181) throw fail(result.error_code, result.error_desc)
154
+ if (Date.now() - started > timeoutMs) {
155
+ throw new Error(`text.ru did not finish in ${Math.round(timeoutMs / 1000)}s (uid ${uid})`)
156
+ }
157
+ await new Promise((resolve) => setTimeout(resolve, delay))
158
+ delay = Math.min(delay + 1000, 10000)
159
+ }
160
+ }
161
+
162
+ async function check(text, options, signal) {
163
+ if (typeof text !== 'string' || text.trim().length < 100) {
164
+ throw new Error('text.ru accepts texts of 100 characters and more')
165
+ }
166
+ const uid = await submit(text, options)
167
+ const result = await poll(uid, signal)
168
+ const resultJson = asObject(result.result_json) ?? {}
169
+ const seo = asObject(result.seo_check)
170
+ return {
171
+ unique: Number(result.text_unique ?? resultJson.unique ?? 0),
172
+ uid,
173
+ link: `https://text.ru/antiplagiat/${uid}`,
174
+ checkedAt: resultJson.date_check ?? '',
175
+ sources: (resultJson.urls ?? []).map((entry) => ({ url: entry.url, plagiat: entry.plagiat })),
176
+ fragments: fragmentsOf(text, resultJson),
177
+ waterPercent: seo?.water_percent ?? null,
178
+ spamPercent: seo?.spam_percent ?? null,
179
+ words: seo?.count_words ?? null,
180
+ }
181
+ }
182
+
183
+ ctx.effect(() =>
184
+ ctx.tools.register({
185
+ name: 'textru_unique',
186
+ description:
187
+ 'Check text uniqueness through the text.ru API. Submits the text, waits for the result and returns the score, the matching sources and the fragments that make the text non-unique. Use it when a brief requires a uniqueness threshold; rewrite flagged fragments and check again.',
188
+ parameters: {
189
+ type: 'object',
190
+ properties: {
191
+ text: {
192
+ type: 'string',
193
+ description: 'Text to check, at least 100 characters.',
194
+ },
195
+ exceptdomain: {
196
+ type: 'string',
197
+ description: 'Comma- or space-separated domains to exclude from the check, e.g. the client site.',
198
+ },
199
+ excepturl: {
200
+ type: 'string',
201
+ description: 'Comma- or space-separated URLs to exclude from the check.',
202
+ },
203
+ },
204
+ required: ['text'],
205
+ additionalProperties: false,
206
+ },
207
+ output: {
208
+ schema: {
209
+ type: 'object',
210
+ properties: {
211
+ unique: { type: 'number' },
212
+ uid: { type: 'string' },
213
+ link: { type: 'string' },
214
+ checkedAt: { type: 'string' },
215
+ sources: { type: 'array', items: { type: 'object' } },
216
+ fragments: { type: 'array', items: { type: 'object' } },
217
+ },
218
+ additionalProperties: true,
219
+ },
220
+ render: (args, value) => {
221
+ const summary = [
222
+ `Uniqueness: ${value.unique}%`,
223
+ `Report: ${value.link}`,
224
+ value.sources.length ? `Sources: ${value.sources.length}` : 'No matches found',
225
+ value.fragments.length ? `Fragments to rewrite: ${value.fragments.length}` : '',
226
+ ].filter(Boolean)
227
+ return [{ type: 'text', text: summary.join('\n') }]
228
+ },
229
+ },
230
+ execute: async (args, exec) => check(args.text, args, exec?.signal),
231
+ }),
232
+ )
233
+
234
+ ctx.effect(() =>
235
+ ctx.tools.register({
236
+ name: 'textru_balance',
237
+ description: 'Remaining text.ru characters on the account that owns the configured API key.',
238
+ parameters: { type: 'object', properties: {}, additionalProperties: false },
239
+ output: {
240
+ schema: { type: 'object', properties: { size: { type: 'number' } }, additionalProperties: false },
241
+ render: (args, value) => [{ type: 'text', text: `text.ru balance: ${value.size} characters` }],
242
+ },
243
+ execute: async () => {
244
+ const res = await fetch(`${API}/account`, {
245
+ method: 'POST',
246
+ headers: { 'content-type': 'application/json' },
247
+ body: JSON.stringify({ userkey: await apiKey(), method: 'get_packages_info' }),
248
+ })
249
+ const data = await res.json().catch(() => ({}))
250
+ if (data.error_code) throw fail(data.error_code, data.error_desc)
251
+ return { size: Number(data.size ?? 0) }
252
+ },
253
+ }),
254
+ )
255
+ }
package/lib/client.js ADDED
@@ -0,0 +1,191 @@
1
+ /**
2
+ * dsh-textru-unique — browser half.
3
+ *
4
+ * Карточка «Настройки → text.ru»: поле API-ключа, который сохраняется в
5
+ * защищённое хранилище креденшелов профиля (DSH_HOME/.credentials.yaml),
6
+ * а не в конфиг плагина. Хост читает ключ из того же хранилища по имени
7
+ * TEXT_RU_KEY (или из переменной окружения с этим именем).
8
+ */
9
+ window.__ModuleLoader__.load({
10
+ id: "dsh-textru-unique",
11
+ factory: (require) => {
12
+ var module = { exports: {} };
13
+ var exports = module.exports;
14
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
15
+ let react = require("react");
16
+
17
+ const ENV = "TEXT_RU_KEY";
18
+ const KEY_URL = "https://text.ru/api/";
19
+
20
+ const wrap = { display: "flex", flexDirection: "column", gap: "12px", padding: "16px", maxWidth: "760px", lineHeight: 1.5 };
21
+ const heading = { fontSize: "15px", fontWeight: 600, margin: 0 };
22
+ const paragraph = { margin: 0, fontSize: "13px", opacity: 0.85 };
23
+ const note = { margin: 0, fontSize: "12px", opacity: 0.65 };
24
+ const row = { display: "flex", alignItems: "center", gap: "8px", flexWrap: "wrap" };
25
+ const label = { fontSize: "12px", opacity: 0.75, minWidth: "120px" };
26
+ const input = { fontSize: "12px", padding: "4px 8px", borderRadius: "6px", border: "1px solid currentColor", background: "transparent", color: "inherit", minWidth: "260px" };
27
+ const chip = { fontSize: "11px", opacity: 0.7, border: "1px solid currentColor", borderRadius: "999px", padding: "1px 8px" };
28
+ const button = { fontSize: "12px", padding: "5px 12px", borderRadius: "6px", border: "1px solid currentColor", background: "transparent", color: "inherit", cursor: "pointer" };
29
+ const buttonDanger = { ...button, opacity: 0.8 };
30
+ const error = { margin: 0, fontSize: "12px", color: "#e5484d" };
31
+ const ok = { margin: 0, fontSize: "12px", color: "#30a46c" };
32
+ const divider = { height: "1px", background: "currentColor", opacity: 0.15 };
33
+ const link = { color: "inherit", textDecoration: "underline", textUnderlineOffset: "2px" };
34
+
35
+ const KEY_WARNING = "Ключ сохраняется в защищённом хранилище креденшелов профиля (DSH_HOME/.credentials.yaml), а не в cordis.patch.yml этого плагина, поэтому в контекст модели он не попадает. Но это файл на диске: при полном доступе к файловой системе агент теоретически может его прочитать — не вставляйте ключи в чат. Альтернативы: 1) переменная окружения " + ENV + " перед запуском DSH; 2) вручную в DSH_HOME/.credentials.yaml, раздел refs; 3) имя переменной можно изменить полем apiKeyEnv в конфиге плагина.";
36
+
37
+ /** Кастомная подсказка: title в webview не всплывает. */
38
+ function Tooltip(props) {
39
+ const [open, setOpen] = react.useState(false);
40
+ return react.createElement("span", {
41
+ style: { position: "relative", display: "inline-flex" },
42
+ onMouseEnter: () => setOpen(true),
43
+ onMouseLeave: () => setOpen(false),
44
+ onFocus: () => setOpen(true),
45
+ onBlur: () => setOpen(false),
46
+ tabIndex: 0,
47
+ "aria-label": props.text,
48
+ },
49
+ props.children,
50
+ open && react.createElement("span", {
51
+ role: "tooltip",
52
+ style: {
53
+ position: "absolute", top: "100%", left: 0, marginTop: "6px",
54
+ width: "340px", maxWidth: "70vw", zIndex: 1000,
55
+ padding: "8px 10px", borderRadius: "8px",
56
+ border: "1px solid color-mix(in srgb, currentColor 25%, transparent)",
57
+ background: "var(--dsw-specific-menu, rgba(24,24,28,0.97))",
58
+ color: "inherit", fontSize: "12px", lineHeight: 1.45,
59
+ whiteSpace: "normal", boxShadow: "0 8px 28px rgba(0,0,0,0.28)",
60
+ }
61
+ }, props.text)
62
+ );
63
+ }
64
+
65
+ async function callRemote(rpcCall) {
66
+ return rpcCall;
67
+ }
68
+
69
+ function TextruSettings(props) {
70
+ const ctx = props.ctx;
71
+ const [info, setInfo] = react.useState({});
72
+ const [draft, setDraft] = react.useState("");
73
+ const [busy, setBusy] = react.useState(false);
74
+ const [message, setMessage] = react.useState("");
75
+ const [failure, setFailure] = react.useState("");
76
+
77
+ const load = react.useCallback(async () => {
78
+ try {
79
+ const response = await ctx.remote.credentials.describe([ENV]);
80
+ if (response && response.ok === true) {
81
+ setInfo((response.value && response.value[ENV]) || {});
82
+ setFailure("");
83
+ } else {
84
+ setFailure(response && response.error ? response.error.message : "не удалось получить статус ключа");
85
+ }
86
+ } catch (cause) {
87
+ setFailure(String(cause));
88
+ }
89
+ }, [ctx]);
90
+
91
+ react.useEffect(() => { load(); }, [load]);
92
+
93
+ const save = async () => {
94
+ const value = draft.trim();
95
+ if (value.length === 0) return;
96
+ setBusy(true);
97
+ setMessage("");
98
+ setFailure("");
99
+ try {
100
+ const response = await ctx.remote.credentials.set(ENV, value);
101
+ if (response && response.ok === true) {
102
+ setDraft("");
103
+ setMessage("Ключ сохранён: " + ENV);
104
+ await load();
105
+ } else {
106
+ setFailure(response && response.error ? response.error.message : "не удалось сохранить");
107
+ }
108
+ } catch (cause) {
109
+ setFailure(String(cause));
110
+ } finally {
111
+ setBusy(false);
112
+ }
113
+ };
114
+
115
+ const remove = async () => {
116
+ setBusy(true);
117
+ setMessage("");
118
+ setFailure("");
119
+ try {
120
+ const response = await ctx.remote.credentials.unset(ENV);
121
+ if (response && response.ok === true) {
122
+ setMessage("Ключ удалён: " + ENV);
123
+ await load();
124
+ } else {
125
+ setFailure(response && response.error ? response.error.message : "не удалось удалить");
126
+ }
127
+ } catch (cause) {
128
+ setFailure(String(cause));
129
+ } finally {
130
+ setBusy(false);
131
+ }
132
+ };
133
+
134
+ const configured = info.configured === true;
135
+ return react.createElement("div", { style: wrap },
136
+ react.createElement("h2", { style: heading }, "text.ru: проверка уникальности"),
137
+ react.createElement("p", { style: paragraph },
138
+ "Ключ text.ru нужен для инструментов textru_unique и textru_balance. Он хранится в хранилище креденшелов профиля, а не в конфиге плагина."
139
+ ),
140
+ react.createElement("h3", { style: heading, fontSize: "13px" }, "API-ключ"),
141
+ react.createElement("div", { style: row },
142
+ react.createElement("span", { style: label }, "Ключ text.ru"),
143
+ react.createElement("span", { style: chip }, ENV),
144
+ react.createElement("input", {
145
+ style: input,
146
+ type: "password",
147
+ autoComplete: "new-password",
148
+ placeholder: configured ? (info.masked || "ключ сохранён") : "API-ключ text.ru",
149
+ value: draft,
150
+ onChange: (event) => setDraft(event.target.value),
151
+ onKeyDown: (event) => { if (event.key === "Enter") save(); },
152
+ }),
153
+ react.createElement("button", { style: button, disabled: busy || draft.trim().length === 0, onClick: save }, "Сохранить"),
154
+ configured && react.createElement("button", { style: buttonDanger, disabled: busy, onClick: remove }, "Удалить"),
155
+ react.createElement("span", { style: chip }, configured ? "задан" : "не задан"),
156
+ react.createElement(Tooltip, { text: KEY_WARNING }, "?"),
157
+ react.createElement("a", { style: link, href: KEY_URL, target: "_blank", rel: "noopener noreferrer" }, "где взять ключ")
158
+ ),
159
+ message.length > 0 && react.createElement("p", { style: ok }, message),
160
+ failure.length > 0 && react.createElement("p", { style: error }, failure),
161
+ react.createElement("div", { style: divider }),
162
+ react.createElement("p", { style: note },
163
+ "Альтернатива: переменная окружения " + ENV + " перед запуском DSH, либо вручную в DSH_HOME/.credentials.yaml (раздел refs). По умолчанию хост читает имя " + ENV + "; изменить имя можно полем apiKeyEnv в конфиге плагина."
164
+ )
165
+ );
166
+ }
167
+
168
+ const name = "textru-unique";
169
+ const inject = ["slots", "remote", "remote.credentials"];
170
+
171
+ function apply(ctx) {
172
+ try {
173
+ ctx.slots.inject("settings.section", () => ctx.slots.register({
174
+ name: "settings.section",
175
+ id: "textru-unique",
176
+ order: 47,
177
+ label: () => "text.ru",
178
+ inject: () => ({ ctx })
179
+ }, TextruSettings));
180
+ } catch (cause) {
181
+ console.error("[textru-unique] не удалось смонтировать карточку:", cause);
182
+ }
183
+ }
184
+
185
+ exports.TextruSettings = TextruSettings;
186
+ exports.apply = apply;
187
+ exports.inject = inject;
188
+ exports.name = name;
189
+ return module.exports;
190
+ }
191
+ });
package/locale/en.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Text.ru uniqueness",
4
+ "description": "Checks text uniqueness through the text.ru API and returns the score, matching sources and the fragments that need a rewrite."
5
+ }
6
+ }
package/locale/ru.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Проверка уникальности text.ru",
4
+ "description": "Проверяет уникальность текста через API text.ru и возвращает процент, найденные источники и фрагменты, которые нужно переписать."
5
+ }
6
+ }
package/package.json CHANGED
@@ -1,6 +1,56 @@
1
1
  {
2
2
  "name": "dsh-textru-unique",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.1",
4
+ "description": "Text.ru uniqueness checks for DeepSeek Harness: submits text through the text.ru API, reports the score, sources and non-unique fragments",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "keywords": [
8
+ "dsh-plugin",
9
+ "textru",
10
+ "uniqueness",
11
+ "seo",
12
+ "antiplagiat"
13
+ ],
14
+ "exports": {
15
+ ".": "./index.js",
16
+ "./client": "./lib/client.js",
17
+ "./locale/*.json": "./locale/*.json",
18
+ "./icon": "./icon.svg"
19
+ },
20
+ "files": [
21
+ "index.js",
22
+ "lib/client.js",
23
+ "cordis.patch.yml",
24
+ "locale/*.json",
25
+ "icon.svg",
26
+ "README.md",
27
+ "LICENSE"
28
+ ],
29
+ "dsh": {
30
+ "bundle": {
31
+ "patch": "./cordis.patch.yml"
32
+ },
33
+ "client": {
34
+ "platform": "web",
35
+ "inject": [
36
+ "@deepseek-ai/dsh-client-ui-settings",
37
+ "@deepseek-ai/dsh-api-remotes"
38
+ ]
39
+ }
40
+ },
41
+ "homepage": "https://seofortuna.ru",
42
+ "repository": {
43
+ "type": "git",
44
+ "url": "git+https://github.com/maburykh-gif/dsh-plugins.git",
45
+ "directory": "packages/textru-unique"
46
+ },
47
+ "bugs": {
48
+ "url": "https://github.com/maburykh-gif/dsh-plugins/issues"
49
+ },
50
+ "peerDependencies": {
51
+ "@deepseek-ai/dsh": "^0.2.2-rc.1",
52
+ "@deepseek-ai/dsh-api-remotes": "^0.2.2-rc.1",
53
+ "@deepseek-ai/dsh-client-ui-settings": "^0.2.2-rc.1",
54
+ "react": "^18.2.0"
55
+ }
56
+ }