@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,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ws",
|
|
3
|
+
"version": "8.22.0",
|
|
4
|
+
"description": "Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"HyBi",
|
|
7
|
+
"Push",
|
|
8
|
+
"RFC-6455",
|
|
9
|
+
"WebSocket",
|
|
10
|
+
"WebSockets",
|
|
11
|
+
"real-time"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://github.com/websockets/ws",
|
|
14
|
+
"bugs": "https://github.com/websockets/ws/issues",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/websockets/ws.git"
|
|
18
|
+
},
|
|
19
|
+
"author": "Einar Otto Stangvik <einaros@gmail.com> (http://2x.io)",
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"main": "index.js",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"browser": "./browser.js",
|
|
25
|
+
"import": "./wrapper.mjs",
|
|
26
|
+
"require": "./index.js"
|
|
27
|
+
},
|
|
28
|
+
"./package.json": "./package.json"
|
|
29
|
+
},
|
|
30
|
+
"browser": "browser.js",
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=10.0.0"
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"browser.js",
|
|
36
|
+
"index.js",
|
|
37
|
+
"lib/*.js",
|
|
38
|
+
"wrapper.mjs"
|
|
39
|
+
],
|
|
40
|
+
"scripts": {
|
|
41
|
+
"test": "nyc --reporter=lcov --reporter=text mocha --throw-deprecation test/*.test.js",
|
|
42
|
+
"integration": "mocha --throw-deprecation test/*.integration.js",
|
|
43
|
+
"lint": "eslint . && prettier --check --ignore-path .gitignore \"**/*.{json,md,yaml,yml}\""
|
|
44
|
+
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"bufferutil": "^4.0.1",
|
|
47
|
+
"utf-8-validate": ">=5.0.2"
|
|
48
|
+
},
|
|
49
|
+
"peerDependenciesMeta": {
|
|
50
|
+
"bufferutil": {
|
|
51
|
+
"optional": true
|
|
52
|
+
},
|
|
53
|
+
"utf-8-validate": {
|
|
54
|
+
"optional": true
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@eslint/js": "^10.0.1",
|
|
59
|
+
"benchmark": "^2.1.4",
|
|
60
|
+
"bufferutil": "^4.0.1",
|
|
61
|
+
"eslint": "^10.0.1",
|
|
62
|
+
"eslint-config-prettier": "^10.0.1",
|
|
63
|
+
"eslint-plugin-prettier": "^5.0.0",
|
|
64
|
+
"globals": "^17.0.0",
|
|
65
|
+
"mocha": "^8.4.0",
|
|
66
|
+
"nyc": "^15.0.0",
|
|
67
|
+
"prettier": "^3.0.0",
|
|
68
|
+
"utf-8-validate": "^6.0.0"
|
|
69
|
+
},
|
|
70
|
+
"allowScripts": {
|
|
71
|
+
"bufferutil": true,
|
|
72
|
+
"utf-8-validate": true
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import createWebSocketStream from './lib/stream.js';
|
|
2
|
+
import extension from './lib/extension.js';
|
|
3
|
+
import PerMessageDeflate from './lib/permessage-deflate.js';
|
|
4
|
+
import Receiver from './lib/receiver.js';
|
|
5
|
+
import Sender from './lib/sender.js';
|
|
6
|
+
import subprotocol from './lib/subprotocol.js';
|
|
7
|
+
import WebSocket from './lib/websocket.js';
|
|
8
|
+
import WebSocketServer from './lib/websocket-server.js';
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
createWebSocketStream,
|
|
12
|
+
extension,
|
|
13
|
+
PerMessageDeflate,
|
|
14
|
+
Receiver,
|
|
15
|
+
Sender,
|
|
16
|
+
subprotocol,
|
|
17
|
+
WebSocket,
|
|
18
|
+
WebSocketServer
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default WebSocket;
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@oddessentials/agent-guild",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Launch and watch AI coding-assistant terminal sessions from one local web page. A bundled session manager owns the terminals so the page can close and reconnect.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/oddessentials/agent-guild.git"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/oddessentials/agent-guild#readme",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/oddessentials/agent-guild/issues"
|
|
13
|
+
},
|
|
14
|
+
"type": "module",
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": ">=22"
|
|
17
|
+
},
|
|
18
|
+
"bin": {
|
|
19
|
+
"agent-guild": "bin/agent-guild.mjs",
|
|
20
|
+
"agent-guild-report": "bin/agent-guild-report.mjs"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"bin/",
|
|
24
|
+
"src/",
|
|
25
|
+
"web/",
|
|
26
|
+
"config/",
|
|
27
|
+
"examples/"
|
|
28
|
+
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"start": "node bin/agent-guild.mjs open",
|
|
31
|
+
"manager": "node bin/agent-guild.mjs start",
|
|
32
|
+
"stop": "node bin/agent-guild.mjs stop",
|
|
33
|
+
"status": "node bin/agent-guild.mjs status",
|
|
34
|
+
"test": "node --test --test-concurrency=1"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@xterm/addon-fit": "^0.11.0",
|
|
38
|
+
"@xterm/addon-serialize": "^0.14.0",
|
|
39
|
+
"@xterm/addon-web-links": "^0.12.0",
|
|
40
|
+
"@xterm/headless": "^6.0.0",
|
|
41
|
+
"@xterm/xterm": "^6.0.0",
|
|
42
|
+
"node-pty": "^1.2.0-beta.15",
|
|
43
|
+
"ws": "^8.22.0"
|
|
44
|
+
},
|
|
45
|
+
"bundleDependencies": true,
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"access": "public"
|
|
48
|
+
},
|
|
49
|
+
"allowScripts": {
|
|
50
|
+
"node-pty@1.2.0-beta.15": true
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
// Locate a provider's command on PATH and turn it into something node-pty can
|
|
2
|
+
// spawn on every platform.
|
|
3
|
+
|
|
4
|
+
import fs from 'node:fs';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import { execFile } from 'node:child_process';
|
|
7
|
+
|
|
8
|
+
function isExecutableFile(file, platform) {
|
|
9
|
+
try {
|
|
10
|
+
const stat = fs.statSync(file);
|
|
11
|
+
if (!stat.isFile()) return false;
|
|
12
|
+
if (platform === 'win32') return true;
|
|
13
|
+
fs.accessSync(file, fs.constants.X_OK);
|
|
14
|
+
return true;
|
|
15
|
+
} catch {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function windowsExtensions(env) {
|
|
21
|
+
const raw = env.PATHEXT || '.COM;.EXE;.BAT;.CMD';
|
|
22
|
+
const exts = raw.split(';').map((e) => e.trim().toLowerCase()).filter(Boolean);
|
|
23
|
+
// npm installs PowerShell shims too; accept them as a last resort.
|
|
24
|
+
if (!exts.includes('.ps1')) exts.push('.ps1');
|
|
25
|
+
return exts;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function pathKey(env, platform = process.platform) {
|
|
29
|
+
// Windows environment keys are case-insensitive ("Path" is common).
|
|
30
|
+
return Object.keys(env).find((k) => k.toUpperCase() === 'PATH') || (platform === 'win32' ? 'Path' : 'PATH');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function getPath(env) {
|
|
34
|
+
return env[pathKey(env)] || '';
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function candidateGroups(command, env, platform) {
|
|
38
|
+
const p = platform === 'win32' ? path.win32 : path.posix;
|
|
39
|
+
const hasExt = platform === 'win32' && p.extname(command) !== '';
|
|
40
|
+
const withExts = (base) =>
|
|
41
|
+
platform === 'win32' && !hasExt ? windowsExtensions(env).map((e) => base + e) : [base];
|
|
42
|
+
|
|
43
|
+
if (command.includes('/') || (platform === 'win32' && command.includes('\\'))) return [withExts(p.resolve(command))];
|
|
44
|
+
const groups = [];
|
|
45
|
+
const delimiter = platform === 'win32' ? ';' : ':';
|
|
46
|
+
for (const dir of getPath(env).split(delimiter)) {
|
|
47
|
+
if (!dir) continue;
|
|
48
|
+
const clean = dir.replace(/^"(.*)"$/, '$1');
|
|
49
|
+
groups.push(withExts(p.join(clean, command)));
|
|
50
|
+
}
|
|
51
|
+
return groups;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Resolve `command` to an absolute path, or return null when it is not
|
|
56
|
+
* installed. Commands that already contain a path separator are checked as-is.
|
|
57
|
+
* `isExecutable` is injectable so tests can simulate another platform.
|
|
58
|
+
*/
|
|
59
|
+
export function resolveCommand(command, env = process.env, platform = process.platform, {
|
|
60
|
+
isExecutable = (file) => isExecutableFile(file, platform),
|
|
61
|
+
} = {}) {
|
|
62
|
+
if (!command) return null;
|
|
63
|
+
for (const group of candidateGroups(command, env, platform)) {
|
|
64
|
+
const hit = group.find((c) => isExecutable(c));
|
|
65
|
+
if (hit) return hit;
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function resolveAllCommands(command, env = process.env, platform = process.platform, {
|
|
71
|
+
isExecutable = (file) => isExecutableFile(file, platform),
|
|
72
|
+
} = {}) {
|
|
73
|
+
if (!command) return [];
|
|
74
|
+
const seen = new Set();
|
|
75
|
+
const hits = [];
|
|
76
|
+
for (const group of candidateGroups(command, env, platform)) {
|
|
77
|
+
const hit = group.find((c) => isExecutable(c));
|
|
78
|
+
const id = hit && (platform === 'win32' ? hit.toLowerCase() : hit);
|
|
79
|
+
if (!hit || seen.has(id)) continue;
|
|
80
|
+
seen.add(id);
|
|
81
|
+
hits.push(hit);
|
|
82
|
+
}
|
|
83
|
+
return hits;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** Quote one argument for a cmd.exe command line. */
|
|
87
|
+
export function quoteForCmd(arg) {
|
|
88
|
+
const s = String(arg);
|
|
89
|
+
if (s !== '' && !/[\s"&|<>^()%!,;=]/.test(s)) return s;
|
|
90
|
+
return '"' + s.replace(/"/g, '""') + '"';
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Build the file/args pair passed to node-pty. On Windows, batch shims
|
|
95
|
+
* (claude.cmd, codex.cmd, ...) must run through cmd.exe and PowerShell shims
|
|
96
|
+
* through powershell.exe; ConPTY cannot execute them directly.
|
|
97
|
+
*/
|
|
98
|
+
export function buildSpawnSpec(resolvedPath, args = [], env = process.env, platform = process.platform) {
|
|
99
|
+
if (platform !== 'win32') return { file: resolvedPath, args: [...args] };
|
|
100
|
+
const ext = path.win32.extname(resolvedPath).toLowerCase();
|
|
101
|
+
// Absolute paths: a bare name is looked up on the child's PATH, which a
|
|
102
|
+
// provider's own env may not carry.
|
|
103
|
+
const system32 = path.win32.join(env.SystemRoot || env.SYSTEMROOT || 'C:\\Windows', 'System32');
|
|
104
|
+
if (ext === '.cmd' || ext === '.bat') {
|
|
105
|
+
const comspec = env.ComSpec || env.COMSPEC || path.win32.join(system32, 'cmd.exe');
|
|
106
|
+
const inner = [resolvedPath, ...args].map(quoteForCmd).join(' ');
|
|
107
|
+
// A raw command-line string: /s strips the outer quotes and keeps the rest.
|
|
108
|
+
return { file: comspec, args: `/d /s /c "${inner}"` };
|
|
109
|
+
}
|
|
110
|
+
if (ext === '.ps1') {
|
|
111
|
+
return {
|
|
112
|
+
file: path.win32.join(system32, 'WindowsPowerShell', 'v1.0', 'powershell.exe'),
|
|
113
|
+
args: ['-NoLogo', '-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', resolvedPath, ...args],
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
return { file: resolvedPath, args: [...args] };
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Run a spawn spec to completion without a terminal. Resolves with its
|
|
121
|
+
* output; rejects with the error carrying stdout and stderr.
|
|
122
|
+
*/
|
|
123
|
+
export function runSpec(spec, { env, timeoutMs = 15000 } = {}) {
|
|
124
|
+
return new Promise((resolve, reject) => {
|
|
125
|
+
const opts = { env, timeout: timeoutMs, windowsHide: true, maxBuffer: 1024 * 1024 };
|
|
126
|
+
let args = spec.args;
|
|
127
|
+
if (typeof args === 'string') {
|
|
128
|
+
opts.windowsVerbatimArguments = true;
|
|
129
|
+
args = [args];
|
|
130
|
+
}
|
|
131
|
+
try {
|
|
132
|
+
execFile(spec.file, args, opts, (err, stdout, stderr) => {
|
|
133
|
+
if (err) reject(Object.assign(err, { stdout, stderr }));
|
|
134
|
+
else resolve({ stdout, stderr });
|
|
135
|
+
});
|
|
136
|
+
} catch (err) {
|
|
137
|
+
reject(err);
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// Filesystem locations, the auth token, and the runtime discovery file.
|
|
2
|
+
//
|
|
3
|
+
// Everything lives in one per-user directory so that other clients (the
|
|
4
|
+
// launcher CLI, the agent reporter, a future Unreal Engine front end) can find
|
|
5
|
+
// a running manager without being told its port or token.
|
|
6
|
+
|
|
7
|
+
import fs from 'node:fs';
|
|
8
|
+
import os from 'node:os';
|
|
9
|
+
import path from 'node:path';
|
|
10
|
+
import crypto from 'node:crypto';
|
|
11
|
+
|
|
12
|
+
export const DEFAULT_PORT = 47821;
|
|
13
|
+
export const DEFAULT_HOST = '127.0.0.1';
|
|
14
|
+
export const VERSION = JSON.parse(fs.readFileSync(new URL('../../package.json', import.meta.url), 'utf8')).version;
|
|
15
|
+
|
|
16
|
+
/** Per-user data directory. Override with AGENT_GUILD_HOME (used by tests). */
|
|
17
|
+
export function dataDir() {
|
|
18
|
+
if (process.env.AGENT_GUILD_HOME) return path.resolve(process.env.AGENT_GUILD_HOME);
|
|
19
|
+
if (process.platform === 'win32') {
|
|
20
|
+
const base = process.env.APPDATA || path.join(os.homedir(), 'AppData', 'Roaming');
|
|
21
|
+
return path.join(base, 'AgentGuild');
|
|
22
|
+
}
|
|
23
|
+
if (process.platform === 'darwin') {
|
|
24
|
+
return path.join(os.homedir(), 'Library', 'Application Support', 'AgentGuild');
|
|
25
|
+
}
|
|
26
|
+
const base = process.env.XDG_CONFIG_HOME || path.join(os.homedir(), '.config');
|
|
27
|
+
return path.join(base, 'agent-guild');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function ensureDataDir() {
|
|
31
|
+
const dir = dataDir();
|
|
32
|
+
fs.mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
33
|
+
return dir;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const paths = {
|
|
37
|
+
get token() { return path.join(dataDir(), 'auth-token'); },
|
|
38
|
+
get runtime() { return path.join(dataDir(), 'manager.json'); },
|
|
39
|
+
get providers() { return path.join(dataDir(), 'providers.json'); },
|
|
40
|
+
get log() { return path.join(dataDir(), 'manager.log'); },
|
|
41
|
+
/** Launchers for agent-guild-report, put first on every session's PATH. */
|
|
42
|
+
get shims() { return path.join(dataDir(), 'bin'); },
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
function writePrivate(file, contents) {
|
|
46
|
+
fs.writeFileSync(file, contents, { mode: 0o600 });
|
|
47
|
+
// writeFileSync only applies mode on creation; tighten an existing file too.
|
|
48
|
+
try { fs.chmodSync(file, 0o600); } catch { /* not supported on Windows */ }
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* The API token guards every endpoint except /health. It persists across
|
|
53
|
+
* manager restarts so a bookmarked page keeps working. Delete the file to
|
|
54
|
+
* rotate it.
|
|
55
|
+
*/
|
|
56
|
+
export function loadOrCreateToken() {
|
|
57
|
+
ensureDataDir();
|
|
58
|
+
try {
|
|
59
|
+
const existing = fs.readFileSync(paths.token, 'utf8').trim();
|
|
60
|
+
if (/^[a-f0-9]{32,}$/.test(existing)) return existing;
|
|
61
|
+
} catch { /* create below */ }
|
|
62
|
+
const token = crypto.randomBytes(24).toString('hex');
|
|
63
|
+
writePrivate(paths.token, token + '\n');
|
|
64
|
+
return token;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function writeRuntimeFile(info) {
|
|
68
|
+
ensureDataDir();
|
|
69
|
+
writePrivate(paths.runtime, JSON.stringify(info, null, 2) + '\n');
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function readRuntimeFile() {
|
|
73
|
+
try {
|
|
74
|
+
return JSON.parse(fs.readFileSync(paths.runtime, 'utf8'));
|
|
75
|
+
} catch {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function removeRuntimeFile(pid = process.pid) {
|
|
81
|
+
const current = readRuntimeFile();
|
|
82
|
+
if (current && current.pid !== pid) return; // another manager owns it
|
|
83
|
+
try { fs.unlinkSync(paths.runtime); } catch { /* already gone */ }
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function resolvePort() {
|
|
87
|
+
const raw = process.env.AGENT_GUILD_PORT;
|
|
88
|
+
if (raw === undefined || raw === '') return DEFAULT_PORT;
|
|
89
|
+
const port = Number(raw);
|
|
90
|
+
if (!Number.isInteger(port) || port < 0 || port > 65535) {
|
|
91
|
+
throw new Error(`AGENT_GUILD_PORT must be an integer between 0 and 65535, got "${raw}"`);
|
|
92
|
+
}
|
|
93
|
+
return port;
|
|
94
|
+
}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
|
|
5
|
+
export const CHANNEL_LABELS = {
|
|
6
|
+
npm: 'npm',
|
|
7
|
+
native: 'native',
|
|
8
|
+
brew: 'Homebrew',
|
|
9
|
+
winget: 'WinGet',
|
|
10
|
+
legacy: 'legacy install',
|
|
11
|
+
unknown: 'unknown install',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const defaultFsx = {
|
|
15
|
+
exists: (file) => fs.existsSync(file),
|
|
16
|
+
realpath: (file) => {
|
|
17
|
+
try { return fs.realpathSync.native(file); } catch { return file; }
|
|
18
|
+
},
|
|
19
|
+
readText: (file) => {
|
|
20
|
+
try { return fs.readFileSync(file, 'utf8').slice(0, 8192); } catch { return ''; }
|
|
21
|
+
},
|
|
22
|
+
isFile: (file) => {
|
|
23
|
+
try { return fs.statSync(file).isFile(); } catch { return false; }
|
|
24
|
+
},
|
|
25
|
+
isLink: (file) => {
|
|
26
|
+
try { return fs.lstatSync(file).isSymbolicLink(); } catch { return false; }
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
function pathModule(platform) {
|
|
31
|
+
return platform === 'win32' ? path.win32 : path.posix;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function homeDir(env, platform) {
|
|
35
|
+
return (platform === 'win32' ? env.USERPROFILE : env.HOME) || os.homedir();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function expandHome(p, env, platform) {
|
|
39
|
+
const m = pathModule(platform);
|
|
40
|
+
if (p === '~') return homeDir(env, platform);
|
|
41
|
+
if (p.startsWith('~/') || p.startsWith('~\\')) return m.join(homeDir(env, platform), p.slice(2));
|
|
42
|
+
return p;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function normalize(p, platform) {
|
|
46
|
+
const m = pathModule(platform);
|
|
47
|
+
let out = m.normalize(p);
|
|
48
|
+
if (platform === 'win32') out = out.toLowerCase();
|
|
49
|
+
return out.length > 1 ? out.replace(/[\\/]+$/, '') : out;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function isInside(file, dir, platform) {
|
|
53
|
+
const m = pathModule(platform);
|
|
54
|
+
return normalize(file, platform).startsWith(normalize(dir, platform) + m.sep);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function samePath(a, b, platform) {
|
|
58
|
+
return normalize(a, platform) === normalize(b, platform);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function ownsLocation({ resolvedPath, realPath }, entries, env, platform, fsx) {
|
|
62
|
+
const exts = platform === 'win32' ? ['', '.exe', '.cmd'] : [''];
|
|
63
|
+
return entries.some((entry) => {
|
|
64
|
+
const expanded = expandHome(entry, env, platform);
|
|
65
|
+
const inside = (dir) => isInside(resolvedPath, dir, platform) || isInside(realPath, dir, platform);
|
|
66
|
+
if (inside(expanded) || inside(fsx.realpath(expanded))) return true;
|
|
67
|
+
return exts.map((ext) => expanded + ext)
|
|
68
|
+
.filter((launcher) => fsx.isFile(launcher) && !fsx.isLink(launcher))
|
|
69
|
+
.some((launcher) => samePath(resolvedPath, launcher, platform) || samePath(realPath, fsx.realpath(launcher), platform));
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function npmPrefixAt(prefix, segments, platform, fsx) {
|
|
74
|
+
const m = pathModule(platform);
|
|
75
|
+
const win = platform === 'win32';
|
|
76
|
+
const pkgDir = win ? m.join(prefix, 'node_modules', ...segments) : m.join(prefix, 'lib', 'node_modules', ...segments);
|
|
77
|
+
if (!fsx.exists(m.join(pkgDir, 'package.json'))) return null;
|
|
78
|
+
const npm = win ? m.join(prefix, 'npm.cmd') : m.join(prefix, 'bin', 'npm');
|
|
79
|
+
return { prefix, pkgDir, npm: fsx.exists(npm) ? npm : null };
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function npmBeside({ resolvedPath, realPath, pkg, platform, fsx }) {
|
|
83
|
+
const m = pathModule(platform);
|
|
84
|
+
const segments = pkg.split('/');
|
|
85
|
+
const dir = m.dirname(resolvedPath);
|
|
86
|
+
const beside = npmPrefixAt(platform === 'win32' ? dir : m.resolve(dir, '..'), segments, platform, fsx);
|
|
87
|
+
if (!beside) return null;
|
|
88
|
+
if (isInside(realPath, beside.pkgDir, platform) || isInside(realPath, fsx.realpath(beside.pkgDir), platform)) return beside;
|
|
89
|
+
if (fsx.isLink(resolvedPath)) return null;
|
|
90
|
+
const text = fsx.readText(resolvedPath).toLowerCase().replace(/\\/g, '/');
|
|
91
|
+
return text.includes(['node_modules', ...segments].join('/').toLowerCase()) ? beside : null;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function npmLinkedInto({ realPath, pkg, platform, fsx }) {
|
|
95
|
+
const m = pathModule(platform);
|
|
96
|
+
const win = platform === 'win32';
|
|
97
|
+
const segments = pkg.split('/');
|
|
98
|
+
const inner = m.sep + m.join(...(win ? [] : ['lib']), 'node_modules', ...segments) + m.sep;
|
|
99
|
+
const at = (win ? realPath.toLowerCase() : realPath).lastIndexOf(win ? inner.toLowerCase() : inner);
|
|
100
|
+
return at > 0 ? npmPrefixAt(realPath.slice(0, at), segments, platform, fsx) : null;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function brewOwner({ realPath, names, platform, fsx }) {
|
|
104
|
+
if (platform === 'win32') return null;
|
|
105
|
+
const segments = realPath.split('/');
|
|
106
|
+
const index = segments.findIndex((s, i) => i > 0 && (s === 'Caskroom' || s === 'Cellar'));
|
|
107
|
+
if (index === -1 || !names.includes(segments[index + 1])) return null;
|
|
108
|
+
const prefix = segments.slice(0, index).join('/') || '/';
|
|
109
|
+
const brew = `${prefix}/bin/brew`;
|
|
110
|
+
return { prefix, token: segments[index + 1], cask: segments[index] === 'Caskroom', brew: fsx.exists(brew) ? brew : null };
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function wingetOwner({ realPath, id, platform }) {
|
|
114
|
+
if (platform !== 'win32' || !id) return null;
|
|
115
|
+
const segments = realPath.split(/[\\/]/);
|
|
116
|
+
const index = segments.findIndex((s, i) => i > 0
|
|
117
|
+
&& s.toLowerCase() === 'winget'
|
|
118
|
+
&& segments[i - 1].toLowerCase() === 'microsoft'
|
|
119
|
+
&& (segments[i + 1] || '').toLowerCase() === 'packages');
|
|
120
|
+
if (index === -1) return null;
|
|
121
|
+
const folder = (segments[index + 2] || '').toLowerCase();
|
|
122
|
+
return folder.startsWith(`${id.toLowerCase()}_`) ? { id } : null;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export function helpDescribes(text, args) {
|
|
126
|
+
const words = args.map((a) => a.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'));
|
|
127
|
+
const named = new RegExp(`(?<![\\w-])${words.join('(?![\\w-]).*(?<![\\w-])')}(?![\\w-])`, 'i');
|
|
128
|
+
const lines = String(text || '').split(/\r?\n/);
|
|
129
|
+
return lines.some((line, i) => (/usage/i.test(line) && named.test(line))
|
|
130
|
+
|| (/^\s*usage:?\s*$/i.test(line) && named.test(lines[i + 1] || '')));
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const EXACT_VERSION = String.raw`\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?`;
|
|
134
|
+
const ALIASED_BUILD = new RegExp(`^npm:((?:@[^/@\\s]+/)?[^/@\\s]+)@(${EXACT_VERSION})$`);
|
|
135
|
+
|
|
136
|
+
export function platformDependency(manifest, pkg, platform, arch) {
|
|
137
|
+
const spec = manifest?.optionalDependencies?.[`${pkg}-${platform}-${arch}`];
|
|
138
|
+
const alias = typeof spec === 'string' ? spec.match(ALIASED_BUILD) : null;
|
|
139
|
+
return alias ? { name: alias[1], version: alias[2] } : null;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export function formatCommand(file, args) {
|
|
143
|
+
return [file, ...args].map((a) => (/\s/.test(a) ? `"${a}"` : a)).join(' ');
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function shellQuote(arg, platform) {
|
|
147
|
+
if (platform === 'win32') return /^[\w\\/.:=+-]+$/.test(arg) ? arg : `'${arg.replace(/'/g, "''")}'`;
|
|
148
|
+
return /^[\w/.:=,+@%-]+$/.test(arg) ? arg : `'${arg.replace(/'/g, "'\\''")}'`;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export function shellCommand(file, args, platform) {
|
|
152
|
+
const command = shellQuote(file, platform);
|
|
153
|
+
const line = [command, ...args.map((arg) => shellQuote(arg, platform))].join(' ');
|
|
154
|
+
return platform === 'win32' && command !== file ? `& ${line}` : line;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export function classifyInstall({
|
|
158
|
+
resolvedPath, provider, env = process.env, platform = process.platform, fsx = defaultFsx, npmOnPath = null, wingetOnPath = null,
|
|
159
|
+
}) {
|
|
160
|
+
const realPath = fsx.realpath(resolvedPath);
|
|
161
|
+
const channels = provider.channels || {};
|
|
162
|
+
const result = (channel, extra = {}) => ({ channel, resolvedPath, realPath, update: null, probe: false, guidance: null, ...extra });
|
|
163
|
+
|
|
164
|
+
const ownedByNpm = (owner) => {
|
|
165
|
+
const npm = owner.npm || npmOnPath;
|
|
166
|
+
if (!npm) return result('npm', { prefix: owner.prefix, guidance: `Installed by npm under ${owner.prefix}, but npm was not found.` });
|
|
167
|
+
return result('npm', { prefix: owner.prefix, update: { file: npm, args: ['install', '-g', '--prefix', owner.prefix], package: provider.package } });
|
|
168
|
+
};
|
|
169
|
+
const npmArgs = { resolvedPath, realPath, pkg: provider.package, platform, fsx };
|
|
170
|
+
|
|
171
|
+
const beside = provider.package ? npmBeside(npmArgs) : null;
|
|
172
|
+
if (beside) return ownedByNpm(beside);
|
|
173
|
+
|
|
174
|
+
const brew = brewOwner({ realPath, names: channels.brew?.names || [], platform, fsx });
|
|
175
|
+
if (brew) {
|
|
176
|
+
const owned = { brewPrefix: brew.prefix, token: brew.token, cask: brew.cask };
|
|
177
|
+
if (!brew.brew) return result('brew', { ...owned, guidance: `Installed by Homebrew under ${brew.prefix}, but brew was not found at ${brew.prefix}/bin/brew.` });
|
|
178
|
+
return result('brew', { ...owned, update: { file: brew.brew, args: brew.cask ? ['upgrade', '--cask', brew.token] : ['upgrade', brew.token] } });
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
const linked = provider.package ? npmLinkedInto(npmArgs) : null;
|
|
182
|
+
if (linked) return ownedByNpm(linked);
|
|
183
|
+
|
|
184
|
+
const native = channels.native;
|
|
185
|
+
if (native && ownsLocation({ resolvedPath, realPath }, native.paths, env, platform, fsx)) {
|
|
186
|
+
if (native.update.length === 0) {
|
|
187
|
+
return result('native', { guidance: `${provider.tool} at ${resolvedPath} has no update command configured. Update it the way you installed it.` });
|
|
188
|
+
}
|
|
189
|
+
return result('native', { update: { file: resolvedPath, args: [...native.update] }, probe: true });
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const winget = wingetOwner({ realPath, id: channels.winget?.id, platform });
|
|
193
|
+
if (winget) {
|
|
194
|
+
if (!wingetOnPath) return result('winget', { wingetId: winget.id, guidance: 'Installed by WinGet, but winget was not found on PATH.' });
|
|
195
|
+
return result('winget', { wingetId: winget.id, update: { file: wingetOnPath, args: ['upgrade', '--id', winget.id, '--exact'] } });
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
const legacy = channels.legacy;
|
|
199
|
+
if (legacy && ownsLocation({ resolvedPath, realPath }, legacy.paths, env, platform, fsx)) {
|
|
200
|
+
return result('legacy', { guidance: legacy.guidance || `Installed by an older installer at ${resolvedPath}. Update it the way you installed it.` });
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
return result('unknown', { guidance: `Installed at ${resolvedPath} by a method Agent Guild does not recognise. Update it the way you installed it.` });
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export function installationKey(install, provider, platform, fsx = defaultFsx) {
|
|
207
|
+
switch (install.channel) {
|
|
208
|
+
case 'npm':
|
|
209
|
+
return provider.channels?.native?.sharedWithNpm ? 'native' : `npm:${normalize(fsx.realpath(install.prefix), platform)}`;
|
|
210
|
+
case 'native':
|
|
211
|
+
return 'native';
|
|
212
|
+
case 'legacy':
|
|
213
|
+
return 'legacy';
|
|
214
|
+
case 'brew':
|
|
215
|
+
return `brew:${install.brewPrefix}:${install.token}`;
|
|
216
|
+
case 'winget':
|
|
217
|
+
return `winget:${install.wingetId.toLowerCase()}`;
|
|
218
|
+
default:
|
|
219
|
+
return `path:${normalize(install.realPath, platform)}`;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export function removalCommand(install, provider, platform) {
|
|
224
|
+
switch (install.channel) {
|
|
225
|
+
case 'npm':
|
|
226
|
+
return install.update ? shellCommand(install.update.file, ['uninstall', '-g', '--prefix', install.prefix, provider.package], platform) : null;
|
|
227
|
+
case 'brew':
|
|
228
|
+
return install.update ? shellCommand(install.update.file, install.cask ? ['uninstall', '--cask', install.token] : ['uninstall', install.token], platform) : null;
|
|
229
|
+
case 'winget':
|
|
230
|
+
return shellCommand('winget', ['uninstall', '--id', install.wingetId, '--exact'], platform);
|
|
231
|
+
case 'native':
|
|
232
|
+
return provider.channels?.native?.uninstall || null;
|
|
233
|
+
case 'legacy':
|
|
234
|
+
return provider.channels?.legacy?.uninstall || null;
|
|
235
|
+
default:
|
|
236
|
+
return null;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export function knownLaunchers({ provider, command, env = process.env, platform = process.platform, fsx = defaultFsx }) {
|
|
241
|
+
if (!command || /[\\/]/.test(command)) return [];
|
|
242
|
+
const m = pathModule(platform);
|
|
243
|
+
const exts = platform === 'win32' ? ['.exe', '.cmd', ''] : [''];
|
|
244
|
+
const firstFile = (base) => exts.map((ext) => base + ext).find((file) => fsx.isFile(file)) || null;
|
|
245
|
+
const found = [];
|
|
246
|
+
for (const channel of [provider.channels?.native, provider.channels?.legacy]) {
|
|
247
|
+
for (const entry of channel?.paths || []) {
|
|
248
|
+
const base = expandHome(entry, env, platform);
|
|
249
|
+
const hit = firstFile(base) || firstFile(m.join(base, command));
|
|
250
|
+
if (hit) found.push(hit);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
return found;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export function listInstallations({
|
|
257
|
+
onPath = [], known = [], provider, env = process.env, platform = process.platform, fsx = defaultFsx, npmOnPath = null, wingetOnPath = null,
|
|
258
|
+
}) {
|
|
259
|
+
const installs = new Map();
|
|
260
|
+
const add = (file, isOnPath) => {
|
|
261
|
+
const install = classifyInstall({ resolvedPath: file, provider, env, platform, fsx, npmOnPath, wingetOnPath });
|
|
262
|
+
const key = installationKey(install, provider, platform, fsx);
|
|
263
|
+
if (!installs.has(key)) installs.set(key, { ...install, key, onPath: isOnPath, removeCommand: removalCommand(install, provider, platform) });
|
|
264
|
+
};
|
|
265
|
+
for (const file of onPath) add(file, true);
|
|
266
|
+
for (const file of known) add(file, false);
|
|
267
|
+
return [...installs.values()];
|
|
268
|
+
}
|