openclacky 1.5.25 → 1.5.26

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 (91) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +61 -0
  3. data/lib/clacky/agent/chunk_index.rb +2 -1
  4. data/lib/clacky/agent/message_compressor_helper.rb +20 -2
  5. data/lib/clacky/agent/session_serializer.rb +28 -1
  6. data/lib/clacky/agent/skill_manager.rb +2 -8
  7. data/lib/clacky/agent/time_machine.rb +108 -127
  8. data/lib/clacky/agent/tool_executor.rb +2 -11
  9. data/lib/clacky/agent.rb +15 -19
  10. data/lib/clacky/agent_config.rb +14 -4
  11. data/lib/clacky/billing/media_usage.rb +69 -0
  12. data/lib/clacky/billing/platform_billing.rb +5 -0
  13. data/lib/clacky/brand_config.rb +16 -215
  14. data/lib/clacky/default_extensions/ext-studio/agents/ext-developer/system_prompt.md +2 -80
  15. data/lib/clacky/default_extensions/ext-studio/panels/studio/view.js +1 -1
  16. data/lib/clacky/default_extensions/ext-studio/skills/ext-develop/SKILL.md +10 -96
  17. data/lib/clacky/default_extensions/git/panels/git/view.js +208 -69
  18. data/lib/clacky/default_extensions/knowledge/README.md +1 -1
  19. data/lib/clacky/default_extensions/knowledge/README.zh.md +1 -1
  20. data/lib/clacky/default_extensions/knowledge/lib/importer.rb +1 -1
  21. data/lib/clacky/default_extensions/knowledge/panels/kb/view.js +3 -3
  22. data/lib/clacky/default_extensions/meeting/api/handler.rb +23 -2
  23. data/lib/clacky/default_extensions/meeting/panels/meeting/view.js +194 -36
  24. data/lib/clacky/default_extensions/preview/icon.svg +3 -2
  25. data/lib/clacky/default_extensions/secretary/panels/work/view.js +108 -33
  26. data/lib/clacky/default_extensions/side-chat/README.md +40 -0
  27. data/lib/clacky/default_extensions/side-chat/README.zh.md +40 -0
  28. data/lib/clacky/default_extensions/side-chat/api/handler.rb +90 -0
  29. data/lib/clacky/default_extensions/side-chat/api/runtime.rb +411 -0
  30. data/lib/clacky/default_extensions/side-chat/ext.yml +16 -0
  31. data/lib/clacky/default_extensions/side-chat/icon.svg +14 -0
  32. data/lib/clacky/default_extensions/side-chat/panels/side-chat/view.js +779 -0
  33. data/lib/clacky/default_extensions/terminal/README.md +36 -0
  34. data/lib/clacky/default_extensions/terminal/README.zh.md +36 -0
  35. data/lib/clacky/default_extensions/terminal/api/handler.rb +121 -0
  36. data/lib/clacky/default_extensions/terminal/api/runtime.rb +397 -0
  37. data/lib/clacky/default_extensions/terminal/ext.yml +16 -0
  38. data/lib/clacky/default_extensions/terminal/icon.svg +13 -0
  39. data/lib/clacky/default_extensions/terminal/panels/terminal/view.js +351 -0
  40. data/lib/clacky/default_extensions/terminal/vendor/LICENSE +21 -0
  41. data/lib/clacky/default_extensions/terminal/vendor/addon-fit.js +2 -0
  42. data/lib/clacky/default_extensions/terminal/vendor/xterm.css +218 -0
  43. data/lib/clacky/default_extensions/terminal/vendor/xterm.js +2 -0
  44. data/lib/clacky/default_skills/media-gen/SKILL.md +30 -9
  45. data/lib/clacky/extension/api_extension.rb +12 -0
  46. data/lib/clacky/locales/en.rb +14 -11
  47. data/lib/clacky/locales/i18n.rb +25 -0
  48. data/lib/clacky/locales/zh.rb +14 -11
  49. data/lib/clacky/media/base.rb +11 -1
  50. data/lib/clacky/media/openai_compat.rb +271 -3
  51. data/lib/clacky/message_format/open_ai.rb +17 -0
  52. data/lib/clacky/prompts/base.md +3 -0
  53. data/lib/clacky/providers.rb +33 -20
  54. data/lib/clacky/reasoning_levels.rb +75 -0
  55. data/lib/clacky/server/channel/channel_ui_controller.rb +12 -5
  56. data/lib/clacky/server/git_panel.rb +40 -18
  57. data/lib/clacky/server/http_server.rb +62 -71
  58. data/lib/clacky/server/session_registry.rb +3 -0
  59. data/lib/clacky/ui2/markdown_renderer.rb +153 -0
  60. data/lib/clacky/ui2/strings_cjk_patch.rb +134 -124
  61. data/lib/clacky/utils/file_link_normalizer.rb +30 -3
  62. data/lib/clacky/utils/frontmatter.rb +63 -0
  63. data/lib/clacky/utils/model_pricing.rb +67 -9
  64. data/lib/clacky/version.rb +1 -1
  65. data/lib/clacky/web/app.css +722 -274
  66. data/lib/clacky/web/app.js +2 -0
  67. data/lib/clacky/web/components/chat-composer.js +504 -0
  68. data/lib/clacky/web/components/chat-navigator.js +1 -1
  69. data/lib/clacky/web/components/model-picker.js +319 -20
  70. data/lib/clacky/web/components/quote-select.js +97 -39
  71. data/lib/clacky/web/core/aside.js +137 -27
  72. data/lib/clacky/web/core/ext.js +658 -81
  73. data/lib/clacky/web/features/brand/store.js +0 -4
  74. data/lib/clacky/web/features/brand/view.js +2 -99
  75. data/lib/clacky/web/features/extensions/store.js +3 -1
  76. data/lib/clacky/web/features/extensions/view.js +14 -15
  77. data/lib/clacky/web/features/new-session/store.js +4 -0
  78. data/lib/clacky/web/features/new-session/view.js +27 -4
  79. data/lib/clacky/web/features/skills/store.js +7 -5
  80. data/lib/clacky/web/features/skills/view.js +65 -16
  81. data/lib/clacky/web/features/version/view.js +1 -1
  82. data/lib/clacky/web/features/workspace/store.js +7 -3
  83. data/lib/clacky/web/features/workspace/view.js +46 -5
  84. data/lib/clacky/web/i18n.js +104 -58
  85. data/lib/clacky/web/index.html +21 -22
  86. data/lib/clacky/web/lib/box-diagram.js +239 -0
  87. data/lib/clacky/web/sessions.js +117 -151
  88. data/lib/clacky/web/settings.js +23 -16
  89. data/lib/clacky/web/ws-dispatcher.js +4 -1
  90. data/lib/clacky.rb +2 -0
  91. metadata +24 -1
