@alexsun-top/opencode-chat-room 0.8.1 → 0.8.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.
Files changed (125) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +18 -62
  3. package/README.zh-CN.md +25 -69
  4. package/dist/cli.js +1008 -274
  5. package/package.json +10 -7
  6. package/packages/chat-room-channeld/README.md +42 -15
  7. package/packages/chat-room-channeld/dist/mock-adapter.js +5 -5
  8. package/packages/chat-room-channeld/src/adapter.ts +150 -7
  9. package/packages/chat-room-channeld/src/cli.ts +72 -5
  10. package/packages/chat-room-channeld/src/host.ts +41 -11
  11. package/packages/chat-room-channeld/src/inbound.ts +13 -4
  12. package/packages/chat-room-channeld/src/pg/database.ts +187 -0
  13. package/packages/chat-room-channeld/src/pg/migrate.ts +150 -0
  14. package/packages/chat-room-channeld/src/pg/schema.ts +60 -0
  15. package/packages/chat-room-channeld/src/pg/sql.mjs +175 -0
  16. package/packages/chat-room-channeld/src/pg/sqlite.ts +100 -0
  17. package/packages/chat-room-channeld/src/pg/worker.mjs +133 -0
  18. package/packages/chat-room-channeld/src/protocol.ts +53 -1
  19. package/packages/chat-room-channeld/src/rules.ts +7 -2
  20. package/packages/chat-room-channeld/src/state.ts +73 -97
  21. package/packages/chat-room-channeld/src/stats.ts +140 -109
  22. package/plugin.ts +1 -1
  23. package/server/assets/base.css +11 -3
  24. package/server/assets/chat/admin-badge.js +32 -30
  25. package/server/assets/chat/admin.js +198 -163
  26. package/server/assets/chat/announcements.js +295 -210
  27. package/server/assets/chat/attachment-store.js +106 -75
  28. package/server/assets/chat/attachments.js +686 -441
  29. package/server/assets/chat/chat-background.js +206 -0
  30. package/server/assets/chat/clipboard.js +44 -25
  31. package/server/assets/chat/confirm-dialog.js +36 -34
  32. package/server/assets/chat/copy-action.js +40 -40
  33. package/server/assets/chat/create-room-dialog.js +50 -48
  34. package/server/assets/chat/diagram-viewer.js +293 -228
  35. package/server/assets/chat/doc-preview.js +510 -388
  36. package/server/assets/chat/editor.js +423 -335
  37. package/server/assets/chat/events.js +637 -502
  38. package/server/assets/chat/files.js +476 -426
  39. package/server/assets/chat/history-loader.js +79 -73
  40. package/server/assets/chat/icons.js +9 -11
  41. package/server/assets/chat/image-zoom.js +239 -169
  42. package/server/assets/chat/index.js +6 -5
  43. package/server/assets/chat/install-prompt.js +86 -66
  44. package/server/assets/chat/integration-account-schema.js +101 -0
  45. package/server/assets/chat/integration-editor.js +162 -153
  46. package/server/assets/chat/integration-values.js +109 -100
  47. package/server/assets/chat/integrations.js +696 -479
  48. package/server/assets/chat/join-requests.js +408 -358
  49. package/server/assets/chat/locales/de.js +193 -194
  50. package/server/assets/chat/locales/es.js +193 -194
  51. package/server/assets/chat/locales/fr.js +193 -194
  52. package/server/assets/chat/locales/index.js +1 -2
  53. package/server/assets/chat/locales/it.js +193 -194
  54. package/server/assets/chat/locales/ja.js +193 -193
  55. package/server/assets/chat/locales/ko.js +193 -193
  56. package/server/assets/chat/markdown-footnotes.js +134 -102
  57. package/server/assets/chat/markdown.js +553 -386
  58. package/server/assets/chat/members.js +236 -197
  59. package/server/assets/chat/mentions.js +157 -133
  60. package/server/assets/chat/message-cache.js +40 -33
  61. package/server/assets/chat/message-polling.js +280 -227
  62. package/server/assets/chat/message-window.js +74 -55
  63. package/server/assets/chat/messages.js +552 -479
  64. package/server/assets/chat/office-preview.js +46 -45
  65. package/server/assets/chat/palette.js +450 -412
  66. package/server/assets/chat/panels.js +94 -58
  67. package/server/assets/chat/pwa.js +144 -73
  68. package/server/assets/chat/questions.js +372 -302
  69. package/server/assets/chat/recall.js +320 -273
  70. package/server/assets/chat/receipts.js +149 -122
  71. package/server/assets/chat/reminders.js +331 -216
  72. package/server/assets/chat/replies.js +165 -136
  73. package/server/assets/chat/resource-format.js +59 -62
  74. package/server/assets/chat/room-list.js +58 -55
  75. package/server/assets/chat/room-watcher.js +72 -50
  76. package/server/assets/chat/rooms.js +623 -505
  77. package/server/assets/chat/search.js +136 -114
  78. package/server/assets/chat/settings.js +229 -140
  79. package/server/assets/chat/shiki.js +61 -62
  80. package/server/assets/chat/shortcuts.js +212 -190
  81. package/server/assets/chat/side-pane.js +166 -131
  82. package/server/assets/chat/state.js +851 -707
  83. package/server/assets/chat/system-events.js +55 -27
  84. package/server/assets/chat/system-messages.js +59 -49
  85. package/server/assets/chat/task-form.js +178 -182
  86. package/server/assets/chat/task-row.js +158 -155
  87. package/server/assets/chat/tasks.js +653 -593
  88. package/server/assets/chat/viewport.js +32 -29
  89. package/server/assets/chat/window-controls.js +37 -0
  90. package/server/assets/code-highlight.css +22 -6
  91. package/server/assets/conversation.css +65 -16
  92. package/server/assets/doc-preview.css +6 -1
  93. package/server/assets/files.css +3 -0
  94. package/server/assets/monaco/integration-rules.css +1 -1
  95. package/server/assets/monaco/integration-rules.js +841 -533
  96. package/server/assets/responsive.css +32 -2
  97. package/server/assets/settings.css +117 -13
  98. package/server/assets/window-controls.css +36 -0
  99. package/server/channel-attachments.ts +133 -0
  100. package/server/channel-integration.ts +79 -26
  101. package/server/channels.ts +15 -5
  102. package/server/chat-server.ts +9 -1
  103. package/server/chat.html +73 -38
  104. package/server/manifest.webmanifest +1 -0
  105. package/server/routes/pages.ts +7 -5
  106. package/server/sw.js +346 -267
  107. package/src/center/center-client.ts +1 -1
  108. package/src/state/pg-database.ts +5 -5
  109. package/src/state/pg-migrate.ts +7 -7
  110. package/src/state/pg-worker.mjs +2 -17
  111. package/src/state/sqlite-database.ts +14 -5
  112. package/src/state/sqlite-rooms.ts +130 -23
  113. package/src/state/sqlite-state-store.ts +6 -5
  114. package/src/state/sqlite.ts +3 -3
  115. package/src/web/integration-rules-editor.ts +141 -5
  116. package/src/web/integration-rules.ts +6 -2
  117. package/src/web/integration-schema.ts +7 -6
  118. package/packages/chat-room-channeld/dist/feishu-adapter.js +0 -1262
  119. package/packages/chat-room-channeld/src/feishu-adapter.ts +0 -303
  120. package/packages/chat-room-channeld/src/feishu-card.ts +0 -27
  121. package/packages/chat-room-channeld/src/feishu-inbound.ts +0 -158
  122. package/packages/chat-room-channeld/src/feishu-live.ts +0 -355
  123. package/packages/chat-room-channeld/src/feishu-send.ts +0 -342
  124. package/packages/chat-room-channeld/src/feishu-ws-frames.ts +0 -173
  125. package/server/assets/chat/forward.js +0 -69
