dsh-cheso-design 0.1.2 → 0.1.3

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/lib/client.js CHANGED
@@ -45,6 +45,15 @@ function isEmbedFormat(format) {
45
45
  return embedFormats.has(format);
46
46
  }
47
47
 
48
+ // src/sites.ts
49
+ var CHESO_SITES = {
50
+ global: "https://cheso.ai"
51
+ };
52
+ function projectSite(projectUrl) {
53
+ if (typeof projectUrl !== "string") return void 0;
54
+ return projectUrl.match(/^(.*)\/agent\/[A-Za-z0-9_-]+\/?$/)?.[1];
55
+ }
56
+
48
57
  // src/client/file-icon-paths.ts
49
58
  var fileIconPaths = {
50
59
  png: [
@@ -187,11 +196,13 @@ var de_default = {
187
196
  toolFailed: "Cheso-Anfrage fehlgeschlagen",
188
197
  taskCompleted: "Abgeschlossen \xB7 Dateien: {count}",
189
198
  taskRunning: "Wird noch erstellt",
199
+ taskQueued: "In der Warteschlange",
190
200
  lowCredits: "Nicht gen\xFCgend Guthaben",
191
201
  taskFailed: "Fehlgeschlagen",
192
202
  taskStopped: "Abgebrochen",
193
203
  taskRolledBack: "Zur\xFCckgesetzt",
194
204
  taskNeedsReply: "Wartet auf deine Antwort",
205
+ questionRound: "Fragerunde {number}",
195
206
  questionAnswered: "Beantwortet",
196
207
  questionSkipped: "\xDCbersprungen",
197
208
  taskUnknown: "Unbekannter Status",
@@ -216,6 +227,7 @@ var de_default = {
216
227
  loginWaiting: "Die Autorisierung steht noch aus. Schlie\xDFe sie in Cheso ab und pr\xFCfe die Anmeldung erneut.",
217
228
  loginNotStarted: "Die Anmeldung wurde noch nicht gestartet oder abgebrochen. Rufe einen neuen Autorisierungslink ab.",
218
229
  loginFailed: "Die Anmeldung bei Cheso ist fehlgeschlagen. Versuche es erneut.",
230
+ fixedTokenRejected: "Cheso hat den konfigurierten API-Token abgelehnt. Aktualisiere oder entferne ihn in der DSH-Konfiguration oder Startumgebung und starte DSH neu.",
219
231
  loginInvalidLink: "Cheso hat keinen g\xFCltigen Autorisierungslink zur\xFCckgegeben.",
220
232
  loginUnknownSite: "Diese Cheso-Website ist nicht mehr konfiguriert. Pr\xFCfe die Website-Einstellungen und versuche es erneut.",
221
233
  previewTitle: "Cheso-Vorschau",
@@ -274,11 +286,13 @@ var en_default = {
274
286
  toolFailed: "Cheso request failed",
275
287
  taskCompleted: "Completed \xB7 Files: {count}",
276
288
  taskRunning: "Still generating",
289
+ taskQueued: "Queued",
277
290
  lowCredits: "Not enough credits",
278
291
  taskFailed: "Failed",
279
292
  taskStopped: "Stopped",
280
293
  taskRolledBack: "Rolled back",
281
294
  taskNeedsReply: "Waiting for your reply",
295
+ questionRound: "Q&A round {number}",
282
296
  questionAnswered: "Answered",
283
297
  questionSkipped: "Skipped",
284
298
  taskUnknown: "Unknown status",
@@ -303,6 +317,7 @@ var en_default = {
303
317
  loginWaiting: "Authorization is pending. Finish in Cheso, then check again.",
304
318
  loginNotStarted: "Sign-in hasn\u2019t started or was canceled. Get a new authorization link.",
305
319
  loginFailed: "Could not sign in to Cheso. Try again.",
320
+ fixedTokenRejected: "Cheso rejected the configured API token. Update or remove it from your DSH configuration or startup environment, then restart DSH.",
306
321
  loginInvalidLink: "Cheso did not return a valid authorization link.",
307
322
  loginUnknownSite: "This Cheso site is no longer configured. Check the site settings and try again.",
308
323
  previewTitle: "Cheso preview",
@@ -361,11 +376,13 @@ var es_default = {
361
376
  toolFailed: "Error en la solicitud a Cheso",
362
377
  taskCompleted: "Completado \xB7 Archivos: {count}",
363
378
  taskRunning: "Generaci\xF3n en curso",
379
+ taskQueued: "En cola",
364
380
  lowCredits: "Cr\xE9ditos insuficientes",
365
381
  taskFailed: "Error",
366
382
  taskStopped: "Detenido",
367
383
  taskRolledBack: "Cambios revertidos",
368
384
  taskNeedsReply: "En espera de tu respuesta",
385
+ questionRound: "Ronda de preguntas {number}",
369
386
  questionAnswered: "Respondido",
370
387
  questionSkipped: "Omitido",
371
388
  taskUnknown: "Estado desconocido",
@@ -390,6 +407,7 @@ var es_default = {
390
407
  loginWaiting: "La autorizaci\xF3n est\xE1 pendiente. Compl\xE9tala en Cheso y vuelve a comprobarla.",
391
408
  loginNotStarted: "El inicio de sesi\xF3n no se ha iniciado o se cancel\xF3. Obt\xE9n un nuevo enlace de autorizaci\xF3n.",
392
409
  loginFailed: "No se pudo iniciar sesi\xF3n en Cheso. Int\xE9ntalo de nuevo.",
410
+ fixedTokenRejected: "Cheso rechaz\xF3 el token de API configurado. Actual\xEDzalo o elim\xEDnalo en la configuraci\xF3n o el entorno de inicio de DSH y reinicia DSH.",
393
411
  loginInvalidLink: "Cheso no devolvi\xF3 un enlace de autorizaci\xF3n v\xE1lido.",
394
412
  loginUnknownSite: "Este sitio de Cheso ya no est\xE1 configurado. Revisa los ajustes del sitio e int\xE9ntalo de nuevo.",
395
413
  previewTitle: "Vista previa de Cheso",
@@ -448,11 +466,13 @@ var fr_default = {
448
466
  toolFailed: "\xC9chec de la requ\xEAte Cheso",
449
467
  taskCompleted: "Termin\xE9 \xB7 Fichiers : {count}",
450
468
  taskRunning: "G\xE9n\xE9ration en cours",
469
+ taskQueued: "En file d\u2019attente",
451
470
  lowCredits: "Cr\xE9dits insuffisants",
452
471
  taskFailed: "\xC9chec",
453
472
  taskStopped: "Arr\xEAt\xE9",
454
473
  taskRolledBack: "Modifications annul\xE9es",
455
474
  taskNeedsReply: "En attente de votre r\xE9ponse",
475
+ questionRound: "S\xE9rie de questions {number}",
456
476
  questionAnswered: "R\xE9pondu",
457
477
  questionSkipped: "Ignor\xE9",
458
478
  taskUnknown: "\xC9tat inconnu",
@@ -477,6 +497,7 @@ var fr_default = {
477
497
  loginWaiting: "L\u2019autorisation est en attente. Terminez-la dans Cheso, puis v\xE9rifiez \xE0 nouveau.",
478
498
  loginNotStarted: "La connexion n\u2019a pas d\xE9marr\xE9 ou a \xE9t\xE9 annul\xE9e. Obtenez un nouveau lien d\u2019autorisation.",
479
499
  loginFailed: "Impossible de se connecter \xE0 Cheso. R\xE9essayez.",
500
+ fixedTokenRejected: "Cheso a refus\xE9 le jeton API configur\xE9. Mettez-le \xE0 jour ou supprimez-le dans la configuration ou l\u2019environnement de d\xE9marrage de DSH, puis red\xE9marrez DSH.",
480
501
  loginInvalidLink: "Cheso n\u2019a pas renvoy\xE9 de lien d\u2019autorisation valide.",
481
502
  loginUnknownSite: "Ce site Cheso n\u2019est plus configur\xE9. V\xE9rifiez les param\xE8tres du site et r\xE9essayez.",
482
503
  previewTitle: "Aper\xE7u Cheso",
@@ -535,11 +556,13 @@ var ja_default = {
535
556
  toolFailed: "Cheso \u3078\u306E\u30EA\u30AF\u30A8\u30B9\u30C8\u306B\u5931\u6557\u3057\u307E\u3057\u305F",
536
557
  taskCompleted: "\u5B8C\u4E86 \xB7 \u30D5\u30A1\u30A4\u30EB {count} \u4EF6",
537
558
  taskRunning: "\u751F\u6210\u3092\u7D9A\u3051\u3066\u3044\u307E\u3059",
559
+ taskQueued: "\u9001\u4FE1\u5F85\u3061",
538
560
  lowCredits: "\u30AF\u30EC\u30B8\u30C3\u30C8\u4E0D\u8DB3",
539
561
  taskFailed: "\u5931\u6557",
540
562
  taskStopped: "\u4E2D\u6B62",
541
563
  taskRolledBack: "\u30ED\u30FC\u30EB\u30D0\u30C3\u30AF\u6E08\u307F",
542
564
  taskNeedsReply: "\u8FD4\u4FE1\u5F85\u3061",
565
+ questionRound: "\u8CEA\u7591\u5FDC\u7B54 {number} \u56DE\u76EE",
543
566
  questionAnswered: "\u56DE\u7B54\u6E08\u307F",
544
567
  questionSkipped: "\u30B9\u30AD\u30C3\u30D7\u6E08\u307F",
545
568
  taskUnknown: "\u72B6\u614B\u4E0D\u660E",
@@ -564,6 +587,7 @@ var ja_default = {
564
587
  loginWaiting: "\u627F\u8A8D\u5F85\u3061\u3067\u3059\u3002Cheso \u3067\u624B\u7D9A\u304D\u3092\u5B8C\u4E86\u3057\u3066\u304B\u3089\u3001\u3082\u3046\u4E00\u5EA6\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
565
588
  loginNotStarted: "\u30ED\u30B0\u30A4\u30F3\u304C\u958B\u59CB\u3055\u308C\u3066\u3044\u306A\u3044\u304B\u3001\u30AD\u30E3\u30F3\u30BB\u30EB\u3055\u308C\u307E\u3057\u305F\u3002\u65B0\u3057\u3044\u8A8D\u8A3C\u30EA\u30F3\u30AF\u3092\u53D6\u5F97\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
566
589
  loginFailed: "Cheso \u306B\u30ED\u30B0\u30A4\u30F3\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u3082\u3046\u4E00\u5EA6\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002",
590
+ fixedTokenRejected: "Cheso \u304C\u8A2D\u5B9A\u6E08\u307F\u306E API \u30C8\u30FC\u30AF\u30F3\u3092\u62D2\u5426\u3057\u307E\u3057\u305F\u3002DSH \u306E\u8A2D\u5B9A\u307E\u305F\u306F\u8D77\u52D5\u74B0\u5883\u3067\u30C8\u30FC\u30AF\u30F3\u3092\u66F4\u65B0\u307E\u305F\u306F\u524A\u9664\u3057\u3001DSH \u3092\u518D\u8D77\u52D5\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
567
591
  loginInvalidLink: "Cheso \u304B\u3089\u6709\u52B9\u306A\u8A8D\u8A3C\u30EA\u30F3\u30AF\u304C\u8FD4\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002",
568
592
  loginUnknownSite: "\u3053\u306E Cheso \u30B5\u30A4\u30C8\u306F\u73FE\u5728\u306E\u8A2D\u5B9A\u306B\u3042\u308A\u307E\u305B\u3093\u3002\u30B5\u30A4\u30C8\u8A2D\u5B9A\u3092\u78BA\u8A8D\u3057\u3066\u3001\u3082\u3046\u4E00\u5EA6\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002",
569
593
  previewTitle: "Cheso \u30D7\u30EC\u30D3\u30E5\u30FC",
@@ -622,11 +646,13 @@ var pt_default = {
622
646
  toolFailed: "Falha na solicita\xE7\xE3o ao Cheso",
623
647
  taskCompleted: "Conclu\xEDdo \xB7 Arquivos: {count}",
624
648
  taskRunning: "Gera\xE7\xE3o em andamento",
649
+ taskQueued: "Na fila",
625
650
  lowCredits: "Cr\xE9ditos insuficientes",
626
651
  taskFailed: "Falha",
627
652
  taskStopped: "Interrompido",
628
653
  taskRolledBack: "Altera\xE7\xF5es revertidas",
629
654
  taskNeedsReply: "Aguardando sua resposta",
655
+ questionRound: "Rodada de perguntas {number}",
630
656
  questionAnswered: "Respondido",
631
657
  questionSkipped: "Ignorado",
632
658
  taskUnknown: "Status desconhecido",
@@ -651,6 +677,7 @@ var pt_default = {
651
677
  loginWaiting: "A autoriza\xE7\xE3o est\xE1 pendente. Conclua no Cheso e verifique novamente.",
652
678
  loginNotStarted: "O login n\xE3o foi iniciado ou foi cancelado. Obtenha um novo link de autoriza\xE7\xE3o.",
653
679
  loginFailed: "N\xE3o foi poss\xEDvel entrar no Cheso. Tente novamente.",
680
+ fixedTokenRejected: "O Cheso rejeitou o token de API configurado. Atualize ou remova o token na configura\xE7\xE3o ou no ambiente de inicializa\xE7\xE3o do DSH e reinicie o DSH.",
654
681
  loginInvalidLink: "O Cheso n\xE3o retornou um link de autoriza\xE7\xE3o v\xE1lido.",
655
682
  loginUnknownSite: "Este site do Cheso n\xE3o est\xE1 mais configurado. Verifique as configura\xE7\xF5es do site e tente novamente.",
656
683
  previewTitle: "Pr\xE9via do Cheso",
@@ -709,11 +736,13 @@ var ru_default = {
709
736
  toolFailed: "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0432\u044B\u043F\u043E\u043B\u043D\u0438\u0442\u044C \u0437\u0430\u043F\u0440\u043E\u0441 \u043A Cheso",
710
737
  taskCompleted: "\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043D\u043E \xB7 \u0424\u0430\u0439\u043B\u043E\u0432: {count}",
711
738
  taskRunning: "\u0421\u043E\u0437\u0434\u0430\u043D\u0438\u0435 \u043F\u0440\u043E\u0434\u043E\u043B\u0436\u0430\u0435\u0442\u0441\u044F",
739
+ taskQueued: "\u0412 \u043E\u0447\u0435\u0440\u0435\u0434\u0438",
712
740
  lowCredits: "\u041D\u0435\u0434\u043E\u0441\u0442\u0430\u0442\u043E\u0447\u043D\u043E \u043A\u0440\u0435\u0434\u0438\u0442\u043E\u0432",
713
741
  taskFailed: "\u041E\u0448\u0438\u0431\u043A\u0430",
714
742
  taskStopped: "\u041E\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u043E",
715
743
  taskRolledBack: "\u0418\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u044F \u043E\u0442\u043C\u0435\u043D\u0435\u043D\u044B",
716
744
  taskNeedsReply: "\u041E\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044F \u0432\u0430\u0448 \u043E\u0442\u0432\u0435\u0442",
745
+ questionRound: "\u0420\u0430\u0443\u043D\u0434 \u0432\u043E\u043F\u0440\u043E\u0441\u043E\u0432 {number}",
717
746
  questionAnswered: "\u041E\u0442\u0432\u0435\u0447\u0435\u043D\u043E",
718
747
  questionSkipped: "\u041F\u0440\u043E\u043F\u0443\u0449\u0435\u043D\u043E",
719
748
  taskUnknown: "\u041D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u044B\u0439 \u0441\u0442\u0430\u0442\u0443\u0441",
@@ -738,6 +767,7 @@ var ru_default = {
738
767
  loginWaiting: "\u0410\u0432\u0442\u043E\u0440\u0438\u0437\u0430\u0446\u0438\u044F \u0435\u0449\u0451 \u043D\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043D\u0430. \u0417\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u0435 \u0435\u0451 \u0432 Cheso \u0438 \u043F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 \u0432\u0445\u043E\u0434 \u0441\u043D\u043E\u0432\u0430.",
739
768
  loginNotStarted: "\u0412\u0445\u043E\u0434 \u043D\u0435 \u043D\u0430\u0447\u0430\u0442 \u0438\u043B\u0438 \u043E\u0442\u043C\u0435\u043D\u0451\u043D. \u041F\u043E\u043B\u0443\u0447\u0438\u0442\u0435 \u043D\u043E\u0432\u0443\u044E \u0441\u0441\u044B\u043B\u043A\u0443 \u0434\u043B\u044F \u0430\u0432\u0442\u043E\u0440\u0438\u0437\u0430\u0446\u0438\u0438.",
740
769
  loginFailed: "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0432\u043E\u0439\u0442\u0438 \u0432 Cheso. \u041F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u0435 \u043F\u043E\u043F\u044B\u0442\u043A\u0443.",
770
+ fixedTokenRejected: "Cheso \u043E\u0442\u043A\u043B\u043E\u043D\u0438\u043B \u043D\u0430\u0441\u0442\u0440\u043E\u0435\u043D\u043D\u044B\u0439 API-\u0442\u043E\u043A\u0435\u043D. \u041E\u0431\u043D\u043E\u0432\u0438\u0442\u0435 \u0438\u043B\u0438 \u0443\u0434\u0430\u043B\u0438\u0442\u0435 \u0435\u0433\u043E \u0432 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0430\u0445 \u0438\u043B\u0438 \u0441\u0440\u0435\u0434\u0435 \u0437\u0430\u043F\u0443\u0441\u043A\u0430 DSH, \u0437\u0430\u0442\u0435\u043C \u043F\u0435\u0440\u0435\u0437\u0430\u043F\u0443\u0441\u0442\u0438\u0442\u0435 DSH.",
741
771
  loginInvalidLink: "Cheso \u043D\u0435 \u0432\u0435\u0440\u043D\u0443\u043B \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043B\u044C\u043D\u0443\u044E \u0441\u0441\u044B\u043B\u043A\u0443 \u0434\u043B\u044F \u0430\u0432\u0442\u043E\u0440\u0438\u0437\u0430\u0446\u0438\u0438.",
742
772
  loginUnknownSite: "\u042D\u0442\u043E\u0442 \u0441\u0430\u0439\u0442 Cheso \u0431\u043E\u043B\u044C\u0448\u0435 \u043D\u0435 \u043D\u0430\u0441\u0442\u0440\u043E\u0435\u043D. \u041F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u0441\u0430\u0439\u0442\u0430 \u0438 \u043F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u0435 \u043F\u043E\u043F\u044B\u0442\u043A\u0443.",
743
773
  previewTitle: "\u041F\u0440\u0435\u0434\u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440 Cheso",
@@ -796,11 +826,13 @@ var zh_default = {
796
826
  toolFailed: "Cheso \u8C03\u7528\u5931\u8D25",
797
827
  taskCompleted: "\u5DF2\u5B8C\u6210 \xB7 {count} \u4E2A\u6587\u4EF6",
798
828
  taskRunning: "\u4ECD\u5728\u751F\u6210\uFF0C\u7A0D\u540E\u7EE7\u7EED\u7B49\u5F85",
829
+ taskQueued: "\u5DF2\u6392\u961F",
799
830
  lowCredits: "\u79EF\u5206\u4E0D\u8DB3",
800
831
  taskFailed: "\u4EFB\u52A1\u5931\u8D25",
801
832
  taskStopped: "\u5DF2\u7EC8\u6B62",
802
833
  taskRolledBack: "\u5DF2\u56DE\u9000",
803
834
  taskNeedsReply: "\u7B49\u5F85\u56DE\u590D",
835
+ questionRound: "\u7B2C {number} \u8F6E\u95EE\u7B54",
804
836
  questionAnswered: "\u5DF2\u56DE\u7B54",
805
837
  questionSkipped: "\u5DF2\u8DF3\u8FC7",
806
838
  taskUnknown: "\u72B6\u6001\u672A\u77E5",
@@ -825,6 +857,7 @@ var zh_default = {
825
857
  loginWaiting: "\u8FD8\u6CA1\u6536\u5230\u6388\u6743\u3002\u8BF7\u5148\u5728 Cheso \u9875\u9762\u5B8C\u6210\u64CD\u4F5C\uFF0C\u518D\u56DE\u6765\u68C0\u67E5\u3002",
826
858
  loginNotStarted: "\u767B\u5F55\u5C1A\u672A\u53D1\u8D77\u6216\u5DF2\u53D6\u6D88\u3002\u8BF7\u91CD\u65B0\u83B7\u53D6\u6388\u6743\u94FE\u63A5\u3002",
827
859
  loginFailed: "Cheso \u767B\u5F55\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u3002",
860
+ fixedTokenRejected: "Cheso \u62D2\u7EDD\u4E86\u914D\u7F6E\u7684 API token\u3002\u8BF7\u5728 DSH \u914D\u7F6E\u6216\u542F\u52A8\u73AF\u5883\u4E2D\u66F4\u65B0\u6216\u79FB\u9664\u5B83\uFF0C\u7136\u540E\u91CD\u542F DSH\u3002",
828
861
  loginInvalidLink: "Cheso \u672A\u8FD4\u56DE\u6709\u6548\u7684\u6388\u6743\u94FE\u63A5\u3002",
829
862
  loginUnknownSite: "\u8BE5\u7AD9\u70B9\u5DF2\u4E0D\u5728\u63D2\u4EF6\u914D\u7F6E\u4E2D\u3002\u8BF7\u68C0\u67E5\u7AD9\u70B9\u8BBE\u7F6E\u5E76\u91CD\u65B0\u53D1\u8D77\u8BF7\u6C42\u3002",
830
863
  previewTitle: "Cheso \u9884\u89C8",
@@ -914,6 +947,8 @@ function loginErrorKey(code) {
914
947
  return "loginIncomplete";
915
948
  case "unknown_cheso_site":
916
949
  return "loginUnknownSite";
950
+ case "fixed_token_rejected":
951
+ return "fixedTokenRejected";
917
952
  default:
918
953
  return "loginFailed";
919
954
  }
@@ -1006,11 +1041,6 @@ function QuestionPreviews({ previews }) {
1006
1041
  // src/client/site-settings.tsx
1007
1042
  var import_react3 = require("react");
1008
1043
 
1009
- // src/sites.ts
1010
- var CHESO_SITES = {
1011
- global: "https://cheso.ai"
1012
- };
1013
-
1014
1044
  // src/client/account.tsx
1015
1045
  var import_react2 = require("react");
1016
1046
  var import_jsx_runtime3 = require("react/jsx-runtime");
@@ -1067,8 +1097,9 @@ function ChesoAccountStatus({ t, disabled, showSite }) {
1067
1097
  setError("loginInvalidLink");
1068
1098
  } catch (reason) {
1069
1099
  if (signal?.aborted || id !== generation.current) return;
1070
- moveTo("signed_out");
1071
- setError(reason instanceof LoginRequestError ? loginErrorKey(reason.code) : "loginFailed");
1100
+ const key = reason instanceof LoginRequestError ? loginErrorKey(reason.code) : "loginFailed";
1101
+ moveTo(key === "fixedTokenRejected" ? "unavailable" : "signed_out");
1102
+ setError(key);
1072
1103
  } finally {
1073
1104
  if (!signal?.aborted && id === generation.current) setStarting(false);
1074
1105
  }
@@ -1158,6 +1189,12 @@ function ChesoAccountStatus({ t, disabled, showSite }) {
1158
1189
  if (controller.signal.aborted) return;
1159
1190
  if (reason instanceof LoginRequestError) {
1160
1191
  const key = loginErrorKey(reason.code);
1192
+ if (key === "fixedTokenRejected") {
1193
+ setChallenge(void 0);
1194
+ setError(key);
1195
+ moveTo("unavailable");
1196
+ return;
1197
+ }
1161
1198
  if (isEndedLoginAttempt(key) || key === "loginUnknownSite") {
1162
1199
  setExpiredAt(deadline || Date.now());
1163
1200
  setNotice(key);
@@ -1191,7 +1228,7 @@ function ChesoAccountStatus({ t, disabled, showSite }) {
1191
1228
  ] }) : null
1192
1229
  ] })
1193
1230
  ] }),
1194
- phase === "signed_out" || phase === "unavailable" || phase === "pending" && !href ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1231
+ error !== "fixedTokenRejected" && (phase === "signed_out" || phase === "unavailable" || phase === "pending" && !href) ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1195
1232
  "button",
1196
1233
  {
1197
1234
  type: "button",
@@ -1382,7 +1419,10 @@ var RESOURCE_PREFIX = "dsh-resource://cheso-file/";
1382
1419
  var PREVIEW_STORAGE_PREFIX = "dsh-cheso-design.preview.v1:";
1383
1420
  var CARD_MARKER = "[cheso-card]";
1384
1421
  var ARTIFACTS_TURN_KEY = "dsh-cheso-design-artifacts";
1385
- var CARD_TOOLS = ["cheso_create", "cheso_wait", "cheso_project_files", "cheso_login"];
1422
+ var WAIT_PROGRESS_DOCK = "dsh-cheso-design-progress";
1423
+ var QUESTION_TIMELINE_KIND = "dsh-cheso-design-questions";
1424
+ var QUESTION_TRAJECTORY_KIND = "dsh-cheso-design-question-trajectory";
1425
+ var CARD_TOOLS = ["cheso_create", "cheso_wait", "cheso_stop", "cheso_project_files", "cheso_login"];
1386
1426
  var ACTIVE_TASK_STATUSES = /* @__PURE__ */ new Set(["running", "in_progress", "pending", "queued"]);
1387
1427
  var CARD_INLINE_PADDING = 14;
1388
1428
  var ARTIFACT_ROW_HEIGHT = 38;
@@ -1481,6 +1521,14 @@ var styles3 = {
1481
1521
  link: { color: "inherit", textDecoration: "underline", fontSize: 12, opacity: 0.8 },
1482
1522
  message: { whiteSpace: "pre-wrap", wordBreak: "break-word" },
1483
1523
  error: { color: "#dc2626", whiteSpace: "pre-wrap", wordBreak: "break-word" },
1524
+ progressDock: {
1525
+ display: "grid",
1526
+ gap: 6,
1527
+ width: "min(calc(100% - 2 * var(--dsh-composer-side-clearance, 16px)), var(--dsh-composer-card-max-width, 952px))",
1528
+ marginInline: "auto",
1529
+ maxHeight: "min(40vh, 336px)",
1530
+ overflowY: "auto"
1531
+ },
1484
1532
  preview: { display: "flex", flexDirection: "column", height: "100%", minHeight: 0 },
1485
1533
  previewHeader: {
1486
1534
  display: "flex",
@@ -1510,13 +1558,16 @@ function projectCardRequested(argsRaw) {
1510
1558
  return false;
1511
1559
  }
1512
1560
  }
1513
- var noChat = (select) => select({ timeline: { turns: /* @__PURE__ */ new Map() } });
1514
- function waitTaskId(argsRaw) {
1561
+ var noChat = (select) => select({ timeline: { turns: /* @__PURE__ */ new Map() }, legacy: { runningCalls: [] } });
1562
+ function waitTaskReference(argsRaw) {
1515
1563
  try {
1516
- const taskId = JSON.parse(argsRaw ?? "{}")?.task_id;
1517
- return typeof taskId === "string" ? taskId : void 0;
1564
+ const args = JSON.parse(argsRaw ?? "{}");
1565
+ return {
1566
+ taskId: typeof args?.task_id === "string" ? args.task_id : void 0,
1567
+ site: typeof args?.task_site === "string" ? args.task_site : void 0
1568
+ };
1518
1569
  } catch {
1519
- return void 0;
1570
+ return {};
1520
1571
  }
1521
1572
  }
1522
1573
  function QuestionReceipts({ receipts, t }) {
@@ -1531,24 +1582,44 @@ function QuestionReceipts({ receipts, t }) {
1531
1582
  ] }, answerIndex)) })
1532
1583
  ] }, index)) ?? null;
1533
1584
  }
1534
- function WaitProgress({ block, callId, useChat, t }) {
1535
- const { previews, receipts } = useQuestionActivity(callId);
1536
- const taskId = waitTaskId(block?.argsRaw);
1537
- const turn = block?.turn;
1538
- const projectUrl = useChat((snapshot) => turn !== void 0 && taskId ? snapshot.timeline.turns.get(turn)?.data.get(ARTIFACTS_TURN_KEY)?.cards.get(taskId)?.payload.project_url : void 0);
1539
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
1540
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(QuestionReceipts, { receipts, t }),
1541
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: styles3.card, "data-tool": "cheso", children: [
1542
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: styles3.head, children: [
1543
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: styles3.dot }),
1544
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: styles3.title, children: t("task") }),
1545
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: styles3.status, children: t(previews ? "taskNeedsReply" : "generating") })
1546
- ] }),
1547
- previews ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(QuestionPreviews, { previews }) : null,
1548
- projectUrl ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("a", { href: projectUrl, target: "_blank", rel: "noreferrer", style: styles3.link, children: t("openInCheso") }) : null
1549
- ] })
1585
+ function WaitProgress({ call, useChat, t }) {
1586
+ const { taskId, site } = waitTaskReference(call.argsRaw);
1587
+ const turn = call.turn;
1588
+ const projectUrl = useChat((snapshot) => {
1589
+ if (turn === void 0 || !taskId) return;
1590
+ const cards = snapshot.timeline.turns.get(turn)?.data.get(ARTIFACTS_TURN_KEY)?.cards;
1591
+ const links = /* @__PURE__ */ new Set();
1592
+ for (const { payload } of cards?.values() ?? []) {
1593
+ if (payload.task_id === taskId && payload.project_url && (!site || cardTaskSite(payload) === site)) {
1594
+ links.add(payload.project_url);
1595
+ }
1596
+ }
1597
+ if (links.size === 1) return links.values().next().value;
1598
+ });
1599
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { ...styles3.card, background: "var(--dsw-specific-menu, Canvas)", margin: 0 }, "data-tool": "cheso", children: [
1600
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: styles3.head, children: [
1601
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { "aria-hidden": "true", style: styles3.dot }),
1602
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: styles3.title, children: t("task") }),
1603
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { role: "status", style: styles3.status, children: t("generating") })
1604
+ ] }),
1605
+ projectUrl ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("a", { href: projectUrl, target: "_blank", rel: "noreferrer", style: styles3.link, children: t("openInCheso") }) : null
1550
1606
  ] });