@@ -0,0 +1,351 @@
1
+ // ── Official panel: terminal ──────────────────────────────────────────────
2
+ //
3
+ // A real shell in the session's working directory, rendered by xterm.js inside
4
+ // the session aside. The shell itself lives in the openclacky process (see
5
+ // api/runtime.rb); this file owns only the view.
6
+ //
7
+ // Two things drive the shape of this code:
8
+ // - The aside re-renders the active tab's body on every activation, so the
9
+ // xterm instance is created once per session and its element is re-parented
10
+ // into the fresh container. Re-creating it would lose the scrollback.
11
+ // - Output arrives as base64 bytes (PTY reads split multi-byte UTF-8), so it
12
+ // is decoded into a Uint8Array instead of being written as a JS string.
13
+ // ───────────────────────────────────────────────────────────────────────────
14
+
15
+ (() => {
16
+ if (!window.Clacky || !Clacky.ext) return;
17
+
18
+ const API_BASE = "/api/ext/terminal";
19
+ const ASSET_BASE = "/ext_ui/terminal/vendor/";
20
+ const WS_PREFIX = "ext.terminal.";
21
+ const TAB_SLOT = "session.aside";
22
+ const TAB_ID = "terminal";
23
+
24
+ const t = (key, fallback, params) => {
25
+ const value = (typeof I18n !== "undefined") ? I18n.t(key, params) : null;
26
+ return (value && value !== key) ? value : fallback;
27
+ };
28
+
29
+ let assetsPromise = null;
30
+
31
+ function loadAssets() {
32
+ if (assetsPromise) return assetsPromise;
33
+ assetsPromise = new Promise((resolve, reject) => {
34
+ if (!document.getElementById("terminal-ext-style")) {
35
+ const link = document.createElement("link");
36
+ link.id = "terminal-ext-style";
37
+ link.rel = "stylesheet";
38
+ link.href = ASSET_BASE + "xterm.css";
39
+ document.head.appendChild(link);
40
+ }
41
+ const files = ["xterm.js", "addon-fit.js"];
42
+ const next = (index) => {
43
+ if (index >= files.length) { resolve(); return; }
44
+ const script = document.createElement("script");
45
+ script.src = ASSET_BASE + files[index];
46
+ script.onload = () => next(index + 1);
47
+ script.onerror = () => reject(new Error("failed to load " + script.src));
48
+ document.head.appendChild(script);
49
+ };
50
+ next(0);
51
+ });
52
+ return assetsPromise;
53
+ }
54
+
55
+ function b64ToBytes(b64) {
56
+ const binary = atob(b64 || "");
57
+ const bytes = new Uint8Array(binary.length);
58
+ for (let i = 0; i < binary.length; i += 1) bytes[i] = binary.charCodeAt(i);
59
+ return bytes;
60
+ }
61
+
62
+ function send(rt, frame) {
63
+ if (!rt || rt.disposed || !rt.termId) return;
64
+ if (!window.Clacky || !Clacky.WS) return;
65
+ Clacky.WS.send(Object.assign({ term_id: rt.termId }, frame));
66
+ }
67
+
68
+ function styles() {
69
+ if (document.getElementById("terminal-ext-css")) return;
70
+ const style = document.createElement("style");
71
+ style.id = "terminal-ext-css";
72
+ style.textContent = `
73
+ .term-host { flex: 1 1 auto; min-height: 0; padding: 0.5rem 0.375rem 0.375rem 0.625rem; background: transparent; }
74
+ .term-host .xterm { height: 100%; }
75
+ .term-host .xterm-viewport { background: transparent !important; }
76
+ .term-host .xterm-viewport::-webkit-scrollbar { width: 0.5rem; }
77
+ .term-host .xterm-viewport::-webkit-scrollbar-thumb { background: var(--color-border-strong, rgba(0,0,0,.18)); border-radius: 0.25rem; }
78
+ .term-note { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center;
79
+ gap: 0.625rem; padding: 1.5rem; text-align: center; font-size: 0.78rem;
80
+ color: var(--color-text-secondary, #4b5563); }
81
+ .term-note-detail { font-size: 0.72rem; color: var(--color-text-tertiary, #9ca3af);
82
+ font-family: var(--font-mono, monospace); word-break: break-all; }
83
+ .term-btn-primary { border: 1px solid var(--color-border-strong, rgba(0,0,0,.14)); background: transparent;
84
+ color: inherit; border-radius: 0.375rem; padding: 0.25rem 0.75rem; font-size: 0.75rem; cursor: pointer; }
85
+ .term-btn-primary:hover { background: var(--color-bg-hover, rgba(0,0,0,.05)); }
86
+ `;
87
+ document.head.appendChild(style);
88
+ }
89
+
90
+ function build(rt) {
91
+ if (rt.disposed) return;
92
+ const css = getComputedStyle(document.documentElement);
93
+ const cssVar = (name, fallback) => (css.getPropertyValue(name) || "").trim() || fallback;
94
+ const Terminal = window.Terminal;
95
+ const FitAddon = window.FitAddon && window.FitAddon.FitAddon;
96
+ if (!Terminal || !FitAddon) return;
97
+
98
+ const term = new Terminal({
99
+ fontFamily: cssVar("--font-mono", "ui-monospace, Menlo, monospace"),
100
+ fontSize: 12.5,
101
+ lineHeight: 1.3,
102
+ letterSpacing: 0,
103
+ cursorBlink: true,
104
+ scrollback: 5000,
105
+ macOptionIsMeta: true,
106
+ theme: {
107
+ background: "rgba(0,0,0,0)",
108
+ foreground: cssVar("--color-text-primary", "#1f2328"),
109
+ cursor: cssVar("--color-text-primary", "#1f2328"),
110
+ selectionBackground: cssVar("--color-accent-soft", "rgba(79,70,229,.28)"),
111
+ },
112
+ allowTransparency: true,
113
+ });
114
+ const fit = new FitAddon();
115
+ term.loadAddon(fit);
116
+ term.onData((data) => send(rt, { type: "ext.terminal.input", data }));
117
+ rt.term = term;
118
+ rt.fit = fit;
119
+ }
120
+
121
+ function fitNow(rt) {
122
+ if (!rt.term || !rt.fit) return;
123
+ const host = rt.host;
124
+ if (!host || !host.isConnected || host.clientWidth < 8 || host.clientHeight < 8) return;
125
+ try { rt.fit.fit(); } catch (_e) { /* container not measurable yet */ }
126
+ }
127
+
128
+ // ResizeObserver fires continuously while the user drags the aside divider;
129
+ // one resize frame per animation frame is plenty for both xterm and the PTY.
130
+ function scheduleSync(rt) {
131
+ if (rt.syncFrame) return;
132
+ rt.syncFrame = requestAnimationFrame(() => {
133
+ rt.syncFrame = null;
134
+ if (rt.disposed) return;
135
+ fitNow(rt);
136
+ if (rt.term) send(rt, { type: "ext.terminal.resize", cols: rt.term.cols, rows: rt.term.rows });
137
+ });
138
+ }
139
+
140
+ function watchSize(rt) {
141
+ if (rt.ro || !rt.host) return;
142
+ rt.ro = new ResizeObserver(() => scheduleSync(rt));
143
+ rt.ro.observe(rt.host);
144
+ }
145
+
146
+ function showNote(rt, title, detail, withRetry) {
147
+ if (!rt.container) return;
148
+ hideNote(rt);
149
+ const note = document.createElement("div");
150
+ note.className = "term-note";
151
+ const line = document.createElement("div");
152
+ line.textContent = title;
153
+ note.appendChild(line);
154
+ if (detail) {
155
+ const small = document.createElement("div");
156
+ small.className = "term-note-detail";
157
+ small.textContent = detail;
158
+ note.appendChild(small);
159
+ }
160
+ if (withRetry) {
161
+ const button = document.createElement("button");
162
+ button.type = "button";
163
+ button.className = "term-btn-primary";
164
+ button.textContent = t("terminal.retry", "重试");
165
+ button.addEventListener("click", () => startShell(rt));
166
+ note.appendChild(button);
167
+ }
168
+ rt.container.appendChild(note);
169
+ rt.note = note;
170
+ if (rt.host) rt.host.style.display = "none";
171
+ }
172
+
173
+ function hideNote(rt) {
174
+ if (rt.note && rt.note.parentNode) rt.note.parentNode.removeChild(rt.note);
175
+ rt.note = null;
176
+ if (rt.host) rt.host.style.display = "";
177
+ }
178
+
179
+ // The shell is the panel: once it exits (or the server no longer knows it,
180
+ // which happens if openclacky restarts) the tab has nothing to show, so it
181
+ // closes itself exactly like the × on the tab would.
182
+ function retire(rt) {
183
+ send(rt, { type: "ext.terminal.close" });
184
+ rt.termId = null;
185
+ if (rt.term) rt.term.reset();
186
+ const ext = window.Clacky && Clacky.ext;
187
+ // A background session's runtime must not close the tab the user is
188
+ // looking at; the tab id is shared, the panel state is per session.
189
+ if (!ext || !ext.context || ext.context.sessionId !== rt.sessionId) return;
190
+ if (ext.closeTab) ext.closeTab(TAB_SLOT, TAB_ID);
191
+ }
192
+
193
+ async function startShell(rt) {
194
+ if (rt.disposed || !rt.term || rt.booting) return;
195
+ if (rt.termId) return;
196
+ hideNote(rt);
197
+ rt.booting = true;
198
+ fitNow(rt);
199
+ try {
200
+ const response = await fetch(API_BASE + "/open", {
201
+ method: "POST",
202
+ headers: { "Content-Type": "application/json" },
203
+ body: JSON.stringify({
204
+ session_id: rt.sessionId,
205
+ cols: rt.term.cols || 80,
206
+ rows: rt.term.rows || 24,
207
+ }),
208
+ });
209
+ const payload = await response.json().catch(() => ({}));
210
+ if (!response.ok) {
211
+ const title = (response.status === 403)
212
+ ? t("terminal.localOnly", "终端只能在从本机打开应用时使用。")
213
+ : (payload.error || ("HTTP " + response.status));
214
+ showNote(rt, title, null, response.status !== 403 && response.status !== 501);
215
+ return;
216
+ }
217
+ rt.termId = payload.term_id;
218
+ send(rt, { type: "ext.terminal.attach" });
219
+ rt.term.focus();
220
+ } catch (error) {
221
+ showNote(rt, t("terminal.openFailed", "无法启动终端"), String(error && error.message || error), true);
222
+ } finally {
223
+ rt.booting = false;
224
+ }
225
+ }
226
+
227
+ function onServerEvent(rt, event) {
228
+ if (!event || rt.disposed) return;
229
+
230
+ if (event.type === "_ws_connected") {
231
+ if (rt.termId) send(rt, { type: "ext.terminal.attach" });
232
+ return;
233
+ }
234
+ if (typeof event.type !== "string" || !event.type.startsWith(WS_PREFIX)) return;
235
+ if (event.term_id !== rt.termId || !rt.term) return;
236
+
237
+ switch (event.type) {
238
+ case "ext.terminal.ready":
239
+ if (event.status && event.status !== "running") { retire(rt); break; }
240
+ if (event.replay) {
241
+ rt.term.reset();
242
+ rt.term.write(b64ToBytes(event.replay));
243
+ }
244
+ fitNow(rt);
245
+ break;
246
+ case "ext.terminal.output":
247
+ rt.term.write(b64ToBytes(event.data));
248
+ break;
249
+ case "ext.terminal.exit":
250
+ case "ext.terminal.gone":
251
+ retire(rt);
252
+ break;
253
+ default:
254
+ break;
255
+ }
256
+ }
257
+
258
+ function create(ctx) {
259
+ styles();
260
+ const rt = {
261
+ sessionId: ctx && ctx.sessionId,
262
+ termId: null,
263
+ term: null,
264
+ fit: null,
265
+ host: null,
266
+ container: null,
267
+ ro: null,
268
+ note: null,
269
+ disposed: false,
270
+ booting: false,
271
+ syncFrame: null,
272
+ ready: null,
273
+ };
274
+
275
+ if (window.Clacky && Clacky.WS) {
276
+ Clacky.WS.onEvent((event) => onServerEvent(rt, event));
277
+ }
278
+ rt.ready = loadAssets().then(() => build(rt)).catch((error) => {
279
+ rt.loadError = error;
280
+ });
281
+
282
+ rt.dispose = () => {
283
+ if (rt.disposed) return;
284
+ rt.disposed = true;
285
+ if (rt.syncFrame) cancelAnimationFrame(rt.syncFrame);
286
+ if (rt.ro) { rt.ro.disconnect(); rt.ro = null; }
287
+ if (rt.termId) {
288
+ if (window.Clacky && Clacky.WS) {
289
+ Clacky.WS.send({ type: "ext.terminal.close", term_id: rt.termId });
290
+ }
291
+ rt.termId = null;
292
+ }
293
+ if (rt.term) { rt.term.dispose(); rt.term = null; }
294
+ };
295
+
296
+ return rt;
297
+ }
298
+
299
+ function render(container, ctx, rt) {
300
+ if (!rt) return undefined;
301
+ rt.container = container;
302
+
303
+ const host = document.createElement("div");
304
+ host.className = "term-host";
305
+ container.appendChild(host);
306
+
307
+ rt.host = host;
308
+
309
+ const activate = () => {
310
+ if (rt.disposed || !rt.term) return;
311
+ if (!rt.host || !rt.host.isConnected) return;
312
+ if (!rt.term.element) {
313
+ rt.term.open(host);
314
+ } else if (rt.term.element.parentNode !== host) {
315
+ host.appendChild(rt.term.element);
316
+ }
317
+ watchSize(rt);
318
+ fitNow(rt);
319
+ rt.term.focus();
320
+ // Switching tabs detaches the pane; re-attaching replays whatever the
321
+ // shell printed meanwhile, so the view is not frozen on return.
322
+ if (!rt.termId) startShell(rt);
323
+ else send(rt, { type: "ext.terminal.attach" });
324
+ };
325
+
326
+ if (rt.loadError) {
327
+ showNote(rt, t("terminal.loadFailed", "终端组件加载失败"), String(rt.loadError.message || rt.loadError), false);
328
+ } else if (rt.ready) {
329
+ rt.ready.then(activate);
330
+ }
331
+
332
+ return () => {
333
+ if (rt.ro) { rt.ro.disconnect(); rt.ro = null; }
334
+ // The shell keeps running while the page lives; the server reaps it after
335
+ // an hour without a client, or earlier when a new terminal needs the slot.
336
+ send(rt, { type: "ext.terminal.detach" });
337
+ rt.host = null;
338
+ rt.container = null;
339
+ rt.note = null;
340
+ };
341
+ }
342
+
343
+ Clacky.ext.ui.mount(TAB_SLOT, { create, render }, {
344
+ order: 35,
345
+ tab: {
346
+ id: TAB_ID,
347
+ label: () => t("terminal.tab", "终端"),
348
+ icon: '<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="5 8 10 12 5 16"/><line x1="12" y1="16.5" x2="19" y2="16.5"/></svg>',
349
+ },
350
+ });
351
+ })();
@@ -0,0 +1,21 @@
1
+ Copyright (c) 2017-2019, The xterm.js authors (https://github.com/xtermjs/xterm.js)
2
+ Copyright (c) 2014-2016, SourceLair Private Company (https://www.sourcelair.com)
3
+ Copyright (c) 2012-2013, Christopher Jeffrey (https://github.com/chjj/)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,2 @@
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.FitAddon=t():e.FitAddon=t()}(self,(()=>(()=>{"use strict";var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.FitAddon=void 0,t.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){const e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;const t=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal)return;if(!this._terminal.element||!this._terminal.element.parentElement)return;const e=this._terminal._core,t=e._renderService.dimensions;if(0===t.css.cell.width||0===t.css.cell.height)return;const r=0===this._terminal.options.scrollback?0:e.viewport.scrollBarWidth,i=window.getComputedStyle(this._terminal.element.parentElement),o=parseInt(i.getPropertyValue("height")),s=Math.max(0,parseInt(i.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),l=o-(parseInt(n.getPropertyValue("padding-top"))+parseInt(n.getPropertyValue("padding-bottom"))),a=s-(parseInt(n.getPropertyValue("padding-right"))+parseInt(n.getPropertyValue("padding-left")))-r;return{cols:Math.max(2,Math.floor(a/t.css.cell.width)),rows:Math.max(1,Math.floor(l/t.css.cell.height))}}}})(),e})()));
2
+ //# sourceMappingURL=addon-fit.js.map
@@ -0,0 +1,218 @@
1
+ /**
2
+ * Copyright (c) 2014 The xterm.js authors. All rights reserved.
3
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
4
+ * https://github.com/chjj/term.js
5
+ * @license MIT
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ *
25
+ * Originally forked from (with the author's permission):
26
+ * Fabrice Bellard's javascript vt100 for jslinux:
27
+ * http://bellard.org/jslinux/
28
+ * Copyright (c) 2011 Fabrice Bellard
29
+ * The original design remains. The terminal itself
30
+ * has been extended to include xterm CSI codes, among
31
+ * other features.
32
+ */
33
+
34
+ /**
35
+ * Default styles for xterm.js
36
+ */
37
+
38
+ .xterm {
39
+ cursor: text;
40
+ position: relative;
41
+ user-select: none;
42
+ -ms-user-select: none;
43
+ -webkit-user-select: none;
44
+ }
45
+
46
+ .xterm.focus,
47
+ .xterm:focus {
48
+ outline: none;
49
+ }
50
+
51
+ .xterm .xterm-helpers {
52
+ position: absolute;
53
+ top: 0;
54
+ /**
55
+ * The z-index of the helpers must be higher than the canvases in order for
56
+ * IMEs to appear on top.
57
+ */
58
+ z-index: 5;
59
+ }
60
+
61
+ .xterm .xterm-helper-textarea {
62
+ padding: 0;
63
+ border: 0;
64
+ margin: 0;
65
+ /* Move textarea out of the screen to the far left, so that the cursor is not visible */
66
+ position: absolute;
67
+ opacity: 0;
68
+ left: -9999em;
69
+ top: 0;
70
+ width: 0;
71
+ height: 0;
72
+ z-index: -5;
73
+ /** Prevent wrapping so the IME appears against the textarea at the correct position */
74
+ white-space: nowrap;
75
+ overflow: hidden;
76
+ resize: none;
77
+ }
78
+
79
+ .xterm .composition-view {
80
+ /* TODO: Composition position got messed up somewhere */
81
+ background: #000;
82
+ color: #FFF;
83
+ display: none;
84
+ position: absolute;
85
+ white-space: nowrap;
86
+ z-index: 1;
87
+ }
88
+
89
+ .xterm .composition-view.active {
90
+ display: block;
91
+ }
92
+
93
+ .xterm .xterm-viewport {
94
+ /* On OS X this is required in order for the scroll bar to appear fully opaque */
95
+ background-color: #000;
96
+ overflow-y: scroll;
97
+ cursor: default;
98
+ position: absolute;
99
+ right: 0;
100
+ left: 0;
101
+ top: 0;
102
+ bottom: 0;
103
+ }
104
+
105
+ .xterm .xterm-screen {
106
+ position: relative;
107
+ }
108
+
109
+ .xterm .xterm-screen canvas {
110
+ position: absolute;
111
+ left: 0;
112
+ top: 0;
113
+ }
114
+
115
+ .xterm .xterm-scroll-area {
116
+ visibility: hidden;
117
+ }
118
+
119
+ .xterm-char-measure-element {
120
+ display: inline-block;
121
+ visibility: hidden;
122
+ position: absolute;
123
+ top: 0;
124
+ left: -9999em;
125
+ line-height: normal;
126
+ }
127
+
128
+ .xterm.enable-mouse-events {
129
+ /* When mouse events are enabled (eg. tmux), revert to the standard pointer cursor */
130
+ cursor: default;
131
+ }
132
+
133
+ .xterm.xterm-cursor-pointer,
134
+ .xterm .xterm-cursor-pointer {
135
+ cursor: pointer;
136
+ }
137
+
138
+ .xterm.column-select.focus {
139
+ /* Column selection mode */
140
+ cursor: crosshair;
141
+ }
142
+
143
+ .xterm .xterm-accessibility:not(.debug),
144
+ .xterm .xterm-message {
145
+ position: absolute;
146
+ left: 0;
147
+ top: 0;
148
+ bottom: 0;
149
+ right: 0;
150
+ z-index: 10;
151
+ color: transparent;
152
+ pointer-events: none;
153
+ }
154
+
155
+ .xterm .xterm-accessibility-tree:not(.debug) *::selection {
156
+ color: transparent;
157
+ }
158
+
159
+ .xterm .xterm-accessibility-tree {
160
+ user-select: text;
161
+ white-space: pre;
162
+ }
163
+
164
+ .xterm .live-region {
165
+ position: absolute;
166
+ left: -9999px;
167
+ width: 1px;
168
+ height: 1px;
169
+ overflow: hidden;
170
+ }
171
+
172
+ .xterm-dim {
173
+ /* Dim should not apply to background, so the opacity of the foreground color is applied
174
+ * explicitly in the generated class and reset to 1 here */
175
+ opacity: 1 !important;
176
+ }
177
+
178
+ .xterm-underline-1 { text-decoration: underline; }
179
+ .xterm-underline-2 { text-decoration: double underline; }
180
+ .xterm-underline-3 { text-decoration: wavy underline; }
181
+ .xterm-underline-4 { text-decoration: dotted underline; }
182
+ .xterm-underline-5 { text-decoration: dashed underline; }
183
+
184
+ .xterm-overline {
185
+ text-decoration: overline;
186
+ }
187
+
188
+ .xterm-overline.xterm-underline-1 { text-decoration: overline underline; }
189
+ .xterm-overline.xterm-underline-2 { text-decoration: overline double underline; }
190
+ .xterm-overline.xterm-underline-3 { text-decoration: overline wavy underline; }
191
+ .xterm-overline.xterm-underline-4 { text-decoration: overline dotted underline; }
192
+ .xterm-overline.xterm-underline-5 { text-decoration: overline dashed underline; }
193
+
194
+ .xterm-strikethrough {
195
+ text-decoration: line-through;
196
+ }
197
+
198
+ .xterm-screen .xterm-decoration-container .xterm-decoration {
199
+ z-index: 6;
200
+ position: absolute;
201
+ }
202
+
203
+ .xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer {
204
+ z-index: 7;
205
+ }
206
+
207
+ .xterm-decoration-overview-ruler {
208
+ z-index: 8;
209
+ position: absolute;
210
+ top: 0;
211
+ right: 0;
212
+ pointer-events: none;
213
+ }
214
+
215
+ .xterm-decoration-top {
216
+ z-index: 2;
217
+ position: relative;
218
+ }