@@ -46,9 +46,16 @@
46
46
  The task board and every file preview follow the same rule. */
47
47
  @media (min-width: 1500px) and (min-height: 900px) {
48
48
  #app:has(#chatView.has-doc),
49
- #app:has(#chatView.has-pane) { max-width: 1600px; }
49
+ #app:has(#chatView.has-pane) { max-width: 2200px; }
50
50
  #chatView.has-doc,
51
- #chatView.has-pane { --side-pane-width: min(560px, calc(100% - 960px)); }
51
+ #chatView.has-pane { --side-pane-width: min(720px, calc(100% - 960px)); }
52
+ }
53
+ /* From 1700px the document preview spends the extra width on the page and keeps
54
+ the conversation at 660px; the task board keeps its 700px chat until 920px. */
55
+ @media (min-width: 1700px) and (min-height: 900px) {
56
+ #chatView.has-doc,
57
+ #chatView.has-pane { --side-pane-width: min(1080px, calc(100% - 920px)); }
58
+ #chatView.has-tasks:not(.has-doc) { --side-pane-width: min(920px, calc(100% - 960px)); }
52
59
  }
53
60
  /* The separator owns one grid column of its own, so it never covers the chat. */
54
61
  .side-pane-handle {
@@ -79,6 +86,10 @@
79
86
  .side-pane-handle:focus-visible::before { background: var(--accent); }
80
87
  body.is-resizing-pane { cursor: col-resize; user-select: none; }
81
88
  @media (min-width: 1100px) and (min-height: 560px) {
89
+ /* Closed panes keep four tracks so side-pane.js can animate the column shut. */
90
+ #chatView { grid-template-columns: 252px minmax(0, 1fr) 0px 0px; }
91
+ #chatView.pane-animating { transition: grid-template-columns 180ms cubic-bezier(.2, .7, .3, 1); }
92
+ body.is-resizing-pane #chatView { transition: none; }
82
93
  #chatView.has-doc,
83
94
  #chatView.has-pane { grid-template-columns: 252px minmax(0, 1fr) 8px var(--side-pane-width); }
84
95
  #chatView.has-doc > .side-pane-handle,
@@ -424,3 +435,22 @@
424
435
  border-radius: 0;
425
436
  box-shadow: none;
426
437
  }
438
+
439
+ /* A browser-local wallpaper covers the whole client window behind the app.
440
+ The conversation plane stays transparent so the image reaches past the
441
+ message column; bubbles keep their own readable surfaces. */
442
+ html.has-chat-background body::before {
443
+ content: "";
444
+ position: fixed;
445
+ inset: 0;
446
+ z-index: 0;
447
+ background-image: var(--chat-background-image, none);
448
+ background-position: center;
449
+ background-size: cover;
450
+ background-repeat: no-repeat;
451
+ opacity: var(--chat-background-opacity, .35);
452
+ pointer-events: none;
453
+ }
454
+ html.has-chat-background #app { position: relative; z-index: 1; }
455
+ html.has-chat-background #chatView,
456
+ html.has-chat-background #chatView .thread { background: transparent; }
@@ -2,10 +2,10 @@
2
2
  :root { color-scheme: light dark; }
3
3
  :root[data-theme="light"] { color-scheme: light; }
4
4
  :root[data-theme="dark"] { color-scheme: dark; }
5
- :root[data-theme="forest"], :root[data-theme="sand"] { color-scheme: light; }
5
+ :root[data-theme="forest"], :root[data-theme="sand"], :root[data-theme="custom"] { color-scheme: light; }
6
6
 
7
7
  @media (prefers-color-scheme: dark) {
8
- :root:not([data-theme="light"]):not([data-theme="forest"]):not([data-theme="sand"]) {
8
+ :root:not([data-theme="light"]):not([data-theme="forest"]):not([data-theme="sand"]):not([data-theme="custom"]) {
9
9
  --bg: #111b19;
10
10
  --surface: #182522;
11
11
  --surface-2: #202f2b;
@@ -83,11 +83,55 @@
83
83
  --shadow: 0 2px 5px rgb(77 57 30 / .06), 0 18px 44px rgb(77 57 30 / .1);
84
84
  }
85
85
 
86
+ /* A user-picked background stays a light palette; surfaces tint toward the choice
87
+ so text keeps its contrast whatever color the picker returns. */
88
+ :root[data-theme="custom"] {
89
+ --bg: var(--custom-bg, #22695c);
90
+ --surface: color-mix(in srgb, var(--custom-bg, #22695c) 46%, #fffefa);
91
+ --surface-2: color-mix(in srgb, var(--custom-bg, #22695c) 58%, #fffefa);
92
+ --ink: #1e2c29;
93
+ --ink-2: #455651;
94
+ --ink-3: #63716b;
95
+ --line: color-mix(in srgb, var(--custom-bg, #22695c) 52%, #dcded4);
96
+ --accent: #22695c;
97
+ --accent-ink: #fffdf6;
98
+ --accent-soft: color-mix(in srgb, var(--custom-bg, #22695c) 40%, #fffefa);
99
+ --danger: #a84437;
100
+ --danger-soft: #f7e8e1;
101
+ --warning: #a9761c;
102
+ --warning-ink: #fffdf6;
103
+ --mention-blue: #266c72;
104
+ --shadow: 0 2px 5px rgb(34 53 47 / .05), 0 18px 44px rgb(34 53 47 / .09);
105
+ }
106
+
107
+ /* Dark custom colors keep the chosen hue only as a tint; every surface and text
108
+ token flips so the page stays readable on the join screen and in dialogs too. */
109
+ :root[data-theme="custom"][data-custom-dark="true"] {
110
+ color-scheme: dark;
111
+ --bg: var(--custom-bg, #22695c);
112
+ --surface: color-mix(in srgb, var(--custom-bg, #22695c) 45%, #0f1917);
113
+ --surface-2: color-mix(in srgb, var(--custom-bg, #22695c) 58%, #0f1917);
114
+ --ink: #f1f6f1;
115
+ --ink-2: #c7d3cb;
116
+ --ink-3: #a3b1a8;
117
+ --line: color-mix(in srgb, var(--custom-bg, #22695c) 58%, #3d4f48);
118
+ --accent: #9bd8b7;
119
+ --accent-ink: #0f241b;
120
+ --accent-soft: color-mix(in srgb, var(--custom-bg, #22695c) 60%, #22322c);
121
+ --danger: #f0a18c;
122
+ --danger-soft: #3b2924;
123
+ --warning: #d9a441;
124
+ --warning-ink: #241a09;
125
+ --mention-blue: #8bc8c2;
126
+ --shadow: 0 2px 6px rgb(0 0 0 / .3), 0 18px 44px rgb(0 0 0 / .4);
127
+ }
128
+
86
129
  /* The redrawn select chevron follows the palette, not only the system scheme. */
87
130
  @media (prefers-color-scheme: dark) {
88
- :root:not([data-theme="light"]):not([data-theme="forest"]):not([data-theme="sand"]) select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='%23a6b3aa' d='M4.22 8.47c.3-.3.77-.3 1.06 0L12 15.19l6.72-6.72a.75.75 0 1 1 1.06 1.06l-7.25 7.25c-.3.3-.77.3-1.06 0L4.22 9.53a.75.75 0 0 1 0-1.06'/%3E%3C/svg%3E"); }
131
+ :root:not([data-theme="light"]):not([data-theme="forest"]):not([data-theme="sand"]):not([data-theme="custom"]) select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='%23a6b3aa' d='M4.22 8.47c.3-.3.77-.3 1.06 0L12 15.19l6.72-6.72a.75.75 0 1 1 1.06 1.06l-7.25 7.25c-.3.3-.77.3-1.06 0L4.22 9.53a.75.75 0 0 1 0-1.06'/%3E%3C/svg%3E"); }
89
132
  }
90
- :root[data-theme="dark"] select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='%23a6b3aa' d='M4.22 8.47c.3-.3.77-.3 1.06 0L12 15.19l6.72-6.72a.75.75 0 1 1 1.06 1.06l-7.25 7.25c-.3.3-.77.3-1.06 0L4.22 9.53a.75.75 0 0 1 0-1.06'/%3E%3C/svg%3E"); }
133
+ :root[data-theme="dark"] select,
134
+ :root[data-theme="custom"][data-custom-dark="true"] select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='%23a6b3aa' d='M4.22 8.47c.3-.3.77-.3 1.06 0L12 15.19l6.72-6.72a.75.75 0 1 1 1.06 1.06l-7.25 7.25c-.3.3-.77.3-1.06 0L4.22 9.53a.75.75 0 0 1 0-1.06'/%3E%3C/svg%3E"); }
91
135
 
92
136
  /* The join header keeps one settings entry instead of its own language control. */
93
137
  .join-head .join-settings { grid-column: 2; grid-row: 1; justify-self: end; }
@@ -99,8 +143,8 @@
99
143
  /* Settings: one dialog for language, appearance, and the optional access token. */
100
144
  .settings-dialog { width: min(1000px, calc(100vw - 32px)); max-width: none; height: min(720px, calc(100dvh - 40px)); max-height: none; margin: auto; padding: 0; overflow: hidden; color: var(--ink); background: var(--surface); border: 1px solid color-mix(in srgb, var(--accent) 16%, var(--line)); border-radius: 22px; box-shadow: 0 30px 90px rgb(8 22 18 / .32); }
101
145
  .settings-dialog[open] { display: flex; flex-direction: column; animation: settings-in .18s ease-out both; }
102
- .settings-dialog::backdrop { background: rgb(8 20 16 / .52); backdrop-filter: blur(5px); }
103
- @keyframes settings-in { from { opacity: 0; transform: translateY(8px) scale(.995); } }
146
+ .settings-dialog::backdrop { background: rgb(8 20 16 / .52); }
147
+ @keyframes settings-in { from { opacity: 0; } }
104
148
  @media (prefers-reduced-motion: reduce) { .settings-dialog[open] { animation: none; } }
105
149
 
106
150
  .settings-head { flex: none; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 24px 16px; }
@@ -135,13 +179,47 @@
135
179
  /* A caution hint keeps its icon on the first line at every width. */
136
180
  .settings-icon-hint { display: flex; align-items: flex-start; gap: 6px; }
137
181
  .settings-icon-hint .fluent-icon { flex: none; width: 14px; height: 14px; margin-top: 2px; }
138
- .settings-select { width: 168px; min-height: 38px; font-size: 13.5px; }
182
+ .settings-select {
183
+ width: 168px;
184
+ height: 38px;
185
+ min-height: 38px;
186
+ padding: 5px 31px 5px 9px;
187
+ border-radius: 8px;
188
+ font-size: 13.5px;
189
+ line-height: 1.25;
190
+ }
139
191
  .settings-range { display: flex; align-items: center; gap: 10px; width: 190px; }
140
192
  .settings-range input { flex: 1; min-width: 0; accent-color: var(--accent); cursor: pointer; }
141
193
  .settings-range input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
142
194
  .settings-range-value { flex: none; width: 42px; color: var(--ink-2); font-size: 13px; font-variant-numeric: tabular-nums; text-align: right; }
143
195
 
196
+ /* Browser-local chat background controls; the conversation layer lives in conversation.css. */
197
+ /* The compound selector must beat the generic `.settings-block` rule below. */
198
+ .settings-block.chat-background-block { margin-top: 28px; padding-top: 14px; border-top: 1px solid color-mix(in srgb, var(--line) 72%, transparent); }
199
+ .chat-background-controls { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; margin-top: 14px; }
200
+ .chat-background-field { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; min-height: 42px; padding: 4px 0; }
201
+ .chat-background-field + .chat-background-field { border-top: 1px solid color-mix(in srgb, var(--line) 72%, transparent); }
202
+ .chat-background-field .field-label { flex: none; color: var(--ink-2); font-size: 13.5px; font-weight: 500; }
203
+ .chat-background-field .settings-select { flex: none; }
204
+ .chat-background-opacity { flex: none; width: 168px; max-width: 168px; }
205
+ .chat-background-image-field { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 4px 12px; }
206
+ .chat-background-image-field .field-label { grid-column: 1; }
207
+ .chat-background-image-field .input { grid-column: 2; width: 100%; max-width: 100%; font-size: 12.5px; }
208
+ .chat-background-image-field .chat-background-preview,
209
+ .chat-background-image-field .chat-background-file-name { grid-column: 1 / -1; }
210
+ .chat-background-preview { display: block; width: 100%; height: 120px; margin-top: 6px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); object-fit: cover; }
211
+ .chat-background-file-name { min-width: 0; overflow: hidden; color: var(--ink-2); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
212
+ .chat-background-status { margin-top: 10px; color: var(--ink-3); }
213
+ .chat-background-status.is-error { color: var(--danger); }
214
+ .chat-background-status[hidden] { display: none; }
215
+ @media (max-width: 620px) {
216
+ .chat-background-controls { grid-template-columns: minmax(0, 1fr); }
217
+ .chat-background-image-field { grid-column: auto; }
218
+ }
219
+
144
220
  .integration-panel { display: grid; gap: 14px; align-content: start; }
221
+ .integration-body { display: grid; gap: 14px; }
222
+ .integration-body[hidden] { display: none; }
145
223
  .integration-lead { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
146
224
  .integration-lead .settings-hint { max-width: 560px; }
147
225
  .integration-error { margin: 0; }
@@ -166,6 +244,8 @@
166
244
  .integration-plugins { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
167
245
  .integration-plugin { display: flex; align-items: center; gap: 8px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); font-size: 12px; }
168
246
  .integration-plugin-name { color: var(--ink-2); font-weight: 600; overflow-wrap: anywhere; }
247
+ .btn.integration-plugin-download { display: grid; place-items: center; width: 24px; height: 24px; min-width: 24px; padding: 0; }
248
+ .integration-plugin-download .fluent-icon { width: 14px; height: 14px; }
169
249
  .integration-rules { width: 100%; min-height: 170px; font-family: var(--font-mono); font-size: 12px; line-height: 1.55; resize: vertical; }
170
250
  .integration-rules-editor { width: 100%; height: 320px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
171
251
  .integration-rules-editor .monaco-editor, .integration-rules-editor .monaco-editor .overflow-guard { border-radius: 11px; }
@@ -188,12 +268,32 @@
188
268
  .integration-env-rows { display: grid; gap: 6px; margin: 6px 0; }
189
269
  .integration-env-row { display: grid; grid-template-columns: minmax(120px, .75fr) minmax(0, 1fr) auto; align-items: center; gap: 6px; }
190
270
  .integration-env-row .input { min-height: 34px; font-size: 13px; }
191
- .integration-env-row.is-stored .integration-env-key { color: var(--ink-3); background: var(--surface-2); }
271
+ .integration-env-combo { position: relative; min-width: 0; }
272
+ .integration-env-combo .input { width: 100%; }
273
+ .integration-env-menu { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0; max-height: 220px; overflow: auto; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); }
274
+ .integration-env-menu[hidden] { display: none; }
275
+ .integration-env-option { display: grid; gap: 1px; width: 100%; padding: 6px 8px; border: 0; border-radius: 7px; color: var(--ink); background: transparent; font: inherit; text-align: left; cursor: pointer; }
276
+ .integration-env-option:hover, .integration-env-option:focus-visible { background: var(--surface-2); outline: none; }
277
+ .integration-env-option-key { font-family: var(--font-mono); font-size: 12px; font-weight: 650; overflow-wrap: anywhere; }
278
+ .integration-env-option-desc { color: var(--ink-3); font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; }
279
+ .integration-env-row.is-stored .integration-env-key { background: var(--surface-2); }
192
280
  .integration-env-row.is-stored .integration-env-value { border-style: dashed; }
193
- .integration-env-row.is-stored .integration-env-value::placeholder { color: var(--ink-2); }
194
- .integration-env-remove { width: 30px; height: 30px; padding: 0; font-size: 16px; line-height: 1; }
281
+ /* Icon-only buttons must outrank the shared .btn.small padding rule. */
282
+ .btn.integration-env-remove, .btn.integration-env-add { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; }
283
+ .integration-env-remove .fluent-icon { width: 16px; height: 16px; }
284
+ .integration-env-add .fluent-icon { width: 16px; height: 16px; }
195
285
  .integration-env-actions { display: flex; flex-wrap: wrap; gap: 6px; }
196
286
  .integration-env-note { margin: 4px 0 0; color: var(--warning); font-size: 12px; font-weight: 600; }
287
+ .integration-schema { display: grid; gap: 10px; margin: 0; padding: 0; border: 0; }
288
+ .integration-schema[hidden] { display: none; }
289
+ .integration-schema-field .hint { display: block; margin-top: 3px; }
290
+ .integration-required { color: var(--danger); }
291
+ .integration-advanced { margin: 0; padding: 0; border: 0; }
292
+ .integration-advanced summary { display: flex; align-items: center; gap: 6px; cursor: pointer; list-style: none; }
293
+ .integration-advanced summary::-webkit-details-marker { display: none; }
294
+ .integration-advanced-icon { width: 16px; height: 16px; transform: rotate(-90deg); transition: transform .15s; }
295
+ .integration-advanced[open] .integration-advanced-icon { transform: rotate(0deg); }
296
+ .integration-advanced[open] summary { margin-bottom: 6px; }
197
297
  @media (max-width: 620px) {
198
298
  .integration-panel { gap: 10px; }
199
299
  .integration-account { grid-template-columns: minmax(0, 1fr); }
@@ -218,7 +318,9 @@
218
318
  .theme-option { position: relative; display: grid; gap: 8px; min-width: 0; padding: 8px 8px 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s; }
219
319
  .theme-option:hover { border-color: color-mix(in srgb, var(--accent) 38%, var(--line)); }
220
320
  .theme-option:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 42%, var(--surface)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 50%, transparent); }
221
- .theme-option input { position: absolute; width: 1px; height: 1px; opacity: 0; }
321
+ .theme-option input[type="radio"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
322
+ .theme-color-input { width: 100%; height: 28px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; }
323
+ .theme-color-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
222
324
  .theme-option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
223
325
  .theme-option:has(input:checked)::after { content: "✓"; position: absolute; top: 14px; right: 14px; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: var(--accent-ink); background: var(--accent); font-size: 11px; font-weight: 700; line-height: 1; }
224
326
  .theme-preview { position: relative; display: block; height: 64px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--line) 75%, transparent); border-radius: 9px; background: var(--swatch-bg, var(--surface-2)); }
@@ -228,9 +330,9 @@
228
330
  .panel-mode-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; margin-top: 10px; }
229
331
  .panel-mode-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 42px; padding: 4px 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent); color: var(--ink-2); font-size: 13.5px; }
230
332
  .panel-mode-row:last-child { border-bottom: 0; }
231
- .panel-mode-row select { width: 150px; min-height: 36px; font-size: 13px; }
333
+ .panel-mode-row select { flex: none; }
232
334
  @media (max-width: 620px) {
233
- .panel-mode-row select { width: 142px; }
335
+ .panel-mode-row select { flex: none; }
234
336
  }
235
337
  .theme-name { min-width: 0; overflow: hidden; color: var(--ink-2); font-size: 11.5px; font-weight: 600; line-height: 1.3; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
236
338
  .theme-option:has(input:checked) .theme-name { color: var(--ink); }
@@ -241,6 +343,8 @@
241
343
  .theme-option[data-theme-choice="dark"] .theme-preview { --swatch-bg: #111b19; --swatch-surface: #182522; --swatch-accent: #8ac9aa; }
242
344
  .theme-option[data-theme-choice="forest"] .theme-preview { --swatch-bg: #e7ede2; --swatch-surface: #f7faf4; --swatch-accent: #2f6b45; }
243
345
  .theme-option[data-theme-choice="sand"] .theme-preview { --swatch-bg: #f4e9d6; --swatch-surface: #fff9ef; --swatch-accent: #9a5a32; }
346
+ .theme-option[data-theme-choice="custom"] .theme-preview { --swatch-bg: var(--custom-bg, #22695c); --swatch-surface: color-mix(in srgb, var(--custom-bg, #22695c) 46%, #fffefa); --swatch-accent: #22695c; }
347
+ :root[data-custom-dark="true"] .theme-option[data-theme-choice="custom"] .theme-preview { --swatch-surface: color-mix(in srgb, var(--custom-bg, #22695c) 45%, #0f1917); --swatch-accent: #9bd8b7; }
244
348
 
245
349
  .settings-token-control { display: flex; align-items: center; gap: 8px; }
246
350
  .settings-token-control .input { width: 220px; min-height: 38px; }
@@ -0,0 +1,36 @@
1
+ /* Installed PWA with a visible Window Controls Overlay: the page draws under the
2
+ title bar, so the free titlebar area becomes a drag strip and the app starts
3
+ below it. Without [data-wco] none of this applies. */
4
+ html[data-wco="true"] body {
5
+ display: grid;
6
+ grid-template-rows: calc(env(titlebar-area-y, var(--wco-top, 0px)) + env(titlebar-area-height, var(--wco-height, 0px))) minmax(0, 1fr);
7
+ background: var(--surface);
8
+ }
9
+ html[data-wco="true"] #app {
10
+ grid-row: 2;
11
+ width: 100%;
12
+ height: 100%;
13
+ min-height: 0;
14
+ max-width: none;
15
+ }
16
+ html[data-wco="true"] #app:has(#chatView.has-doc),
17
+ html[data-wco="true"] #app:has(#chatView.has-pane) { max-width: none; }
18
+ html[data-wco="true"] #chatView {
19
+ width: 100%;
20
+ height: 100%;
21
+ margin: 0;
22
+ border: 0;
23
+ border-radius: 0;
24
+ box-shadow: none;
25
+ }
26
+ .wco-drag { display: none; }
27
+ html[data-wco="true"] .wco-drag {
28
+ display: block;
29
+ position: fixed;
30
+ top: env(titlebar-area-y, var(--wco-top, 0px));
31
+ left: env(titlebar-area-x, var(--wco-left, 0px));
32
+ width: env(titlebar-area-width, var(--wco-width, 100%));
33
+ height: env(titlebar-area-height, var(--wco-height, 0px));
34
+ -webkit-app-region: drag;
35
+ app-region: drag;
36
+ }
@@ -0,0 +1,133 @@
1
+ // Channel D attachments: chatroom resources become local files for the adapter,
2
+ // and adapter-downloaded files become chatroom resources for the room.
3
+ import { createHash } from "node:crypto";
4
+ import { createReadStream, createWriteStream } from "node:fs";
5
+ import { promises as fs } from "node:fs";
6
+ import os from "node:os";
7
+ import path from "node:path";
8
+ import { Readable } from "node:stream";
9
+ import { pipeline } from "node:stream/promises";
10
+ import type { AdapterCapabilities, AttachmentRef, IngestEvent } from "../packages/chat-room-channeld/src/protocol.ts";
11
+ import { platformLabel } from "../packages/chat-room-channeld/src/inbound.ts";
12
+ import { findResource, maxResourceBytes, openResource, uploadResource } from "../src/rooms/resources.ts";
13
+
14
+ /**
15
+ * Resources referenced by a room message marker. The message text stays the
16
+ * source of truth: an attachment that was uploaded but never mentioned is not
17
+ * forwarded.
18
+ */
19
+ export async function forwardAttachments(roomId: string, text: string): Promise<AttachmentRef[]> {
20
+ const ids = [...text.matchAll(/\[\[resource:([0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})\]\]/gi)]
21
+ .map((match) => match[1]!)
22
+ .filter((id, index, all) => all.indexOf(id) === index);
23
+ const attachments: AttachmentRef[] = [];
24
+ for (const id of ids) {
25
+ const resource = await findResource(roomId, id).catch(() => undefined);
26
+ if (!resource) {
27
+ attachments.push({ kind: "file", name: "attachment", error: "resource unavailable" });
28
+ continue;
29
+ }
30
+ attachments.push({
31
+ kind: resource.mimeType.startsWith("image/") ? "image" : "file",
32
+ name: resource.name,
33
+ mimeType: resource.mimeType,
34
+ size: resource.size,
35
+ resourceId: resource.id,
36
+ roomId,
37
+ });
38
+ }
39
+ return attachments;
40
+ }
41
+
42
+ /**
43
+ * Turn chatroom resource ids into local files for the adapter. Channel D runs
44
+ * adapters as child processes on the same host, so a path is cheaper and less
45
+ * fragile than moving megabytes through the JSON frame.
46
+ */
47
+ export async function prepareSendPayload(
48
+ payload: unknown,
49
+ capabilities?: AdapterCapabilities,
50
+ ): Promise<{ payload: unknown; cleanup?: () => Promise<void> }> {
51
+ if (!payload || typeof payload !== "object" || Array.isArray(payload)) return { payload };
52
+ const attachments = (payload as { attachments?: unknown }).attachments;
53
+ if (!Array.isArray(attachments) || attachments.length === 0) return { payload };
54
+
55
+ const directory = await fs.mkdtemp(path.join(os.tmpdir(), "chat-room-outbound-"));
56
+ const files: AttachmentRef[] = [];
57
+ for (const raw of attachments) {
58
+ if (!raw || typeof raw !== "object") continue;
59
+ const attachment = raw as AttachmentRef;
60
+ if (!attachment.resourceId || !attachment.roomId) {
61
+ files.push(attachment);
62
+ continue;
63
+ }
64
+ try {
65
+ const resource = await findResource(attachment.roomId, attachment.resourceId);
66
+ if (!resource) throw new Error("resource not found");
67
+ const limit = resource.mimeType.startsWith("image/")
68
+ ? capabilities?.attachments?.imageMaxBytes
69
+ : capabilities?.attachments?.fileMaxBytes;
70
+ if (limit !== undefined && resource.size > limit) throw new Error(`exceeds adapter attachment limit (${limit} bytes)`);
71
+ const opened = await openResource(resource);
72
+ if (!opened) throw new Error("resource content is missing");
73
+ const extension = path.extname(resource.name).toLowerCase();
74
+ const file = path.join(directory, `${resource.id}${/^\.[a-z0-9]{1,10}$/.test(extension) ? extension : ".bin"}`);
75
+ await pipeline(Readable.fromWeb(opened.stream as unknown as import("node:stream/web").ReadableStream), createWriteStream(file, { mode: 0o600 }));
76
+ files.push({ ...attachment, name: resource.name, mimeType: resource.mimeType, size: resource.size, path: file });
77
+ } catch (error) {
78
+ files.push({ ...attachment, error: error instanceof Error ? error.message : String(error) });
79
+ }
80
+ }
81
+ return {
82
+ payload: { ...(payload as Record<string, unknown>), attachments: files },
83
+ cleanup: () => fs.rm(directory, { recursive: true, force: true }),
84
+ };
85
+ }
86
+
87
+ /** Reuse one resource id per event, room, and attachment so a retry cannot duplicate it. */
88
+ function stableResourceID(eventId: string, roomId: string, index: number): string {
89
+ const hex = createHash("sha256").update(`${eventId}:${roomId}:${index}`).digest("hex");
90
+ return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-5${hex.slice(13, 16)}-a${hex.slice(17, 20)}-${hex.slice(20, 32)}`;
91
+ }
92
+
93
+ /**
94
+ * Adapter downloads live in a private temp directory. Only accept that shape so
95
+ * an adapter cannot ask the server to import an arbitrary local file.
96
+ */
97
+ function readableAdapterFile(value: unknown): string | undefined {
98
+ if (typeof value !== "string" || !path.isAbsolute(value)) return undefined;
99
+ const prefix = path.join(os.tmpdir(), "chat-room-channeld-");
100
+ return path.resolve(value).startsWith(prefix) ? path.resolve(value) : undefined;
101
+ }
102
+
103
+ export async function inboundAttachments(event: IngestEvent, roomId: string): Promise<string[]> {
104
+ const attachments = event.content?.attachments ?? [];
105
+ const markers: string[] = [];
106
+ for (const [index, attachment] of attachments.entries()) {
107
+ if (attachment.error) {
108
+ markers.push(`[attachment unavailable: ${attachment.error}]`);
109
+ continue;
110
+ }
111
+ const file = readableAdapterFile(attachment.path);
112
+ if (!file) {
113
+ markers.push("[attachment unavailable: no local file]");
114
+ continue;
115
+ }
116
+ try {
117
+ const info = await fs.stat(file);
118
+ if (!info.isFile() || info.size > maxResourceBytes()) throw new Error("file is not a regular file within the upload limit");
119
+ const resource = await uploadResource(
120
+ roomId,
121
+ attachment.name || `${attachment.kind}-${index + 1}`,
122
+ Readable.toWeb(createReadStream(file)) as unknown as ReadableStream<Uint8Array>,
123
+ maxResourceBytes(),
124
+ { sessionID: `channel:${event.source.accountId}`, name: `${platformLabel(event.source.platform)} ${event.source.accountId}` },
125
+ stableResourceID(event.eventId, roomId, index),
126
+ );
127
+ markers.push(`[[resource:${resource.id}]]`);
128
+ } catch (error) {
129
+ markers.push(`[attachment upload failed: ${error instanceof Error ? error.message : String(error)}]`);
130
+ }
131
+ }
132
+ return markers;
133
+ }
@@ -14,6 +14,7 @@ import { randomUUID } from "node:crypto";
14
14
  import path from "node:path";
15
15
  import { parse as parseYaml, stringify as stringifyYaml } from "yaml";
16
16
  import { AdapterProcess } from "../packages/chat-room-channeld/src/adapter.ts";
17
+ import type { AccountCapabilities } from "../packages/chat-room-channeld/src/protocol.ts";
17
18
  import {
18
19
  parseConfig,
19
20
  type AccountConfig,
@@ -38,7 +39,13 @@ export interface IntegrationControl {
38
39
  disable(): Promise<Response>;
39
40
  }
40
41
 
41
- type PluginMeta = { id: string; name: string; platform: string };
42
+ type PluginMeta = {
43
+ id: string;
44
+ name: string;
45
+ platform: string;
46
+ displayName?: string;
47
+ account?: AccountCapabilities;
48
+ };
42
49
  type ManagedAccount = {
43
50
  id: string;
44
51
  platform: string;
@@ -47,7 +54,7 @@ type ManagedAccount = {
47
54
  };
48
55
 
49
56
  const IDENTIFIER = /^[A-Za-z0-9._-]{1,128}$/;
50
- const PLUGIN_NAME = /^[A-Za-z0-9][A-Za-z0-9._-]*\.(?:js|mjs|cjs)$/;
57
+ const PLUGIN_NAME = /^[A-Za-z0-9][A-Za-z0-9._-]*\.(?:js|mjs|cjs|ts)$/;
51
58
  const ENV_KEY = /^[A-Za-z_][A-Za-z0-9_]*$/;
52
59
  const RESERVED_ENV = new Set(["CHANNELD_ACCOUNT_ID", "CHANNELD_PLATFORM"]);
53
60
  const MAX_ENV = 64;
@@ -56,7 +63,7 @@ const MAX_PLUGIN_BYTES = 256 * 1024;
56
63
  const MAX_REQUEST_BYTES = 1024 * 1024;
57
64
  const HANDSHAKE_TIMEOUT_MS = 3000;
58
65
 
59
- const json = (body: unknown, status = 200) => Response.json(body, { status });
66
+ const json = (body: unknown, status = 200) => Response.json(body, { status, headers: { "Cache-Control": "no-store" } });
60
67
 
61
68
  function integrationRoot(): string {
62
69
  return path.resolve(path.dirname(databasePath()), "integrations");
@@ -195,10 +202,38 @@ function readPlugin(pluginId: string): { dir: string; file: string; meta: Plugin
195
202
  if (typeof platform !== "string" || !IDENTIFIER.test(platform)) return undefined;
196
203
  const file = path.join(dir, name);
197
204
  if (path.dirname(file) !== dir || !existsSync(file)) return undefined;
198
- return { dir, file, meta: { id, name, platform } };
205
+ const displayName = typeof meta.displayName === "string" && meta.displayName.trim()
206
+ ? meta.displayName.trim()
207
+ : undefined;
208
+ const account = isRecord(meta.account) ? meta.account as AccountCapabilities : undefined;
209
+ return {
210
+ dir,
211
+ file,
212
+ meta: { id, name, platform, ...(displayName ? { displayName } : {}), ...(account ? { account } : {}) },
213
+ };
199
214
  }
200
215
 
201
- function uploadedPlugins(): Array<{ pluginId: string; name: string; platform: string }> {
216
+ function downloadPlugin(pluginId: string): Response {
217
+ const plugin = readPlugin(pluginId);
218
+ if (!plugin) return json({ error: "plugin not found" }, 404);
219
+ let bytes: Buffer;
220
+ try {
221
+ bytes = readFileSync(plugin.file);
222
+ } catch {
223
+ return json({ error: "plugin not found" }, 404);
224
+ }
225
+ const name = plugin.meta.name.replace(/[^\x20-\x7e]|["\\]/g, "_");
226
+ return new Response(new Uint8Array(bytes), {
227
+ headers: {
228
+ "Content-Type": "application/octet-stream",
229
+ "Content-Disposition": `attachment; filename="${name}"; filename*=UTF-8''${encodeURIComponent(plugin.meta.name)}`,
230
+ "Cache-Control": "no-store",
231
+ "X-Content-Type-Options": "nosniff",
232
+ },
233
+ });
234
+ }
235
+
236
+ function uploadedPlugins(): Array<{ pluginId: string; name: string; platform: string; displayName?: string; account?: AccountCapabilities }> {
202
237
  let entries: string[];
203
238
  try {
204
239
  entries = readdirSync(pluginsRoot());
@@ -209,7 +244,13 @@ function uploadedPlugins(): Array<{ pluginId: string; name: string; platform: st
209
244
  .flatMap((pluginId) => {
210
245
  const plugin = readPlugin(pluginId);
211
246
  return plugin
212
- ? [{ pluginId: plugin.meta.id, name: plugin.meta.name, platform: plugin.meta.platform }]
247
+ ? [{
248
+ pluginId: plugin.meta.id,
249
+ name: plugin.meta.name,
250
+ platform: plugin.meta.platform,
251
+ ...(plugin.meta.displayName ? { displayName: plugin.meta.displayName } : {}),
252
+ ...(plugin.meta.account ? { account: plugin.meta.account } : {}),
253
+ }]
213
254
  : [];
214
255
  })
215
256
  .sort((left, right) => left.pluginId.localeCompare(right.pluginId));
@@ -441,6 +482,13 @@ export async function handleIntegrationAdmin(
441
482
  url: URL,
442
483
  control: IntegrationControl,
443
484
  ): Promise<Response | undefined> {
485
+ const download = /^\/channeld\/plugins\/([^/]+)\/download$/.exec(url.pathname);
486
+ if (download) {
487
+ if (req.method !== "GET") return json({ error: "method not allowed" }, 405);
488
+ let pluginId: string;
489
+ try { pluginId = decodeURIComponent(download[1]!); } catch { return json({ error: "plugin not found" }, 404); }
490
+ return downloadPlugin(pluginId);
491
+ }
444
492
  if (url.pathname === "/channeld/plugins") {
445
493
  if (req.method !== "POST") return json({ error: "method not allowed" }, 405);
446
494
  return uploadPlugin(req);
@@ -458,22 +506,13 @@ async function uploadPlugin(req: Request): Promise<Response> {
458
506
  if (!body.ok || !isRecord(body.value)) {
459
507
  return json({ error: "plugin body must be a JSON object" }, 400);
460
508
  }
461
- const { name, platform, source } = body.value;
509
+ const { name = "plugin.js", source } = body.value;
462
510
  if (typeof name !== "string" || !PLUGIN_NAME.test(name) || name.length > 128) {
463
- return json({ error: "name must be a safe .js, .mjs, or .cjs file name" }, 400);
464
- }
465
- if (typeof platform !== "string" || !IDENTIFIER.test(platform)) {
466
- return json({ error: "platform must be a safe identifier" }, 400);
511
+ return json({ error: "name must be a safe .js, .mjs, .cjs, or .ts file name" }, 400);
467
512
  }
468
513
  if (typeof source !== "string" || Buffer.byteLength(source, "utf8") > MAX_PLUGIN_BYTES) {
469
514
  return json({ error: `source must be UTF-8 text of at most ${MAX_PLUGIN_BYTES} bytes` }, 400);
470
515
  }
471
- let env: Record<string, string> | undefined;
472
- try {
473
- env = envValue(body.value.env);
474
- } catch (error) {
475
- return json({ error: publicError(error) }, 400);
476
- }
477
516
 
478
517
  const root = integrationRoot();
479
518
  const pluginId = randomUUID();
@@ -483,14 +522,14 @@ async function uploadPlugin(req: Request): Promise<Response> {
483
522
  try {
484
523
  mkdirSync(tempDir, { recursive: true, mode: 0o700 });
485
524
  writeFileSync(pluginFile, source, { mode: 0o600 });
486
- const meta: PluginMeta = { id: pluginId, name, platform };
487
- writeFileSync(path.join(tempDir, "meta.json"), `${JSON.stringify(meta)}\n`, { mode: 0o600 });
488
525
 
526
+ // A probe runs initialize only: it proves the adapter speaks the protocol
527
+ // and declares its platform/capabilities without starting the account or
528
+ // requiring credentials.
489
529
  const account: AccountConfig = {
490
530
  id: `plugin-${pluginId}`,
491
- platform,
531
+ platform: "plugin",
492
532
  adapter: { command: ["node", pluginFile] },
493
- env,
494
533
  };
495
534
  const adapter = new AdapterProcess({
496
535
  account,
@@ -498,16 +537,30 @@ async function uploadPlugin(req: Request): Promise<Response> {
498
537
  onExit: () => {},
499
538
  initializeTimeoutMs: HANDSHAKE_TIMEOUT_MS,
500
539
  });
501
- try {
502
- await adapter.start();
503
- } finally {
504
- await adapter.stop();
540
+ const probed = await adapter.probe();
541
+ const platform = probed.platform;
542
+ if (!platform || !IDENTIFIER.test(platform)) {
543
+ throw new Error("plugin must declare a platform in initialize");
505
544
  }
545
+ const meta: PluginMeta = {
546
+ id: pluginId,
547
+ name,
548
+ platform,
549
+ ...(probed.capabilities?.displayName ? { displayName: probed.capabilities.displayName } : {}),
550
+ ...(probed.capabilities?.account ? { account: probed.capabilities.account } : {}),
551
+ };
552
+ writeFileSync(path.join(tempDir, "meta.json"), `${JSON.stringify(meta)}\n`, { mode: 0o600 });
506
553
 
507
554
  mkdirSync(pluginsRoot(), { recursive: true, mode: 0o700 });
508
555
  if (existsSync(finalDir)) throw new Error("plugin id collision");
509
556
  renameSync(tempDir, finalDir);
510
- return json({ pluginId, name, platform }, 201);
557
+ return json({
558
+ pluginId,
559
+ name,
560
+ platform,
561
+ ...(meta.displayName ? { displayName: meta.displayName } : {}),
562
+ ...(meta.account ? { account: meta.account } : {}),
563
+ }, 201);
511
564
  } catch (error) {
512
565
  try {
513
566
  rmSync(tempDir, { recursive: true, force: true });