1551
1607
  }
1608
+ function runningWaits(calls) {
1609
+ const waits = [];
1610
+ for (const call of calls) {
1611
+ if (call.phase !== "start") continue;
1612
+ if (call.name === "cheso_wait") waits.push(call);
1613
+ waits.push(...runningWaits(call.subCalls));
1614
+ }
1615
+ return waits;
1616
+ }
1617
+ function WaitProgressDock({ useChat, t }) {
1618
+ const calls = useChat((snapshot) => snapshot.legacy.runningCalls);
1619
+ const waits = runningWaits(calls);
1620
+ if (!waits.length) return null;
1621
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: styles3.progressDock, "data-cheso-progress": "", children: waits.map((call) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(WaitProgress, { call, useChat, t }, call.callId)) });
1622
+ }
1552
1623
  function ToolResultArtifact({ payload, callId, openFile, openPreview, useChat, t }) {
1553
1624
  const visible = useChat((snapshot) => {
1554
1625
  for (const turn of snapshot.timeline.turns.values()) {
@@ -1562,24 +1633,12 @@ function ToolResultArtifact({ payload, callId, openFile, openPreview, useChat, t
1562
1633
  return visible ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ArtifactCard, { payload, openFile, openPreview, t }) : null;
1563
1634
  }
1564
1635
  function ToolCard(props) {
1565
- const { phase, block, callId, toolName, t, useChat = noChat } = props;
1566
- const receipts = toolName === "cheso_wait" && phase === "result" ? questionReceiptsOf(block?.meta) : void 0;
1567
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
1568
- receipts ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SettledQuestionReceipts, { receipts, callId, useChat, t }) : null,
1569
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ToolCardContent, { ...props })
1570
- ] });
1571
- }
1572
- function SettledQuestionReceipts({ receipts, callId, useChat, t }) {
1573
- const shownInTurnTail = useChat((snapshot) => Array.from(snapshot.timeline.turns.values()).some((turn) => turn.status === "closed" && turn.data.get(ARTIFACTS_TURN_KEY)?.receipts.has(callId)));
1574
- return shownInTurnTail ? null : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(QuestionReceipts, { receipts, t });
1575
- }
1576
- function ToolCardContent(props) {
1577
1636
  const { phase, block, toolName, openFile, openPreview } = props;
1578
1637
  const t = props.t;
1579
1638
  const projectQuery = toolName === "cheso_project_files";
1639
+ const stopTool = toolName === "cheso_stop";
1580
1640
  if (phase !== "result") {
1581
- if (projectQuery || toolName === "cheso_create") return null;
1582
- if (toolName === "cheso_wait") return phase === "start" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(WaitProgress, { block, callId: props.callId, useChat: props.useChat ?? noChat, t }, props.callId) : null;
1641
+ if (projectQuery || stopTool || toolName === "cheso_create" || toolName === "cheso_wait") return null;
1583
1642
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: styles3.card, "data-tool": "cheso", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: styles3.head, children: [
1584
1643
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: styles3.dot }),
1585
1644
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: styles3.title, children: "Cheso" }),
@@ -1598,8 +1657,9 @@ function ToolCardContent(props) {
1598
1657
  ] });
