@rarog/server 0.0.0-stage → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +160 -2
- package/THIRD-PARTY-NOTICES +2110 -0
- package/bin/rarog.mjs +146 -0
- package/node_modules/@rarog/shared/LICENSE +21 -0
- package/node_modules/@rarog/shared/package.json +43 -0
- package/node_modules/@rarog/shared/src/data-dir.d.mts +49 -0
- package/node_modules/@rarog/shared/src/data-dir.mjs +120 -0
- package/node_modules/@rarog/shared/src/decode.js +335 -0
- package/node_modules/@rarog/shared/src/iroh.js +13 -0
- package/node_modules/@rarog/shared/src/notify-copy.js +12 -0
- package/node_modules/@rarog/shared/src/pairing-link.js +246 -0
- package/node_modules/@rarog/shared/src/protocol/activity.js +42 -0
- package/node_modules/@rarog/shared/src/protocol/attachments.js +192 -0
- package/node_modules/@rarog/shared/src/protocol/background.js +89 -0
- package/node_modules/@rarog/shared/src/protocol/commands.js +34 -0
- package/node_modules/@rarog/shared/src/protocol/consent.js +28 -0
- package/node_modules/@rarog/shared/src/protocol/dictation.js +23 -0
- package/node_modules/@rarog/shared/src/protocol/diff.js +78 -0
- package/node_modules/@rarog/shared/src/protocol/directories.js +44 -0
- package/node_modules/@rarog/shared/src/protocol/git.js +23 -0
- package/node_modules/@rarog/shared/src/protocol/herdr.js +23 -0
- package/node_modules/@rarog/shared/src/protocol/model.js +214 -0
- package/node_modules/@rarog/shared/src/protocol/notes.js +91 -0
- package/node_modules/@rarog/shared/src/protocol/resume.js +57 -0
- package/node_modules/@rarog/shared/src/protocol/terminal.js +259 -0
- package/node_modules/@rarog/shared/src/protocol.js +865 -0
- package/node_modules/@rarog/shared/src/relay-auth.js +231 -0
- package/node_modules/@rarog/shared/src/relay.js +103 -0
- package/node_modules/@rarog/shared/src/rest.js +804 -0
- package/node_modules/@rarog/shared/src/sentences/commands.js +203 -0
- package/node_modules/@rarog/shared/src/sentences/demo.js +10 -0
- package/node_modules/@rarog/shared/src/sentences/dialogs.js +103 -0
- package/node_modules/@rarog/shared/src/sentences/herdr.js +111 -0
- package/node_modules/@rarog/shared/src/sentences/index.js +362 -0
- package/node_modules/@rarog/shared/src/sentences/model.js +73 -0
- package/node_modules/@rarog/shared/src/sentences/push.js +56 -0
- package/node_modules/@rarog/shared/src/sentences/rest.js +127 -0
- package/node_modules/@rarog/shared/src/sentences/restart.js +71 -0
- package/node_modules/@rarog/shared/src/sentences/session.js +133 -0
- package/node_modules/@rarog/shared/src/sentences/state.js +15 -0
- package/node_modules/@rarog/shared/src/sentences/term.js +34 -0
- package/node_modules/@rarog/shared/src/sentences/transcript.js +24 -0
- package/node_modules/@rarog/shared/src/sentences/uploads.js +32 -0
- package/node_modules/@rarog/shared/src/workflow-phases.js +45 -0
- package/node_modules/ansi-regex/index.d.ts +37 -0
- package/node_modules/ansi-regex/index.js +10 -0
- package/node_modules/ansi-regex/license +9 -0
- package/node_modules/ansi-regex/package.json +55 -0
- package/node_modules/ansi-regex/readme.md +78 -0
- package/node_modules/ansi-styles/index.d.ts +345 -0
- package/node_modules/ansi-styles/index.js +163 -0
- package/node_modules/ansi-styles/license +9 -0
- package/node_modules/ansi-styles/package.json +56 -0
- package/node_modules/ansi-styles/readme.md +152 -0
- package/node_modules/camelcase/index.d.ts +63 -0
- package/node_modules/camelcase/index.js +76 -0
- package/node_modules/camelcase/license +9 -0
- package/node_modules/camelcase/package.json +43 -0
- package/node_modules/camelcase/readme.md +99 -0
- package/node_modules/cliui/LICENSE.txt +14 -0
- package/node_modules/cliui/README.md +115 -0
- package/node_modules/cliui/index.js +354 -0
- package/node_modules/cliui/package.json +65 -0
- package/node_modules/color-convert/LICENSE +21 -0
- package/node_modules/color-convert/README.md +68 -0
- package/node_modules/color-convert/conversions.js +839 -0
- package/node_modules/color-convert/index.js +81 -0
- package/node_modules/color-convert/package.json +48 -0
- package/node_modules/color-convert/route.js +97 -0
- package/node_modules/color-name/LICENSE +8 -0
- package/node_modules/color-name/README.md +11 -0
- package/node_modules/color-name/index.js +152 -0
- package/node_modules/color-name/package.json +28 -0
- package/node_modules/decamelize/index.js +13 -0
- package/node_modules/decamelize/license +21 -0
- package/node_modules/decamelize/package.json +38 -0
- package/node_modules/decamelize/readme.md +48 -0
- package/node_modules/dijkstrajs/.travis.yml +4 -0
- package/node_modules/dijkstrajs/CONTRIBUTING.md +8 -0
- package/node_modules/dijkstrajs/LICENSE.md +19 -0
- package/node_modules/dijkstrajs/README.md +18 -0
- package/node_modules/dijkstrajs/dijkstra.js +165 -0
- package/node_modules/dijkstrajs/package.json +60 -0
- package/node_modules/dijkstrajs/test/dijkstra.test.js +96 -0
- package/node_modules/emoji-regex/LICENSE-MIT.txt +20 -0
- package/node_modules/emoji-regex/README.md +73 -0
- package/node_modules/emoji-regex/es2015/index.js +6 -0
- package/node_modules/emoji-regex/es2015/text.js +6 -0
- package/node_modules/emoji-regex/index.d.ts +23 -0
- package/node_modules/emoji-regex/index.js +6 -0
- package/node_modules/emoji-regex/package.json +50 -0
- package/node_modules/emoji-regex/text.js +6 -0
- package/node_modules/find-up/index.d.ts +137 -0
- package/node_modules/find-up/index.js +89 -0
- package/node_modules/find-up/license +9 -0
- package/node_modules/find-up/package.json +53 -0
- package/node_modules/find-up/readme.md +156 -0
- package/node_modules/get-caller-file/LICENSE.md +6 -0
- package/node_modules/get-caller-file/README.md +41 -0
- package/node_modules/get-caller-file/index.d.ts +2 -0
- package/node_modules/get-caller-file/index.js +22 -0
- package/node_modules/get-caller-file/index.js.map +1 -0
- package/node_modules/get-caller-file/package.json +42 -0
- package/node_modules/is-fullwidth-code-point/index.d.ts +17 -0
- package/node_modules/is-fullwidth-code-point/index.js +50 -0
- package/node_modules/is-fullwidth-code-point/license +9 -0
- package/node_modules/is-fullwidth-code-point/package.json +42 -0
- package/node_modules/is-fullwidth-code-point/readme.md +39 -0
- package/node_modules/locate-path/index.d.ts +83 -0
- package/node_modules/locate-path/index.js +65 -0
- package/node_modules/locate-path/license +9 -0
- package/node_modules/locate-path/package.json +45 -0
- package/node_modules/locate-path/readme.md +122 -0
- package/node_modules/p-limit/index.d.ts +38 -0
- package/node_modules/p-limit/index.js +57 -0
- package/node_modules/p-limit/license +9 -0
- package/node_modules/p-limit/package.json +52 -0
- package/node_modules/p-limit/readme.md +101 -0
- package/node_modules/p-locate/index.d.ts +64 -0
- package/node_modules/p-locate/index.js +52 -0
- package/node_modules/p-locate/license +9 -0
- package/node_modules/p-locate/package.json +53 -0
- package/node_modules/p-locate/readme.md +90 -0
- package/node_modules/p-try/index.d.ts +39 -0
- package/node_modules/p-try/index.js +9 -0
- package/node_modules/p-try/license +9 -0
- package/node_modules/p-try/package.json +42 -0
- package/node_modules/p-try/readme.md +58 -0
- package/node_modules/path-exists/index.d.ts +28 -0
- package/node_modules/path-exists/index.js +23 -0
- package/node_modules/path-exists/license +9 -0
- package/node_modules/path-exists/package.json +39 -0
- package/node_modules/path-exists/readme.md +52 -0
- package/node_modules/pngjs/.eslintignore +2 -0
- package/node_modules/pngjs/.eslintrc.json +19 -0
- package/node_modules/pngjs/.prettierignore +3 -0
- package/node_modules/pngjs/LICENSE +20 -0
- package/node_modules/pngjs/README.md +429 -0
- package/node_modules/pngjs/browser.js +16096 -0
- package/node_modules/pngjs/coverage/lcov-report/base.css +354 -0
- package/node_modules/pngjs/coverage/lcov-report/bitmapper.js.html +881 -0
- package/node_modules/pngjs/coverage/lcov-report/bitpacker.js.html +554 -0
- package/node_modules/pngjs/coverage/lcov-report/block-navigation.js +77 -0
- package/node_modules/pngjs/coverage/lcov-report/chunkstream.js.html +647 -0
- package/node_modules/pngjs/coverage/lcov-report/constants.js.html +176 -0
- package/node_modules/pngjs/coverage/lcov-report/crc.js.html +200 -0
- package/node_modules/pngjs/coverage/lcov-report/favicon.png +0 -0
- package/node_modules/pngjs/coverage/lcov-report/filter-pack.js.html +593 -0
- package/node_modules/pngjs/coverage/lcov-report/filter-parse-async.js.html +152 -0
- package/node_modules/pngjs/coverage/lcov-report/filter-parse-sync.js.html +143 -0
- package/node_modules/pngjs/coverage/lcov-report/filter-parse.js.html +611 -0
- package/node_modules/pngjs/coverage/lcov-report/format-normaliser.js.html +359 -0
- package/node_modules/pngjs/coverage/lcov-report/index.html +426 -0
- package/node_modules/pngjs/coverage/lcov-report/interlace.js.html +365 -0
- package/node_modules/pngjs/coverage/lcov-report/packer-async.js.html +230 -0
- package/node_modules/pngjs/coverage/lcov-report/packer-sync.js.html +248 -0
- package/node_modules/pngjs/coverage/lcov-report/packer.js.html +467 -0
- package/node_modules/pngjs/coverage/lcov-report/paeth-predictor.js.html +128 -0
- package/node_modules/pngjs/coverage/lcov-report/parser-async.js.html +575 -0
- package/node_modules/pngjs/coverage/lcov-report/parser-sync.js.html +404 -0
- package/node_modules/pngjs/coverage/lcov-report/parser.js.html +950 -0
- package/node_modules/pngjs/coverage/lcov-report/png-sync.js.html +116 -0
- package/node_modules/pngjs/coverage/lcov-report/png.js.html +662 -0
- package/node_modules/pngjs/coverage/lcov-report/prettify.css +101 -0
- package/node_modules/pngjs/coverage/lcov-report/prettify.js +1007 -0
- package/node_modules/pngjs/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/node_modules/pngjs/coverage/lcov-report/sorter.js +169 -0
- package/node_modules/pngjs/coverage/lcov-report/sync-inflate.js.html +584 -0
- package/node_modules/pngjs/coverage/lcov-report/sync-reader.js.html +215 -0
- package/node_modules/pngjs/coverage/lcov.info +2177 -0
- package/node_modules/pngjs/lib/bitmapper.js +267 -0
- package/node_modules/pngjs/lib/bitpacker.js +158 -0
- package/node_modules/pngjs/lib/chunkstream.js +189 -0
- package/node_modules/pngjs/lib/constants.js +32 -0
- package/node_modules/pngjs/lib/crc.js +40 -0
- package/node_modules/pngjs/lib/filter-pack.js +171 -0
- package/node_modules/pngjs/lib/filter-parse-async.js +24 -0
- package/node_modules/pngjs/lib/filter-parse-sync.js +21 -0
- package/node_modules/pngjs/lib/filter-parse.js +177 -0
- package/node_modules/pngjs/lib/format-normaliser.js +93 -0
- package/node_modules/pngjs/lib/interlace.js +95 -0
- package/node_modules/pngjs/lib/packer-async.js +50 -0
- package/node_modules/pngjs/lib/packer-sync.js +56 -0
- package/node_modules/pngjs/lib/packer.js +129 -0
- package/node_modules/pngjs/lib/paeth-predictor.js +16 -0
- package/node_modules/pngjs/lib/parser-async.js +165 -0
- package/node_modules/pngjs/lib/parser-sync.js +108 -0
- package/node_modules/pngjs/lib/parser.js +290 -0
- package/node_modules/pngjs/lib/png-sync.js +12 -0
- package/node_modules/pngjs/lib/png.js +194 -0
- package/node_modules/pngjs/lib/sync-inflate.js +168 -0
- package/node_modules/pngjs/lib/sync-reader.js +45 -0
- package/node_modules/pngjs/package.json +73 -0
- package/node_modules/qrcode/README.md +770 -0
- package/node_modules/qrcode/bin/qrcode +159 -0
- package/node_modules/qrcode/helper/to-sjis-browser.js +2 -0
- package/node_modules/qrcode/helper/to-sjis.js +105 -0
- package/node_modules/qrcode/lib/browser.js +76 -0
- package/node_modules/qrcode/lib/can-promise.js +7 -0
- package/node_modules/qrcode/lib/core/alignment-pattern.js +83 -0
- package/node_modules/qrcode/lib/core/alphanumeric-data.js +59 -0
- package/node_modules/qrcode/lib/core/bit-buffer.js +37 -0
- package/node_modules/qrcode/lib/core/bit-matrix.js +65 -0
- package/node_modules/qrcode/lib/core/byte-data.js +30 -0
- package/node_modules/qrcode/lib/core/error-correction-code.js +135 -0
- package/node_modules/qrcode/lib/core/error-correction-level.js +50 -0
- package/node_modules/qrcode/lib/core/finder-pattern.js +22 -0
- package/node_modules/qrcode/lib/core/format-info.js +29 -0
- package/node_modules/qrcode/lib/core/galois-field.js +69 -0
- package/node_modules/qrcode/lib/core/kanji-data.js +54 -0
- package/node_modules/qrcode/lib/core/mask-pattern.js +234 -0
- package/node_modules/qrcode/lib/core/mode.js +167 -0
- package/node_modules/qrcode/lib/core/numeric-data.js +43 -0
- package/node_modules/qrcode/lib/core/polynomial.js +62 -0
- package/node_modules/qrcode/lib/core/qrcode.js +495 -0
- package/node_modules/qrcode/lib/core/reed-solomon-encoder.js +56 -0
- package/node_modules/qrcode/lib/core/regex.js +31 -0
- package/node_modules/qrcode/lib/core/segments.js +330 -0
- package/node_modules/qrcode/lib/core/utils.js +63 -0
- package/node_modules/qrcode/lib/core/version-check.js +9 -0
- package/node_modules/qrcode/lib/core/version.js +163 -0
- package/node_modules/qrcode/lib/index.js +12 -0
- package/node_modules/qrcode/lib/renderer/canvas.js +63 -0
- package/node_modules/qrcode/lib/renderer/png.js +78 -0
- package/node_modules/qrcode/lib/renderer/svg-tag.js +81 -0
- package/node_modules/qrcode/lib/renderer/svg.js +19 -0
- package/node_modules/qrcode/lib/renderer/terminal/terminal-small.js +85 -0
- package/node_modules/qrcode/lib/renderer/terminal/terminal.js +49 -0
- package/node_modules/qrcode/lib/renderer/terminal.js +9 -0
- package/node_modules/qrcode/lib/renderer/utf8.js +71 -0
- package/node_modules/qrcode/lib/renderer/utils.js +99 -0
- package/node_modules/qrcode/lib/server.js +138 -0
- package/node_modules/qrcode/license +10 -0
- package/node_modules/qrcode/package.json +77 -0
- package/node_modules/require-directory/.jshintrc +67 -0
- package/node_modules/require-directory/.npmignore +1 -0
- package/node_modules/require-directory/.travis.yml +3 -0
- package/node_modules/require-directory/LICENSE +22 -0
- package/node_modules/require-directory/README.markdown +184 -0
- package/node_modules/require-directory/index.js +86 -0
- package/node_modules/require-directory/package.json +40 -0
- package/node_modules/require-main-filename/LICENSE.txt +14 -0
- package/node_modules/require-main-filename/README.md +26 -0
- package/node_modules/require-main-filename/index.js +18 -0
- package/node_modules/require-main-filename/package.json +35 -0
- package/node_modules/set-blocking/LICENSE.txt +14 -0
- package/node_modules/set-blocking/README.md +31 -0
- package/node_modules/set-blocking/index.js +7 -0
- package/node_modules/set-blocking/package.json +42 -0
- package/node_modules/string-width/index.d.ts +29 -0
- package/node_modules/string-width/index.js +47 -0
- package/node_modules/string-width/license +9 -0
- package/node_modules/string-width/package.json +56 -0
- package/node_modules/string-width/readme.md +50 -0
- package/node_modules/strip-ansi/index.d.ts +17 -0
- package/node_modules/strip-ansi/index.js +4 -0
- package/node_modules/strip-ansi/license +9 -0
- package/node_modules/strip-ansi/package.json +54 -0
- package/node_modules/strip-ansi/readme.md +46 -0
- package/node_modules/which-module/LICENSE +13 -0
- package/node_modules/which-module/README.md +58 -0
- package/node_modules/which-module/index.js +9 -0
- package/node_modules/which-module/package.json +41 -0
- package/node_modules/wrap-ansi/index.js +186 -0
- package/node_modules/wrap-ansi/license +9 -0
- package/node_modules/wrap-ansi/package.json +61 -0
- package/node_modules/wrap-ansi/readme.md +97 -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 +1407 -0
- package/node_modules/ws/package.json +74 -0
- package/node_modules/ws/wrapper.mjs +21 -0
- package/node_modules/y18n/LICENSE +13 -0
- package/node_modules/y18n/README.md +109 -0
- package/node_modules/y18n/index.js +188 -0
- package/node_modules/y18n/package.json +39 -0
- package/node_modules/yargs/LICENSE +21 -0
- package/node_modules/yargs/README.md +140 -0
- package/node_modules/yargs/build/lib/apply-extends.d.ts +2 -0
- package/node_modules/yargs/build/lib/apply-extends.js +65 -0
- package/node_modules/yargs/build/lib/argsert.d.ts +2 -0
- package/node_modules/yargs/build/lib/argsert.js +65 -0
- package/node_modules/yargs/build/lib/command.d.ts +64 -0
- package/node_modules/yargs/build/lib/command.js +416 -0
- package/node_modules/yargs/build/lib/common-types.d.ts +36 -0
- package/node_modules/yargs/build/lib/common-types.js +25 -0
- package/node_modules/yargs/build/lib/completion-templates.d.ts +2 -0
- package/node_modules/yargs/build/lib/completion-templates.js +50 -0
- package/node_modules/yargs/build/lib/completion.d.ts +21 -0
- package/node_modules/yargs/build/lib/completion.js +135 -0
- package/node_modules/yargs/build/lib/is-promise.d.ts +1 -0
- package/node_modules/yargs/build/lib/is-promise.js +9 -0
- package/node_modules/yargs/build/lib/levenshtein.d.ts +1 -0
- package/node_modules/yargs/build/lib/levenshtein.js +58 -0
- package/node_modules/yargs/build/lib/middleware.d.ts +10 -0
- package/node_modules/yargs/build/lib/middleware.js +57 -0
- package/node_modules/yargs/build/lib/obj-filter.d.ts +1 -0
- package/node_modules/yargs/build/lib/obj-filter.js +14 -0
- package/node_modules/yargs/build/lib/parse-command.d.ts +11 -0
- package/node_modules/yargs/build/lib/parse-command.js +36 -0
- package/node_modules/yargs/build/lib/process-argv.d.ts +2 -0
- package/node_modules/yargs/build/lib/process-argv.js +31 -0
- package/node_modules/yargs/build/lib/usage.d.ts +49 -0
- package/node_modules/yargs/build/lib/usage.js +540 -0
- package/node_modules/yargs/build/lib/validation.d.ts +34 -0
- package/node_modules/yargs/build/lib/validation.js +330 -0
- package/node_modules/yargs/build/lib/yargs.d.ts +274 -0
- package/node_modules/yargs/build/lib/yargs.js +1190 -0
- package/node_modules/yargs/build/lib/yerror.d.ts +4 -0
- package/node_modules/yargs/build/lib/yerror.js +11 -0
- package/node_modules/yargs/index.js +40 -0
- package/node_modules/yargs/locales/be.json +46 -0
- package/node_modules/yargs/locales/de.json +46 -0
- package/node_modules/yargs/locales/en.json +51 -0
- package/node_modules/yargs/locales/es.json +46 -0
- package/node_modules/yargs/locales/fi.json +49 -0
- package/node_modules/yargs/locales/fr.json +53 -0
- package/node_modules/yargs/locales/hi.json +49 -0
- package/node_modules/yargs/locales/hu.json +46 -0
- package/node_modules/yargs/locales/id.json +50 -0
- package/node_modules/yargs/locales/it.json +46 -0
- package/node_modules/yargs/locales/ja.json +51 -0
- package/node_modules/yargs/locales/ko.json +49 -0
- package/node_modules/yargs/locales/nb.json +44 -0
- package/node_modules/yargs/locales/nl.json +49 -0
- package/node_modules/yargs/locales/nn.json +44 -0
- package/node_modules/yargs/locales/pirate.json +13 -0
- package/node_modules/yargs/locales/pl.json +49 -0
- package/node_modules/yargs/locales/pt.json +45 -0
- package/node_modules/yargs/locales/pt_BR.json +48 -0
- package/node_modules/yargs/locales/ru.json +46 -0
- package/node_modules/yargs/locales/th.json +46 -0
- package/node_modules/yargs/locales/tr.json +48 -0
- package/node_modules/yargs/locales/zh_CN.json +48 -0
- package/node_modules/yargs/locales/zh_TW.json +47 -0
- package/node_modules/yargs/package.json +92 -0
- package/node_modules/yargs/yargs.js +14 -0
- package/node_modules/yargs-parser/LICENSE.txt +14 -0
- package/node_modules/yargs-parser/README.md +449 -0
- package/node_modules/yargs-parser/index.js +1032 -0
- package/node_modules/yargs-parser/lib/tokenize-arg-string.js +40 -0
- package/node_modules/yargs-parser/package.json +46 -0
- package/node_modules/zod/LICENSE +21 -0
- package/node_modules/zod/README.md +191 -0
- package/node_modules/zod/index.cjs +33 -0
- package/node_modules/zod/index.d.cts +4 -0
- package/node_modules/zod/index.d.ts +4 -0
- package/node_modules/zod/index.js +4 -0
- package/node_modules/zod/locales/index.cjs +17 -0
- package/node_modules/zod/locales/index.d.cts +1 -0
- package/node_modules/zod/locales/index.d.ts +1 -0
- package/node_modules/zod/locales/index.js +1 -0
- package/node_modules/zod/locales/package.json +7 -0
- package/node_modules/zod/mini/index.cjs +32 -0
- package/node_modules/zod/mini/index.d.cts +3 -0
- package/node_modules/zod/mini/index.d.ts +3 -0
- package/node_modules/zod/mini/index.js +3 -0
- package/node_modules/zod/mini/package.json +7 -0
- package/node_modules/zod/package.json +135 -0
- package/node_modules/zod/src/index.ts +4 -0
- package/node_modules/zod/src/locales/index.ts +1 -0
- package/node_modules/zod/src/mini/index.ts +3 -0
- package/node_modules/zod/src/v3/ZodError.ts +330 -0
- package/node_modules/zod/src/v3/benchmarks/datetime.ts +58 -0
- package/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts +80 -0
- package/node_modules/zod/src/v3/benchmarks/index.ts +59 -0
- package/node_modules/zod/src/v3/benchmarks/ipv4.ts +57 -0
- package/node_modules/zod/src/v3/benchmarks/object.ts +69 -0
- package/node_modules/zod/src/v3/benchmarks/primitives.ts +162 -0
- package/node_modules/zod/src/v3/benchmarks/realworld.ts +63 -0
- package/node_modules/zod/src/v3/benchmarks/string.ts +55 -0
- package/node_modules/zod/src/v3/benchmarks/union.ts +80 -0
- package/node_modules/zod/src/v3/errors.ts +13 -0
- package/node_modules/zod/src/v3/external.ts +6 -0
- package/node_modules/zod/src/v3/helpers/enumUtil.ts +17 -0
- package/node_modules/zod/src/v3/helpers/errorUtil.ts +8 -0
- package/node_modules/zod/src/v3/helpers/parseUtil.ts +176 -0
- package/node_modules/zod/src/v3/helpers/partialUtil.ts +34 -0
- package/node_modules/zod/src/v3/helpers/typeAliases.ts +2 -0
- package/node_modules/zod/src/v3/helpers/util.ts +224 -0
- package/node_modules/zod/src/v3/index.ts +4 -0
- package/node_modules/zod/src/v3/locales/en.ts +124 -0
- package/node_modules/zod/src/v3/standard-schema.ts +113 -0
- package/node_modules/zod/src/v3/tests/Mocker.ts +54 -0
- package/node_modules/zod/src/v3/tests/all-errors.test.ts +157 -0
- package/node_modules/zod/src/v3/tests/anyunknown.test.ts +28 -0
- package/node_modules/zod/src/v3/tests/array.test.ts +71 -0
- package/node_modules/zod/src/v3/tests/async-parsing.test.ts +388 -0
- package/node_modules/zod/src/v3/tests/async-refinements.test.ts +46 -0
- package/node_modules/zod/src/v3/tests/base.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/bigint.test.ts +55 -0
- package/node_modules/zod/src/v3/tests/branded.test.ts +53 -0
- package/node_modules/zod/src/v3/tests/catch.test.ts +220 -0
- package/node_modules/zod/src/v3/tests/coerce.test.ts +133 -0
- package/node_modules/zod/src/v3/tests/complex.test.ts +70 -0
- package/node_modules/zod/src/v3/tests/custom.test.ts +31 -0
- package/node_modules/zod/src/v3/tests/date.test.ts +32 -0
- package/node_modules/zod/src/v3/tests/deepmasking.test.ts +186 -0
- package/node_modules/zod/src/v3/tests/default.test.ts +112 -0
- package/node_modules/zod/src/v3/tests/description.test.ts +33 -0
- package/node_modules/zod/src/v3/tests/discriminated-unions.test.ts +315 -0
- package/node_modules/zod/src/v3/tests/enum.test.ts +80 -0
- package/node_modules/zod/src/v3/tests/error.test.ts +551 -0
- package/node_modules/zod/src/v3/tests/firstparty.test.ts +87 -0
- package/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts +21 -0
- package/node_modules/zod/src/v3/tests/function.test.ts +261 -0
- package/node_modules/zod/src/v3/tests/generics.test.ts +48 -0
- package/node_modules/zod/src/v3/tests/instanceof.test.ts +37 -0
- package/node_modules/zod/src/v3/tests/intersection.test.ts +110 -0
- package/node_modules/zod/src/v3/tests/language-server.source.ts +76 -0
- package/node_modules/zod/src/v3/tests/language-server.test.ts +207 -0
- package/node_modules/zod/src/v3/tests/literal.test.ts +36 -0
- package/node_modules/zod/src/v3/tests/map.test.ts +110 -0
- package/node_modules/zod/src/v3/tests/masking.test.ts +4 -0
- package/node_modules/zod/src/v3/tests/mocker.test.ts +19 -0
- package/node_modules/zod/src/v3/tests/nan.test.ts +24 -0
- package/node_modules/zod/src/v3/tests/nativeEnum.test.ts +87 -0
- package/node_modules/zod/src/v3/tests/nullable.test.ts +42 -0
- package/node_modules/zod/src/v3/tests/number.test.ts +176 -0
- package/node_modules/zod/src/v3/tests/object-augmentation.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/object.test.ts +434 -0
- package/node_modules/zod/src/v3/tests/optional.test.ts +42 -0
- package/node_modules/zod/src/v3/tests/parseUtil.test.ts +23 -0
- package/node_modules/zod/src/v3/tests/parser.test.ts +41 -0
- package/node_modules/zod/src/v3/tests/partials.test.ts +243 -0
- package/node_modules/zod/src/v3/tests/pickomit.test.ts +111 -0
- package/node_modules/zod/src/v3/tests/pipeline.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/preprocess.test.ts +186 -0
- package/node_modules/zod/src/v3/tests/primitive.test.ts +440 -0
- package/node_modules/zod/src/v3/tests/promise.test.ts +90 -0
- package/node_modules/zod/src/v3/tests/readonly.test.ts +194 -0
- package/node_modules/zod/src/v3/tests/record.test.ts +171 -0
- package/node_modules/zod/src/v3/tests/recursive.test.ts +197 -0
- package/node_modules/zod/src/v3/tests/refine.test.ts +313 -0
- package/node_modules/zod/src/v3/tests/safeparse.test.ts +27 -0
- package/node_modules/zod/src/v3/tests/set.test.ts +142 -0
- package/node_modules/zod/src/v3/tests/standard-schema.test.ts +83 -0
- package/node_modules/zod/src/v3/tests/string.test.ts +916 -0
- package/node_modules/zod/src/v3/tests/transformer.test.ts +233 -0
- package/node_modules/zod/src/v3/tests/tuple.test.ts +90 -0
- package/node_modules/zod/src/v3/tests/unions.test.ts +57 -0
- package/node_modules/zod/src/v3/tests/validations.test.ts +133 -0
- package/node_modules/zod/src/v3/tests/void.test.ts +15 -0
- package/node_modules/zod/src/v3/types.ts +5138 -0
- package/node_modules/zod/src/v4/classic/checks.ts +32 -0
- package/node_modules/zod/src/v4/classic/coerce.ts +27 -0
- package/node_modules/zod/src/v4/classic/compat.ts +70 -0
- package/node_modules/zod/src/v4/classic/errors.ts +82 -0
- package/node_modules/zod/src/v4/classic/external.ts +52 -0
- package/node_modules/zod/src/v4/classic/from-json-schema.ts +659 -0
- package/node_modules/zod/src/v4/classic/index.ts +5 -0
- package/node_modules/zod/src/v4/classic/iso.ts +90 -0
- package/node_modules/zod/src/v4/classic/parse.ts +82 -0
- package/node_modules/zod/src/v4/classic/schemas.ts +2672 -0
- package/node_modules/zod/src/v4/classic/tests/anyunknown.test.ts +26 -0
- package/node_modules/zod/src/v4/classic/tests/apply.test.ts +59 -0
- package/node_modules/zod/src/v4/classic/tests/array.test.ts +264 -0
- package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +216 -0
- package/node_modules/zod/src/v4/classic/tests/async-parsing.test.ts +381 -0
- package/node_modules/zod/src/v4/classic/tests/async-refinements.test.ts +68 -0
- package/node_modules/zod/src/v4/classic/tests/base.test.ts +7 -0
- package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +54 -0
- package/node_modules/zod/src/v4/classic/tests/brand.test.ts +106 -0
- package/node_modules/zod/src/v4/classic/tests/catch.test.ts +326 -0
- package/node_modules/zod/src/v4/classic/tests/coalesce.test.ts +20 -0
- package/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +573 -0
- package/node_modules/zod/src/v4/classic/tests/codec.test.ts +703 -0
- package/node_modules/zod/src/v4/classic/tests/coerce.test.ts +160 -0
- package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +374 -0
- package/node_modules/zod/src/v4/classic/tests/custom.test.ts +40 -0
- package/node_modules/zod/src/v4/classic/tests/date.test.ts +62 -0
- package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +302 -0
- package/node_modules/zod/src/v4/classic/tests/default.test.ts +409 -0
- package/node_modules/zod/src/v4/classic/tests/describe-meta-checks.test.ts +27 -0
- package/node_modules/zod/src/v4/classic/tests/description.test.ts +32 -0
- package/node_modules/zod/src/v4/classic/tests/detached-methods.test.ts +197 -0
- package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +694 -0
- package/node_modules/zod/src/v4/classic/tests/enum.test.ts +285 -0
- package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +807 -0
- package/node_modules/zod/src/v4/classic/tests/error.test.ts +711 -0
- package/node_modules/zod/src/v4/classic/tests/file.test.ts +96 -0
- package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +179 -0
- package/node_modules/zod/src/v4/classic/tests/fix-json-issue.test.ts +26 -0
- package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +895 -0
- package/node_modules/zod/src/v4/classic/tests/function.test.ts +360 -0
- package/node_modules/zod/src/v4/classic/tests/generics.test.ts +72 -0
- package/node_modules/zod/src/v4/classic/tests/global-config.test.ts +39 -0
- package/node_modules/zod/src/v4/classic/tests/hash.test.ts +68 -0
- package/node_modules/zod/src/v4/classic/tests/index.test.ts +939 -0
- package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +60 -0
- package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +198 -0
- package/node_modules/zod/src/v4/classic/tests/jitless-allows-eval.test.ts +46 -0
- package/node_modules/zod/src/v4/classic/tests/json.test.ts +109 -0
- package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +227 -0
- package/node_modules/zod/src/v4/classic/tests/literal.test.ts +117 -0
- package/node_modules/zod/src/v4/classic/tests/locales_ka.test.ts +29 -0
- package/node_modules/zod/src/v4/classic/tests/locales_ro.test.ts +24 -0
- package/node_modules/zod/src/v4/classic/tests/map.test.ts +330 -0
- package/node_modules/zod/src/v4/classic/tests/nan.test.ts +21 -0
- package/node_modules/zod/src/v4/classic/tests/nested-refine.test.ts +168 -0
- package/node_modules/zod/src/v4/classic/tests/nonoptional.test.ts +101 -0
- package/node_modules/zod/src/v4/classic/tests/nullable.test.ts +22 -0
- package/node_modules/zod/src/v4/classic/tests/number.test.ts +325 -0
- package/node_modules/zod/src/v4/classic/tests/object.test.ts +717 -0
- package/node_modules/zod/src/v4/classic/tests/optional.test.ts +333 -0
- package/node_modules/zod/src/v4/classic/tests/partial.test.ts +450 -0
- package/node_modules/zod/src/v4/classic/tests/pickomit.test.ts +211 -0
- package/node_modules/zod/src/v4/classic/tests/pipe.test.ts +101 -0
- package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +74 -0
- package/node_modules/zod/src/v4/classic/tests/preprocess-types.test.ts +26 -0
- package/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +351 -0
- package/node_modules/zod/src/v4/classic/tests/primitive.test.ts +175 -0
- package/node_modules/zod/src/v4/classic/tests/promise.test.ts +81 -0
- package/node_modules/zod/src/v4/classic/tests/prototypes.test.ts +23 -0
- package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +252 -0
- package/node_modules/zod/src/v4/classic/tests/record.test.ts +717 -0
- package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +631 -0
- package/node_modules/zod/src/v4/classic/tests/refine.test.ts +633 -0
- package/node_modules/zod/src/v4/classic/tests/registries.test.ts +243 -0
- package/node_modules/zod/src/v4/classic/tests/set.test.ts +181 -0
- package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +134 -0
- package/node_modules/zod/src/v4/classic/tests/string-formats.test.ts +125 -0
- package/node_modules/zod/src/v4/classic/tests/string.test.ts +1224 -0
- package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +106 -0
- package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +771 -0
- package/node_modules/zod/src/v4/classic/tests/to-json-schema-methods.test.ts +438 -0
- package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +3125 -0
- package/node_modules/zod/src/v4/classic/tests/transform.test.ts +378 -0
- package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +496 -0
- package/node_modules/zod/src/v4/classic/tests/union.test.ts +273 -0
- package/node_modules/zod/src/v4/classic/tests/url.test.ts +13 -0
- package/node_modules/zod/src/v4/classic/tests/validations.test.ts +283 -0
- package/node_modules/zod/src/v4/classic/tests/void.test.ts +12 -0
- package/node_modules/zod/src/v4/core/api.ts +1823 -0
- package/node_modules/zod/src/v4/core/checks.ts +1293 -0
- package/node_modules/zod/src/v4/core/config.ts +15 -0
- package/node_modules/zod/src/v4/core/core.ts +153 -0
- package/node_modules/zod/src/v4/core/doc.ts +44 -0
- package/node_modules/zod/src/v4/core/errors.ts +455 -0
- package/node_modules/zod/src/v4/core/index.ts +16 -0
- package/node_modules/zod/src/v4/core/json-schema-generator.ts +126 -0
- package/node_modules/zod/src/v4/core/json-schema-processors.ts +666 -0
- package/node_modules/zod/src/v4/core/json-schema.ts +147 -0
- package/node_modules/zod/src/v4/core/parse.ts +195 -0
- package/node_modules/zod/src/v4/core/regexes.ts +190 -0
- package/node_modules/zod/src/v4/core/registries.ts +105 -0
- package/node_modules/zod/src/v4/core/schemas.ts +4730 -0
- package/node_modules/zod/src/v4/core/standard-schema.ts +159 -0
- package/node_modules/zod/src/v4/core/tests/extend.test.ts +59 -0
- package/node_modules/zod/src/v4/core/tests/index.test.ts +46 -0
- package/node_modules/zod/src/v4/core/tests/locales/be.test.ts +124 -0
- package/node_modules/zod/src/v4/core/tests/locales/el.test.ts +215 -0
- package/node_modules/zod/src/v4/core/tests/locales/en.test.ts +22 -0
- package/node_modules/zod/src/v4/core/tests/locales/es.test.ts +181 -0
- package/node_modules/zod/src/v4/core/tests/locales/fr.test.ts +72 -0
- package/node_modules/zod/src/v4/core/tests/locales/he.test.ts +379 -0
- package/node_modules/zod/src/v4/core/tests/locales/hr.test.ts +163 -0
- package/node_modules/zod/src/v4/core/tests/locales/nl.test.ts +46 -0
- package/node_modules/zod/src/v4/core/tests/locales/ru.test.ts +128 -0
- package/node_modules/zod/src/v4/core/tests/locales/tr.test.ts +69 -0
- package/node_modules/zod/src/v4/core/tests/locales/uz.test.ts +105 -0
- package/node_modules/zod/src/v4/core/tests/record-constructor.test.ts +125 -0
- package/node_modules/zod/src/v4/core/tests/recursive-tuples.test.ts +45 -0
- package/node_modules/zod/src/v4/core/to-json-schema.ts +622 -0
- package/node_modules/zod/src/v4/core/util.ts +983 -0
- package/node_modules/zod/src/v4/core/versions.ts +5 -0
- package/node_modules/zod/src/v4/core/zsf.ts +323 -0
- package/node_modules/zod/src/v4/index.ts +4 -0
- package/node_modules/zod/src/v4/locales/ar.ts +115 -0
- package/node_modules/zod/src/v4/locales/az.ts +111 -0
- package/node_modules/zod/src/v4/locales/be.ts +176 -0
- package/node_modules/zod/src/v4/locales/bg.ts +128 -0
- package/node_modules/zod/src/v4/locales/ca.ts +116 -0
- package/node_modules/zod/src/v4/locales/cs.ts +118 -0
- package/node_modules/zod/src/v4/locales/da.ts +123 -0
- package/node_modules/zod/src/v4/locales/de.ts +116 -0
- package/node_modules/zod/src/v4/locales/el.ts +121 -0
- package/node_modules/zod/src/v4/locales/en.ts +123 -0
- package/node_modules/zod/src/v4/locales/eo.ts +118 -0
- package/node_modules/zod/src/v4/locales/es.ts +141 -0
- package/node_modules/zod/src/v4/locales/fa.ts +126 -0
- package/node_modules/zod/src/v4/locales/fi.ts +121 -0
- package/node_modules/zod/src/v4/locales/fr-CA.ts +116 -0
- package/node_modules/zod/src/v4/locales/fr.ts +132 -0
- package/node_modules/zod/src/v4/locales/he.ts +246 -0
- package/node_modules/zod/src/v4/locales/hr.ts +131 -0
- package/node_modules/zod/src/v4/locales/hu.ts +117 -0
- package/node_modules/zod/src/v4/locales/hy.ts +164 -0
- package/node_modules/zod/src/v4/locales/id.ts +115 -0
- package/node_modules/zod/src/v4/locales/index.ts +52 -0
- package/node_modules/zod/src/v4/locales/is.ts +119 -0
- package/node_modules/zod/src/v4/locales/it.ts +116 -0
- package/node_modules/zod/src/v4/locales/ja.ts +114 -0
- package/node_modules/zod/src/v4/locales/ka.ts +123 -0
- package/node_modules/zod/src/v4/locales/kh.ts +7 -0
- package/node_modules/zod/src/v4/locales/km.ts +119 -0
- package/node_modules/zod/src/v4/locales/ko.ts +121 -0
- package/node_modules/zod/src/v4/locales/lt.ts +239 -0
- package/node_modules/zod/src/v4/locales/mk.ts +118 -0
- package/node_modules/zod/src/v4/locales/ms.ts +115 -0
- package/node_modules/zod/src/v4/locales/nl.ts +121 -0
- package/node_modules/zod/src/v4/locales/no.ts +116 -0
- package/node_modules/zod/src/v4/locales/ota.ts +117 -0
- package/node_modules/zod/src/v4/locales/pl.ts +118 -0
- package/node_modules/zod/src/v4/locales/ps.ts +126 -0
- package/node_modules/zod/src/v4/locales/pt.ts +116 -0
- package/node_modules/zod/src/v4/locales/ro.ts +129 -0
- package/node_modules/zod/src/v4/locales/ru.ts +176 -0
- package/node_modules/zod/src/v4/locales/sl.ts +118 -0
- package/node_modules/zod/src/v4/locales/sv.ts +119 -0
- package/node_modules/zod/src/v4/locales/ta.ts +118 -0
- package/node_modules/zod/src/v4/locales/th.ts +119 -0
- package/node_modules/zod/src/v4/locales/tr.ts +111 -0
- package/node_modules/zod/src/v4/locales/ua.ts +7 -0
- package/node_modules/zod/src/v4/locales/uk.ts +117 -0
- package/node_modules/zod/src/v4/locales/ur.ts +119 -0
- package/node_modules/zod/src/v4/locales/uz.ts +117 -0
- package/node_modules/zod/src/v4/locales/vi.ts +117 -0
- package/node_modules/zod/src/v4/locales/yo.ts +124 -0
- package/node_modules/zod/src/v4/locales/zh-CN.ts +116 -0
- package/node_modules/zod/src/v4/locales/zh-TW.ts +115 -0
- package/node_modules/zod/src/v4/mini/checks.ts +32 -0
- package/node_modules/zod/src/v4/mini/coerce.ts +27 -0
- package/node_modules/zod/src/v4/mini/external.ts +41 -0
- package/node_modules/zod/src/v4/mini/index.ts +3 -0
- package/node_modules/zod/src/v4/mini/iso.ts +66 -0
- package/node_modules/zod/src/v4/mini/parse.ts +14 -0
- package/node_modules/zod/src/v4/mini/schemas.ts +1947 -0
- package/node_modules/zod/src/v4/mini/tests/apply.test.ts +24 -0
- package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +129 -0
- package/node_modules/zod/src/v4/mini/tests/brand.test.ts +94 -0
- package/node_modules/zod/src/v4/mini/tests/checks.test.ts +144 -0
- package/node_modules/zod/src/v4/mini/tests/codec.test.ts +548 -0
- package/node_modules/zod/src/v4/mini/tests/computed.test.ts +36 -0
- package/node_modules/zod/src/v4/mini/tests/error.test.ts +22 -0
- package/node_modules/zod/src/v4/mini/tests/functions.test.ts +5 -0
- package/node_modules/zod/src/v4/mini/tests/index.test.ts +993 -0
- package/node_modules/zod/src/v4/mini/tests/number.test.ts +95 -0
- package/node_modules/zod/src/v4/mini/tests/object.test.ts +227 -0
- package/node_modules/zod/src/v4/mini/tests/prototypes.test.ts +43 -0
- package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +325 -0
- package/node_modules/zod/src/v4/mini/tests/standard-schema.test.ts +50 -0
- package/node_modules/zod/src/v4/mini/tests/string.test.ts +352 -0
- package/node_modules/zod/src/v4-mini/index.ts +3 -0
- package/node_modules/zod/v3/ZodError.cjs +138 -0
- package/node_modules/zod/v3/ZodError.d.cts +164 -0
- package/node_modules/zod/v3/ZodError.d.ts +164 -0
- package/node_modules/zod/v3/ZodError.js +133 -0
- package/node_modules/zod/v3/errors.cjs +17 -0
- package/node_modules/zod/v3/errors.d.cts +5 -0
- package/node_modules/zod/v3/errors.d.ts +5 -0
- package/node_modules/zod/v3/errors.js +9 -0
- package/node_modules/zod/v3/external.cjs +22 -0
- package/node_modules/zod/v3/external.d.cts +6 -0
- package/node_modules/zod/v3/external.d.ts +6 -0
- package/node_modules/zod/v3/external.js +6 -0
- package/node_modules/zod/v3/helpers/enumUtil.cjs +2 -0
- package/node_modules/zod/v3/helpers/enumUtil.d.cts +8 -0
- package/node_modules/zod/v3/helpers/enumUtil.d.ts +8 -0
- package/node_modules/zod/v3/helpers/enumUtil.js +1 -0
- package/node_modules/zod/v3/helpers/errorUtil.cjs +9 -0
- package/node_modules/zod/v3/helpers/errorUtil.d.cts +9 -0
- package/node_modules/zod/v3/helpers/errorUtil.d.ts +9 -0
- package/node_modules/zod/v3/helpers/errorUtil.js +6 -0
- package/node_modules/zod/v3/helpers/parseUtil.cjs +124 -0
- package/node_modules/zod/v3/helpers/parseUtil.d.cts +78 -0
- package/node_modules/zod/v3/helpers/parseUtil.d.ts +78 -0
- package/node_modules/zod/v3/helpers/parseUtil.js +109 -0
- package/node_modules/zod/v3/helpers/partialUtil.cjs +2 -0
- package/node_modules/zod/v3/helpers/partialUtil.d.cts +8 -0
- package/node_modules/zod/v3/helpers/partialUtil.d.ts +8 -0
- package/node_modules/zod/v3/helpers/partialUtil.js +1 -0
- package/node_modules/zod/v3/helpers/typeAliases.cjs +2 -0
- package/node_modules/zod/v3/helpers/typeAliases.d.cts +2 -0
- package/node_modules/zod/v3/helpers/typeAliases.d.ts +2 -0
- package/node_modules/zod/v3/helpers/typeAliases.js +1 -0
- package/node_modules/zod/v3/helpers/util.cjs +137 -0
- package/node_modules/zod/v3/helpers/util.d.cts +85 -0
- package/node_modules/zod/v3/helpers/util.d.ts +85 -0
- package/node_modules/zod/v3/helpers/util.js +133 -0
- package/node_modules/zod/v3/index.cjs +33 -0
- package/node_modules/zod/v3/index.d.cts +4 -0
- package/node_modules/zod/v3/index.d.ts +4 -0
- package/node_modules/zod/v3/index.js +4 -0
- package/node_modules/zod/v3/locales/en.cjs +112 -0
- package/node_modules/zod/v3/locales/en.d.cts +3 -0
- package/node_modules/zod/v3/locales/en.d.ts +3 -0
- package/node_modules/zod/v3/locales/en.js +109 -0
- package/node_modules/zod/v3/package.json +7 -0
- package/node_modules/zod/v3/standard-schema.cjs +2 -0
- package/node_modules/zod/v3/standard-schema.d.cts +102 -0
- package/node_modules/zod/v3/standard-schema.d.ts +102 -0
- package/node_modules/zod/v3/standard-schema.js +1 -0
- package/node_modules/zod/v3/types.cjs +3777 -0
- package/node_modules/zod/v3/types.d.cts +1034 -0
- package/node_modules/zod/v3/types.d.ts +1034 -0
- package/node_modules/zod/v3/types.js +3695 -0
- package/node_modules/zod/v4/classic/checks.cjs +33 -0
- package/node_modules/zod/v4/classic/checks.d.cts +1 -0
- package/node_modules/zod/v4/classic/checks.d.ts +1 -0
- package/node_modules/zod/v4/classic/checks.js +1 -0
- package/node_modules/zod/v4/classic/coerce.cjs +47 -0
- package/node_modules/zod/v4/classic/coerce.d.cts +17 -0
- package/node_modules/zod/v4/classic/coerce.d.ts +17 -0
- package/node_modules/zod/v4/classic/coerce.js +17 -0
- package/node_modules/zod/v4/classic/compat.cjs +61 -0
- package/node_modules/zod/v4/classic/compat.d.cts +50 -0
- package/node_modules/zod/v4/classic/compat.d.ts +50 -0
- package/node_modules/zod/v4/classic/compat.js +31 -0
- package/node_modules/zod/v4/classic/errors.cjs +74 -0
- package/node_modules/zod/v4/classic/errors.d.cts +30 -0
- package/node_modules/zod/v4/classic/errors.d.ts +30 -0
- package/node_modules/zod/v4/classic/errors.js +48 -0
- package/node_modules/zod/v4/classic/external.cjs +73 -0
- package/node_modules/zod/v4/classic/external.d.cts +16 -0
- package/node_modules/zod/v4/classic/external.d.ts +16 -0
- package/node_modules/zod/v4/classic/external.js +20 -0
- package/node_modules/zod/v4/classic/from-json-schema.cjs +625 -0
- package/node_modules/zod/v4/classic/from-json-schema.d.cts +12 -0
- package/node_modules/zod/v4/classic/from-json-schema.d.ts +12 -0
- package/node_modules/zod/v4/classic/from-json-schema.js +599 -0
- package/node_modules/zod/v4/classic/index.cjs +33 -0
- package/node_modules/zod/v4/classic/index.d.cts +4 -0
- package/node_modules/zod/v4/classic/index.d.ts +4 -0
- package/node_modules/zod/v4/classic/index.js +4 -0
- package/node_modules/zod/v4/classic/iso.cjs +60 -0
- package/node_modules/zod/v4/classic/iso.d.cts +22 -0
- package/node_modules/zod/v4/classic/iso.d.ts +22 -0
- package/node_modules/zod/v4/classic/iso.js +30 -0
- package/node_modules/zod/v4/classic/package.json +7 -0
- package/node_modules/zod/v4/classic/parse.cjs +41 -0
- package/node_modules/zod/v4/classic/parse.d.cts +31 -0
- package/node_modules/zod/v4/classic/parse.d.ts +31 -0
- package/node_modules/zod/v4/classic/parse.js +15 -0
- package/node_modules/zod/v4/classic/schemas.cjs +1511 -0
- package/node_modules/zod/v4/classic/schemas.d.cts +767 -0
- package/node_modules/zod/v4/classic/schemas.d.ts +767 -0
- package/node_modules/zod/v4/classic/schemas.js +1395 -0
- package/node_modules/zod/v4/core/api.cjs +1227 -0
- package/node_modules/zod/v4/core/api.d.cts +325 -0
- package/node_modules/zod/v4/core/api.d.ts +325 -0
- package/node_modules/zod/v4/core/api.js +1087 -0
- package/node_modules/zod/v4/core/checks.cjs +601 -0
- package/node_modules/zod/v4/core/checks.d.cts +278 -0
- package/node_modules/zod/v4/core/checks.d.ts +278 -0
- package/node_modules/zod/v4/core/checks.js +575 -0
- package/node_modules/zod/v4/core/core.cjs +85 -0
- package/node_modules/zod/v4/core/core.d.cts +70 -0
- package/node_modules/zod/v4/core/core.d.ts +70 -0
- package/node_modules/zod/v4/core/core.js +78 -0
- package/node_modules/zod/v4/core/doc.cjs +39 -0
- package/node_modules/zod/v4/core/doc.d.cts +14 -0
- package/node_modules/zod/v4/core/doc.d.ts +14 -0
- package/node_modules/zod/v4/core/doc.js +35 -0
- package/node_modules/zod/v4/core/errors.cjs +216 -0
- package/node_modules/zod/v4/core/errors.d.cts +221 -0
- package/node_modules/zod/v4/core/errors.d.ts +221 -0
- package/node_modules/zod/v4/core/errors.js +185 -0
- package/node_modules/zod/v4/core/index.cjs +47 -0
- package/node_modules/zod/v4/core/index.d.cts +16 -0
- package/node_modules/zod/v4/core/index.d.ts +16 -0
- package/node_modules/zod/v4/core/index.js +16 -0
- package/node_modules/zod/v4/core/json-schema-generator.cjs +99 -0
- package/node_modules/zod/v4/core/json-schema-generator.d.cts +65 -0
- package/node_modules/zod/v4/core/json-schema-generator.d.ts +65 -0
- package/node_modules/zod/v4/core/json-schema-generator.js +95 -0
- package/node_modules/zod/v4/core/json-schema-processors.cjs +644 -0
- package/node_modules/zod/v4/core/json-schema-processors.d.cts +49 -0
- package/node_modules/zod/v4/core/json-schema-processors.d.ts +49 -0
- package/node_modules/zod/v4/core/json-schema-processors.js +601 -0
- package/node_modules/zod/v4/core/json-schema.cjs +2 -0
- package/node_modules/zod/v4/core/json-schema.d.cts +88 -0
- package/node_modules/zod/v4/core/json-schema.d.ts +88 -0
- package/node_modules/zod/v4/core/json-schema.js +1 -0
- package/node_modules/zod/v4/core/package.json +7 -0
- package/node_modules/zod/v4/core/parse.cjs +131 -0
- package/node_modules/zod/v4/core/parse.d.cts +49 -0
- package/node_modules/zod/v4/core/parse.d.ts +49 -0
- package/node_modules/zod/v4/core/parse.js +93 -0
- package/node_modules/zod/v4/core/regexes.cjs +172 -0
- package/node_modules/zod/v4/core/regexes.d.cts +85 -0
- package/node_modules/zod/v4/core/regexes.d.ts +85 -0
- package/node_modules/zod/v4/core/regexes.js +139 -0
- package/node_modules/zod/v4/core/registries.cjs +56 -0
- package/node_modules/zod/v4/core/registries.d.cts +35 -0
- package/node_modules/zod/v4/core/registries.d.ts +35 -0
- package/node_modules/zod/v4/core/registries.js +51 -0
- package/node_modules/zod/v4/core/schemas.cjs +2270 -0
- package/node_modules/zod/v4/core/schemas.d.cts +1184 -0
- package/node_modules/zod/v4/core/schemas.d.ts +1184 -0
- package/node_modules/zod/v4/core/schemas.js +2239 -0
- package/node_modules/zod/v4/core/standard-schema.cjs +2 -0
- package/node_modules/zod/v4/core/standard-schema.d.cts +126 -0
- package/node_modules/zod/v4/core/standard-schema.d.ts +126 -0
- package/node_modules/zod/v4/core/standard-schema.js +1 -0
- package/node_modules/zod/v4/core/to-json-schema.cjs +457 -0
- package/node_modules/zod/v4/core/to-json-schema.d.cts +114 -0
- package/node_modules/zod/v4/core/to-json-schema.d.ts +114 -0
- package/node_modules/zod/v4/core/to-json-schema.js +448 -0
- package/node_modules/zod/v4/core/util.cjs +734 -0
- package/node_modules/zod/v4/core/util.d.cts +200 -0
- package/node_modules/zod/v4/core/util.d.ts +200 -0
- package/node_modules/zod/v4/core/util.js +674 -0
- package/node_modules/zod/v4/core/versions.cjs +8 -0
- package/node_modules/zod/v4/core/versions.d.cts +5 -0
- package/node_modules/zod/v4/core/versions.d.ts +5 -0
- package/node_modules/zod/v4/core/versions.js +5 -0
- package/node_modules/zod/v4/index.cjs +22 -0
- package/node_modules/zod/v4/index.d.cts +3 -0
- package/node_modules/zod/v4/index.d.ts +3 -0
- package/node_modules/zod/v4/index.js +3 -0
- package/node_modules/zod/v4/locales/ar.cjs +133 -0
- package/node_modules/zod/v4/locales/ar.d.cts +5 -0
- package/node_modules/zod/v4/locales/ar.d.ts +4 -0
- package/node_modules/zod/v4/locales/ar.js +106 -0
- package/node_modules/zod/v4/locales/az.cjs +132 -0
- package/node_modules/zod/v4/locales/az.d.cts +5 -0
- package/node_modules/zod/v4/locales/az.d.ts +4 -0
- package/node_modules/zod/v4/locales/az.js +105 -0
- package/node_modules/zod/v4/locales/be.cjs +183 -0
- package/node_modules/zod/v4/locales/be.d.cts +5 -0
- package/node_modules/zod/v4/locales/be.d.ts +4 -0
- package/node_modules/zod/v4/locales/be.js +156 -0
- package/node_modules/zod/v4/locales/bg.cjs +147 -0
- package/node_modules/zod/v4/locales/bg.d.cts +5 -0
- package/node_modules/zod/v4/locales/bg.d.ts +4 -0
- package/node_modules/zod/v4/locales/bg.js +120 -0
- package/node_modules/zod/v4/locales/ca.cjs +134 -0
- package/node_modules/zod/v4/locales/ca.d.cts +5 -0
- package/node_modules/zod/v4/locales/ca.d.ts +4 -0
- package/node_modules/zod/v4/locales/ca.js +107 -0
- package/node_modules/zod/v4/locales/cs.cjs +138 -0
- package/node_modules/zod/v4/locales/cs.d.cts +5 -0
- package/node_modules/zod/v4/locales/cs.d.ts +4 -0
- package/node_modules/zod/v4/locales/cs.js +111 -0
- package/node_modules/zod/v4/locales/da.cjs +142 -0
- package/node_modules/zod/v4/locales/da.d.cts +5 -0
- package/node_modules/zod/v4/locales/da.d.ts +4 -0
- package/node_modules/zod/v4/locales/da.js +115 -0
- package/node_modules/zod/v4/locales/de.cjs +135 -0
- package/node_modules/zod/v4/locales/de.d.cts +5 -0
- package/node_modules/zod/v4/locales/de.d.ts +4 -0
- package/node_modules/zod/v4/locales/de.js +108 -0
- package/node_modules/zod/v4/locales/el.cjs +136 -0
- package/node_modules/zod/v4/locales/el.d.cts +5 -0
- package/node_modules/zod/v4/locales/el.d.ts +4 -0
- package/node_modules/zod/v4/locales/el.js +109 -0
- package/node_modules/zod/v4/locales/en.cjs +140 -0
- package/node_modules/zod/v4/locales/en.d.cts +5 -0
- package/node_modules/zod/v4/locales/en.d.ts +4 -0
- package/node_modules/zod/v4/locales/en.js +113 -0
- package/node_modules/zod/v4/locales/eo.cjs +136 -0
- package/node_modules/zod/v4/locales/eo.d.cts +5 -0
- package/node_modules/zod/v4/locales/eo.d.ts +4 -0
- package/node_modules/zod/v4/locales/eo.js +109 -0
- package/node_modules/zod/v4/locales/es.cjs +159 -0
- package/node_modules/zod/v4/locales/es.d.cts +5 -0
- package/node_modules/zod/v4/locales/es.d.ts +4 -0
- package/node_modules/zod/v4/locales/es.js +132 -0
- package/node_modules/zod/v4/locales/fa.cjs +141 -0
- package/node_modules/zod/v4/locales/fa.d.cts +5 -0
- package/node_modules/zod/v4/locales/fa.d.ts +4 -0
- package/node_modules/zod/v4/locales/fa.js +114 -0
- package/node_modules/zod/v4/locales/fi.cjs +139 -0
- package/node_modules/zod/v4/locales/fi.d.cts +5 -0
- package/node_modules/zod/v4/locales/fi.d.ts +4 -0
- package/node_modules/zod/v4/locales/fi.js +112 -0
- package/node_modules/zod/v4/locales/fr-CA.cjs +134 -0
- package/node_modules/zod/v4/locales/fr-CA.d.cts +5 -0
- package/node_modules/zod/v4/locales/fr-CA.d.ts +4 -0
- package/node_modules/zod/v4/locales/fr-CA.js +107 -0
- package/node_modules/zod/v4/locales/fr.cjs +152 -0
- package/node_modules/zod/v4/locales/fr.d.cts +5 -0
- package/node_modules/zod/v4/locales/fr.d.ts +4 -0
- package/node_modules/zod/v4/locales/fr.js +125 -0
- package/node_modules/zod/v4/locales/he.cjs +241 -0
- package/node_modules/zod/v4/locales/he.d.cts +5 -0
- package/node_modules/zod/v4/locales/he.d.ts +4 -0
- package/node_modules/zod/v4/locales/he.js +214 -0
- package/node_modules/zod/v4/locales/hr.cjs +149 -0
- package/node_modules/zod/v4/locales/hr.d.cts +5 -0
- package/node_modules/zod/v4/locales/hr.d.ts +4 -0
- package/node_modules/zod/v4/locales/hr.js +122 -0
- package/node_modules/zod/v4/locales/hu.cjs +135 -0
- package/node_modules/zod/v4/locales/hu.d.cts +5 -0
- package/node_modules/zod/v4/locales/hu.d.ts +4 -0
- package/node_modules/zod/v4/locales/hu.js +108 -0
- package/node_modules/zod/v4/locales/hy.cjs +174 -0
- package/node_modules/zod/v4/locales/hy.d.cts +5 -0
- package/node_modules/zod/v4/locales/hy.d.ts +4 -0
- package/node_modules/zod/v4/locales/hy.js +147 -0
- package/node_modules/zod/v4/locales/id.cjs +133 -0
- package/node_modules/zod/v4/locales/id.d.cts +5 -0
- package/node_modules/zod/v4/locales/id.d.ts +4 -0
- package/node_modules/zod/v4/locales/id.js +106 -0
- package/node_modules/zod/v4/locales/index.cjs +111 -0
- package/node_modules/zod/v4/locales/index.d.cts +52 -0
- package/node_modules/zod/v4/locales/index.d.ts +52 -0
- package/node_modules/zod/v4/locales/index.js +52 -0
- package/node_modules/zod/v4/locales/is.cjs +136 -0
- package/node_modules/zod/v4/locales/is.d.cts +5 -0
- package/node_modules/zod/v4/locales/is.d.ts +4 -0
- package/node_modules/zod/v4/locales/is.js +109 -0
- package/node_modules/zod/v4/locales/it.cjs +135 -0
- package/node_modules/zod/v4/locales/it.d.cts +5 -0
- package/node_modules/zod/v4/locales/it.d.ts +4 -0
- package/node_modules/zod/v4/locales/it.js +108 -0
- package/node_modules/zod/v4/locales/ja.cjs +134 -0
- package/node_modules/zod/v4/locales/ja.d.cts +5 -0
- package/node_modules/zod/v4/locales/ja.d.ts +4 -0
- package/node_modules/zod/v4/locales/ja.js +107 -0
- package/node_modules/zod/v4/locales/ka.cjs +139 -0
- package/node_modules/zod/v4/locales/ka.d.cts +5 -0
- package/node_modules/zod/v4/locales/ka.d.ts +4 -0
- package/node_modules/zod/v4/locales/ka.js +112 -0
- package/node_modules/zod/v4/locales/kh.cjs +12 -0
- package/node_modules/zod/v4/locales/kh.d.cts +5 -0
- package/node_modules/zod/v4/locales/kh.d.ts +5 -0
- package/node_modules/zod/v4/locales/kh.js +5 -0
- package/node_modules/zod/v4/locales/km.cjs +137 -0
- package/node_modules/zod/v4/locales/km.d.cts +5 -0
- package/node_modules/zod/v4/locales/km.d.ts +4 -0
- package/node_modules/zod/v4/locales/km.js +110 -0
- package/node_modules/zod/v4/locales/ko.cjs +138 -0
- package/node_modules/zod/v4/locales/ko.d.cts +5 -0
- package/node_modules/zod/v4/locales/ko.d.ts +4 -0
- package/node_modules/zod/v4/locales/ko.js +111 -0
- package/node_modules/zod/v4/locales/lt.cjs +230 -0
- package/node_modules/zod/v4/locales/lt.d.cts +5 -0
- package/node_modules/zod/v4/locales/lt.d.ts +4 -0
- package/node_modules/zod/v4/locales/lt.js +203 -0
- package/node_modules/zod/v4/locales/mk.cjs +136 -0
- package/node_modules/zod/v4/locales/mk.d.cts +5 -0
- package/node_modules/zod/v4/locales/mk.d.ts +4 -0
- package/node_modules/zod/v4/locales/mk.js +109 -0
- package/node_modules/zod/v4/locales/ms.cjs +134 -0
- package/node_modules/zod/v4/locales/ms.d.cts +5 -0
- package/node_modules/zod/v4/locales/ms.d.ts +4 -0
- package/node_modules/zod/v4/locales/ms.js +107 -0
- package/node_modules/zod/v4/locales/nl.cjs +137 -0
- package/node_modules/zod/v4/locales/nl.d.cts +5 -0
- package/node_modules/zod/v4/locales/nl.d.ts +4 -0
- package/node_modules/zod/v4/locales/nl.js +110 -0
- package/node_modules/zod/v4/locales/no.cjs +135 -0
- package/node_modules/zod/v4/locales/no.d.cts +5 -0
- package/node_modules/zod/v4/locales/no.d.ts +4 -0
- package/node_modules/zod/v4/locales/no.js +108 -0
- package/node_modules/zod/v4/locales/ota.cjs +136 -0
- package/node_modules/zod/v4/locales/ota.d.cts +5 -0
- package/node_modules/zod/v4/locales/ota.d.ts +4 -0
- package/node_modules/zod/v4/locales/ota.js +109 -0
- package/node_modules/zod/v4/locales/package.json +7 -0
- package/node_modules/zod/v4/locales/pl.cjs +136 -0
- package/node_modules/zod/v4/locales/pl.d.cts +5 -0
- package/node_modules/zod/v4/locales/pl.d.ts +4 -0
- package/node_modules/zod/v4/locales/pl.js +109 -0
- package/node_modules/zod/v4/locales/ps.cjs +141 -0
- package/node_modules/zod/v4/locales/ps.d.cts +5 -0
- package/node_modules/zod/v4/locales/ps.d.ts +4 -0
- package/node_modules/zod/v4/locales/ps.js +114 -0
- package/node_modules/zod/v4/locales/pt.cjs +135 -0
- package/node_modules/zod/v4/locales/pt.d.cts +5 -0
- package/node_modules/zod/v4/locales/pt.d.ts +4 -0
- package/node_modules/zod/v4/locales/pt.js +108 -0
- package/node_modules/zod/v4/locales/ro.cjs +146 -0
- package/node_modules/zod/v4/locales/ro.d.cts +5 -0
- package/node_modules/zod/v4/locales/ro.d.ts +4 -0
- package/node_modules/zod/v4/locales/ro.js +119 -0
- package/node_modules/zod/v4/locales/ru.cjs +183 -0
- package/node_modules/zod/v4/locales/ru.d.cts +5 -0
- package/node_modules/zod/v4/locales/ru.d.ts +4 -0
- package/node_modules/zod/v4/locales/ru.js +156 -0
- package/node_modules/zod/v4/locales/sl.cjs +136 -0
- package/node_modules/zod/v4/locales/sl.d.cts +5 -0
- package/node_modules/zod/v4/locales/sl.d.ts +4 -0
- package/node_modules/zod/v4/locales/sl.js +109 -0
- package/node_modules/zod/v4/locales/sv.cjs +137 -0
- package/node_modules/zod/v4/locales/sv.d.cts +5 -0
- package/node_modules/zod/v4/locales/sv.d.ts +4 -0
- package/node_modules/zod/v4/locales/sv.js +110 -0
- package/node_modules/zod/v4/locales/ta.cjs +137 -0
- package/node_modules/zod/v4/locales/ta.d.cts +5 -0
- package/node_modules/zod/v4/locales/ta.d.ts +4 -0
- package/node_modules/zod/v4/locales/ta.js +110 -0
- package/node_modules/zod/v4/locales/th.cjs +137 -0
- package/node_modules/zod/v4/locales/th.d.cts +5 -0
- package/node_modules/zod/v4/locales/th.d.ts +4 -0
- package/node_modules/zod/v4/locales/th.js +110 -0
- package/node_modules/zod/v4/locales/tr.cjs +132 -0
- package/node_modules/zod/v4/locales/tr.d.cts +5 -0
- package/node_modules/zod/v4/locales/tr.d.ts +4 -0
- package/node_modules/zod/v4/locales/tr.js +105 -0
- package/node_modules/zod/v4/locales/ua.cjs +12 -0
- package/node_modules/zod/v4/locales/ua.d.cts +5 -0
- package/node_modules/zod/v4/locales/ua.d.ts +5 -0
- package/node_modules/zod/v4/locales/ua.js +5 -0
- package/node_modules/zod/v4/locales/uk.cjs +135 -0
- package/node_modules/zod/v4/locales/uk.d.cts +5 -0
- package/node_modules/zod/v4/locales/uk.d.ts +4 -0
- package/node_modules/zod/v4/locales/uk.js +108 -0
- package/node_modules/zod/v4/locales/ur.cjs +137 -0
- package/node_modules/zod/v4/locales/ur.d.cts +5 -0
- package/node_modules/zod/v4/locales/ur.d.ts +4 -0
- package/node_modules/zod/v4/locales/ur.js +110 -0
- package/node_modules/zod/v4/locales/uz.cjs +137 -0
- package/node_modules/zod/v4/locales/uz.d.cts +5 -0
- package/node_modules/zod/v4/locales/uz.d.ts +4 -0
- package/node_modules/zod/v4/locales/uz.js +110 -0
- package/node_modules/zod/v4/locales/vi.cjs +135 -0
- package/node_modules/zod/v4/locales/vi.d.cts +5 -0
- package/node_modules/zod/v4/locales/vi.d.ts +4 -0
- package/node_modules/zod/v4/locales/vi.js +108 -0
- package/node_modules/zod/v4/locales/yo.cjs +134 -0
- package/node_modules/zod/v4/locales/yo.d.cts +5 -0
- package/node_modules/zod/v4/locales/yo.d.ts +4 -0
- package/node_modules/zod/v4/locales/yo.js +107 -0
- package/node_modules/zod/v4/locales/zh-CN.cjs +136 -0
- package/node_modules/zod/v4/locales/zh-CN.d.cts +5 -0
- package/node_modules/zod/v4/locales/zh-CN.d.ts +4 -0
- package/node_modules/zod/v4/locales/zh-CN.js +109 -0
- package/node_modules/zod/v4/locales/zh-TW.cjs +134 -0
- package/node_modules/zod/v4/locales/zh-TW.d.cts +5 -0
- package/node_modules/zod/v4/locales/zh-TW.d.ts +4 -0
- package/node_modules/zod/v4/locales/zh-TW.js +107 -0
- package/node_modules/zod/v4/mini/checks.cjs +34 -0
- package/node_modules/zod/v4/mini/checks.d.cts +1 -0
- package/node_modules/zod/v4/mini/checks.d.ts +1 -0
- package/node_modules/zod/v4/mini/checks.js +1 -0
- package/node_modules/zod/v4/mini/coerce.cjs +52 -0
- package/node_modules/zod/v4/mini/coerce.d.cts +7 -0
- package/node_modules/zod/v4/mini/coerce.d.ts +7 -0
- package/node_modules/zod/v4/mini/coerce.js +22 -0
- package/node_modules/zod/v4/mini/external.cjs +63 -0
- package/node_modules/zod/v4/mini/external.d.cts +13 -0
- package/node_modules/zod/v4/mini/external.d.ts +13 -0
- package/node_modules/zod/v4/mini/external.js +14 -0
- package/node_modules/zod/v4/mini/index.cjs +32 -0
- package/node_modules/zod/v4/mini/index.d.cts +3 -0
- package/node_modules/zod/v4/mini/index.d.ts +3 -0
- package/node_modules/zod/v4/mini/index.js +3 -0
- package/node_modules/zod/v4/mini/iso.cjs +64 -0
- package/node_modules/zod/v4/mini/iso.d.cts +22 -0
- package/node_modules/zod/v4/mini/iso.d.ts +22 -0
- package/node_modules/zod/v4/mini/iso.js +34 -0
- package/node_modules/zod/v4/mini/package.json +7 -0
- package/node_modules/zod/v4/mini/parse.cjs +16 -0
- package/node_modules/zod/v4/mini/parse.d.cts +1 -0
- package/node_modules/zod/v4/mini/parse.d.ts +1 -0
- package/node_modules/zod/v4/mini/parse.js +1 -0
- package/node_modules/zod/v4/mini/schemas.cjs +1083 -0
- package/node_modules/zod/v4/mini/schemas.d.cts +445 -0
- package/node_modules/zod/v4/mini/schemas.d.ts +445 -0
- package/node_modules/zod/v4/mini/schemas.js +961 -0
- package/node_modules/zod/v4/package.json +7 -0
- package/node_modules/zod/v4-mini/index.cjs +32 -0
- package/node_modules/zod/v4-mini/index.d.cts +3 -0
- package/node_modules/zod/v4-mini/index.d.ts +3 -0
- package/node_modules/zod/v4-mini/index.js +3 -0
- package/node_modules/zod/v4-mini/package.json +7 -0
- package/package.json +49 -4
- package/scripts/hooks/canon.mjs +45 -0
- package/scripts/hooks/consent.mjs +728 -0
- package/scripts/hooks/rarog-context.mjs +163 -0
- package/scripts/hooks/rarog-pending.mjs +1498 -0
- package/scripts/hooks/rarog-statusline.mjs +258 -0
- package/scripts/hooks/tall-dialog.mjs +400 -0
- package/scripts/hooks/work-area.mjs +138 -0
- package/scripts/restart.sh +393 -0
- package/server/src/auth/admin.js +272 -0
- package/server/src/auth/consent-socket.js +89 -0
- package/server/src/auth/device.js +81 -0
- package/server/src/auth/devices-store.js +544 -0
- package/server/src/auth/index.js +26 -0
- package/server/src/auth/limiter.js +95 -0
- package/server/src/auth/origin.js +13 -0
- package/server/src/auth/pairing.js +201 -0
- package/server/src/auth/principal.js +28 -0
- package/server/src/auth/redact.js +78 -0
- package/server/src/auth/unix-socket.js +156 -0
- package/server/src/bootstrap/alive-sessions.js +22 -0
- package/server/src/bootstrap/consent.js +367 -0
- package/server/src/bootstrap/devices.js +43 -0
- package/server/src/bootstrap/health.js +45 -0
- package/server/src/bootstrap/herdr.js +25 -0
- package/server/src/bootstrap/hook-files.js +97 -0
- package/server/src/bootstrap/http.js +69 -0
- package/server/src/bootstrap/inbox.js +29 -0
- package/server/src/bootstrap/iroh.js +26 -0
- package/server/src/bootstrap/manager.js +51 -0
- package/server/src/bootstrap/pr-status.js +35 -0
- package/server/src/bootstrap/push.js +88 -0
- package/server/src/bootstrap/sse.js +31 -0
- package/server/src/bootstrap/term.js +54 -0
- package/server/src/bootstrap/versions.js +45 -0
- package/server/src/cli/child-output.js +214 -0
- package/server/src/cli/claude-settings.js +905 -0
- package/server/src/cli/config-rewrite.js +147 -0
- package/server/src/cli/devices.js +417 -0
- package/server/src/cli/dialogs.js +212 -0
- package/server/src/cli/dictation.js +87 -0
- package/server/src/cli/doctor-pr-status.js +77 -0
- package/server/src/cli/doctor-write-block.js +65 -0
- package/server/src/cli/doctor.js +1528 -0
- package/server/src/cli/hooks.js +734 -0
- package/server/src/cli/io.js +61 -0
- package/server/src/cli/launchd-loaded.js +82 -0
- package/server/src/cli/lock.js +170 -0
- package/server/src/cli/main.js +129 -0
- package/server/src/cli/restart.js +842 -0
- package/server/src/cli/screen/ask.js +55 -0
- package/server/src/cli/screen/log.js +136 -0
- package/server/src/cli/screen/prose.js +74 -0
- package/server/src/cli/screen/steps.js +528 -0
- package/server/src/cli/screen/style.js +161 -0
- package/server/src/cli/secret-input.js +212 -0
- package/server/src/cli/secrets-file.js +288 -0
- package/server/src/cli/serve.js +687 -0
- package/server/src/cli/service.js +1375 -0
- package/server/src/cli/setup-check.js +287 -0
- package/server/src/cli/setup-config.js +192 -0
- package/server/src/cli/setup-context.js +174 -0
- package/server/src/cli/setup-herdr-agent.js +503 -0
- package/server/src/cli/setup-herdr-unit.js +437 -0
- package/server/src/cli/setup-plan.js +85 -0
- package/server/src/cli/setup-screen.js +372 -0
- package/server/src/cli/setup-secrets.js +179 -0
- package/server/src/cli/setup-settings.js +305 -0
- package/server/src/cli/setup-tailscale-add.js +235 -0
- package/server/src/cli/setup-tailscale-only.js +81 -0
- package/server/src/cli/setup-tailscale-port.js +276 -0
- package/server/src/cli/setup-transport.js +417 -0
- package/server/src/cli/setup-voice.js +174 -0
- package/server/src/cli/setup.js +1191 -0
- package/server/src/cli/systemd-unit.js +370 -0
- package/server/src/cli/templates/herdr-agent.plist +34 -0
- package/server/src/cli/templates/launchd.plist +35 -0
- package/server/src/cli/templates/rarog.service +25 -0
- package/server/src/cli/update-lock.js +148 -0
- package/server/src/cli/update-provenance.js +303 -0
- package/server/src/cli/update-registry.js +530 -0
- package/server/src/cli/update.js +441 -0
- package/server/src/cli/voice-agent.js +235 -0
- package/server/src/cli/voice-keys.js +71 -0
- package/server/src/cli-store.js +38 -0
- package/server/src/cli-version.js +442 -0
- package/server/src/client-log.js +121 -0
- package/server/src/companion/ask.js +165 -0
- package/server/src/companion/asks-owner.js +205 -0
- package/server/src/companion/catalog.js +22 -0
- package/server/src/companion/cli-literals.js +84 -0
- package/server/src/companion/cli.js +235 -0
- package/server/src/companion/condense.js +274 -0
- package/server/src/companion/conversation.js +21 -0
- package/server/src/companion/index.js +46 -0
- package/server/src/companion/mask.js +37 -0
- package/server/src/companion/openai-token.js +129 -0
- package/server/src/companion/prompt.js +102 -0
- package/server/src/companion/turns-settle.js +30 -0
- package/server/src/companion/turns.js +101 -0
- package/server/src/config/claude-account.js +101 -0
- package/server/src/config/clients.js +45 -0
- package/server/src/config/demo.js +97 -0
- package/server/src/config/flags.js +143 -0
- package/server/src/config/herdr.js +129 -0
- package/server/src/config/listen.js +122 -0
- package/server/src/config/protected-dirs.js +79 -0
- package/server/src/config/push.js +72 -0
- package/server/src/config/roots.js +259 -0
- package/server/src/config/terminal.js +86 -0
- package/server/src/config/voice.js +21 -0
- package/server/src/config/work-area.js +168 -0
- package/server/src/config-env.js +506 -0
- package/server/src/config.js +745 -0
- package/server/src/demo/content/en.js +673 -0
- package/server/src/demo/content/index.js +16 -0
- package/server/src/demo/content/named-set.js +59 -0
- package/server/src/demo/content/pl.js +691 -0
- package/server/src/demo/content/types.js +1 -0
- package/server/src/demo/control.js +574 -0
- package/server/src/demo/mac.js +20 -0
- package/server/src/demo/mock-herdr.js +251 -0
- package/server/src/demo/notes.js +60 -0
- package/server/src/demo/review-routes.js +96 -0
- package/server/src/demo/scenarios.js +338 -0
- package/server/src/demo/seeds.js +480 -0
- package/server/src/demo/usage.js +29 -0
- package/server/src/demo/voice.js +24 -0
- package/server/src/device-effects.js +37 -0
- package/server/src/drivers/herdr/audit-fields.js +27 -0
- package/server/src/drivers/herdr/cli-reserve.js +238 -0
- package/server/src/drivers/herdr/command-dialog-settle.js +90 -0
- package/server/src/drivers/herdr/commands.js +751 -0
- package/server/src/drivers/herdr/consent-channel.js +231 -0
- package/server/src/drivers/herdr/consent-registry-read.js +45 -0
- package/server/src/drivers/herdr/form-reserve.js +203 -0
- package/server/src/drivers/herdr/layer2-card.js +302 -0
- package/server/src/drivers/herdr/layer2-step.js +199 -0
- package/server/src/drivers/herdr/prompt-gates.js +118 -0
- package/server/src/drivers/herdr/prompt-paste.js +106 -0
- package/server/src/drivers/herdr/prompt-queue-store.js +284 -0
- package/server/src/drivers/herdr/prompt-queue.js +921 -0
- package/server/src/drivers/herdr/pull-request-poll.js +61 -0
- package/server/src/drivers/herdr/queue-take-back.js +429 -0
- package/server/src/drivers/herdr/scheduled-task-poll.js +120 -0
- package/server/src/drivers/herdr/stale-block.js +33 -0
- package/server/src/drivers/herdr/take-back-field.js +311 -0
- package/server/src/drivers/herdr/transcript.js +186 -0
- package/server/src/drivers/herdr/turn-guard.js +328 -0
- package/server/src/drivers/herdr-driver.js +4503 -0
- package/server/src/drivers/mock-driver.js +541 -0
- package/server/src/drivers/runtime.js +76 -0
- package/server/src/drivers/tool-summary.js +95 -0
- package/server/src/drivers/tool-text.js +206 -0
- package/server/src/drivers/types.js +15 -0
- package/server/src/fs-browse.js +268 -0
- package/server/src/fs-mkdir-child.js +86 -0
- package/server/src/fs-mkdir.js +161 -0
- package/server/src/git-config-guard.js +72 -0
- package/server/src/git-diff.js +356 -0
- package/server/src/git-sandbox.js +100 -0
- package/server/src/git-stats.js +61 -0
- package/server/src/git-status.js +1072 -0
- package/server/src/git-watch.js +299 -0
- package/server/src/git-work-tree.js +33 -0
- package/server/src/health.js +167 -0
- package/server/src/herdr/answer-recheck.js +85 -0
- package/server/src/herdr/argv.js +234 -0
- package/server/src/herdr/audit.js +520 -0
- package/server/src/herdr/background/agent-file.js +411 -0
- package/server/src/herdr/background/artifacts.js +173 -0
- package/server/src/herdr/background/cli-shapes.js +442 -0
- package/server/src/herdr/background/ids.js +29 -0
- package/server/src/herdr/background/incremental-read.js +70 -0
- package/server/src/herdr/background/index.js +93 -0
- package/server/src/herdr/background/jsonl-lines.js +68 -0
- package/server/src/herdr/background/main-scan.js +229 -0
- package/server/src/herdr/background/merge.js +336 -0
- package/server/src/herdr/background/notice.js +110 -0
- package/server/src/herdr/background/notification.js +267 -0
- package/server/src/herdr/background/pull-request-files.js +257 -0
- package/server/src/herdr/background/pull-requests.js +684 -0
- package/server/src/herdr/background/queued-prompt.js +52 -0
- package/server/src/herdr/background/reducer.js +682 -0
- package/server/src/herdr/background/satellite.js +73 -0
- package/server/src/herdr/background/scheduled-task-file.js +118 -0
- package/server/src/herdr/background/scheduled-tasks.js +251 -0
- package/server/src/herdr/background/work.js +134 -0
- package/server/src/herdr/background/workflow-run.js +417 -0
- package/server/src/herdr/client.js +894 -0
- package/server/src/herdr/commands/catalog.js +179 -0
- package/server/src/herdr/commands/discover.js +605 -0
- package/server/src/herdr/commands/guard.js +192 -0
- package/server/src/herdr/commands/index.js +35 -0
- package/server/src/herdr/commands/registry.js +496 -0
- package/server/src/herdr/commands/shape.js +240 -0
- package/server/src/herdr/commands/transcript.js +261 -0
- package/server/src/herdr/consent-evidence.js +592 -0
- package/server/src/herdr/consent-step.js +44 -0
- package/server/src/herdr/consent-subagent.js +423 -0
- package/server/src/herdr/dialogs/cards/build.js +445 -0
- package/server/src/herdr/dialogs/cards/ids.js +101 -0
- package/server/src/herdr/dialogs/cards/roles.js +22 -0
- package/server/src/herdr/dialogs/consent-gate.js +62 -0
- package/server/src/herdr/dialogs/copy.js +97 -0
- package/server/src/herdr/dialogs/cross-check.js +500 -0
- package/server/src/herdr/dialogs/decide/decide.js +825 -0
- package/server/src/herdr/dialogs/decide/input.js +1 -0
- package/server/src/herdr/dialogs/decide/reasons.js +60 -0
- package/server/src/herdr/dialogs/decide/sources.js +322 -0
- package/server/src/herdr/dialogs/hook/answers.js +190 -0
- package/server/src/herdr/dialogs/hook/canon.js +28 -0
- package/server/src/herdr/dialogs/hook/contract.js +225 -0
- package/server/src/herdr/dialogs/hook/dump.js +350 -0
- package/server/src/herdr/dialogs/hook/suggestions.js +75 -0
- package/server/src/herdr/dialogs/hook/target.js +99 -0
- package/server/src/herdr/dialogs/index.js +203 -0
- package/server/src/herdr/dialogs/layer1/always.js +71 -0
- package/server/src/herdr/dialogs/layer1/bind.js +193 -0
- package/server/src/herdr/dialogs/layer1/card.js +190 -0
- package/server/src/herdr/dialogs/layer1/cards.js +37 -0
- package/server/src/herdr/dialogs/layer1/contract.js +399 -0
- package/server/src/herdr/dialogs/layer1/cycle.js +1746 -0
- package/server/src/herdr/dialogs/layer1/desk-reason.js +119 -0
- package/server/src/herdr/dialogs/layer1/desk.js +190 -0
- package/server/src/herdr/dialogs/layer1/frames.js +118 -0
- package/server/src/herdr/dialogs/layer1/hook-list/hook-list.js +976 -0
- package/server/src/herdr/dialogs/layer1/mode.js +93 -0
- package/server/src/herdr/dialogs/layer1/observe.js +419 -0
- package/server/src/herdr/dialogs/layer1/proof.js +454 -0
- package/server/src/herdr/dialogs/layer1/receipt.js +71 -0
- package/server/src/herdr/dialogs/layer1/records.js +236 -0
- package/server/src/herdr/dialogs/layer1/registry.js +274 -0
- package/server/src/herdr/dialogs/layer1/resume.js +178 -0
- package/server/src/herdr/dialogs/layer1/sign.js +182 -0
- package/server/src/herdr/dialogs/layer1/top.js +264 -0
- package/server/src/herdr/dialogs/layer1/turns.js +251 -0
- package/server/src/herdr/dialogs/layer1/version-gate.js +154 -0
- package/server/src/herdr/dialogs/layer2/card.js +109 -0
- package/server/src/herdr/dialogs/layer2/match.js +98 -0
- package/server/src/herdr/dialogs/layer2/read-block.js +153 -0
- package/server/src/herdr/dialogs/layer2/shapes.js +61 -0
- package/server/src/herdr/dialogs/layer2/stability.js +104 -0
- package/server/src/herdr/dialogs/layer2/verdict.js +282 -0
- package/server/src/herdr/dialogs/policy/consent.js +29 -0
- package/server/src/herdr/dialogs/policy/escalation.js +115 -0
- package/server/src/herdr/dialogs/policy/exit-tasks.js +34 -0
- package/server/src/herdr/dialogs/policy/measured-consent.js +123 -0
- package/server/src/herdr/dialogs/policy/option-policy.js +22 -0
- package/server/src/herdr/dialogs/policy/options.js +79 -0
- package/server/src/herdr/dialogs/policy/pause.js +18 -0
- package/server/src/herdr/dialogs/policy/terminal.js +93 -0
- package/server/src/herdr/dialogs/presence.js +49 -0
- package/server/src/herdr/dialogs/refusals.js +271 -0
- package/server/src/herdr/dialogs/router.js +137 -0
- package/server/src/herdr/dialogs/screen/auto-deny.js +31 -0
- package/server/src/herdr/dialogs/screen/bash-zone.js +161 -0
- package/server/src/herdr/dialogs/screen/block-visible.js +60 -0
- package/server/src/herdr/dialogs/screen/block.js +286 -0
- package/server/src/herdr/dialogs/screen/confirm.js +83 -0
- package/server/src/herdr/dialogs/screen/dialog-bottom.js +54 -0
- package/server/src/herdr/dialogs/screen/edit-frame.js +391 -0
- package/server/src/herdr/dialogs/screen/edit-zone.js +33 -0
- package/server/src/herdr/dialogs/screen/excerpt.js +48 -0
- package/server/src/herdr/dialogs/screen/file-dialog.js +38 -0
- package/server/src/herdr/dialogs/screen/form.js +199 -0
- package/server/src/herdr/dialogs/screen/identity.js +23 -0
- package/server/src/herdr/dialogs/screen/kinds.js +39 -0
- package/server/src/herdr/dialogs/screen/known.js +101 -0
- package/server/src/herdr/dialogs/screen/mode-footer.js +90 -0
- package/server/src/herdr/dialogs/screen/operation.js +196 -0
- package/server/src/herdr/dialogs/screen/option-run.js +62 -0
- package/server/src/herdr/dialogs/screen/options.js +534 -0
- package/server/src/herdr/dialogs/screen/parse.js +359 -0
- package/server/src/herdr/dialogs/screen/plan-file.js +53 -0
- package/server/src/herdr/dialogs/screen/queue.js +59 -0
- package/server/src/herdr/dialogs/screen/region.js +92 -0
- package/server/src/herdr/dialogs/screen/resolve.js +305 -0
- package/server/src/herdr/dialogs/screen/review.js +118 -0
- package/server/src/herdr/dialogs/screen/signatures.js +1030 -0
- package/server/src/herdr/dialogs/screen/snippet.js +49 -0
- package/server/src/herdr/dialogs/screen/text.js +50 -0
- package/server/src/herdr/dialogs/screen/trust-arrow.js +122 -0
- package/server/src/herdr/dialogs/screen/write-zone.js +41 -0
- package/server/src/herdr/dialogs/screen-unavailable.js +52 -0
- package/server/src/herdr/dialogs/send/form-submit.js +72 -0
- package/server/src/herdr/dialogs/send/key-row.js +29 -0
- package/server/src/herdr/dialogs/send/keys.js +75 -0
- package/server/src/herdr/dialogs/send/prompt-submit.js +35 -0
- package/server/src/herdr/dialogs/send/take-back-keys.js +33 -0
- package/server/src/herdr/dialogs/send/trust-step.js +52 -0
- package/server/src/herdr/dialogs/shadow/alive-log.js +100 -0
- package/server/src/herdr/dialogs/shadow/alive.js +211 -0
- package/server/src/herdr/dialogs/shadow/atomic.js +55 -0
- package/server/src/herdr/dialogs/shadow/channel.js +321 -0
- package/server/src/herdr/dialogs/shadow/evidence.js +322 -0
- package/server/src/herdr/dialogs/shadow/files.js +375 -0
- package/server/src/herdr/dialogs/shadow/liveness.js +145 -0
- package/server/src/herdr/dialogs/shadow/sweep.js +220 -0
- package/server/src/herdr/dialogs/timing.js +88 -0
- package/server/src/herdr/history-steps.js +190 -0
- package/server/src/herdr/hook-commands.js +355 -0
- package/server/src/herdr/hook-config.js +1468 -0
- package/server/src/herdr/identity.js +277 -0
- package/server/src/herdr/index.js +27 -0
- package/server/src/herdr/input-segments.js +135 -0
- package/server/src/herdr/jsonl-activity.js +122 -0
- package/server/src/herdr/jsonl-follow.js +2358 -0
- package/server/src/herdr/jsonl-pending.js +527 -0
- package/server/src/herdr/jsonl-queue.js +133 -0
- package/server/src/herdr/jsonl-usage.js +174 -0
- package/server/src/herdr/launcher.js +574 -0
- package/server/src/herdr/line-diff.js +104 -0
- package/server/src/herdr/mode-cycle.js +78 -0
- package/server/src/herdr/project-workspace.js +131 -0
- package/server/src/herdr/provenance.js +204 -0
- package/server/src/herdr/session-pulse.js +536 -0
- package/server/src/herdr/socket.js +1003 -0
- package/server/src/herdr/statusline.js +348 -0
- package/server/src/herdr/supervisor.js +1934 -0
- package/server/src/herdr/transcript-path.js +123 -0
- package/server/src/herdr/trust.js +201 -0
- package/server/src/herdr/types.js +163 -0
- package/server/src/herdr/ultracode.js +132 -0
- package/server/src/herdr/uploads-registry.js +173 -0
- package/server/src/herdr/uploads.js +642 -0
- package/server/src/herdr/workspace-resolver.js +219 -0
- package/server/src/hidden-chars.js +52 -0
- package/server/src/inbox/card.js +121 -0
- package/server/src/inbox/dialogs.js +122 -0
- package/server/src/inbox/inbox.js +418 -0
- package/server/src/inbox/index.js +19 -0
- package/server/src/inbox/removals.js +181 -0
- package/server/src/inbox/segments.js +37 -0
- package/server/src/index.js +796 -0
- package/server/src/install/data-dir.js +103 -0
- package/server/src/install/evidence.js +66 -0
- package/server/src/install/mode.js +37 -0
- package/server/src/install/repair.js +215 -0
- package/server/src/install/sdk-lock.json +153 -0
- package/server/src/install/sdk-package.json +7 -0
- package/server/src/install/sdk-probe.js +18 -0
- package/server/src/install/sdk.js +624 -0
- package/server/src/install/service-target.js +106 -0
- package/server/src/iroh/adapter.js +294 -0
- package/server/src/iroh/duplex.js +169 -0
- package/server/src/iroh/endpoint.js +17 -0
- package/server/src/iroh/listener.js +422 -0
- package/server/src/iroh/log-budget.js +70 -0
- package/server/src/iroh/module-probe.js +17 -0
- package/server/src/iroh/path-log.js +96 -0
- package/server/src/iroh/socket.js +89 -0
- package/server/src/live-sessions.js +162 -0
- package/server/src/log-timestamps-install.js +8 -0
- package/server/src/log-timestamps.js +58 -0
- package/server/src/mac-stats.js +261 -0
- package/server/src/notes/store.js +248 -0
- package/server/src/notify/apns-channel.js +70 -0
- package/server/src/notify/apns-devices.js +477 -0
- package/server/src/notify/apns-payload.js +267 -0
- package/server/src/notify/apns-sink.js +207 -0
- package/server/src/notify/apns.js +307 -0
- package/server/src/notify/consent-canary-push.js +163 -0
- package/server/src/notify/content.js +328 -0
- package/server/src/notify/fanout.js +44 -0
- package/server/src/notify/index.js +505 -0
- package/server/src/notify/live-activity-limits.js +126 -0
- package/server/src/notify/live-activity-state.js +176 -0
- package/server/src/notify/live-activity.js +581 -0
- package/server/src/notify/policy.js +273 -0
- package/server/src/notify/presence.js +176 -0
- package/server/src/notify/push-crypto.js +95 -0
- package/server/src/notify/relay-pass.js +487 -0
- package/server/src/notify/relay-sender.js +206 -0
- package/server/src/notify/sender.js +117 -0
- package/server/src/notify/weekly-limit.js +204 -0
- package/server/src/notify/workflow-phase.js +11 -0
- package/server/src/permissions.js +239 -0
- package/server/src/pr-status/gh.js +270 -0
- package/server/src/pr-status/index.js +12 -0
- package/server/src/pr-status/source.js +22 -0
- package/server/src/pr-status/tracker.js +204 -0
- package/server/src/risk.js +100 -0
- package/server/src/router.js +597 -0
- package/server/src/routes/context.js +8 -0
- package/server/src/routes/devices.js +246 -0
- package/server/src/routes/limits.js +41 -0
- package/server/src/routes/notes.js +105 -0
- package/server/src/routes/projects.js +189 -0
- package/server/src/routes/push.js +252 -0
- package/server/src/routes/sessions.js +757 -0
- package/server/src/routes/system.js +274 -0
- package/server/src/routes/terminal.js +140 -0
- package/server/src/safe-read.js +118 -0
- package/server/src/session-label.js +48 -0
- package/server/src/session-list.js +166 -0
- package/server/src/sessions/activity-clocks.js +47 -0
- package/server/src/sessions/attach-slots.js +64 -0
- package/server/src/sessions/claim-window.js +132 -0
- package/server/src/sessions/cli-registry.js +233 -0
- package/server/src/sessions/companion-scope.js +99 -0
- package/server/src/sessions/consent-cards.js +509 -0
- package/server/src/sessions/context-usage.js +23 -0
- package/server/src/sessions/conversation-lists.js +68 -0
- package/server/src/sessions/dialog-timing.js +57 -0
- package/server/src/sessions/driver-events.js +282 -0
- package/server/src/sessions/errors.js +64 -0
- package/server/src/sessions/fallback-label.js +38 -0
- package/server/src/sessions/held-echo.js +258 -0
- package/server/src/sessions/herdr-lifecycle.js +453 -0
- package/server/src/sessions/interrupt-windows.js +141 -0
- package/server/src/sessions/launch-gate.js +299 -0
- package/server/src/sessions/manager-api.js +1 -0
- package/server/src/sessions/manager.js +4045 -0
- package/server/src/sessions/pr-status-link.js +50 -0
- package/server/src/sessions/project-scan.js +48 -0
- package/server/src/sessions/question-card.js +137 -0
- package/server/src/sessions/recent-projects.js +55 -0
- package/server/src/sessions/ring-buffer.js +196 -0
- package/server/src/sessions/seen-marks.js +431 -0
- package/server/src/sessions/send-registry.js +275 -0
- package/server/src/sessions/session-git.js +304 -0
- package/server/src/sessions/session-restart.js +420 -0
- package/server/src/sessions/session-take-back.js +118 -0
- package/server/src/sessions/session.js +724 -0
- package/server/src/sessions/state-machine.js +145 -0
- package/server/src/sessions/state-sentences.js +642 -0
- package/server/src/shutdown.js +20 -0
- package/server/src/sse.js +577 -0
- package/server/src/tailnet.js +169 -0
- package/server/src/term/backend.js +59 -0
- package/server/src/term/herdr-backend.js +1649 -0
- package/server/src/term/herdr-stream.js +109 -0
- package/server/src/term/index.js +338 -0
- package/server/src/term/lifecycle.js +182 -0
- package/server/src/term/paste.js +139 -0
- package/server/src/term/registry.js +1032 -0
- package/server/src/term/ws.js +306 -0
- package/server/src/text.js +102 -0
- package/server/src/transcript-import.js +579 -0
- package/server/src/usage.js +255 -0
- package/server/src/version-watch.js +243 -0
- package/server/src/version.js +72 -0
- package/server/src/voice/soniox.js +301 -0
|
@@ -0,0 +1,1375 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `rarog service install|uninstall` (macOS): usługa launchd
|
|
3
|
+
* `ai.rarog.server` z szablonu `templates/launchd.plist` dla drogi `rarog serve`.
|
|
4
|
+
*
|
|
5
|
+
* `install` idzie w dwóch fazach, bo zatrzymuje serwer, przez który właściciel łączy się z telefonu:
|
|
6
|
+
*
|
|
7
|
+
* - **faza 0, nic nie zatrzymuje:** paczka npm uruchomiona z cache `npx` albo przez `pnpm dlx` = odmowa jeszcze
|
|
8
|
+
* przed blokadą (`install/service-target.ts`); blokada `~/.config/rarog/lock`; środowisko instalacji bez
|
|
9
|
+
* zmiennych katalogu danych (rodzaj `process` rejestru: launchd ich nie przekaże, więc katalog instalacji i usługi
|
|
10
|
+
* byłby inny),
|
|
11
|
+
* także w bloku `environment` domeny z `launchctl print gui/<uid>` (dziedziczy go każda usługa; nierozpoznany
|
|
12
|
+
* wydruk = ostrzeżenie „nie sprawdzone”, nie odmowa);
|
|
13
|
+
* węzeł tego procesu (`process.execPath`, trafia do plistu) z wersją z `nodeVersionOk`; `rarog serve --check`
|
|
14
|
+
* w procesie na środowisku, które da launchd (konfiguracja, katalog danych bez konfliktu, port); ścieżka gniazda
|
|
15
|
+
* administracyjnego ≤ 103 B i żaden serwer tych danych na innym porcie (żywe gniazdo przy milczącym porcie);
|
|
16
|
+
* pierwszy element `service.wrapper` to wykonywalny plik o ścieżce bezwzględnej;
|
|
17
|
+
* plist z szablonu w pliku tymczasowym i `plutil -lint`; na końcu pełne `rarog serve --check` PRZEZ
|
|
18
|
+
* `service.wrapper`, czyli z sekretami (dlatego `install` u właściciela uruchamia właściciel); wrapper, który nie
|
|
19
|
+
* daje ani jednego sekretu albo zmienia katalog danych lub port, to odmowa; ostatni krok to stan usługi
|
|
20
|
+
* (`loadState` z `restart.ts`), a „nie wiem” (`launchctl print` z kodem innym niż 0 i 113) to odmowa przed
|
|
21
|
+
* `bootout`.
|
|
22
|
+
* - **faza 1:** `bootout` `ai.rarog.server`, jeśli jest załadowana, z czekaniem (do 30 s), aż launchd zdejmie
|
|
23
|
+
* etykietę ({@link waitUntilAbsent}); katalog danych 0700 (launchd zakłada plik logu, ale nie katalog); zapis
|
|
24
|
+
* plistu; `bootstrap`; `scripts/restart.sh` z etykietą, portem i logiem (ubija resztki na porcie, `kickstart`,
|
|
25
|
+
* health), wołany wprost, bo blokadę trzyma już `install`; na końcu dowiązanie `~/.local/bin/rarog` (tylko klon
|
|
26
|
+
* repo; w paczce polecenie `rarog` daje menedżer paczek).
|
|
27
|
+
* Porażka po pierwszym kroku tej fazy, także wyjątek, wypisuje DOSŁOWNIE komendy powrotu.
|
|
28
|
+
*
|
|
29
|
+
* Klon repo przy usłudze, która startuje paczkę npm ({@link packageSwitch}): `install` przełączyłby produkcję
|
|
30
|
+
* z paczki na klon, więc bez terminala (`CliIo.ask`) odmawia jeszcze przed fazą 0, a w terminalu po fazie 0 wypisuje
|
|
31
|
+
* listę zmian z komendą powrotu na paczkę i pyta `[y/N]`; „nie” i EOF = odmowa, nic nie zatrzymane. To samo na Linuksie.
|
|
32
|
+
* Tak samo plik usługi, którego cel klon nie odczyta ({@link unknownTarget}): lista bez komendy powrotu.
|
|
33
|
+
*
|
|
34
|
+
* Każdy krok jest idempotentny: ponowna instalacja przy załadowanym `ai.rarog.server` to to samo wywołanie.
|
|
35
|
+
* `uninstall` = `bootout` + plist removal; data and config stay, and in a clone the `~/.local/bin/rarog` symlink
|
|
36
|
+
* goes only when it points to this clone ({@link removeRarogLink}). An undecided state of `ai.rarog.server` is
|
|
37
|
+
* a refusal before anything changes. In the npm package it then removes the Rarog entries from
|
|
38
|
+
* `~/.claude/settings.json` after a `[y/N/d]` question and the hook copy directory after a `[y/N]` one, and prints
|
|
39
|
+
* the rest of the uninstall ({@link packageUninstall}). Starej instalacji z plistu `install` nie sprawdza: przepina
|
|
40
|
+
* usługę także wtedy, gdy węzła albo wejścia z plistu już nie ma.
|
|
41
|
+
*
|
|
42
|
+
* Sekrety nie trafiają do argv, plistu ani wyjścia: plist niesie wyłącznie `service.wrapper`, węzeł i ścieżki,
|
|
43
|
+
* a `serve --check` wypisuje same nazwy.
|
|
44
|
+
*
|
|
45
|
+
* Linux: jednostka `systemd --user` `rarog.service` z szablonu `templates/rarog.service`
|
|
46
|
+
* ({@link installUnit}, {@link uninstallUnit}) w tych samych dwóch fazach. Faza 0: blokada; zmienne katalogu danych
|
|
47
|
+
* puste w powłoce i w środowisku menedżera użytkownika (`busctl`); `UnitPath` menedżera zawiera
|
|
48
|
+
* `~/.config/systemd/user`; jednostka bez drop-inów; węzeł; `curl`, `ps`, `pgrep`; `serve --check` na środowisku
|
|
49
|
+
* menedżera; gniazdo ≤ 103 B i żaden serwer tych danych na innym porcie; wrapper; jednostka z szablonu w pliku
|
|
50
|
+
* tymczasowym i `systemd-analyze verify` (tryb systemowy, działa bez menedżera; brak narzędzia = linia „nie
|
|
51
|
+
* sprawdzone”); pełne `--check` przez wrapper (ten sam katalog danych i port co bez niego); stan jednostki. Faza 1: zapis atomowy, `daemon-reload`, `enable`, katalog danych 0700, `restart.sh`
|
|
52
|
+
* z `RAROG_RESTART_UNIT`, linia o lingerze, dowiązanie; porażka wypisuje komendy powrotu. `uninstall` = `disable
|
|
53
|
+
* --now`, unit file removal, `daemon-reload`, this clone's symlink as on macOS. Inna platforma = odmowa.
|
|
54
|
+
*/
|
|
55
|
+
import { spawnSync } from 'node:child_process';
|
|
56
|
+
import { accessSync, constants, existsSync, lstatSync, mkdirSync, readlinkSync, renameSync, rmSync, symlinkSync, unlinkSync, writeFileSync, } from 'node:fs';
|
|
57
|
+
import { userInfo } from 'node:os';
|
|
58
|
+
import path from 'node:path';
|
|
59
|
+
import { resolveDataDir } from '@rarog/shared/data-dir';
|
|
60
|
+
import { ADMIN_SOCKET_PATH_MAX, adminSocketPath } from '../auth/admin.js';
|
|
61
|
+
import { contextHookCommand, denyReadPaths, hookCommand, hookCopyDirState, hookInstallDir, removeHookCopy, renderPasteHookBlock, renderStatuslineBlock, statuslineCommand, userSettingsPath, visibleLine, writeBlockRules, } from '../herdr/hook-config.js';
|
|
62
|
+
import { INSTALL_MODE, INSTALL_ROOT } from '../install/mode.js';
|
|
63
|
+
import { PACKAGE_INSTALL, REPAIR, installationCli, packageCommands, packageManagerOf, rarogCli, } from '../install/repair.js';
|
|
64
|
+
import { SDK_DIRNAME } from '../install/sdk.js';
|
|
65
|
+
import { RAROG_BIN, serviceArgv, serviceArgvNode, serviceArgvWrapper, serviceTarget, transientInstall, } from '../install/service-target.js';
|
|
66
|
+
import { readRegularFileSync } from '../safe-read.js';
|
|
67
|
+
import { RAROG_VERSION } from '../version.js';
|
|
68
|
+
import { SETTINGS_BACKUP_DIRNAME, copyRemovalCheck, entriesDiff, entriesQuestion, writeClaudeSettings } from './claude-settings.js';
|
|
69
|
+
import { EXIT_OK, EXIT_REFUSED, Refusal, Usage, err, homeOf, isYes, out, platformOf, terminalOf } from './io.js';
|
|
70
|
+
import { childExitText } from './child-output.js';
|
|
71
|
+
import { acquireLock } from './lock.js';
|
|
72
|
+
import { LAUNCHD_PATH, LINUX_RESTART_TOOLS, NOTHING_STOPPED, SERVICE_LABEL, accepts, decidedLoadState, installedServiceDataDir, launchdDomain, launchdEnv, launchdTarget, loadState, nodeRequirement, onPath, refuseLaunchdDataDirEnv, runRestartScript, scriptEnv, serviceNodeVersionOk, servicePackageFromClone, servicePackageText, servicePlistArgv, servicePlistPath, unitArgv, } from './restart.js';
|
|
73
|
+
import { confirm as confirmForm } from './screen/ask.js';
|
|
74
|
+
import { layoutOf } from './screen/style.js';
|
|
75
|
+
import { CHECK_DATA_DIR_LABEL, CHECK_PORT_LABEL, PROCESS_NAMES, SECRETS_UNCHECKED_LINE, buildServeEnv, checkServeEnv, rarogConfigDir, } from './serve.js';
|
|
76
|
+
import { UNIT_ENV_PROPS, UNIT_NAME, UNIT_STATE_PROPS, classifyUnit, enableLingerCommand, lingerState, managerEnvironment, managerStrings, renderServiceUnit, samePath, showUnit, unitFilePath, userUnitDir, } from './systemd-unit.js';
|
|
77
|
+
import { usageFor } from './screen/prose.js';
|
|
78
|
+
import { herdrAgentUninstallLines } from './setup-herdr-agent.js';
|
|
79
|
+
export const SERVICE_USAGE = ` rarog service install|uninstall
|
|
80
|
+
launchd service ${SERVICE_LABEL} (macOS). install first checks everything without stopping anything, then
|
|
81
|
+
unloads the running service, writes the plist from the template, loads it and restarts with a health check;
|
|
82
|
+
uninstall unloads the service and removes its plist (data stays) and, in a repo clone, the ~/.local/bin/rarog
|
|
83
|
+
symlink when it points to this clone; in the npm package it then removes the Rarog entries from
|
|
84
|
+
~/.claude/settings.json after a [y/N/d] question (d shows the diff) and the hook copy after a list and
|
|
85
|
+
[y/N]. On Linux the same with the systemd --user unit ${UNIT_NAME}. Repo clone over a service on the npm
|
|
86
|
+
package or with an unreadable target: install prints the changes and asks [y/N] (refuses without a terminal).`;
|
|
87
|
+
/** Szablon plistu usługi; wartości wstawia {@link renderServicePlist} po escapowaniu XML. */
|
|
88
|
+
export const PLIST_TEMPLATE = path.join(INSTALL_ROOT, 'server', 'src', 'cli', 'templates', 'launchd.plist');
|
|
89
|
+
/** Wejście `rarog`, które startuje usługa (`install/service-target.ts`). */
|
|
90
|
+
export { RAROG_BIN };
|
|
91
|
+
/** Środowisko „jak pod launchd” i jego `PATH` (`restart.ts`, wspólne z `restart` i `doctor`). */
|
|
92
|
+
export { LAUNCHD_PATH, launchdEnv };
|
|
93
|
+
/** Sufit pełnego `serve --check` przez wrapper (wrapper sekretów może pytać sieć). */
|
|
94
|
+
export const WRAPPER_CHECK_TIMEOUT_MS = 120_000;
|
|
95
|
+
/** Odmowa przy wrapperze, który nie dał żadnego sekretu: `rarog serve` z wrapperem bez sekretów nie startuje. */
|
|
96
|
+
export const WRAPPER_WITHOUT_SECRETS = 'service.wrapper supplied no secret at all, and rarog serve with a wrapper but'
|
|
97
|
+
+ ' without secrets refuses to start, so the service would not come up. Check the wrapper (names after --only,'
|
|
98
|
+
+ ' vault access).';
|
|
99
|
+
/** Dowiązanie komendy `rarog` w `PATH` użytkownika. */
|
|
100
|
+
export function rarogLinkPath(home) {
|
|
101
|
+
return path.join(home, '.local', 'bin', 'rarog');
|
|
102
|
+
}
|
|
103
|
+
/** Odmowa poza macOS (launchd) i Linuksem (`systemd --user`). */
|
|
104
|
+
export function servicePlatformIssue(platform) {
|
|
105
|
+
return platform === 'darwin' || platform === 'linux'
|
|
106
|
+
? null
|
|
107
|
+
: `rarog service knows the launchd (macOS) and systemd --user (Linux) supervisors, and this platform is`
|
|
108
|
+
+ ` ${platform}. Here the server starts with \`rarog serve\` from your own supervisor.`;
|
|
109
|
+
}
|
|
110
|
+
/** Szablon z repo przez `safe-read.ts`: plik zwykły, bez dowiązania, z sufitem. */
|
|
111
|
+
function readTemplate() {
|
|
112
|
+
const read = readRegularFileSync(PLIST_TEMPLATE, { maxBytes: 64 * 1024, followSymlink: false });
|
|
113
|
+
if (read === null || read.truncated) {
|
|
114
|
+
throw new Error(`${PLIST_TEMPLATE}: the template is not a regular file ≤ 64 KiB.`);
|
|
115
|
+
}
|
|
116
|
+
return read.bytes.toString('utf8');
|
|
117
|
+
}
|
|
118
|
+
/** Tekst w elemencie albo atrybucie XML: pięć znaków specjalnych jako encje. */
|
|
119
|
+
export function xmlEscape(value) {
|
|
120
|
+
return value.replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>')
|
|
121
|
+
.replaceAll('"', '"').replaceAll("'", ''');
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Plist usługi z szablonu: etykieta, `ProgramArguments` (po jednym `<string>` na element), katalog roboczy i log
|
|
125
|
+
* na oba strumienie; każda wartość escapowana. Znak, którego XML 1.0 nie przenosi (np. NUL), wyłapie `plutil -lint`
|
|
126
|
+
* w fazie 0.
|
|
127
|
+
*/
|
|
128
|
+
export function renderServicePlist(input, template = readTemplate()) {
|
|
129
|
+
const args = input.programArguments.map((arg) => ` <string>${xmlEscape(arg)}</string>`).join('\n');
|
|
130
|
+
const values = {
|
|
131
|
+
'{{LABEL}}': xmlEscape(SERVICE_LABEL),
|
|
132
|
+
'{{PROGRAM_ARGUMENTS}}': args,
|
|
133
|
+
'{{WORKING_DIRECTORY}}': xmlEscape(input.workingDirectory),
|
|
134
|
+
'{{LOG}}': xmlEscape(input.log),
|
|
135
|
+
};
|
|
136
|
+
let text = template;
|
|
137
|
+
for (const [placeholder, value] of Object.entries(values))
|
|
138
|
+
text = text.split(placeholder).join(value);
|
|
139
|
+
if (text.includes('{{'))
|
|
140
|
+
throw new Error(`${PLIST_TEMPLATE}: a template field is left unfilled.`);
|
|
141
|
+
return text;
|
|
142
|
+
}
|
|
143
|
+
/** Ścieżka w pojedynczym cudzysłowie powłoki — komenda ma się dać wkleić. */
|
|
144
|
+
export function quote(value) {
|
|
145
|
+
return `'${value.replaceAll("'", "'\\''")}'`;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Komendy powrotu po porażce fazy 1, do wklejenia w powłoce przez mosh: wyładowanie
|
|
149
|
+
* nowej usługi i usunięcie jej plistu; dane i konfiguracja zostają.
|
|
150
|
+
*/
|
|
151
|
+
export function rollbackLines(home, mode = INSTALL_MODE) {
|
|
152
|
+
return [
|
|
153
|
+
`ROLLBACK (unloads ${SERVICE_LABEL}; data and config stay), in a shell:`,
|
|
154
|
+
...cdLines(mode),
|
|
155
|
+
` ${rarogCli('service uninstall', mode)}`,
|
|
156
|
+
'Without the CLI (this also breaks the KeepAlive loop of the new service):',
|
|
157
|
+
` launchctl bootout gui/$UID/${SERVICE_LABEL}`,
|
|
158
|
+
` rm ${quote(servicePlistPath(home))}`,
|
|
159
|
+
];
|
|
160
|
+
}
|
|
161
|
+
/** `cd` do katalogu repo przed komendą powrotu: tylko w klonie, bo `rarog` paczki leży w `PATH`. */
|
|
162
|
+
function cdLines(mode) {
|
|
163
|
+
return mode === 'clone' ? [` cd ${quote(INSTALL_ROOT)}`] : [];
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* The new service starts `rarog serve` without flags, so its data directory is the rule's on the service environment:
|
|
167
|
+
* another directory than the caller's `--data-dir` is a refusal before anything stops (the service would leave it).
|
|
168
|
+
*/
|
|
169
|
+
function refuseOtherDataDir(given, dataDir) {
|
|
170
|
+
if (given === undefined || samePath(given, dataDir))
|
|
171
|
+
return;
|
|
172
|
+
throw new Refusal(`the service would use the data directory ${dataDir}, not ${given} from --data-dir (it starts`
|
|
173
|
+
+ ` rarog serve without flags). ${NOTHING_STOPPED}`);
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Instalacja z cache `npx` albo uruchomiona przez `pnpm dlx` ({@link transientInstall}) = odmowa przed blokadą
|
|
177
|
+
* i przed `launchctl`: usługa wskazywałaby katalog, który menedżer paczek usuwa przy czyszczeniu cache.
|
|
178
|
+
*/
|
|
179
|
+
function refuseTransientInstall(io, deps) {
|
|
180
|
+
const transient = transientInstall(deps.mode ?? INSTALL_MODE, deps.installRoot ?? INSTALL_ROOT, io.env);
|
|
181
|
+
if (transient === null)
|
|
182
|
+
return;
|
|
183
|
+
throw new Refusal(`started from ${transient}. The service would point to a directory that disappears when the`
|
|
184
|
+
+ ` package manager cache is cleaned. Install permanently: ${PACKAGE_INSTALL.npm} (or ${PACKAGE_INSTALL.pnpm}),`
|
|
185
|
+
+ ` then rarog service install. ${NOTHING_STOPPED}`);
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* {@link PackageSwitch} z pliku zainstalowanej usługi (plist albo jednostka); `null` = tryb paczki, brak albo
|
|
189
|
+
* nieczytelny plik usługi, usługa na tym klonie, na innym klonie albo na instalacji, której już nie ma.
|
|
190
|
+
*/
|
|
191
|
+
function packageSwitch(io, platform, mode) {
|
|
192
|
+
if (mode !== 'clone')
|
|
193
|
+
return null;
|
|
194
|
+
const found = platform === 'linux' ? unitArgv(io) : servicePlistArgv(io);
|
|
195
|
+
if ('issue' in found)
|
|
196
|
+
return null;
|
|
197
|
+
const from = servicePackageFromClone(found.argv, mode);
|
|
198
|
+
if (from === null)
|
|
199
|
+
return null;
|
|
200
|
+
return { from, argv: found.argv, dataDir: installedServiceDataDir(io, platform, homeOf(io.env)) };
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Przełączenie z paczki na klon bez terminala = odmowa przed fazą 0 (bez wrappera sekretów i bez żadnego zapisu):
|
|
204
|
+
* tę zmianę produkcji potwierdza człowiek odpowiedzią na pytanie z listą zmian ({@link confirmSwitch}).
|
|
205
|
+
*/
|
|
206
|
+
function refuseSwitchWithoutTerminal(io, switching, label) {
|
|
207
|
+
if (switching !== null && io.ask === undefined)
|
|
208
|
+
throw switchWithoutTerminal(switching, label);
|
|
209
|
+
}
|
|
210
|
+
function switchWithoutTerminal(switching, label) {
|
|
211
|
+
return new Refusal(`service ${label} starts ${servicePackageText(switching.from)}, and this is the repo clone`
|
|
212
|
+
+ ` ${INSTALL_ROOT}, so install would switch the service from the package to this clone. Confirm the switch in a`
|
|
213
|
+
+ ` terminal: ${rarogCli('service install', 'clone')} prints the list of changes there and asks [y/N]. Restart the`
|
|
214
|
+
+ ` service without switching: ${installationCli(switching.from, 'restart')}. ${NOTHING_STOPPED}`);
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Co `install` klonu zrobi z dowiązaniem `~/.local/bin/rarog` ({@link ensureRarogLink}) i jak to cofnąć (`undo`,
|
|
218
|
+
* `null` = nic do cofnięcia): nowe dowiązanie usuwa `rm`, a podmienione (np. polecenie paczki z prefiksu
|
|
219
|
+
* `~/.local`) wraca do dawnego celu przez `ln -sfn`, bo `service install` paczki dowiązania nie zakłada. Nic nie zapisuje.
|
|
220
|
+
*/
|
|
221
|
+
function rarogLinkPlan(home) {
|
|
222
|
+
const link = rarogLinkPath(home);
|
|
223
|
+
const shadows = `${RAROG_BIN} (may shadow the rarog command of the package in PATH)`;
|
|
224
|
+
const stats = lstatSync(link, { throwIfNoEntry: false });
|
|
225
|
+
if (stats === undefined)
|
|
226
|
+
return { link, text: `none → ${shadows}`, undo: `rm ${quote(link)}` };
|
|
227
|
+
if (!stats.isSymbolicLink())
|
|
228
|
+
return { link, text: 'stays (a file, not a symlink)', undo: null };
|
|
229
|
+
const target = readlinkSync(link);
|
|
230
|
+
if (target === RAROG_BIN)
|
|
231
|
+
return { link, text: 'unchanged (points to this clone)', undo: null };
|
|
232
|
+
return { link, text: `${target} → ${shadows}`, undo: `ln -sfn ${quote(target)} ${quote(link)}` };
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Lista zmian przełączenia z paczki na ten klon (wejście, węzeł, wrapper, katalog danych, dowiązanie, restart), co
|
|
236
|
+
* zostaje i komenda powrotu na paczkę: jej węzeł i wejście z argv usługi, które działają bez `PATH`.
|
|
237
|
+
*/
|
|
238
|
+
function switchLines(switching, next, home, label) {
|
|
239
|
+
const change = (name, before, after) => (before === after
|
|
240
|
+
? ` ${name}: unchanged (${after})` : ` ${name}: ${before} → ${after}`);
|
|
241
|
+
const wrapper = (argv) => serviceArgvWrapper(argv).join(' ') || 'none';
|
|
242
|
+
const link = rarogLinkPlan(home);
|
|
243
|
+
return [
|
|
244
|
+
`Service ${label} starts ${servicePackageText(switching.from)}; install switches it to this clone.`
|
|
245
|
+
+ ' What changes:',
|
|
246
|
+
` entry: ${switching.from.bin} → ${RAROG_BIN} (repo clone, version ${RAROG_VERSION})`,
|
|
247
|
+
change('node', serviceArgvNode(switching.argv) ?? '?', serviceArgvNode(next.argv) ?? '?'),
|
|
248
|
+
change('service.wrapper', wrapper(switching.argv), wrapper(next.argv)),
|
|
249
|
+
change('data directory (service log)', switching.dataDir ?? '?', next.dataDir),
|
|
250
|
+
` symlink ${link.link}: ${link.text}`,
|
|
251
|
+
' server: stopped and started from the code of this clone; apps lose the connection for a few seconds',
|
|
252
|
+
` Unchanged: devices, config.json and the hook copy in ${hookInstallDir(home)} (${REPAIR.hooksDoctor} shows`
|
|
253
|
+
+ ' whether it matches this clone).',
|
|
254
|
+
` Back to the package: ${installationCli(switching.from, 'service install')}`
|
|
255
|
+
+ `${link.undo === null ? '' : `, then ${link.undo}`}.`,
|
|
256
|
+
];
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Koniec fazy 0 przy {@link PackageSwitch}: lista zmian ({@link switchLines}) i pytanie `[y/N]`; „nie” albo EOF =
|
|
260
|
+
* odmowa, zanim cokolwiek się zatrzyma.
|
|
261
|
+
*/
|
|
262
|
+
async function confirmSwitch(io, switching, next, label) {
|
|
263
|
+
if (switching === null)
|
|
264
|
+
return;
|
|
265
|
+
const ask = io.ask;
|
|
266
|
+
if (ask === undefined)
|
|
267
|
+
throw switchWithoutTerminal(switching, label);
|
|
268
|
+
for (const line of switchLines(switching, next, homeOf(io.env), label))
|
|
269
|
+
out(io, line);
|
|
270
|
+
if (!isYes(await ask(`Switch service ${label} from the package to this clone? [y/N] `))) {
|
|
271
|
+
throw new Refusal(`switch declined; the service still starts ${servicePackageText(switching.from)}.`
|
|
272
|
+
+ ` ${NOTHING_STOPPED}`);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
function unknownTarget(io, platform, mode) {
|
|
276
|
+
if (mode !== 'clone')
|
|
277
|
+
return null;
|
|
278
|
+
const home = homeOf(io.env);
|
|
279
|
+
const file = platform === 'linux' ? unitFilePath(home) : servicePlistPath(home);
|
|
280
|
+
if (lstatSync(file, { throwIfNoEntry: false }) === undefined)
|
|
281
|
+
return null;
|
|
282
|
+
const found = platform === 'linux' ? unitArgv(io) : servicePlistArgv(io);
|
|
283
|
+
return 'issue' in found ? { issue: found.issue, dataDir: installedServiceDataDir(io, platform, home) } : null;
|
|
284
|
+
}
|
|
285
|
+
function unknownWithoutTerminal(unknown, label) {
|
|
286
|
+
return new Refusal(`service ${label}: target of the current service unreadable: ${unknown.issue} This is the repo`
|
|
287
|
+
+ ` clone ${INSTALL_ROOT}, so install would replace the service without knowing what it starts (maybe the npm`
|
|
288
|
+
+ ` package). Confirm the replacement in a terminal: ${rarogCli('service install', 'clone')} prints the list of`
|
|
289
|
+
+ ` changes there and asks [y/N]. ${NOTHING_STOPPED}`);
|
|
290
|
+
}
|
|
291
|
+
/** {@link UnknownTarget} bez terminala = odmowa przed fazą 0, bez wrappera sekretów i bez zapisu. */
|
|
292
|
+
function refuseUnknownWithoutTerminal(io, unknown, label) {
|
|
293
|
+
if (unknown !== null && io.ask === undefined)
|
|
294
|
+
throw unknownWithoutTerminal(unknown, label);
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Koniec fazy 0 przy {@link UnknownTarget}: lista zmian jak przy przełączeniu z paczki, z linią o nieczytelnym celu
|
|
298
|
+
* i bez komendy powrotu (plik nie mówi, którą instalację startował), i pytanie `[y/N]`; „nie” albo EOF = odmowa.
|
|
299
|
+
*/
|
|
300
|
+
async function confirmUnknownTarget(io, unknown, next, label) {
|
|
301
|
+
if (unknown === null)
|
|
302
|
+
return;
|
|
303
|
+
const ask = io.ask;
|
|
304
|
+
if (ask === undefined)
|
|
305
|
+
throw unknownWithoutTerminal(unknown, label);
|
|
306
|
+
const home = homeOf(io.env);
|
|
307
|
+
const link = rarogLinkPlan(home);
|
|
308
|
+
const lines = [
|
|
309
|
+
`Service ${label}: install replaces it with a service of this clone, without knowing what it starts. What`
|
|
310
|
+
+ ' changes:',
|
|
311
|
+
` target of the current service unreadable: ${unknown.issue}`,
|
|
312
|
+
` entry: ? → ${RAROG_BIN} (repo clone, version ${RAROG_VERSION})`,
|
|
313
|
+
` node: ? → ${serviceArgvNode(next.argv) ?? '?'}`,
|
|
314
|
+
` service.wrapper: ? → ${serviceArgvWrapper(next.argv).join(' ') || 'none'}`,
|
|
315
|
+
` data directory (service log): ${unknown.dataDir === next.dataDir ? `unchanged (${next.dataDir})`
|
|
316
|
+
: `${unknown.dataDir ?? '?'} → ${next.dataDir}`}`,
|
|
317
|
+
` symlink ${link.link}: ${link.text}`,
|
|
318
|
+
' server: stopped and started from the code of this clone; apps lose the connection for a few seconds',
|
|
319
|
+
` Unchanged: devices, config.json and the hook copy in ${hookInstallDir(home)} (${REPAIR.hooksDoctor} shows`
|
|
320
|
+
+ ' whether it matches this clone).',
|
|
321
|
+
' No command to go back to the previous installation: the service file does not say which one it started.',
|
|
322
|
+
];
|
|
323
|
+
for (const line of lines)
|
|
324
|
+
out(io, line);
|
|
325
|
+
if (!isYes(await ask(`Replace service ${label} with a service of this clone? [y/N] `))) {
|
|
326
|
+
throw new Refusal(`replacement declined; the service file is unchanged. ${NOTHING_STOPPED}`);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
export function spawnText(command, args, env, timeout = 30_000) {
|
|
330
|
+
return spawnSync(command, args, { env, encoding: 'utf8', timeout, cwd: INSTALL_ROOT });
|
|
331
|
+
}
|
|
332
|
+
/** Linie wyjścia procesu potomnego z wcięciem (pusty koniec pominięty). */
|
|
333
|
+
export function indented(text) {
|
|
334
|
+
return text.split('\n').filter((line, i, all) => line !== '' || i < all.length - 1).map((line) => ` ${line}`);
|
|
335
|
+
}
|
|
336
|
+
/** `plutil -lint` na tekście plistu w pliku tymczasowym w katalogu konfiguracji (0700, blokada już jest nasza). */
|
|
337
|
+
function lintPlist(text, io) {
|
|
338
|
+
const file = path.join(rarogConfigDir(io.env), `${SERVICE_LABEL}.plist.sprawdzany`);
|
|
339
|
+
writeFileSync(file, text, { mode: 0o600 });
|
|
340
|
+
try {
|
|
341
|
+
const lint = spawnText('plutil', ['-lint', file], io.env);
|
|
342
|
+
if (lint.error !== undefined || lint.status !== 0) {
|
|
343
|
+
const detail = lint.error?.message ?? `${lint.stdout}${lint.stderr}`.trim();
|
|
344
|
+
throw new Refusal(`the plist from the template fails plutil -lint (${detail}). ${NOTHING_STOPPED}`);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
finally {
|
|
348
|
+
rmSync(file, { force: true });
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
/** Faza 0: każda odmowa tutaj pada, zanim cokolwiek zostanie zatrzymane. */
|
|
352
|
+
async function prepare(io, mode, given) {
|
|
353
|
+
const home = homeOf(io.env);
|
|
354
|
+
out(io, 'rarog service install — phase 0 (checks, stops nothing):');
|
|
355
|
+
// Zmienne katalogu danych puste w powłoce i w domenie launchd — ta sama reguła co w `rarog restart`.
|
|
356
|
+
refuseLaunchdDataDirEnv(io, 'install');
|
|
357
|
+
if (!serviceNodeVersionOk(process.versions.node)) {
|
|
358
|
+
throw new Refusal(`the node of this installation is v${process.versions.node} (${process.execPath}), but the`
|
|
359
|
+
+ ` service requires ${nodeRequirement()} (process.execve); this path goes into the plist. Run install with such`
|
|
360
|
+
+ ' a node.');
|
|
361
|
+
}
|
|
362
|
+
out(io, ` service node: ${serviceTarget().node} (v${process.versions.node})`);
|
|
363
|
+
// Konfiguracja, katalog danych i port tak, jak zobaczy je usługa: środowisko launchd, nie ta powłoka.
|
|
364
|
+
const env = launchdEnv(io.env);
|
|
365
|
+
let built;
|
|
366
|
+
try {
|
|
367
|
+
built = buildServeEnv(env, { env: {}, mode: 'check' });
|
|
368
|
+
}
|
|
369
|
+
catch (failure) {
|
|
370
|
+
if (failure instanceof Refusal)
|
|
371
|
+
throw new Refusal(`${failure.message} ${NOTHING_STOPPED}`);
|
|
372
|
+
throw failure;
|
|
373
|
+
}
|
|
374
|
+
if (built.config === null) {
|
|
375
|
+
throw new Refusal(`no ${path.join(rarogConfigDir(io.env), 'config.json')}; the service starts \`rarog serve\``
|
|
376
|
+
+ ` without flags, so it does not come up without a config file. ${NOTHING_STOPPED}`);
|
|
377
|
+
}
|
|
378
|
+
const captured = [];
|
|
379
|
+
const quiet = { ...io, stdout: (text) => { captured.push(text); }, stderr: (text) => { captured.push(text); } };
|
|
380
|
+
const checked = await checkServeEnv(built, quiet, 'rarog serve --check');
|
|
381
|
+
if (!checked.ok) {
|
|
382
|
+
throw new Refusal(`the config fails the check. ${NOTHING_STOPPED}\n${captured.join('')}`
|
|
383
|
+
.trimEnd());
|
|
384
|
+
}
|
|
385
|
+
out(io, ` config: ${built.config.file}, data directory ${checked.dataDir}, port ${String(checked.port)}`);
|
|
386
|
+
refuseOtherDataDir(given, checked.dataDir);
|
|
387
|
+
const socket = adminSocketPath(checked.dataDir);
|
|
388
|
+
if (Buffer.byteLength(socket, 'utf8') > ADMIN_SOCKET_PATH_MAX) {
|
|
389
|
+
throw new Refusal(`the admin socket path ${socket} has ${String(Buffer.byteLength(socket, 'utf8'))} B, but a`
|
|
390
|
+
+ ` Unix socket on macOS holds ${String(ADMIN_SOCKET_PATH_MAX)} B; the server could not create the socket.`
|
|
391
|
+
+ ` Choose a shorter data directory. ${NOTHING_STOPPED}`);
|
|
392
|
+
}
|
|
393
|
+
// Serwer tych danych na innym porcie (np. `rarog serve` z ręki przed zmianą `RAROG_PORT`) zostałby obok usługi —
|
|
394
|
+
// `restart.sh` zatrzymuje tylko serwer portu z konfiguracji. Ta sama reguła co w `rarog restart` i na Linuksie.
|
|
395
|
+
if (await accepts({ path: socket }) && !await accepts({ host: '127.0.0.1', port: checked.port })) {
|
|
396
|
+
throw new Refusal(`the server of data directory ${checked.dataDir} is running (socket ${socket}), but not on`
|
|
397
|
+
+ ` port ${String(checked.port)} from the config; RAROG_PORT changed? restart.sh stops only the server on that`
|
|
398
|
+
+ ' port, so the old one would stay next to the new one on the same data. Stop the old server by hand and'
|
|
399
|
+
+ ` repeat install. ${NOTHING_STOPPED}`);
|
|
400
|
+
}
|
|
401
|
+
const wrapper = built.config.wrapper ?? [];
|
|
402
|
+
const head = wrapper[0];
|
|
403
|
+
if (head !== undefined) {
|
|
404
|
+
if (!path.isAbsolute(head)) {
|
|
405
|
+
throw new Refusal(`service.wrapper starts with "${head}", but launchd needs an absolute path`
|
|
406
|
+
+ ` (fix ${built.config.file}). ${NOTHING_STOPPED}`);
|
|
407
|
+
}
|
|
408
|
+
try {
|
|
409
|
+
accessSync(head, constants.X_OK);
|
|
410
|
+
}
|
|
411
|
+
catch {
|
|
412
|
+
throw new Refusal(`service.wrapper: ${head} does not exist or is not executable. ${NOTHING_STOPPED}`);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
const programArguments = serviceArgv(wrapper, ['serve']);
|
|
416
|
+
const log = path.join(checked.dataDir, 'server.log');
|
|
417
|
+
const plist = renderServicePlist({ programArguments, workingDirectory: INSTALL_ROOT, log });
|
|
418
|
+
lintPlist(plist, io);
|
|
419
|
+
out(io, ' plist from the template: plutil -lint OK');
|
|
420
|
+
// Pełny poziom `--check`: przez wrapper, z sekretami, na środowisku jak pod launchd.
|
|
421
|
+
const command = serviceArgv(wrapper, ['serve', '--check']);
|
|
422
|
+
out(io, ` rarog serve --check ${wrapper.length > 0 ? 'through service.wrapper' : 'without a wrapper'}:`);
|
|
423
|
+
const full = spawnText(command[0] ?? process.execPath, command.slice(1), env, WRAPPER_CHECK_TIMEOUT_MS);
|
|
424
|
+
for (const line of indented(full.stdout ?? ''))
|
|
425
|
+
out(io, line);
|
|
426
|
+
for (const line of indented(full.stderr ?? ''))
|
|
427
|
+
err(io, line);
|
|
428
|
+
if (full.error !== undefined || full.status !== 0) {
|
|
429
|
+
throw new Refusal(`rarog serve --check ${wrapper.length > 0 ? 'through service.wrapper ' : ''}failed`
|
|
430
|
+
+ ` (${full.error?.message ?? `code ${String(full.status)}`}). ${NOTHING_STOPPED}`);
|
|
431
|
+
}
|
|
432
|
+
// Pod wrapperem `--check` bez żadnego sekretu przechodzi z linią „not checked”, a prawdziwy start odmówi.
|
|
433
|
+
if (wrapper.length > 0 && (full.stdout ?? '').split('\n').some((line) => line.trim() === SECRETS_UNCHECKED_LINE)) {
|
|
434
|
+
throw new Refusal(`${WRAPPER_WITHOUT_SECRETS} ${NOTHING_STOPPED}`);
|
|
435
|
+
}
|
|
436
|
+
// Wrapper może dołożyć zmienną katalogu danych albo podmienić HOME (inny `config.json`, inny port) — wtedy usługa
|
|
437
|
+
// pracowałaby na innych danych niż hook i niż katalog logu w plistcie. Porównanie z liniami pełnego `--check`.
|
|
438
|
+
// `RAROG_PORT` z wrappera nie działa: `rarog serve` bierze port z `config.json`, nie ze środowiska rodzica.
|
|
439
|
+
const seenDataDir = checkValue(full.stdout ?? '', CHECK_DATA_DIR_LABEL);
|
|
440
|
+
const seenPort = checkValue(full.stdout ?? '', CHECK_PORT_LABEL);
|
|
441
|
+
if (seenDataDir !== checked.dataDir || seenPort !== String(checked.port)) {
|
|
442
|
+
throw new Refusal(`the full rarog serve --check${wrapper.length > 0 ? ' through service.wrapper' : ''} sees data`
|
|
443
|
+
+ ` directory ${seenDataDir ?? '?'} and port ${seenPort ?? '?'}, but the check without the wrapper`
|
|
444
|
+
+ ` ${checked.dataDir} and ${String(checked.port)}; does the wrapper set ${PROCESS_NAMES.join(', ')} or HOME?`
|
|
445
|
+
+ ` The service would work on other data than the hook. ${NOTHING_STOPPED}`);
|
|
446
|
+
}
|
|
447
|
+
// Stan usługi na końcu fazy 0, tuż przed `bootout`: „nie wiem” = odmowa tutaj, bo w fazie 1 pominięty `bootout`
|
|
448
|
+
// zostawiłby starą instancję usługi obok nowego plistu.
|
|
449
|
+
decidedLoadState(SERVICE_LABEL, io);
|
|
450
|
+
return { home, plist, argv: programArguments, dataDir: checked.dataDir, port: checked.port, mode };
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Domyślne czekanie po `bootout`: launchd przy usłudze z `KeepAlive` kończy `bootout` asynchronicznie, a `bootstrap`
|
|
454
|
+
* tej samej etykiety przed końcem pada z „Bootstrap failed: 5” (zaobserwowane);
|
|
455
|
+
* przy innej etykiecie stary proces może jeszcze trzymać port.
|
|
456
|
+
*/
|
|
457
|
+
export const BOOTOUT_WAIT = { timeoutMs: 30_000, stepMs: 500 };
|
|
458
|
+
/** Sleep without the event loop: waiting after `bootout` is synchronous (`spawnSync`); only `restart.sh` is async. */
|
|
459
|
+
function sleepSync(ms) {
|
|
460
|
+
if (ms > 0)
|
|
461
|
+
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* Po udanym `bootout`: {@link loadState} co `stepMs`, aż etykieta zniknie (kod 113). `null` = zniknęła; inaczej
|
|
465
|
+
* powód porażki — limit przekroczony albo „nie wiem” w trakcie.
|
|
466
|
+
*/
|
|
467
|
+
export function waitUntilAbsent(label, io, wait = BOOTOUT_WAIT) {
|
|
468
|
+
const target = launchdTarget(label) ?? label;
|
|
469
|
+
const deadline = Date.now() + wait.timeoutMs;
|
|
470
|
+
for (;;) {
|
|
471
|
+
const state = loadState(label, io);
|
|
472
|
+
if (state === 'absent')
|
|
473
|
+
return null;
|
|
474
|
+
if (typeof state === 'object') {
|
|
475
|
+
return `after launchctl bootout ${target} the state is undecided (${state.unknown}); unknown whether launchd`
|
|
476
|
+
+ ` removed ${label}.`;
|
|
477
|
+
}
|
|
478
|
+
const left = deadline - Date.now();
|
|
479
|
+
if (left <= 0) {
|
|
480
|
+
return `after launchctl bootout ${target} label ${label} is still loaded after`
|
|
481
|
+
+ ` ${String(wait.timeoutMs / 1000)} s; launchd did not remove it, bootstrap would come too early.`;
|
|
482
|
+
}
|
|
483
|
+
sleepSync(Math.min(wait.stepMs, left));
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* `launchctl bootout` jednej etykiety, jeśli jest załadowana, i czekanie, aż launchd ją zdejmie
|
|
488
|
+
* ({@link waitUntilAbsent}); `null` = zrobione albo nie było czego. Stan pytany od nowa (mógł się zmienić od
|
|
489
|
+
* fazy 0); „nie wiem” = porażka, nie pominięcie.
|
|
490
|
+
*/
|
|
491
|
+
function bootout(label, io, wait) {
|
|
492
|
+
const target = launchdTarget(label) ?? label;
|
|
493
|
+
const state = loadState(label, io);
|
|
494
|
+
if (typeof state === 'object') {
|
|
495
|
+
return `launchctl print ${target} does not decide whether ${label} is loaded (${state.unknown}); bootout`
|
|
496
|
+
+ ' held back, no further steps.';
|
|
497
|
+
}
|
|
498
|
+
if (state === 'absent')
|
|
499
|
+
return null;
|
|
500
|
+
const result = spawnText('launchctl', ['bootout', target], io.env, 60_000);
|
|
501
|
+
if (result.error !== undefined || result.status !== 0) {
|
|
502
|
+
return `launchctl bootout ${target} failed (${result.error?.message ?? `code ${String(result.status)}`}`
|
|
503
|
+
+ `${result.stderr.trim() === '' ? '' : `: ${result.stderr.trim()}`}).`;
|
|
504
|
+
}
|
|
505
|
+
out(io, ` bootout ${target}`);
|
|
506
|
+
return waitUntilAbsent(label, io, wait);
|
|
507
|
+
}
|
|
508
|
+
/** Zapis pliku przez plik tymczasowy obok i `rename` — launchd nie zobaczy połowy plistu. */
|
|
509
|
+
function writeAtomic(file, text) {
|
|
510
|
+
const temp = `${file}.${String(process.pid)}.tmp`;
|
|
511
|
+
writeFileSync(temp, text, { mode: 0o644 });
|
|
512
|
+
renameSync(temp, file);
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Dowiązanie `~/.local/bin/rarog` → `bin/rarog.mjs` w klonie repo ({@link ensureRarogLink}). W paczce npm nic:
|
|
516
|
+
* polecenie `rarog` w `PATH` daje menedżer paczek, a dowiązanie klonu by je przesłoniło. Zwraca linie raportu.
|
|
517
|
+
*/
|
|
518
|
+
function rarogLinkLines(home, mode) {
|
|
519
|
+
return mode === 'clone' ? [ensureRarogLink(home)] : [];
|
|
520
|
+
}
|
|
521
|
+
/** Dowiązanie `~/.local/bin/rarog` → `bin/rarog.mjs`; cudzego pliku nie nadpisuje. Zwraca linię raportu. */
|
|
522
|
+
function ensureRarogLink(home) {
|
|
523
|
+
const link = rarogLinkPath(home);
|
|
524
|
+
try {
|
|
525
|
+
mkdirSync(path.dirname(link), { recursive: true });
|
|
526
|
+
let stats = null;
|
|
527
|
+
try {
|
|
528
|
+
stats = lstatSync(link);
|
|
529
|
+
}
|
|
530
|
+
catch (failure) {
|
|
531
|
+
if (failure.code !== 'ENOENT')
|
|
532
|
+
throw failure;
|
|
533
|
+
}
|
|
534
|
+
if (stats === null) {
|
|
535
|
+
symlinkSync(RAROG_BIN, link);
|
|
536
|
+
return ` symlink ${link} → ${RAROG_BIN}`;
|
|
537
|
+
}
|
|
538
|
+
if (!stats.isSymbolicLink()) {
|
|
539
|
+
return ` WARNING: ${link} exists and is not a symlink; left as is; run rarog with ${REPAIR.cli}.`;
|
|
540
|
+
}
|
|
541
|
+
const target = readlinkSync(link);
|
|
542
|
+
if (target === RAROG_BIN)
|
|
543
|
+
return ` symlink ${link} → ${RAROG_BIN} (already there)`;
|
|
544
|
+
unlinkSync(link);
|
|
545
|
+
symlinkSync(RAROG_BIN, link);
|
|
546
|
+
return ` symlink ${link} → ${RAROG_BIN} (pointed to ${target})`;
|
|
547
|
+
}
|
|
548
|
+
catch (failure) {
|
|
549
|
+
return ` WARNING: cannot create symlink ${link} (${failure.code ?? 'error'});`
|
|
550
|
+
+ ` the service works, run rarog with ${REPAIR.cli}.`;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* `uninstall` in a clone: removes `~/.local/bin/rarog` only when it is a symlink to this clone's `bin/rarog.mjs`
|
|
555
|
+
* (the one {@link ensureRarogLink} made), so the package's `rarog` in `PATH` is no longer shadowed. Another symlink
|
|
556
|
+
* or a file stays with a report line; no entry = no line. The npm package does nothing (its `rarog` comes from the
|
|
557
|
+
* package manager).
|
|
558
|
+
*/
|
|
559
|
+
function removeRarogLink(home, mode) {
|
|
560
|
+
if (mode !== 'clone')
|
|
561
|
+
return null;
|
|
562
|
+
const link = rarogLinkPath(home);
|
|
563
|
+
try {
|
|
564
|
+
const stats = lstatSync(link, { throwIfNoEntry: false });
|
|
565
|
+
if (stats === undefined)
|
|
566
|
+
return null;
|
|
567
|
+
if (!stats.isSymbolicLink())
|
|
568
|
+
return `${link} stays: it is not a symlink.`;
|
|
569
|
+
const target = readlinkSync(link);
|
|
570
|
+
if (path.resolve(path.dirname(link), target) !== RAROG_BIN) {
|
|
571
|
+
return `Symlink ${link} stays: it points to ${target}, not to this clone.`;
|
|
572
|
+
}
|
|
573
|
+
unlinkSync(link);
|
|
574
|
+
return `Symlink ${link} removed (it pointed to this clone).`;
|
|
575
|
+
}
|
|
576
|
+
catch (failure) {
|
|
577
|
+
return `WARNING: cannot remove symlink ${link} (${failure.code ?? 'error'});`
|
|
578
|
+
+ ` remove it by hand: rm ${quote(link)}`;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
/** Faza 1. Od pierwszego `bootout` każda porażka wypisuje komendy powrotu. */
|
|
582
|
+
async function apply(io, prepared, wait, output) {
|
|
583
|
+
const { home } = prepared;
|
|
584
|
+
const fail = (what, code = EXIT_REFUSED) => {
|
|
585
|
+
err(io, `rarog service install: ${what}`);
|
|
586
|
+
for (const line of rollbackLines(home, prepared.mode))
|
|
587
|
+
err(io, line);
|
|
588
|
+
return code;
|
|
589
|
+
};
|
|
590
|
+
out(io, 'rarog service install — phase 1 (stop and switch):');
|
|
591
|
+
try {
|
|
592
|
+
return await switchOver(io, prepared, fail, wait, output);
|
|
593
|
+
}
|
|
594
|
+
catch (failure) {
|
|
595
|
+
// Wyjątek po `bootout` (np. `bash` nie startuje w `runRestartScript`) też musi wypisać drogę powrotu.
|
|
596
|
+
return fail(failure instanceof Error ? failure.message : String(failure));
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
/** Kroki fazy 1 po kolei; porażka każdego idzie przez `fail` z komendami powrotu. */
|
|
600
|
+
async function switchOver(io, prepared, fail, wait, output) {
|
|
601
|
+
const { home, plist, dataDir, port } = prepared;
|
|
602
|
+
const issue = bootout(SERVICE_LABEL, io, wait);
|
|
603
|
+
if (issue !== null)
|
|
604
|
+
return fail(issue);
|
|
605
|
+
const plistFile = servicePlistPath(home);
|
|
606
|
+
try {
|
|
607
|
+
mkdirSync(dataDir, { recursive: true, mode: 0o700 });
|
|
608
|
+
mkdirSync(path.dirname(plistFile), { recursive: true });
|
|
609
|
+
writeAtomic(plistFile, plist);
|
|
610
|
+
out(io, ` plist ${plistFile}`);
|
|
611
|
+
}
|
|
612
|
+
catch (failure) {
|
|
613
|
+
return fail(`writing files failed (${failure.code ?? String(failure)}).`);
|
|
614
|
+
}
|
|
615
|
+
const domain = launchdDomain() ?? 'gui';
|
|
616
|
+
const loaded = spawnText('launchctl', ['bootstrap', domain, plistFile], io.env, 60_000);
|
|
617
|
+
if (loaded.error !== undefined || loaded.status !== 0) {
|
|
618
|
+
return fail(`launchctl bootstrap ${domain} ${plistFile} failed`
|
|
619
|
+
+ ` (${loaded.error?.message ?? `code ${String(loaded.status)}`}${loaded.stderr.trim() === '' ? ''
|
|
620
|
+
: `: ${loaded.stderr.trim()}`}).`);
|
|
621
|
+
}
|
|
622
|
+
out(io, ` bootstrap ${domain} ${plistFile}`);
|
|
623
|
+
out(io, ` restart.sh with label ${SERVICE_LABEL}, port ${String(port)}:`);
|
|
624
|
+
const result = await runRestartScript(scriptEnv(io, {
|
|
625
|
+
RAROG_RESTART_LABEL: SERVICE_LABEL,
|
|
626
|
+
RAROG_RESTART_PORT: String(port),
|
|
627
|
+
RAROG_LOG: path.join(dataDir, 'server.log'),
|
|
628
|
+
}), output);
|
|
629
|
+
if (result.code !== 0) {
|
|
630
|
+
return fail(`${childExitText('restart.sh', result)}; the service is loaded, but unhealthy.`, result.code);
|
|
631
|
+
}
|
|
632
|
+
for (const line of rarogLinkLines(home, prepared.mode))
|
|
633
|
+
out(io, line);
|
|
634
|
+
out(io, `rarog service install: done — ${SERVICE_LABEL} is running. Check: ${rarogCli('doctor', prepared.mode)}.`);
|
|
635
|
+
return EXIT_OK;
|
|
636
|
+
}
|
|
637
|
+
function runPrecheck(precheck) {
|
|
638
|
+
const reason = precheck?.() ?? null;
|
|
639
|
+
if (reason !== null)
|
|
640
|
+
throw new Refusal(reason);
|
|
641
|
+
}
|
|
642
|
+
async function install(io, wait, precheck, deps = {}) {
|
|
643
|
+
refuseTransientInstall(io, deps);
|
|
644
|
+
const lock = acquireLock(rarogConfigDir(io.env), 'rarog service install');
|
|
645
|
+
try {
|
|
646
|
+
runPrecheck(precheck);
|
|
647
|
+
const mode = deps.mode ?? INSTALL_MODE;
|
|
648
|
+
const switching = packageSwitch(io, 'darwin', mode);
|
|
649
|
+
refuseSwitchWithoutTerminal(io, switching, SERVICE_LABEL);
|
|
650
|
+
const unknown = unknownTarget(io, 'darwin', mode);
|
|
651
|
+
refuseUnknownWithoutTerminal(io, unknown, SERVICE_LABEL);
|
|
652
|
+
const prepared = await prepare(io, mode, deps.dataDir);
|
|
653
|
+
await confirmSwitch(io, switching, prepared, SERVICE_LABEL);
|
|
654
|
+
await confirmUnknownTarget(io, unknown, prepared, SERVICE_LABEL);
|
|
655
|
+
return await apply(io, prepared, wait, deps.output);
|
|
656
|
+
}
|
|
657
|
+
finally {
|
|
658
|
+
lock.release();
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
async function uninstall(io, wait, deps = {}) {
|
|
662
|
+
const home = homeOf(io.env);
|
|
663
|
+
const mode = deps.mode ?? INSTALL_MODE;
|
|
664
|
+
const lock = acquireLock(rarogConfigDir(io.env), 'rarog service uninstall');
|
|
665
|
+
try {
|
|
666
|
+
// „Nie wiem” = odmowa przed `bootout` i przed usunięciem plistu; etykieta, której launchd nie zdjął w limicie,
|
|
667
|
+
// też zostawia plist.
|
|
668
|
+
const wasLoaded = decidedLoadState(SERVICE_LABEL, io) === 'loaded';
|
|
669
|
+
const issue = bootout(SERVICE_LABEL, io, wait);
|
|
670
|
+
if (issue !== null)
|
|
671
|
+
throw new Refusal(`${issue} The plist stays.`);
|
|
672
|
+
const plistFile = servicePlistPath(home);
|
|
673
|
+
const hadPlist = existsSync(plistFile);
|
|
674
|
+
const dataDir = uninstalledDataDir(io, 'darwin', home);
|
|
675
|
+
rmSync(plistFile, { force: true });
|
|
676
|
+
out(io, `rarog service uninstall: ${wasLoaded ? `${SERVICE_LABEL} unloaded (the service server is STOPPED)`
|
|
677
|
+
: `${SERVICE_LABEL} was not loaded`}, ${hadPlist ? `${plistFile} removed` : `${plistFile} did not exist`}.`
|
|
678
|
+
+ ' The data directory, ~/.config/rarog stay.');
|
|
679
|
+
const linkLine = removeRarogLink(home, mode);
|
|
680
|
+
if (linkLine !== null)
|
|
681
|
+
out(io, linkLine);
|
|
682
|
+
out(io, `Reinstall: ${rarogCli('service install', mode)}.`);
|
|
683
|
+
// The herdr agent is not Rarog's service: it stays, and the lines say how to remove it.
|
|
684
|
+
for (const one of herdrAgentUninstallLines(home))
|
|
685
|
+
out(io, one);
|
|
686
|
+
await packageUninstall(io, home, mode, uninstallPaths(io, deps, dataDir));
|
|
687
|
+
return EXIT_OK;
|
|
688
|
+
}
|
|
689
|
+
finally {
|
|
690
|
+
lock.release();
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
// ---------------------------------------------------------------------------
|
|
694
|
+
// Linux: jednostka systemd --user
|
|
695
|
+
// ---------------------------------------------------------------------------
|
|
696
|
+
const NOTHING_CHANGED = 'Nothing was changed.';
|
|
697
|
+
/**
|
|
698
|
+
* Komendy powrotu po porażce fazy 1 na Linuksie: wyłączenie i zatrzymanie jednostki, usunięcie jej pliku,
|
|
699
|
+
* przeładowanie menedżera; dane i konfiguracja zostają.
|
|
700
|
+
*/
|
|
701
|
+
export function unitRollbackLines(home, mode = INSTALL_MODE) {
|
|
702
|
+
return [
|
|
703
|
+
`ROLLBACK (disables ${UNIT_NAME}; data and config stay), in a shell:`,
|
|
704
|
+
...cdLines(mode),
|
|
705
|
+
` ${rarogCli('service uninstall', mode)}`,
|
|
706
|
+
'Without the CLI (this also breaks the Restart=always loop of the new unit):',
|
|
707
|
+
` systemctl --user disable --now ${UNIT_NAME}`,
|
|
708
|
+
` rm ${quote(unitFilePath(home))}`,
|
|
709
|
+
' systemctl --user daemon-reload',
|
|
710
|
+
];
|
|
711
|
+
}
|
|
712
|
+
/** Kod albo błąd uruchomienia i pierwsza linia stderr — bez stdout. */
|
|
713
|
+
function failureText(result) {
|
|
714
|
+
if (result.error !== undefined)
|
|
715
|
+
return result.error.message;
|
|
716
|
+
const how = result.status === null ? `signal ${String(result.signal)}` : `code ${String(result.status)}`;
|
|
717
|
+
const first = (result.stderr.trim().split('\n')[0] ?? '').trim();
|
|
718
|
+
return `${how}${first === '' ? '' : `: ${first}`}`;
|
|
719
|
+
}
|
|
720
|
+
function failed(result) {
|
|
721
|
+
return result.error !== undefined || result.status !== 0;
|
|
722
|
+
}
|
|
723
|
+
function systemctlUser(args, io) {
|
|
724
|
+
return spawnText('systemctl', ['--user', ...args], io.env, 60_000);
|
|
725
|
+
}
|
|
726
|
+
/**
|
|
727
|
+
* `systemd-analyze verify` jednostki z szablonu w pliku tymczasowym (nazwa `*.service`) w katalogu konfiguracji
|
|
728
|
+
* (0700, blokada już jest nasza). Tryb systemowy, bo `--user verify` bez menedżera pada; brak narzędzia to
|
|
729
|
+
* linia „nie sprawdzone”, nie odmowa.
|
|
730
|
+
*/
|
|
731
|
+
function verifyUnit(text, io) {
|
|
732
|
+
const file = path.join(rarogConfigDir(io.env), 'rarog-sprawdzany.service');
|
|
733
|
+
writeFileSync(file, text, { mode: 0o600 });
|
|
734
|
+
try {
|
|
735
|
+
const verify = spawnText('systemd-analyze', ['verify', file], io.env, 60_000);
|
|
736
|
+
if (verify.error?.code === 'ENOENT') {
|
|
737
|
+
out(io, ' unit from the template: systemd-analyze verify not checked (no systemd-analyze in PATH)');
|
|
738
|
+
return;
|
|
739
|
+
}
|
|
740
|
+
if (failed(verify)) {
|
|
741
|
+
const detail = verify.error?.message ?? `${verify.stdout}${verify.stderr}`.trim();
|
|
742
|
+
throw new Refusal(`the unit from the template fails systemd-analyze verify (${detail}). ${NOTHING_STOPPED}`);
|
|
743
|
+
}
|
|
744
|
+
out(io, ' unit from the template: systemd-analyze verify OK');
|
|
745
|
+
}
|
|
746
|
+
finally {
|
|
747
|
+
rmSync(file, { force: true });
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
/** Wartość linii `<etykieta>: <wartość>` z wyjścia `rarog serve --check` (ostatnie wystąpienie); `null` = brak. */
|
|
751
|
+
export function checkValue(stdout, label) {
|
|
752
|
+
const lines = stdout.split('\n').filter((line) => line.startsWith(`${label}: `));
|
|
753
|
+
const last = lines.at(-1);
|
|
754
|
+
return last === undefined ? null : last.slice(label.length + 2);
|
|
755
|
+
}
|
|
756
|
+
/** Faza 0 na Linuksie: każda odmowa tutaj pada, zanim cokolwiek zostanie zapisane albo zatrzymane. */
|
|
757
|
+
async function prepareUnit(io, mode, given) {
|
|
758
|
+
const home = homeOf(io.env);
|
|
759
|
+
out(io, 'rarog service install — phase 0 (checks, stops nothing):');
|
|
760
|
+
for (const name of PROCESS_NAMES) {
|
|
761
|
+
if ((io.env[name] ?? '') !== '') {
|
|
762
|
+
throw new Refusal(`${name} is set in this shell, but the systemd --user unit gets the manager environment`
|
|
763
|
+
+ ' without it; the data directory of the installation and of the service would differ (the hook in Claude'
|
|
764
|
+
+ ` sessions too). Run install without this variable. ${NOTHING_STOPPED}`);
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
// Środowisko menedżera użytkownika dziedziczy każda jednostka (`set-environment` też), więc to ono decyduje.
|
|
768
|
+
const manager = managerEnvironment(io);
|
|
769
|
+
if ('failure' in manager) {
|
|
770
|
+
throw new Refusal(`the systemd --user manager environment (busctl … Manager Environment) is unreadable`
|
|
771
|
+
+ ` (${manager.failure}), and that is what the service gets. ${NOTHING_STOPPED}`);
|
|
772
|
+
}
|
|
773
|
+
for (const name of PROCESS_NAMES) {
|
|
774
|
+
if ((manager.env[name] ?? '') !== '') {
|
|
775
|
+
throw new Refusal(`${name} is set in the systemd --user manager environment, so the service would get it;`
|
|
776
|
+
+ ` the data directory would differ from the checked one. Remove it: systemctl --user unset-environment`
|
|
777
|
+
+ ` ${name}. ${NOTHING_STOPPED}`);
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
const unitDir = userUnitDir(home);
|
|
781
|
+
const unitPath = managerStrings(io, 'UnitPath');
|
|
782
|
+
if ('failure' in unitPath) {
|
|
783
|
+
throw new Refusal(`the unit search path of the manager (busctl … Manager UnitPath) is unreadable`
|
|
784
|
+
+ ` (${unitPath.failure}). ${NOTHING_STOPPED}`);
|
|
785
|
+
}
|
|
786
|
+
if (!unitPath.values.some((dir) => samePath(dir, unitDir))) {
|
|
787
|
+
throw new Refusal(`the systemd --user manager does not look for units in ${unitDir} (not in UnitPath; another`
|
|
788
|
+
+ ' XDG_CONFIG_HOME of the manager?), so a unit written there would be invisible. Run install in a regular'
|
|
789
|
+
+ ` user session. ${NOTHING_STOPPED}`);
|
|
790
|
+
}
|
|
791
|
+
const early = showUnit(io, UNIT_STATE_PROPS, UNIT_ENV_PROPS);
|
|
792
|
+
if ('failure' in early) {
|
|
793
|
+
throw new Refusal(`systemctl --user show ${UNIT_NAME} does not decide the unit state (${early.failure}).`
|
|
794
|
+
+ ` ${NOTHING_STOPPED}`);
|
|
795
|
+
}
|
|
796
|
+
const dropIns = (early.values.get('DropInPaths') ?? '').trim();
|
|
797
|
+
if (dropIns !== '') {
|
|
798
|
+
throw new Refusal(`${UNIT_NAME} has drop-ins (${dropIns}): they survive a reinstall and can change the start or`
|
|
799
|
+
+ ' the environment of the service. Remove them and run systemctl --user daemon-reload; server variables go to'
|
|
800
|
+
+ ` config.json. ${NOTHING_STOPPED}`);
|
|
801
|
+
}
|
|
802
|
+
if (!serviceNodeVersionOk(process.versions.node)) {
|
|
803
|
+
throw new Refusal(`the node of this installation is v${process.versions.node} (${process.execPath}), but the`
|
|
804
|
+
+ ` service requires ${nodeRequirement()} (process.execve); this path goes into the unit. Run install with such`
|
|
805
|
+
+ ' a node.');
|
|
806
|
+
}
|
|
807
|
+
out(io, ` service node: ${serviceTarget().node} (v${process.versions.node})`);
|
|
808
|
+
const missing = LINUX_RESTART_TOOLS.filter((tool) => !onPath(tool, io.env));
|
|
809
|
+
if (missing.length > 0) {
|
|
810
|
+
throw new Refusal(`missing in PATH: ${missing.join(', ')}; restart.sh needs them for health (curl) and for`
|
|
811
|
+
+ ` stopping by pattern (ps, pgrep). Install them (e.g. the curl and procps packages). ${NOTHING_STOPPED}`);
|
|
812
|
+
}
|
|
813
|
+
// Konfiguracja, katalog danych i port tak, jak zobaczy je usługa: środowisko menedżera, nie ta powłoka.
|
|
814
|
+
let built;
|
|
815
|
+
try {
|
|
816
|
+
built = buildServeEnv(manager.env, { env: {}, mode: 'check' });
|
|
817
|
+
}
|
|
818
|
+
catch (failure) {
|
|
819
|
+
if (failure instanceof Refusal)
|
|
820
|
+
throw new Refusal(`${failure.message} ${NOTHING_STOPPED}`);
|
|
821
|
+
throw failure;
|
|
822
|
+
}
|
|
823
|
+
if (built.config === null) {
|
|
824
|
+
throw new Refusal(`no ${path.join(rarogConfigDir(manager.env), 'config.json')}; the service starts \`rarog serve\``
|
|
825
|
+
+ ` without flags, so it does not come up without a config file. ${NOTHING_STOPPED}`);
|
|
826
|
+
}
|
|
827
|
+
const captured = [];
|
|
828
|
+
const quiet = { ...io, stdout: (text) => { captured.push(text); }, stderr: (text) => { captured.push(text); } };
|
|
829
|
+
const checked = await checkServeEnv(built, quiet, 'rarog serve --check');
|
|
830
|
+
if (!checked.ok) {
|
|
831
|
+
throw new Refusal(`the config fails the check. ${NOTHING_STOPPED}\n${captured.join('')}`.trimEnd());
|
|
832
|
+
}
|
|
833
|
+
out(io, ` config: ${built.config.file}, data directory ${checked.dataDir}, port ${String(checked.port)}`);
|
|
834
|
+
refuseOtherDataDir(given, checked.dataDir);
|
|
835
|
+
const socket = adminSocketPath(checked.dataDir);
|
|
836
|
+
if (Buffer.byteLength(socket, 'utf8') > ADMIN_SOCKET_PATH_MAX) {
|
|
837
|
+
throw new Refusal(`the admin socket path ${socket} has ${String(Buffer.byteLength(socket, 'utf8'))} B, but the`
|
|
838
|
+
+ ` server creates a socket of at most ${String(ADMIN_SOCKET_PATH_MAX)} B (the macOS cap, the same on Linux).`
|
|
839
|
+
+ ` Choose a shorter data directory. ${NOTHING_STOPPED}`);
|
|
840
|
+
}
|
|
841
|
+
// Serwer tych danych na innym porcie (np. `rarog serve` z ręki przed zmianą `RAROG_PORT`) zostałby
|
|
842
|
+
// obok jednostki — `restart.sh` zatrzymuje tylko serwer portu z konfiguracji. Ta sama reguła co w `rarog restart`.
|
|
843
|
+
if (await accepts({ path: socket }) && !await accepts({ host: '127.0.0.1', port: checked.port })) {
|
|
844
|
+
throw new Refusal(`the server of data directory ${checked.dataDir} is running (socket ${socket}), but not on`
|
|
845
|
+
+ ` port ${String(checked.port)} from the config; RAROG_PORT changed? restart.sh stops only the server on that`
|
|
846
|
+
+ ' port, so the old one would stay next to the new one on the same data. Stop the old server by hand and'
|
|
847
|
+
+ ` repeat install. ${NOTHING_STOPPED}`);
|
|
848
|
+
}
|
|
849
|
+
const wrapper = built.config.wrapper ?? [];
|
|
850
|
+
const head = wrapper[0];
|
|
851
|
+
if (head !== undefined) {
|
|
852
|
+
if (!path.isAbsolute(head)) {
|
|
853
|
+
throw new Refusal(`service.wrapper starts with "${head}", but the unit needs an absolute path`
|
|
854
|
+
+ ` (fix ${built.config.file}). ${NOTHING_STOPPED}`);
|
|
855
|
+
}
|
|
856
|
+
try {
|
|
857
|
+
accessSync(head, constants.X_OK);
|
|
858
|
+
}
|
|
859
|
+
catch {
|
|
860
|
+
throw new Refusal(`service.wrapper: ${head} does not exist or is not executable. ${NOTHING_STOPPED}`);
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
const execStart = serviceArgv(wrapper, ['serve']);
|
|
864
|
+
let unit;
|
|
865
|
+
try {
|
|
866
|
+
unit = renderServiceUnit({ execStart, workingDirectory: INSTALL_ROOT, log: path.join(checked.dataDir, 'server.log') });
|
|
867
|
+
}
|
|
868
|
+
catch (failure) {
|
|
869
|
+
if (failure instanceof Refusal)
|
|
870
|
+
throw new Refusal(`${failure.message} ${NOTHING_STOPPED}`);
|
|
871
|
+
throw failure;
|
|
872
|
+
}
|
|
873
|
+
verifyUnit(unit, io);
|
|
874
|
+
// Pełny poziom `--check`: przez wrapper, z sekretami, na środowisku menedżera (to dostanie usługa).
|
|
875
|
+
const command = serviceArgv(wrapper, ['serve', '--check']);
|
|
876
|
+
out(io, ` rarog serve --check ${wrapper.length > 0 ? 'through service.wrapper' : 'without a wrapper'}:`);
|
|
877
|
+
const full = spawnText(command[0] ?? process.execPath, command.slice(1), manager.env, WRAPPER_CHECK_TIMEOUT_MS);
|
|
878
|
+
for (const line of indented(full.stdout ?? ''))
|
|
879
|
+
out(io, line);
|
|
880
|
+
for (const line of indented(full.stderr ?? ''))
|
|
881
|
+
err(io, line);
|
|
882
|
+
if (failed(full)) {
|
|
883
|
+
throw new Refusal(`rarog serve --check ${wrapper.length > 0 ? 'through service.wrapper ' : ''}failed`
|
|
884
|
+
+ ` (${full.error?.message ?? `code ${String(full.status)}`}). ${NOTHING_STOPPED}`);
|
|
885
|
+
}
|
|
886
|
+
if (wrapper.length > 0 && (full.stdout ?? '').split('\n').some((line) => line.trim() === SECRETS_UNCHECKED_LINE)) {
|
|
887
|
+
throw new Refusal(`${WRAPPER_WITHOUT_SECRETS} ${NOTHING_STOPPED}`);
|
|
888
|
+
}
|
|
889
|
+
// Wrapper może dołożyć zmienną katalogu danych (albo portu) — wtedy usługa pracowałaby na innych
|
|
890
|
+
// danych niż hook i niż katalog logu w jednostce. Porównanie z liniami pełnego `--check`.
|
|
891
|
+
const seenDataDir = checkValue(full.stdout ?? '', CHECK_DATA_DIR_LABEL);
|
|
892
|
+
const seenPort = checkValue(full.stdout ?? '', CHECK_PORT_LABEL);
|
|
893
|
+
if (seenDataDir !== checked.dataDir || seenPort !== String(checked.port)) {
|
|
894
|
+
throw new Refusal(`the full rarog serve --check${wrapper.length > 0 ? ' through service.wrapper' : ''} sees data`
|
|
895
|
+
+ ` directory ${seenDataDir ?? '?'} and port ${seenPort ?? '?'}, but the check without the wrapper`
|
|
896
|
+
+ ` ${checked.dataDir} and ${String(checked.port)}; does the wrapper set ${PROCESS_NAMES.join(', ')}, HOME or`
|
|
897
|
+
+ ` RAROG_PORT? The service would work on other data than the hook. ${NOTHING_STOPPED}`);
|
|
898
|
+
}
|
|
899
|
+
// Stan jednostki na końcu fazy 0, tuż przed zapisem: brak albo nasza (także zmieniona ręcznie — zapis ją
|
|
900
|
+
// nadpisze); cudza, zamaskowana, z drop-inem, z błędem albo „nie wiem” = odmowa.
|
|
901
|
+
const final = showUnit(io, UNIT_STATE_PROPS, UNIT_ENV_PROPS);
|
|
902
|
+
if ('failure' in final) {
|
|
903
|
+
throw new Refusal(`systemctl --user show ${UNIT_NAME} does not decide the unit state (${final.failure}).`
|
|
904
|
+
+ ` ${NOTHING_STOPPED}`);
|
|
905
|
+
}
|
|
906
|
+
const status = classifyUnit(final.values, home);
|
|
907
|
+
switch (status.kind) {
|
|
908
|
+
case 'absent':
|
|
909
|
+
case 'ours':
|
|
910
|
+
case 'stale':
|
|
911
|
+
case 'environment':
|
|
912
|
+
break;
|
|
913
|
+
case 'masked':
|
|
914
|
+
throw new Refusal(`${UNIT_NAME} is masked (LoadState=masked). Unmask it: systemctl --user unmask`
|
|
915
|
+
+ ` ${UNIT_NAME}, then repeat install. ${NOTHING_STOPPED}`);
|
|
916
|
+
case 'foreign':
|
|
917
|
+
throw new Refusal(`${UNIT_NAME} is loaded from ${status.detail}, not from ${unitFilePath(home)}; this is a`
|
|
918
|
+
+ ` foreign unit with this name, install does not cover it. ${NOTHING_STOPPED}`);
|
|
919
|
+
case 'drop-in':
|
|
920
|
+
throw new Refusal(`${UNIT_NAME} has drop-ins (${status.detail}). Remove them and run systemctl --user`
|
|
921
|
+
+ ` daemon-reload. ${NOTHING_STOPPED}`);
|
|
922
|
+
default:
|
|
923
|
+
throw new Refusal(`${UNIT_NAME} has ${status.detail}; install handles only loaded or not-found. Check`
|
|
924
|
+
+ ` systemctl --user status ${UNIT_NAME}; remove a broken unit file (rm ${quote(unitFilePath(home))},`
|
|
925
|
+
+ ` systemctl --user daemon-reload) and repeat. ${NOTHING_STOPPED}`);
|
|
926
|
+
}
|
|
927
|
+
return { home, unit, argv: execStart, dataDir: checked.dataDir, port: checked.port, mode };
|
|
928
|
+
}
|
|
929
|
+
/**
|
|
930
|
+
* Linger użytkownika (`loginctl show-user … -p Linger --value`): bez niego menedżer użytkownika, a z nim usługa,
|
|
931
|
+
* żyje tylko z sesją logowania. `no` i „nie wiem” to ostrzeżenie z komendą, nie porażka instalacji.
|
|
932
|
+
*/
|
|
933
|
+
function lingerLine(io) {
|
|
934
|
+
const user = userInfo().username;
|
|
935
|
+
const enable = enableLingerCommand(user);
|
|
936
|
+
const linger = lingerState(io, user);
|
|
937
|
+
if ('failure' in linger) {
|
|
938
|
+
return ` linger: unknown (${linger.failure}); without linger the service lives only with a login session;`
|
|
939
|
+
+ ` enable it with ${enable}`;
|
|
940
|
+
}
|
|
941
|
+
const { value } = linger;
|
|
942
|
+
if (value === 'yes')
|
|
943
|
+
return ' linger: yes (the service comes up after a reboot without a login)';
|
|
944
|
+
return ` WARNING: linger disabled (Linger=${value || '?'}); after a logout and after a reboot the service does not`
|
|
945
|
+
+ ` come up without a login session. Enable it: ${enable}`;
|
|
946
|
+
}
|
|
947
|
+
/** Faza 1 na Linuksie; każda porażka, także wyjątek, wypisuje komendy powrotu. */
|
|
948
|
+
async function applyUnit(io, prepared, output) {
|
|
949
|
+
const { home, unit, dataDir, port } = prepared;
|
|
950
|
+
const fail = (what, code = EXIT_REFUSED) => {
|
|
951
|
+
err(io, `rarog service install: ${what}`);
|
|
952
|
+
for (const line of unitRollbackLines(home, prepared.mode))
|
|
953
|
+
err(io, line);
|
|
954
|
+
return code;
|
|
955
|
+
};
|
|
956
|
+
out(io, 'rarog service install — phase 1 (unit write and switch):');
|
|
957
|
+
try {
|
|
958
|
+
const file = unitFilePath(home);
|
|
959
|
+
try {
|
|
960
|
+
mkdirSync(userUnitDir(home), { recursive: true });
|
|
961
|
+
writeAtomic(file, unit);
|
|
962
|
+
}
|
|
963
|
+
catch (failure) {
|
|
964
|
+
return fail(`writing ${file} failed (${failure.code ?? String(failure)}).`);
|
|
965
|
+
}
|
|
966
|
+
out(io, ` unit ${file}`);
|
|
967
|
+
for (const args of [['daemon-reload'], ['enable', UNIT_NAME]]) {
|
|
968
|
+
const result = systemctlUser(args, io);
|
|
969
|
+
if (failed(result))
|
|
970
|
+
return fail(`systemctl --user ${args.join(' ')} failed (${failureText(result)}).`);
|
|
971
|
+
out(io, ` systemctl --user ${args.join(' ')}`);
|
|
972
|
+
}
|
|
973
|
+
mkdirSync(dataDir, { recursive: true, mode: 0o700 });
|
|
974
|
+
out(io, ` restart.sh with unit ${UNIT_NAME}, port ${String(port)}:`);
|
|
975
|
+
const result = await runRestartScript(scriptEnv(io, {
|
|
976
|
+
RAROG_RESTART_UNIT: UNIT_NAME,
|
|
977
|
+
RAROG_RESTART_PORT: String(port),
|
|
978
|
+
RAROG_LOG: path.join(dataDir, 'server.log'),
|
|
979
|
+
}), output);
|
|
980
|
+
if (result.code !== 0) {
|
|
981
|
+
return fail(`${childExitText('restart.sh', result)}; the unit is enabled, but unhealthy.`, result.code);
|
|
982
|
+
}
|
|
983
|
+
out(io, lingerLine(io));
|
|
984
|
+
for (const line of rarogLinkLines(home, prepared.mode))
|
|
985
|
+
out(io, line);
|
|
986
|
+
out(io, `rarog service install: done — ${UNIT_NAME} is running. Check: ${rarogCli('doctor', prepared.mode)}.`);
|
|
987
|
+
return EXIT_OK;
|
|
988
|
+
}
|
|
989
|
+
catch (failure) {
|
|
990
|
+
return fail(failure instanceof Error ? failure.message : String(failure));
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
/** `rarog service install` na Linuksie. */
|
|
994
|
+
export async function installUnit(io, precheck, deps = {}) {
|
|
995
|
+
refuseTransientInstall(io, deps);
|
|
996
|
+
const lock = acquireLock(rarogConfigDir(io.env), 'rarog service install');
|
|
997
|
+
try {
|
|
998
|
+
runPrecheck(precheck);
|
|
999
|
+
const mode = deps.mode ?? INSTALL_MODE;
|
|
1000
|
+
const switching = packageSwitch(io, 'linux', mode);
|
|
1001
|
+
refuseSwitchWithoutTerminal(io, switching, UNIT_NAME);
|
|
1002
|
+
const unknown = unknownTarget(io, 'linux', mode);
|
|
1003
|
+
refuseUnknownWithoutTerminal(io, unknown, UNIT_NAME);
|
|
1004
|
+
const prepared = await prepareUnit(io, mode, deps.dataDir);
|
|
1005
|
+
await confirmSwitch(io, switching, prepared, UNIT_NAME);
|
|
1006
|
+
await confirmUnknownTarget(io, unknown, prepared, UNIT_NAME);
|
|
1007
|
+
return await applyUnit(io, prepared, deps.output);
|
|
1008
|
+
}
|
|
1009
|
+
finally {
|
|
1010
|
+
lock.release();
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
/**
|
|
1014
|
+
* `rarog service uninstall` on Linux: `disable --now`, unit file removal, `daemon-reload`. The unit is touched only
|
|
1015
|
+
* when it is loaded from our file (also with a drop-in or edited by hand); a foreign, masked or failed unit, or an
|
|
1016
|
+
* undecided state, is a refusal before anything changes. Data and config stay; in a clone this clone's
|
|
1017
|
+
* `~/.local/bin/rarog` symlink is removed ({@link removeRarogLink}).
|
|
1018
|
+
*/
|
|
1019
|
+
export async function uninstallUnit(io, deps = {}) {
|
|
1020
|
+
const home = homeOf(io.env);
|
|
1021
|
+
const mode = deps.mode ?? INSTALL_MODE;
|
|
1022
|
+
const lock = acquireLock(rarogConfigDir(io.env), 'rarog service uninstall');
|
|
1023
|
+
try {
|
|
1024
|
+
const shown = showUnit(io, UNIT_STATE_PROPS, UNIT_ENV_PROPS);
|
|
1025
|
+
if ('failure' in shown) {
|
|
1026
|
+
throw new Refusal(`systemctl --user show ${UNIT_NAME} does not decide the unit state (${shown.failure}).`
|
|
1027
|
+
+ ` ${NOTHING_CHANGED}`);
|
|
1028
|
+
}
|
|
1029
|
+
const file = unitFilePath(home);
|
|
1030
|
+
const status = classifyUnit(shown.values, home);
|
|
1031
|
+
let stopped = false;
|
|
1032
|
+
switch (status.kind) {
|
|
1033
|
+
case 'absent':
|
|
1034
|
+
break;
|
|
1035
|
+
case 'ours':
|
|
1036
|
+
case 'drop-in':
|
|
1037
|
+
case 'stale':
|
|
1038
|
+
case 'environment': {
|
|
1039
|
+
const disabled = systemctlUser(['disable', '--now', UNIT_NAME], io);
|
|
1040
|
+
if (failed(disabled)) {
|
|
1041
|
+
throw new Refusal(`systemctl --user disable --now ${UNIT_NAME} failed (${failureText(disabled)}).`
|
|
1042
|
+
+ ' The unit file stays.');
|
|
1043
|
+
}
|
|
1044
|
+
stopped = true;
|
|
1045
|
+
break;
|
|
1046
|
+
}
|
|
1047
|
+
case 'masked':
|
|
1048
|
+
throw new Refusal(`${UNIT_NAME} is masked (LoadState=masked); unmask it (systemctl --user unmask`
|
|
1049
|
+
+ ` ${UNIT_NAME}) and repeat. ${NOTHING_CHANGED}`);
|
|
1050
|
+
case 'foreign':
|
|
1051
|
+
throw new Refusal(`${UNIT_NAME} is loaded from ${status.detail}, not from ${file}; this is not a unit from`
|
|
1052
|
+
+ ` rarog service install. ${NOTHING_CHANGED}`);
|
|
1053
|
+
default:
|
|
1054
|
+
throw new Refusal(`${UNIT_NAME} has ${status.detail}; uninstall handles only loaded or not-found.`
|
|
1055
|
+
+ ` Check systemctl --user status ${UNIT_NAME}. ${NOTHING_CHANGED}`);
|
|
1056
|
+
}
|
|
1057
|
+
let hadFile = true;
|
|
1058
|
+
try {
|
|
1059
|
+
lstatSync(file);
|
|
1060
|
+
}
|
|
1061
|
+
catch {
|
|
1062
|
+
hadFile = false;
|
|
1063
|
+
}
|
|
1064
|
+
const dataDir = uninstalledDataDir(io, 'linux', home);
|
|
1065
|
+
rmSync(file, { force: true });
|
|
1066
|
+
const what = `${stopped ? `${UNIT_NAME} disabled (the service server is STOPPED)` : `${UNIT_NAME} was not loaded`},`
|
|
1067
|
+
+ ` ${hadFile ? `${file} removed` : `${file} did not exist`}`;
|
|
1068
|
+
if (stopped || hadFile) {
|
|
1069
|
+
const reload = systemctlUser(['daemon-reload'], io);
|
|
1070
|
+
if (failed(reload)) {
|
|
1071
|
+
err(io, `rarog service uninstall: ${what}, but systemctl --user daemon-reload failed`
|
|
1072
|
+
+ ` (${failureText(reload)}); run it by hand.`);
|
|
1073
|
+
return EXIT_REFUSED;
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
out(io, `rarog service uninstall: ${what}.${status.kind === 'drop-in' ? ` The drop-ins (${status.detail}) stay.`
|
|
1077
|
+
: ''} The data directory, ~/.config/rarog stay.`);
|
|
1078
|
+
const linkLine = removeRarogLink(home, mode);
|
|
1079
|
+
if (linkLine !== null)
|
|
1080
|
+
out(io, linkLine);
|
|
1081
|
+
out(io, `Reinstall: ${rarogCli('service install', mode)}.`);
|
|
1082
|
+
await packageUninstall(io, home, mode, uninstallPaths(io, deps, dataDir));
|
|
1083
|
+
return EXIT_OK;
|
|
1084
|
+
}
|
|
1085
|
+
finally {
|
|
1086
|
+
lock.release();
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
/**
|
|
1090
|
+
* Katalog danych usuwanej usługi, odczytany przed usunięciem jej pliku: katalog logu usługi, inaczej reguła na
|
|
1091
|
+
* środowisku bez zmiennych katalogu danych; `null` = konflikt reguły.
|
|
1092
|
+
*/
|
|
1093
|
+
function uninstalledDataDir(io, platform, home) {
|
|
1094
|
+
const resolved = resolveDataDir({ env: launchdEnv(io.env), home });
|
|
1095
|
+
return installedServiceDataDir(io, platform, home) ?? (resolved.ok ? resolved.dir : null);
|
|
1096
|
+
}
|
|
1097
|
+
function uninstallPaths(io, deps, dataDir) {
|
|
1098
|
+
return { installRoot: deps.installRoot ?? INSTALL_ROOT, dataDir, configDir: rarogConfigDir(io.env) };
|
|
1099
|
+
}
|
|
1100
|
+
/**
|
|
1101
|
+
* Zdanie o kopiach zapasowych `~/.claude/settings.json` w katalogu danych (pisarz ustawień kładzie je tam przed
|
|
1102
|
+
* każdym zapisem): `rm -r` katalogu danych usuwa też je, w tym kopię `backup` z tego przebiegu. Osobna linia
|
|
1103
|
+
* pod krokiem, żeby skopiowana linia z `rm -r` nie niosła zdania jako dalszych argumentów. `null`, gdy katalogu
|
|
1104
|
+
* danych nie znamy albo kopii nie ma.
|
|
1105
|
+
*/
|
|
1106
|
+
function backupsNote(dataDir, backup) {
|
|
1107
|
+
if (dataDir === null)
|
|
1108
|
+
return null;
|
|
1109
|
+
const dir = path.join(dataDir, SETTINGS_BACKUP_DIRNAME);
|
|
1110
|
+
let present = backup !== null;
|
|
1111
|
+
try {
|
|
1112
|
+
present ||= lstatSync(dir, { throwIfNoEntry: false }) !== undefined;
|
|
1113
|
+
}
|
|
1114
|
+
catch {
|
|
1115
|
+
present = true;
|
|
1116
|
+
}
|
|
1117
|
+
if (!present)
|
|
1118
|
+
return null;
|
|
1119
|
+
return ` The data directory also holds the backups of ${userSettingsPath('~')} (${quote(dir)}`
|
|
1120
|
+
+ `${backup === null ? '' : `, the one from this run: ${quote(backup)}`}); rm -r removes them too.`;
|
|
1121
|
+
}
|
|
1122
|
+
/** Ostatni krok: `rm -r` katalogu danych i konfiguracji (`number` = numer kroku), z kopiami zapasowymi ustawień. */
|
|
1123
|
+
function dataDirStep(number, home, paths, backup) {
|
|
1124
|
+
const { dataDir, configDir } = paths;
|
|
1125
|
+
const step = `${String(number)}. When you are done with Rarog`;
|
|
1126
|
+
const text = dataDir !== null && removableDataDir(dataDir, home)
|
|
1127
|
+
? `${step} (data, devices, SDK and config): rm -r ${quote(dataDir)} ${quote(configDir)}`
|
|
1128
|
+
: `${step}: rm -r ${quote(configDir)} (config); the data directory`
|
|
1129
|
+
+ ` ${dataDir === null ? 'from rarog doctor' : quote(dataDir)} gets no delete command, because it does not look`
|
|
1130
|
+
+ ` like a package data directory (no ${SDK_DIRNAME}/, or it is the home directory or above it); check it`
|
|
1131
|
+
+ ' yourself.';
|
|
1132
|
+
const note = backupsNote(dataDir, backup);
|
|
1133
|
+
return note === null ? [text] : [text, note];
|
|
1134
|
+
}
|
|
1135
|
+
/** Komenda menedżera, który położył paczkę (`install/repair.ts`). */
|
|
1136
|
+
function packageUninstallCommand(paths) {
|
|
1137
|
+
return packageCommands(packageManagerOf(paths.installRoot), paths.installRoot).uninstall;
|
|
1138
|
+
}
|
|
1139
|
+
/**
|
|
1140
|
+
* Reszta odinstalowania paczki npm do zrobienia ręcznie, po kolei: wpisy Raroga do usunięcia z ustawień Claude Code
|
|
1141
|
+
* (hooki zgód i kontekstu, `statusLine`, ścieżki `denyRead`, reguły blokady zapisu; po odinstalowaniu paczki
|
|
1142
|
+
* wskazywałyby kopię, której nikt już nie aktualizuje), katalog kopii hooka, komenda menedżera, który położył paczkę
|
|
1143
|
+
* (npm nie uruchamia przy tym skryptów paczki, więc niczego nie posprząta sam), na końcu opcjonalnie katalog danych
|
|
1144
|
+
* i konfiguracji. Drukuje je
|
|
1145
|
+
* {@link packageUninstall}, gdy wpisy zostają w ustawieniach („n”, brak terminala, konflikt, odmowa) albo wróciły do
|
|
1146
|
+
* nich w czasie pytania o kopię (`backup` = kopia zapasowa z zapisu w tym przebiegu). W klonie repo nic (hook zostaje
|
|
1147
|
+
* razem z checkoutem).
|
|
1148
|
+
*/
|
|
1149
|
+
export function packageUninstallNotes(home, mode = INSTALL_MODE, paths = { installRoot: INSTALL_ROOT, dataDir: null, configDir: path.join(home, '.config', 'rarog') }, backup = null) {
|
|
1150
|
+
if (mode !== 'package')
|
|
1151
|
+
return [];
|
|
1152
|
+
const deny = denyReadPaths(paths.dataDir ?? '<dataDir>').map((one) => JSON.stringify(one)).join(' and ');
|
|
1153
|
+
const block = paths.dataDir === null ? null : writeBlockRules(paths.dataDir, home);
|
|
1154
|
+
const rules = block?.ok === true ? block.rules.map((one) => JSON.stringify(one)).join(' and ')
|
|
1155
|
+
: '"Edit(//<dataDir>/**)" and "Edit(//<home>/.config/rarog/**)"';
|
|
1156
|
+
return [
|
|
1157
|
+
'',
|
|
1158
|
+
'Uninstalling Rarog, step by step (the service is already removed):',
|
|
1159
|
+
`1. In ${userSettingsPath('~')} remove by hand the hook entries of this block (keep the rest of \`hooks\`):`,
|
|
1160
|
+
renderPasteHookBlock(hookCommand(home), contextHookCommand(home)),
|
|
1161
|
+
' and the statusLine key, when it points to the copy of the Rarog script:',
|
|
1162
|
+
renderStatuslineBlock(statuslineCommand(home)),
|
|
1163
|
+
` and the paths ${deny} from sandbox.filesystem.denyRead,`,
|
|
1164
|
+
` and the rules ${rules} from permissions.deny.`,
|
|
1165
|
+
`2. Copy of the hook code and of the statusLine script: ${hookInstallDir(home)} (remove after the entries).`,
|
|
1166
|
+
`3. Package: ${packageUninstallCommand(paths)}`,
|
|
1167
|
+
...dataDirStep(4, home, paths, backup),
|
|
1168
|
+
];
|
|
1169
|
+
}
|
|
1170
|
+
/** Wcięcie linii pod nagłówkiem części odinstalowania: różnica, pytania i wyniki. */
|
|
1171
|
+
const UNDER = ' ';
|
|
1172
|
+
/**
|
|
1173
|
+
* Wpisy Raroga zostały w ustawieniach: powód (linie pod nagłówkiem) albo `null`, gdy ich tam już nie ma (zapis albo
|
|
1174
|
+
* nic do zdjęcia).
|
|
1175
|
+
*/
|
|
1176
|
+
function entriesLeft(result) {
|
|
1177
|
+
const byHand = 'nothing removed; remove them by hand (step 1 below)';
|
|
1178
|
+
switch (result.kind) {
|
|
1179
|
+
case 'unchanged':
|
|
1180
|
+
case 'written':
|
|
1181
|
+
return null;
|
|
1182
|
+
case 'declined':
|
|
1183
|
+
return [`answer no: ${byHand}`];
|
|
1184
|
+
case 'no-terminal':
|
|
1185
|
+
return [`without a terminal ${byHand}`];
|
|
1186
|
+
case 'conflict':
|
|
1187
|
+
return [`conflict: ${byHand}`, ...result.reasons.map((reason) => ` ${reason}`)];
|
|
1188
|
+
case 'copy-not-ready':
|
|
1189
|
+
return [`${result.reason}: ${byHand}`];
|
|
1190
|
+
case 'refused':
|
|
1191
|
+
return [`${result.reason}: ${byHand}`];
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
/** Nazwy wpisów do jednej linii wydruku. */
|
|
1195
|
+
const shown = (names) => names.map((one) => visibleLine(one)).join(', ');
|
|
1196
|
+
/**
|
|
1197
|
+
* Katalog kopii po zdjęciu wpisów: co zniknie (pliki z zamkniętej listy, {@link hookCopyDirState}) i co zostanie,
|
|
1198
|
+
* pytanie i usunięcie ({@link removeHookCopy}) po „y”, tuż przed nim ustawienia jeszcze raz ({@link copyRemovalCheck}).
|
|
1199
|
+
* Bez terminala, po „n” albo przy błędzie usuwania komenda do zrobienia ręcznie: `rm -r` katalogu, gdy są w nim
|
|
1200
|
+
* same pliki kopii, inaczej `rm` samych plików kopii. Katalog podmieniony w czasie pytania albo usuwania: powód, co
|
|
1201
|
+
* usunięte i co nie, bez komendy (trafiłaby w katalog, którego nikt nie pokazał). `manual` = w ustawieniach są znowu
|
|
1202
|
+
* wpisy Raroga albo nie da się ich odczytać: nic nie usunięte, dalej kroki ręczne.
|
|
1203
|
+
*/
|
|
1204
|
+
async function removeCopyStep(io, home, confirm) {
|
|
1205
|
+
const state = hookCopyDirState(home);
|
|
1206
|
+
const print = (line) => { out(io, `${UNDER}${line}`); };
|
|
1207
|
+
out(io, `Copy of the hook code and of the statusLine script: ${state.dir}`);
|
|
1208
|
+
if (state.kind === 'missing') {
|
|
1209
|
+
print('not there, nothing to remove');
|
|
1210
|
+
return 'done';
|
|
1211
|
+
}
|
|
1212
|
+
if (state.kind === 'refused') {
|
|
1213
|
+
print(state.reason);
|
|
1214
|
+
return 'done';
|
|
1215
|
+
}
|
|
1216
|
+
print(`to remove: ${shown(state.remove)}`);
|
|
1217
|
+
if (state.keep.length > 0)
|
|
1218
|
+
print(`stays, not from a Rarog install: ${shown(state.keep)}`);
|
|
1219
|
+
/** Komenda ręczna dla plików kopii `names`, które jeszcze są w katalogu. */
|
|
1220
|
+
const byHand = (names) => {
|
|
1221
|
+
if (names.length === 0)
|
|
1222
|
+
return `remove the empty directory by hand: rmdir ${quote(state.dir)}`;
|
|
1223
|
+
return state.keep.length === 0
|
|
1224
|
+
? `remove it by hand: rm -r ${quote(state.dir)}`
|
|
1225
|
+
: `remove the Rarog files by hand: rm ${names.map((one) => quote(path.join(state.dir, one))).join(' ')}`;
|
|
1226
|
+
};
|
|
1227
|
+
if (confirm === null) {
|
|
1228
|
+
print(`without a terminal it stays; ${byHand(state.remove)}`);
|
|
1229
|
+
return 'done';
|
|
1230
|
+
}
|
|
1231
|
+
const question = state.keep.length === 0
|
|
1232
|
+
? 'Remove these files and the directory?' : 'Remove these files? The directory stays with the rest.';
|
|
1233
|
+
if (!(await confirm(question))) {
|
|
1234
|
+
print(`kept; ${byHand(state.remove)}`);
|
|
1235
|
+
return 'done';
|
|
1236
|
+
}
|
|
1237
|
+
// W czasie pytania ktoś mógł dopisać wpis Raroga do ustawień: po usunięciu wskazywałby brakujący plik.
|
|
1238
|
+
const check = copyRemovalCheck(home, 'rarog service uninstall');
|
|
1239
|
+
if (!check.ok) {
|
|
1240
|
+
print(`${check.reason}; nothing removed`);
|
|
1241
|
+
for (const entry of check.entries)
|
|
1242
|
+
print(` ${entry}`);
|
|
1243
|
+
return 'manual';
|
|
1244
|
+
}
|
|
1245
|
+
const removed = removeHookCopy(state);
|
|
1246
|
+
if (removed.ok) {
|
|
1247
|
+
print(removed.dirRemoved
|
|
1248
|
+
? `removed: ${state.dir}`
|
|
1249
|
+
: `removed: ${shown(removed.removed)}; ${state.dir} stays with: ${shown(removed.left)}`);
|
|
1250
|
+
return 'done';
|
|
1251
|
+
}
|
|
1252
|
+
print(removed.reason);
|
|
1253
|
+
if (removed.removed.length > 0) {
|
|
1254
|
+
print(`removed: ${shown(removed.removed)}`);
|
|
1255
|
+
if (removed.notRemoved.length > 0)
|
|
1256
|
+
print(`not removed: ${shown(removed.notRemoved)}`);
|
|
1257
|
+
}
|
|
1258
|
+
if (removed.why === 'failed')
|
|
1259
|
+
print(`then ${byHand(removed.notRemoved)}`);
|
|
1260
|
+
return 'done';
|
|
1261
|
+
}
|
|
1262
|
+
/**
|
|
1263
|
+
* Po `uninstall` w paczce npm: zdjęcie wpisów Raroga z `~/.claude/settings.json` pisarzem ustawień (operacja
|
|
1264
|
+
* `remove`: one `[y/N/d]` question as in `rarog setup`, the diff only on `d`; „y”, kopia zapasowa, zapis; blokadę
|
|
1265
|
+
* trzyma już `uninstall`), potem pytanie o katalog kopii, na końcu wydruk komendy menedżera paczek i katalogów danych
|
|
1266
|
+
* i konfiguracji. Katalog kopii idzie tylko wtedy, gdy wpisów Raroga w ustawieniach już nie ma (zapis albo nic do
|
|
1267
|
+
* zdjęcia), bo inaczej wskazywałyby brakujący plik; po „y” sprawdza to jeszcze raz. „n”, EOF, brak terminala,
|
|
1268
|
+
* konflikt i odmowa pisarza, a także wpisy, które wróciły w czasie pytania o kopię = kroki ręczne
|
|
1269
|
+
* {@link packageUninstallNotes}; kod wyjścia `uninstall` się nie zmienia. W klonie repo nic.
|
|
1270
|
+
*/
|
|
1271
|
+
async function packageUninstall(io, home, mode, paths) {
|
|
1272
|
+
if (mode !== 'package')
|
|
1273
|
+
return;
|
|
1274
|
+
const ask = io.ask;
|
|
1275
|
+
const confirm = ask === undefined
|
|
1276
|
+
? null : async (question) => isYes(await ask(`${UNDER}${question} [y/N] `));
|
|
1277
|
+
const print = (line) => { out(io, `${UNDER}${line}`); };
|
|
1278
|
+
out(io, '');
|
|
1279
|
+
out(io, `Rarog entries in ${userSettingsPath('~')} (hook entries, statusLine, denyRead paths, write block rules):`);
|
|
1280
|
+
const result = await writeClaudeSettings({
|
|
1281
|
+
home, root: paths.installRoot, operation: 'remove',
|
|
1282
|
+
dataDir: paths.dataDir === null
|
|
1283
|
+
? { ok: false, message: 'the data directory rule gives a conflict (rarog doctor shows it)' }
|
|
1284
|
+
: { ok: true, dir: paths.dataDir },
|
|
1285
|
+
lock: 'held', print, again: 'rarog service uninstall',
|
|
1286
|
+
confirm: ask === undefined ? null : (question) => confirmForm(ask, entriesQuestion(question), 'y/N/d', {
|
|
1287
|
+
width: layoutOf(terminalOf(io).columns).width,
|
|
1288
|
+
showDiff: () => { for (const one of entriesDiff(question))
|
|
1289
|
+
print(one); },
|
|
1290
|
+
}),
|
|
1291
|
+
// The diff quotes the user's file: only on the answer `d`, never up front.
|
|
1292
|
+
printDiff: () => { },
|
|
1293
|
+
});
|
|
1294
|
+
const left = entriesLeft(result);
|
|
1295
|
+
if (left !== null) {
|
|
1296
|
+
for (const line of left)
|
|
1297
|
+
print(line);
|
|
1298
|
+
for (const note of packageUninstallNotes(home, mode, paths))
|
|
1299
|
+
out(io, note);
|
|
1300
|
+
return;
|
|
1301
|
+
}
|
|
1302
|
+
if (result.kind === 'unchanged')
|
|
1303
|
+
print('none left, nothing to remove');
|
|
1304
|
+
const backup = result.kind === 'written' ? result.backup : null;
|
|
1305
|
+
if (await removeCopyStep(io, home, confirm) === 'manual') {
|
|
1306
|
+
for (const note of packageUninstallNotes(home, mode, paths, backup))
|
|
1307
|
+
out(io, note);
|
|
1308
|
+
return;
|
|
1309
|
+
}
|
|
1310
|
+
out(io, '');
|
|
1311
|
+
out(io, 'Uninstalling Rarog, the remaining steps:');
|
|
1312
|
+
out(io, `1. Package: ${packageUninstallCommand(paths)}`);
|
|
1313
|
+
for (const line of dataDirStep(2, home, paths, backup))
|
|
1314
|
+
out(io, line);
|
|
1315
|
+
}
|
|
1316
|
+
/**
|
|
1317
|
+
* Katalog danych, który komenda kasowania z {@link packageUninstallNotes} może podać: nie katalog domowy ani katalog
|
|
1318
|
+
* nad nim, z podkatalogiem `sdk/` (`rarog setup` paczki zakłada go zawsze). Katalog danych bierze się z katalogu
|
|
1319
|
+
* logu usługi, więc plik usługi zmieniony ręcznie (np. log w katalogu domowym) nie trafia do `rm -r`.
|
|
1320
|
+
*/
|
|
1321
|
+
export function removableDataDir(dir, home) {
|
|
1322
|
+
const toHome = path.relative(path.resolve(dir), path.resolve(home));
|
|
1323
|
+
if (toHome !== '..' && !toHome.startsWith(`..${path.sep}`))
|
|
1324
|
+
return false;
|
|
1325
|
+
return lstatSync(path.join(dir, SDK_DIRNAME), { throwIfNoEntry: false })?.isDirectory() === true;
|
|
1326
|
+
}
|
|
1327
|
+
/** `rarog service install|uninstall` — `argv` zaczyna się od `service`; `wait` podają testy (krótszy limit). */
|
|
1328
|
+
export async function serviceCommand(argv, io, wait = BOOTOUT_WAIT, deps = {}) {
|
|
1329
|
+
if (argv.includes('--help') || argv.includes('-h')) {
|
|
1330
|
+
out(io, usageFor(io, `Usage:\n${SERVICE_USAGE}`));
|
|
1331
|
+
return EXIT_OK;
|
|
1332
|
+
}
|
|
1333
|
+
const action = argv[1];
|
|
1334
|
+
if (argv.length !== 2 || (action !== 'install' && action !== 'uninstall')) {
|
|
1335
|
+
throw new Usage('rarog service: expected install or uninstall, with no other arguments.');
|
|
1336
|
+
}
|
|
1337
|
+
try {
|
|
1338
|
+
const platform = platformOf(io);
|
|
1339
|
+
const issue = servicePlatformIssue(platform);
|
|
1340
|
+
if (issue !== null)
|
|
1341
|
+
throw new Refusal(issue);
|
|
1342
|
+
if (platform === 'linux') {
|
|
1343
|
+
return action === 'install' ? await installUnit(io, undefined, deps) : await uninstallUnit(io, deps);
|
|
1344
|
+
}
|
|
1345
|
+
return action === 'install' ? await install(io, wait, undefined, deps) : await uninstall(io, wait, deps);
|
|
1346
|
+
}
|
|
1347
|
+
catch (failure) {
|
|
1348
|
+
if (failure instanceof Refusal) {
|
|
1349
|
+
err(io, `rarog service ${action}: ${failure.message}`);
|
|
1350
|
+
return EXIT_REFUSED;
|
|
1351
|
+
}
|
|
1352
|
+
throw failure;
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
/**
|
|
1356
|
+
* `rarog service install` dla `rarog setup`: to samo co `serviceCommand(['service', 'install'])`, ale pod blokadą
|
|
1357
|
+
* instalatora najpierw `precheck` — usługa zainstalowana w trakcie pytania (drugi `setup`, ręczne `service install`)
|
|
1358
|
+
* daje odmowę, zanim padnie pierwszy `bootout` albo zapis.
|
|
1359
|
+
*/
|
|
1360
|
+
export async function serviceInstallIfAbsent(io, precheck, wait = BOOTOUT_WAIT, deps = {}) {
|
|
1361
|
+
try {
|
|
1362
|
+
const platform = platformOf(io);
|
|
1363
|
+
const issue = servicePlatformIssue(platform);
|
|
1364
|
+
if (issue !== null)
|
|
1365
|
+
throw new Refusal(issue);
|
|
1366
|
+
return platform === 'linux' ? await installUnit(io, precheck, deps) : await install(io, wait, precheck, deps);
|
|
1367
|
+
}
|
|
1368
|
+
catch (failure) {
|
|
1369
|
+
if (failure instanceof Refusal) {
|
|
1370
|
+
err(io, `rarog service install: ${failure.message}`);
|
|
1371
|
+
return EXIT_REFUSED;
|
|
1372
|
+
}
|
|
1373
|
+
throw failure;
|
|
1374
|
+
}
|
|
1375
|
+
}
|