dsh-theone 0.3.20 → 0.3.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 +109 -14
- package/README.zh.md +110 -15
- package/dist/catalog-types.d.ts +5 -0
- package/dist/client-locales.d.ts +39 -0
- package/dist/client-locales.js +78 -0
- package/dist/client.js +423 -43
- package/dist/fact-flow.d.ts +39 -0
- package/dist/fact-flow.js +135 -0
- package/dist/facts.d.ts +127 -0
- package/dist/facts.js +177 -0
- package/dist/feedback.d.ts +113 -0
- package/dist/feedback.js +146 -0
- package/dist/history-catalog.d.ts +9 -0
- package/dist/history-catalog.js +48 -2
- package/dist/index.d.ts +37 -1
- package/dist/index.js +318 -28
- package/dist/linkage.d.ts +9 -0
- package/dist/linkage.js +31 -1
- package/dist/llm-router.d.ts +8 -1
- package/dist/llm-router.js +29 -6
- package/dist/run.d.ts +2 -0
- package/dist/run.js +2 -0
- package/dist/settings-types.d.ts +6 -2
- package/dist/settings-types.js +3 -3
- package/dist/settings.js +3 -2
- package/dist/store.d.ts +104 -2
- package/dist/store.js +269 -2
- package/dist/topic-memory.d.ts +61 -0
- package/dist/topic-memory.js +78 -0
- package/dist/types.d.ts +4 -0
- package/package.json +22 -3
package/dist/client.js
CHANGED
|
@@ -39,7 +39,9 @@ var EDITABLE_SETTINGS_KEYS = [
|
|
|
39
39
|
"linkScope",
|
|
40
40
|
"routeNotice",
|
|
41
41
|
"contextsPath",
|
|
42
|
-
"notices"
|
|
42
|
+
"notices",
|
|
43
|
+
"factLinks",
|
|
44
|
+
"factExtraction"
|
|
43
45
|
];
|
|
44
46
|
|
|
45
47
|
// src/client-navigation.ts
|
|
@@ -91,6 +93,10 @@ var zh = {
|
|
|
91
93
|
"retry": "\u91CD\u8BD5",
|
|
92
94
|
"settings.other": "\u5176\u4ED6",
|
|
93
95
|
"settings.notices": "\u663E\u793A\u516C\u544A",
|
|
96
|
+
"settings.factLinks": "\u5171\u4EAB\u5DF2\u786E\u8BA4\u7684\u8981\u70B9\uFF08\u5B9E\u9A8C\uFF09",
|
|
97
|
+
"settings.help.factLinks": "\u8BDD\u9898\u4E4B\u95F4\u53EA\u5171\u4EAB\u7528\u6237\u4EB2\u81EA\u786E\u8BA4\u8FC7\u7684\u8981\u70B9\uFF08\u6570\u5B57\u3001\u51B3\u5B9A\u3001\u6587\u4EF6\u4F4D\u7F6E\uFF09\uFF0C\u5E26\u7248\u672C\u548C\u51FA\u5904\uFF1B\u8981\u70B9\u6539\u4E86\u6216\u64A4\u56DE\u4E86\uFF0C\u7528\u5230\u5B83\u7684\u8BDD\u9898\u4F1A\u6536\u5230\u63D0\u793A\u3002\u9ED8\u8BA4\u5173\u95ED\uFF0C\u91CD\u542F DSH \u540E\u751F\u6548\u3002",
|
|
98
|
+
"settings.factExtraction": "\u81EA\u52A8\u8BB0\u5F55\u8981\u70B9\uFF08\u5B9E\u9A8C\uFF09",
|
|
99
|
+
"settings.help.factExtraction": "\u5F00\u542F\u300C\u5171\u4EAB\u5DF2\u786E\u8BA4\u7684\u8981\u70B9\u300D\u540E\uFF0C\u6BCF\u8F6E\u7ED3\u675F\u591A\u7528\u4E00\u6B21\u5C0F\u6A21\u578B\u8C03\u7528\uFF0C\u8865\u8BB0\u540E\u53F0\u4F1A\u8BDD\u6CA1\u8BB0\u4E0B\u7684\u8981\u70B9\uFF1B\u540C\u6837\u53EA\u6709\u7528\u6237\u786E\u8BA4\u8FC7\u7684\u624D\u4F1A\u5171\u4EAB\u3002\u9ED8\u8BA4\u5173\u95ED\uFF0C\u91CD\u542F DSH \u540E\u751F\u6548\u3002",
|
|
94
100
|
"settings.help.notices": "\u663E\u793A TheOne \u4F5C\u8005\u53D1\u5E03\u7684\u516C\u544A\uFF08\u65B0\u7248\u672C\u3001\u91CD\u8981\u63D0\u9192\u7B49\uFF09\u3002\u53EA\u4ECE yulid.org \u8BFB\u53D6\u4E00\u4E2A\u516C\u544A\u6587\u4EF6\uFF0C\u4E0D\u53D1\u9001\u4EFB\u4F55\u4F60\u7684\u6570\u636E\u3002",
|
|
95
101
|
"notice.label": "\u516C\u544A",
|
|
96
102
|
"notice.more": "\u67E5\u770B\u8BE6\u60C5",
|
|
@@ -197,6 +203,9 @@ var zh = {
|
|
|
197
203
|
"settings.help.gatewayKey": "\u533A\u5206\u4E0D\u540C\u7684\u4E3B\u804A\u5929\u5165\u53E3\u72B6\u6001\uFF08\u5F53\u524D\u8BDD\u9898\u3001\u8DEF\u7531\u8BB0\u5F55\u3001\u8BBE\u7F6E\uFF09\u3002\u6539\u52A8\u76F8\u5F53\u4E8E\u6362\u4E00\u4E2A\u65B0\u7684\u5165\u53E3\uFF0C\u56E0\u6B64\u53EA\u80FD\u7528\u73AF\u5883\u53D8\u91CF THEONE_GATEWAY_KEY \u4FEE\u6539\uFF0C\u901A\u5E38\u4FDD\u7559 default\u3002",
|
|
198
204
|
"catalog.title": "\u8BDD\u9898\u5DE5\u4F5C\u533A",
|
|
199
205
|
"catalog.subtitle": "\u76F8\u5173\u7684\u4E8B\u60C5\u653E\u5728\u4E00\u8D77\uFF0C\u968F\u65F6\u56DE\u5230\u4E3B\u804A\u5929\u7EE7\u7EED\u3002",
|
|
206
|
+
"catalog.figTopics": "\u8BDD\u9898",
|
|
207
|
+
"catalog.figGroups": "\u5DE5\u4F5C\u533A",
|
|
208
|
+
"catalog.figKept": "\u6CA1\u88AB\u66F4\u6B63",
|
|
200
209
|
"catalog.refresh": "\u6574\u7406\u5386\u53F2",
|
|
201
210
|
"link.label": "\u5173\u8054\uFF1A",
|
|
202
211
|
"link.none": "\u6682\u65E0\u5173\u8054\u8BDD\u9898",
|
|
@@ -230,9 +239,12 @@ var zh = {
|
|
|
230
239
|
"catalog.unassignedSummary": "\u8FD9\u4E9B\u8BDD\u9898\u8FD8\u5728\u7B49\u5F85\u81EA\u52A8\u5F52\u7C7B\u3002",
|
|
231
240
|
"topic.opening": "\u6B63\u5728\u6253\u5F00\u2026",
|
|
232
241
|
"topic.continue": "\u7EE7\u7EED\u804A\u5929",
|
|
242
|
+
"topic.continueHidden": "\u8FD9\u4E2A\u8BDD\u9898\u7684\u539F\u4F1A\u8BDD\u5DF2\u4E0D\u5728\uFF08\u5DF2\u5220\u9664\u6216\u5DF2\u5F52\u6863\uFF09\uFF0C\u6CA1\u6709\u53EF\u4EE5\u63A5\u7740\u804A\u7684\u5185\u5BB9\u3002\u53D6\u6D88\u5F52\u6863\u540E\u5373\u53EF\u7EE7\u7EED\u3002",
|
|
233
243
|
"topic.source": "\u67E5\u770B\u539F\u4F1A\u8BDD",
|
|
234
244
|
"topic.state": "\u8FDB\u5C55\uFF1A",
|
|
235
245
|
"topic.constraints": "\u7EA6\u675F\uFF1A",
|
|
246
|
+
"topic.hiddenOrphaned": "\u6765\u6E90\u4F1A\u8BDD\u5DF2\u4ECE\u78C1\u76D8\u4E0A\u6D88\u5931\uFF1A\u672C\u8BDD\u9898\u4E0D\u518D\u53C2\u4E0E\u8DEF\u7531\uFF0C\u5220\u9664\u5373\u53EF\u4ECE\u76EE\u5F55\u79FB\u9664\u3002",
|
|
247
|
+
"topic.hiddenArchived": "\u6765\u6E90\u4F1A\u8BDD\u5DF2\u5F52\u6863\uFF1A\u672C\u8BDD\u9898\u4E0D\u518D\u53C2\u4E0E\u8DEF\u7531\uFF0C\u53D6\u6D88\u5F52\u6863\u6216\u5220\u9664\u5B83\u5373\u53EF\u3002",
|
|
236
248
|
"manage.open": "\u7BA1\u7406",
|
|
237
249
|
"manage.close": "\u6536\u8D77",
|
|
238
250
|
"manage.title": "\u6807\u9898",
|
|
@@ -273,6 +285,35 @@ var zh = {
|
|
|
273
285
|
"routes.error": "\u5206\u7C7B\u51FA\u9519\uFF1A{code}",
|
|
274
286
|
"routes.rules": "\u89C4\u5219\u5224\u65AD",
|
|
275
287
|
"routes.removed": "\uFF08\u5DF2\u5220\u9664\u7684\u8BDD\u9898\uFF09",
|
|
288
|
+
"routes.report": "\u62A5\u544A\u95EE\u9898",
|
|
289
|
+
"feedback.open": "\u53CD\u9988\u95EE\u9898",
|
|
290
|
+
"feedback.title": "\u53CD\u9988\u95EE\u9898",
|
|
291
|
+
"feedback.titleMessage": "\u62A5\u544A\u8FD9\u6761\u56DE\u590D\u7684\u95EE\u9898",
|
|
292
|
+
"feedback.intro": "\u8BF4\u8BF4\u53D1\u751F\u4E86\u4EC0\u4E48\u3002\u4E0B\u9762\u80FD\u770B\u5230\u8981\u53D1\u51FA\u7684\u5168\u90E8\u5185\u5BB9\uFF0C\u70B9\u300C\u53D1\u9001\u300D\u4E4B\u524D\u4EC0\u4E48\u90FD\u4E0D\u4F1A\u53D1\u51FA\u3002",
|
|
293
|
+
"feedback.description": "\u53D1\u751F\u4E86\u4EC0\u4E48\uFF1F\u6BD4\u5982\uFF1A\u56DE\u590D\u91CC\u51FA\u73B0\u4E71\u7801\u3001\u5206\u9519\u4E86\u8BDD\u9898\u3001\u67D0\u4E2A\u6309\u94AE\u6CA1\u53CD\u5E94",
|
|
294
|
+
"feedback.contact": "\u8054\u7CFB\u65B9\u5F0F\uFF08\u9009\u586B\uFF09\uFF1A\u90AE\u7BB1\u3001QQ \u6216\u5FAE\u4FE1\uFF0C\u65B9\u4FBF\u4F5C\u8005\u56DE\u590D\u4F60",
|
|
295
|
+
"feedback.includeReply": "\u9644\u4E0A\u8FD9\u6761\u6D88\u606F\u548C\u56DE\u590D\u7684\u539F\u6587\uFF08\u6392\u67E5\u4E71\u7801\u8FD9\u7C7B\u95EE\u9898\u65F6\u9700\u8981\uFF09",
|
|
296
|
+
"feedback.preview": "\u8981\u53D1\u9001\u7684\u5185\u5BB9",
|
|
297
|
+
"feedback.privacy": "\u53D1\u9001\u5230 feedback.yulid.org\uFF0C\u53EA\u7528\u4E8E\u6392\u67E5\u95EE\u9898\uFF0C\u7531 TheOne \u4F5C\u8005\u4FDD\u5B58 90 \u5929\u540E\u81EA\u52A8\u5220\u9664\u3002\u9ED8\u8BA4\u53EA\u542B\u7248\u672C\u3001\u8BBE\u7F6E\u548C\u8DEF\u7531\u7684\u9519\u8BEF\u7801\u4E0E\u8017\u65F6\uFF0C\u4E0D\u542B\u804A\u5929\u5185\u5BB9\u3002",
|
|
298
|
+
"feedback.loading": "\u6B63\u5728\u6574\u7406\u8BCA\u65AD\u4FE1\u606F\u2026",
|
|
299
|
+
"feedback.loadError": "\u8BCA\u65AD\u4FE1\u606F\u6CA1\u6709\u6574\u7406\u51FA\u6765\uFF0C\u4F60\u4ECD\u7136\u53EF\u4EE5\u5199\u4E0B\u95EE\u9898\uFF0C\u590D\u5236\u540E\u53D1\u90AE\u4EF6\u5230 {email}\u3002",
|
|
300
|
+
"feedback.send": "\u53D1\u9001",
|
|
301
|
+
"feedback.sending": "\u6B63\u5728\u53D1\u9001\u2026",
|
|
302
|
+
"feedback.copy": "\u590D\u5236\u5185\u5BB9",
|
|
303
|
+
"feedback.copied": "\u5DF2\u590D\u5236",
|
|
304
|
+
"feedback.email": "\u53D1\u90AE\u4EF6",
|
|
305
|
+
"feedback.cancel": "\u53D6\u6D88",
|
|
306
|
+
"feedback.close": "\u5173\u95ED",
|
|
307
|
+
"feedback.sent": "\u5DF2\u53D1\u9001\uFF0C\u7F16\u53F7 {id}\u3002\u5728\u8BC4\u8BBA\u6216\u90AE\u4EF6\u91CC\u63D0\u5230\u8FD9\u4E2A\u7F16\u53F7\uFF0C\u4F5C\u8005\u5C31\u80FD\u627E\u5230\u5B83\u3002\u8C22\u8C22\uFF01",
|
|
308
|
+
"feedback.fallback": "\u4E5F\u53EF\u4EE5\u70B9\u300C\u590D\u5236\u5185\u5BB9\u300D\uFF0C\u53D1\u90AE\u4EF6\u5230 {email}\u3002",
|
|
309
|
+
"feedback.error.UNREACHABLE": "\u8FDE\u4E0D\u4E0A\u53CD\u9988\u670D\u52A1\u5668\u3002",
|
|
310
|
+
"feedback.error.RATE_LIMITED": "\u53D1\u9001\u5F97\u592A\u9891\u7E41\u4E86\uFF0C\u8BF7\u4E00\u5C0F\u65F6\u540E\u518D\u8BD5\u3002",
|
|
311
|
+
"feedback.error.REJECTED": "\u53CD\u9988\u670D\u52A1\u5668\u6CA1\u6709\u63A5\u6536\u8FD9\u4EFD\u62A5\u544A\u3002",
|
|
312
|
+
"feedback.error.SERVER_ERROR": "\u53CD\u9988\u670D\u52A1\u5668\u6682\u65F6\u51FA\u4E86\u95EE\u9898\u3002",
|
|
313
|
+
"feedback.error.DESCRIPTION_REQUIRED": "\u5148\u5199\u4E00\u53E5\u53D1\u751F\u4E86\u4EC0\u4E48\u3002",
|
|
314
|
+
"feedback.error.TOO_LARGE": "\u5185\u5BB9\u592A\u957F\u4E86\uFF0C\u8BF7\u7F29\u77ED\u63CF\u8FF0\uFF0C\u6216\u53BB\u6389\u56DE\u590D\u539F\u6587\u3002",
|
|
315
|
+
"feedback.error.DIRECT_OFF": "\u8FD9\u4E2A DSH \u5173\u95ED\u4E86\u76F4\u63A5\u53D1\u9001\u3002",
|
|
316
|
+
"feedback.error.other": "\u6CA1\u6709\u53D1\u9001\u6210\u529F\u3002",
|
|
276
317
|
"route.reason.steering": "\u56DE\u590D\u4E2D\u8865\u5145",
|
|
277
318
|
"route.reason.short-continuation": "\u63A5\u7740\u8BF4",
|
|
278
319
|
"route.reason.attachment-only": "\u53EA\u6709\u9644\u4EF6",
|
|
@@ -302,6 +343,10 @@ var en = {
|
|
|
302
343
|
"retry": "Retry",
|
|
303
344
|
"settings.other": "Other",
|
|
304
345
|
"settings.notices": "Show notices",
|
|
346
|
+
"settings.factLinks": "Share confirmed facts (experimental)",
|
|
347
|
+
"settings.help.factLinks": "Topics share only facts the user confirmed (figures, decisions, file locations), with version and source; when one changes or is withdrawn, topics that used it are told. Off by default; takes effect after DSH restarts.",
|
|
348
|
+
"settings.factExtraction": "Record facts automatically (experimental)",
|
|
349
|
+
"settings.help.factExtraction": "With shared facts on, one small model call after each turn records facts the topic session left out; again only facts the user confirmed are shared. Off by default; takes effect after DSH restarts.",
|
|
305
350
|
"settings.help.notices": "Show notices from TheOne's author (new versions, important reminders). TheOne only reads one notice file from yulid.org and sends none of your data.",
|
|
306
351
|
"notice.label": "Notice",
|
|
307
352
|
"notice.more": "Read more",
|
|
@@ -408,6 +453,9 @@ var en = {
|
|
|
408
453
|
"settings.help.gatewayKey": "Separates main-chat entry state (current topic, routing records, settings). Changing it amounts to a new entry, so it can only be set through THEONE_GATEWAY_KEY; usually leave it as default.",
|
|
409
454
|
"catalog.title": "Topic workspaces",
|
|
410
455
|
"catalog.subtitle": "Keep related topics together and pick up the conversation in main chat.",
|
|
456
|
+
"catalog.figTopics": "Topics",
|
|
457
|
+
"catalog.figGroups": "Workspaces",
|
|
458
|
+
"catalog.figKept": "Kept as routed",
|
|
411
459
|
"catalog.refresh": "Organize history",
|
|
412
460
|
"link.label": "Related:",
|
|
413
461
|
"link.none": "No related topics",
|
|
@@ -441,9 +489,12 @@ var en = {
|
|
|
441
489
|
"catalog.unassignedSummary": "These topics are waiting to be grouped.",
|
|
442
490
|
"topic.opening": "Opening\u2026",
|
|
443
491
|
"topic.continue": "Continue chatting",
|
|
492
|
+
"topic.continueHidden": "This topic\u2019s conversations are gone (deleted or archived), so there is nothing to continue. Unarchive them to pick it up again.",
|
|
444
493
|
"topic.source": "View original chat",
|
|
445
494
|
"topic.state": "Progress:",
|
|
446
495
|
"topic.constraints": "Constraints:",
|
|
496
|
+
"topic.hiddenOrphaned": "Its conversations are gone from disk: this topic no longer takes part in routing. Delete it to remove it from the directory.",
|
|
497
|
+
"topic.hiddenArchived": "Its conversations are archived: this topic no longer takes part in routing. Unarchive or delete it.",
|
|
447
498
|
"manage.open": "Manage",
|
|
448
499
|
"manage.close": "Close",
|
|
449
500
|
"manage.title": "Title",
|
|
@@ -484,6 +535,35 @@ var en = {
|
|
|
484
535
|
"routes.error": "Classifier error: {code}",
|
|
485
536
|
"routes.rules": "rules",
|
|
486
537
|
"routes.removed": "(deleted topic)",
|
|
538
|
+
"routes.report": "Report a problem",
|
|
539
|
+
"feedback.open": "Report a problem",
|
|
540
|
+
"feedback.title": "Report a problem",
|
|
541
|
+
"feedback.titleMessage": "Report a problem with this reply",
|
|
542
|
+
"feedback.intro": "Tell us what happened. Everything that would be sent is shown below; nothing leaves this computer until you press Send.",
|
|
543
|
+
"feedback.description": "What happened? For example: garbled text in a reply, the wrong topic, a button that does nothing",
|
|
544
|
+
"feedback.contact": "Contact (optional): email or any handle, so the author can reply",
|
|
545
|
+
"feedback.includeReply": "Include this message and its reply as text (needed for problems like garbled replies)",
|
|
546
|
+
"feedback.preview": "What will be sent",
|
|
547
|
+
"feedback.privacy": "Sent to feedback.yulid.org, used only to look into the problem, and deleted by TheOne's author after 90 days. By default it holds versions, settings and routing error codes and timings, no chat content.",
|
|
548
|
+
"feedback.loading": "Gathering diagnostics\u2026",
|
|
549
|
+
"feedback.loadError": "Diagnostics could not be gathered. You can still describe the problem, copy it and email {email}.",
|
|
550
|
+
"feedback.send": "Send",
|
|
551
|
+
"feedback.sending": "Sending\u2026",
|
|
552
|
+
"feedback.copy": "Copy",
|
|
553
|
+
"feedback.copied": "Copied",
|
|
554
|
+
"feedback.email": "Email",
|
|
555
|
+
"feedback.cancel": "Cancel",
|
|
556
|
+
"feedback.close": "Close",
|
|
557
|
+
"feedback.sent": "Sent as {id}. Mention this id in a comment or email and the author can find it. Thank you!",
|
|
558
|
+
"feedback.fallback": "You can also press Copy and email {email}.",
|
|
559
|
+
"feedback.error.UNREACHABLE": "The feedback server cannot be reached.",
|
|
560
|
+
"feedback.error.RATE_LIMITED": "Too many reports in a short time; try again in an hour.",
|
|
561
|
+
"feedback.error.REJECTED": "The feedback server did not accept this report.",
|
|
562
|
+
"feedback.error.SERVER_ERROR": "The feedback server has a problem right now.",
|
|
563
|
+
"feedback.error.DESCRIPTION_REQUIRED": "Say in a sentence what happened first.",
|
|
564
|
+
"feedback.error.TOO_LARGE": "Too long; shorten the description or leave out the reply text.",
|
|
565
|
+
"feedback.error.DIRECT_OFF": "Sending directly is turned off in this DSH.",
|
|
566
|
+
"feedback.error.other": "The report was not sent.",
|
|
487
567
|
"route.reason.steering": "Added during a reply",
|
|
488
568
|
"route.reason.short-continuation": "Continuation",
|
|
489
569
|
"route.reason.attachment-only": "Attachment only",
|
|
@@ -685,6 +765,160 @@ function apply(ctx) {
|
|
|
685
765
|
document.body.append(backdrop);
|
|
686
766
|
(allow ?? footer.querySelector("button"))?.focus();
|
|
687
767
|
}
|
|
768
|
+
function openFeedbackDialog(messageId) {
|
|
769
|
+
if (document.querySelector(".theone-dialog-backdrop")) return;
|
|
770
|
+
const backdrop = document.createElement("div");
|
|
771
|
+
backdrop.className = "theone-dialog-backdrop";
|
|
772
|
+
backdrop.setAttribute("translate", "no");
|
|
773
|
+
const card = document.createElement("div");
|
|
774
|
+
card.className = "theone-dialog theone-feedback";
|
|
775
|
+
card.setAttribute("role", "dialog");
|
|
776
|
+
card.setAttribute("aria-modal", "true");
|
|
777
|
+
const title = document.createElement("h2");
|
|
778
|
+
title.id = "theone-feedback-title";
|
|
779
|
+
title.textContent = t(messageId ? "feedback.titleMessage" : "feedback.title");
|
|
780
|
+
card.setAttribute("aria-labelledby", title.id);
|
|
781
|
+
const intro = document.createElement("p");
|
|
782
|
+
intro.textContent = t("feedback.intro");
|
|
783
|
+
const description = document.createElement("textarea");
|
|
784
|
+
description.maxLength = 4e3;
|
|
785
|
+
description.rows = 4;
|
|
786
|
+
description.placeholder = t("feedback.description");
|
|
787
|
+
description.setAttribute("aria-label", t("feedback.description"));
|
|
788
|
+
const contact = document.createElement("input");
|
|
789
|
+
contact.maxLength = 200;
|
|
790
|
+
contact.placeholder = t("feedback.contact");
|
|
791
|
+
contact.setAttribute("aria-label", t("feedback.contact"));
|
|
792
|
+
const include = document.createElement("input");
|
|
793
|
+
include.type = "checkbox";
|
|
794
|
+
const includeLabel = document.createElement("label");
|
|
795
|
+
includeLabel.className = "theone-feedback-check";
|
|
796
|
+
includeLabel.append(include, " ", t("feedback.includeReply"));
|
|
797
|
+
const preview = document.createElement("details");
|
|
798
|
+
preview.className = "theone-feedback-preview";
|
|
799
|
+
const summary = document.createElement("summary");
|
|
800
|
+
summary.textContent = t("feedback.preview");
|
|
801
|
+
const pre = document.createElement("pre");
|
|
802
|
+
preview.append(summary, pre);
|
|
803
|
+
const privacy = document.createElement("p");
|
|
804
|
+
privacy.className = "theone-dialog-note";
|
|
805
|
+
privacy.textContent = t("feedback.privacy");
|
|
806
|
+
const status = document.createElement("p");
|
|
807
|
+
status.className = "theone-dialog-note";
|
|
808
|
+
status.setAttribute("role", "status");
|
|
809
|
+
status.textContent = t("feedback.loading");
|
|
810
|
+
const footer = document.createElement("div");
|
|
811
|
+
footer.className = "theone-dialog-actions";
|
|
812
|
+
const button = (text2, primary, act) => {
|
|
813
|
+
const element = document.createElement("button");
|
|
814
|
+
element.type = "button";
|
|
815
|
+
element.textContent = text2;
|
|
816
|
+
if (primary) element.className = "theone-dialog-primary";
|
|
817
|
+
element.addEventListener("click", act);
|
|
818
|
+
footer.append(element);
|
|
819
|
+
return element;
|
|
820
|
+
};
|
|
821
|
+
let draft;
|
|
822
|
+
let email = "theone@yulid.org";
|
|
823
|
+
let direct = false;
|
|
824
|
+
let sentId;
|
|
825
|
+
let sending = false;
|
|
826
|
+
const language = () => localeSnapshot().active.startsWith("zh") ? "zh" : "en";
|
|
827
|
+
const report = () => ({ description: description.value.trim(), ...contact.value.trim() ? { contact: contact.value.trim() } : {}, lang: language(), ...draft ?? {} });
|
|
828
|
+
const render = () => {
|
|
829
|
+
pre.textContent = JSON.stringify(report(), null, 2);
|
|
830
|
+
send.disabled = sending || !!sentId || !direct || !draft || !description.value.trim();
|
|
831
|
+
send.textContent = t(sending ? "feedback.sending" : "feedback.send");
|
|
832
|
+
};
|
|
833
|
+
const load = async () => {
|
|
834
|
+
status.textContent = t("feedback.loading");
|
|
835
|
+
draft = void 0;
|
|
836
|
+
render();
|
|
837
|
+
try {
|
|
838
|
+
const response = await fetch("/api/theone/feedback", {
|
|
839
|
+
method: "POST",
|
|
840
|
+
headers: { "content-type": "application/json" },
|
|
841
|
+
signal: lifetime.signal,
|
|
842
|
+
body: JSON.stringify({ action: "draft", ...messageId ? { messageId, includeReply: include.checked } : {} })
|
|
843
|
+
});
|
|
844
|
+
const body = await response.json();
|
|
845
|
+
if (!response.ok || !body.draft) throw new Error("draft");
|
|
846
|
+
draft = body.draft;
|
|
847
|
+
email = body.email ?? email;
|
|
848
|
+
direct = body.direct === true;
|
|
849
|
+
status.textContent = direct ? "" : t("feedback.fallback", { email });
|
|
850
|
+
} catch {
|
|
851
|
+
status.textContent = t("feedback.loadError", { email });
|
|
852
|
+
}
|
|
853
|
+
render();
|
|
854
|
+
};
|
|
855
|
+
const close = () => {
|
|
856
|
+
backdrop.remove();
|
|
857
|
+
document.removeEventListener("keydown", keydown, true);
|
|
858
|
+
};
|
|
859
|
+
const keydown = (event) => {
|
|
860
|
+
if (event.key === "Escape") {
|
|
861
|
+
event.preventDefault();
|
|
862
|
+
close();
|
|
863
|
+
}
|
|
864
|
+
};
|
|
865
|
+
const text = () => sentId ? sentId : JSON.stringify(report(), null, 2);
|
|
866
|
+
button(t("feedback.cancel"), false, close);
|
|
867
|
+
const copy = button(t("feedback.copy"), false, () => {
|
|
868
|
+
void navigator.clipboard?.writeText(text()).then(() => {
|
|
869
|
+
copy.textContent = t("feedback.copied");
|
|
870
|
+
setTimeout(() => {
|
|
871
|
+
copy.textContent = t("feedback.copy");
|
|
872
|
+
}, 2e3);
|
|
873
|
+
}, () => {
|
|
874
|
+
});
|
|
875
|
+
});
|
|
876
|
+
button(t("feedback.email"), false, () => {
|
|
877
|
+
const subject = `TheOne ${String(draft?.version ?? "")} ${description.value.trim().split("\n")[0].slice(0, 40)}`.trim();
|
|
878
|
+
window.open(`mailto:${email}?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(text().slice(0, 1800))}`, "_self");
|
|
879
|
+
});
|
|
880
|
+
const send = button(t("feedback.send"), true, () => {
|
|
881
|
+
if (send.disabled) return;
|
|
882
|
+
sending = true;
|
|
883
|
+
render();
|
|
884
|
+
void (async () => {
|
|
885
|
+
try {
|
|
886
|
+
const response = await fetch("/api/theone/feedback", {
|
|
887
|
+
method: "POST",
|
|
888
|
+
headers: { "content-type": "application/json" },
|
|
889
|
+
signal: lifetime.signal,
|
|
890
|
+
body: JSON.stringify({ action: "send", draft, description: description.value, contact: contact.value, lang: language() })
|
|
891
|
+
});
|
|
892
|
+
const body = await response.json().catch(() => ({}));
|
|
893
|
+
if (!response.ok || !body.id) throw new Error(body.error ?? "other");
|
|
894
|
+
sentId = body.id;
|
|
895
|
+
status.textContent = t("feedback.sent", { id: body.id });
|
|
896
|
+
description.disabled = contact.disabled = include.disabled = true;
|
|
897
|
+
} catch (error) {
|
|
898
|
+
const code = error instanceof Error ? error.message : "";
|
|
899
|
+
const known = ["UNREACHABLE", "RATE_LIMITED", "REJECTED", "SERVER_ERROR", "DESCRIPTION_REQUIRED", "TOO_LARGE", "DIRECT_OFF"].includes(code);
|
|
900
|
+
status.textContent = `${t(known ? `feedback.error.${code}` : "feedback.error.other")} ${t("feedback.fallback", { email })}`;
|
|
901
|
+
} finally {
|
|
902
|
+
sending = false;
|
|
903
|
+
render();
|
|
904
|
+
}
|
|
905
|
+
})();
|
|
906
|
+
});
|
|
907
|
+
description.addEventListener("input", render);
|
|
908
|
+
contact.addEventListener("input", render);
|
|
909
|
+
include.addEventListener("change", () => {
|
|
910
|
+
void load();
|
|
911
|
+
});
|
|
912
|
+
card.append(title, intro, description, contact, ...messageId ? [includeLabel] : [], preview, privacy, status, footer);
|
|
913
|
+
backdrop.append(card);
|
|
914
|
+
backdrop.addEventListener("pointerdown", (event) => {
|
|
915
|
+
if (event.target === backdrop && !description.value.trim()) close();
|
|
916
|
+
});
|
|
917
|
+
document.addEventListener("keydown", keydown, true);
|
|
918
|
+
document.body.append(backdrop);
|
|
919
|
+
description.focus();
|
|
920
|
+
void load();
|
|
921
|
+
}
|
|
688
922
|
const ICONS = {
|
|
689
923
|
download: ["M12 4v11", "M7 10l5 5 5-5", "M5 20h14"],
|
|
690
924
|
restart: ["M20 12a8 8 0 1 1-2.34-5.66L20 8.5", "M20 4v4.5h-4.5"],
|
|
@@ -718,9 +952,9 @@ function apply(ctx) {
|
|
|
718
952
|
const status = (0, import_react.useSyncExternalStore)(subscribeUpdate, () => update);
|
|
719
953
|
const waiting = !!status?.waiting && !status.available && !status.state;
|
|
720
954
|
if (!status || !status.available && !status.state && !waiting) return null;
|
|
721
|
-
const
|
|
955
|
+
const label2 = waiting ? t2("update.waiting") : status.state === "installing" ? t2("update.installing") : status.state === "reloading" ? t2("update.reloading") : status.state === "restart" ? t2("update.restart") : status.state === "failed" ? t2("update.failed") : t2("update.available");
|
|
722
956
|
const hint = waiting ? t2("update.waitingHint", { latest: status.waiting.version }) : status.error === "GATEWAY_BUSY" ? t2("update.busy") : status.state === "reloading" ? t2("update.reloadingHint") : status.state === "restart" ? t2("update.restartHint") : status.state === "failed" ? status.error === "OTHER_RELEASE_AGE" ? t2("update.otherAge", { names: status.detail ?? "" }) : status.error === "MINIMUM_RELEASE_AGE" ? status.exempt ? t2("update.ageStill", { detail: status.detail ?? "" }) : t2("update.tooNew") : status.error === "NETWORK" ? t2("update.network") : t2("update.failedHint", { error: status.detail ?? status.error ?? "" }) : status.installable ? t2("update.hint", { current: status.current, latest: status.latest ?? "" }) : t2("update.manualHint", { current: status.current, latest: status.latest ?? "" });
|
|
723
|
-
const title = `${
|
|
957
|
+
const title = `${label2} \xB7 ${hint}`;
|
|
724
958
|
const act = (event) => {
|
|
725
959
|
event.preventDefault();
|
|
726
960
|
event.stopPropagation();
|
|
@@ -936,7 +1170,7 @@ function apply(ctx) {
|
|
|
936
1170
|
const pinned = settings?.values.workerProvider && settings.values.workerModel ? { provider: settings.values.workerProvider, model: settings.values.workerModel } : null;
|
|
937
1171
|
const nameOf = (provider, model) => settings?.models.find((item) => item.provider === provider && item.id === model)?.name ?? model;
|
|
938
1172
|
const effective = settings?.model ? nameOf(settings.model.provider, settings.model.model) : void 0;
|
|
939
|
-
const
|
|
1173
|
+
const label2 = pinned ? nameOf(pinned.provider, pinned.model) : effective ?? t2("bg.follow");
|
|
940
1174
|
const choose = async (choice) => {
|
|
941
1175
|
closeMenu.current?.();
|
|
942
1176
|
setSaving(true);
|
|
@@ -1061,7 +1295,7 @@ function apply(ctx) {
|
|
|
1061
1295
|
window.addEventListener("blur", close);
|
|
1062
1296
|
(search ?? rows().find((row) => row.getAttribute("aria-checked") === "true") ?? rows()[0])?.focus();
|
|
1063
1297
|
};
|
|
1064
|
-
const title = failed ? t2("bg.error") : t2(pinned ? "bg.hint" : "bg.hintFollow", { model:
|
|
1298
|
+
const title = failed ? t2("bg.error") : t2(pinned ? "bg.hint" : "bg.hintFollow", { model: label2 });
|
|
1065
1299
|
return (0, import_react.createElement)(
|
|
1066
1300
|
"button",
|
|
1067
1301
|
{
|
|
@@ -1081,7 +1315,7 @@ function apply(ctx) {
|
|
|
1081
1315
|
}
|
|
1082
1316
|
},
|
|
1083
1317
|
(0, import_react.createElement)("span", { className: "theone-bg-caption", "aria-hidden": true }, icon("layers", 15)),
|
|
1084
|
-
(0, import_react.createElement)("span", { className: "theone-bg-text" },
|
|
1318
|
+
(0, import_react.createElement)("span", { className: "theone-bg-text" }, label2),
|
|
1085
1319
|
(0, import_react.createElement)("span", { className: "theone-bg-chevron", "aria-hidden": true }, saving ? "\u2026" : icon("chevron", 12))
|
|
1086
1320
|
);
|
|
1087
1321
|
}
|
|
@@ -1275,7 +1509,7 @@ ${body}` }, (0, import_react.createElement)("strong", null, title), " ", body),
|
|
|
1275
1509
|
const groups = [
|
|
1276
1510
|
["models", ["workerProvider", "workerModel", "routerMode"]],
|
|
1277
1511
|
["history", ["historyCatalog", "catalogIntervalMs"]],
|
|
1278
|
-
["linkage", ["linkScope", "routeNotice"]],
|
|
1512
|
+
["linkage", ["linkScope", "routeNotice", "factLinks", "factExtraction"]],
|
|
1279
1513
|
["limits", ["maxDescriptorChars", "maxResponseChars"]],
|
|
1280
1514
|
["storage", ["contextsPath", "databasePath", "gatewayKey"]],
|
|
1281
1515
|
["other", ["notices"]]
|
|
@@ -1335,7 +1569,7 @@ ${body}` }, (0, import_react.createElement)("strong", null, title), " ", body),
|
|
|
1335
1569
|
{ ...props, value, required: field === "workerModel" && !!draft.workerProvider, onChange: (event) => selectValue(event.target.value) },
|
|
1336
1570
|
...choices.map((choice) => (0, import_react.createElement)("option", { key: choice.value, value: choice.value }, choice.label))
|
|
1337
1571
|
);
|
|
1338
|
-
if (field === "historyCatalog" || field === "notices") return select(String(draft[field]), [{ value: "true", label: t2("settings.on") }, { value: "false", label: t2("settings.off") }], (v) => change(field, v === "true"));
|
|
1572
|
+
if (field === "historyCatalog" || field === "notices" || field === "factLinks" || field === "factExtraction") return select(String(draft[field]), [{ value: "true", label: t2("settings.on") }, { value: "false", label: t2("settings.off") }], (v) => change(field, v === "true"));
|
|
1339
1573
|
if (field === "linkScope" || field === "routeNotice") {
|
|
1340
1574
|
const values = field === "linkScope" ? ["auto", "workspace", "off"] : ["switch", "hidden", "all"];
|
|
1341
1575
|
return select(draft[field], values.map((value) => ({ value, label: t2(`settings.${field === "linkScope" ? "scope" : "notice"}.${value}`) })), (v) => change(field, v));
|
|
@@ -1481,7 +1715,7 @@ ${body}` }, (0, import_react.createElement)("strong", null, title), " ", body),
|
|
|
1481
1715
|
}, []);
|
|
1482
1716
|
const own = new Set(topic.sourceSessionIds);
|
|
1483
1717
|
const edited = title.trim() !== topic.title || summary.trim() !== topic.summary || rules.trim() !== constraints;
|
|
1484
|
-
const field = (
|
|
1718
|
+
const field = (label2, control) => (0, import_react.createElement)("label", { className: "theone-manage-field" }, (0, import_react.createElement)("span", null, t2(label2)), control);
|
|
1485
1719
|
return (0, import_react.createElement)(
|
|
1486
1720
|
"div",
|
|
1487
1721
|
{ className: "theone-manage" },
|
|
@@ -1581,6 +1815,7 @@ ${body}` }, (0, import_react.createElement)("strong", null, title), " ", body),
|
|
|
1581
1815
|
)
|
|
1582
1816
|
);
|
|
1583
1817
|
}
|
|
1818
|
+
const label = (text) => text.replace(/\s*[::]\s*$/, "");
|
|
1584
1819
|
function RouteList({ routes, stats, contexts, post, busy }) {
|
|
1585
1820
|
const t2 = useText();
|
|
1586
1821
|
const titleOf = (id) => contexts.find((context) => context.id === id)?.title ?? t2("routes.removed");
|
|
@@ -1612,17 +1847,18 @@ ${body}` }, (0, import_react.createElement)("strong", null, title), " ", body),
|
|
|
1612
1847
|
return (0, import_react.createElement)(
|
|
1613
1848
|
"li",
|
|
1614
1849
|
{ key: route.messageId },
|
|
1850
|
+
(0, import_react.createElement)("time", null, new Date(route.at).toLocaleTimeString(localeSnapshot().active, { hour: "2-digit", minute: "2-digit" })),
|
|
1851
|
+
(0, import_react.createElement)("q", null, route.excerpt || "\u2026"),
|
|
1615
1852
|
(0, import_react.createElement)(
|
|
1616
1853
|
"div",
|
|
1617
|
-
{ className: "theone-route-
|
|
1618
|
-
(0, import_react.createElement)("
|
|
1619
|
-
(0, import_react.createElement)("
|
|
1854
|
+
{ className: "theone-route-target" },
|
|
1855
|
+
(0, import_react.createElement)("strong", null, route.decision.action === "CLARIFY" ? t2("routes.clarify") : `\u2192 ${titleOf(target)}`),
|
|
1856
|
+
(0, import_react.createElement)("small", null, details)
|
|
1620
1857
|
),
|
|
1621
1858
|
(0, import_react.createElement)(
|
|
1622
1859
|
"div",
|
|
1623
|
-
{ className: "theone-route-
|
|
1624
|
-
(0, import_react.createElement)("
|
|
1625
|
-
(0, import_react.createElement)("small", null, details),
|
|
1860
|
+
{ className: "theone-route-actions" },
|
|
1861
|
+
(0, import_react.createElement)("button", { type: "button", className: "theone-quiet", onClick: () => openFeedbackDialog(route.messageId) }, t2("routes.report")),
|
|
1626
1862
|
route.correctedTo ? (0, import_react.createElement)("span", { className: "theone-route-fixed" }, t2("routes.corrected", { title: titleOf(route.correctedTo) })) : (0, import_react.createElement)(
|
|
1627
1863
|
"select",
|
|
1628
1864
|
{
|
|
@@ -1767,6 +2003,10 @@ ${body}` }, (0, import_react.createElement)("strong", null, title), " ", body),
|
|
|
1767
2003
|
if (!linkage || linkage.scope === "off") return null;
|
|
1768
2004
|
const own = linkage.topics[id];
|
|
1769
2005
|
if (!own) return null;
|
|
2006
|
+
if (managing !== id) return own.related.length || own.private ? [
|
|
2007
|
+
(0, import_react.createElement)("dt", { key: "dt" }, label(t2("link.label"))),
|
|
2008
|
+
(0, import_react.createElement)("dd", { key: "dd" }, own.related.map((topic) => topic.title).join(" \xB7 "), own.private ? (0, import_react.createElement)("span", { className: "theone-tag" }, t2("link.private")) : null)
|
|
2009
|
+
] : null;
|
|
1770
2010
|
const related = new Set(own.related.map((topic) => topic.id));
|
|
1771
2011
|
const others = snapshot.contexts.filter((context) => context.id !== id && !related.has(context.id));
|
|
1772
2012
|
return (0, import_react.createElement)(
|
|
@@ -1831,26 +2071,48 @@ ${body}` }, (0, import_react.createElement)("strong", null, title), " ", body),
|
|
|
1831
2071
|
const assigned = new Set(snapshot?.groups.flatMap((group) => group.contextIds) ?? []);
|
|
1832
2072
|
const groups = [...snapshot?.groups ?? [], ...snapshot?.contexts.some((c) => !assigned.has(c.id)) ? [{ id: "pending", title: t2("catalog.unassigned"), summary: t2("catalog.unassignedSummary"), contextIds: snapshot.contexts.filter((c) => !assigned.has(c.id)).map((c) => c.id) }] : []];
|
|
1833
2073
|
const status = snapshot?.status;
|
|
2074
|
+
const kept = routeStats?.total ? Math.round(100 * (routeStats.total - routeStats.corrected) / routeStats.total) : void 0;
|
|
2075
|
+
const figure = (value, name) => (0, import_react.createElement)("div", { key: name }, (0, import_react.createElement)("dd", null, value), (0, import_react.createElement)("dt", null, name));
|
|
1834
2076
|
return (0, import_react.createElement)(
|
|
1835
2077
|
"section",
|
|
1836
2078
|
{ className: "theone-catalog", translate: "no" },
|
|
1837
2079
|
(0, import_react.createElement)(
|
|
1838
2080
|
"header",
|
|
1839
2081
|
{ className: "theone-catalog-header" },
|
|
1840
|
-
(0, import_react.createElement)(
|
|
2082
|
+
(0, import_react.createElement)(
|
|
2083
|
+
"div",
|
|
2084
|
+
{ className: "theone-catalog-heading" },
|
|
2085
|
+
(0, import_react.createElement)("p", { className: "theone-overline" }, "TheOne"),
|
|
2086
|
+
(0, import_react.createElement)("h1", null, t2("catalog.title")),
|
|
2087
|
+
(0, import_react.createElement)("p", { className: "theone-catalog-lede" }, t2("catalog.subtitle"))
|
|
2088
|
+
),
|
|
2089
|
+
snapshot ? (0, import_react.createElement)(
|
|
2090
|
+
"dl",
|
|
2091
|
+
{ className: "theone-figures" },
|
|
2092
|
+
figure(snapshot.contexts.length, t2("catalog.figTopics")),
|
|
2093
|
+
figure(snapshot.groups.length, t2("catalog.figGroups")),
|
|
2094
|
+
kept !== void 0 ? figure(`${kept}%`, t2("catalog.figKept")) : null
|
|
2095
|
+
) : null
|
|
2096
|
+
),
|
|
2097
|
+
(0, import_react.createElement)(
|
|
2098
|
+
"div",
|
|
2099
|
+
{ className: "theone-toolbar" },
|
|
2100
|
+
(0, import_react.createElement)("p", { className: "theone-catalog-status", role: "status" }, snapshot ? status?.running ? t2("catalog.indexing") : status?.pending ? t2("catalog.pending", { count: status.pending, sessionSuffix: status.pending === 1 ? "" : "s" }) : t2("catalog.updated") : t2("catalog.reading")),
|
|
1841
2101
|
(0, import_react.createElement)(
|
|
1842
2102
|
"div",
|
|
1843
2103
|
{ className: "theone-catalog-tools" },
|
|
1844
|
-
(0, import_react.createElement)("button", { type: "button", disabled: !!busy, onClick: () => setCreating((open) => !open) }, t2("manage.create")),
|
|
2104
|
+
(0, import_react.createElement)("button", { type: "button", className: "theone-primary", disabled: !!busy, onClick: () => setCreating((open) => !open) }, t2("manage.create")),
|
|
2105
|
+
(0, import_react.createElement)("button", { type: "button", onClick: refresh, disabled: !!busy || status?.running }, t2("catalog.refresh")),
|
|
1845
2106
|
snapshot?.linkage && snapshot.linkage.scope !== "off" ? (0, import_react.createElement)("button", {
|
|
1846
2107
|
type: "button",
|
|
2108
|
+
className: "theone-quiet",
|
|
1847
2109
|
disabled: !!busy,
|
|
1848
2110
|
title: t2("link.clearLearnedHint"),
|
|
1849
2111
|
onClick: () => {
|
|
1850
2112
|
void editLinks({ action: "clearLearned" });
|
|
1851
2113
|
}
|
|
1852
2114
|
}, t2("link.clearLearned")) : null,
|
|
1853
|
-
(0, import_react.createElement)("button", { type: "button",
|
|
2115
|
+
(0, import_react.createElement)("button", { type: "button", className: "theone-quiet", onClick: () => openFeedbackDialog() }, t2("feedback.open"))
|
|
1854
2116
|
)
|
|
1855
2117
|
),
|
|
1856
2118
|
creating ? (0, import_react.createElement)(
|
|
@@ -1860,56 +2122,83 @@ ${body}` }, (0, import_react.createElement)("strong", null, title), " ", body),
|
|
|
1860
2122
|
void post("/api/theone/topics", { action: "create", title: newTitle });
|
|
1861
2123
|
} },
|
|
1862
2124
|
(0, import_react.createElement)("input", { value: newTitle, maxLength: 80, autoFocus: true, placeholder: t2("manage.title"), disabled: !!busy, onChange: (event) => setNewTitle(event.target.value) }),
|
|
1863
|
-
(0, import_react.createElement)("button", { type: "submit", disabled: !!busy || !newTitle.trim() }, t2("manage.createButton")),
|
|
1864
|
-
(0, import_react.createElement)("button", { type: "button", onClick: () => {
|
|
2125
|
+
(0, import_react.createElement)("button", { type: "submit", className: "theone-primary", disabled: !!busy || !newTitle.trim() }, t2("manage.createButton")),
|
|
2126
|
+
(0, import_react.createElement)("button", { type: "button", className: "theone-quiet", onClick: () => {
|
|
1865
2127
|
setCreating(false);
|
|
1866
2128
|
setNewTitle("");
|
|
1867
2129
|
} }, t2("manage.cancel"))
|
|
1868
2130
|
) : null,
|
|
1869
|
-
snapshot?.linkage?.scope === "off" ? (0, import_react.createElement)("p", { className: "theone-catalog-
|
|
1870
|
-
(0, import_react.createElement)("p", { className: "theone-catalog-status", role: "status" }, snapshot ? t2("catalog.counts", { topics: snapshot.contexts.length, groups: snapshot.groups.length, topicSuffix: snapshot.contexts.length === 1 ? "" : "s", groupSuffix: snapshot.groups.length === 1 ? "" : "s" }) + " \xB7 " + (status?.running ? t2("catalog.indexing") : status?.pending ? t2("catalog.pending", { count: status.pending, sessionSuffix: status.pending === 1 ? "" : "s" }) : t2("catalog.updated")) : t2("catalog.reading")),
|
|
2131
|
+
snapshot?.linkage?.scope === "off" ? (0, import_react.createElement)("p", { className: "theone-catalog-note" }, t2("link.off")) : null,
|
|
1871
2132
|
status?.failed ? (0, import_react.createElement)("p", { className: "theone-catalog-warning" }, t2("catalog.failed", { count: status.failed, sessionSuffix: status.failed === 1 ? "" : "s" })) : null,
|
|
1872
2133
|
status?.searchUnavailable ? (0, import_react.createElement)("p", { className: "theone-catalog-warning" }, t2("catalog.searchUnavailable")) : null,
|
|
1873
2134
|
error ? (0, import_react.createElement)("p", { role: "alert", className: "theone-catalog-warning" }, t2(error)) : null,
|
|
1874
2135
|
snapshot ? (0, import_react.createElement)(RouteList, { routes, stats: routeStats, contexts: snapshot.contexts, post, busy: !!busy }) : null,
|
|
1875
2136
|
snapshot && !snapshot.contexts.length ? (0, import_react.createElement)("p", { className: "theone-catalog-empty" }, t2(status?.running ? "catalog.emptyIndexing" : "catalog.empty")) : null,
|
|
1876
|
-
(0, import_react.createElement)("div", { className: "theone-catalog-groups" }, ...groups.map((group) => (0, import_react.createElement)(
|
|
2137
|
+
(0, import_react.createElement)("div", { className: "theone-catalog-groups" }, ...groups.map((group, index) => (0, import_react.createElement)(
|
|
1877
2138
|
"section",
|
|
1878
2139
|
{ key: group.id, className: "theone-topic-group" },
|
|
1879
|
-
(0, import_react.createElement)(
|
|
1880
|
-
|
|
1881
|
-
|
|
2140
|
+
(0, import_react.createElement)(
|
|
2141
|
+
"header",
|
|
2142
|
+
{ className: "theone-group-head" },
|
|
2143
|
+
(0, import_react.createElement)("span", { className: "theone-group-index" }, String(index + 1).padStart(2, "0")),
|
|
2144
|
+
(0, import_react.createElement)("h2", null, group.title, (0, import_react.createElement)("span", null, group.contextIds.length)),
|
|
2145
|
+
group.summary ? (0, import_react.createElement)("p", { className: "theone-group-summary" }, group.summary) : null
|
|
2146
|
+
),
|
|
2147
|
+
(0, import_react.createElement)("ol", { className: "theone-topic-list" }, ...group.contextIds.flatMap((id) => {
|
|
1882
2148
|
const topic = snapshot?.contexts.find((c) => c.id === id);
|
|
1883
2149
|
if (!topic) return [];
|
|
1884
2150
|
const constraints = snapshot?.linkage?.topics[id]?.constraints ?? "";
|
|
2151
|
+
const open = managing === id;
|
|
2152
|
+
const links = linkRow(id);
|
|
1885
2153
|
return [(0, import_react.createElement)(
|
|
1886
|
-
"
|
|
1887
|
-
{ key: id, className:
|
|
1888
|
-
(0, import_react.createElement)(
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
2154
|
+
"li",
|
|
2155
|
+
{ key: id, className: `theone-topic-card${open ? " theone-open" : ""}${topic.hidden ? " theone-hidden" : ""}` },
|
|
2156
|
+
(0, import_react.createElement)(
|
|
2157
|
+
"div",
|
|
2158
|
+
{ className: "theone-topic-main" },
|
|
2159
|
+
(0, import_react.createElement)("h3", null, topic.title),
|
|
2160
|
+
topic.summary && topic.summary.trim() !== topic.title.trim() ? (0, import_react.createElement)("p", { className: "theone-topic-summary" }, topic.summary) : null,
|
|
2161
|
+
topic.hidden ? (0, import_react.createElement)("p", { className: "theone-topic-warning" }, t2(topic.hidden === "archived" ? "topic.hiddenArchived" : "topic.hiddenOrphaned")) : null,
|
|
2162
|
+
topic.lastState || constraints || links && !open ? (0, import_react.createElement)(
|
|
2163
|
+
"dl",
|
|
2164
|
+
{ className: "theone-topic-meta" },
|
|
2165
|
+
topic.lastState ? [(0, import_react.createElement)("dt", { key: "s" }, label(t2("topic.state"))), (0, import_react.createElement)("dd", { key: "sv" }, topic.lastState)] : null,
|
|
2166
|
+
constraints ? [(0, import_react.createElement)("dt", { key: "c" }, label(t2("topic.constraints"))), (0, import_react.createElement)("dd", { key: "cv" }, constraints)] : null,
|
|
2167
|
+
open ? null : links
|
|
2168
|
+
) : null
|
|
2169
|
+
),
|
|
1893
2170
|
(0, import_react.createElement)(
|
|
1894
2171
|
"div",
|
|
1895
2172
|
{ className: "theone-topic-actions" },
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
2173
|
+
// A hidden topic has nothing left to continue: its conversations are gone or archived.
|
|
2174
|
+
(0, import_react.createElement)("button", {
|
|
2175
|
+
type: "button",
|
|
2176
|
+
className: "theone-continue",
|
|
2177
|
+
disabled: !!busy || !!topic.hidden,
|
|
2178
|
+
title: topic.hidden ? t2("topic.continueHidden") : void 0,
|
|
2179
|
+
onClick: () => {
|
|
2180
|
+
void continueTopic(id);
|
|
2181
|
+
}
|
|
2182
|
+
}, t2(busy === id ? "topic.opening" : "topic.continue"), (0, import_react.createElement)("span", { "aria-hidden": true }, " \u2192")),
|
|
2183
|
+
(0, import_react.createElement)("button", { type: "button", className: "theone-quiet", "aria-expanded": open, onClick: () => setManaging((current) => current === id ? void 0 : id) }, t2(open ? "manage.close" : "manage.open")),
|
|
2184
|
+
...(topic.hidden === "orphaned" ? [] : topic.sourceSessionIds).slice(0, 3).map((sessionId, i) => (0, import_react.createElement)("button", {
|
|
1901
2185
|
key: sessionId,
|
|
1902
2186
|
type: "button",
|
|
1903
|
-
className: "theone-
|
|
2187
|
+
className: "theone-quiet",
|
|
1904
2188
|
onClick: () => {
|
|
1905
2189
|
ctx.layout.beginNavigation();
|
|
1906
2190
|
ctx.uiWorkspace.openSession(sessionId);
|
|
1907
2191
|
}
|
|
1908
2192
|
}, t2("topic.source") + (topic.sourceSessionIds.length > 1 ? " " + (i + 1) : "")))
|
|
1909
2193
|
),
|
|
1910
|
-
|
|
2194
|
+
open ? (0, import_react.createElement)(
|
|
2195
|
+
"div",
|
|
2196
|
+
{ className: "theone-topic-edit" },
|
|
2197
|
+
links,
|
|
2198
|
+
(0, import_react.createElement)(TopicManager, { key: `${id}:${topic.title}:${topic.summary}:${constraints}`, topic, constraints, groups: snapshot.groups, contexts: snapshot.contexts, post, busy: !!busy })
|
|
2199
|
+
) : null
|
|
1911
2200
|
)];
|
|
1912
|
-
})
|
|
2201
|
+
}))
|
|
1913
2202
|
)))
|
|
1914
2203
|
);
|
|
1915
2204
|
}
|
|
@@ -1989,6 +2278,12 @@ button:has(.theone-nav[data-wide=true])>span:has(.theone-nav){flex:1;min-width:0
|
|
|
1989
2278
|
.theone-dialog-actions .theone-dialog-primary:hover{background:#4a7fc0}
|
|
1990
2279
|
.theone-dialog-actions button:focus-visible{outline:2px solid #4a7fc0;outline-offset:2px}
|
|
1991
2280
|
.theone-dialog .theone-dialog-body{white-space:pre-wrap;color:var(--dsw-alias-label-primary,#e8e8ea)}
|
|
2281
|
+
.theone-feedback{width:min(560px,100%);max-height:calc(100vh - 32px);overflow:auto}
|
|
2282
|
+
.theone-feedback textarea,.theone-feedback input:not([type=checkbox]){display:block;width:100%;box-sizing:border-box;margin:0 0 10px;padding:8px 10px;border:1px solid var(--dsw-alias-border-l2,#ffffff1f);border-radius:9px;background:transparent;color:inherit;font:inherit;resize:vertical}
|
|
2283
|
+
.theone-feedback .theone-feedback-check{display:block;margin:0 0 10px;font-size:13px;color:var(--dsw-alias-label-secondary,#a0a0a6)}
|
|
2284
|
+
.theone-feedback-preview{margin:0 0 10px;font-size:13px}
|
|
2285
|
+
.theone-feedback-preview summary{cursor:pointer;color:var(--dsw-alias-label-secondary,#a0a0a6)}
|
|
2286
|
+
.theone-feedback-preview pre{max-height:220px;overflow:auto;margin:6px 0 0;padding:8px 10px;border-radius:9px;background:#0000001f;font-size:12px;line-height:1.5;white-space:pre-wrap;word-break:break-word}
|
|
1992
2287
|
.theone-notice{display:flex;align-items:center;gap:8px;margin:6px 4px 0;padding:6px 8px 6px 10px;border:1px solid var(--dsw-alias-border-l2,#ffffff1f);border-radius:10px;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary,#a0a0a6);min-width:0}
|
|
1993
2288
|
.theone-notice-tag{flex:none;display:inline-flex;padding:3px;border-radius:6px;background:#3b6fb033;color:#7fa9dd}
|
|
1994
2289
|
.theone-notice-text{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
@@ -2012,8 +2307,93 @@ button:has(.theone-nav[data-wide=true])>span:has(.theone-nav){flex:1;min-width:0
|
|
|
2012
2307
|
`;
|
|
2013
2308
|
var catalogCss = `
|
|
2014
2309
|
button:has(.theone-catalog-entry)>span:not(:has(.theone-catalog-entry)){display:none}
|
|
2015
|
-
.theone-catalog{
|
|
2016
|
-
|
|
2310
|
+
.theone-catalog{--t-fg:var(--dsw-alias-label-primary,#18181b);--t-muted:var(--dsw-alias-label-secondary,#6b6b72);--t-rule:var(--dsw-alias-border-l2,#18181b1f);--t-accent:#b4531c;--t-warn:#c2410c;--t-field:#18181b0a;
|
|
2311
|
+
container-type:inline-size;box-sizing:border-box;height:100%;overflow:auto;padding:48px 56px 96px;color:var(--t-fg);font-feature-settings:"tnum" 1}
|
|
2312
|
+
[data-ds-dark-theme] .theone-catalog{--t-accent:#8cc2ef;--t-warn:#fb923c;--t-field:#ffffff0d}
|
|
2313
|
+
.theone-catalog>*{max-width:1120px;margin-left:auto;margin-right:auto}
|
|
2314
|
+
.theone-catalog button{font:inherit;font-size:13px;line-height:1.4;color:inherit;background:transparent;border:1px solid var(--t-rule);border-radius:6px;padding:6px 12px;cursor:pointer;white-space:nowrap}
|
|
2315
|
+
.theone-catalog button:hover:not(:disabled){border-color:var(--t-fg)}
|
|
2316
|
+
.theone-catalog button:disabled{opacity:.4;cursor:default}
|
|
2317
|
+
.theone-catalog button:focus-visible{outline:2px solid var(--t-accent);outline-offset:2px}
|
|
2318
|
+
.theone-catalog .theone-primary{background:var(--t-fg);border-color:var(--t-fg);color:var(--dsw-alias-bg-primary,#fff)}
|
|
2319
|
+
[data-ds-dark-theme] .theone-catalog .theone-primary{color:#111}
|
|
2320
|
+
.theone-catalog .theone-quiet{border-color:transparent;color:var(--t-muted);padding-left:6px;padding-right:6px}
|
|
2321
|
+
.theone-catalog .theone-quiet:hover:not(:disabled){border-color:transparent;color:var(--t-fg);text-decoration:underline;text-underline-offset:3px}
|
|
2322
|
+
.theone-catalog .theone-continue{border-color:transparent;color:var(--t-accent);font-weight:600;padding-left:0;padding-right:6px}
|
|
2323
|
+
.theone-catalog .theone-continue:hover:not(:disabled){border-color:transparent;text-decoration:underline;text-underline-offset:3px}
|
|
2324
|
+
.theone-catalog-header{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:end;gap:24px 48px;padding-bottom:28px;border-bottom:2px solid var(--t-fg)}
|
|
2325
|
+
.theone-overline{margin:0 0 14px;font-size:12px;font-weight:600;letter-spacing:.06em;color:var(--t-accent)}
|
|
2326
|
+
.theone-catalog h1{margin:0;font-size:44px;line-height:1.05;font-weight:700;letter-spacing:-.02em}
|
|
2327
|
+
.theone-catalog-lede{margin:14px 0 0;max-width:34em;font-size:15px;line-height:1.6;color:var(--t-muted)}
|
|
2328
|
+
.theone-figures{display:flex;gap:40px;margin:0}
|
|
2329
|
+
.theone-figures>div{display:flex;flex-direction:column-reverse;gap:6px;min-width:64px}
|
|
2330
|
+
.theone-figures dd{margin:0;font-size:40px;line-height:1;font-weight:600;letter-spacing:-.02em}
|
|
2331
|
+
.theone-figures dt{font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:var(--t-muted)}
|
|
2332
|
+
.theone-toolbar{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px 24px;padding:14px 0 40px}
|
|
2333
|
+
.theone-catalog-status{margin:0;font-size:13px;color:var(--t-muted)}
|
|
2334
|
+
.theone-catalog-tools{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
|
|
2335
|
+
.theone-catalog-note,.theone-catalog-empty{color:var(--t-muted);font-size:14px;line-height:1.7}
|
|
2336
|
+
.theone-catalog-empty{padding:48px 0}
|
|
2337
|
+
.theone-catalog-warning{margin:0 0 24px;padding:10px 0 10px 14px;border-left:2px solid var(--t-warn);font-size:13px;line-height:1.6}
|
|
2338
|
+
.theone-catalog-entry{display:flex;align-items:center;gap:10px;font-size:14px}
|
|
2339
|
+
.theone-routes{margin-bottom:56px;border-top:1px solid var(--t-rule);border-bottom:1px solid var(--t-rule)}
|
|
2340
|
+
.theone-routes summary{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 12px;padding:14px 0;cursor:pointer;font-size:13px;font-weight:600;letter-spacing:.04em;list-style:none}
|
|
2341
|
+
.theone-routes summary::-webkit-details-marker{display:none}
|
|
2342
|
+
.theone-routes summary::before{content:"+";display:inline-block;width:14px;color:var(--t-muted);font-weight:400}
|
|
2343
|
+
.theone-routes[open] summary::before{content:"\u2212"}
|
|
2344
|
+
.theone-routes summary>span{color:var(--t-muted);font-weight:400}
|
|
2345
|
+
.theone-route-stats{font-weight:400;color:var(--t-muted);font-size:12px}
|
|
2346
|
+
.theone-routes .theone-manage-hint{margin:0 0 12px 26px;max-width:46em}
|
|
2347
|
+
.theone-routes ol{list-style:none;margin:0;padding:0 0 8px}
|
|
2348
|
+
.theone-routes li{display:grid;grid-template-columns:52px minmax(0,1.3fr) minmax(0,1fr) auto;gap:4px 20px;align-items:baseline;padding:10px 0;border-top:1px solid var(--t-rule);font-size:13px}
|
|
2349
|
+
.theone-routes time{color:var(--t-muted)}
|
|
2350
|
+
.theone-routes q{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;quotes:none}
|
|
2351
|
+
.theone-route-target{display:flex;flex-direction:column;gap:2px;min-width:0}
|
|
2352
|
+
.theone-route-target strong{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
2353
|
+
.theone-route-target small{color:var(--t-muted);font-size:12px}
|
|
2354
|
+
.theone-route-actions{display:flex;gap:8px;align-items:center;justify-content:flex-end}
|
|
2355
|
+
.theone-route-fixed{color:var(--t-muted);font-size:12px}
|
|
2356
|
+
.theone-routes select{width:auto;max-width:150px;padding-top:4px;padding-bottom:4px;font-size:12px}
|
|
2357
|
+
.theone-catalog-groups{display:flex;flex-direction:column;gap:56px}
|
|
2358
|
+
.theone-topic-group{display:grid;grid-template-columns:minmax(0,3fr) minmax(0,9fr);gap:0 40px;border-top:2px solid var(--t-fg);padding-top:16px}
|
|
2359
|
+
.theone-group-head{position:sticky;top:0;align-self:start}
|
|
2360
|
+
.theone-group-index{display:block;margin-bottom:10px;font-size:13px;font-weight:600;color:var(--t-accent)}
|
|
2361
|
+
.theone-topic-group h2{margin:0;font-size:22px;line-height:1.2;font-weight:700;letter-spacing:-.01em}
|
|
2362
|
+
.theone-topic-group h2 span{margin-left:8px;font-size:13px;font-weight:400;color:var(--t-muted)}
|
|
2363
|
+
.theone-group-summary{margin:10px 0 0;font-size:13px;line-height:1.6;color:var(--t-muted)}
|
|
2364
|
+
.theone-topic-list{list-style:none;margin:0;padding:0}
|
|
2365
|
+
.theone-topic-card{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:6px 32px;padding:18px 0 20px;border-top:1px solid var(--t-rule)}
|
|
2366
|
+
.theone-topic-card:first-child{border-top:0;padding-top:4px}
|
|
2367
|
+
.theone-topic-card.theone-hidden .theone-topic-main{opacity:.6}
|
|
2368
|
+
.theone-topic-card h3{margin:0;font-size:16px;line-height:1.4;font-weight:600}
|
|
2369
|
+
.theone-topic-summary{margin:6px 0 0;max-width:42em;font-size:14px;line-height:1.6;color:var(--t-muted);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
|
|
2370
|
+
.theone-topic-meta{display:grid;grid-template-columns:auto minmax(0,1fr);gap:6px 16px;margin:14px 0 0;max-width:46em;font-size:13px;line-height:1.55}
|
|
2371
|
+
.theone-topic-meta dt{color:var(--t-muted);font-size:12px;white-space:nowrap}
|
|
2372
|
+
.theone-topic-meta dd{margin:0}
|
|
2373
|
+
.theone-tag{display:inline-block;margin-left:8px;padding:0 6px;border:1px solid var(--t-rule);border-radius:4px;font-size:11px;color:var(--t-muted)}
|
|
2374
|
+
.theone-topic-warning{margin:10px 0 0;padding-left:12px;border-left:2px solid var(--t-warn);font-size:12px;line-height:1.6}
|
|
2375
|
+
.theone-topic-actions{display:flex;flex-direction:column;align-items:flex-end;gap:0}.theone-topic-actions button{padding-top:3px;padding-bottom:3px}
|
|
2376
|
+
.theone-topic-edit{grid-column:1/-1;margin-top:12px;padding:4px 0 4px 20px;border-left:2px solid var(--t-accent)}
|
|
2377
|
+
.theone-topic-links{display:flex;flex-wrap:wrap;align-items:center;gap:6px 8px;margin:0 0 16px;font-size:13px}
|
|
2378
|
+
.theone-links-label,.theone-links-empty{color:var(--t-muted)}
|
|
2379
|
+
.theone-link-chip{display:inline-flex;align-items:center;gap:2px;padding:2px 2px 2px 10px;border:1px solid var(--t-rule);border-radius:4px}
|
|
2380
|
+
.theone-catalog .theone-link-chip button{border:0;padding:0 6px;font-size:14px;line-height:1;color:var(--t-muted)}
|
|
2381
|
+
.theone-link-private{display:inline-flex;align-items:center;gap:6px;color:var(--t-muted);cursor:pointer}
|
|
2382
|
+
.theone-catalog input:not([type=checkbox]),.theone-catalog textarea,.theone-catalog select{font:inherit;font-size:13px;color:inherit;background:var(--t-field);border:1px solid transparent;border-bottom-color:var(--t-rule);border-radius:4px 4px 0 0;padding:7px 10px;box-sizing:border-box;min-width:0}
|
|
2383
|
+
.theone-catalog input:not([type=checkbox]):focus,.theone-catalog textarea:focus,.theone-catalog select:focus{outline:none;border-bottom-color:var(--t-accent)}
|
|
2384
|
+
.theone-manage{display:flex;flex-direction:column;gap:14px;font-size:13px}
|
|
2385
|
+
.theone-create{flex-direction:row;flex-wrap:wrap;align-items:center;gap:8px;margin:0 0 40px;padding:16px 0;border-top:1px solid var(--t-rule);border-bottom:1px solid var(--t-rule)}
|
|
2386
|
+
.theone-create input{flex:1;min-width:200px}
|
|
2387
|
+
.theone-manage-field{display:flex;flex-direction:column;gap:6px}
|
|
2388
|
+
.theone-manage-field>span{font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:var(--t-muted)}
|
|
2389
|
+
.theone-manage textarea{resize:vertical;width:100%}
|
|
2390
|
+
.theone-manage-row{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
|
|
2391
|
+
.theone-manage-row select,.theone-manage-row input{flex:1;min-width:160px}
|
|
2392
|
+
.theone-manage-hint{margin:0;font-size:12px;line-height:1.6;color:var(--t-muted)}
|
|
2393
|
+
.theone-catalog .theone-danger{color:var(--t-warn);border-color:var(--t-warn)}
|
|
2394
|
+
@container (max-width:860px){.theone-topic-group{grid-template-columns:1fr}.theone-group-head{position:static;margin-bottom:20px}.theone-catalog-header{grid-template-columns:1fr}.theone-figures{gap:32px}}
|
|
2395
|
+
@container (max-width:640px){.theone-catalog h1{font-size:32px}.theone-figures dd{font-size:30px}.theone-topic-card{grid-template-columns:1fr}.theone-topic-actions{flex-direction:row;flex-wrap:wrap;align-items:center}.theone-routes li{grid-template-columns:44px minmax(0,1fr)}.theone-route-target,.theone-route-actions{grid-column:2}.theone-route-actions{justify-content:flex-start}}
|
|
2396
|
+
@media(max-width:640px){.theone-catalog{padding:28px 16px 64px}}
|
|
2017
2397
|
`;
|
|
2018
2398
|
var composerCss = `
|
|
2019
2399
|
.theone-bg{display:inline-flex;align-items:center;gap:5px;height:32px;padding:0 10px;border:0;border-radius:10px;background:transparent;color:var(--dsw-alias-label-primary);font:inherit;font-size:14px;white-space:nowrap;cursor:pointer;max-width:220px}
|