1599
1658
  }
1600
1659
  const payload = parseCard(block);
1660
+ if (stopTool && payload && payload.status !== "terminated" && !isLoginCard(payload)) return null;
1601
1661
  if (!payload) {
1602
- if (projectQuery) return null;
1662
+ if (projectQuery || stopTool) return null;
1603
1663
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: styles3.card, "data-tool": "cheso", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: styles3.head, children: [
1604
1664
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: styles3.dot }),
1605
1665
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: styles3.title, children: "Cheso" })
@@ -1608,7 +1668,7 @@ function ToolCardContent(props) {
1608
1668
  if (payload.task_id && payload.status && ACTIVE_TASK_STATUSES.has(payload.status) && !payload.artifacts?.length) {
1609
1669
  return null;
1610
1670
  }
1611
- if (!isLoginCard(payload) && (payload.artifacts?.length || isProjectListing(payload))) {
1671
+ if (!isLoginCard(payload) && isTurnTailCard(payload)) {
1612
1672
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1613
1673
  ToolResultArtifact,
1614
1674
  {
@@ -1633,7 +1693,8 @@ function LoginCard({ payload, t }) {
1633
1693
  const login = challenge ?? payload;
1634
1694
  const site = login.base_url && URL.canParse(login.base_url) ? new URL(login.base_url).host : void 0;
1635
1695
  const expiresAt = login.expires_at ?? 0;
1636
- const href = expiresAt > Math.max(expiredAt, Date.now()) ? authorizationUrl(login) : void 0;
1696
+ const tokenRejected = error === "fixedTokenRejected";
1697
+ const href = !tokenRejected && expiresAt > Math.max(expiredAt, Date.now()) ? authorizationUrl(login) : void 0;
1637
1698
  (0, import_react4.useEffect)(() => {
1638
1699
  if (!href) return;
1639
1700
  const expiry = setTimeout(() => setExpiredAt(expiresAt), Math.max(0, expiresAt - Date.now()));
@@ -1655,6 +1716,9 @@ function LoginCard({ payload, t }) {
1655
1716
  case "unknown_cheso_site":
1656
1717
  setError("loginUnknownSite");
1657
1718
  break;
1719
+ case "fixed_token_rejected":
1720
+ setError("fixedTokenRejected");
1721
+ break;
1658
1722
  case "login_expired":
1659
1723
  setExpiredAt(expiresAt);
1660
1724
  break;
@@ -1699,10 +1763,10 @@ function LoginCard({ payload, t }) {
1699
1763
  " ",
1700
1764
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("code", { children: login.user_code })
1701
1765
  ] }) : null,
1702
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: 8, marginTop: 8 }, children: href ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
1766
+ !tokenRejected ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: 8, marginTop: 8 }, children: href ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
1703
1767
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("a", { href, target: "_blank", rel: "noopener noreferrer", style: { ...styles3.button, textDecoration: "none" }, children: t("loginAuthorize") }),
1704
1768
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", style: styles3.button, disabled: !!busy, onClick: () => void act("check"), children: t(busy === "check" ? "loginChecking" : "loginCheck") })
1705
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", style: styles3.button, disabled: !!busy, onClick: () => void act("start"), children: t(busy === "start" ? "loginGettingLink" : expiresAt ? "loginGetNewLink" : "loginGetLink") }) }),
1769
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", style: styles3.button, disabled: !!busy, onClick: () => void act("start"), children: t(busy === "start" ? "loginGettingLink" : expiresAt ? "loginGetNewLink" : "loginGetLink") }) }) : null,
1706
1770
  notice ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { role: "status", style: { marginTop: 6 }, children: t(notice) }) : null,
1707
1771
  error ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { role: "alert", style: { ...styles3.error, marginTop: 6 }, children: t(error) }) : null
1708
1772
  ] })
