odant-work 1.0.19 → 1.0.21
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/#system/package-manifest.json +35 -22
- package/$server/$folder/$class/$structure/handlers/pages/form/chat/$handler/chat.js +21 -2
- package/$server/$folder/lib/chat-item/chat-item.js +17 -1
- package/$server/$folder/lib/local-models-transfer/local-models-transfer.js +972 -0
- package/MODELS/$ai/$folder/$class/$provider/handlers/pages/form/trainer/$handler/trainer.js +427 -106
- package/MODELS/Local/$provider/handlers/methods/transfer/$handler/class.js +41 -0
- package/package.json +1 -1
- package/rules/threats.md +117 -116
- package/sources/client.js +1 -0
- package/sources/data/progress.md +15 -0
- package/sources/host/auto-updater.js +30 -2
- package/sources/host/http-server.js +23 -0
- package/sources/host/websocket.js +127 -120
- package/sources/modules/agent/index.js +6 -1
- package/sources/modules/agent/readme.md +217 -216
- package/sources/modules/agent/tools/chrome.js +263 -0
- package/sources/modules/bridge/chrome.js +673 -0
- package/sources/modules/bridge/hub.js +395 -361
- package/sources/modules/chrome-extension/background.js +299 -0
- package/sources/modules/chrome-extension/manifest.json +25 -0
- package/sources/modules/chrome-extension/options.html +48 -0
- package/sources/modules/chrome-extension/options.js +104 -0
- package/sources/modules/chrome-extension/popup.html +25 -0
- package/sources/modules/chrome-extension/popup.js +32 -0
- package/sources/modules/trainer/halogen.js +16 -4
- package/sources/modules/trainer/huggingface.js +471 -95
- package/sources/modules/trainer/index.js +288 -1
- package/sources/modules/trainer/runner.js +54 -4
- package/sources/modules/trainer/tar-stream.js +458 -0
- package/sources/modules/trainer/transfer.js +1570 -0
- package/sources/modules/user-profile/user-profile.js +34 -10
- package/sources/modules/user-profile/user-token.js +168 -0
|
@@ -42,12 +42,16 @@ ODA({ is: 'user-profile', imports: 'oda//otp.js',
|
|
|
42
42
|
<span>{{state.label}}</span>
|
|
43
43
|
<oda-icon ~if="state.icon" :icon="state.icon"></oda-icon>
|
|
44
44
|
</button>
|
|
45
|
-
<div ~if="isLogin && state?.name === 'ok' && !showCode" vertical style="gap: 8px; width: 100%;">
|
|
46
|
-
<
|
|
47
|
-
|
|
45
|
+
<div ~if="isLogin && state?.name === 'ok' && !showCode" vertical style="gap: 8px; width: 100%; border-top: 1px solid rgba(128,128,128,.3); padding-top: 12px; margin-top: 4px;">
|
|
46
|
+
<div style="font-size: medium; font-weight: 600; text-align: center;">Подключения</div>
|
|
47
|
+
<button center horizontal flex @tap.stop.prevent="mcp_token" title="Один токен для внешних ИИ-клиентов (MCP) и расширения WORK Chrome Bridge">
|
|
48
|
+
<span>Токен для подключения</span>
|
|
48
49
|
</button>
|
|
50
|
+
<div style="font-size: small; text-align: center; opacity: 0.75; line-height: 1.35;">
|
|
51
|
+
Этот же токен вместе с адресом WORK вводится в расширении <b>WORK Chrome Bridge</b> и MCP-клиентах.
|
|
52
|
+
</div>
|
|
49
53
|
<button center horizontal flex @tap.stop.prevent="mcp_list" title="Список токенов: срок жизни, последнее использование, отзыв по одному">
|
|
50
|
-
<span
|
|
54
|
+
<span>Список токенов…</span>
|
|
51
55
|
</button>
|
|
52
56
|
<div ~if="mcpList" vertical style="gap: 8px; width: 100%;">
|
|
53
57
|
<div ~if="!mcpList.length" style="font-size: small; text-align: center;">токенов нет</div>
|
|
@@ -58,7 +62,7 @@ ODA({ is: 'user-profile', imports: 'oda//otp.js',
|
|
|
58
62
|
</div>
|
|
59
63
|
</div>
|
|
60
64
|
<button center horizontal flex @tap.stop.prevent="mcp_revoke">
|
|
61
|
-
<span>Отозвать
|
|
65
|
+
<span>Отозвать все токены</span>
|
|
62
66
|
</button>
|
|
63
67
|
</div>
|
|
64
68
|
</div>
|
|
@@ -229,15 +233,33 @@ ODA({ is: 'user-profile', imports: 'oda//otp.js',
|
|
|
229
233
|
get workSecure() {
|
|
230
234
|
return ODA.LocalStorage.create('work-secure');
|
|
231
235
|
},
|
|
232
|
-
/** Токен
|
|
236
|
+
/** Токен подключения (MCP и WORK Chrome Bridge): выпускается вошедшим пользователем, показывается один раз. */
|
|
233
237
|
async mcp_token() {
|
|
234
238
|
try {
|
|
235
|
-
await WORK.showConfirm('Выпустить токен для
|
|
239
|
+
await WORK.showConfirm('Выпустить персональный токен для подключения (WORK Chrome Bridge, OpenCode, Claude Code…)? Он даёт доступ к WORK с вашими правами и покажется один раз.');
|
|
236
240
|
}
|
|
237
241
|
catch { return; }
|
|
238
242
|
try {
|
|
239
|
-
const r = await WORK.fetch('/', 'mcp_token_create', {}, { label: 'MCP
|
|
240
|
-
|
|
243
|
+
const r = await WORK.fetch('/', 'mcp_token_create', {}, { label: 'Подключение (MCP / Chrome)' });
|
|
244
|
+
if (this.mcpList)
|
|
245
|
+
this.mcpList = await WORK.fetch('/', 'mcp_token_list', {}, {});
|
|
246
|
+
if (typeof WORK.showModal === 'function') {
|
|
247
|
+
const dlg = ODA.createComponent('user-token', {
|
|
248
|
+
token: r.token,
|
|
249
|
+
origin: location.origin,
|
|
250
|
+
});
|
|
251
|
+
try {
|
|
252
|
+
await WORK.showModal(dlg, {
|
|
253
|
+
TITLE: { label: 'Токен подключения' },
|
|
254
|
+
allowClose: true,
|
|
255
|
+
BUTTONS: [],
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
catch { /* закрыли окно */ }
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
prompt('Токен подключения — скопируйте, повторно он не показывается.\nАдрес сервера: ' + location.origin + '\nАдрес MCP: ' + location.origin + '/mcp', r.token);
|
|
262
|
+
}
|
|
241
263
|
}
|
|
242
264
|
catch (e) {
|
|
243
265
|
this.text = e.message;
|
|
@@ -245,11 +267,13 @@ ODA({ is: 'user-profile', imports: 'oda//otp.js',
|
|
|
245
267
|
},
|
|
246
268
|
async mcp_revoke() {
|
|
247
269
|
try {
|
|
248
|
-
await WORK.showConfirm('Отозвать все токены
|
|
270
|
+
await WORK.showConfirm('Отозвать все токены подключения? Подключённые внешние клиенты и Chrome Bridge перестанут работать.');
|
|
249
271
|
}
|
|
250
272
|
catch { return; }
|
|
251
273
|
try {
|
|
252
274
|
const r = await WORK.fetch('/', 'mcp_token_revoke', {}, { all: true });
|
|
275
|
+
if (this.mcpList)
|
|
276
|
+
this.mcpList = await WORK.fetch('/', 'mcp_token_list', {}, {});
|
|
253
277
|
this.text = 'Токенов отозвано: ' + (r?.revoked ?? 0);
|
|
254
278
|
}
|
|
255
279
|
catch (e) {
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Модальное окно однократного показа выпущенного токена подключения (MCP и WORK Chrome Bridge).
|
|
3
|
+
* Отображается один раз после выпуска — повторно восстановить секрет из БД невозможно.
|
|
4
|
+
*/
|
|
5
|
+
ODA({
|
|
6
|
+
is: 'user-token',
|
|
7
|
+
imports: 'oda//button',
|
|
8
|
+
template: /* html */`
|
|
9
|
+
<style>
|
|
10
|
+
:host {
|
|
11
|
+
@apply --vertical;
|
|
12
|
+
gap: 12px;
|
|
13
|
+
padding: 16px;
|
|
14
|
+
min-width: 340px;
|
|
15
|
+
max-width: 520px;
|
|
16
|
+
box-sizing: border-box;
|
|
17
|
+
@apply --light;
|
|
18
|
+
}
|
|
19
|
+
.warn {
|
|
20
|
+
padding: 10px 12px;
|
|
21
|
+
border-radius: 8px;
|
|
22
|
+
background: var(--accent-soft, #eff6ff);
|
|
23
|
+
border: 1px solid var(--border-color, #d1d5db);
|
|
24
|
+
font-size: 13px;
|
|
25
|
+
line-height: 1.45;
|
|
26
|
+
}
|
|
27
|
+
.field {
|
|
28
|
+
@apply --vertical;
|
|
29
|
+
gap: 4px;
|
|
30
|
+
}
|
|
31
|
+
.label {
|
|
32
|
+
font-size: 12px;
|
|
33
|
+
font-weight: 600;
|
|
34
|
+
opacity: 0.8;
|
|
35
|
+
}
|
|
36
|
+
.row {
|
|
37
|
+
@apply --horizontal;
|
|
38
|
+
gap: 8px;
|
|
39
|
+
align-items: stretch;
|
|
40
|
+
}
|
|
41
|
+
.val {
|
|
42
|
+
flex: 1;
|
|
43
|
+
min-width: 0;
|
|
44
|
+
padding: 8px 10px;
|
|
45
|
+
border-radius: 6px;
|
|
46
|
+
border: 1px solid var(--border-color, #d1d5db);
|
|
47
|
+
background: var(--subtle-background, #f8fafc);
|
|
48
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
49
|
+
font-size: 12.5px;
|
|
50
|
+
line-height: 1.4;
|
|
51
|
+
word-break: break-all;
|
|
52
|
+
user-select: all;
|
|
53
|
+
}
|
|
54
|
+
.copy-btn {
|
|
55
|
+
flex-shrink: 0;
|
|
56
|
+
padding: 0 12px;
|
|
57
|
+
border-radius: 6px;
|
|
58
|
+
border: 1px solid var(--border-color, #d1d5db);
|
|
59
|
+
background: var(--content, #fff);
|
|
60
|
+
cursor: pointer;
|
|
61
|
+
font-size: 12.5px;
|
|
62
|
+
white-space: nowrap;
|
|
63
|
+
}
|
|
64
|
+
.copy-btn.ok {
|
|
65
|
+
border-color: var(--success-color, #16a34a);
|
|
66
|
+
color: var(--success-color, #16a34a);
|
|
67
|
+
}
|
|
68
|
+
.hint {
|
|
69
|
+
font-size: 12px;
|
|
70
|
+
opacity: 0.75;
|
|
71
|
+
line-height: 1.4;
|
|
72
|
+
}
|
|
73
|
+
</style>
|
|
74
|
+
<div class="warn">
|
|
75
|
+
<strong>Сохраните токен сейчас.</strong> Он показывается только один раз.
|
|
76
|
+
Если потеряете — отзовите в профиле и выпустите новый.
|
|
77
|
+
</div>
|
|
78
|
+
|
|
79
|
+
<div class="field">
|
|
80
|
+
<div class="label">Персональный токен (для Chrome Bridge и MCP)</div>
|
|
81
|
+
<div class="row">
|
|
82
|
+
<div class="val">{{token}}</div>
|
|
83
|
+
<button class="copy-btn" :class="{ok: copied === 'token'}" @tap.stop="copy('token', token)">
|
|
84
|
+
{{copied === 'token' ? 'Скопировано' : 'Скопировать'}}
|
|
85
|
+
</button>
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
88
|
+
|
|
89
|
+
<div class="field">
|
|
90
|
+
<div class="label">Адрес сервера WORK (для расширения Chrome Bridge)</div>
|
|
91
|
+
<div class="row">
|
|
92
|
+
<div class="val">{{origin}}</div>
|
|
93
|
+
<button class="copy-btn" :class="{ok: copied === 'origin'}" @tap.stop="copy('origin', origin)">
|
|
94
|
+
{{copied === 'origin' ? 'Скопировано' : 'Скопировать'}}
|
|
95
|
+
</button>
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
98
|
+
|
|
99
|
+
<div class="field">
|
|
100
|
+
<div class="label">Адрес MCP-сервера (для OpenCode / Claude Code)</div>
|
|
101
|
+
<div class="row">
|
|
102
|
+
<div class="val">{{mcpUrl}}</div>
|
|
103
|
+
<button class="copy-btn" :class="{ok: copied === 'mcp'}" @tap.stop="copy('mcp', mcpUrl)">
|
|
104
|
+
{{copied === 'mcp' ? 'Скопировано' : 'Скопировать'}}
|
|
105
|
+
</button>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
|
|
109
|
+
<div class="field">
|
|
110
|
+
<div class="label">Готовая строка для WORK Chrome Bridge (можно вставить целиком в поле токена)</div>
|
|
111
|
+
<div class="row">
|
|
112
|
+
<div class="val">{{bridgeJson}}</div>
|
|
113
|
+
<button class="copy-btn" :class="{ok: copied === 'json'}" @tap.stop="copy('json', bridgeJson)">
|
|
114
|
+
{{copied === 'json' ? 'Скопировано' : 'Скопировать'}}
|
|
115
|
+
</button>
|
|
116
|
+
</div>
|
|
117
|
+
</div>
|
|
118
|
+
|
|
119
|
+
<div class="hint">
|
|
120
|
+
В Chrome: иконка расширения <b>WORK Chrome Bridge</b> → <b>Настройки</b> → вставьте адрес и токен (или готовую строку) → <b>Сохранить и подключить</b>.
|
|
121
|
+
</div>
|
|
122
|
+
`,
|
|
123
|
+
token: '',
|
|
124
|
+
origin: '',
|
|
125
|
+
copied: '',
|
|
126
|
+
get mcpUrl() {
|
|
127
|
+
return (this.origin || location.origin) + '/mcp';
|
|
128
|
+
},
|
|
129
|
+
get bridgeJson() {
|
|
130
|
+
return JSON.stringify({
|
|
131
|
+
server: this.origin || location.origin,
|
|
132
|
+
token: this.token || '',
|
|
133
|
+
});
|
|
134
|
+
},
|
|
135
|
+
async copy(key, text) {
|
|
136
|
+
const val = String(text ?? '');
|
|
137
|
+
let ok = false;
|
|
138
|
+
try {
|
|
139
|
+
if (navigator.clipboard?.writeText) {
|
|
140
|
+
await navigator.clipboard.writeText(val);
|
|
141
|
+
ok = true;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
catch { /* fallback ниже */ }
|
|
145
|
+
if (!ok && typeof document !== 'undefined') {
|
|
146
|
+
try {
|
|
147
|
+
const ta = document.createElement('textarea');
|
|
148
|
+
ta.value = val;
|
|
149
|
+
ta.setAttribute('readonly', '');
|
|
150
|
+
ta.style.position = 'fixed';
|
|
151
|
+
ta.style.opacity = '0';
|
|
152
|
+
document.body.appendChild(ta);
|
|
153
|
+
ta.select();
|
|
154
|
+
ok = document.execCommand('copy');
|
|
155
|
+
ta.remove();
|
|
156
|
+
}
|
|
157
|
+
catch { /* ignore */ }
|
|
158
|
+
}
|
|
159
|
+
if (ok) {
|
|
160
|
+
this.copied = key;
|
|
161
|
+
clearTimeout(this._copyTimer);
|
|
162
|
+
this._copyTimer = setTimeout(() => {
|
|
163
|
+
if (this.copied === key)
|
|
164
|
+
this.copied = '';
|
|
165
|
+
}, 2000);
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
});
|