@celljs/ta 4.9.0 → 4.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/dist/gateway.mjs +26 -8
  2. package/dist/pi/CHANGELOG.md +4 -0
  3. package/dist/pi/package.json +1 -1
  4. package/dist/pi/packages/ta-agents/README.en.md +2 -2
  5. package/dist/pi/packages/ta-agents/README.md +2 -2
  6. package/dist/pi/packages/ta-agents/extension/index.mjs +50 -12
  7. package/dist/pi/packages/ta-agents/lib/agent-bindings.d.ts +17 -4
  8. package/dist/pi/packages/ta-agents/lib/agent-bindings.js +39 -9
  9. package/dist/pi/packages/ta-agents/lib/agent-catalog.d.ts +2 -0
  10. package/dist/pi/packages/ta-agents/lib/agent-catalog.js +3 -0
  11. package/dist/pi/packages/ta-agents/lib/extension.d.ts +2 -1
  12. package/dist/pi/packages/ta-agents/lib/extension.js +11 -3
  13. package/dist/pi/packages/ta-agents/lib/json-rpc.js +7 -1
  14. package/dist/pi/packages/ta-agents/package.json +1 -1
  15. package/dist/pi/packages/ta-bots/package.json +1 -1
  16. package/dist/pi/packages/ta-changes/package.json +1 -1
  17. package/dist/pi/packages/ta-channels/lib/i18n.d.ts +2 -1
  18. package/dist/pi/packages/ta-channels/lib/i18n.js +4 -2
  19. package/dist/pi/packages/ta-channels/lib/sidebar.js +63 -11
  20. package/dist/pi/packages/ta-channels/lib/tasks.d.ts +2 -0
  21. package/dist/pi/packages/ta-channels/lib/tasks.js +21 -10
  22. package/dist/pi/packages/ta-channels/package.json +1 -1
  23. package/dist/pi/packages/ta-channels/web/index.js +95 -27
  24. package/dist/pi/packages/ta-computer-use/package.json +1 -1
  25. package/dist/pi/packages/ta-cron/package.json +1 -1
  26. package/dist/pi/packages/ta-extensions/package.json +1 -1
  27. package/dist/pi/packages/ta-launcher/package.json +1 -1
  28. package/dist/pi/packages/ta-workspace/lib/index.js +2 -1
  29. package/dist/pi/packages/ta-workspace/lib/terminal-sessions.d.ts +51 -0
  30. package/dist/pi/packages/ta-workspace/lib/terminal-sessions.js +226 -0
  31. package/dist/pi/packages/ta-workspace/lib/terminal.d.ts +0 -39
  32. package/dist/pi/packages/ta-workspace/lib/terminal.js +28 -240
  33. package/dist/pi/packages/ta-workspace/package.json +1 -1
  34. package/dist/pi/packages/ta-workspace/web/index.js +3 -1
  35. package/dist/public/assets/{abnfDiagram-S7VZAUFO-C1tb6dM5.js → abnfDiagram-S7VZAUFO-EVMX_yOb.js} +1 -1
  36. package/dist/public/assets/{architecture-WOLXFQ4H-DN1Va8BF.js → architecture-WOLXFQ4H-CDgbgZ_o.js} +1 -1
  37. package/dist/public/assets/{architectureDiagram-YGSQEFNW-BmK2SYtQ.js → architectureDiagram-YGSQEFNW-dHreaCWz.js} +1 -1
  38. package/dist/public/assets/{blockDiagram-APKKGZFW-DvLrLzTm.js → blockDiagram-APKKGZFW-D6FhzBDq.js} +1 -1
  39. package/dist/public/assets/{browser-DAv3ly6M.js → browser-y6EDNUmc.js} +1 -1
  40. package/dist/public/assets/{c4Diagram-KJ2TOQU5-CrQlWwrG.js → c4Diagram-KJ2TOQU5-BFpcr8Cs.js} +1 -1
  41. package/dist/public/assets/{chunk-6MUBBAK2-CHKMsuY_.js → chunk-6MUBBAK2-BczXkMV-.js} +1 -1
  42. package/dist/public/assets/{chunk-AXFCVDMN-CWJ7Np6s.js → chunk-AXFCVDMN-CjJsv3jB.js} +1 -1
  43. package/dist/public/assets/{chunk-BG4553SI-3v5XbQGM.js → chunk-BG4553SI-FBaleaLz.js} +1 -1
  44. package/dist/public/assets/{chunk-DQASFODM-2CC-yiCz.js → chunk-DQASFODM-BFdXY5sX.js} +1 -1
  45. package/dist/public/assets/{chunk-HFQBQIA3-D2hzQPAy.js → chunk-HFQBQIA3-C5cwK-Fg.js} +1 -1
  46. package/dist/public/assets/{chunk-KQLB2F66-SifAZs2r.js → chunk-KQLB2F66-BUek3IRk.js} +1 -1
  47. package/dist/public/assets/{chunk-KS47KZWR-BP0C0VCC.js → chunk-KS47KZWR-BxsYBzt6.js} +1 -1
  48. package/dist/public/assets/{chunk-LEVMRMFU-B1f5vw5b.js → chunk-LEVMRMFU-Bdcwz9fS.js} +1 -1
  49. package/dist/public/assets/{chunk-M57EVK23-B2MCJt7Y.js → chunk-M57EVK23-kkpP5oug.js} +1 -1
  50. package/dist/public/assets/{chunk-OY52VR5R-cDpZJMk4.js → chunk-OY52VR5R-CFhQgxmD.js} +1 -1
  51. package/dist/public/assets/{chunk-QB3YPZ4I-BE0we2xc.js → chunk-QB3YPZ4I-BVXqu0eC.js} +1 -1
  52. package/dist/public/assets/{chunk-R3KSYZAL-D9wOfqqH.js → chunk-R3KSYZAL-B7SUqqLI.js} +1 -1
  53. package/dist/public/assets/{chunk-STOXU5M4-BIaVsc0K.js → chunk-STOXU5M4-B3abfbnH.js} +1 -1
  54. package/dist/public/assets/{chunk-TU62E6Q5-BZc0OZEM.js → chunk-TU62E6Q5-C9NqnUav.js} +1 -1
  55. package/dist/public/assets/{chunk-X4PVCEUW-Bngfwwzm.js → chunk-X4PVCEUW-BeLfETDx.js} +1 -1
  56. package/dist/public/assets/{chunk-XXDRQBXY-C5FQ6XHK.js → chunk-XXDRQBXY-DXai1i8p.js} +1 -1
  57. package/dist/public/assets/{classDiagram-v2-L25IHNXF-_om54nmt.js → classDiagram-v2-L25IHNXF-Zj6ne_tC.js} +1 -1
  58. package/dist/public/assets/{cose-bilkent-JH36ORCC-Dwpeee_6.js → cose-bilkent-JH36ORCC-C0-TjqfJ.js} +1 -1
  59. package/dist/public/assets/cynefin-EF2NZ3EQ-CoY4CrZu.js +1 -0
  60. package/dist/public/assets/{cynefinDiagram-L36ESFBY-DP5_y9Dq.js → cynefinDiagram-L36ESFBY-BnqxfzPa.js} +1 -1
  61. package/dist/public/assets/{d3-selection-DFiMlEmn.js → d3-selection-DfFLTR9d.js} +1 -1
  62. package/dist/public/assets/{dagre-SPEB5RXH-DYwsk6gk.js → dagre-SPEB5RXH-kI17e5cH.js} +1 -1
  63. package/dist/public/assets/{diagram-3B7GL73J-Dq_nT3AZ.js → diagram-3B7GL73J-DgPjeLA5.js} +1 -1
  64. package/dist/public/assets/{diagram-DNEMPZML-ChURW6y9.js → diagram-DNEMPZML-CRhPfa0I.js} +1 -1
  65. package/dist/public/assets/{diagram-L3MUGCDN-CgVp4Rto.js → diagram-L3MUGCDN-ExuTg12b.js} +1 -1
  66. package/dist/public/assets/{diagram-LA4NIPWU-vrqLMDby.js → diagram-LA4NIPWU-Dgx5xNiY.js} +1 -1
  67. package/dist/public/assets/{diagram-MHCOC4E2-lvfOr5ij.js → diagram-MHCOC4E2-BuifkUTl.js} +1 -1
  68. package/dist/public/assets/{diagram-XPFHEONP-oQ18TeVp.js → diagram-XPFHEONP-CFEaBo7z.js} +1 -1
  69. package/dist/public/assets/{dist-BOxxmveI.js → dist-C-iJHcSK.js} +1 -1
  70. package/dist/public/assets/{ebnfDiagram-UZSYDL2S-C7_tlZCS.js → ebnfDiagram-UZSYDL2S-D-hp5yNt.js} +1 -1
  71. package/dist/public/assets/{editor.api-CoZ8MEuz.js → editor.api-BopUWpqY.js} +1 -1
  72. package/dist/public/assets/{elk-XV6XMXQE-Dkt5-ikg.js → elk-XV6XMXQE-CBbk_IpU.js} +1 -1
  73. package/dist/public/assets/{erDiagram-EYBAPDEH-27kh3zlx.js → erDiagram-EYBAPDEH-B02R_WWE.js} +1 -1
  74. package/dist/public/assets/{eventmodeling-K75KTNOO-CxVEejjN.js → eventmodeling-K75KTNOO-aCZfYnCI.js} +1 -1
  75. package/dist/public/assets/flowDiagram-MALGAFMO-CATkJShO.js +1 -0
  76. package/dist/public/assets/{freemarker2-D6CwPIXh.js → freemarker2-DMN60LeK.js} +1 -1
  77. package/dist/public/assets/{ganttDiagram-23REXITY-C-amlwpX.js → ganttDiagram-23REXITY-DioU8TlD.js} +1 -1
  78. package/dist/public/assets/gitGraph-VSP46ZUC-g4yHXXxx.js +1 -0
  79. package/dist/public/assets/{gitGraphDiagram-STJD7YCW-DKhzI0Xz.js → gitGraphDiagram-STJD7YCW--q3ctg6y.js} +1 -1
  80. package/dist/public/assets/{handlebars-mxNr68Gm.js → handlebars-B_-qdvpB.js} +1 -1
  81. package/dist/public/assets/{html-Bze6s9R9.js → html-BN8Ah3Js.js} +1 -1
  82. package/dist/public/assets/{index-BhQUc9PU.js → index-B3A--ac8.js} +2 -2
  83. package/dist/public/assets/info-OHQRW6UA-CKADJjz4.js +1 -0
  84. package/dist/public/assets/{infoDiagram-KBXO4MBG-WHuWjEDO.js → infoDiagram-KBXO4MBG-CGXteYo9.js} +1 -1
  85. package/dist/public/assets/{ishikawaDiagram-M35NCXHK-DFHUwD0J.js → ishikawaDiagram-M35NCXHK-DM2LmOAc.js} +1 -1
  86. package/dist/public/assets/{javascript-4NMPu7y1.js → javascript-BlizGb0q.js} +1 -1
  87. package/dist/public/assets/{journeyDiagram-OPLOXDXO-C7gV6zEr.js → journeyDiagram-OPLOXDXO-CNITRtGl.js} +1 -1
  88. package/dist/public/assets/{jsonMode-B1JEHPMp.js → jsonMode-CEUmT5sN.js} +1 -1
  89. package/dist/public/assets/{kanban-definition-BZKZHSQY-DlRu_d2Q.js → kanban-definition-BZKZHSQY-BPUuS9um.js} +1 -1
  90. package/dist/public/assets/{liquid-B7sIf4NX.js → liquid-BbyLjUbE.js} +1 -1
  91. package/dist/public/assets/{mdx-CAN0qez6.js → mdx-DiQz7Q35.js} +1 -1
  92. package/dist/public/assets/{mermaid-parser.core-BGmotBhf.js → mermaid-parser.core-Dum100hC.js} +3 -3
  93. package/dist/public/assets/{mermaid.core-Cl6SS3cM.js → mermaid.core-BWmWf6XO.js} +4 -4
  94. package/dist/public/assets/{mindmap-definition-I2QAS2VK-DiQ8Feqr.js → mindmap-definition-I2QAS2VK-L8HyYUDY.js} +1 -1
  95. package/dist/public/assets/module-CH7IXa5L.js +1781 -0
  96. package/dist/public/assets/module-DNAasuMC.js +1 -0
  97. package/dist/public/assets/{monaco-CwCjTWAO.js → monaco-zOOyBmxy.js} +3 -3
  98. package/dist/public/assets/packet-JDAUHWVQ-CpKMhX4K.js +1 -0
  99. package/dist/public/assets/{pegDiagram-FD4XPPHP-XhCpv6BX.js → pegDiagram-FD4XPPHP-CTZKPo0Z.js} +1 -1
  100. package/dist/public/assets/pie-XZMESJXO-CW-zGDRd.js +1 -0
  101. package/dist/public/assets/{pieDiagram-J4AKIIQI-DUVzuXUd.js → pieDiagram-J4AKIIQI-DAeT3dFi.js} +1 -1
  102. package/dist/public/assets/{python-DsoF66Sp.js → python-C984gt98.js} +1 -1
  103. package/dist/public/assets/{quadrantDiagram-XTYBLID2-Ddobf0z0.js → quadrantDiagram-XTYBLID2--PXxwV1Z.js} +1 -1
  104. package/dist/public/assets/radar-ABXABTNO-Cg8W433p.js +1 -0
  105. package/dist/public/assets/railroad-I3PHUGI6-DriMt2PQ.js +1 -0
  106. package/dist/public/assets/{railroad-abnf-LNEFI6M7-DkrNo-Gf.js → railroad-abnf-LNEFI6M7-BYcFfrCa.js} +1 -1
  107. package/dist/public/assets/{railroad-ebnf-DWYD2UWJ-DaB7gY8P.js → railroad-ebnf-DWYD2UWJ-Cd33qxAm.js} +1 -1
  108. package/dist/public/assets/{railroad-peg-JR7BVNR7-D_QG87QV.js → railroad-peg-JR7BVNR7-C5TpzaU8.js} +1 -1
  109. package/dist/public/assets/{railroadDiagram-MRQ6NCDL-x-nUoBjv.js → railroadDiagram-MRQ6NCDL-DlWwjbhH.js} +1 -1
  110. package/dist/public/assets/{razor-DSrcJyQe.js → razor-BBqMR1Qn.js} +1 -1
  111. package/dist/public/assets/{requirementDiagram-Y7LWUY3S-kNNcbsty.js → requirementDiagram-Y7LWUY3S-CsYBy9HS.js} +1 -1
  112. package/dist/public/assets/{sankeyDiagram-WGJFYUXA-ClC12Odk.js → sankeyDiagram-WGJFYUXA-Baxyb5p9.js} +1 -1
  113. package/dist/public/assets/{sequenceDiagram-5NDRBG5M-DDQITP2g.js → sequenceDiagram-5NDRBG5M-Cq6VeBT_.js} +1 -1
  114. package/dist/public/assets/{stateDiagram-v2-FJ4FJNEA-N1t_36oh.js → stateDiagram-v2-FJ4FJNEA-O60WKaE7.js} +1 -1
  115. package/dist/public/assets/{swimlanes-UMQ2AFYF-DSt9fFYE.js → swimlanes-UMQ2AFYF-C2nf1-Cc.js} +1 -1
  116. package/dist/public/assets/swimlanesDiagram-OMPLPG4O-B46JxqS8.js +8 -0
  117. package/dist/public/assets/{timeline-definition-SEUHKTQE-CfymOw_s.js → timeline-definition-SEUHKTQE-DEfUG6YH.js} +1 -1
  118. package/dist/public/assets/treeView-D4JQ5SDB-1LhEWwC9.js +1 -0
  119. package/dist/public/assets/treemap-SAJKECNS-D3t3N7nS.js +1 -0
  120. package/dist/public/assets/{typescript-J7rF-zX8.js → typescript-Gtq7f0aU.js} +1 -1
  121. package/dist/public/assets/{usecaseDiagram-AFA6YXN4-CK_mRc2_.js → usecaseDiagram-AFA6YXN4-Gw9DyJcx.js} +1 -1
  122. package/dist/public/assets/{vennDiagram-NNMJR3RB-DW8xR6IJ.js → vennDiagram-NNMJR3RB-Clb3MLWF.js} +1 -1
  123. package/dist/public/assets/wardley-7MLQ67FV-D3sAsd8p.js +1 -0
  124. package/dist/public/assets/{wardleyDiagram-S7YFUSEH-Css55Zq5.js → wardleyDiagram-S7YFUSEH-BrTRpwu2.js} +1 -1
  125. package/dist/public/assets/{xml-CJeviG_a.js → xml-Bx3nk7iG.js} +1 -1
  126. package/dist/public/assets/{xychartDiagram-GGNKY7IX-BnhK9cFS.js → xychartDiagram-GGNKY7IX-BfjTcIsb.js} +1 -1
  127. package/dist/public/assets/{yaml-Gw3uo6rF.js → yaml-dFLE_rSl.js} +1 -1
  128. package/dist/public/index.html +1 -1
  129. package/dist/serve/index.mjs +13 -5
  130. package/package.json +24 -24
  131. package/dist/public/assets/cynefin-EF2NZ3EQ-CW_93VVD.js +0 -1
  132. package/dist/public/assets/flowDiagram-MALGAFMO-BRowRdve.js +0 -1
  133. package/dist/public/assets/gitGraph-VSP46ZUC-BGmojXlx.js +0 -1
  134. package/dist/public/assets/info-OHQRW6UA-CRRVgGj2.js +0 -1
  135. package/dist/public/assets/module-1nDbf1AK.js +0 -1761
  136. package/dist/public/assets/module-BkKfSTDV.js +0 -1
  137. package/dist/public/assets/packet-JDAUHWVQ-DUlqTCWQ.js +0 -1
  138. package/dist/public/assets/pie-XZMESJXO-2RgP4ScO.js +0 -1
  139. package/dist/public/assets/radar-ABXABTNO-Dap8k-yH.js +0 -1
  140. package/dist/public/assets/railroad-I3PHUGI6-Ds10NBze.js +0 -1
  141. package/dist/public/assets/swimlanesDiagram-OMPLPG4O-BHAN4SQO.js +0 -8
  142. package/dist/public/assets/treeView-D4JQ5SDB-f1hLUBjI.js +0 -1
  143. package/dist/public/assets/treemap-SAJKECNS-_NPRpuUC.js +0 -1
  144. package/dist/public/assets/wardley-7MLQ67FV-CLBqtefx.js +0 -1