@@ -1719,7 +1783,7 @@ function ArtifactCard({ payload, openFile, openPreview, t }) {
1719
1783
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: styles3.title, children: payload.project_url ? t("artifacts") : payload.task_id ? t("taskId", { id: payload.task_id }) : t("task") }),
1720
1784
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: styles3.status, children: statusLabel(t, status, artifacts.length) })
1721
1785
  ] }),
1722
- payload.message && status !== "insufficient_credits" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: status === "interact" ? styles3.message : styles3.error, children: payload.message }) : null,
1786
+ payload.message && status !== "insufficient_credits" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: status === "interact" || status === "queued" ? styles3.message : styles3.error, children: payload.message }) : null,
1723
1787
  artifacts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1724
1788
  "div",
1725
1789
  {
@@ -1744,6 +1808,7 @@ function ArtifactCard({ payload, openFile, openPreview, t }) {
1744
1808
  ] });
1745
1809
  }
1746
1810
  function statusLabel(t, status, count) {
1811
+ if (status === "queued") return t("taskQueued");
1747
1812
  if (ACTIVE_TASK_STATUSES.has(status)) return t("taskRunning");
1748
1813
  switch (status) {
1749
1814
  case "completed":
@@ -1793,19 +1858,127 @@ function questionReceiptsOf(meta) {
1793
1858
  const receipts = meta.cheso_question_receipts;
1794
1859
  if (Array.isArray(receipts) && receipts.length && receipts.every(
1795
1860
  (receipt) => Array.isArray(receipt?.answers) && receipt.answers.every(
1796
- (answer) => typeof answer?.label === "string" && Array.isArray(answer.values) && answer.values.every((value) => typeof value === "string")
1861
+ (answer) => typeof answer?.label === "string" && Array.isArray(answer.values) && (answer.question === void 0 || typeof answer.question === "string") && answer.values.every((value) => typeof value === "string")
1797
1862
  )
1798
1863
  )) return receipts;
1799
1864
  }
1865
+ function settledQuestion(event) {
1866
+ return {
1867
+ active: false,
1868
+ receipts: event?.type === "tool/result" || event?.type === "tool/ptc-dispatch" ? questionReceiptsOf(event.data.meta) : void 0
1869
+ };
1870
+ }
1871
+ var questionTimelineDefinition = {
1872
+ kind: QUESTION_TIMELINE_KIND,
1873
+ target: "chat",
1874
+ match(event) {
1875
+ if (event.type === "tool/call" && event.data.name === "cheso_wait") {
1876
+ return { id: event.data.callId, role: "start" };
1877
+ }
1878
+ if (event.type === "tool/result" && event.surfaceOp === "append") {
1879
+ return { id: event.data.message.source.callId, role: "update" };
1880
+ }
1881
+ if ((event.type === "tool/ptc-dispatch-start" || event.type === "tool/ptc-dispatch") && event.data.name === "cheso_wait") {
1882
+ return { id: event.data.subCallId, role: event.type === "tool/ptc-dispatch-start" ? "start" : "update" };
1883
+ }
1884
+ return null;
1885
+ },
1886
+ start() {
1887
+ return { active: true };
1888
+ },
1889
+ update(_context, { event }) {
1890
+ return settledQuestion(event);
1891
+ },
1892
+ buildViewNode({ key, id, start, matches, state, current }) {
1893
+ const anchor = start ?? matches[0];
1894
+ if (!anchor) return null;
1895
+ const { event, location } = anchor;
1896
+ const { active, receipts } = state ?? settledQuestion(event);
1897
+ const running = active && !(location.kind === "step" && location.step.status === "closed") && !((location.kind === "step" || location.kind === "turn") && location.turn.status === "closed");
1898
+ if (!running && !receipts) {
1899
+ const previous = current.get("chat");
1900
+ return previous ? { ...previous, visibility: "hidden" } : null;
1901
+ }
1902
+ return {
1903
+ key,
1904
+ id,
1905
+ target: "chat",
1906
+ kind: QUESTION_TIMELINE_KIND,
1907
+ location,
1908
+ anchorSeq: event.seq + 0.1,
1909
+ groupTree: "turn",
1910
+ visibility: "visible",
1911
+ data: { active: running, receipts }
1912
+ };
1913
+ }
1914
+ };
1915
+ function questionTrajectoryDefinition(t) {
1916
+ return {
1917
+ kind: QUESTION_TRAJECTORY_KIND,
1918
+ target: "trajectory",
1919
+ match(event) {
1920
+ if (event.type !== "tool/result" && event.type !== "tool/ptc-dispatch") return null;
1921
+ if (event.type === "tool/result" ? event.surfaceOp !== "append" : event.data.name !== "cheso_wait") return null;
1922
+ return questionReceiptsOf(event.data.meta) ? { id: String(event.seq), role: "start" } : null;
1923
+ },
1924
+ start(_context, { event }) {
1925
+ return settledQuestion(event).receipts;
1926
+ },
1927
+ update({ state }) {
1928
+ return state;
1929
+ },
1930
+ buildViewNode({ key, id, start, state }) {
1931
+ if (!start || !state?.length || !("time" in start.event)) return null;
1932
+ const { seq, time } = start.event;
1933
+ const text = state.map(({ answers }, index) => [
1934
+ `Cheso \xB7 ${t("questionRound", { number: index + 1 })}`,
1935
+ ...answers.map(({ label, question, values }) => `${question ?? label}: ${values.length ? values.join(", ") : t("questionSkipped")}`)
1936
+ ].join("\n")).join("\n\n");
1937
+ return {
1938
+ key,
1939
+ id,
1940
+ kind: QUESTION_TRAJECTORY_KIND,
1941
+ target: "trajectory",
1942
+ location: start.location,
1943
+ anchorSeq: seq,
1944
+ data: { kind: "node", node: {
1945
+ kind: "context",
1946
+ seq,
1947
+ time,
1948
+ content: [{ type: "text", text }],
1949
+ source: { kind: "plugin", plugin: "dsh-cheso-design" },
1950
+ producer: { role: "inject", label: "Cheso" },
1951
+ form: null
1952
+ } }
1953
+ };
1954
+ }
1955
+ };
1956
+ }
1957
+ function WaitQuestions({ node, t }) {
1958
+ const { active, receipts } = node.data;
1959
+ const activity = useQuestionActivity(active ? node.id : void 0);
1960
+ const previews = active ? activity.previews : null;
1961
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
1962
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(QuestionReceipts, { receipts: active ? activity.receipts : receipts, t }),
1963
+ previews?.length ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: styles3.card, "data-cheso-question-previews": "", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(QuestionPreviews, { previews }) }) : null
1964
+ ] });
1965
+ }
1800
1966
  function isProjectListing(payload) {
1801
1967
  return payload.status === "completed" && !!payload.project_id && !payload.task_id;
1802
1968
  }
