@celljs/ta 4.11.0 → 4.12.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/dist/pi/CHANGELOG.md +4 -0
- package/dist/pi/package.json +1 -1
- package/dist/pi/packages/ta-agents/extension/index.mjs +194 -17
- package/dist/pi/packages/ta-agents/lib/acp-protocol.d.ts +5 -0
- package/dist/pi/packages/ta-agents/lib/agent-prompt.d.ts +4 -1
- package/dist/pi/packages/ta-agents/lib/agent-prompt.js +8 -2
- package/dist/pi/packages/ta-agents/lib/agent-session.d.ts +70 -2
- package/dist/pi/packages/ta-agents/lib/agent-session.js +176 -18
- package/dist/pi/packages/ta-agents/lib/agent-streamer.js +16 -2
- package/dist/pi/packages/ta-agents/lib/agent-tool.js +1 -1
- package/dist/pi/packages/ta-agents/lib/agent-turn.d.ts +7 -1
- package/dist/pi/packages/ta-agents/lib/agent-turn.js +26 -3
- package/dist/pi/packages/ta-agents/lib/extension.js +7 -0
- package/dist/pi/packages/ta-agents/lib/texts.d.ts +12 -0
- package/dist/pi/packages/ta-agents/lib/texts.js +12 -0
- package/dist/pi/packages/ta-agents/package.json +1 -1
- package/dist/pi/packages/ta-bots/package.json +1 -1
- package/dist/pi/packages/ta-changes/package.json +1 -1
- package/dist/pi/packages/ta-channels/lib/sidebar.js +31 -13
- package/dist/pi/packages/ta-channels/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-channels/lib/style.js +3 -0
- package/dist/pi/packages/ta-channels/lib/views.d.ts +12 -0
- package/dist/pi/packages/ta-channels/lib/views.js +19 -0
- package/dist/pi/packages/ta-channels/package.json +1 -1
- package/dist/pi/packages/ta-channels/web/index.js +54 -9
- package/dist/pi/packages/ta-computer-use/package.json +1 -1
- package/dist/pi/packages/ta-cron/package.json +1 -1
- package/dist/pi/packages/ta-extensions/package.json +1 -1
- package/dist/pi/packages/ta-extensions/skills/ta-package/SKILL.md +1 -0
- package/dist/pi/packages/ta-games/package.json +1 -1
- package/dist/pi/packages/ta-glance/lib/card.js +5 -4
- package/dist/pi/packages/ta-glance/lib/glance-spec.d.ts +2 -1
- package/dist/pi/packages/ta-glance/lib/glance-spec.js +8 -6
- package/dist/pi/packages/ta-glance/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-glance/lib/style.js +178 -101
- package/dist/pi/packages/ta-glance/package.json +1 -1
- package/dist/pi/packages/ta-glance/web/index.js +189 -109
- package/dist/pi/packages/ta-launcher/package.json +1 -1
- package/dist/pi/packages/ta-manual/lib/pictures-c.d.ts +2 -0
- package/dist/pi/packages/ta-manual/lib/pictures-c.js +53 -0
- package/dist/pi/packages/ta-manual/lib/pictures.js +2 -1
- package/dist/pi/packages/ta-manual/lib/topics.d.ts +1 -0
- package/dist/pi/packages/ta-manual/lib/topics.js +35 -1
- package/dist/pi/packages/ta-manual/package.json +1 -1
- package/dist/pi/packages/ta-manual/skills/ta-manual/SKILL.md +11 -0
- package/dist/pi/packages/ta-manual/web/index.js +186 -1
- package/dist/pi/packages/ta-notify/package.json +1 -1
- package/dist/pi/packages/ta-recall/extension/index.mjs +2 -1
- package/dist/pi/packages/ta-recall/lib/conversations.js +6 -0
- package/dist/pi/packages/ta-recall/lib/extension.js +5 -4
- package/dist/pi/packages/ta-recall/package.json +1 -1
- package/dist/pi/packages/ta-recall/web/index.js +4 -0
- package/dist/pi/packages/ta-rooms/README.en.md +8 -2
- package/dist/pi/packages/ta-rooms/README.md +8 -2
- package/dist/pi/packages/ta-rooms/extension/index.mjs +362 -0
- package/dist/pi/packages/ta-rooms/host/index.mjs +966 -0
- package/dist/pi/packages/ta-rooms/lib/agents-view.d.ts +25 -0
- package/dist/pi/packages/ta-rooms/lib/agents-view.js +128 -0
- package/dist/pi/packages/ta-rooms/lib/double-host.d.ts +114 -0
- package/dist/pi/packages/ta-rooms/lib/double-host.js +645 -0
- package/dist/pi/packages/ta-rooms/lib/double-i18n.d.ts +85 -0
- package/dist/pi/packages/ta-rooms/lib/double-i18n.js +172 -0
- package/dist/pi/packages/ta-rooms/lib/double-protocol.d.ts +165 -0
- package/dist/pi/packages/ta-rooms/lib/double-protocol.js +73 -0
- package/dist/pi/packages/ta-rooms/lib/double-util.d.ts +99 -0
- package/dist/pi/packages/ta-rooms/lib/double-util.js +180 -0
- package/dist/pi/packages/ta-rooms/lib/doubles-store.d.ts +45 -0
- package/dist/pi/packages/ta-rooms/lib/doubles-store.js +145 -0
- package/dist/pi/packages/ta-rooms/lib/doubles-view.d.ts +34 -0
- package/dist/pi/packages/ta-rooms/lib/doubles-view.js +223 -0
- package/dist/pi/packages/ta-rooms/lib/extension.d.ts +24 -0
- package/dist/pi/packages/ta-rooms/lib/extension.js +176 -0
- package/dist/pi/packages/ta-rooms/lib/host.d.ts +7 -0
- package/dist/pi/packages/ta-rooms/lib/host.js +18 -0
- package/dist/pi/packages/ta-rooms/lib/i18n.d.ts +4 -0
- package/dist/pi/packages/ta-rooms/lib/i18n.js +8 -0
- package/dist/pi/packages/ta-rooms/lib/index.js +23 -2
- package/dist/pi/packages/ta-rooms/lib/members-view.js +32 -2
- package/dist/pi/packages/ta-rooms/lib/page.d.ts +57 -8
- package/dist/pi/packages/ta-rooms/lib/page.js +121 -27
- package/dist/pi/packages/ta-rooms/lib/room-view.d.ts +2 -4
- package/dist/pi/packages/ta-rooms/lib/room-view.js +52 -34
- package/dist/pi/packages/ta-rooms/lib/rooms-home.d.ts +32 -0
- package/dist/pi/packages/ta-rooms/lib/rooms-home.js +141 -0
- package/dist/pi/packages/ta-rooms/lib/rooms-page.d.ts +8 -2
- package/dist/pi/packages/ta-rooms/lib/rooms-page.js +64 -21
- package/dist/pi/packages/ta-rooms/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-rooms/lib/style.js +96 -45
- package/dist/pi/packages/ta-rooms/package.json +9 -3
- package/dist/pi/packages/ta-rooms/web/index.js +1380 -147
- package/dist/pi/packages/ta-share/lib/shares-page.js +35 -11
- package/dist/pi/packages/ta-share/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-share/lib/style.js +11 -5
- package/dist/pi/packages/ta-share/package.json +1 -1
- package/dist/pi/packages/ta-share/web/index.js +45 -18
- package/dist/pi/packages/ta-workspace/package.json +1 -1
- package/dist/public/assets/{abnfDiagram-S7VZAUFO-D9uU0Tx2.js → abnfDiagram-S7VZAUFO-BnqtcbpZ.js} +1 -1
- package/dist/public/assets/{architecture-WOLXFQ4H-f7Nm7EIo.js → architecture-WOLXFQ4H-BzPq1Ioe.js} +1 -1
- package/dist/public/assets/{architectureDiagram-YGSQEFNW-DSAqlcms.js → architectureDiagram-YGSQEFNW-BsquO3a7.js} +1 -1
- package/dist/public/assets/{blockDiagram-APKKGZFW-C0lPIW9g.js → blockDiagram-APKKGZFW-BQNYOEP4.js} +1 -1
- package/dist/public/assets/{browser-WLpgVYno.js → browser-DS711n7Y.js} +1 -1
- package/dist/public/assets/{c4Diagram-KJ2TOQU5-CDcZ7mJq.js → c4Diagram-KJ2TOQU5-D6e79Ycq.js} +1 -1
- package/dist/public/assets/{chunk-6MUBBAK2-CXPuyqPL.js → chunk-6MUBBAK2-B-sgaPoU.js} +1 -1
- package/dist/public/assets/{chunk-AXFCVDMN-Du6JRX1x.js → chunk-AXFCVDMN-D8pJKIg2.js} +1 -1
- package/dist/public/assets/{chunk-BG4553SI-D592E55X.js → chunk-BG4553SI-86TL-vCz.js} +1 -1
- package/dist/public/assets/{chunk-DQASFODM-BW2r2SL4.js → chunk-DQASFODM-CfUVuGjc.js} +1 -1
- package/dist/public/assets/{chunk-HFQBQIA3-C3yoe54R.js → chunk-HFQBQIA3-Drm0FEYk.js} +1 -1
- package/dist/public/assets/{chunk-KQLB2F66-DF8gfYCy.js → chunk-KQLB2F66-BVFRADlC.js} +1 -1
- package/dist/public/assets/{chunk-KS47KZWR-C8CRMTv1.js → chunk-KS47KZWR-DfyALEmP.js} +1 -1
- package/dist/public/assets/{chunk-LEVMRMFU-BDcMKiwj.js → chunk-LEVMRMFU-DtJVzk2c.js} +1 -1
- package/dist/public/assets/{chunk-M57EVK23-CKJPBygc.js → chunk-M57EVK23-DTy27PHQ.js} +1 -1
- package/dist/public/assets/{chunk-OY52VR5R-B3ZWH07L.js → chunk-OY52VR5R-nSgn7jZg.js} +1 -1
- package/dist/public/assets/{chunk-QB3YPZ4I-DI-z4UPL.js → chunk-QB3YPZ4I-CkSxO_X6.js} +1 -1
- package/dist/public/assets/{chunk-R3KSYZAL-Bg4-haAc.js → chunk-R3KSYZAL-Ck6iAjAL.js} +1 -1
- package/dist/public/assets/{chunk-STOXU5M4-l_SHib3p.js → chunk-STOXU5M4-DQPHdSTh.js} +1 -1
- package/dist/public/assets/{chunk-TU62E6Q5-BINu9tIm.js → chunk-TU62E6Q5-Bc2AbV2Y.js} +1 -1
- package/dist/public/assets/{chunk-X4PVCEUW-BQn-mvV5.js → chunk-X4PVCEUW-Cgpm0IXm.js} +1 -1
- package/dist/public/assets/{chunk-XXDRQBXY-uvpAu0Ys.js → chunk-XXDRQBXY-CGE4eLpg.js} +1 -1
- package/dist/public/assets/{classDiagram-v2-L25IHNXF-BIowooW1.js → classDiagram-v2-L25IHNXF-4eQuDPEo.js} +1 -1
- package/dist/public/assets/{cose-bilkent-JH36ORCC-BTyx1Mh2.js → cose-bilkent-JH36ORCC-tDLCWq07.js} +1 -1
- package/dist/public/assets/cynefin-EF2NZ3EQ-Dd40W2Jh.js +1 -0
- package/dist/public/assets/{cynefinDiagram-L36ESFBY-D64EU9I0.js → cynefinDiagram-L36ESFBY-ByqcZ8x9.js} +1 -1
- package/dist/public/assets/{d3-selection-CN9k6_B9.js → d3-selection-Bgn1374-.js} +1 -1
- package/dist/public/assets/{dagre-SPEB5RXH-FCbz2-Kk.js → dagre-SPEB5RXH-mCgr71mV.js} +1 -1
- package/dist/public/assets/{diagram-3B7GL73J-OhHUSI7j.js → diagram-3B7GL73J-DpYSwpQ0.js} +1 -1
- package/dist/public/assets/{diagram-DNEMPZML-Be4xMtp6.js → diagram-DNEMPZML-DMozUQzi.js} +1 -1
- package/dist/public/assets/{diagram-L3MUGCDN-CmKSs3aG.js → diagram-L3MUGCDN-Bk5Uf8PD.js} +1 -1
- package/dist/public/assets/{diagram-LA4NIPWU-D1C32rMN.js → diagram-LA4NIPWU-DFt5cPVK.js} +1 -1
- package/dist/public/assets/{diagram-MHCOC4E2-BjoE6JXs.js → diagram-MHCOC4E2-BkZZcKqK.js} +1 -1
- package/dist/public/assets/{diagram-XPFHEONP-B22k4v8R.js → diagram-XPFHEONP-HEY6kyyN.js} +1 -1
- package/dist/public/assets/{dist-DcBP8Cf6.js → dist-Bj2CrKn7.js} +1 -1
- package/dist/public/assets/{ebnfDiagram-UZSYDL2S-Tn-K8-X7.js → ebnfDiagram-UZSYDL2S-D4JvYyVb.js} +1 -1
- package/dist/public/assets/{editor.api-Bz4sjRz_.js → editor.api-BpJFzYbl.js} +1 -1
- package/dist/public/assets/{elk-XV6XMXQE-COnQsWlN.js → elk-XV6XMXQE-CT6qLJkF.js} +1 -1
- package/dist/public/assets/{erDiagram-EYBAPDEH-c53dJilq.js → erDiagram-EYBAPDEH-BGng1goR.js} +1 -1
- package/dist/public/assets/{eventmodeling-K75KTNOO-DaFpPPks.js → eventmodeling-K75KTNOO-Tt8O-Q1Z.js} +1 -1
- package/dist/public/assets/flowDiagram-MALGAFMO-uFzenfA3.js +1 -0
- package/dist/public/assets/{freemarker2-BLxfRHsw.js → freemarker2-Dd5ksoRn.js} +1 -1
- package/dist/public/assets/{ganttDiagram-23REXITY-Md-SavIS.js → ganttDiagram-23REXITY-Jl8VO_g2.js} +1 -1
- package/dist/public/assets/gitGraph-VSP46ZUC-D28I_jUc.js +1 -0
- package/dist/public/assets/{gitGraphDiagram-STJD7YCW-CMSwTghO.js → gitGraphDiagram-STJD7YCW-Be4qXALb.js} +1 -1
- package/dist/public/assets/{handlebars-sNpu01kP.js → handlebars-4xabgUi4.js} +1 -1
- package/dist/public/assets/{html-C_tKd-uP.js → html-Dk3kt2w_.js} +1 -1
- package/dist/public/assets/{index-Bn86rI4n.js → index-Bx0c7eoh.js} +2 -2
- package/dist/public/assets/info-OHQRW6UA-5vIGEIq7.js +1 -0
- package/dist/public/assets/{infoDiagram-KBXO4MBG-CwgNj-7i.js → infoDiagram-KBXO4MBG-Coc0tdwb.js} +1 -1
- package/dist/public/assets/{ishikawaDiagram-M35NCXHK-BSlzQNMN.js → ishikawaDiagram-M35NCXHK-CE_1VQCg.js} +1 -1
- package/dist/public/assets/{javascript-l3qKw0L-.js → javascript-DKLGqy6v.js} +1 -1
- package/dist/public/assets/{journeyDiagram-OPLOXDXO-B09LPEnF.js → journeyDiagram-OPLOXDXO-CrolRZ_7.js} +1 -1
- package/dist/public/assets/{jsonMode-5SQQn1EX.js → jsonMode-Chcs19_y.js} +1 -1
- package/dist/public/assets/{kanban-definition-BZKZHSQY-BiW4aJ29.js → kanban-definition-BZKZHSQY-CjJj47De.js} +1 -1
- package/dist/public/assets/{liquid-BGyTIIUt.js → liquid-jff3p-Ji.js} +1 -1
- package/dist/public/assets/{mdx-8tGjz4em.js → mdx-DW4uRDfJ.js} +1 -1
- package/dist/public/assets/{mermaid-parser.core-CctN5b0z.js → mermaid-parser.core-XhQj6FvH.js} +3 -3
- package/dist/public/assets/{mermaid.core-7ERSdZ4-.js → mermaid.core-OD4Atimg.js} +4 -4
- package/dist/public/assets/{mindmap-definition-I2QAS2VK-D-GOUwW1.js → mindmap-definition-I2QAS2VK-DpGelVY7.js} +1 -1
- package/dist/public/assets/module-CrD0OHQp.js +1 -0
- package/dist/public/assets/module-DEBMgdtf.js +2273 -0
- package/dist/public/assets/{monaco-B_9hlk78.js → monaco-BTVZP-tU.js} +3 -3
- package/dist/public/assets/packet-JDAUHWVQ-CBxQ5Mzy.js +1 -0
- package/dist/public/assets/{pegDiagram-FD4XPPHP-Dmy1fWB3.js → pegDiagram-FD4XPPHP-CqcBmPfB.js} +1 -1
- package/dist/public/assets/pie-XZMESJXO-DT5V3581.js +1 -0
- package/dist/public/assets/{pieDiagram-J4AKIIQI-CXFHLYTg.js → pieDiagram-J4AKIIQI-CRir3beB.js} +1 -1
- package/dist/public/assets/{python-e-JK0s5M.js → python-BwW_0207.js} +1 -1
- package/dist/public/assets/{quadrantDiagram-XTYBLID2-RQvEpGWO.js → quadrantDiagram-XTYBLID2-DIY6gdcf.js} +1 -1
- package/dist/public/assets/radar-ABXABTNO-BAOovYEa.js +1 -0
- package/dist/public/assets/railroad-I3PHUGI6-RZ2Rnwzh.js +1 -0
- package/dist/public/assets/{railroad-abnf-LNEFI6M7-CDOSPZwX.js → railroad-abnf-LNEFI6M7-XWNOzunl.js} +1 -1
- package/dist/public/assets/{railroad-ebnf-DWYD2UWJ-BTrNQ0DX.js → railroad-ebnf-DWYD2UWJ-CI0-j1Jz.js} +1 -1
- package/dist/public/assets/{railroad-peg-JR7BVNR7-B7NtVofS.js → railroad-peg-JR7BVNR7-BVB_IaIG.js} +1 -1
- package/dist/public/assets/{railroadDiagram-MRQ6NCDL-DsDrT0Jf.js → railroadDiagram-MRQ6NCDL-CudwT6q2.js} +1 -1
- package/dist/public/assets/{razor-DtSPwumi.js → razor-DrjCyQqB.js} +1 -1
- package/dist/public/assets/{requirementDiagram-Y7LWUY3S-BQh0hFuA.js → requirementDiagram-Y7LWUY3S-CvRMeRqj.js} +1 -1
- package/dist/public/assets/{sankeyDiagram-WGJFYUXA-BUXNAQEF.js → sankeyDiagram-WGJFYUXA-adxYCJKr.js} +1 -1
- package/dist/public/assets/{sequenceDiagram-5NDRBG5M-05f-N5V_.js → sequenceDiagram-5NDRBG5M-lCRsoLUp.js} +1 -1
- package/dist/public/assets/{stateDiagram-v2-FJ4FJNEA-D6V1fGWV.js → stateDiagram-v2-FJ4FJNEA-DNst1BLg.js} +1 -1
- package/dist/public/assets/{swimlanes-UMQ2AFYF-DWhlPvKs.js → swimlanes-UMQ2AFYF-S_omrdvA.js} +1 -1
- package/dist/public/assets/swimlanesDiagram-OMPLPG4O-By5lnz4u.js +8 -0
- package/dist/public/assets/{timeline-definition-SEUHKTQE-CMdocOui.js → timeline-definition-SEUHKTQE-_pMGrTE-.js} +1 -1
- package/dist/public/assets/treeView-D4JQ5SDB-Cyb9N8KY.js +1 -0
- package/dist/public/assets/treemap-SAJKECNS-BkMo57pG.js +1 -0
- package/dist/public/assets/{typescript-65jNyipU.js → typescript-0-z_OYCU.js} +1 -1
- package/dist/public/assets/{usecaseDiagram-AFA6YXN4-BQTHUX1f.js → usecaseDiagram-AFA6YXN4-B2oJKi5Q.js} +1 -1
- package/dist/public/assets/{vennDiagram-NNMJR3RB-BULkVTfA.js → vennDiagram-NNMJR3RB-inPs2Kkr.js} +1 -1
- package/dist/public/assets/wardley-7MLQ67FV-CSt-uQ-Y.js +1 -0
- package/dist/public/assets/{wardleyDiagram-S7YFUSEH-Cek6l8lz.js → wardleyDiagram-S7YFUSEH-DNhNHM7b.js} +1 -1
- package/dist/public/assets/{xml-DWBejfu-.js → xml-BXPxQzKF.js} +1 -1
- package/dist/public/assets/{xychartDiagram-GGNKY7IX-ujnZQTWA.js → xychartDiagram-GGNKY7IX-DJc93dNT.js} +1 -1
- package/dist/public/assets/{yaml-CwRCT7q1.js → yaml-CGmD9Rya.js} +1 -1
- package/dist/public/index.html +1 -1
- package/dist/serve/index.mjs +1222 -727
- package/package.json +31 -31
- package/dist/public/assets/cynefin-EF2NZ3EQ-Dg54eFzZ.js +0 -1
- package/dist/public/assets/flowDiagram-MALGAFMO-V5qkYWIO.js +0 -1
- package/dist/public/assets/gitGraph-VSP46ZUC-1q8ldRXU.js +0 -1
- package/dist/public/assets/info-OHQRW6UA-Crere6sx.js +0 -1
- package/dist/public/assets/module-DEqsdd00.js +0 -1
- package/dist/public/assets/module-TWc52XwT.js +0 -2244
- package/dist/public/assets/packet-JDAUHWVQ-qMf5LkHT.js +0 -1
- package/dist/public/assets/pie-XZMESJXO-BjqLn4qm.js +0 -1
- package/dist/public/assets/radar-ABXABTNO-DWO6t_4C.js +0 -1
- package/dist/public/assets/railroad-I3PHUGI6-D1XOJPWy.js +0 -1
- package/dist/public/assets/swimlanesDiagram-OMPLPG4O-CRn5uHsY.js +0 -8
- package/dist/public/assets/treeView-D4JQ5SDB-D09wHNzT.js +0 -1
- package/dist/public/assets/treemap-SAJKECNS-ChxAT7Fq.js +0 -1
- package/dist/public/assets/wardley-7MLQ67FV-DfSjKzbJ.js +0 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const NO_SERVER = "Rooms need the Ta service: start it with `ta serve`. In Ta in a terminal there are none.";
|
|
2
|
+
interface Pi {
|
|
3
|
+
events: {
|
|
4
|
+
emit(event: string, data: unknown): void;
|
|
5
|
+
};
|
|
6
|
+
on(event: string, handler: (event: never, ctx: never) => unknown): unknown;
|
|
7
|
+
registerTool(tool: never): unknown;
|
|
8
|
+
getActiveTools(): string[];
|
|
9
|
+
getAllTools(): {
|
|
10
|
+
name: string;
|
|
11
|
+
}[];
|
|
12
|
+
setActiveTools(names: string[]): void;
|
|
13
|
+
}
|
|
14
|
+
/** A path of a call of a tool of files, inside the directory the user let the double work in. */
|
|
15
|
+
export declare function inside(cwd: string, path: unknown): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* The pi extension of the rooms: in the session of a double in a room (its role has ROOM_DOUBLE_MARK), only the tools its
|
|
18
|
+
* permissions allow, for the one it answers now, and no instructions or skills of the user's that it may not read; so too
|
|
19
|
+
* for an agent of the user others ask in a room, while one the user asks works with all its tools. In the user's own
|
|
20
|
+
* conversations, the tools to act in rooms for them. The doubles are the host's (double-host.ts).
|
|
21
|
+
*/
|
|
22
|
+
export default function activate(pi: Pi): void;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=extension.d.ts.map
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NO_SERVER = void 0;
|
|
4
|
+
exports.inside = inside;
|
|
5
|
+
exports.default = activate;
|
|
6
|
+
const node_path_1 = require("node:path");
|
|
7
|
+
const ta_extension_host_1 = require("@celljs/ta-protocol/lib/common/ta-extension-host");
|
|
8
|
+
const double_protocol_1 = require("./double-protocol");
|
|
9
|
+
const double_util_1 = require("./double-util");
|
|
10
|
+
exports.NO_SERVER = 'Rooms need the Ta service: start it with `ta serve`. In Ta in a terminal there are none.';
|
|
11
|
+
/** In the role of the agents of ta-channels (AGENT_MARK there, which this bundle does not import): they do not act in rooms. */
|
|
12
|
+
const AGENT_MARK = 'one of the agents of Ta';
|
|
13
|
+
/** pi's tools an agent the user asks in a room has at least. */
|
|
14
|
+
const OWN_TOOLS = ['read', 'bash', 'edit', 'write'];
|
|
15
|
+
/** The tools of a double in a room (DoubleUtil.ROOM_TOOLS): what it may do with no permission, and asking for one. */
|
|
16
|
+
const DOUBLE_TOOLS = [
|
|
17
|
+
{
|
|
18
|
+
name: 'room_state',
|
|
19
|
+
label: 'Room state',
|
|
20
|
+
description: 'Reads the shared state of the room you are answering in (what its game or app keeps), by key: all of it, or the keys that start with prefix.',
|
|
21
|
+
parameters: { type: 'object', properties: { prefix: { type: 'string' } } },
|
|
22
|
+
run: (doubles, params, file) => doubles.roomState(file, typeof params.prefix === 'string' ? params.prefix : undefined),
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: 'room_set_state',
|
|
26
|
+
label: 'Set room state',
|
|
27
|
+
description: 'Sets a key of the shared state of the room you are answering in, as its game or app keeps it (null clears it). Say things in your reply, not here.',
|
|
28
|
+
parameters: { type: 'object', properties: { key: { type: 'string' }, value: {} }, required: ['key', 'value'] },
|
|
29
|
+
run: (doubles, params, file) => { var _a; return doubles.setRoomState(file, String((_a = params.key) !== null && _a !== void 0 ? _a : ''), params.value); },
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: 'ask_permission',
|
|
33
|
+
label: 'Ask permission',
|
|
34
|
+
description: "Asks your user to let you work on their computer for the one who asked you: 'files' to read and change files of a directory, 'commands' to run commands there. Your user answers in Ta, and picks the directory; tell the one who asked that it is asked.",
|
|
35
|
+
parameters: {
|
|
36
|
+
type: 'object',
|
|
37
|
+
properties: { capability: { type: 'string', enum: [...double_protocol_1.ROOM_CAPABILITIES] }, reason: { type: 'string', description: 'What for, in one sentence.' } },
|
|
38
|
+
required: ['capability', 'reason'],
|
|
39
|
+
},
|
|
40
|
+
run: (doubles, params, file) => doubles.askPermission(file, params.capability, params.reason),
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
/** The tools of the user's own conversations to act in rooms for them (USER_TOOLS). */
|
|
44
|
+
const USER_ROOM_TOOLS = [
|
|
45
|
+
{
|
|
46
|
+
name: 'list_rooms',
|
|
47
|
+
label: 'List rooms',
|
|
48
|
+
description: "Lists the rooms of Ta the user is in (group chats shared with other people's Ta) and who is in each.",
|
|
49
|
+
parameters: { type: 'object', properties: {} },
|
|
50
|
+
run: doubles => doubles.listRooms(),
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'read_room',
|
|
54
|
+
label: 'Read room',
|
|
55
|
+
description: 'Reads what was said lately in a room of the user, by its title or id. With wait_seconds (up to 120), waits first for someone else to say something: the answer of a double you asked.',
|
|
56
|
+
parameters: { type: 'object', properties: { room: { type: 'string' }, wait_seconds: { type: 'number' } }, required: ['room'] },
|
|
57
|
+
run: (doubles, params) => doubles.readRoom(params.room, params.wait_seconds),
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: 'say_in_room',
|
|
61
|
+
label: 'Say in room',
|
|
62
|
+
description: 'Says something in a room of the user, as their double, for them. With ask, the names of members whose doubles it asks: their Ta answers, if their user lets it. Only what the user wants said; nothing private they did not ask you to share.',
|
|
63
|
+
parameters: {
|
|
64
|
+
type: 'object',
|
|
65
|
+
properties: { room: { type: 'string' }, text: { type: 'string' }, ask: { type: 'array', items: { type: 'string' } } },
|
|
66
|
+
required: ['room', 'text'],
|
|
67
|
+
},
|
|
68
|
+
run: (doubles, params) => doubles.sayInRoom(params.room, params.text, params.ask),
|
|
69
|
+
},
|
|
70
|
+
];
|
|
71
|
+
/** A path of a call of a tool of files, inside the directory the user let the double work in. */
|
|
72
|
+
function inside(cwd, path) {
|
|
73
|
+
const target = (0, node_path_1.resolve)(cwd, typeof path === 'string' && path ? path.replace(/^@/, '') : '.');
|
|
74
|
+
const rest = (0, node_path_1.relative)(cwd, target);
|
|
75
|
+
return !rest.startsWith('..') && !(0, node_path_1.isAbsolute)(rest);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The pi extension of the rooms: in the session of a double in a room (its role has ROOM_DOUBLE_MARK), only the tools its
|
|
79
|
+
* permissions allow, for the one it answers now, and no instructions or skills of the user's that it may not read; so too
|
|
80
|
+
* for an agent of the user others ask in a room, while one the user asks works with all its tools. In the user's own
|
|
81
|
+
* conversations, the tools to act in rooms for them. The doubles are the host's (double-host.ts).
|
|
82
|
+
*/
|
|
83
|
+
function activate(pi) {
|
|
84
|
+
let reached;
|
|
85
|
+
const reach = () => (reached !== null && reached !== void 0 ? reached : (reached = ta_extension_host_1.TaHostUtil.reach(pi.events, double_protocol_1.NAME).then(answer => { var _a; return ({
|
|
86
|
+
answered: !!answer,
|
|
87
|
+
doubles: (_a = answer === null || answer === void 0 ? void 0 : answer.service) === null || _a === void 0 ? void 0 : _a.service,
|
|
88
|
+
}); })));
|
|
89
|
+
const isDouble = (ctx) => ctx.getSystemPrompt().includes(double_protocol_1.ROOM_DOUBLE_MARK);
|
|
90
|
+
/** What a double may do now: nothing but chat when its host is not there. */
|
|
91
|
+
const turnOf = async (ctx) => {
|
|
92
|
+
var _a;
|
|
93
|
+
const turn = (_a = (await reach()).doubles) === null || _a === void 0 ? void 0 : _a.turnOf(ctx.sessionManager.getSessionFile());
|
|
94
|
+
return (turn === null || turn === void 0 ? void 0 : turn.active) ? turn : undefined;
|
|
95
|
+
};
|
|
96
|
+
pi.on('session_start', () => {
|
|
97
|
+
void reach();
|
|
98
|
+
});
|
|
99
|
+
pi.on('before_agent_start', async (event, ctx) => {
|
|
100
|
+
var _a, _b;
|
|
101
|
+
if (isDouble(ctx)) {
|
|
102
|
+
const turn = await turnOf(ctx);
|
|
103
|
+
// The user asked their agent in a room: it works for them as anywhere, but speaks in rooms only by its answer.
|
|
104
|
+
if (turn === null || turn === void 0 ? void 0 : turn.trusted) {
|
|
105
|
+
const all = new Set(pi.getAllTools().map(tool => tool.name));
|
|
106
|
+
// Its tools as a conversation has them, and pi's own again if a turn for another took them away.
|
|
107
|
+
pi.setActiveTools(double_util_1.DoubleUtil.ownTools([...new Set([...pi.getActiveTools(), ...OWN_TOOLS])].filter(name => all.has(name))));
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const capabilities = (_a = turn === null || turn === void 0 ? void 0 : turn.capabilities) !== null && _a !== void 0 ? _a : [];
|
|
111
|
+
pi.setActiveTools(double_util_1.DoubleUtil.tools(capabilities, pi.getAllTools().map(tool => tool.name)));
|
|
112
|
+
// What the user wrote for their own agents is not for others: only the instructions of the directory it may work in.
|
|
113
|
+
const cwd = turn === null || turn === void 0 ? void 0 : turn.cwd;
|
|
114
|
+
const options = event.systemPromptOptions;
|
|
115
|
+
options.contextFiles = cwd && capabilities.includes('files') ? ((_b = options.contextFiles) !== null && _b !== void 0 ? _b : []).filter(file => inside(cwd, file.path)) : [];
|
|
116
|
+
if (!capabilities.includes('files')) {
|
|
117
|
+
options.skills = [];
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
// The tools of a double are not for the user's conversations, and the agents of channels do not act in rooms.
|
|
122
|
+
const agent = ctx.getSystemPrompt().includes(AGENT_MARK);
|
|
123
|
+
const off = new Set([...double_util_1.ROOM_TOOLS, ...(agent ? double_util_1.USER_TOOLS : [])]);
|
|
124
|
+
const active = pi.getActiveTools();
|
|
125
|
+
if (active.some(name => off.has(name))) {
|
|
126
|
+
pi.setActiveTools(active.filter(name => !off.has(name)));
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
// Whatever asks for a tool (the model, a script of a tool), a double only uses what it may, where it may.
|
|
131
|
+
pi.on('tool_call', async (event, ctx) => {
|
|
132
|
+
var _a, _b, _c;
|
|
133
|
+
var _d;
|
|
134
|
+
if (!isDouble(ctx)) {
|
|
135
|
+
return undefined;
|
|
136
|
+
}
|
|
137
|
+
const turn = await turnOf(ctx);
|
|
138
|
+
if (turn === null || turn === void 0 ? void 0 : turn.trusted) {
|
|
139
|
+
if (!double_util_1.DoubleUtil.ownTools([event.toolName]).length) {
|
|
140
|
+
return { block: true, reason: 'Your answer is said in the room: no tool for it.' };
|
|
141
|
+
}
|
|
142
|
+
(_a = (await reach()).doubles) === null || _a === void 0 ? void 0 : _a.used(ctx.sessionManager.getSessionFile(), event.toolName);
|
|
143
|
+
return undefined;
|
|
144
|
+
}
|
|
145
|
+
const capabilities = (_d = turn === null || turn === void 0 ? void 0 : turn.capabilities) !== null && _d !== void 0 ? _d : [];
|
|
146
|
+
if (!double_util_1.DoubleUtil.tools(capabilities, [event.toolName]).length) {
|
|
147
|
+
return { block: true, reason: 'A double in a room may not use this tool now; ask_permission asks your user.' };
|
|
148
|
+
}
|
|
149
|
+
if (double_util_1.CAPABILITY_TOOLS.files.includes(event.toolName) && !((turn === null || turn === void 0 ? void 0 : turn.cwd) && inside(turn.cwd, (_b = event.input) === null || _b === void 0 ? void 0 : _b.path))) {
|
|
150
|
+
return { block: true, reason: `Only inside ${turn === null || turn === void 0 ? void 0 : turn.cwd}.` };
|
|
151
|
+
}
|
|
152
|
+
(_c = (await reach()).doubles) === null || _c === void 0 ? void 0 : _c.used(ctx.sessionManager.getSessionFile(), event.toolName);
|
|
153
|
+
return undefined;
|
|
154
|
+
});
|
|
155
|
+
for (const tool of [...DOUBLE_TOOLS, ...USER_ROOM_TOOLS]) {
|
|
156
|
+
const forDouble = DOUBLE_TOOLS.includes(tool);
|
|
157
|
+
pi.registerTool({
|
|
158
|
+
name: tool.name,
|
|
159
|
+
label: tool.label,
|
|
160
|
+
description: tool.description,
|
|
161
|
+
parameters: tool.parameters,
|
|
162
|
+
execute: async (_id, params, _signal, _update, ctx) => {
|
|
163
|
+
if (forDouble !== isDouble(ctx)) {
|
|
164
|
+
throw new Error(forDouble ? 'Only for a double answering in a room.' : 'Not for a double in a room.');
|
|
165
|
+
}
|
|
166
|
+
const { answered, doubles } = await reach();
|
|
167
|
+
if (!doubles) {
|
|
168
|
+
throw new Error(answered ? 'The rooms did not start in the Ta service; its log says why.' : exports.NO_SERVER);
|
|
169
|
+
}
|
|
170
|
+
const text = await tool.run(doubles, params !== null && params !== void 0 ? params : {}, ctx.sessionManager.getSessionFile());
|
|
171
|
+
return { content: [{ type: 'text', text }], details: undefined };
|
|
172
|
+
},
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=extension.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TaExtensionHost, TaPackageService } from '@celljs/ta-protocol';
|
|
2
|
+
/**
|
|
3
|
+
* The server side of the package (`pi.host`): ta serve runs it once, so that the user's double answers who asks it in a
|
|
4
|
+
* room with no page open. Its pi extension reaches it for the tools; the page reads its data and calls `doubles` (callHost).
|
|
5
|
+
*/
|
|
6
|
+
export default function activate(host: TaExtensionHost): Promise<TaPackageService>;
|
|
7
|
+
//# sourceMappingURL=host.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = activate;
|
|
4
|
+
const double_host_1 = require("./double-host");
|
|
5
|
+
/**
|
|
6
|
+
* The server side of the package (`pi.host`): ta serve runs it once, so that the user's double answers who asks it in a
|
|
7
|
+
* room with no page open. Its pi extension reaches it for the tools; the page reads its data and calls `doubles` (callHost).
|
|
8
|
+
*/
|
|
9
|
+
async function activate(host) {
|
|
10
|
+
const doubles = new double_host_1.RoomDoubles(host);
|
|
11
|
+
await doubles.start();
|
|
12
|
+
return {
|
|
13
|
+
dispose: () => doubles.dispose(),
|
|
14
|
+
doubles: (request) => doubles.request(request),
|
|
15
|
+
service: doubles,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=host.js.map
|
|
@@ -43,6 +43,8 @@ declare const EN: {
|
|
|
43
43
|
send: string;
|
|
44
44
|
qr: string;
|
|
45
45
|
members: string;
|
|
46
|
+
memberCount: string;
|
|
47
|
+
onlineCount: string;
|
|
46
48
|
membersTitle: string;
|
|
47
49
|
membersCount: string;
|
|
48
50
|
noRoomOpen: string;
|
|
@@ -91,6 +93,8 @@ declare const EN: {
|
|
|
91
93
|
pageLine: string;
|
|
92
94
|
chatEmpty: string;
|
|
93
95
|
chatPlaceholder: string;
|
|
96
|
+
showOnHome: string;
|
|
97
|
+
showOnHomeHint: string;
|
|
94
98
|
};
|
|
95
99
|
export type Words = typeof EN;
|
|
96
100
|
export declare namespace RoomWords {
|
|
@@ -46,6 +46,8 @@ const EN = {
|
|
|
46
46
|
send: 'Send…',
|
|
47
47
|
qr: 'QR code of the invitation',
|
|
48
48
|
members: 'Members',
|
|
49
|
+
memberCount: '{n} members',
|
|
50
|
+
onlineCount: '{n} online',
|
|
49
51
|
membersTitle: 'Members of the room',
|
|
50
52
|
membersCount: '{n} members · {online} online',
|
|
51
53
|
noRoomOpen: 'Open a room to see who is in it',
|
|
@@ -94,6 +96,8 @@ const EN = {
|
|
|
94
96
|
pageLine: 'A room of {name}: play in it together',
|
|
95
97
|
chatEmpty: 'Nothing said yet. Only those in the room read it: the relay keeps it sealed.',
|
|
96
98
|
chatPlaceholder: 'Message',
|
|
99
|
+
showOnHome: "Show rooms on the double's home",
|
|
100
|
+
showOnHomeHint: "With rooms, the double's home has a Rooms section, beside members and channels.",
|
|
97
101
|
};
|
|
98
102
|
const ZH = {
|
|
99
103
|
roomsTitle: '房间',
|
|
@@ -140,6 +144,8 @@ const ZH = {
|
|
|
140
144
|
send: '发送…',
|
|
141
145
|
qr: '邀请二维码',
|
|
142
146
|
members: '成员',
|
|
147
|
+
memberCount: '{n} 位成员',
|
|
148
|
+
onlineCount: '{n} 人在线',
|
|
143
149
|
membersTitle: '房间成员',
|
|
144
150
|
membersCount: '{n} 位成员 · {online} 人在线',
|
|
145
151
|
noRoomOpen: '打开一个房间,这里显示它的成员',
|
|
@@ -188,6 +194,8 @@ const ZH = {
|
|
|
188
194
|
pageLine: '{name}的房间,大家可以一起玩',
|
|
189
195
|
chatEmpty: '还没有人说话。只有房间里的人能看到,中继保存的是密文。',
|
|
190
196
|
chatPlaceholder: '发消息',
|
|
197
|
+
showOnHome: '在分身首页显示房间',
|
|
198
|
+
showOnHomeHint: '有房间时,分身首页多一个“房间”分类,和成员、频道放在一起。',
|
|
191
199
|
};
|
|
192
200
|
var RoomWords;
|
|
193
201
|
(function (RoomWords) {
|
|
@@ -3,9 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.default = activate;
|
|
4
4
|
const relay_hub_util_1 = require("@celljs/ta-relay/lib/common/relay-hub-util");
|
|
5
5
|
const dialogs_1 = require("./dialogs");
|
|
6
|
+
const double_i18n_1 = require("./double-i18n");
|
|
7
|
+
const doubles_view_1 = require("./doubles-view");
|
|
6
8
|
const members_view_1 = require("./members-view");
|
|
7
9
|
const page_1 = require("./page");
|
|
8
10
|
const react_1 = require("./react");
|
|
11
|
+
const rooms_home_1 = require("./rooms-home");
|
|
9
12
|
const rooms_page_1 = require("./rooms-page");
|
|
10
13
|
const style_1 = require("./style");
|
|
11
14
|
/** A room joined this soon after asking opens at once: the user is waiting for it. */
|
|
@@ -42,12 +45,28 @@ function tell(pi, changes) {
|
|
|
42
45
|
* change. The rooms themselves are ta serve's (pi.rooms): this only shows them.
|
|
43
46
|
*/
|
|
44
47
|
function activate(pi) {
|
|
45
|
-
var _a;
|
|
48
|
+
var _a, _b;
|
|
46
49
|
(0, react_1.bind)(pi.React);
|
|
47
50
|
(0, page_1.bindPage)(pi);
|
|
48
51
|
const removeStyle = (0, style_1.injectStyle)();
|
|
49
52
|
pi.registerView('rooms', { title: () => (0, page_1.t)('roomsTitle'), icon: (0, page_1.icon)('Users'), render: rooms_page_1.RoomsPage, head: rooms_page_1.RoomsHead, discover: true, order: 81 });
|
|
50
53
|
pi.registerView('members', { title: () => (0, page_1.t)('membersTitle'), icon: (0, page_1.icon)('Users'), render: members_view_1.MembersView, location: 'panel', order: 90 });
|
|
54
|
+
pi.registerView(doubles_view_1.DOUBLES_VIEW.slice(doubles_view_1.DOUBLES_VIEW.lastIndexOf('/') + 1), {
|
|
55
|
+
title: () => (0, double_i18n_1.dt)('logTitle'),
|
|
56
|
+
icon: (0, page_1.icon)('Bot'),
|
|
57
|
+
render: doubles_view_1.DoublesView,
|
|
58
|
+
location: 'panel',
|
|
59
|
+
order: 91,
|
|
60
|
+
});
|
|
61
|
+
pi.registerSettings((0, rooms_home_1.roomsSettings)());
|
|
62
|
+
// The rooms the user is in, in a section of the double's home; none in an app of before.
|
|
63
|
+
const home = new rooms_home_1.RoomsHome();
|
|
64
|
+
const stopHome = pi.rooms ? home.start() : () => undefined;
|
|
65
|
+
if (pi.rooms) {
|
|
66
|
+
(_a = pi.registerHomeItems) === null || _a === void 0 ? void 0 : _a.call(pi, home);
|
|
67
|
+
}
|
|
68
|
+
// What the double asks the user to let it do comes as a dialog, as those asking to join do.
|
|
69
|
+
const stopAsks = pi.rooms ? (0, doubles_view_1.listenAsks)() : () => undefined;
|
|
51
70
|
pi.registerOpener(link => {
|
|
52
71
|
if (link.type !== 'url' || !relay_hub_util_1.RelayHubUtil.is(link.url)) {
|
|
53
72
|
return false;
|
|
@@ -57,7 +76,7 @@ function activate(pi) {
|
|
|
57
76
|
}, { specific: true });
|
|
58
77
|
// What was said, without the messages of games: the rows of the list and the chats keep it as it comes.
|
|
59
78
|
// An app older than rooms: the page says to update.
|
|
60
|
-
const stop = (
|
|
79
|
+
const stop = (_b = pi.onRoomEvent) === null || _b === void 0 ? void 0 : _b.call(pi, event => {
|
|
61
80
|
if (event.type === 'request') {
|
|
62
81
|
void page_1.book.load().then(() => (0, dialogs_1.openRequests)());
|
|
63
82
|
}
|
|
@@ -78,6 +97,8 @@ function activate(pi) {
|
|
|
78
97
|
}
|
|
79
98
|
return () => {
|
|
80
99
|
stop === null || stop === void 0 ? void 0 : stop();
|
|
100
|
+
stopAsks();
|
|
101
|
+
stopHome();
|
|
81
102
|
page_1.book.onChange = undefined;
|
|
82
103
|
removeStyle();
|
|
83
104
|
};
|
|
@@ -1,21 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MembersView = MembersView;
|
|
4
|
+
const agents_view_1 = require("./agents-view");
|
|
4
5
|
const dialogs_1 = require("./dialogs");
|
|
6
|
+
const double_i18n_1 = require("./double-i18n");
|
|
7
|
+
const doubles_view_1 = require("./doubles-view");
|
|
5
8
|
const page_1 = require("./page");
|
|
6
9
|
// biome-ignore lint/correctness/noUnusedImports: the JSX below compiles to React.createElement (jsxFactory)
|
|
7
10
|
const react_1 = require("./react");
|
|
8
11
|
const room_view_1 = require("./room-view");
|
|
9
12
|
function MemberRow({ room, member }) {
|
|
13
|
+
var _a;
|
|
10
14
|
const Remove = (0, page_1.icon)('X');
|
|
15
|
+
const Key = (_a = page_1.pi.ui.icons.KeyRound) !== null && _a !== void 0 ? _a : (0, page_1.icon)('Bot');
|
|
16
|
+
const may = (0, doubles_view_1.useMayLine)(member);
|
|
11
17
|
const tags = [member.self ? (0, page_1.t)('you') : '', member.owner ? (0, page_1.t)('owner') : '', member.guest ? (0, page_1.t)('guestTag') : ''].filter(Boolean);
|
|
12
18
|
return (react_1.React.createElement("li", { className: "trm-member" },
|
|
13
|
-
react_1.React.createElement(page_1.Face, { id: member.id, name: member.name, size:
|
|
19
|
+
react_1.React.createElement(page_1.Face, { id: member.id, name: member.name, size: 34, online: member.online }),
|
|
14
20
|
react_1.React.createElement("span", { className: "trm-member-text" },
|
|
15
21
|
react_1.React.createElement("span", { className: "trm-member-name" },
|
|
16
22
|
react_1.React.createElement("span", { className: "trm-ellipsis" }, member.name),
|
|
17
23
|
tags.map(tag => (react_1.React.createElement("span", { key: tag, className: "trm-tag" }, tag)))),
|
|
18
|
-
react_1.React.createElement("span", { className: `trm-member-detail${member.online ? ' trm-live' : ''}` }, member.online ? (0, page_1.t)('online') : (0, page_1.t)('offline'))
|
|
24
|
+
react_1.React.createElement("span", { className: `trm-member-detail${member.online ? ' trm-live' : ''}` }, member.online ? (0, page_1.t)('online') : (0, page_1.t)('offline')),
|
|
25
|
+
may && react_1.React.createElement("span", { className: "trm-member-detail trm-member-may trm-ellipsis" }, may)),
|
|
26
|
+
!member.self && !member.guest && (react_1.React.createElement("button", { type: "button", className: `trm-icon trm-member-action${may ? ' trm-on-icon' : ''}`, title: (0, double_i18n_1.dt)('permissions'), "aria-label": (0, double_i18n_1.dt)('permissions'), onClick: () => (0, doubles_view_1.openGrant)(member) },
|
|
27
|
+
react_1.React.createElement(Key, { size: 15 }))),
|
|
19
28
|
room.owner && !member.self && (react_1.React.createElement("button", { type: "button", className: "trm-icon trm-danger trm-member-action", title: (0, page_1.t)('remove'), "aria-label": (0, page_1.t)('remove'), onClick: () => void (0, room_view_1.confirmThen)((0, page_1.t)('removeTitle', { name: member.name, title: room.title }), (0, page_1.t)('removeHint'), (0, page_1.t)('remove'), async () => { var _a; return (_a = (0, page_1.rooms)()) === null || _a === void 0 ? void 0 : _a.removeMember(room.id, member.member); }) },
|
|
20
29
|
react_1.React.createElement(Remove, { size: 15 })))));
|
|
21
30
|
}
|
|
@@ -29,15 +38,20 @@ function SettingRow({ label, value, onClick }) {
|
|
|
29
38
|
}
|
|
30
39
|
/** The members of the room shown, in the workbench, as a messenger shows the settings of a group. */
|
|
31
40
|
function MembersView() {
|
|
41
|
+
var _a;
|
|
32
42
|
const { identity } = (0, page_1.useBook)();
|
|
33
43
|
const room = (0, page_1.useOpened)();
|
|
34
44
|
const page = (0, page_1.usePageOf)(room !== null && room !== void 0 ? room : { view: undefined });
|
|
45
|
+
const agents = (0, page_1.useAgents)(room !== null && room !== void 0 ? room : { status: 'gone' });
|
|
46
|
+
const joining = (0, page_1.useJoining)(room !== null && room !== void 0 ? room : { id: '', status: 'gone', members: [] });
|
|
35
47
|
if (!room) {
|
|
36
48
|
return (react_1.React.createElement("div", { className: "trm-panel" },
|
|
37
49
|
react_1.React.createElement(page_1.pi.ui.Empty, { title: (0, page_1.t)('noRoomOpen') })));
|
|
38
50
|
}
|
|
39
51
|
const Plus = (0, page_1.icon)('Plus');
|
|
52
|
+
const Bot = (0, page_1.icon)('Bot');
|
|
40
53
|
const online = room.members.filter(member => member.online).length;
|
|
54
|
+
const self = (_a = room.members.find(member => member.self)) === null || _a === void 0 ? void 0 : _a.member;
|
|
41
55
|
return (react_1.React.createElement("div", { className: "trm-panel" },
|
|
42
56
|
react_1.React.createElement("div", { className: "trm-panel-scroll" },
|
|
43
57
|
react_1.React.createElement("div", { className: "trm-panel-top" },
|
|
@@ -55,6 +69,22 @@ function MembersView() {
|
|
|
55
69
|
react_1.React.createElement("span", { className: "trm-member-name" }, (0, page_1.t)('invite')),
|
|
56
70
|
react_1.React.createElement("span", { className: "trm-member-detail" }, (0, page_1.t)('inviteLine')))))),
|
|
57
71
|
room.members.map(member => (react_1.React.createElement(MemberRow, { key: member.member, room: room, member: member })))),
|
|
72
|
+
react_1.React.createElement("div", { className: "trm-panel-label" }, agents.length ? `${(0, double_i18n_1.dt)('agentsTitle')} · ${agents.length}` : (0, double_i18n_1.dt)('agentsTitle')),
|
|
73
|
+
react_1.React.createElement("ul", { className: "trm-panel-members" },
|
|
74
|
+
react_1.React.createElement("li", null,
|
|
75
|
+
react_1.React.createElement("button", { type: "button", className: "trm-member trm-member-add", onClick: () => (0, agents_view_1.openAgentPicker)(room) },
|
|
76
|
+
react_1.React.createElement("span", { className: "trm-member-plus" },
|
|
77
|
+
react_1.React.createElement(Bot, { size: 16 })),
|
|
78
|
+
react_1.React.createElement("span", { className: "trm-member-text" },
|
|
79
|
+
react_1.React.createElement("span", { className: "trm-member-name" }, (0, double_i18n_1.dt)('inviteAgent')),
|
|
80
|
+
react_1.React.createElement("span", { className: "trm-member-detail" }, (0, double_i18n_1.dt)('inviteAgentLine'))))),
|
|
81
|
+
agents.map(agent => (react_1.React.createElement(agents_view_1.AgentRow, { key: `${agent.member}/${agent.id}`, room: room, agent: agent }))),
|
|
82
|
+
joining
|
|
83
|
+
.filter(agent => !agents.some(each => each.id === agent.id && each.member === self))
|
|
84
|
+
.map(agent => (react_1.React.createElement(agents_view_1.JoiningRow, { key: `joining/${agent.id}`, agent: agent })))),
|
|
85
|
+
react_1.React.createElement("div", { className: "trm-panel-sep" }),
|
|
86
|
+
react_1.React.createElement(doubles_view_1.DoubleSwitch, { room: room }),
|
|
87
|
+
react_1.React.createElement(SettingRow, { label: (0, double_i18n_1.dt)('log'), onClick: () => void page_1.pi.ui.showView(doubles_view_1.DOUBLES_VIEW) }),
|
|
58
88
|
react_1.React.createElement("div", { className: "trm-panel-sep" }),
|
|
59
89
|
page && room.view && react_1.React.createElement(SettingRow, { label: (0, page_1.t)('openPage', { name: page.title }), onClick: () => void page_1.pi.ui.showView(room.view) }),
|
|
60
90
|
react_1.React.createElement(SettingRow, { label: (0, page_1.t)('me'), value: identity === null || identity === void 0 ? void 0 : identity.name, onClick: () => void (0, dialogs_1.rename)() })),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { TaFriend, TaIdentity, TaRoomEvent, TaRoomInfo, TaRoomRequest } from '@celljs/ta-protocol';
|
|
2
2
|
import { type RelayChatLine as ChatLine, RelayRoomChat as RoomChat } from '@celljs/ta-relay/lib/common/relay-room-chat';
|
|
3
3
|
import type { WebExtensionAPI, WebIcon, WebPageInfo, WebRooms } from '@celljs/ta-web/lib/browser/extension/web-extension-api';
|
|
4
|
+
import { type RoomAgent, type RoomAgentIn } from './double-protocol';
|
|
4
5
|
import { type Words } from './i18n';
|
|
5
6
|
/** The kind of the rooms made here: a group chat, which this page shows (room-view.tsx). */
|
|
6
7
|
export declare const ROOMS_KIND = "ta-rooms";
|
|
@@ -8,7 +9,7 @@ export declare const ROOMS_KIND = "ta-rooms";
|
|
|
8
9
|
export declare const ROOMS_VIEW = "@celljs/ta-rooms/rooms";
|
|
9
10
|
/** The members of the room shown, a tool of the workbench (members-view.tsx). */
|
|
10
11
|
export declare const MEMBERS_VIEW = "@celljs/ta-rooms/members";
|
|
11
|
-
/** What the page hears of the state of the rooms without their messages: what is said (chat.ts). */
|
|
12
|
+
/** What the page hears of the state of the rooms without their messages: what is said (chat.ts), the agents invited. */
|
|
12
13
|
export declare const CHAT_STATE: string[];
|
|
13
14
|
/** The API of the page, bound once by `activate`. */
|
|
14
15
|
export declare let pi: WebExtensionAPI;
|
|
@@ -27,6 +28,8 @@ export interface BookState {
|
|
|
27
28
|
friends?: TaFriend[];
|
|
28
29
|
/** The room the page shows, its chat. */
|
|
29
30
|
opened?: string;
|
|
31
|
+
/** It was opened from elsewhere (the double's home): on a phone, it alone, back going where the user came from. */
|
|
32
|
+
direct?: boolean;
|
|
30
33
|
/** When the user last saw what was said in each room, by its id (`pi.storage`). */
|
|
31
34
|
seen: Record<string, number>;
|
|
32
35
|
}
|
|
@@ -40,6 +43,15 @@ export declare class RoomBook {
|
|
|
40
43
|
protected state: BookState;
|
|
41
44
|
protected readonly listeners: Set<() => void>;
|
|
42
45
|
protected readonly chats: Map<string, RoomChat>;
|
|
46
|
+
/** The agents of each room read, by key of its state (RoomAgentsUtil), and listed. */
|
|
47
|
+
protected readonly agentStates: Map<string, Record<string, {
|
|
48
|
+
value: unknown;
|
|
49
|
+
by: string;
|
|
50
|
+
version: number;
|
|
51
|
+
}>>;
|
|
52
|
+
protected readonly agentLists: Map<string, readonly RoomAgentIn[]>;
|
|
53
|
+
/** The agents the user invites to each room, till they are in it. */
|
|
54
|
+
protected readonly joiningLists: Map<string, readonly RoomAgent[]>;
|
|
43
55
|
protected timer?: ReturnType<typeof setTimeout>;
|
|
44
56
|
protected loading?: Promise<void>;
|
|
45
57
|
protected again: boolean;
|
|
@@ -55,8 +67,22 @@ export declare class RoomBook {
|
|
|
55
67
|
set(partial: Partial<BookState>): void;
|
|
56
68
|
/** The chat of a room, read the first time it is asked for and kept as its state changes (`heard`). */
|
|
57
69
|
chat(room: string): RoomChat | undefined;
|
|
58
|
-
/**
|
|
70
|
+
/** The agents invited to a room, read the first time it is asked for and kept as its state changes. */
|
|
71
|
+
agents(room: string): readonly RoomAgentIn[];
|
|
72
|
+
/** The agents the user invites to a room, on their way in. */
|
|
73
|
+
joining(room: string): readonly RoomAgent[];
|
|
74
|
+
/** An agent the user invites is on its way into a room (`true`), or no more. */
|
|
75
|
+
setJoining(room: string, agent: RoomAgent, on: boolean): void;
|
|
76
|
+
/** The agents of the user in a room, as the server listed them on inviting one: shown before the room says so. */
|
|
77
|
+
putMine(room: string, member: string, agents: readonly RoomAgent[]): void;
|
|
78
|
+
/** What happened in a room: what was said goes to its chat, if it was read; who was invited, to its agents. */
|
|
59
79
|
heard(event: TaRoomEvent): void;
|
|
80
|
+
protected readAgents(room: string): void;
|
|
81
|
+
protected putAgents(room: string, state: Record<string, {
|
|
82
|
+
value: unknown;
|
|
83
|
+
by: string;
|
|
84
|
+
version: number;
|
|
85
|
+
}>): void;
|
|
60
86
|
/** The user saw what was said in a room till `at`. */
|
|
61
87
|
see(room: string, at: number): void;
|
|
62
88
|
protected readSeen(): void;
|
|
@@ -66,10 +92,17 @@ export declare const book: RoomBook;
|
|
|
66
92
|
export declare function useBook(): BookState;
|
|
67
93
|
/** What was said in a room, as it changes; nothing for one not joined. */
|
|
68
94
|
export declare function useLines(room: TaRoomInfo): readonly ChatLine[];
|
|
95
|
+
/** The agents invited to a room, as they come and go; none for one not joined. */
|
|
96
|
+
export declare function useAgents(room: TaRoomInfo): readonly RoomAgentIn[];
|
|
97
|
+
/** The agents the user invites to a room, till they said hello there. */
|
|
98
|
+
export declare function useJoining(room: TaRoomInfo): readonly RoomAgent[];
|
|
69
99
|
/** Said in a room by others since the user saw it last (or joined). */
|
|
70
100
|
export declare function unseen(room: TaRoomInfo, lines: readonly ChatLine[], seen: Record<string, number>): boolean;
|
|
71
|
-
/**
|
|
72
|
-
|
|
101
|
+
/**
|
|
102
|
+
* Shows a room: its chat, over the list on a phone, beside it elsewhere; `direct` from elsewhere than the list, on a phone
|
|
103
|
+
* without the list under it, so that back goes where the user came from.
|
|
104
|
+
*/
|
|
105
|
+
export declare function openRoom(id: string, direct?: boolean): void;
|
|
73
106
|
/** The room shown, while it is one the user is in. */
|
|
74
107
|
export declare function useOpened(): TaRoomInfo | undefined;
|
|
75
108
|
/** A phone, or a window as narrow: the list, and a room pushed over it, rather than the two side by side. */
|
|
@@ -86,20 +119,36 @@ export declare function when(at: number, now?: number): string;
|
|
|
86
119
|
/** One of the colours of the faces of the page (--ta-tint-<n>), the same for the same id. */
|
|
87
120
|
export declare function tint(id: string): number;
|
|
88
121
|
export declare function initial(name: string): string;
|
|
89
|
-
/** A
|
|
90
|
-
export declare function Face({ id, name, size, online }: {
|
|
122
|
+
/** A face of one of the rooms, as the agents of channels have (`ui.Face`); a letter in a circle in an app of before. */
|
|
123
|
+
export declare function Face({ id, name, size, online, face }: {
|
|
91
124
|
id: string;
|
|
92
125
|
name: string;
|
|
93
126
|
size?: number;
|
|
94
127
|
online?: boolean;
|
|
128
|
+
face?: number;
|
|
95
129
|
}): import("react").JSX.Element;
|
|
96
130
|
/**
|
|
97
|
-
*
|
|
98
|
-
*
|
|
131
|
+
* Those a room is drawn by, as a channel by its members: the others first, its owner in front, then the agents in it, then
|
|
132
|
+
* the user, so that a room of two (the user and an agent) shows both; the user alone in a room of its own.
|
|
133
|
+
*/
|
|
134
|
+
export declare function faceMembers(room: TaRoomInfo, agents?: readonly RoomAgentIn[]): {
|
|
135
|
+
id: string;
|
|
136
|
+
name: string;
|
|
137
|
+
face?: number;
|
|
138
|
+
}[];
|
|
139
|
+
/**
|
|
140
|
+
* The face of a room, as a channel is drawn (`ui.GroupFace`): two of those in it, one in front of the other; the icon
|
|
141
|
+
* of the page of its game at a corner; an amber dot for what the user has not read.
|
|
99
142
|
*/
|
|
100
143
|
export declare function RoomFace({ room, size, unread }: {
|
|
101
144
|
room: TaRoomInfo;
|
|
102
145
|
size?: number;
|
|
103
146
|
unread?: boolean;
|
|
104
147
|
}): import("react").JSX.Element;
|
|
148
|
+
/** The faces of those in a room, up to five, as the head of a channel shows them; the button shows its members. */
|
|
149
|
+
export declare function MemberFaces({ room, onClick, shown }: {
|
|
150
|
+
room: TaRoomInfo;
|
|
151
|
+
onClick(): void;
|
|
152
|
+
shown: boolean;
|
|
153
|
+
}): import("react").JSX.Element;
|
|
105
154
|
//# sourceMappingURL=page.d.ts.map
|