@oddessentials/agent-guild 0.1.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/LICENSE +21 -0
- package/README.md +162 -0
- package/bin/agent-guild-report.mjs +134 -0
- package/bin/agent-guild.mjs +240 -0
- package/config/providers.default.json +124 -0
- package/examples/claude-code-settings.json +48 -0
- package/examples/codex-hooks.json +45 -0
- package/examples/gemini-settings.json +61 -0
- package/examples/grok-hooks.json +55 -0
- package/examples/providers.json +27 -0
- package/node_modules/@xterm/addon-fit/LICENSE +19 -0
- package/node_modules/@xterm/addon-fit/README.md +24 -0
- package/node_modules/@xterm/addon-fit/lib/addon-fit.js +2 -0
- package/node_modules/@xterm/addon-fit/lib/addon-fit.js.map +1 -0
- package/node_modules/@xterm/addon-fit/lib/addon-fit.mjs +18 -0
- package/node_modules/@xterm/addon-fit/lib/addon-fit.mjs.map +7 -0
- package/node_modules/@xterm/addon-fit/package.json +26 -0
- package/node_modules/@xterm/addon-fit/src/FitAddon.ts +92 -0
- package/node_modules/@xterm/addon-fit/typings/addon-fit.d.ts +55 -0
- package/node_modules/@xterm/addon-serialize/README.md +42 -0
- package/node_modules/@xterm/addon-serialize/lib/addon-serialize.js +2 -0
- package/node_modules/@xterm/addon-serialize/lib/addon-serialize.js.map +1 -0
- package/node_modules/@xterm/addon-serialize/lib/addon-serialize.mjs +19 -0
- package/node_modules/@xterm/addon-serialize/lib/addon-serialize.mjs.map +7 -0
- package/node_modules/@xterm/addon-serialize/package.json +29 -0
- package/node_modules/@xterm/addon-serialize/src/SerializeAddon.ts +695 -0
- package/node_modules/@xterm/addon-serialize/typings/addon-serialize.d.ts +116 -0
- package/node_modules/@xterm/addon-web-links/LICENSE +19 -0
- package/node_modules/@xterm/addon-web-links/README.md +21 -0
- package/node_modules/@xterm/addon-web-links/lib/addon-web-links.js +2 -0
- package/node_modules/@xterm/addon-web-links/lib/addon-web-links.js.map +1 -0
- package/node_modules/@xterm/addon-web-links/lib/addon-web-links.mjs +18 -0
- package/node_modules/@xterm/addon-web-links/lib/addon-web-links.mjs.map +7 -0
- package/node_modules/@xterm/addon-web-links/package.json +26 -0
- package/node_modules/@xterm/addon-web-links/src/WebLinkProvider.ts +199 -0
- package/node_modules/@xterm/addon-web-links/src/WebLinksAddon.ts +58 -0
- package/node_modules/@xterm/addon-web-links/typings/addon-web-links.d.ts +57 -0
- package/node_modules/@xterm/headless/README.md +31 -0
- package/node_modules/@xterm/headless/lib-headless/xterm-headless.js +2 -0
- package/node_modules/@xterm/headless/lib-headless/xterm-headless.js.map +1 -0
- package/node_modules/@xterm/headless/lib-headless/xterm-headless.mjs +46 -0
- package/node_modules/@xterm/headless/lib-headless/xterm-headless.mjs.map +7 -0
- package/node_modules/@xterm/headless/package.json +29 -0
- package/node_modules/@xterm/headless/typings/xterm-headless.d.ts +1385 -0
- package/node_modules/@xterm/xterm/LICENSE +21 -0
- package/node_modules/@xterm/xterm/README.md +243 -0
- package/node_modules/@xterm/xterm/css/xterm.css +285 -0
- package/node_modules/@xterm/xterm/lib/xterm.js +2 -0
- package/node_modules/@xterm/xterm/lib/xterm.js.map +1 -0
- package/node_modules/@xterm/xterm/lib/xterm.mjs +53 -0
- package/node_modules/@xterm/xterm/lib/xterm.mjs.map +7 -0
- package/node_modules/@xterm/xterm/package.json +111 -0
- package/node_modules/@xterm/xterm/src/browser/AccessibilityManager.ts +435 -0
- package/node_modules/@xterm/xterm/src/browser/Clipboard.ts +93 -0
- package/node_modules/@xterm/xterm/src/browser/ColorContrastCache.ts +34 -0
- package/node_modules/@xterm/xterm/src/browser/CoreBrowserTerminal.ts +1339 -0
- package/node_modules/@xterm/xterm/src/browser/Linkifier.ts +403 -0
- package/node_modules/@xterm/xterm/src/browser/LocalizableStrings.ts +23 -0
- package/node_modules/@xterm/xterm/src/browser/OscLinkProvider.ts +129 -0
- package/node_modules/@xterm/xterm/src/browser/RenderDebouncer.ts +84 -0
- package/node_modules/@xterm/xterm/src/browser/TimeBasedDebouncer.ts +86 -0
- package/node_modules/@xterm/xterm/src/browser/Types.ts +226 -0
- package/node_modules/@xterm/xterm/src/browser/Viewport.ts +192 -0
- package/node_modules/@xterm/xterm/src/browser/decorations/BufferDecorationRenderer.ts +139 -0
- package/node_modules/@xterm/xterm/src/browser/decorations/ColorZoneStore.ts +117 -0
- package/node_modules/@xterm/xterm/src/browser/decorations/OverviewRulerRenderer.ts +214 -0
- package/node_modules/@xterm/xterm/src/browser/input/CompositionHelper.ts +248 -0
- package/node_modules/@xterm/xterm/src/browser/input/Mouse.ts +54 -0
- package/node_modules/@xterm/xterm/src/browser/input/MoveToCell.ts +251 -0
- package/node_modules/@xterm/xterm/src/browser/public/Terminal.ts +275 -0
- package/node_modules/@xterm/xterm/src/browser/renderer/dom/DomRenderer.ts +542 -0
- package/node_modules/@xterm/xterm/src/browser/renderer/dom/DomRendererRowFactory.ts +546 -0
- package/node_modules/@xterm/xterm/src/browser/renderer/dom/WidthCache.ts +167 -0
- package/node_modules/@xterm/xterm/src/browser/renderer/shared/Constants.ts +6 -0
- package/node_modules/@xterm/xterm/src/browser/renderer/shared/RendererUtils.ts +95 -0
- package/node_modules/@xterm/xterm/src/browser/renderer/shared/SelectionRenderModel.ts +93 -0
- package/node_modules/@xterm/xterm/src/browser/renderer/shared/Types.ts +84 -0
- package/node_modules/@xterm/xterm/src/browser/selection/SelectionModel.ts +144 -0
- package/node_modules/@xterm/xterm/src/browser/selection/Types.ts +15 -0
- package/node_modules/@xterm/xterm/src/browser/services/CharSizeService.ts +127 -0
- package/node_modules/@xterm/xterm/src/browser/services/CharacterJoinerService.ts +339 -0
- package/node_modules/@xterm/xterm/src/browser/services/CoreBrowserService.ts +137 -0
- package/node_modules/@xterm/xterm/src/browser/services/LinkProviderService.ts +28 -0
- package/node_modules/@xterm/xterm/src/browser/services/MouseService.ts +46 -0
- package/node_modules/@xterm/xterm/src/browser/services/RenderService.ts +376 -0
- package/node_modules/@xterm/xterm/src/browser/services/SelectionService.ts +1039 -0
- package/node_modules/@xterm/xterm/src/browser/services/Services.ts +158 -0
- package/node_modules/@xterm/xterm/src/browser/services/ThemeService.ts +198 -0
- package/node_modules/@xterm/xterm/src/browser/shared/Constants.ts +8 -0
- package/node_modules/@xterm/xterm/src/common/CircularList.ts +241 -0
- package/node_modules/@xterm/xterm/src/common/Clone.ts +23 -0
- package/node_modules/@xterm/xterm/src/common/Color.ts +376 -0
- package/node_modules/@xterm/xterm/src/common/CoreTerminal.ts +283 -0
- package/node_modules/@xterm/xterm/src/common/InputHandler.ts +3495 -0
- package/node_modules/@xterm/xterm/src/common/MultiKeyMap.ts +42 -0
- package/node_modules/@xterm/xterm/src/common/Platform.ts +44 -0
- package/node_modules/@xterm/xterm/src/common/SortedList.ts +194 -0
- package/node_modules/@xterm/xterm/src/common/TaskQueue.ts +166 -0
- package/node_modules/@xterm/xterm/src/common/TypedArrayUtils.ts +17 -0
- package/node_modules/@xterm/xterm/src/common/Types.ts +552 -0
- package/node_modules/@xterm/xterm/src/common/WindowsMode.ts +27 -0
- package/node_modules/@xterm/xterm/src/common/buffer/AttributeData.ts +211 -0
- package/node_modules/@xterm/xterm/src/common/buffer/Buffer.ts +662 -0
- package/node_modules/@xterm/xterm/src/common/buffer/BufferLine.ts +551 -0
- package/node_modules/@xterm/xterm/src/common/buffer/BufferRange.ts +13 -0
- package/node_modules/@xterm/xterm/src/common/buffer/BufferReflow.ts +226 -0
- package/node_modules/@xterm/xterm/src/common/buffer/BufferSet.ts +134 -0
- package/node_modules/@xterm/xterm/src/common/buffer/CellData.ts +94 -0
- package/node_modules/@xterm/xterm/src/common/buffer/Constants.ts +157 -0
- package/node_modules/@xterm/xterm/src/common/buffer/Marker.ts +43 -0
- package/node_modules/@xterm/xterm/src/common/buffer/Types.ts +52 -0
- package/node_modules/@xterm/xterm/src/common/data/Charsets.ts +256 -0
- package/node_modules/@xterm/xterm/src/common/data/EscapeSequences.ts +153 -0
- package/node_modules/@xterm/xterm/src/common/input/Keyboard.ts +373 -0
- package/node_modules/@xterm/xterm/src/common/input/TextDecoder.ts +346 -0
- package/node_modules/@xterm/xterm/src/common/input/UnicodeV6.ts +145 -0
- package/node_modules/@xterm/xterm/src/common/input/WriteBuffer.ts +247 -0
- package/node_modules/@xterm/xterm/src/common/input/XParseColor.ts +80 -0
- package/node_modules/@xterm/xterm/src/common/parser/Constants.ts +58 -0
- package/node_modules/@xterm/xterm/src/common/parser/DcsParser.ts +192 -0
- package/node_modules/@xterm/xterm/src/common/parser/EscapeSequenceParser.ts +792 -0
- package/node_modules/@xterm/xterm/src/common/parser/OscParser.ts +238 -0
- package/node_modules/@xterm/xterm/src/common/parser/Params.ts +229 -0
- package/node_modules/@xterm/xterm/src/common/parser/Types.ts +275 -0
- package/node_modules/@xterm/xterm/src/common/public/AddonManager.ts +53 -0
- package/node_modules/@xterm/xterm/src/common/public/BufferApiView.ts +35 -0
- package/node_modules/@xterm/xterm/src/common/public/BufferLineApiView.ts +29 -0
- package/node_modules/@xterm/xterm/src/common/public/BufferNamespaceApi.ts +36 -0
- package/node_modules/@xterm/xterm/src/common/public/ParserApi.ts +37 -0
- package/node_modules/@xterm/xterm/src/common/public/UnicodeApi.ts +27 -0
- package/node_modules/@xterm/xterm/src/common/services/BufferService.ts +154 -0
- package/node_modules/@xterm/xterm/src/common/services/CharsetService.ts +34 -0
- package/node_modules/@xterm/xterm/src/common/services/CoreMouseService.ts +365 -0
- package/node_modules/@xterm/xterm/src/common/services/CoreService.ts +92 -0
- package/node_modules/@xterm/xterm/src/common/services/DecorationService.ts +140 -0
- package/node_modules/@xterm/xterm/src/common/services/InstantiationService.ts +85 -0
- package/node_modules/@xterm/xterm/src/common/services/LogService.ts +124 -0
- package/node_modules/@xterm/xterm/src/common/services/OptionsService.ts +212 -0
- package/node_modules/@xterm/xterm/src/common/services/OscLinkService.ts +115 -0
- package/node_modules/@xterm/xterm/src/common/services/ServiceRegistry.ts +49 -0
- package/node_modules/@xterm/xterm/src/common/services/Services.ts +396 -0
- package/node_modules/@xterm/xterm/src/common/services/UnicodeService.ts +111 -0
- package/node_modules/@xterm/xterm/src/vs/base/browser/browser.ts +141 -0
- package/node_modules/@xterm/xterm/src/vs/base/browser/canIUse.ts +49 -0
- package/node_modules/@xterm/xterm/src/vs/base/browser/dom.ts +2369 -0
- package/node_modules/@xterm/xterm/src/vs/base/browser/fastDomNode.ts +316 -0
- package/node_modules/@xterm/xterm/src/vs/base/browser/globalPointerMoveMonitor.ts +112 -0
- package/node_modules/@xterm/xterm/src/vs/base/browser/iframe.ts +135 -0
- package/node_modules/@xterm/xterm/src/vs/base/browser/keyboardEvent.ts +213 -0
- package/node_modules/@xterm/xterm/src/vs/base/browser/mouseEvent.ts +229 -0
- package/node_modules/@xterm/xterm/src/vs/base/browser/touch.ts +372 -0
- package/node_modules/@xterm/xterm/src/vs/base/browser/ui/scrollbar/abstractScrollbar.ts +303 -0
- package/node_modules/@xterm/xterm/src/vs/base/browser/ui/scrollbar/horizontalScrollbar.ts +114 -0
- package/node_modules/@xterm/xterm/src/vs/base/browser/ui/scrollbar/scrollableElement.ts +720 -0
- package/node_modules/@xterm/xterm/src/vs/base/browser/ui/scrollbar/scrollableElementOptions.ts +165 -0
- package/node_modules/@xterm/xterm/src/vs/base/browser/ui/scrollbar/scrollbarArrow.ts +114 -0
- package/node_modules/@xterm/xterm/src/vs/base/browser/ui/scrollbar/scrollbarState.ts +243 -0
- package/node_modules/@xterm/xterm/src/vs/base/browser/ui/scrollbar/scrollbarVisibilityController.ts +118 -0
- package/node_modules/@xterm/xterm/src/vs/base/browser/ui/scrollbar/verticalScrollbar.ts +116 -0
- package/node_modules/@xterm/xterm/src/vs/base/browser/ui/widget.ts +57 -0
- package/node_modules/@xterm/xterm/src/vs/base/browser/window.ts +14 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/arrays.ts +887 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/arraysFind.ts +202 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/assert.ts +71 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/async.ts +1992 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/cancellation.ts +148 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/charCode.ts +450 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/collections.ts +140 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/decorators.ts +130 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/equals.ts +146 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/errors.ts +303 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/event.ts +1778 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/functional.ts +32 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/hash.ts +316 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/iterator.ts +159 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/keyCodes.ts +526 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/keybindings.ts +284 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/lazy.ts +47 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/lifecycle.ts +801 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/linkedList.ts +142 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/map.ts +202 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/numbers.ts +98 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/observable.ts +76 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/observableInternal/api.ts +31 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/observableInternal/autorun.ts +281 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/observableInternal/base.ts +489 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/observableInternal/debugName.ts +145 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/observableInternal/derived.ts +428 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/observableInternal/lazyObservableValue.ts +146 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/observableInternal/logging.ts +328 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/observableInternal/promise.ts +209 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/observableInternal/utils.ts +610 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/platform.ts +281 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/scrollable.ts +522 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/sequence.ts +34 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/stopwatch.ts +43 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/strings.ts +557 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/symbols.ts +9 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/uint.ts +59 -0
- package/node_modules/@xterm/xterm/src/vs/patches/nls.ts +90 -0
- package/node_modules/@xterm/xterm/src/vs/typings/base-common.d.ts +20 -0
- package/node_modules/@xterm/xterm/src/vs/typings/require.d.ts +42 -0
- package/node_modules/@xterm/xterm/src/vs/typings/vscode-globals-nls.d.ts +36 -0
- package/node_modules/@xterm/xterm/src/vs/typings/vscode-globals-product.d.ts +33 -0
- package/node_modules/@xterm/xterm/typings/xterm.d.ts +1957 -0
- package/node_modules/node-addon-api/LICENSE.md +9 -0
- package/node_modules/node-addon-api/README.md +319 -0
- package/node_modules/node-addon-api/common.gypi +20 -0
- package/node_modules/node-addon-api/except.gypi +25 -0
- package/node_modules/node-addon-api/index.js +12 -0
- package/node_modules/node-addon-api/napi-inl.deprecated.h +186 -0
- package/node_modules/node-addon-api/napi-inl.h +6607 -0
- package/node_modules/node-addon-api/napi.h +3201 -0
- package/node_modules/node-addon-api/node_addon_api.gyp +32 -0
- package/node_modules/node-addon-api/node_api.gyp +9 -0
- package/node_modules/node-addon-api/noexcept.gypi +26 -0
- package/node_modules/node-addon-api/nothing.c +0 -0
- package/node_modules/node-addon-api/package-support.json +21 -0
- package/node_modules/node-addon-api/package.json +480 -0
- package/node_modules/node-addon-api/tools/README.md +73 -0
- package/node_modules/node-addon-api/tools/check-napi.js +99 -0
- package/node_modules/node-addon-api/tools/clang-format.js +71 -0
- package/node_modules/node-addon-api/tools/conversion.js +301 -0
- package/node_modules/node-addon-api/tools/eslint-format.js +79 -0
- package/node_modules/node-pty/LICENSE +69 -0
- package/node_modules/node-pty/README.md +164 -0
- package/node_modules/node-pty/binding.gyp +150 -0
- package/node_modules/node-pty/lib/conpty_console_list_agent.js +25 -0
- package/node_modules/node-pty/lib/eventEmitter2.js +47 -0
- package/node_modules/node-pty/lib/index.js +52 -0
- package/node_modules/node-pty/lib/interfaces.js +7 -0
- package/node_modules/node-pty/lib/shared/conout.js +10 -0
- package/node_modules/node-pty/lib/terminal.js +190 -0
- package/node_modules/node-pty/lib/types.js +7 -0
- package/node_modules/node-pty/lib/unixTerminal.js +351 -0
- package/node_modules/node-pty/lib/utils.js +38 -0
- package/node_modules/node-pty/lib/windowsConoutConnection.js +131 -0
- package/node_modules/node-pty/lib/windowsPtyAgent.js +344 -0
- package/node_modules/node-pty/lib/windowsTerminal.js +209 -0
- package/node_modules/node-pty/lib/worker/conoutSocketWorker.js +22 -0
- package/node_modules/node-pty/package.json +66 -0
- package/node_modules/node-pty/prebuilds/darwin-arm64/pty.node +0 -0
- package/node_modules/node-pty/prebuilds/darwin-arm64/spawn-helper +0 -0
- package/node_modules/node-pty/prebuilds/darwin-x64/pty.node +0 -0
- package/node_modules/node-pty/prebuilds/darwin-x64/spawn-helper +0 -0
- package/node_modules/node-pty/prebuilds/linux-arm64/pty.node +0 -0
- package/node_modules/node-pty/prebuilds/linux-x64/pty.node +0 -0
- package/node_modules/node-pty/prebuilds/win32-arm64/conpty/OpenConsole.exe +0 -0
- package/node_modules/node-pty/prebuilds/win32-arm64/conpty/conpty.dll +0 -0
- package/node_modules/node-pty/prebuilds/win32-arm64/conpty.node +0 -0
- package/node_modules/node-pty/prebuilds/win32-arm64/conpty.pdb +0 -0
- package/node_modules/node-pty/prebuilds/win32-arm64/conpty_console_list.node +0 -0
- package/node_modules/node-pty/prebuilds/win32-arm64/conpty_console_list.pdb +0 -0
- package/node_modules/node-pty/prebuilds/win32-x64/conpty/OpenConsole.exe +0 -0
- package/node_modules/node-pty/prebuilds/win32-x64/conpty/conpty.dll +0 -0
- package/node_modules/node-pty/prebuilds/win32-x64/conpty.node +0 -0
- package/node_modules/node-pty/prebuilds/win32-x64/conpty.pdb +0 -0
- package/node_modules/node-pty/prebuilds/win32-x64/conpty_console_list.node +0 -0
- package/node_modules/node-pty/prebuilds/win32-x64/conpty_console_list.pdb +0 -0
- package/node_modules/node-pty/scripts/post-install.js +76 -0
- package/node_modules/node-pty/scripts/prebuild.js +34 -0
- package/node_modules/node-pty/src/unix/pty.cc +876 -0
- package/node_modules/node-pty/src/unix/spawn-helper.cc +23 -0
- package/node_modules/node-pty/src/win/conpty.cc +616 -0
- package/node_modules/node-pty/src/win/conpty.h +41 -0
- package/node_modules/node-pty/src/win/conpty_console_list.cc +44 -0
- package/node_modules/node-pty/src/win/path_util.cc +95 -0
- package/node_modules/node-pty/src/win/path_util.h +26 -0
- package/node_modules/node-pty/third_party/conpty/1.25.260303002/win10-arm64/OpenConsole.exe +0 -0
- package/node_modules/node-pty/third_party/conpty/1.25.260303002/win10-arm64/conpty.dll +0 -0
- package/node_modules/node-pty/third_party/conpty/1.25.260303002/win10-x64/OpenConsole.exe +0 -0
- package/node_modules/node-pty/third_party/conpty/1.25.260303002/win10-x64/conpty.dll +0 -0
- package/node_modules/node-pty/typings/node-pty.d.ts +215 -0
- package/node_modules/ws/LICENSE +20 -0
- package/node_modules/ws/README.md +548 -0
- package/node_modules/ws/browser.js +8 -0
- package/node_modules/ws/index.js +22 -0
- package/node_modules/ws/lib/buffer-util.js +131 -0
- package/node_modules/ws/lib/constants.js +19 -0
- package/node_modules/ws/lib/event-target.js +292 -0
- package/node_modules/ws/lib/extension.js +203 -0
- package/node_modules/ws/lib/limiter.js +55 -0
- package/node_modules/ws/lib/permessage-deflate.js +530 -0
- package/node_modules/ws/lib/receiver.js +743 -0
- package/node_modules/ws/lib/sender.js +607 -0
- package/node_modules/ws/lib/stream.js +161 -0
- package/node_modules/ws/lib/subprotocol.js +62 -0
- package/node_modules/ws/lib/validation.js +152 -0
- package/node_modules/ws/lib/websocket-server.js +562 -0
- package/node_modules/ws/lib/websocket.js +1421 -0
- package/node_modules/ws/package.json +74 -0
- package/node_modules/ws/wrapper.mjs +21 -0
- package/package.json +52 -0
- package/src/manager/command-resolver.mjs +140 -0
- package/src/manager/config.mjs +94 -0
- package/src/manager/install-channels.mjs +268 -0
- package/src/manager/main.mjs +136 -0
- package/src/manager/providers.mjs +601 -0
- package/src/manager/report-shims.mjs +104 -0
- package/src/manager/server.mjs +421 -0
- package/src/manager/session-manager.mjs +306 -0
- package/src/manager/session.mjs +531 -0
- package/src/manager/shell-env.mjs +150 -0
- package/src/manager/usage.mjs +535 -0
- package/src/manager/versions.mjs +62 -0
- package/src/report/hooks.mjs +150 -0
- package/web/app.js +916 -0
- package/web/art/art.css +186 -0
- package/web/art/characters/anthropic/idle.png +0 -0
- package/web/art/characters/anthropic/locked.png +0 -0
- package/web/art/characters/anthropic/working.png +0 -0
- package/web/art/characters/google/idle.png +0 -0
- package/web/art/characters/google/locked.png +0 -0
- package/web/art/characters/google/working.png +0 -0
- package/web/art/characters/openai/idle.png +0 -0
- package/web/art/characters/openai/locked.png +0 -0
- package/web/art/characters/openai/working.png +0 -0
- package/web/art/characters/shell/idle.png +0 -0
- package/web/art/characters/shell/locked.png +0 -0
- package/web/art/characters/shell/working.png +0 -0
- package/web/art/characters/xai/idle.png +0 -0
- package/web/art/characters/xai/locked.png +0 -0
- package/web/art/characters/xai/working.png +0 -0
- package/web/art/familiars/aether.png +0 -0
- package/web/art/familiars/flame.png +0 -0
- package/web/art/familiars/leaf.png +0 -0
- package/web/art/familiars/night.png +0 -0
- package/web/art/icons/anthropic.png +0 -0
- package/web/art/icons/google.png +0 -0
- package/web/art/icons/openai.png +0 -0
- package/web/art/icons/shell.png +0 -0
- package/web/art/icons/xai.png +0 -0
- package/web/art/page.png +0 -0
- package/web/art/ui/frame.png +0 -0
- package/web/art/ui/gem-mana.png +0 -0
- package/web/art/ui/gem-vitality.png +0 -0
- package/web/art/ui/guild-crest.png +0 -0
- package/web/art/ui/level-medallion.png +0 -0
- package/web/art/ui/padlock.png +0 -0
- package/web/icons/README.md +8 -0
- package/web/index.html +154 -0
- package/web/styles.css +226 -0
|
@@ -0,0 +1,695 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2019 The xterm.js authors. All rights reserved.
|
|
3
|
+
* @license MIT
|
|
4
|
+
*
|
|
5
|
+
* (EXPERIMENTAL) This Addon is still under development
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { IBuffer, IBufferCell, IBufferRange, ITerminalAddon, Terminal } from '@xterm/xterm';
|
|
9
|
+
import type { IHTMLSerializeOptions, SerializeAddon as ISerializeApi, ISerializeOptions, ISerializeRange } from '@xterm/addon-serialize';
|
|
10
|
+
import { IAttributeData, IColor } from 'common/Types';
|
|
11
|
+
import { DEFAULT_ANSI_COLORS } from 'browser/Types';
|
|
12
|
+
|
|
13
|
+
function constrain(value: number, low: number, high: number): number {
|
|
14
|
+
return Math.max(low, Math.min(value, high));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function escapeHTMLChar(c: string): string {
|
|
18
|
+
switch (c) {
|
|
19
|
+
case '&': return '&';
|
|
20
|
+
case '<': return '<';
|
|
21
|
+
}
|
|
22
|
+
return c;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// TODO: Refine this template class later
|
|
26
|
+
abstract class BaseSerializeHandler {
|
|
27
|
+
constructor(
|
|
28
|
+
protected readonly _buffer: IBuffer
|
|
29
|
+
) {
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public serialize(range: IBufferRange, excludeFinalCursorPosition?: boolean): string {
|
|
33
|
+
// we need two of them to flip between old and new cell
|
|
34
|
+
const cell1 = this._buffer.getNullCell();
|
|
35
|
+
const cell2 = this._buffer.getNullCell();
|
|
36
|
+
let oldCell = cell1;
|
|
37
|
+
|
|
38
|
+
const startRow = range.start.y;
|
|
39
|
+
const endRow = range.end.y;
|
|
40
|
+
const startColumn = range.start.x;
|
|
41
|
+
const endColumn = range.end.x;
|
|
42
|
+
|
|
43
|
+
this._beforeSerialize(endRow - startRow, startRow, endRow);
|
|
44
|
+
|
|
45
|
+
for (let row = startRow; row <= endRow; row++) {
|
|
46
|
+
const line = this._buffer.getLine(row);
|
|
47
|
+
if (line) {
|
|
48
|
+
const startLineColumn = row === range.start.y ? startColumn : 0;
|
|
49
|
+
const endLineColumn = row === range.end.y ? endColumn: line.length;
|
|
50
|
+
for (let col = startLineColumn; col < endLineColumn; col++) {
|
|
51
|
+
const c = line.getCell(col, oldCell === cell1 ? cell2 : cell1);
|
|
52
|
+
if (!c) {
|
|
53
|
+
console.warn(`Can't get cell at row=${row}, col=${col}`);
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
this._nextCell(c, oldCell, row, col);
|
|
57
|
+
oldCell = c;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
this._rowEnd(row, row === endRow);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
this._afterSerialize();
|
|
64
|
+
|
|
65
|
+
return this._serializeString(excludeFinalCursorPosition);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
protected _nextCell(cell: IBufferCell, oldCell: IBufferCell, row: number, col: number): void { }
|
|
69
|
+
protected _rowEnd(row: number, isLastRow: boolean): void { }
|
|
70
|
+
protected _beforeSerialize(rows: number, startRow: number, endRow: number): void { }
|
|
71
|
+
protected _afterSerialize(): void { }
|
|
72
|
+
protected _serializeString(excludeFinalCursorPosition?: boolean): string { return ''; }
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function equalFg(cell1: IBufferCell | IAttributeData, cell2: IBufferCell): boolean {
|
|
76
|
+
return cell1.getFgColorMode() === cell2.getFgColorMode()
|
|
77
|
+
&& cell1.getFgColor() === cell2.getFgColor();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function equalBg(cell1: IBufferCell | IAttributeData, cell2: IBufferCell): boolean {
|
|
81
|
+
return cell1.getBgColorMode() === cell2.getBgColorMode()
|
|
82
|
+
&& cell1.getBgColor() === cell2.getBgColor();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function equalFlags(cell1: IBufferCell | IAttributeData, cell2: IBufferCell): boolean {
|
|
86
|
+
return cell1.isInverse() === cell2.isInverse()
|
|
87
|
+
&& cell1.isBold() === cell2.isBold()
|
|
88
|
+
&& cell1.isUnderline() === cell2.isUnderline()
|
|
89
|
+
&& cell1.isOverline() === cell2.isOverline()
|
|
90
|
+
&& cell1.isBlink() === cell2.isBlink()
|
|
91
|
+
&& cell1.isInvisible() === cell2.isInvisible()
|
|
92
|
+
&& cell1.isItalic() === cell2.isItalic()
|
|
93
|
+
&& cell1.isDim() === cell2.isDim()
|
|
94
|
+
&& cell1.isStrikethrough() === cell2.isStrikethrough();
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
class StringSerializeHandler extends BaseSerializeHandler {
|
|
98
|
+
private _rowIndex: number = 0;
|
|
99
|
+
private _allRows: string[] = new Array<string>();
|
|
100
|
+
private _allRowSeparators: string[] = new Array<string>();
|
|
101
|
+
private _currentRow: string = '';
|
|
102
|
+
private _nullCellCount: number = 0;
|
|
103
|
+
|
|
104
|
+
// we can see a full colored cell and a null cell that only have background the same style
|
|
105
|
+
// but the information isn't preserved by null cell itself
|
|
106
|
+
// so wee need to record it when required.
|
|
107
|
+
private _cursorStyle: IBufferCell = this._buffer.getNullCell();
|
|
108
|
+
|
|
109
|
+
// where exact the cursor styles comes from
|
|
110
|
+
// because we can't copy the cell directly
|
|
111
|
+
// so we remember where the content comes from instead
|
|
112
|
+
private _cursorStyleRow: number = 0;
|
|
113
|
+
private _cursorStyleCol: number = 0;
|
|
114
|
+
|
|
115
|
+
// this is a null cell for reference for checking whether background is empty or not
|
|
116
|
+
private _backgroundCell: IBufferCell = this._buffer.getNullCell();
|
|
117
|
+
|
|
118
|
+
private _firstRow: number = 0;
|
|
119
|
+
private _lastCursorRow: number = 0;
|
|
120
|
+
private _lastCursorCol: number = 0;
|
|
121
|
+
private _lastContentCursorRow: number = 0;
|
|
122
|
+
private _lastContentCursorCol: number = 0;
|
|
123
|
+
|
|
124
|
+
constructor(
|
|
125
|
+
buffer: IBuffer,
|
|
126
|
+
private readonly _terminal: Terminal
|
|
127
|
+
) {
|
|
128
|
+
super(buffer);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
protected _beforeSerialize(rows: number, start: number, end: number): void {
|
|
132
|
+
this._allRows = new Array<string>(rows);
|
|
133
|
+
this._lastContentCursorRow = start;
|
|
134
|
+
this._lastCursorRow = start;
|
|
135
|
+
this._firstRow = start;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
private _thisRowLastChar: IBufferCell = this._buffer.getNullCell();
|
|
139
|
+
private _thisRowLastSecondChar: IBufferCell = this._buffer.getNullCell();
|
|
140
|
+
private _nextRowFirstChar: IBufferCell = this._buffer.getNullCell();
|
|
141
|
+
protected _rowEnd(row: number, isLastRow: boolean): void {
|
|
142
|
+
// if there is colorful empty cell at line end, whe must pad it back, or the the color block
|
|
143
|
+
// will missing
|
|
144
|
+
if (this._nullCellCount > 0 && !equalBg(this._cursorStyle, this._backgroundCell)) {
|
|
145
|
+
// use clear right to set background.
|
|
146
|
+
this._currentRow += `\u001b[${this._nullCellCount}X`;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
let rowSeparator = '';
|
|
150
|
+
|
|
151
|
+
// handle row separator
|
|
152
|
+
if (!isLastRow) {
|
|
153
|
+
// Enable BCE
|
|
154
|
+
if (row - this._firstRow >= this._terminal.rows) {
|
|
155
|
+
this._buffer.getLine(this._cursorStyleRow)?.getCell(this._cursorStyleCol, this._backgroundCell);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Fetch current line
|
|
159
|
+
const currentLine = this._buffer.getLine(row)!;
|
|
160
|
+
// Fetch next line
|
|
161
|
+
const nextLine = this._buffer.getLine(row + 1)!;
|
|
162
|
+
|
|
163
|
+
if (!nextLine.isWrapped) {
|
|
164
|
+
// just insert the line break
|
|
165
|
+
rowSeparator = '\r\n';
|
|
166
|
+
// we sended the enter
|
|
167
|
+
this._lastCursorRow = row + 1;
|
|
168
|
+
this._lastCursorCol = 0;
|
|
169
|
+
} else {
|
|
170
|
+
rowSeparator = '';
|
|
171
|
+
const thisRowLastChar = currentLine.getCell(currentLine.length - 1, this._thisRowLastChar)!;
|
|
172
|
+
const thisRowLastSecondChar = currentLine.getCell(currentLine.length - 2, this._thisRowLastSecondChar)!;
|
|
173
|
+
const nextRowFirstChar = nextLine.getCell(0, this._nextRowFirstChar)!;
|
|
174
|
+
const isNextRowFirstCharDoubleWidth = nextRowFirstChar.getWidth() > 1;
|
|
175
|
+
|
|
176
|
+
// validate whether this line wrap is ever possible
|
|
177
|
+
// which mean whether cursor can placed at a overflow position (x === row) naturally
|
|
178
|
+
let isValid = false;
|
|
179
|
+
|
|
180
|
+
if (
|
|
181
|
+
// you must output character to cause overflow, control sequence can't do this
|
|
182
|
+
nextRowFirstChar.getChars() &&
|
|
183
|
+
isNextRowFirstCharDoubleWidth ? this._nullCellCount <= 1 : this._nullCellCount <= 0
|
|
184
|
+
) {
|
|
185
|
+
if (
|
|
186
|
+
// the last character can't be null,
|
|
187
|
+
// you can't use control sequence to move cursor to (x === row)
|
|
188
|
+
(thisRowLastChar.getChars() || thisRowLastChar.getWidth() === 0) &&
|
|
189
|
+
// change background of the first wrapped cell also affects BCE
|
|
190
|
+
// so we mark it as invalid to simply the process to determine line separator
|
|
191
|
+
equalBg(thisRowLastChar, nextRowFirstChar)
|
|
192
|
+
) {
|
|
193
|
+
isValid = true;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (
|
|
197
|
+
// the second to last character can't be null if the next line starts with CJK,
|
|
198
|
+
// you can't use control sequence to move cursor to (x === row)
|
|
199
|
+
isNextRowFirstCharDoubleWidth &&
|
|
200
|
+
(thisRowLastSecondChar.getChars() || thisRowLastSecondChar.getWidth() === 0) &&
|
|
201
|
+
// change background of the first wrapped cell also affects BCE
|
|
202
|
+
// so we mark it as invalid to simply the process to determine line separator
|
|
203
|
+
equalBg(thisRowLastChar, nextRowFirstChar) &&
|
|
204
|
+
equalBg(thisRowLastSecondChar, nextRowFirstChar)
|
|
205
|
+
) {
|
|
206
|
+
isValid = true;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (!isValid) {
|
|
211
|
+
// force the wrap with magic
|
|
212
|
+
// insert enough character to force the wrap
|
|
213
|
+
rowSeparator = '-'.repeat(this._nullCellCount + 1);
|
|
214
|
+
// move back and erase next line head
|
|
215
|
+
rowSeparator += '\u001b[1D\u001b[1X';
|
|
216
|
+
|
|
217
|
+
if (this._nullCellCount > 0) {
|
|
218
|
+
// do these because we filled the last several null slot, which we shouldn't
|
|
219
|
+
rowSeparator += '\u001b[A';
|
|
220
|
+
rowSeparator += `\u001b[${currentLine.length - this._nullCellCount}C`;
|
|
221
|
+
rowSeparator += `\u001b[${this._nullCellCount}X`;
|
|
222
|
+
rowSeparator += `\u001b[${currentLine.length - this._nullCellCount}D`;
|
|
223
|
+
rowSeparator += '\u001b[B';
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// This is content and need the be serialized even it is invisible.
|
|
227
|
+
// without this, wrap will be missing from outputs.
|
|
228
|
+
this._lastContentCursorRow = row + 1;
|
|
229
|
+
this._lastContentCursorCol = 0;
|
|
230
|
+
|
|
231
|
+
// force commit the cursor position
|
|
232
|
+
this._lastCursorRow = row + 1;
|
|
233
|
+
this._lastCursorCol = 0;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
this._allRows[this._rowIndex] = this._currentRow;
|
|
239
|
+
this._allRowSeparators[this._rowIndex++] = rowSeparator;
|
|
240
|
+
this._currentRow = '';
|
|
241
|
+
this._nullCellCount = 0;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
private _diffStyle(cell: IBufferCell | IAttributeData, oldCell: IBufferCell): number[] {
|
|
245
|
+
const sgrSeq: number[] = [];
|
|
246
|
+
const fgChanged = !equalFg(cell, oldCell);
|
|
247
|
+
const bgChanged = !equalBg(cell, oldCell);
|
|
248
|
+
const flagsChanged = !equalFlags(cell, oldCell);
|
|
249
|
+
|
|
250
|
+
if (fgChanged || bgChanged || flagsChanged) {
|
|
251
|
+
if (cell.isAttributeDefault()) {
|
|
252
|
+
if (!oldCell.isAttributeDefault()) {
|
|
253
|
+
sgrSeq.push(0);
|
|
254
|
+
}
|
|
255
|
+
} else {
|
|
256
|
+
if (fgChanged) {
|
|
257
|
+
const color = cell.getFgColor();
|
|
258
|
+
if (cell.isFgRGB()) { sgrSeq.push(38, 2, (color >>> 16) & 0xFF, (color >>> 8) & 0xFF, color & 0xFF); }
|
|
259
|
+
else if (cell.isFgPalette()) {
|
|
260
|
+
if (color >= 16) { sgrSeq.push(38, 5, color); }
|
|
261
|
+
else { sgrSeq.push(color & 8 ? 90 + (color & 7) : 30 + (color & 7)); }
|
|
262
|
+
}
|
|
263
|
+
else { sgrSeq.push(39); }
|
|
264
|
+
}
|
|
265
|
+
if (bgChanged) {
|
|
266
|
+
const color = cell.getBgColor();
|
|
267
|
+
if (cell.isBgRGB()) { sgrSeq.push(48, 2, (color >>> 16) & 0xFF, (color >>> 8) & 0xFF, color & 0xFF); }
|
|
268
|
+
else if (cell.isBgPalette()) {
|
|
269
|
+
if (color >= 16) { sgrSeq.push(48, 5, color); }
|
|
270
|
+
else { sgrSeq.push(color & 8 ? 100 + (color & 7) : 40 + (color & 7)); }
|
|
271
|
+
}
|
|
272
|
+
else { sgrSeq.push(49); }
|
|
273
|
+
}
|
|
274
|
+
if (flagsChanged) {
|
|
275
|
+
if (cell.isInverse() !== oldCell.isInverse()) { sgrSeq.push(cell.isInverse() ? 7 : 27); }
|
|
276
|
+
if (cell.isBold() !== oldCell.isBold()) { sgrSeq.push(cell.isBold() ? 1 : 22); }
|
|
277
|
+
if (cell.isUnderline() !== oldCell.isUnderline()) { sgrSeq.push(cell.isUnderline() ? 4 : 24); }
|
|
278
|
+
if (cell.isOverline() !== oldCell.isOverline()) { sgrSeq.push(cell.isOverline() ? 53 : 55); }
|
|
279
|
+
if (cell.isBlink() !== oldCell.isBlink()) { sgrSeq.push(cell.isBlink() ? 5 : 25); }
|
|
280
|
+
if (cell.isInvisible() !== oldCell.isInvisible()) { sgrSeq.push(cell.isInvisible() ? 8 : 28); }
|
|
281
|
+
if (cell.isItalic() !== oldCell.isItalic()) { sgrSeq.push(cell.isItalic() ? 3 : 23); }
|
|
282
|
+
if (cell.isDim() !== oldCell.isDim()) { sgrSeq.push(cell.isDim() ? 2 : 22); }
|
|
283
|
+
if (cell.isStrikethrough() !== oldCell.isStrikethrough()) { sgrSeq.push(cell.isStrikethrough() ? 9 : 29); }
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
return sgrSeq;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
protected _nextCell(cell: IBufferCell, oldCell: IBufferCell, row: number, col: number): void {
|
|
292
|
+
// a width 0 cell don't need to be count because it is just a placeholder after a CJK character;
|
|
293
|
+
const isPlaceHolderCell = cell.getWidth() === 0;
|
|
294
|
+
|
|
295
|
+
if (isPlaceHolderCell) {
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// this cell don't have content
|
|
300
|
+
const isEmptyCell = cell.getChars() === '';
|
|
301
|
+
|
|
302
|
+
const sgrSeq = this._diffStyle(cell, this._cursorStyle);
|
|
303
|
+
|
|
304
|
+
// the empty cell style is only assumed to be changed when background changed, because
|
|
305
|
+
// foreground is always 0.
|
|
306
|
+
const styleChanged = isEmptyCell ? !equalBg(this._cursorStyle, cell) : sgrSeq.length > 0;
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* handles style change
|
|
310
|
+
*/
|
|
311
|
+
if (styleChanged) {
|
|
312
|
+
// before update the style, we need to fill empty cell back
|
|
313
|
+
if (this._nullCellCount > 0) {
|
|
314
|
+
// use clear right to set background.
|
|
315
|
+
if (!equalBg(this._cursorStyle, this._backgroundCell)) {
|
|
316
|
+
this._currentRow += `\u001b[${this._nullCellCount}X`;
|
|
317
|
+
}
|
|
318
|
+
// use move right to move cursor.
|
|
319
|
+
this._currentRow += `\u001b[${this._nullCellCount}C`;
|
|
320
|
+
this._nullCellCount = 0;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
this._lastContentCursorRow = this._lastCursorRow = row;
|
|
324
|
+
this._lastContentCursorCol = this._lastCursorCol = col;
|
|
325
|
+
|
|
326
|
+
this._currentRow += `\u001b[${sgrSeq.join(';')}m`;
|
|
327
|
+
|
|
328
|
+
// update the last cursor style
|
|
329
|
+
const line = this._buffer.getLine(row);
|
|
330
|
+
if (line !== undefined) {
|
|
331
|
+
line.getCell(col, this._cursorStyle);
|
|
332
|
+
this._cursorStyleRow = row;
|
|
333
|
+
this._cursorStyleCol = col;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* handles actual content
|
|
339
|
+
*/
|
|
340
|
+
if (isEmptyCell) {
|
|
341
|
+
this._nullCellCount += cell.getWidth();
|
|
342
|
+
} else {
|
|
343
|
+
if (this._nullCellCount > 0) {
|
|
344
|
+
// we can just assume we have same style with previous one here
|
|
345
|
+
// because style change is handled by previous stage
|
|
346
|
+
// use move right when background is empty, use clear right when there is background.
|
|
347
|
+
if (equalBg(this._cursorStyle, this._backgroundCell)) {
|
|
348
|
+
this._currentRow += `\u001b[${this._nullCellCount}C`;
|
|
349
|
+
} else {
|
|
350
|
+
this._currentRow += `\u001b[${this._nullCellCount}X`;
|
|
351
|
+
this._currentRow += `\u001b[${this._nullCellCount}C`;
|
|
352
|
+
}
|
|
353
|
+
this._nullCellCount = 0;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
this._currentRow += cell.getChars();
|
|
357
|
+
|
|
358
|
+
// update cursor
|
|
359
|
+
this._lastContentCursorRow = this._lastCursorRow = row;
|
|
360
|
+
this._lastContentCursorCol = this._lastCursorCol = col + cell.getWidth();
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
protected _serializeString(excludeFinalCursorPosition: boolean): string {
|
|
365
|
+
let rowEnd = this._allRows.length;
|
|
366
|
+
|
|
367
|
+
// the fixup is only required for data without scrollback
|
|
368
|
+
// because it will always be placed at last line otherwise
|
|
369
|
+
if (this._buffer.length - this._firstRow <= this._terminal.rows) {
|
|
370
|
+
rowEnd = this._lastContentCursorRow + 1 - this._firstRow;
|
|
371
|
+
this._lastCursorCol = this._lastContentCursorCol;
|
|
372
|
+
this._lastCursorRow = this._lastContentCursorRow;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
let content = '';
|
|
376
|
+
|
|
377
|
+
for (let i = 0; i < rowEnd; i++) {
|
|
378
|
+
content += this._allRows[i];
|
|
379
|
+
if (i + 1 < rowEnd) {
|
|
380
|
+
content += this._allRowSeparators[i];
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
// restore the cursor
|
|
385
|
+
if (!excludeFinalCursorPosition) {
|
|
386
|
+
const realCursorRow = this._buffer.baseY + this._buffer.cursorY;
|
|
387
|
+
const realCursorCol = this._buffer.cursorX;
|
|
388
|
+
|
|
389
|
+
const cursorMoved = (realCursorRow !== this._lastCursorRow || realCursorCol !== this._lastCursorCol);
|
|
390
|
+
|
|
391
|
+
const moveRight = (offset: number): void => {
|
|
392
|
+
if (offset > 0) {
|
|
393
|
+
content += `\u001b[${offset}C`;
|
|
394
|
+
} else if (offset < 0) {
|
|
395
|
+
content += `\u001b[${-offset}D`;
|
|
396
|
+
}
|
|
397
|
+
};
|
|
398
|
+
const moveDown = (offset: number): void => {
|
|
399
|
+
if (offset > 0) {
|
|
400
|
+
content += `\u001b[${offset}B`;
|
|
401
|
+
} else if (offset < 0) {
|
|
402
|
+
content += `\u001b[${-offset}A`;
|
|
403
|
+
}
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
if (cursorMoved) {
|
|
407
|
+
moveDown(realCursorRow - this._lastCursorRow);
|
|
408
|
+
moveRight(realCursorCol - this._lastCursorCol);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
// Restore the cursor's current style, see https://github.com/xtermjs/xterm.js/issues/3677
|
|
413
|
+
// HACK: Internal API access since it's awkward to expose this in the API and serialize will
|
|
414
|
+
// likely be the only consumer
|
|
415
|
+
const curAttrData: IAttributeData = (this._terminal as any)._core._inputHandler._curAttrData;
|
|
416
|
+
const sgrSeq = this._diffStyle(curAttrData, this._cursorStyle);
|
|
417
|
+
if (sgrSeq.length > 0) {
|
|
418
|
+
content += `\u001b[${sgrSeq.join(';')}m`;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
return content;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
export class SerializeAddon implements ITerminalAddon , ISerializeApi {
|
|
426
|
+
private _terminal: Terminal | undefined;
|
|
427
|
+
|
|
428
|
+
public activate(terminal: Terminal): void {
|
|
429
|
+
this._terminal = terminal;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
private _serializeBufferByScrollback(terminal: Terminal, buffer: IBuffer, scrollback?: number): string {
|
|
433
|
+
const maxRows = buffer.length;
|
|
434
|
+
const correctRows = (scrollback === undefined) ? maxRows : constrain(scrollback + terminal.rows, 0, maxRows);
|
|
435
|
+
return this._serializeBufferByRange(terminal, buffer, {
|
|
436
|
+
start: maxRows - correctRows,
|
|
437
|
+
end: maxRows - 1
|
|
438
|
+
}, false);
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
private _serializeBufferByRange(terminal: Terminal, buffer: IBuffer, range: ISerializeRange, excludeFinalCursorPosition: boolean): string {
|
|
442
|
+
const handler = new StringSerializeHandler(buffer, terminal);
|
|
443
|
+
return handler.serialize({
|
|
444
|
+
start: { x: 0, y: typeof range.start === 'number' ? range.start : range.start.line },
|
|
445
|
+
end: { x: terminal.cols, y: typeof range.end === 'number' ? range.end : range.end.line }
|
|
446
|
+
}, excludeFinalCursorPosition);
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
private _serializeBufferAsHTML(terminal: Terminal, options: Partial<IHTMLSerializeOptions>): string {
|
|
450
|
+
const buffer = terminal.buffer.active;
|
|
451
|
+
const handler = new HTMLSerializeHandler(buffer, terminal, options);
|
|
452
|
+
const onlySelection = options.onlySelection ?? false;
|
|
453
|
+
const range = options.range;
|
|
454
|
+
if (range) {
|
|
455
|
+
return handler.serialize({
|
|
456
|
+
start: { x: range.startCol, y: typeof range.startLine === 'number' ? range.startLine : range.startLine },
|
|
457
|
+
end: { x: terminal.cols, y: typeof range.endLine === 'number' ? range.endLine : range.endLine }
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
if (!onlySelection) {
|
|
461
|
+
const maxRows = buffer.length;
|
|
462
|
+
const scrollback = options.scrollback;
|
|
463
|
+
const correctRows = (scrollback === undefined) ? maxRows : constrain(scrollback + terminal.rows, 0, maxRows);
|
|
464
|
+
return handler.serialize({
|
|
465
|
+
start: { x: 0, y: maxRows - correctRows },
|
|
466
|
+
end: { x: terminal.cols, y: maxRows - 1 }
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
const selection = this._terminal?.getSelectionPosition();
|
|
471
|
+
if (selection !== undefined) {
|
|
472
|
+
return handler.serialize({
|
|
473
|
+
start: { x: selection.start.x, y: selection.start.y },
|
|
474
|
+
end: { x: selection.end.x, y: selection.end.y }
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
return '';
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
private _serializeModes(terminal: Terminal): string {
|
|
482
|
+
let content = '';
|
|
483
|
+
const modes = terminal.modes;
|
|
484
|
+
|
|
485
|
+
// Default: false
|
|
486
|
+
if (modes.applicationCursorKeysMode) content += '\x1b[?1h';
|
|
487
|
+
if (modes.applicationKeypadMode) content += '\x1b[?66h';
|
|
488
|
+
if (modes.bracketedPasteMode) content += '\x1b[?2004h';
|
|
489
|
+
if (modes.insertMode) content += '\x1b[4h';
|
|
490
|
+
if (modes.originMode) content += '\x1b[?6h';
|
|
491
|
+
if (modes.reverseWraparoundMode) content += '\x1b[?45h';
|
|
492
|
+
if (modes.sendFocusMode) content += '\x1b[?1004h';
|
|
493
|
+
// synchronizedOutputMode doesn't need to be serialized as it's a temporary mode
|
|
494
|
+
|
|
495
|
+
// Default: true
|
|
496
|
+
if (modes.wraparoundMode === false) content += '\x1b[?7l';
|
|
497
|
+
|
|
498
|
+
// Default: 'none'
|
|
499
|
+
if (modes.mouseTrackingMode !== 'none') {
|
|
500
|
+
switch (modes.mouseTrackingMode) {
|
|
501
|
+
case 'x10': content += '\x1b[?9h'; break;
|
|
502
|
+
case 'vt200': content += '\x1b[?1000h'; break;
|
|
503
|
+
case 'drag': content += '\x1b[?1002h'; break;
|
|
504
|
+
case 'any': content += '\x1b[?1003h'; break;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
return content;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
public serialize(options?: ISerializeOptions): string {
|
|
512
|
+
// TODO: Add combinedData support
|
|
513
|
+
if (!this._terminal) {
|
|
514
|
+
throw new Error('Cannot use addon until it has been loaded');
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
// Normal buffer
|
|
518
|
+
let content = options?.range
|
|
519
|
+
? this._serializeBufferByRange(this._terminal, this._terminal.buffer.normal, options.range, true)
|
|
520
|
+
: this._serializeBufferByScrollback(this._terminal, this._terminal.buffer.normal, options?.scrollback);
|
|
521
|
+
|
|
522
|
+
// Alternate buffer
|
|
523
|
+
if (!options?.excludeAltBuffer) {
|
|
524
|
+
if (this._terminal.buffer.active.type === 'alternate') {
|
|
525
|
+
const alternativeScreenContent = this._serializeBufferByScrollback(this._terminal, this._terminal.buffer.alternate, undefined);
|
|
526
|
+
content += `\u001b[?1049h\u001b[H${alternativeScreenContent}`;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
// Modes
|
|
531
|
+
if (!options?.excludeModes) {
|
|
532
|
+
content += this._serializeModes(this._terminal);
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
return content;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
public serializeAsHTML(options?: Partial<IHTMLSerializeOptions>): string {
|
|
539
|
+
if (!this._terminal) {
|
|
540
|
+
throw new Error('Cannot use addon until it has been loaded');
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
return this._serializeBufferAsHTML(this._terminal, options || {});
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
public dispose(): void { }
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
export class HTMLSerializeHandler extends BaseSerializeHandler {
|
|
550
|
+
private _currentRow: string = '';
|
|
551
|
+
|
|
552
|
+
private _htmlContent = '';
|
|
553
|
+
|
|
554
|
+
private _ansiColors: Readonly<IColor[]>;
|
|
555
|
+
|
|
556
|
+
constructor(
|
|
557
|
+
buffer: IBuffer,
|
|
558
|
+
private readonly _terminal: Terminal,
|
|
559
|
+
private readonly _options: Partial<IHTMLSerializeOptions>
|
|
560
|
+
) {
|
|
561
|
+
super(buffer);
|
|
562
|
+
|
|
563
|
+
// For xterm headless: fallback to ansi colors
|
|
564
|
+
if ((_terminal as any)._core._themeService) {
|
|
565
|
+
this._ansiColors = (_terminal as any)._core._themeService.colors.ansi;
|
|
566
|
+
}
|
|
567
|
+
else {
|
|
568
|
+
this._ansiColors = DEFAULT_ANSI_COLORS;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
private _padStart(target: string, targetLength: number, padString: string): string {
|
|
573
|
+
targetLength = targetLength >> 0;
|
|
574
|
+
padString = padString ?? ' ';
|
|
575
|
+
if (target.length > targetLength) {
|
|
576
|
+
return target;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
targetLength -= target.length;
|
|
580
|
+
if (targetLength > padString.length) {
|
|
581
|
+
padString += padString.repeat(targetLength / padString.length);
|
|
582
|
+
}
|
|
583
|
+
return padString.slice(0, targetLength) + target;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
protected _beforeSerialize(rows: number, start: number, end: number): void {
|
|
587
|
+
this._htmlContent += '<html><body><!--StartFragment--><pre>';
|
|
588
|
+
|
|
589
|
+
let foreground = '#000000';
|
|
590
|
+
let background = '#ffffff';
|
|
591
|
+
if (this._options.includeGlobalBackground ?? false) {
|
|
592
|
+
foreground = this._terminal.options.theme?.foreground ?? '#ffffff';
|
|
593
|
+
background = this._terminal.options.theme?.background ?? '#000000';
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
const globalStyleDefinitions = [];
|
|
597
|
+
globalStyleDefinitions.push('color: ' + foreground + ';');
|
|
598
|
+
globalStyleDefinitions.push('background-color: ' + background + ';');
|
|
599
|
+
globalStyleDefinitions.push('font-family: ' + this._terminal.options.fontFamily + ';');
|
|
600
|
+
globalStyleDefinitions.push('font-size: ' + this._terminal.options.fontSize + 'px;');
|
|
601
|
+
this._htmlContent += '<div style=\'' + globalStyleDefinitions.join(' ') + '\'>';
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
protected _afterSerialize(): void {
|
|
605
|
+
this._htmlContent += '</div>';
|
|
606
|
+
this._htmlContent += '</pre><!--EndFragment--></body></html>';
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
protected _rowEnd(row: number, isLastRow: boolean): void {
|
|
610
|
+
this._htmlContent += '<div><span>' + this._currentRow + '</span></div>';
|
|
611
|
+
this._currentRow = '';
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
private _getHexColor(cell: IBufferCell, isFg: boolean): string | undefined {
|
|
615
|
+
const color = isFg ? cell.getFgColor() : cell.getBgColor();
|
|
616
|
+
if (isFg ? cell.isFgRGB() : cell.isBgRGB()) {
|
|
617
|
+
const rgb = [
|
|
618
|
+
(color >> 16) & 255,
|
|
619
|
+
(color >> 8) & 255,
|
|
620
|
+
(color ) & 255
|
|
621
|
+
];
|
|
622
|
+
return '#' + rgb.map(x => this._padStart(x.toString(16), 2, '0')).join('');
|
|
623
|
+
}
|
|
624
|
+
if (isFg ? cell.isFgPalette() : cell.isBgPalette()) {
|
|
625
|
+
return this._ansiColors[color].css;
|
|
626
|
+
}
|
|
627
|
+
return undefined;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
private _diffStyle(cell: IBufferCell, oldCell: IBufferCell): string[] | undefined {
|
|
631
|
+
const content: string[] = [];
|
|
632
|
+
|
|
633
|
+
const fgChanged = !equalFg(cell, oldCell);
|
|
634
|
+
const bgChanged = !equalBg(cell, oldCell);
|
|
635
|
+
const flagsChanged = !equalFlags(cell, oldCell);
|
|
636
|
+
|
|
637
|
+
if (fgChanged || bgChanged || flagsChanged) {
|
|
638
|
+
const fgHexColor = this._getHexColor(cell, true);
|
|
639
|
+
if (fgHexColor) {
|
|
640
|
+
content.push('color: ' + fgHexColor + ';');
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
const bgHexColor = this._getHexColor(cell, false);
|
|
644
|
+
if (bgHexColor) {
|
|
645
|
+
content.push('background-color: ' + bgHexColor + ';');
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
if (cell.isInverse()) { content.push('color: #000000; background-color: #BFBFBF;'); }
|
|
649
|
+
if (cell.isBold()) { content.push('font-weight: bold;'); }
|
|
650
|
+
if (cell.isUnderline() && cell.isOverline()) { content.push('text-decoration: overline underline;'); }
|
|
651
|
+
else if (cell.isUnderline()) { content.push('text-decoration: underline;'); }
|
|
652
|
+
else if (cell.isOverline()) { content.push('text-decoration: overline;'); }
|
|
653
|
+
if (cell.isBlink()) { content.push('text-decoration: blink;'); }
|
|
654
|
+
if (cell.isInvisible()) { content.push('visibility: hidden;'); }
|
|
655
|
+
if (cell.isItalic()) { content.push('font-style: italic;'); }
|
|
656
|
+
if (cell.isDim()) { content.push('opacity: 0.5;'); }
|
|
657
|
+
if (cell.isStrikethrough()) { content.push('text-decoration: line-through;'); }
|
|
658
|
+
|
|
659
|
+
return content;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
return undefined;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
protected _nextCell(cell: IBufferCell, oldCell: IBufferCell, row: number, col: number): void {
|
|
666
|
+
// a width 0 cell don't need to be count because it is just a placeholder after a CJK character;
|
|
667
|
+
const isPlaceHolderCell = cell.getWidth() === 0;
|
|
668
|
+
if (isPlaceHolderCell) {
|
|
669
|
+
return;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
// this cell don't have content
|
|
673
|
+
const isEmptyCell = cell.getChars() === '';
|
|
674
|
+
|
|
675
|
+
const styleDefinitions = this._diffStyle(cell, oldCell);
|
|
676
|
+
|
|
677
|
+
// handles style change
|
|
678
|
+
if (styleDefinitions) {
|
|
679
|
+
this._currentRow += styleDefinitions.length === 0 ?
|
|
680
|
+
'</span><span>' :
|
|
681
|
+
'</span><span style=\'' + styleDefinitions.join(' ') + '\'>';
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
// handles actual content
|
|
685
|
+
if (isEmptyCell) {
|
|
686
|
+
this._currentRow += ' ';
|
|
687
|
+
} else {
|
|
688
|
+
this._currentRow += escapeHTMLChar(cell.getChars());
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
protected _serializeString(): string {
|
|
693
|
+
return this._htmlContent;
|
|
694
|
+
}
|
|
695
|
+
}
|