@@ -0,0 +1,226 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Terminals = exports.OPEN_ROWS = exports.OPEN_COLS = void 0;
4
+ exports.useTerminals = useTerminals;
5
+ exports.cwdOf = cwdOf;
6
+ exports.hintOf = hintOf;
7
+ exports.close = close;
8
+ exports.closeEach = closeEach;
9
+ exports.copySelection = copySelection;
10
+ exports.pasteClipboard = pasteClipboard;
11
+ const host_1 = require("./host");
12
+ const react_1 = require("./react");
13
+ const terminal_1 = require("./util/terminal");
14
+ const RESIZE_MS = 120;
15
+ /** A shell opens at this size, and its screen with it, until its view fits it. */
16
+ exports.OPEN_COLS = 100;
17
+ exports.OPEN_ROWS = 30;
18
+ /** The terminals of this page and what they printed; they outlive the views that show them. */
19
+ var Terminals;
20
+ (function (Terminals) {
21
+ let sessions = new Map();
22
+ /** Closed here: what the server still sends of them (their end) does not bring them back. */
23
+ const closed = new Set();
24
+ const listeners = new Set();
25
+ let list = [];
26
+ let frame = 0;
27
+ /** The screen in sight, if any: one that rings there needs no mark. */
28
+ let seen;
29
+ function all() {
30
+ return list;
31
+ }
32
+ Terminals.all = all;
33
+ function get(id) {
34
+ return sessions.get(id);
35
+ }
36
+ Terminals.get = get;
37
+ function subscribe(listener) {
38
+ listeners.add(listener);
39
+ return () => listeners.delete(listener);
40
+ }
41
+ Terminals.subscribe = subscribe;
42
+ /** The list of terminals, their names, directories or how one ended changed: views read it again once a frame. */
43
+ function changed() {
44
+ list = [...sessions.values()];
45
+ if (!frame) {
46
+ frame = requestAnimationFrame(() => {
47
+ frame = 0;
48
+ for (const listener of listeners) {
49
+ listener();
50
+ }
51
+ });
52
+ }
53
+ }
54
+ function create(info, name) {
55
+ const terminal = host_1.pi.ui.createTerminal({ cols: exports.OPEN_COLS, rows: exports.OPEN_ROWS, cwd: info.cwd || undefined });
56
+ const created = { info, terminal, name };
57
+ const id = info.terminalId;
58
+ terminal.onData(data => {
59
+ if (created.exitCode !== undefined) {
60
+ return;
61
+ }
62
+ if (created.ctrl) {
63
+ created.ctrl = false;
64
+ data = terminal_1.TerminalUtil.ctrl(data);
65
+ changed();
66
+ }
67
+ void host_1.pi.terminals.writeTerminal(id, data).catch(() => undefined);
68
+ });
69
+ // The shell hears the last size, once the view stopped changing.
70
+ let timer;
71
+ terminal.onResize(({ cols, rows }) => {
72
+ clearTimeout(timer);
73
+ timer = setTimeout(() => void host_1.pi.terminals.resizeTerminal(id, cols, rows).catch(() => undefined), RESIZE_MS);
74
+ });
75
+ // Its tab names the directory it is in, what its program says it does and how far it is.
76
+ terminal.onCwdChange(() => changed());
77
+ terminal.onTitleChange(raw => {
78
+ const title = terminal_1.TerminalUtil.title(raw);
79
+ if (title && title !== created.title) {
80
+ created.title = title;
81
+ changed();
82
+ }
83
+ });
84
+ terminal.onProgressChange(progress => {
85
+ created.progress = progress;
86
+ changed();
87
+ });
88
+ terminal.onAttention(() => {
89
+ const element = (seen === null || seen === void 0 ? void 0 : seen.terminalId) === created.info.terminalId ? seen.element : undefined;
90
+ const inSight = (element === null || element === void 0 ? void 0 : element.isConnected) && element.offsetParent !== null && !document.hidden;
91
+ if (!inSight && !created.attention) {
92
+ created.attention = true;
93
+ changed();
94
+ }
95
+ });
96
+ return created;
97
+ }
98
+ function add(info) {
99
+ let session = sessions.get(info.terminalId);
100
+ if (!session) {
101
+ session = create(info);
102
+ sessions.set(info.terminalId, session);
103
+ changed();
104
+ }
105
+ return session;
106
+ }
107
+ Terminals.add = add;
108
+ function receive(terminalId, data, exitCode) {
109
+ var _a;
110
+ if (closed.has(terminalId)) {
111
+ return;
112
+ }
113
+ const session = (_a = sessions.get(terminalId)) !== null && _a !== void 0 ? _a : add({ terminalId, cwd: '', shell: '', pty: true });
114
+ session.terminal.write(data);
115
+ // JSON has no undefined: a terminal that goes on sends null.
116
+ if (exitCode !== undefined && exitCode !== null) {
117
+ session.exitCode = exitCode;
118
+ session.ctrl = false;
119
+ // Nothing more is typed there: the cursor goes; the view says it ended.
120
+ session.terminal.write('\x1b[?25l');
121
+ changed();
122
+ }
123
+ }
124
+ Terminals.receive = receive;
125
+ function remove(terminalId) {
126
+ const session = sessions.get(terminalId);
127
+ if (session && sessions.delete(terminalId)) {
128
+ session.terminal.dispose();
129
+ closed.add(terminalId);
130
+ changed();
131
+ }
132
+ }
133
+ Terminals.remove = remove;
134
+ function rename(terminalId, name) {
135
+ const session = sessions.get(terminalId);
136
+ if (session && session.name !== name) {
137
+ session.name = name;
138
+ changed();
139
+ }
140
+ }
141
+ Terminals.rename = rename;
142
+ /** Its screen is in sight in `element`: what it rang there is seen. The function returned says it no longer is. */
143
+ function see(terminalId, element) {
144
+ seen = { terminalId, element };
145
+ const session = sessions.get(terminalId);
146
+ if (session === null || session === void 0 ? void 0 : session.attention) {
147
+ session.attention = false;
148
+ changed();
149
+ }
150
+ return () => {
151
+ if ((seen === null || seen === void 0 ? void 0 : seen.element) === element) {
152
+ seen = undefined;
153
+ }
154
+ };
155
+ }
156
+ Terminals.see = see;
157
+ function setCtrl(terminalId, ctrl) {
158
+ const session = sessions.get(terminalId);
159
+ if (session && session.exitCode === undefined && Boolean(session.ctrl) !== ctrl) {
160
+ session.ctrl = ctrl;
161
+ changed();
162
+ }
163
+ }
164
+ Terminals.setCtrl = setCtrl;
165
+ /** A new shell in the place of one, where it started and with its name; the one before closes. Its id. */
166
+ async function restart(session) {
167
+ const old = session.info.terminalId;
168
+ const { cols, rows } = session.terminal;
169
+ const info = await host_1.pi.terminals.openTerminal({ cwd: session.info.cwd || undefined, cols, rows });
170
+ const created = create(info, session.name);
171
+ sessions = new Map([...sessions].map(([id, other]) => (id === old ? [info.terminalId, created] : [id, other])));
172
+ if (!sessions.has(info.terminalId)) {
173
+ sessions.set(info.terminalId, created);
174
+ }
175
+ closed.add(old);
176
+ session.terminal.dispose();
177
+ if (session.exitCode === undefined) {
178
+ void host_1.pi.terminals.closeTerminal(old).catch(() => undefined);
179
+ }
180
+ changed();
181
+ return info.terminalId;
182
+ }
183
+ Terminals.restart = restart;
184
+ /** Takes back the shells of this page after a reconnect. */
185
+ async function sync() {
186
+ for (const info of await host_1.pi.terminals.listTerminals()) {
187
+ add(info);
188
+ }
189
+ }
190
+ Terminals.sync = sync;
191
+ })(Terminals || (exports.Terminals = Terminals = {}));
192
+ function useTerminals() {
193
+ return react_1.React.useSyncExternalStore(Terminals.subscribe, Terminals.all);
194
+ }
195
+ function cwdOf(session) {
196
+ return session.terminal.cwd || session.info.cwd;
197
+ }
198
+ /** The hover text of a tab: what runs there, if anything, and where. */
199
+ function hintOf(session) {
200
+ var _a;
201
+ const title = (_a = session.terminal.title) === null || _a === void 0 ? void 0 : _a.trim();
202
+ return title ? `${title} — ${cwdOf(session)}` : cwdOf(session);
203
+ }
204
+ async function close(session) {
205
+ Terminals.remove(session.info.terminalId);
206
+ if (session.exitCode === undefined) {
207
+ await host_1.pi.terminals.closeTerminal(session.info.terminalId).catch(() => undefined);
208
+ }
209
+ }
210
+ function closeEach(sessions) {
211
+ for (const session of sessions) {
212
+ void close(session);
213
+ }
214
+ }
215
+ function copySelection(session) {
216
+ var _a;
217
+ const text = session.terminal.getSelection();
218
+ if (text) {
219
+ void ((_a = navigator.clipboard) === null || _a === void 0 ? void 0 : _a.writeText(text).catch(() => undefined));
220
+ }
221
+ }
222
+ function pasteClipboard(session) {
223
+ var _a;
224
+ void ((_a = navigator.clipboard) === null || _a === void 0 ? void 0 : _a.readText().then(text => text && session.terminal.paste(text)).catch(() => undefined));
225
+ }
226
+ //# sourceMappingURL=terminal-sessions.js.map
@@ -1,46 +1,7 @@
1
- import type { TaTerminalInfo } from '@celljs/ta-protocol';
2
- import type { WebTerminal, WebTerminalProgress } from '@celljs/ta-web/lib/browser/extension/web-extension-api';
3
- /** `pty` is false for a shell on pipes (the server has no `script`). */
4
- type TerminalInfo = TaTerminalInfo;
5
- interface Session {
6
- info: TerminalInfo;
7
- terminal: WebTerminal;
8
- exitCode?: number;
9
- /** The name the user gave its tab. */
10
- name?: string;
11
- /**
12
- * The title its program set last (OSC 0 or 2), as a terminal's tab shows it: a coding agent's task,
13
- * its spinner as it works; an empty one leaves it as it was. The progress it reports (OSC 9;4).
14
- */
15
- title?: string;
16
- progress?: WebTerminalProgress;
17
- /** It rang or notified while it was not in sight: its tab says so until it is. */
18
- attention?: boolean;
19
- /** The Ctrl of the keys of a touch screen: held for the next key typed. */
20
- ctrl?: boolean;
21
- }
22
- /** The terminals of this page and what they printed; they outlive the views that show them. */
23
- export declare namespace Terminals {
24
- function all(): Session[];
25
- function get(id: string): Session | undefined;
26
- function subscribe(listener: () => void): () => void;
27
- function add(info: TerminalInfo): Session;
28
- function receive(terminalId: string, data: string, exitCode?: number): void;
29
- function remove(terminalId: string): void;
30
- function rename(terminalId: string, name: string | undefined): void;
31
- /** Its screen is in sight in `element`: what it rang there is seen. The function returned says it no longer is. */
32
- function see(terminalId: string, element: HTMLElement): () => void;
33
- function setCtrl(terminalId: string, ctrl: boolean): void;
34
- /** A new shell in the place of one, where it started and with its name; the one before closes. Its id. */
35
- function restart(session: Session): Promise<string>;
36
- /** Takes back the shells of this page after a reconnect. */
37
- function sync(): Promise<void>;
38
- }
39
1
  /**
40
2
  * The terminals of the page in one tab of the workbench. One shows under a bar with its title; more show
41
3
  * as tabs there. The bar opens a new one and kills the one shown; the tabs and the screen have their
42
4
  * menus. The first opens with the view.
43
5
  */