1969
+ function isTurnTailCard(payload) {
1970
+ return payload.status === "terminated" || !!payload.artifacts?.length || isProjectListing(payload);
1971
+ }
1972
+ function cardTaskSite(payload) {
1973
+ return payload.base_url || projectSite(payload.project_url);
1974
+ }
1803
1975
  function artifactCardKey(payload, callId) {
1804
1976
  if (payload.status === "completed" && payload.project_url) {
1805
1977
  const files = [...new Set(payload.artifacts?.map((file) => file.file_id ?? file.name))].sort();
1806
1978
  return JSON.stringify([payload.project_url, files]);
1807
1979
  }
1808
- return payload.task_id ?? payload.project_id ?? callId;
1980
+ if (payload.task_id) return JSON.stringify([cardTaskSite(payload), payload.task_id]);
1981
+ return payload.project_id ?? callId;
1809
1982
  }
1810
1983
  var artifactTurnDefinition = {
1811
1984
  kind: ARTIFACTS_TURN_KEY,
@@ -1814,20 +1987,19 @@ var artifactTurnDefinition = {
1814
1987
  if (event.type === "tool/call" && CARD_TOOLS.includes(event.data.name)) {
1815
1988
  return { id: String(event.data.turn), role: "start" };
1816
1989
  }
1817
- if (event.type === "tool/result" && event.surfaceOp === "append" && (parseCard(event.data.message) || questionReceiptsOf(event.data.meta))) {
1990
+ if (event.type === "tool/result" && event.surfaceOp === "append" && parseCard(event.data.message)) {
1818
1991
  return { id: String(event.data.turn), role: "start" };
1819
1992
  }
1820
1993
  return null;
1821
1994
  },
1822
- /** 初始化回合内的工具调用、卡片与答复记录。 */
1995
+ /** 初始化回合内的工具调用和卡片。 */
1823
1996
  start(_context, { event }) {
1824
1997
  return {
1825
1998
  callIds: new Set(event.type === "tool/call" ? [event.data.callId] : []),
1826
- cards: /* @__PURE__ */ new Map(),
1827
- receipts: /* @__PURE__ */ new Map()
1999
+ cards: /* @__PURE__ */ new Map()
1828
2000
  };
1829
2001
  },
1830
- /** 将工具事件归入当前回合,合并答复记录并对登录卡和产物卡去重。 */
2002
+ /** 将工具事件归入当前回合,并对登录卡和产物卡去重。 */
1831
2003
  update({ state }, { event }) {
1832
2004
  if (event.type === "tool/call") {
1833
2005
  return { ...state, callIds: /* @__PURE__ */ new Set([...state.callIds, event.data.callId]) };
@@ -1835,8 +2007,6 @@ var artifactTurnDefinition = {
1835
2007
  if (event.type !== "tool/result") return state;
1836
2008
  const { message } = event.data;
1837
2009
  if (!state.callIds.has(message.source.callId)) return state;
1838
- const receipts = questionReceiptsOf(event.data.meta);
1839
- if (receipts) state = { ...state, receipts: new Map(state.receipts).set(message.source.callId, receipts) };
1840
2010
  if (message.isError) return state;
1841
2011
  const payload = parseCard(message);
1842
2012
  if (!payload) return state;
@@ -1848,14 +2018,13 @@ var artifactTurnDefinition = {
1848
2018
  return { ...state, cards: new Map(state.cards).set(loginKey, card) };
1849
2019
  }
1850
2020
  const isActiveTask = payload.task_id && payload.status && ACTIVE_TASK_STATUSES.has(payload.status);
1851
- if (!payload.artifacts?.length && !isProjectListing(payload) && !(isActiveTask && payload.project_url)) return state;
2021
+ if (!isTurnTailCard(payload) && !(isActiveTask && payload.project_url)) return state;
1852
2022
  const key = artifactCardKey(payload, callId);
1853
- if (payload.status === "completed" && state.cards.get(key)?.payload.status === "completed") return state;
1854
2023
  return { ...state, cards: new Map(state.cards).set(key, card) };
1855
2024
  },
1856
2025
  /** 将非空状态发布到回合位置,并复用未变化的视图数据。 */
1857
2026
  buildLocationData({ id, state }, scope, previous) {
1858
- if (scope !== "turn" || !state || !state.cards.size && !state.receipts.size) return null;
2027
+ if (scope !== "turn" || !state?.cards.size) return null;
1859
2028
  if (previous?.value === state) return previous;
1860
2029
  return { kind: "turn", turn: Number(id), key: ARTIFACTS_TURN_KEY, value: state };
1861
2030
  }
@@ -1863,14 +2032,10 @@ var artifactTurnDefinition = {
1863
2032
  function TurnArtifacts({ turn, openFile, openPreview, t }) {
1864
2033
  const state = turn.data.get(ARTIFACTS_TURN_KEY);
1865
2034
  if (!state) return null;
1866
- const cards = Array.from(state.cards, ([key, { payload }]) => {
2035
+ return Array.from(state.cards, ([key, { payload }]) => {
1867
2036
  if (payload.task_id && payload.status && ACTIVE_TASK_STATUSES.has(payload.status) && !payload.artifacts?.length) return null;
1868
2037
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ArtifactCard, { payload, openFile, openPreview, t }, key);
1869
2038
  });
1870
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
1871
- turn.status === "closed" ? Array.from(state.receipts, ([key, receipts]) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(QuestionReceipts, { receipts, t }, key)) : null,
1872
- cards
1873
- ] });
1874
2039
  }
1875
2040
  function savedPreview(address) {
1876
2041
  try {
@@ -1907,6 +2072,7 @@ async function requestContent({ file_id, project_url, embed_base_url }, signal,
1907
2072
  if (!response.ok) {
1908
2073
  const result = await response.json().catch(() => null);
1909
2074
  if (result?.error === "cheso_login_required") throw new PreviewError("previewLoginRequired");
2075
+ if (result?.error === "fixed_token_rejected") throw new PreviewError("fixedTokenRejected");
1910
2076
  if (result?.error === "cheso_file_forbidden") throw new PreviewError("previewForbidden");
1911
2077
  if (result?.error === "unknown_cheso_site") throw new PreviewError("previewUnknownSite");
1912
2078
  if (response.status === 401) throw new PreviewError("previewSessionExpired");
@@ -2148,6 +2314,16 @@ function apply(ctx) {
2148
2314
  () => ctx.slots.register({ name: "tool.call.toolview", key: tool, locale: localeNamespace }, (props) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ToolCard, { ...props, toolName: tool, openPreview }))
2149
2315
  );
2150
2316
  }
2317
+ ctx.slots.inject(
2318
+ "conversation.input.dock",
2319
+ () => ctx.slots.register({ name: "conversation.input.dock", id: WAIT_PROGRESS_DOCK, locale: localeNamespace }, WaitProgressDock)
2320
+ );
2321
+ ctx.uiConversation.events.register(questionTimelineDefinition);
2322
+ ctx.uiConversation.events.register(questionTrajectoryDefinition(t));
2323
+ ctx.slots.inject(
2324
+ "conversation.chat.node",
2325
+ () => ctx.slots.register({ name: "conversation.chat.node", key: QUESTION_TIMELINE_KIND, locale: localeNamespace }, WaitQuestions)
2326
+ );
2151
2327
  ctx.uiConversation.events.register(artifactTurnDefinition);
2152
2328
  ctx.slots.inject(
2153
2329
  "conversation.chat.turnTail",