pi-roundtable-web 0.24.2 → 0.26.0
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/CHANGELOG.md +48 -0
- package/README.md +195 -16
- package/dist/account-zk4efb87.css +102 -0
- package/dist/chunk-account-hw49gd0d.js +1 -0
- package/dist/chunk-action-menu-rm5cyqkj.js +1 -0
- package/dist/chunk-agent-b017vswv.js +1 -0
- package/dist/chunk-arranged-rooms-q5v3dm1r.js +1 -0
- package/dist/chunk-character-creator-5dxcvd16.js +1 -0
- package/dist/chunk-codeeditor-pyt09fwg.js +2 -0
- package/dist/chunk-confirm-521yqmta.js +1 -0
- package/dist/chunk-connectors-hrm06nx8.js +1 -0
- package/dist/chunk-conversations-e26rrf01.js +1 -0
- package/dist/chunk-drag-v41gx2mc.js +1 -0
- package/dist/chunk-entry-jxxb3ath.js +1 -0
- package/dist/chunk-folder-list-b97xk12b.js +1 -0
- package/dist/chunk-folds-b8q7eags.js +1 -0
- package/dist/chunk-gate-8k61stsc.js +1 -0
- package/dist/chunk-group-scene-dx6wt19m.js +1 -0
- package/dist/chunk-group-table-e4jr8r3a.js +1 -0
- package/dist/chunk-host-state-g7e7c0k5.js +1 -0
- package/dist/chunk-host-ui-x7k6n07v.js +939 -0
- package/dist/chunk-index-014rjv9k.js +2 -0
- package/dist/chunk-index-2d0kg096.js +2 -0
- package/dist/chunk-index-2qd81wbx.js +2 -0
- package/dist/chunk-index-2stynxw6.css +1 -0
- package/dist/chunk-index-459drsft.js +2 -0
- package/dist/chunk-index-4mfj596y.js +2 -0
- package/dist/chunk-index-66nskrdj.js +47 -0
- package/dist/chunk-index-awx6nnta.js +2 -0
- package/dist/chunk-index-bbsytycb.js +2 -0
- package/dist/chunk-index-c07p8k0x.js +4 -0
- package/dist/chunk-index-cq1e9xdz.js +2 -0
- package/dist/chunk-index-d1prgfbp.js +2 -0
- package/dist/chunk-index-dhpt8qr9.js +2 -0
- package/dist/chunk-index-e5sd30xy.js +2 -0
- package/dist/chunk-index-g351921r.js +1 -0
- package/dist/chunk-index-hby0ap91.js +2 -0
- package/dist/chunk-index-hssjbr1k.js +2 -0
- package/dist/chunk-index-k2qq1gdj.js +2 -0
- package/dist/chunk-index-ke9ynm0n.js +2 -0
- package/dist/chunk-index-km40bhsz.js +2 -0
- package/dist/chunk-index-kpscvg85.js +2 -0
- package/dist/chunk-index-m0d100mg.js +2 -0
- package/dist/chunk-index-mb72snk9.js +2 -0
- package/dist/chunk-index-mjqqver5.js +4 -0
- package/dist/chunk-index-nqfkwkfp.js +2 -0
- package/dist/chunk-index-nwqk447w.js +2 -0
- package/dist/chunk-index-pcfhpm8v.js +302 -0
- package/dist/chunk-index-q8h8xzbm.js +2 -0
- package/dist/chunk-index-r5vszgfs.js +2 -0
- package/dist/{chunk-index-mpm90318.js → chunk-index-rhtvcbsq.js} +2 -2
- package/dist/chunk-index-rjv7vrwd.js +13 -0
- package/dist/chunk-index-v23m38p6.js +50 -0
- package/dist/chunk-index-va0g7d88.js +1 -0
- package/dist/{chunk-index-6t68gbex.js → chunk-index-wnjp6wv0.js} +2 -2
- package/dist/chunk-index-xgkd15n3.js +2 -0
- package/dist/chunk-index-y8rnq8zf.js +14 -0
- package/dist/chunk-index-z3k18atc.js +2 -0
- package/dist/chunk-lang-css-6bepqpnx.js +1 -0
- package/dist/{chunk-lang-dockerfile-ey0nvhhm.js → chunk-lang-dockerfile-hrav55t7.js} +1 -1
- package/dist/{chunk-lang-go-403qsw9f.js → chunk-lang-go-x9ahv6e5.js} +3 -3
- package/dist/chunk-lang-html-8jc72zt4.js +1 -0
- package/dist/chunk-lang-javascript-2p2qtbnf.js +1 -0
- package/dist/chunk-lang-json-hsemyd0r.js +1 -0
- package/dist/chunk-lang-markdown-zkwb4c9n.js +6 -0
- package/dist/{chunk-lang-python-9jk5a49y.js → chunk-lang-python-tewx7006.js} +2 -2
- package/dist/chunk-lang-rust-0ydx84s1.js +1 -0
- package/dist/{chunk-lang-shell-cgq6q0kj.js → chunk-lang-shell-gq1tmdz4.js} +1 -1
- package/dist/chunk-lang-sql-xt1qyycg.js +2 -0
- package/dist/{chunk-lang-toml-xh45nm68.js → chunk-lang-toml-0hamc5fc.js} +1 -1
- package/dist/chunk-lang-typescript-82xf7z2e.js +1 -0
- package/dist/{chunk-lang-xml-1mh879j9.js → chunk-lang-xml-wf6h5pt2.js} +1 -1
- package/dist/{chunk-lang-yaml-jac98srt.js → chunk-lang-yaml-7vk521h1.js} +1 -1
- package/dist/chunk-layout-actions-zh7bezk7.js +1 -0
- package/dist/chunk-menu-items-1n9qargb.js +2 -0
- package/dist/chunk-notes-t15bh04m.js +1 -0
- package/dist/chunk-notice-bell-w3y0h0sr.js +1 -0
- package/dist/chunk-notices-fa3g7qze.js +1 -0
- package/dist/chunk-onboarding-34v3nr17.js +1 -0
- package/dist/chunk-overview-km5vq375.js +1 -0
- package/dist/chunk-palette-a8txdgd0.js +1 -0
- package/dist/chunk-placement-items-wgaxsbvs.js +1 -0
- package/dist/chunk-profile-ypxdbsk1.js +1 -0
- package/dist/chunk-prompt-history-wm9dsy6s.js +1 -0
- package/dist/chunk-prompts-7mhhq7zs.js +1 -0
- package/dist/chunk-room-confirms-t11a1gsw.js +1 -0
- package/dist/chunk-room-menu-2tm2xtfx.js +1 -0
- package/dist/chunk-rooms-menu-button-wxnsxjwc.js +1 -0
- package/dist/chunk-schedules-2ft6xxyw.js +1 -0
- package/dist/chunk-seat-menu-d3npdtx1.js +1 -0
- package/dist/chunk-sheet-hosts-vngvp7wv.js +1 -0
- package/dist/chunk-skill-editor-65n2hsq4.js +8 -0
- package/dist/chunk-skills-shkdwes8.js +1 -0
- package/dist/chunk-switcher-list-g6hhmr1t.js +1 -0
- package/dist/chunk-table-1b6bsq2y.js +1 -0
- package/dist/chunk-table-seats-vy1qhdks.js +1 -0
- package/dist/chunk-table2d-n26b7gd0.js +1 -0
- package/dist/chunk-table3d-8aysyf56.js +4220 -0
- package/dist/chunk-transcript-355faceq.js +1 -0
- package/dist/chunk-where-j5qdt8a4.js +1 -0
- package/dist/chunk-workspace-vrbs6zx1.js +1 -0
- package/dist/chunk-zh-tw-zeg600bk.js +1 -0
- package/dist/index.html +1 -1
- package/dist/sw.js +1 -1
- package/package.json +5 -4
- package/src/api-types.ts +515 -6
- package/src/app/api-http.ts +66 -0
- package/src/app/app.ts +214 -33
- package/src/app/card-log.ts +6 -0
- package/src/app/desk.ts +47 -22
- package/src/app/files.ts +73 -7
- package/src/app/layout-routes.ts +239 -0
- package/src/app/layout.ts +133 -0
- package/src/app/presence.ts +2 -2
- package/src/app/prompt-routes.ts +167 -0
- package/src/app/protocol.ts +63 -1
- package/src/app/room-log.ts +148 -14
- package/src/app/rooms.ts +23 -0
- package/src/app/routes.ts +278 -156
- package/src/app/skill-doc-routes.ts +122 -0
- package/src/app/socket.ts +309 -77
- package/src/app/sockets.ts +108 -20
- package/src/app/surface.ts +72 -36
- package/src/app/team-routes.ts +457 -0
- package/src/app/threads.ts +14 -0
- package/src/app/uploads.ts +33 -7
- package/src/auth/authenticator.ts +71 -8
- package/src/auth/next.ts +52 -0
- package/src/auth/oidc-pages.ts +60 -0
- package/src/auth/oidc.ts +611 -0
- package/src/auth/sessions.ts +193 -0
- package/src/authz.ts +172 -0
- package/src/console-api.ts +122 -25
- package/src/console-server.ts +70 -6
- package/src/gate.ts +90 -0
- package/src/host/access.ts +161 -0
- package/src/host/cards.ts +99 -0
- package/src/host/context.ts +141 -0
- package/src/host/forms.ts +237 -0
- package/src/host/frames.ts +342 -0
- package/src/host/host-app.ts +176 -0
- package/src/host/host-context.ts +49 -0
- package/src/host/host-routes.ts +363 -0
- package/src/host/pages.ts +266 -0
- package/src/host/reads.ts +155 -0
- package/src/host/retention.ts +41 -0
- package/src/host/room-views.ts +137 -0
- package/src/host/rooms-service.ts +414 -0
- package/src/host/stored-json.ts +13 -0
- package/src/host/views.ts +103 -0
- package/src/i18n/zh-tw.ts +309 -10
- package/src/layout-order.ts +210 -0
- package/src/notices/api.ts +43 -0
- package/src/notices/mount.ts +292 -0
- package/src/notices/service.ts +294 -0
- package/src/notices/store.ts +298 -0
- package/src/notices/urls.ts +38 -0
- package/src/onboarding/api.ts +32 -0
- package/src/onboarding/service.ts +149 -0
- package/src/onboarding/steps.ts +75 -0
- package/src/onboarding/waivers.ts +40 -0
- package/src/options.ts +498 -34
- package/src/profile/api.ts +175 -0
- package/src/profile/links.ts +162 -0
- package/src/push/api.ts +189 -52
- package/src/push/dispatch.ts +156 -0
- package/src/push/drain.ts +139 -0
- package/src/push/mutes.ts +17 -0
- package/src/push/outbox.ts +218 -0
- package/src/push/prefs.ts +118 -0
- package/src/push/sender.ts +7 -2
- package/src/push/triggers.ts +56 -5
- package/src/push/vapid.ts +19 -0
- package/src/push/web-push-transport.ts +106 -0
- package/src/push-sender/index.ts +14 -0
- package/src/push-sender/run.ts +118 -0
- package/src/push-sender/session.ts +54 -0
- package/src/visitors.ts +94 -6
- package/src/web-app.ts +674 -0
- package/src/web-plugin.ts +293 -26
- package/dist/chunk-action-menu-7v5fce2v.js +0 -1
- package/dist/chunk-agent-2rw4ydw2.js +0 -1
- package/dist/chunk-agent-sheet-2q24dkkf.js +0 -3
- package/dist/chunk-character-creator-8q6ympxj.js +0 -1
- package/dist/chunk-codeeditor-fgmq298t.js +0 -2
- package/dist/chunk-connectors-mr53r7fh.js +0 -1
- package/dist/chunk-conversations-4vy2z6w9.js +0 -1
- package/dist/chunk-entry-jg1eem82.js +0 -1
- package/dist/chunk-group-scene-na95b1te.js +0 -1
- package/dist/chunk-index-11rjg8a8.js +0 -1
- package/dist/chunk-index-1y50d6sj.js +0 -2
- package/dist/chunk-index-5y2r0eaj.js +0 -47
- package/dist/chunk-index-7fphxxzd.js +0 -14
- package/dist/chunk-index-80f1zkp6.css +0 -1
- package/dist/chunk-index-87h45frg.js +0 -2
- package/dist/chunk-index-bnwmssyn.js +0 -2
- package/dist/chunk-index-ckgbszwt.js +0 -51
- package/dist/chunk-index-fmjjekhd.js +0 -2
- package/dist/chunk-index-t1m65yn6.js +0 -13
- package/dist/chunk-index-t711t17m.js +0 -2
- package/dist/chunk-index-txv7qvyy.js +0 -2
- package/dist/chunk-index-wr3dg24d.js +0 -2
- package/dist/chunk-index-yx683d5n.js +0 -2
- package/dist/chunk-lang-css-fkdg3x8x.js +0 -1
- package/dist/chunk-lang-html-v8h9g977.js +0 -1
- package/dist/chunk-lang-javascript-ykb2vhaa.js +0 -1
- package/dist/chunk-lang-json-2rze3rpy.js +0 -1
- package/dist/chunk-lang-markdown-6w2htnfc.js +0 -6
- package/dist/chunk-lang-rust-24fggcqx.js +0 -1
- package/dist/chunk-lang-sql-gjywb9ke.js +0 -2
- package/dist/chunk-lang-typescript-qh6rebyb.js +0 -1
- package/dist/chunk-menu-items-zjpyj51b.js +0 -2
- package/dist/chunk-notes-sjba7kw3.js +0 -1
- package/dist/chunk-overview-26r77kb6.js +0 -1
- package/dist/chunk-room-confirms-851184ep.js +0 -1
- package/dist/chunk-room-menu-8y9c026y.js +0 -1
- package/dist/chunk-skills-56s4hdbn.js +0 -1
- package/dist/chunk-table-qykpvp32.js +0 -1
- package/dist/chunk-table2d-k60ressj.js +0 -1
- package/dist/chunk-table3d-bv2ajk39.js +0 -4220
- package/dist/chunk-transcript-vekz1mh6.js +0 -1
- package/dist/chunk-workspace-hevefd0d.js +0 -1
- package/dist/chunk-zh-tw-5r2wjre0.js +0 -1
package/src/i18n/zh-tw.ts
CHANGED
|
@@ -266,6 +266,9 @@ export const ZH_TW: Readonly<Record<string, string>> = {
|
|
|
266
266
|
// 進度
|
|
267
267
|
"{name} is working…": "{name}正在處理…",
|
|
268
268
|
"Show the whole stream": "顯示完整串流",
|
|
269
|
+
"{count} earlier tool": "前面還有 {count} 個工具",
|
|
270
|
+
"{count} earlier tools": "前面還有 {count} 個工具",
|
|
271
|
+
"Show fewer tools": "收合工具",
|
|
269
272
|
|
|
270
273
|
// 聊天室選單
|
|
271
274
|
"A thread has no settings.": "討論串沒有設定。",
|
|
@@ -280,6 +283,15 @@ export const ZH_TW: Readonly<Record<string, string>> = {
|
|
|
280
283
|
"Reply to the agent that started this thread.": "回覆開啟這個討論串的夥伴。",
|
|
281
284
|
"Yolo mode": "Yolo 模式",
|
|
282
285
|
"No agents are seated yet.": "圓桌上還沒有夥伴入座。",
|
|
286
|
+
"Who's at the table": "誰上桌",
|
|
287
|
+
"Off the table": "離席中",
|
|
288
|
+
"Leave the table": "離席",
|
|
289
|
+
"{name} left the table": "{name}已離席",
|
|
290
|
+
"The table is empty": "圓桌空了",
|
|
291
|
+
"Every agent has left the table. Choose who sits down.":
|
|
292
|
+
"所有夥伴都離席了。選擇誰要上桌。",
|
|
293
|
+
"An agent who leaves the table is muted: its room stops pushing to you. A card that waits for you is always pushed.":
|
|
294
|
+
"離席的夥伴會被靜音:它的聊天室不再推播給你。等你回應的卡片仍會推播。",
|
|
283
295
|
|
|
284
296
|
// 通知
|
|
285
297
|
"A file is no longer available. Attach it again.":
|
|
@@ -318,8 +330,8 @@ export const ZH_TW: Readonly<Record<string, string>> = {
|
|
|
318
330
|
// 夥伴
|
|
319
331
|
"Class, colors and parts. The picture here, in the rooms and in Discord all follow it.":
|
|
320
332
|
"職業、配色與部件。這裡、聊天室與 Discord 的圖像都會跟著改變。",
|
|
321
|
-
"Follow the assistant (automatic)": "
|
|
322
|
-
"Follow the assistant": "
|
|
333
|
+
"Follow the assistant (automatic)": "跟隨夥伴(自動)",
|
|
334
|
+
"Follow the assistant": "跟隨夥伴",
|
|
323
335
|
Look: "造型",
|
|
324
336
|
Name: "名稱",
|
|
325
337
|
Prompt: "提示詞",
|
|
@@ -338,7 +350,7 @@ export const ZH_TW: Readonly<Record<string, string>> = {
|
|
|
338
350
|
Unreachable: "無法連線",
|
|
339
351
|
"Upstream gateways": "上游閘道",
|
|
340
352
|
"Upstream MCP gateways and virtual servers used by the assistant.":
|
|
341
|
-
"
|
|
353
|
+
"夥伴使用的上游 MCP 閘道與虛擬伺服器。",
|
|
342
354
|
"Used by": "使用者",
|
|
343
355
|
"Virtual servers": "虛擬伺服器",
|
|
344
356
|
|
|
@@ -349,7 +361,7 @@ export const ZH_TW: Readonly<Record<string, string>> = {
|
|
|
349
361
|
running: "進行中",
|
|
350
362
|
"Owner channels": "擁有者頻道",
|
|
351
363
|
"Direct messages and channels where the owner talks to the assistant.":
|
|
352
|
-
"
|
|
364
|
+
"擁有者與夥伴交談的私訊與頻道。",
|
|
353
365
|
"Agent channels": "夥伴頻道",
|
|
354
366
|
"The agent server's one-to-one channels.": "夥伴伺服器的一對一頻道。",
|
|
355
367
|
"Group channels": "群組頻道",
|
|
@@ -386,12 +398,12 @@ export const ZH_TW: Readonly<Record<string, string>> = {
|
|
|
386
398
|
"Search notes": "搜尋記憶",
|
|
387
399
|
Text: "內容",
|
|
388
400
|
"What the assistant remembers. A change applies from the next turn.":
|
|
389
|
-
"
|
|
401
|
+
"夥伴記得的內容。變更會從下一個回合起生效。",
|
|
390
402
|
"Whose notes": "誰的記憶",
|
|
391
403
|
Core: "核心",
|
|
392
404
|
"Carried into every turn.": "每個回合都會帶入。",
|
|
393
405
|
Note: "備忘",
|
|
394
|
-
"Searched when the assistant needs them.": "
|
|
406
|
+
"Searched when the assistant needs them.": "夥伴需要時才會搜尋。",
|
|
395
407
|
Events: "事件",
|
|
396
408
|
"Carried into every turn until their date.": "到期日之前每個回合都會帶入。",
|
|
397
409
|
|
|
@@ -406,7 +418,7 @@ export const ZH_TW: Readonly<Record<string, string>> = {
|
|
|
406
418
|
"Conversations opened through remote MCP; after deletion the session ID cannot be resumed.":
|
|
407
419
|
"透過遠端 MCP 開啟的對話;刪除後無法再用該工作階段 ID 接續。",
|
|
408
420
|
"Direct messages and channels where you mention the assistant. Start over archives; delete removes every archive permanently.":
|
|
409
|
-
"
|
|
421
|
+
"你在私訊與頻道中提及夥伴的對話。重新開始會封存;刪除會永久移除所有封存。",
|
|
410
422
|
"Enabled by {name} at {time}": "由{name}於 {time} 啟用",
|
|
411
423
|
idle: "閒置",
|
|
412
424
|
"Just compacted (limit {limit})": "剛完成壓縮(上限 {limit})",
|
|
@@ -496,6 +508,61 @@ export const ZH_TW: Readonly<Record<string, string>> = {
|
|
|
496
508
|
"Could not copy.": "無法複製。",
|
|
497
509
|
"Could not share.": "無法分享。",
|
|
498
510
|
|
|
511
|
+
// 新增、封存與群組
|
|
512
|
+
"New agent": "新增夥伴",
|
|
513
|
+
"New group": "新增群組",
|
|
514
|
+
Archived: "已封存",
|
|
515
|
+
Archive: "封存",
|
|
516
|
+
"Archive {name}": "封存{name}",
|
|
517
|
+
"Archive {name}?": "要封存{name}嗎?",
|
|
518
|
+
"Archive agent": "封存夥伴",
|
|
519
|
+
"Archive group": "封存群組",
|
|
520
|
+
"Archived {name}.": "已封存{name}。",
|
|
521
|
+
"Restored {name}.": "已還原{name}。",
|
|
522
|
+
"Deleted {name}.": "已刪除{name}。",
|
|
523
|
+
"Delete {name}?": "要刪除{name}嗎?",
|
|
524
|
+
"Made {name}.": "已建立{name}。",
|
|
525
|
+
"Make agent": "建立夥伴",
|
|
526
|
+
"Make group": "建立群組",
|
|
527
|
+
"Making…": "建立中…",
|
|
528
|
+
"Permanent name": "固定名稱",
|
|
529
|
+
"Lowercase letters, digits and dashes, up to 32. It names the room and cannot be changed.":
|
|
530
|
+
"小寫英文字母、數字與連字號,最多 32 個字元。它是聊天室的名稱,建立後無法更改。",
|
|
531
|
+
"Its job, its sources, its limits and how it reports.":
|
|
532
|
+
"它的工作、資料來源、限制,以及怎麼回報。",
|
|
533
|
+
"Opening task": "開場任務",
|
|
534
|
+
"Optional. The agent starts on it as soon as it is made.":
|
|
535
|
+
"可不填。夥伴建立後會立刻開始做。",
|
|
536
|
+
"Your look": "你選的外觀",
|
|
537
|
+
"Suggested from its role": "依角色建議的外觀",
|
|
538
|
+
"Choose a look": "選擇外觀",
|
|
539
|
+
"Use this look": "使用這個外觀",
|
|
540
|
+
"Edit group": "編輯群組",
|
|
541
|
+
"Name, members and host": "名稱、成員與主持人",
|
|
542
|
+
Members: "成員",
|
|
543
|
+
"Pick 2 to 6 agents. They take turns in the order picked.":
|
|
544
|
+
"選 2 到 6 位夥伴。他們依選取的順序輪流發言。",
|
|
545
|
+
Host: "主持人",
|
|
546
|
+
"It stops answering. The history is kept and it can be restored.":
|
|
547
|
+
"它會停止回應。歷史會保留,之後可以還原。",
|
|
548
|
+
"An archived agent stops answering and its schedules are cancelled. Its history is kept, and you can restore it from Archived.":
|
|
549
|
+
"封存後的夥伴不再回應,排程也會取消。歷史會保留,之後可以從「已封存」還原。",
|
|
550
|
+
"{name} stops answering and its schedules are cancelled. A group loses it as a member. The history is kept, and Archived in the room list restores it.":
|
|
551
|
+
"{name}會停止回應,排程也會取消;群組會少掉這位成員。歷史會保留,可以從聊天室列表的「已封存」還原。",
|
|
552
|
+
"Archived agents and groups no longer answer. Their history is kept until you delete them.":
|
|
553
|
+
"已封存的夥伴與群組不再回應。歷史會保留,直到你刪除它們。",
|
|
554
|
+
"Nothing is archived.": "沒有已封存的項目。",
|
|
555
|
+
"{name} and its messages in this app are deleted for good, and the name can be used again. This cannot be undone.":
|
|
556
|
+
"{name}和它在這個應用程式裡的訊息會永久刪除,名稱可以再使用。此動作無法復原。",
|
|
557
|
+
"What the agent can load when a task calls for it. It applies from its next turn.":
|
|
558
|
+
"夥伴在任務需要時可以載入的技能。下一輪對話起生效。",
|
|
559
|
+
"Its file cannot be read.": "讀不到它的檔案。",
|
|
560
|
+
"Built in: every agent carries it.": "內建:每位夥伴都有。",
|
|
561
|
+
"This host has no skills.": "這個主機沒有技能。",
|
|
562
|
+
"Give add or remove.": "請給 add 或 remove。",
|
|
563
|
+
"members must be a list of text.": "members 必須是文字清單。",
|
|
564
|
+
"Give displayName, members or host.": "請給 displayName、members 或 host。",
|
|
565
|
+
|
|
499
566
|
// 聊天室列表
|
|
500
567
|
Agents: "夥伴",
|
|
501
568
|
"Dispatch threads": "派工討論串",
|
|
@@ -578,7 +645,7 @@ export const ZH_TW: Readonly<Record<string, string>> = {
|
|
|
578
645
|
|
|
579
646
|
// 技能
|
|
580
647
|
"All agents": "所有夥伴",
|
|
581
|
-
"Assistant-written": "
|
|
648
|
+
"Assistant-written": "夥伴撰寫",
|
|
582
649
|
"Built-in": "內建",
|
|
583
650
|
Carriers: "搭載對象",
|
|
584
651
|
"File missing": "檔案遺失",
|
|
@@ -608,7 +675,7 @@ export const ZH_TW: Readonly<Record<string, string>> = {
|
|
|
608
675
|
"Tool failed": "工具執行失敗",
|
|
609
676
|
"Tool result": "工具結果",
|
|
610
677
|
User: "使用者",
|
|
611
|
-
Assistant: "
|
|
678
|
+
Assistant: "夥伴",
|
|
612
679
|
"Summary of earlier conversation": "先前對話的摘要",
|
|
613
680
|
|
|
614
681
|
// 伺服器回應
|
|
@@ -654,6 +721,46 @@ export const ZH_TW: Readonly<Record<string, string>> = {
|
|
|
654
721
|
"before and limit must be whole numbers.": "before 與 limit 必須是整數。",
|
|
655
722
|
"Give yolo or longRunning.": "請提供 yolo 或 longRunning。",
|
|
656
723
|
"muted must be true or false.": "muted 必須是 true 或 false。",
|
|
724
|
+
// 分組與置頂
|
|
725
|
+
"Give the folder a name of 1 to 40 characters.": "分組名稱要 1 到 40 個字。",
|
|
726
|
+
"There is no such folder.": "找不到這個分組。",
|
|
727
|
+
"A folder of that name exists.": "已經有同名的分組。",
|
|
728
|
+
"There are 50 folders already.": "分組已達 50 個上限。",
|
|
729
|
+
"before must be a key or null.": "before 必須是聊天室代號或 null。",
|
|
730
|
+
"name must be text.": "name 必須是文字。",
|
|
731
|
+
"Give a name or a place.": "請提供名稱或位置。",
|
|
732
|
+
"A thread stays under its room.": "派工串跟著原本的聊天室。",
|
|
733
|
+
"Home stays at the top.": "首頁固定在最上面。",
|
|
734
|
+
"pinned must be true or false.": "pinned 必須是 true 或 false。",
|
|
735
|
+
"folder must be a folder id or null.": "folder 必須是分組 ID 或 null。",
|
|
736
|
+
"Add a folder": "新增分組",
|
|
737
|
+
"New folder…": "新增分組…",
|
|
738
|
+
"Folder name": "分組名稱",
|
|
739
|
+
"Rename folder": "重新命名分組",
|
|
740
|
+
"Delete folder": "刪除分組",
|
|
741
|
+
"Delete the folder {name}? Its rooms move to Ungrouped; no room is deleted.":
|
|
742
|
+
"刪除分組「{name}」?裡面的聊天室會移到未分組,聊天室本身不會刪除。",
|
|
743
|
+
"Folder menu": "分組選單",
|
|
744
|
+
"Folders and order": "分組與排序",
|
|
745
|
+
"Move to folder…": "移到分組…",
|
|
746
|
+
"No rooms in this folder yet.": "這個分組還沒有聊天室。",
|
|
747
|
+
"Collapse {name}": "收合「{name}」",
|
|
748
|
+
"Expand {name}": "展開「{name}」",
|
|
749
|
+
"{count} room": "{count} 個聊天室",
|
|
750
|
+
"{count} rooms": "{count} 個聊天室",
|
|
751
|
+
Ungrouped: "未分組",
|
|
752
|
+
Pinned: "置頂",
|
|
753
|
+
Pin: "置頂",
|
|
754
|
+
Unpin: "取消置頂",
|
|
755
|
+
Arrange: "整理",
|
|
756
|
+
"Keep this room at the top of the list.": "把這個聊天室固定在清單最上面。",
|
|
757
|
+
"Put this room in a folder, or take it out.":
|
|
758
|
+
"把這個聊天室放進分組,或移出分組。",
|
|
759
|
+
"Move up": "上移",
|
|
760
|
+
"Move down": "下移",
|
|
761
|
+
"Mute the whole folder": "靜音整個分組",
|
|
762
|
+
"Unmute the whole folder": "取消靜音整個分組",
|
|
763
|
+
"Some notifications are off": "部分通知已關閉",
|
|
657
764
|
"This pane is not served.": "沒有提供這個頁面。",
|
|
658
765
|
"The schedule id is a number.": "排程 ID 必須是數字。",
|
|
659
766
|
"There is no such schedule.": "找不到這個排程。",
|
|
@@ -736,7 +843,7 @@ export const ZH_TW: Readonly<Record<string, string>> = {
|
|
|
736
843
|
"character.class.paladin": "聖騎士",
|
|
737
844
|
"character.class.archivist": "檔案管理員",
|
|
738
845
|
// 職業適合的工作
|
|
739
|
-
"character.jobs.wizard": "
|
|
846
|
+
"character.jobs.wizard": "協調者、規劃者、主要夥伴",
|
|
740
847
|
"character.jobs.knight": "審查者、品質把關、守護者",
|
|
741
848
|
"character.jobs.scholar": "研究員、文獻回顧",
|
|
742
849
|
"character.jobs.smith": "程式開發、建置、重構",
|
|
@@ -854,4 +961,196 @@ export const ZH_TW: Readonly<Record<string, string>> = {
|
|
|
854
961
|
"character.accessory.glasses": "眼鏡",
|
|
855
962
|
"character.accessory.freckles": "雀斑",
|
|
856
963
|
"character.accessory.scar": "疤痕",
|
|
964
|
+
|
|
965
|
+
// 主要提示詞與技能內容的編輯
|
|
966
|
+
"Main prompts": "主要提示詞",
|
|
967
|
+
"Edit the main prompts": "編輯主要提示詞",
|
|
968
|
+
"The texts the assistant and the agents start from, with a diff to read before you save and a way back to the file's text.":
|
|
969
|
+
"夥伴們開始工作時所依據的文字;儲存前可檢視差異,也能回到檔案裡的版本。",
|
|
970
|
+
"The texts the assistant and the agents start from. A text you save here replaces the one from the file from the next turn on, until you go back to the file's.":
|
|
971
|
+
"夥伴們開始工作時所依據的文字。你在這裡儲存的文字,從下一回合起取代檔案裡的版本,直到你回到檔案版本為止。",
|
|
972
|
+
"Shared prompt": "共用提示詞",
|
|
973
|
+
"Guest prompt": "訪客提示詞",
|
|
974
|
+
"The base every agent's prompt starts with, the main assistant's included.":
|
|
975
|
+
"每位夥伴的提示詞都以它開頭,主要夥伴也不例外。",
|
|
976
|
+
"Used instead of the shared prompt when the person speaking is not the owner.":
|
|
977
|
+
"說話的人不是擁有者時,改用它取代共用提示詞。",
|
|
978
|
+
"No prompts to edit.": "沒有可編輯的提示詞。",
|
|
979
|
+
"Differs from the file version": "與檔案版本不同",
|
|
980
|
+
"File version cannot be read": "讀不到檔案版本",
|
|
981
|
+
"The file version of this prompt cannot be read, so it cannot be changed here until it can: {reason}":
|
|
982
|
+
"這份提示詞的檔案版本讀不到,在讀得到之前無法在這裡修改:{reason}",
|
|
983
|
+
"Set by {name}, {time}": "由{name}設定,{time}",
|
|
984
|
+
"Revert to the file version": "還原為檔案版本",
|
|
985
|
+
"Revert {name} to the file version?": "要把{name}還原為檔案版本嗎?",
|
|
986
|
+
"Back to the file version.": "已還原為檔案版本。",
|
|
987
|
+
"The text you saved is dropped and the text from the file applies from the next turn. It stays in the history, so you can bring it back.":
|
|
988
|
+
"你儲存的文字會被移除,從下一回合起改用檔案裡的文字。它仍留在歷史中,之後可以再取回。",
|
|
989
|
+
History: "歷史",
|
|
990
|
+
"History of the prompt": "提示詞的歷史",
|
|
991
|
+
"History of {name}": "{name}的歷史",
|
|
992
|
+
"No changes have been kept yet.": "還沒有留下任何更動紀錄。",
|
|
993
|
+
"Back to the file version": "已回到檔案版本",
|
|
994
|
+
"This change": "這次更動",
|
|
995
|
+
"It goes into the editor, where you read it over and save it to put it in force.":
|
|
996
|
+
"它會放進編輯器;檢視差異並儲存後才會生效。",
|
|
997
|
+
"Use this text": "使用這段文字",
|
|
998
|
+
"New skill": "新增技能",
|
|
999
|
+
"Create skill": "建立技能",
|
|
1000
|
+
"Skill created.": "已建立技能。",
|
|
1001
|
+
"This skill cannot be edited here.": "這個技能無法在這裡編輯。",
|
|
1002
|
+
"This skill changed while you were editing it. The changes below are against the version there now; save again to replace it, or go back to edit.":
|
|
1003
|
+
"這個技能在你編輯時被更動了。下方的差異是對照目前的版本;再儲存一次會取代它,或回去繼續編輯。",
|
|
1004
|
+
"Frontmatter holds the name, which cannot change, and a description that starts with “Use when”. The rest is the skill.":
|
|
1005
|
+
"Frontmatter 含有名稱(不能更改)與以「Use when」開頭的描述,其餘就是技能內容。",
|
|
1006
|
+
"Registered skills and their carriers. A skill an agent wrote can be edited here; the others are read-only.":
|
|
1007
|
+
"已登錄的技能與攜帶者。夥伴撰寫的技能可以在這裡編輯,其他的唯讀。",
|
|
1008
|
+
"Built in with the release; it changes with the release.":
|
|
1009
|
+
"隨版本內建;要隨版本更新才會改變。",
|
|
1010
|
+
"From the package {package}; it changes when the package is upgraded.":
|
|
1011
|
+
"來自套件 {package};套件升級時才會改變。",
|
|
1012
|
+
"Linked from {repo}; change it in its repository.":
|
|
1013
|
+
"連結自 {repo};請到它的儲存庫修改。",
|
|
1014
|
+
// 主要提示詞與技能內容的編輯:伺服器的拒絕訊息
|
|
1015
|
+
"This host has no prompts to edit.": "這個主機沒有可編輯的提示詞。",
|
|
1016
|
+
"There is no such prompt.": "沒有這份提示詞。",
|
|
1017
|
+
"base must be the text the prompt was edited from.":
|
|
1018
|
+
"base 必須是編輯所依據的提示詞文字。",
|
|
1019
|
+
"base must be the text the prompt was reverted from.":
|
|
1020
|
+
"base 必須是還原所依據的提示詞文字。",
|
|
1021
|
+
"This prompt changed while you were editing it.":
|
|
1022
|
+
"這份提示詞在你編輯時被更動了。",
|
|
1023
|
+
"baseHash must be the hash the skill was read with.":
|
|
1024
|
+
"baseHash 必須是讀取技能時的雜湊值。",
|
|
1025
|
+
"This skill changed while you were editing it.":
|
|
1026
|
+
"這個技能在你編輯時被更動了。",
|
|
1027
|
+
// 成員、登入與設定關卡
|
|
1028
|
+
Profile: "個人資料",
|
|
1029
|
+
Owner: "擁有者",
|
|
1030
|
+
Admin: "管理員",
|
|
1031
|
+
Member: "成員",
|
|
1032
|
+
"Finish setting up": "完成設定",
|
|
1033
|
+
"Finish setting up first.": "請先完成設定。",
|
|
1034
|
+
"These steps come first. The rest of the app opens when they are done.":
|
|
1035
|
+
"請先完成這些步驟,完成後才能使用其餘功能。",
|
|
1036
|
+
"Push is not available to you.": "你不能使用推播通知。",
|
|
1037
|
+
"You are signed out.": "你已登出。",
|
|
1038
|
+
"This account is not allowed to use this app.":
|
|
1039
|
+
"這個帳號不能使用此應用程式。",
|
|
1040
|
+
"Sign-in did not complete.": "登入沒有完成。",
|
|
1041
|
+
// 主機的聊天室、頁面、卡片與已讀
|
|
1042
|
+
"Host room": "主機聊天室",
|
|
1043
|
+
"No rooms yet.": "還沒有聊天室。",
|
|
1044
|
+
"No messages yet.": "還沒有訊息。",
|
|
1045
|
+
"Nothing here.": "這裡沒有內容。",
|
|
1046
|
+
"Show more": "顯示更多",
|
|
1047
|
+
"Search {name}": "搜尋{name}",
|
|
1048
|
+
"Search…": "搜尋…",
|
|
1049
|
+
"Needs attention": "需要處理",
|
|
1050
|
+
"This page is not available.": "這個頁面無法使用。",
|
|
1051
|
+
"You can read this room but not write in it.":
|
|
1052
|
+
"你可以閱讀這個聊天室,但不能在其中發言。",
|
|
1053
|
+
"Send as": "傳送方式",
|
|
1054
|
+
"Ask the agent": "請夥伴處理",
|
|
1055
|
+
"Earlier cards ({count})": "先前的卡片({count})",
|
|
1056
|
+
Replaced: "已被取代",
|
|
1057
|
+
Image: "圖片",
|
|
1058
|
+
edited: "已編輯",
|
|
1059
|
+
"{count} file was removed": "已移除 {count} 個檔案",
|
|
1060
|
+
"{count} files were removed": "已移除 {count} 個檔案",
|
|
1061
|
+
"{count} unread message": "{count} 則未讀訊息",
|
|
1062
|
+
"{count} unread messages": "{count} 則未讀訊息",
|
|
1063
|
+
"New messages": "新訊息",
|
|
1064
|
+
"Seen by {count}": "已讀 {count}",
|
|
1065
|
+
"More settings": "更多設定",
|
|
1066
|
+
// 主機聊天室與頁面:伺服器的拒絕訊息
|
|
1067
|
+
"There is no such room.": "沒有這個聊天室。",
|
|
1068
|
+
"There is no such page.": "沒有這個頁面。",
|
|
1069
|
+
"input must be an object.": "input 必須是物件。",
|
|
1070
|
+
"input holds text or lists of text.": "input 只能放文字或文字清單。",
|
|
1071
|
+
"action must be text.": "action 必須是文字。",
|
|
1072
|
+
"card must be text.": "card 必須是文字。",
|
|
1073
|
+
"This is not yours to do.": "這個操作不是你可以做的。",
|
|
1074
|
+
"The page's query is too long.": "頁面的查詢參數太長。",
|
|
1075
|
+
"This action takes no form.": "這個操作沒有表單。",
|
|
1076
|
+
"The form has no such field.": "表單沒有這個欄位。",
|
|
1077
|
+
"This field is required.": "這個欄位必填。",
|
|
1078
|
+
"Choose from the list.": "請從清單中選擇。",
|
|
1079
|
+
"This field takes one value.": "這個欄位只能填一個值。",
|
|
1080
|
+
"This field is too long.": "這個欄位的內容太長。",
|
|
1081
|
+
"Give a web address.": "請填入網址。",
|
|
1082
|
+
"The action could not be done.": "無法執行這個操作。",
|
|
1083
|
+
// 通知、設定步驟與帳號連結
|
|
1084
|
+
Notices: "通知",
|
|
1085
|
+
"Notices, {count} waiting": "通知,{count} 則待處理",
|
|
1086
|
+
"Turn on notifications": "開啟通知",
|
|
1087
|
+
"Link your {name} account": "連結你的 {name} 帳號",
|
|
1088
|
+
"Prove which account is yours, so the app knows who you are there.":
|
|
1089
|
+
"證明哪個帳號是你的,讓應用程式知道你在那裡是誰。",
|
|
1090
|
+
"So that you hear when something needs you, even when the app is closed.":
|
|
1091
|
+
"這樣即使應用程式關著,有事找你時你也聽得到。",
|
|
1092
|
+
Urgent: "緊急",
|
|
1093
|
+
Handled: "已處理",
|
|
1094
|
+
"Nothing needs you.": "目前沒有需要你處理的事。",
|
|
1095
|
+
Linked: "已連結",
|
|
1096
|
+
Required: "必填",
|
|
1097
|
+
Recommended: "建議",
|
|
1098
|
+
"The server's configuration links this account.":
|
|
1099
|
+
"這個帳號由伺服器設定連結,無法在這裡移除。",
|
|
1100
|
+
Unlink: "解除連結",
|
|
1101
|
+
"Unlink {name}?": "要解除連結 {name} 嗎?",
|
|
1102
|
+
"The app will no longer know this account is yours. You can link it again later.":
|
|
1103
|
+
"應用程式將不再知道這個帳號是你的。之後可以再連結。",
|
|
1104
|
+
"Your code": "你的驗證碼",
|
|
1105
|
+
"The code works until {time}.": "驗證碼的有效時間到 {time}。",
|
|
1106
|
+
"A code is waiting to be used.": "有一組驗證碼等著被使用。",
|
|
1107
|
+
"{name} used the code. Confirm that this is you.":
|
|
1108
|
+
"{name} 使用了驗證碼。請確認那是你。",
|
|
1109
|
+
"I did it": "我完成了",
|
|
1110
|
+
"Link {name} first.": "請先連結 {name}。",
|
|
1111
|
+
Link: "連結",
|
|
1112
|
+
"In your quiet hours a normal notice waits in the bell instead of ringing your phone. An urgent one still rings.":
|
|
1113
|
+
"勿擾時段內,一般通知只會留在通知鈴裡,不會響手機;緊急通知照常響。",
|
|
1114
|
+
From: "從",
|
|
1115
|
+
To: "到",
|
|
1116
|
+
"Turn off quiet hours": "關閉勿擾時段",
|
|
1117
|
+
"A test notification is on its way.": "測試通知已送出。",
|
|
1118
|
+
"Send a test notification": "傳送測試通知",
|
|
1119
|
+
"Shown as": "顯示為",
|
|
1120
|
+
"The name and picture of this account are what others see in the app.":
|
|
1121
|
+
"別人在應用程式裡看到的,是這個帳號的名稱與頭像。",
|
|
1122
|
+
Automatic: "自動",
|
|
1123
|
+
"Your accounts": "你的帳號",
|
|
1124
|
+
"Put the app on your phone": "把應用程式放到手機上",
|
|
1125
|
+
"On iPhone and iPad, open this page in Safari, tap Share, then Add to Home Screen, and open the app from there.":
|
|
1126
|
+
"在 iPhone 與 iPad 上,用 Safari 開啟此頁,點「分享」,再點「加入主畫面」,之後從主畫面開啟。",
|
|
1127
|
+
"On a phone, add it to the home screen from the browser's menu so notifications reach you when it is closed.":
|
|
1128
|
+
"在手機上,請從瀏覽器選單加入主畫面,這樣應用程式關著時也收得到通知。",
|
|
1129
|
+
"Allow notifications": "允許通知",
|
|
1130
|
+
"This browser cannot get push notifications.": "這個瀏覽器無法接收推播通知。",
|
|
1131
|
+
"Allowed on this device.": "這台裝置已允許。",
|
|
1132
|
+
"Send a test": "傳送測試",
|
|
1133
|
+
"It arrived. Notifications work on this device.":
|
|
1134
|
+
"收到了。這台裝置的通知可以正常運作。",
|
|
1135
|
+
"Waiting for it…": "等待通知中…",
|
|
1136
|
+
"It has not arrived. Check that notifications are allowed for this app, then send another.":
|
|
1137
|
+
"還沒收到。請確認這個應用程式已允許通知,再傳送一次。",
|
|
1138
|
+
Skip: "略過",
|
|
1139
|
+
"{count} device(s) will get notifications.": "{count} 台裝置會收到通知。",
|
|
1140
|
+
Skipped: "已略過",
|
|
1141
|
+
"There is nothing left to set up.": "沒有需要再設定的項目。",
|
|
1142
|
+
"There is no such notice to handle.": "沒有這則可處理的通知。",
|
|
1143
|
+
"This account has no device that gets push yet. Turn it on first.":
|
|
1144
|
+
"這個帳號還沒有接收推播的裝置,請先開啟推播。",
|
|
1145
|
+
"A receipt needs a tag and received or opened.":
|
|
1146
|
+
"回報需要標籤,以及「已收到」或「已開啟」。",
|
|
1147
|
+
"There is no such notification.": "沒有這則通知。",
|
|
1148
|
+
"Send quiet: {start, end, timeZone} or null.":
|
|
1149
|
+
"請傳入 quiet:{start, end, timeZone},或 null。",
|
|
1150
|
+
"Send provider: the account's provider, or null for the default.":
|
|
1151
|
+
"請傳入 provider(帳號的提供者),或 null 使用預設。",
|
|
1152
|
+
"There is no picture.": "沒有頭像。",
|
|
1153
|
+
"Send request: the id the code came with.":
|
|
1154
|
+
"請傳入 request:驗證碼附帶的代號。",
|
|
1155
|
+
"That step cannot be waived.": "這個步驟不能略過。",
|
|
857
1156
|
};
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
// The arrangement of the room list as plain functions over `LayoutView`. The server applies them to
|
|
2
|
+
// the stored layout under a lock and the page applies the same ones at once (optimistic), so a move
|
|
3
|
+
// means the same on both sides. Nothing here touches a database or the DOM.
|
|
4
|
+
|
|
5
|
+
import type { FolderView, LayoutView } from "./api-types.ts";
|
|
6
|
+
|
|
7
|
+
/** The most folders there can be. */
|
|
8
|
+
export const MAX_FOLDERS = 50;
|
|
9
|
+
/** The most code points of a folder's name. */
|
|
10
|
+
export const FOLDER_NAME_MAX = 40;
|
|
11
|
+
|
|
12
|
+
export const EMPTY_LAYOUT: LayoutView = { pins: [], folders: [] };
|
|
13
|
+
|
|
14
|
+
/** Why an edit of the layout was refused. */
|
|
15
|
+
export type LayoutProblem = "bad-name" | "no-folder" | "duplicate" | "full";
|
|
16
|
+
|
|
17
|
+
export class LayoutError extends Error {
|
|
18
|
+
constructor(readonly code: LayoutProblem) {
|
|
19
|
+
super(code);
|
|
20
|
+
this.name = "LayoutError";
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* `list` with `item` standing before `before`, or last when `before` is none or not in the list (a
|
|
26
|
+
* neighbour that was deleted meanwhile). `item` is taken out of its old place first; before itself
|
|
27
|
+
* it stays where it is.
|
|
28
|
+
*/
|
|
29
|
+
export function moveBefore<T>(
|
|
30
|
+
list: readonly T[],
|
|
31
|
+
item: T,
|
|
32
|
+
before: T | null | undefined,
|
|
33
|
+
): T[] {
|
|
34
|
+
if (before === item && list.includes(item)) return [...list];
|
|
35
|
+
const rest = list.filter((one) => one !== item);
|
|
36
|
+
const at =
|
|
37
|
+
before === null || before === undefined ? -1 : rest.indexOf(before);
|
|
38
|
+
if (at < 0) return [...rest, item];
|
|
39
|
+
return [...rest.slice(0, at), item, ...rest.slice(at)];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Where moving `item` one step goes in the list as it is shown: the neighbour it then stands
|
|
44
|
+
* before (`null` = last). Undefined when it is not in the list or already at that end. Reading the
|
|
45
|
+
* neighbour from what is shown keeps a step right when the stored list holds rooms that are hidden.
|
|
46
|
+
*/
|
|
47
|
+
export function nudgeBefore(
|
|
48
|
+
shownList: readonly string[],
|
|
49
|
+
item: string,
|
|
50
|
+
direction: "up" | "down",
|
|
51
|
+
): { before: string | null } | undefined {
|
|
52
|
+
const at = shownList.indexOf(item);
|
|
53
|
+
if (at < 0) return undefined;
|
|
54
|
+
if (direction === "up")
|
|
55
|
+
return at === 0 ? undefined : { before: shownList[at - 1] ?? null };
|
|
56
|
+
return at === shownList.length - 1
|
|
57
|
+
? undefined
|
|
58
|
+
: { before: shownList[at + 2] ?? null };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** A folder's name as stored: trimmed, 1 to 40 code points, without control characters. */
|
|
62
|
+
export function folderNameOf(raw: string): string {
|
|
63
|
+
const name = raw.trim();
|
|
64
|
+
const length = Array.from(name).length;
|
|
65
|
+
if (length < 1 || length > FOLDER_NAME_MAX || /\p{Cc}/u.test(name))
|
|
66
|
+
throw new LayoutError("bad-name");
|
|
67
|
+
return name;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const same = (a: string, b: string): boolean =>
|
|
71
|
+
a.toLocaleLowerCase() === b.toLocaleLowerCase();
|
|
72
|
+
|
|
73
|
+
function folderIndex(layout: LayoutView, id: string): number {
|
|
74
|
+
const at = layout.folders.findIndex((folder) => folder.id === id);
|
|
75
|
+
if (at < 0) throw new LayoutError("no-folder");
|
|
76
|
+
return at;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const withFolders = (
|
|
80
|
+
layout: LayoutView,
|
|
81
|
+
folders: FolderView[],
|
|
82
|
+
): LayoutView => ({ pins: layout.pins, folders });
|
|
83
|
+
|
|
84
|
+
/** The layout with a new last folder. */
|
|
85
|
+
export function createFolder(
|
|
86
|
+
layout: LayoutView,
|
|
87
|
+
id: string,
|
|
88
|
+
rawName: string,
|
|
89
|
+
): LayoutView {
|
|
90
|
+
const name = folderNameOf(rawName);
|
|
91
|
+
if (layout.folders.some((folder) => same(folder.name, name)))
|
|
92
|
+
throw new LayoutError("duplicate");
|
|
93
|
+
if (layout.folders.length >= MAX_FOLDERS) throw new LayoutError("full");
|
|
94
|
+
return withFolders(layout, [...layout.folders, { id, name, rooms: [] }]);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export function renameFolder(
|
|
98
|
+
layout: LayoutView,
|
|
99
|
+
id: string,
|
|
100
|
+
rawName: string,
|
|
101
|
+
): LayoutView {
|
|
102
|
+
const at = folderIndex(layout, id);
|
|
103
|
+
const name = folderNameOf(rawName);
|
|
104
|
+
if (layout.folders.some((f) => f.id !== id && same(f.name, name)))
|
|
105
|
+
throw new LayoutError("duplicate");
|
|
106
|
+
return withFolders(
|
|
107
|
+
layout,
|
|
108
|
+
layout.folders.map((folder, i) =>
|
|
109
|
+
i === at ? { ...folder, name } : folder,
|
|
110
|
+
),
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** The folder moved before another, or last. */
|
|
115
|
+
export function placeFolder(
|
|
116
|
+
layout: LayoutView,
|
|
117
|
+
id: string,
|
|
118
|
+
before: string | null,
|
|
119
|
+
): LayoutView {
|
|
120
|
+
const at = folderIndex(layout, id);
|
|
121
|
+
const moving = layout.folders[at] as FolderView;
|
|
122
|
+
const ids = moveBefore(
|
|
123
|
+
layout.folders.map((folder) => folder.id),
|
|
124
|
+
id,
|
|
125
|
+
before,
|
|
126
|
+
);
|
|
127
|
+
return withFolders(
|
|
128
|
+
layout,
|
|
129
|
+
ids.map((one) =>
|
|
130
|
+
one === id
|
|
131
|
+
? moving
|
|
132
|
+
: (layout.folders.find((folder) => folder.id === one) as FolderView),
|
|
133
|
+
),
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** The layout without the folder; its rooms are in no folder. */
|
|
138
|
+
export function removeFolder(layout: LayoutView, id: string): LayoutView {
|
|
139
|
+
folderIndex(layout, id);
|
|
140
|
+
return withFolders(
|
|
141
|
+
layout,
|
|
142
|
+
layout.folders.filter((folder) => folder.id !== id),
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** The layout without a room: not pinned and in no folder. For a room that is gone for good. */
|
|
147
|
+
export const forgetRoom = (layout: LayoutView, room: string): LayoutView => ({
|
|
148
|
+
pins: layout.pins.filter((one) => one !== room),
|
|
149
|
+
folders: layout.folders.map((folder) =>
|
|
150
|
+
folder.rooms.includes(room)
|
|
151
|
+
? { ...folder, rooms: folder.rooms.filter((one) => one !== room) }
|
|
152
|
+
: folder,
|
|
153
|
+
),
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* A room into a folder before another room of it (or last), or into none with `folder` null. A
|
|
158
|
+
* room is in one place, so it leaves its pin and its old folder.
|
|
159
|
+
*/
|
|
160
|
+
export function placeRoom(
|
|
161
|
+
layout: LayoutView,
|
|
162
|
+
room: string,
|
|
163
|
+
folder: string | null,
|
|
164
|
+
before: string | null,
|
|
165
|
+
): LayoutView {
|
|
166
|
+
if (folder !== null) folderIndex(layout, folder);
|
|
167
|
+
const clear = forgetRoom(layout, room);
|
|
168
|
+
if (folder === null) return clear;
|
|
169
|
+
return withFolders(
|
|
170
|
+
clear,
|
|
171
|
+
clear.folders.map((one) =>
|
|
172
|
+
one.id === folder
|
|
173
|
+
? { ...one, rooms: moveBefore(one.rooms, room, before) }
|
|
174
|
+
: one,
|
|
175
|
+
),
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/** A room pinned before another pinned room (or last), or unpinned. A pinned room leaves its folder. */
|
|
180
|
+
export function setPinned(
|
|
181
|
+
layout: LayoutView,
|
|
182
|
+
room: string,
|
|
183
|
+
pinned: boolean,
|
|
184
|
+
before: string | null,
|
|
185
|
+
): LayoutView {
|
|
186
|
+
const clear = forgetRoom(layout, room);
|
|
187
|
+
if (!pinned) return clear;
|
|
188
|
+
return {
|
|
189
|
+
pins: moveBefore(
|
|
190
|
+
layout.pins.filter((one) => one !== room),
|
|
191
|
+
room,
|
|
192
|
+
before,
|
|
193
|
+
),
|
|
194
|
+
folders: clear.folders,
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/** The layout with only the rooms `known` accepts, for a reader who must not see a deleted agent's room. */
|
|
199
|
+
export function shown(
|
|
200
|
+
layout: LayoutView,
|
|
201
|
+
known: (room: string) => boolean,
|
|
202
|
+
): LayoutView {
|
|
203
|
+
return {
|
|
204
|
+
pins: layout.pins.filter(known),
|
|
205
|
+
folders: layout.folders.map((folder) => ({
|
|
206
|
+
...folder,
|
|
207
|
+
rooms: folder.rooms.filter(known),
|
|
208
|
+
})),
|
|
209
|
+
};
|
|
210
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ConsoleHttpError as HttpError, json } from "../http.ts";
|
|
2
|
+
import type { FrameHandler, PluggedFrames, RouteArea } from "../web-app.ts";
|
|
3
|
+
import type { NoticeService } from "./service.ts";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* `GET api/notices` and `POST api/notices/<tag>/ack`. Both are the signed-in person's own: the
|
|
7
|
+
* principal is the session's, and a notice not addressed to them answers 404 as if there were none.
|
|
8
|
+
*/
|
|
9
|
+
export function noticesArea(notices: NoticeService): RouteArea {
|
|
10
|
+
return {
|
|
11
|
+
area: "notices",
|
|
12
|
+
async handle(request, parts, { visitor }) {
|
|
13
|
+
try {
|
|
14
|
+
const principalId = visitor.principal.id;
|
|
15
|
+
const [tag, action] = parts;
|
|
16
|
+
if (tag === undefined && request.method === "GET")
|
|
17
|
+
return json(await notices.listFor(principalId));
|
|
18
|
+
if (tag !== undefined && action === "ack" && parts.length === 2) {
|
|
19
|
+
if (request.method !== "POST")
|
|
20
|
+
throw new HttpError(405, "Method not allowed.");
|
|
21
|
+
if (!(await notices.ack(tag, principalId)))
|
|
22
|
+
throw new HttpError(404, "There is no such notice to handle.");
|
|
23
|
+
return json({ ok: true });
|
|
24
|
+
}
|
|
25
|
+
throw new HttpError(404, "There is no such API.");
|
|
26
|
+
} catch (error) {
|
|
27
|
+
if (error instanceof HttpError)
|
|
28
|
+
return json({ error: error.message }, error.status);
|
|
29
|
+
throw error;
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** The `ack` frame: the person handled a notice. A notice that is not theirs, or needs no answer, is refused. */
|
|
36
|
+
export function ackFrame(
|
|
37
|
+
notices: NoticeService,
|
|
38
|
+
): FrameHandler<PluggedFrames["ack"]> {
|
|
39
|
+
return async ({ frame, viewer, refuse }) => {
|
|
40
|
+
if (!(await notices.ack(frame.tag, viewer.principalId)))
|
|
41
|
+
refuse("not_accepted");
|
|
42
|
+
};
|
|
43
|
+
}
|