44
6
  export declare function TerminalView(): import("react").JSX.Element;
45
- export {};
46
7
  //# sourceMappingURL=terminal.d.ts.map
@@ -1,225 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Terminals = void 0;
4
3
  exports.TerminalView = TerminalView;
5
4
  const common_1 = require("./common");
6
5
  const host_1 = require("./host");
7
6
  const i18n_1 = require("./i18n");
8
7
  const react_1 = require("./react");
8
+ const terminal_sessions_1 = require("./terminal-sessions");
9
9
  const terminal_1 = require("./util/terminal");
10
10
  const workspace_1 = require("./util/workspace");
11
- const RESIZE_MS = 120;
12
- /** A shell opens at this size, and its screen with it, until its view fits it. */
13
- const OPEN_COLS = 100;
14
- const OPEN_ROWS = 30;
15
- /** The terminals of this page and what they printed; they outlive the views that show them. */
16
- var Terminals;
17
- (function (Terminals) {
18
- let sessions = new Map();
19
- /** Closed here: what the server still sends of them (their end) does not bring them back. */
20
- const closed = new Set();
21
- const listeners = new Set();
22
- let list = [];
23
- let frame = 0;
24
- /** The screen in sight, if any: one that rings there needs no mark. */
25
- let seen;
26
- function all() {
27
- return list;
28
- }
29
- Terminals.all = all;
30
- function get(id) {
31
- return sessions.get(id);
32
- }
33
- Terminals.get = get;
34
- function subscribe(listener) {
35
- listeners.add(listener);
36
- return () => listeners.delete(listener);
37
- }
38
- Terminals.subscribe = subscribe;
39
- /** The list of terminals, their names, directories or how one ended changed: views read it again once a frame. */
40
- function changed() {
41
- list = [...sessions.values()];
42
- if (!frame) {
43
- frame = requestAnimationFrame(() => {
44
- frame = 0;
45
- for (const listener of listeners) {
46
- listener();
47
- }
48
- });
49
- }
50
- }
51
- function create(info, name) {
52
- const terminal = host_1.pi.ui.createTerminal({ cols: OPEN_COLS, rows: OPEN_ROWS, cwd: info.cwd || undefined });
53
- const created = { info, terminal, name };
54
- const id = info.terminalId;
55
- terminal.onData(data => {
56
- if (created.exitCode !== undefined) {
57
- return;
58
- }
59
- if (created.ctrl) {
60
- created.ctrl = false;
61
- data = terminal_1.TerminalUtil.ctrl(data);
62
- changed();
63
- }
64
- void host_1.pi.terminals.writeTerminal(id, data).catch(() => undefined);
65
- });
66
- // The shell hears the last size, once the view stopped changing.
67
- let timer;
68
- terminal.onResize(({ cols, rows }) => {
69
- clearTimeout(timer);
70
- timer = setTimeout(() => void host_1.pi.terminals.resizeTerminal(id, cols, rows).catch(() => undefined), RESIZE_MS);
71
- });
72
- // Its tab names the directory it is in, what its program says it does and how far it is.
73
- terminal.onCwdChange(() => changed());
74
- terminal.onTitleChange(raw => {
75
- const title = terminal_1.TerminalUtil.title(raw);
76
- if (title && title !== created.title) {
77
- created.title = title;
78
- changed();
79
- }
80
- });
81
- terminal.onProgressChange(progress => {
82
- created.progress = progress;
83
- changed();
84
- });
85
- terminal.onAttention(() => {
86
- const element = (seen === null || seen === void 0 ? void 0 : seen.terminalId) === created.info.terminalId ? seen.element : undefined;
87
- const inSight = (element === null || element === void 0 ? void 0 : element.isConnected) && element.offsetParent !== null && !document.hidden;
88
- if (!inSight && !created.attention) {
89
- created.attention = true;
90
- changed();
91
- }
92
- });
93
- return created;
94
- }
95
- function add(info) {
96
- let session = sessions.get(info.terminalId);
97
- if (!session) {
98
- session = create(info);
99
- sessions.set(info.terminalId, session);
100
- changed();
101
- }
102
- return session;
103
- }
104
- Terminals.add = add;
105
- function receive(terminalId, data, exitCode) {
106
- var _a;
107
- if (closed.has(terminalId)) {
108
- return;
109
- }
110
- const session = (_a = sessions.get(terminalId)) !== null && _a !== void 0 ? _a : add({ terminalId, cwd: '', shell: '', pty: true });
111
- session.terminal.write(data);
112
- // JSON has no undefined: a terminal that goes on sends null.
113
- if (exitCode !== undefined && exitCode !== null) {
114
- session.exitCode = exitCode;
115
- session.ctrl = false;
116
- // Nothing more is typed there: the cursor goes; the view says it ended.
117
- session.terminal.write('\x1b[?25l');
118
- changed();
119
- }
120
- }
121
- Terminals.receive = receive;
122
- function remove(terminalId) {
123
- const session = sessions.get(terminalId);
124
- if (session && sessions.delete(terminalId)) {
125
- session.terminal.dispose();
126
- closed.add(terminalId);
127
- changed();
128
- }
129
- }
130
- Terminals.remove = remove;
131
- function rename(terminalId, name) {
132
- const session = sessions.get(terminalId);
133
- if (session && session.name !== name) {
134
- session.name = name;
135
- changed();
136
- }
137
- }
138
- Terminals.rename = rename;
139
- /** Its screen is in sight in `element`: what it rang there is seen. The function returned says it no longer is. */
140
- function see(terminalId, element) {
141
- seen = { terminalId, element };
142
- const session = sessions.get(terminalId);
143
- if (session === null || session === void 0 ? void 0 : session.attention) {
144
- session.attention = false;
145
- changed();
146
- }
147
- return () => {
148
- if ((seen === null || seen === void 0 ? void 0 : seen.element) === element) {
149
- seen = undefined;
150
- }
151
- };
152
- }
153
- Terminals.see = see;
154
- function setCtrl(terminalId, ctrl) {
155
- const session = sessions.get(terminalId);
156
- if (session && session.exitCode === undefined && Boolean(session.ctrl) !== ctrl) {
157
- session.ctrl = ctrl;
158
- changed();
159
- }
160
- }
161
- Terminals.setCtrl = setCtrl;
162
- /** A new shell in the place of one, where it started and with its name; the one before closes. Its id. */
163
- async function restart(session) {
164
- const old = session.info.terminalId;
165
- const { cols, rows } = session.terminal;
166
- const info = await host_1.pi.terminals.openTerminal({ cwd: session.info.cwd || undefined, cols, rows });
167
- const created = create(info, session.name);
168
- sessions = new Map([...sessions].map(([id, other]) => (id === old ? [info.terminalId, created] : [id, other])));
169
- if (!sessions.has(info.terminalId)) {
170
- sessions.set(info.terminalId, created);
171
- }
172
- closed.add(old);
173
- session.terminal.dispose();
174
- if (session.exitCode === undefined) {
175
- void host_1.pi.terminals.closeTerminal(old).catch(() => undefined);
176
- }
177
- changed();
178
- return info.terminalId;
179
- }
180
- Terminals.restart = restart;
181
- /** Takes back the shells of this page after a reconnect. */
182
- async function sync() {
183
- for (const info of await host_1.pi.terminals.listTerminals()) {
184
- add(info);
185
- }
186
- }
187
- Terminals.sync = sync;
188
- })(Terminals || (exports.Terminals = Terminals = {}));
189
- function useTerminals() {
190
- return react_1.React.useSyncExternalStore(Terminals.subscribe, Terminals.all);
191
- }
192
- function cwdOf(session) {
193
- return session.terminal.cwd || session.info.cwd;
194
- }
195
- /** The hover text of a tab: what runs there, if anything, and where. */
196
- function hintOf(session) {
197
- var _a;
198
- const title = (_a = session.terminal.title) === null || _a === void 0 ? void 0 : _a.trim();
199
- return title ? `${title} — ${cwdOf(session)}` : cwdOf(session);
200
- }
201
- async function close(session) {
202
- Terminals.remove(session.info.terminalId);
203
- if (session.exitCode === undefined) {
204
- await host_1.pi.terminals.closeTerminal(session.info.terminalId).catch(() => undefined);
205
- }
206
- }
207
- function closeEach(sessions) {
208
- for (const session of sessions) {
209
- void close(session);
210
- }
211
- }
212
- function copySelection(session) {
213
- var _a;
214
- const text = session.terminal.getSelection();
215
- if (text) {
216
- void ((_a = navigator.clipboard) === null || _a === void 0 ? void 0 : _a.writeText(text).catch(() => undefined));
217
- }
218
- }
219
- function pasteClipboard(session) {
220
- var _a;
221
- void ((_a = navigator.clipboard) === null || _a === void 0 ? void 0 : _a.readText().then(text => text && session.terminal.paste(text)).catch(() => undefined));
222
- }
223
11
  /**
224
12
  * What the tab of a terminal shows before its title: its number (T1, T2, …), which tells tabs of the same
225
13
  * title apart, then how it ended or how far its program is (OSC 9;4).
@@ -282,7 +70,7 @@ function RenameField({ value, onDone }) {
282
70
  function TerminalView() {
283
71
  var _a;
284
72
  const cwd = host_1.pi.ui.useCwd();
285
- const sessions = useTerminals();
73
+ const sessions = (0, terminal_sessions_1.useTerminals)();
286
74
  const [shown, setShown] = react_1.React.useState();
287
75
  const [renaming, setRenaming] = react_1.React.useState();
288
76
  const [error, setError] = react_1.React.useState();
@@ -294,7 +82,7 @@ function TerminalView() {
294
82
  opening.current = true;
295
83
  try {
296
84
  setError(undefined);
297
- setShown(Terminals.add(await host_1.pi.terminals.openTerminal({ cwd, cols: OPEN_COLS, rows: OPEN_ROWS })).info.terminalId);
85
+ setShown(terminal_sessions_1.Terminals.add(await host_1.pi.terminals.openTerminal({ cwd, cols: terminal_sessions_1.OPEN_COLS, rows: terminal_sessions_1.OPEN_ROWS })).info.terminalId);
298
86
  }
299
87
  catch (failure) {
300
88
  setError(host_1.Host.message(failure));
@@ -305,8 +93,8 @@ function TerminalView() {
305
93
  }, [cwd]);
306
94
  // Once, when the view opens.
307
95
  react_1.React.useEffect(() => {
308
- Terminals.sync().then(async () => {
309
- if (Terminals.all().length === 0) {
96
+ terminal_sessions_1.Terminals.sync().then(async () => {
97
+ if (terminal_sessions_1.Terminals.all().length === 0) {
310
98
  await create();
311
99
  }
312
100
  }, failure => setError(host_1.Host.message(failure)));
@@ -325,12 +113,12 @@ function TerminalView() {
325
113
  })), (0, i18n_1.t)('terminal'));
326
114
  const titleOf = (session) => { var _a; return (_a = titles[sessions.indexOf(session)]) !== null && _a !== void 0 ? _a : (0, i18n_1.t)('terminal'); };
327
115
  const restart = (session) => {
328
- Terminals.restart(session).then(setShown, failure => setError(host_1.Host.message(failure)));
116
+ terminal_sessions_1.Terminals.restart(session).then(setShown, failure => setError(host_1.Host.message(failure)));
329
117
  };
330
118
  const finishRename = (session) => (name, keep) => {
331
119
  setRenaming(undefined);
332
120
  if (keep) {
333
- Terminals.rename(session.info.terminalId, name);
121
+ terminal_sessions_1.Terminals.rename(session.info.terminalId, name);
334
122
  }
335
123
  session.terminal.focus();
336
124
  };
@@ -345,13 +133,13 @@ function TerminalView() {
345
133
  { label: (0, i18n_1.t)('renameTerminal'), run: () => setRenaming(session.info.terminalId) },
346
134
  { label: (0, i18n_1.t)('restartTerminal'), run: () => restart(session) },
347
135
  '-',
348
- { label: (0, i18n_1.t)('close'), run: () => void close(session) },
349
- { label: (0, i18n_1.t)('closeOthers'), run: () => closeEach(others), disabled: others.length === 0 },
350
- { label: (0, i18n_1.t)('closeToTheLeft'), run: () => closeEach(left), disabled: left.length === 0 },
351
- { label: (0, i18n_1.t)('closeTabsToTheRight'), run: () => closeEach(right), disabled: right.length === 0 },
136
+ { label: (0, i18n_1.t)('close'), run: () => void (0, terminal_sessions_1.close)(session) },
137
+ { label: (0, i18n_1.t)('closeOthers'), run: () => (0, terminal_sessions_1.closeEach)(others), disabled: others.length === 0 },
138
+ { label: (0, i18n_1.t)('closeToTheLeft'), run: () => (0, terminal_sessions_1.closeEach)(left), disabled: left.length === 0 },
139
+ { label: (0, i18n_1.t)('closeTabsToTheRight'), run: () => (0, terminal_sessions_1.closeEach)(right), disabled: right.length === 0 },
352
140
  '-',
353
- { label: (0, i18n_1.t)('closeEnded'), run: () => closeEach(ended), disabled: ended.length === 0 },
354
- { label: (0, i18n_1.t)('closeAll'), run: () => closeEach(sessions) },
141
+ { label: (0, i18n_1.t)('closeEnded'), run: () => (0, terminal_sessions_1.closeEach)(ended), disabled: ended.length === 0 },
142
+ { label: (0, i18n_1.t)('closeAll'), run: () => (0, terminal_sessions_1.closeEach)(sessions) },
355
143
  '-',
356
144
  { label: (0, i18n_1.t)('newTerminal'), run: () => void create() },
357
145
  ];
@@ -363,8 +151,8 @@ function TerminalView() {
363
151
  session.terminal.focus();
364
152
  };
365
153
  return [
366
- { label: (0, i18n_1.t)('copy'), keys: host_1.MAC ? '⌘C' : 'Ctrl+Shift+C', run: refocus(() => copySelection(session)), disabled: !selected },
367
- { label: (0, i18n_1.t)('paste'), keys: host_1.MAC ? '⌘V' : 'Ctrl+Shift+V', run: refocus(() => pasteClipboard(session)), disabled: session.exitCode !== undefined },
154
+ { label: (0, i18n_1.t)('copy'), keys: host_1.MAC ? '⌘C' : 'Ctrl+Shift+C', run: refocus(() => (0, terminal_sessions_1.copySelection)(session)), disabled: !selected },
155
+ { label: (0, i18n_1.t)('paste'), keys: host_1.MAC ? '⌘V' : 'Ctrl+Shift+V', run: refocus(() => (0, terminal_sessions_1.pasteClipboard)(session)), disabled: session.exitCode !== undefined },
368
156
  { label: (0, i18n_1.t)('selectAll'), run: refocus(() => session.terminal.selectAll()) },
369
157
  '-',
370
158
  { label: (0, i18n_1.t)('clearTerminal'), keys: host_1.MAC ? '⌘K' : undefined, run: refocus(() => session.terminal.clear()) },
@@ -372,7 +160,7 @@ function TerminalView() {
372
160
  { label: (0, i18n_1.t)('newTerminal'), run: () => void create() },
373
161
  { label: (0, i18n_1.t)('renameTerminal'), run: () => setRenaming(session.info.terminalId) },
374
162
  { label: (0, i18n_1.t)('restartTerminal'), run: () => restart(session) },
375
- { label: (0, i18n_1.t)('killTerminal'), run: () => void close(session) },
163
+ { label: (0, i18n_1.t)('killTerminal'), run: () => void (0, terminal_sessions_1.close)(session) },
376
164
  ];
377
165
  };
378
166
  return (react_1.React.createElement("div", { className: "taw-view taw-terminals" },
@@ -381,22 +169,22 @@ function TerminalView() {
381
169
  const id = session.info.terminalId;
382
170
  const on = session === current;
383
171
  const title = titleOf(session);
384
- return (react_1.React.createElement("div", { key: id, className: `taw-terminal-tab ${on ? 'taw-on' : ''}`, title: hintOf(session) },
172
+ return (react_1.React.createElement("div", { key: id, className: `taw-terminal-tab ${on ? 'taw-on' : ''}`, title: (0, terminal_sessions_1.hintOf)(session) },
385
173
  renaming === id ? (react_1.React.createElement("span", { className: "taw-terminal-tab-main" },
386
174
  react_1.React.createElement(TerminalBadge, { session: session, index: sessions.indexOf(session) }),
387
- react_1.React.createElement(RenameField, { value: title, onDone: finishRename(session) }))) : (react_1.React.createElement("button", { type: "button", role: "tab", className: "taw-terminal-tab-main", "aria-selected": on, onClick: () => setShown(id), onDoubleClick: () => setRenaming(id), onAuxClick: event => event.button === 1 && void close(session), onContextMenu: event => openMenu(event, tabMenu(session)) },
175
+ react_1.React.createElement(RenameField, { value: title, onDone: finishRename(session) }))) : (react_1.React.createElement("button", { type: "button", role: "tab", className: "taw-terminal-tab-main", "aria-selected": on, onClick: () => setShown(id), onDoubleClick: () => setRenaming(id), onAuxClick: event => event.button === 1 && void (0, terminal_sessions_1.close)(session), onContextMenu: event => openMenu(event, tabMenu(session)) },
388
176
  react_1.React.createElement(TerminalBadge, { session: session, index: sessions.indexOf(session) }),
389
177
  react_1.React.createElement("span", { className: "taw-terminal-tab-title" }, title),
390
178
  stateOf(session) && react_1.React.createElement("span", { className: "taw-sr-only" }, stateOf(session)),
391
179
  session.attention && !on && (react_1.React.createElement("span", { className: "taw-terminal-attention" },
392
180
  react_1.React.createElement("span", { className: "taw-sr-only" }, (0, i18n_1.t)('terminalAttention')))))),
393
- react_1.React.createElement(common_1.Action, { icon: "X", label: (0, i18n_1.t)('close'), onClick: () => void close(session) })));
394
- }))) : (current && (react_1.React.createElement("div", { className: "taw-terminal-title", title: hintOf(current), onDoubleClick: () => setRenaming(current.info.terminalId), onContextMenu: event => openMenu(event, tabMenu(current)) },
181
+ react_1.React.createElement(common_1.Action, { icon: "X", label: (0, i18n_1.t)('close'), onClick: () => void (0, terminal_sessions_1.close)(session) })));
182
+ }))) : (current && (react_1.React.createElement("div", { className: "taw-terminal-title", title: (0, terminal_sessions_1.hintOf)(current), onDoubleClick: () => setRenaming(current.info.terminalId), onContextMenu: event => openMenu(event, tabMenu(current)) },
395
183
  react_1.React.createElement(TerminalBadge, { session: current, index: sessions.indexOf(current) }),
396
184
  renaming === current.info.terminalId ? (react_1.React.createElement(RenameField, { value: titleOf(current), onDone: finishRename(current) })) : (react_1.React.createElement("span", { className: "taw-terminal-tab-title" }, titleOf(current)))))),
397
185
  react_1.React.createElement("div", { className: "taw-actions" },
398
186
  react_1.React.createElement(common_1.Action, { icon: "Plus", label: (0, i18n_1.t)('newTerminal'), onClick: () => void create() }),
399
- current && react_1.React.createElement(common_1.Action, { icon: "Trash2", label: (0, i18n_1.t)('killTerminal'), onClick: () => void close(current) }))),
187
+ current && react_1.React.createElement(common_1.Action, { icon: "Trash2", label: (0, i18n_1.t)('killTerminal'), onClick: () => void (0, terminal_sessions_1.close)(current) }))),
400
188
  menu,
401
189
  error && react_1.React.createElement(common_1.Empty, { tone: "error", title: (0, i18n_1.t)('failed', { message: error }) }),
402
190
  !error && sessions.length === 0 && (react_1.React.createElement(common_1.Empty, { title: (0, i18n_1.t)('noTerminals') },
@@ -427,10 +215,10 @@ function TouchKeys({ session }) {
427
215
  };
428
216
  const id = session.info.terminalId;
429
217
  return (react_1.React.createElement("div", { className: "taw-touch-keys", role: "toolbar", "aria-label": (0, i18n_1.t)('terminalKeys') },
430
- react_1.React.createElement("button", { type: "button", className: `taw-touch-key ${session.ctrl ? 'taw-on' : ''}`, "aria-pressed": Boolean(session.ctrl), onPointerDown: keep, onMouseDown: keep, onClick: press(() => Terminals.setCtrl(id, !session.ctrl)) }, "Ctrl"),
218
+ react_1.React.createElement("button", { type: "button", className: `taw-touch-key ${session.ctrl ? 'taw-on' : ''}`, "aria-pressed": Boolean(session.ctrl), onPointerDown: keep, onMouseDown: keep, onClick: press(() => terminal_sessions_1.Terminals.setCtrl(id, !session.ctrl)) }, "Ctrl"),
431
219
  TOUCH_KEYS.map(({ label, key, text }) => (react_1.React.createElement("button", { key: label, type: "button", className: "taw-touch-key", onPointerDown: keep, onMouseDown: keep, onClick: press(() => {
432
220
  if (key) {
433
- Terminals.setCtrl(id, false);
221
+ terminal_sessions_1.Terminals.setCtrl(id, false);
434
222
  session.terminal.sendKey(key);
435
223
  }
436
224
  else if (text) {
@@ -441,8 +229,8 @@ function TouchKeys({ session }) {
441
229
  /** The screen of a shell: its terminal, moved into this view while it shows. */
442
230
  function TerminalEditor({ terminalId, onMenu, onRestart, }) {
443
231
  var _a;
444
- useTerminals();
445
- const session = Terminals.get(terminalId);
232
+ (0, terminal_sessions_1.useTerminals)();
233
+ const session = terminal_sessions_1.Terminals.get(terminalId);
446
234
  const box = react_1.React.useRef(null);
447
235
  const terminal = session === null || session === void 0 ? void 0 : session.terminal;
448
236
  react_1.React.useEffect(() => {
@@ -451,7 +239,7 @@ function TerminalEditor({ terminalId, onMenu, onRestart, }) {
451
239
  return;
452
240
  }
453
241
  const detach = terminal.attach(element);
454
- const unsee = Terminals.see(terminalId, element);
242
+ const unsee = terminal_sessions_1.Terminals.see(terminalId, element);
455
243
  terminal.focus();
456
244
  return () => {
457
245
  unsee();
@@ -464,7 +252,7 @@ function TerminalEditor({ terminalId, onMenu, onRestart, }) {
464
252
  const ended = session.exitCode !== undefined;
465
253
  return (react_1.React.createElement("div", { className: "taw-editor" },
466
254
  session.info.pty === false && react_1.React.createElement("div", { className: "taw-hint" }, (0, i18n_1.t)('pipeMode')),
467
- react_1.React.createElement("div", { className: "taw-terminal", ref: box, onFocus: () => box.current && Terminals.see(terminalId, box.current), onContextMenu: event => onMenu(event, session), onDragOver: event => {
255
+ react_1.React.createElement("div", { className: "taw-terminal", ref: box, onFocus: () => box.current && terminal_sessions_1.Terminals.see(terminalId, box.current), onContextMenu: event => onMenu(event, session), onDragOver: event => {
468
256
  if (host_1.pi.ui.fileDrag.has(event.dataTransfer)) {
469
257
  event.preventDefault();
470
258
  event.dataTransfer.dropEffect = 'copy';
@@ -486,6 +274,6 @@ function TerminalEditor({ terminalId, onMenu, onRestart, }) {
486
274
  react_1.React.createElement("button", { type: "button", className: "taw-button", onClick: () => onRestart(session) },
487
275
  react_1.React.createElement(common_1.Glyph, { name: "RotateCcw", size: 13 }),
488
276
  (0, i18n_1.t)('restartTerminal')),
489
- react_1.React.createElement("button", { type: "button", className: "taw-button", onClick: () => void close(session) }, (0, i18n_1.t)('close')))) : (react_1.React.createElement(TouchKeys, { session: session }))));
277
+ react_1.React.createElement("button", { type: "button", className: "taw-button", onClick: () => void (0, terminal_sessions_1.close)(session) }, (0, i18n_1.t)('close')))) : (react_1.React.createElement(TouchKeys, { session: session }))));
490
278
  }
491
279
  //# sourceMappingURL=terminal.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celljs/ta-workspace",
3
- "version": "4.9.0",
3
+ "version": "4.9.1",
4
4
  "description": "A pi package for Ta: the workspace beside the conversation, with an explorer, open files, search, source control, terminals and a browser",
5
5
  "keywords": [
6
6
  "pi-package"