@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,1528 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `rarog doctor`: jedna linia na sprawdzenie, stany — zielony,
|
|
3
|
+
* czerwony z komendą naprawy, „nie wiem” (np. `ps` w sandboksie sesji agenta: ani sukces, ani błąd), żółty „uwaga”
|
|
4
|
+
* z komendą naprawy (działa, ale z brakiem) i „info” (stan bez oceny). Tylko czyta: hook i `statusLine` drukuje,
|
|
5
|
+
* nigdy nie wpisuje. Kod 0 wyłącznie przy wszystkich liniach zielonych; „info” się nie liczy.
|
|
6
|
+
*
|
|
7
|
+
* Linie: tryb i katalog tej instalacji z wersją (info; w paczce npm katalog bez prawa zapisu = „uwaga”); `/health`
|
|
8
|
+
* na porcie z `config.json` albo `--port` (wersja serwera inna niż zainstalowana = czerwone z `rarog restart`); usługa
|
|
9
|
+
* launchd (stan etykiety, plist, cel usługi wobec tej instalacji, węzeł usługi, log usługi w katalogu danych);
|
|
10
|
+
* katalog danych (reguła, konflikt = czerwone, katalog z tej powłoki inny niż usługi = czerwone, skrót `serverId`);
|
|
11
|
+
* środowisko żywego serwera wobec konfiguracji (`ps -Eww` procesu nasłuchującego na porcie); nasłuch iroh (`GET /api/admin/iroh` z gniazda administracyjnego, bez klucza; wyłączony = „info”
|
|
12
|
+
* z paczką z manifestu, kod natywny nie ładuje się); hook (to samo porównanie co `/health`); kanał zgód (`consent`
|
|
13
|
+
* z `/health`: tryb skonfigurowany i efektywny z powodem); ustawienia Claude Code wobec kanału (sandbox z dostępem do
|
|
14
|
+
* gniazd pod `<dataDir>/run/` i drugi hook `PermissionRequest` to „uwaga”: doctor ostrzega, nie
|
|
15
|
+
* zabezpiecza); state write block (`doctor-write-block.ts`); `statusLine`; gniazdo herdr; `rarog` w `PATH`
|
|
16
|
+
* (w paczce wejście innej instalacji, np. dowiązanie klonu, = „uwaga”); stan PR-ów (`doctor-pr-status.ts`: `gh`
|
|
17
|
+
* i jego logowanie). `--port` i `--data-dir` celują w wystąpienie próbne.
|
|
18
|
+
*
|
|
19
|
+
* Środowisko oczekiwane to `buildServeEnv` na środowisku „jak pod launchd” ({@link launchdEnv}), bez zmiennych
|
|
20
|
+
* powłoki, w której uruchomiono `doctor`. `ps -E` skleja argv i środowisko spacjami, więc linię dzielimy po znanych
|
|
21
|
+
* nazwach (rejestr i pomijane), a spacja w wartości nie psuje porównania. Sekrety: wyłącznie obecność — wartość
|
|
22
|
+
* sekretu nie trafia na ekran nigdy.
|
|
23
|
+
*
|
|
24
|
+
* Linux: usługa to jednostka `systemd --user` `rarog.service` (stan z `systemctl --user
|
|
25
|
+
* show`, węzeł z `ExecStart` naszego pliku, linger z `loginctl`), środowisko oczekiwane to `buildServeEnv` na
|
|
26
|
+
* środowisku menedżera użytkownika (`busctl`), a żywe — dokładnie z `<procfs>/<pid>/environ` (PID słuchacza
|
|
27
|
+
* z `lsof`, bez niego z `ss`). Do porównania i na ekran idą wyłącznie nazwy z rejestru; nazwa spoza rejestru =
|
|
28
|
+
* różnica samą nazwą. Platformę i katalog procfs podaje `CliIo` (testy na macOS biegną gałęzią Linuksa).
|
|
29
|
+
*/
|
|
30
|
+
import { spawnSync } from 'node:child_process';
|
|
31
|
+
import { accessSync, constants, existsSync, lstatSync, realpathSync } from 'node:fs';
|
|
32
|
+
import http from 'node:http';
|
|
33
|
+
import { userInfo } from 'node:os';
|
|
34
|
+
import path from 'node:path';
|
|
35
|
+
import { dataDirConflictMessage, resolveDataDir } from '@rarog/shared/data-dir';
|
|
36
|
+
import { adminSocketPath } from '../auth/admin.js';
|
|
37
|
+
import { DEVICES_FILENAME } from '../auth/devices-store.js';
|
|
38
|
+
import { DEFAULT_PORT, defaultHerdrSocket } from '../config.js';
|
|
39
|
+
import { minClientBuildOf } from '../config/clients.js';
|
|
40
|
+
import { HERDR_SOCKET_ENV, IROH_ENV, IROH_RELAY_ENV, MIN_CLIENT_BUILD_ENV, SERVER_ENV, registryNameOf, } from '../config-env.js';
|
|
41
|
+
import { HOOK_STATUS_MISSING } from '../health.js';
|
|
42
|
+
import { consentChannelOpen } from '../herdr/dialogs/hook/contract.js';
|
|
43
|
+
import { CONSENT_SOCKET_FILENAME } from '../herdr/dialogs/layer1/contract.js';
|
|
44
|
+
import { HOOK_MANIFEST_FILENAME, HOOK_PERMISSION_EVENT, STATUSLINE_FRESH_MS, STATUSLINE_INSTALLED_SCRIPT_REL, combineStatus, expectedHookEntries, hookCommand, hookCopyReport, hookOriginText, inspectSettingsFile, newestStatuslineDump, rarogHookEntries, statuslineCopyReport, statuslineDumpDir, userSettingsPath, withCopyStatus, } from '../herdr/hook-config.js';
|
|
45
|
+
import { installDataDir } from '../install/data-dir.js';
|
|
46
|
+
import { INSTALL_MODE, INSTALL_ROOT } from '../install/mode.js';
|
|
47
|
+
import { REPAIR, npmBinDir, packageCommands, packageManagerOf, rarogCli } from '../install/repair.js';
|
|
48
|
+
import { SDK_PACKAGE, probeCheckedSdkDir, probeSdkDir, readSdkPin, sdkVersionDir, sdkVersions, treeBytes, } from '../install/sdk.js';
|
|
49
|
+
import { RAROG_BIN } from '../install/service-target.js';
|
|
50
|
+
import { IROH_PACKAGE, irohModuleInfo, irohPlatform } from '../iroh/adapter.js';
|
|
51
|
+
import { readRegularFileSync } from '../safe-read.js';
|
|
52
|
+
import { RAROG_VERSION } from '../version.js';
|
|
53
|
+
import { prStatusLine } from './doctor-pr-status.js';
|
|
54
|
+
import { writeBlockLine } from './doctor-write-block.js';
|
|
55
|
+
import { HOOK_CHECKOUT_REASON, HOOK_REPAIR_COPY, HOOK_REPAIR_ENTRY, seenByFileLines, } from './hooks.js';
|
|
56
|
+
import { EXIT_OK, EXIT_REFUSED, Refusal, Usage, homeOf, out, platformOf } from './io.js';
|
|
57
|
+
import { SERVICE_LABEL, clonePackageAdvice, loadState, serviceInstallationMismatch, serviceNode, servicePlistArgv, servicePlistPath, unitArgv, unitNode, } from './restart.js';
|
|
58
|
+
import { PROCESS_NAMES, buildServeEnv, servePath } from './serve.js';
|
|
59
|
+
import { launchdEnv, rarogLinkPath } from './service.js';
|
|
60
|
+
import { UNIT_ENV_PROPS, UNIT_NAME, UNIT_STATE_PROPS, classifyUnit, enableLingerCommand, lingerState, managerEnvironment, showUnit, unitFilePath, } from './systemd-unit.js';
|
|
61
|
+
import { usageFor } from './screen/prose.js';
|
|
62
|
+
import { herdrAgentDoctorLine, herdrAgentStart } from './setup-herdr-agent.js';
|
|
63
|
+
export const DOCTOR_USAGE = ` rarog doctor [--port <port>] [--data-dir <dir>]
|
|
64
|
+
Checks the installation line by line (/health, service, data directory, live server environment against
|
|
65
|
+
config.json, iroh listener, hook, consent channel, Claude Code settings for the channel, statusLine, herdr
|
|
66
|
+
socket, rarog in PATH, PR status: gh and its login); read-only. Exit code 0 = all lines ok ("info" lines do
|
|
67
|
+
not count). --port and --data-dir: a trial instance.`;
|
|
68
|
+
/** Zmienne, które żywy serwer ma, a których konfiguracja nie daje: dokłada je tsx, powłoka albo system. */
|
|
69
|
+
const SKIPPED = ['NODE_PATH', 'PWD', 'SHLVL'];
|
|
70
|
+
const SKIPPED_PREFIX = '__CF_';
|
|
71
|
+
const HEALTH_TIMEOUT_MS = 3_000;
|
|
72
|
+
const MARK = {
|
|
73
|
+
ok: 'ok ', bad: 'ERROR ', unknown: 'unknown ', warn: 'warn ', info: 'info ',
|
|
74
|
+
};
|
|
75
|
+
function parseDoctorFlags(argv, cwd) {
|
|
76
|
+
let port;
|
|
77
|
+
let dataDir;
|
|
78
|
+
for (let i = 1; i < argv.length; i += 1) {
|
|
79
|
+
const arg = argv[i] ?? '';
|
|
80
|
+
const next = argv[i + 1];
|
|
81
|
+
if (arg !== '--port' && arg !== '--data-dir')
|
|
82
|
+
throw new Usage(`Unknown rarog doctor option: ${arg}`);
|
|
83
|
+
if (next === undefined || next.startsWith('--'))
|
|
84
|
+
throw new Usage(`${arg} requires a value.`);
|
|
85
|
+
if (arg === '--port') {
|
|
86
|
+
if (!/^[0-9]{1,5}$/.test(next) || Number(next) < 1 || Number(next) > 65535) {
|
|
87
|
+
throw new Usage(`--port: expected a port number 1–65535 (got: ${next}).`);
|
|
88
|
+
}
|
|
89
|
+
if (port !== undefined)
|
|
90
|
+
throw new Usage('--port given twice.');
|
|
91
|
+
port = String(Number(next));
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
if (dataDir !== undefined)
|
|
95
|
+
throw new Usage('--data-dir given twice.');
|
|
96
|
+
dataDir = path.resolve(cwd, next);
|
|
97
|
+
}
|
|
98
|
+
i += 1;
|
|
99
|
+
}
|
|
100
|
+
return { ...(port !== undefined ? { port } : {}), ...(dataDir !== undefined ? { dataDir } : {}) };
|
|
101
|
+
}
|
|
102
|
+
const isRecord = (value) => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
103
|
+
const errnoCode = (failure) => (isRecord(failure) && typeof failure['code'] === 'string' ? failure['code'] : '') || String(failure);
|
|
104
|
+
/** Rodzaj nazwy z rejestru albo `undefined`. */
|
|
105
|
+
const kindOf = (name) => {
|
|
106
|
+
const registry = registryNameOf(name);
|
|
107
|
+
return registry === undefined ? undefined : SERVER_ENV[registry];
|
|
108
|
+
};
|
|
109
|
+
const isSkipped = (name) => SKIPPED.includes(name) || name.startsWith(SKIPPED_PREFIX);
|
|
110
|
+
const quoted = (value) => (value === '' ? '(empty)' : `«${value}»`);
|
|
111
|
+
// ---------------------------------------------------------------------------
|
|
112
|
+
// Środowisko żywego serwera
|
|
113
|
+
// ---------------------------------------------------------------------------
|
|
114
|
+
const escapeRe = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
115
|
+
const KNOWN_NAMES = new RegExp(`(?:^| )(${[...Object.keys(SERVER_ENV), ...SKIPPED]
|
|
116
|
+
.map(escapeRe).join('|')}|${SKIPPED_PREFIX}[A-Za-z0-9_]*)=`, 'g');
|
|
117
|
+
/** Wygląd przypisania zmiennej środowiska wewnątrz wartości: znak, że skleiła się nazwa spoza rejestru. */
|
|
118
|
+
const ANY_ASSIGNMENT = /(?:^| )([A-Z_][A-Z0-9_]*)=/g;
|
|
119
|
+
/**
|
|
120
|
+
* Część środowiska z wyjścia `ps -E` (po odcięciu polecenia) podzielona po znanych nazwach. Wartość ciągnie się do
|
|
121
|
+
* spacji przed następną znaną nazwą, więc `RAROG_PROJECT_ROOTS=/a/My Projects` zostaje jedną wartością.
|
|
122
|
+
*/
|
|
123
|
+
export function parsePsEnvironment(text) {
|
|
124
|
+
const matches = [...text.matchAll(KNOWN_NAMES)];
|
|
125
|
+
const values = new Map();
|
|
126
|
+
const printable = new Set();
|
|
127
|
+
const repeated = new Set();
|
|
128
|
+
let ambiguousFromHere = false;
|
|
129
|
+
matches.forEach((match, i) => {
|
|
130
|
+
const name = match[1] ?? '';
|
|
131
|
+
const start = (match.index ?? 0) + match[0].length;
|
|
132
|
+
const end = matches[i + 1]?.index ?? text.length;
|
|
133
|
+
const value = text.slice(start, end);
|
|
134
|
+
if (values.has(name)) {
|
|
135
|
+
repeated.add(name);
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
values.set(name, value);
|
|
139
|
+
if (!ambiguousFromHere)
|
|
140
|
+
printable.add(name);
|
|
141
|
+
}
|
|
142
|
+
if (kindOf(name) === 'secret' || gluedNames(value).length > 0)
|
|
143
|
+
ambiguousFromHere = true;
|
|
144
|
+
});
|
|
145
|
+
const lead = text.slice(0, matches[0]?.index ?? text.length);
|
|
146
|
+
return {
|
|
147
|
+
values, printable, repeated: [...repeated].sort(),
|
|
148
|
+
unknownLead: [...lead.matchAll(ANY_ASSIGNMENT)].map((m) => m[1] ?? ''),
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
/** Nazwy spoza rejestru sklejone w wartości (`ps -E` nie zaznacza granic wpisów). */
|
|
152
|
+
function gluedNames(value) {
|
|
153
|
+
return [...value.matchAll(ANY_ASSIGNMENT)].map((m) => m[1] ?? '').filter((n) => kindOf(n) === undefined);
|
|
154
|
+
}
|
|
155
|
+
/** Nazwa spoza rejestru do wypisania: zwykła dosłownie, nietypowa w cudzysłowie JSON (bez łamania linii). */
|
|
156
|
+
const shownName = (name) => (/^[A-Za-z_][A-Za-z0-9_]*$/.test(name) ? name : JSON.stringify(name));
|
|
157
|
+
/**
|
|
158
|
+
* Środowisko z `/proc/<pid>/environ` (Linux): wpisy rozdzielone NUL-em, więc granice są dokładne —
|
|
159
|
+
* wartość ze spacją i `=` zostaje jedną wartością. Do `values` (i dalej na ekran) idą WYŁĄCZNIE nazwy z rejestru;
|
|
160
|
+
* nazwy spoza rejestru (`_`, `INVOCATION_ID`) trafiają do `unknownLead` samą nazwą, pomijane (tsx, powłoka) nigdzie.
|
|
161
|
+
* Pierwsze wystąpienie wygrywa jak w `getenv`, powtórzona nazwa z rejestru trafia do `repeated`.
|
|
162
|
+
*/
|
|
163
|
+
export function parseProcEnvironment(bytes) {
|
|
164
|
+
const values = new Map();
|
|
165
|
+
const repeated = new Set();
|
|
166
|
+
const unknown = new Set();
|
|
167
|
+
for (const entry of bytes.toString('utf8').split('\0')) {
|
|
168
|
+
if (entry === '')
|
|
169
|
+
continue;
|
|
170
|
+
const eq = entry.indexOf('=');
|
|
171
|
+
if (eq <= 0) {
|
|
172
|
+
unknown.add('(entry without "NAME=")');
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
const name = entry.slice(0, eq);
|
|
176
|
+
if (kindOf(name) === undefined) {
|
|
177
|
+
if (!isSkipped(name))
|
|
178
|
+
unknown.add(shownName(name));
|
|
179
|
+
}
|
|
180
|
+
else if (values.has(name)) {
|
|
181
|
+
repeated.add(name);
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
values.set(name, entry.slice(eq + 1));
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return {
|
|
188
|
+
values, printable: new Set(values.keys()), repeated: [...repeated].sort(), unknownLead: [...unknown].sort(),
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
const HIDDEN_VALUE = ' (value from ps not shown: it follows a secret or a name outside the registry, so it may be'
|
|
192
|
+
+ ' part of their value)';
|
|
193
|
+
/**
|
|
194
|
+
* Różnice środowiska żywego serwera wobec oczekiwanego. Wartości jawne dosłownie (także `PATH`), pusta = brak;
|
|
195
|
+
* sekrety tylko obecność; zmienne katalogu danych niepuste bez `--data-dir` = różnica z powodem. Wartość z `ps`
|
|
196
|
+
* pada na ekran tylko dla nazw z `printable`; nazwa powtórzona w odczycie to „nie wiem”. Zwraca zdania do
|
|
197
|
+
* wypisania — bez wartości sekretów.
|
|
198
|
+
*/
|
|
199
|
+
export function compareServerEnv(expected, live, opts) {
|
|
200
|
+
const diffs = [];
|
|
201
|
+
const unsure = [];
|
|
202
|
+
if (live.unknownLead.length > 0) {
|
|
203
|
+
diffs.push(`variables outside the registry in the server environment: ${live.unknownLead.join(', ')}`);
|
|
204
|
+
}
|
|
205
|
+
const names = [...new Set([...Object.keys(expected), ...live.values.keys()])].filter((n) => !isSkipped(n)).sort();
|
|
206
|
+
for (const name of names) {
|
|
207
|
+
const want = expected[name] ?? '';
|
|
208
|
+
const got = live.values.get(name) ?? '';
|
|
209
|
+
const kind = kindOf(name);
|
|
210
|
+
if (live.repeated.includes(name)) {
|
|
211
|
+
unsure.push(opts.exact === true
|
|
212
|
+
? `${name}: appears more than once in the process environment — not compared, not shown`
|
|
213
|
+
: `${name}: appears more than once in the ps output (one occurrence is part of another value)`
|
|
214
|
+
+ ' — not compared, not shown');
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
if (kind === 'secret') {
|
|
218
|
+
if (want !== '' && got === '')
|
|
219
|
+
diffs.push(`${name}: the secrets file has it, the server does not`);
|
|
220
|
+
if (want === '' && got !== '' && !opts.wrapper) {
|
|
221
|
+
diffs.push(`${name}: the server has it, but the config does not provide it (neither the secrets file nor`
|
|
222
|
+
+ ' service.wrapper)');
|
|
223
|
+
}
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
if (got === want)
|
|
227
|
+
continue;
|
|
228
|
+
const printable = live.printable.has(name);
|
|
229
|
+
const glued = opts.exact === true ? [] : gluedNames(got);
|
|
230
|
+
if (glued.length > 0 && printable) {
|
|
231
|
+
diffs.push(`${name}: a variable outside the registry follows the value (${glued.join(', ')}) — value not`
|
|
232
|
+
+ ' compared');
|
|
233
|
+
}
|
|
234
|
+
else if (PROCESS_NAMES.includes(name) && want === '') {
|
|
235
|
+
diffs.push(`${printable ? `${name}=${quoted(got)}` : `${name} non-empty`} in the server: the hook in Claude`
|
|
236
|
+
+ ` sessions computes the data directory without this variable, so it writes elsewhere${printable ? ''
|
|
237
|
+
: HIDDEN_VALUE}`);
|
|
238
|
+
}
|
|
239
|
+
else if (printable) {
|
|
240
|
+
diffs.push(`${name}: expected ${quoted(want)}, server ${quoted(got)}`);
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
diffs.push(`${name}: expected ${quoted(want)}, the server has another value${HIDDEN_VALUE}`);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
return { diffs, unsure };
|
|
247
|
+
}
|
|
248
|
+
function spawnLsof(port, io) {
|
|
249
|
+
return spawnSync('lsof', ['-nP', `-iTCP:${String(port)}`, '-sTCP:LISTEN', '-t'], {
|
|
250
|
+
env: io.env, encoding: 'utf8', timeout: 10_000,
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
/** PID-y nasłuchujące na porcie TCP (`lsof`); `failure` = `lsof` nie odpowiedział. */
|
|
254
|
+
function listeningPids(port, io) {
|
|
255
|
+
return lsofListeners(spawnLsof(port, io));
|
|
256
|
+
}
|
|
257
|
+
const isMissing = (failure) => failure !== undefined && errnoCode(failure) === 'ENOENT';
|
|
258
|
+
/**
|
|
259
|
+
* Linux: PID-y słuchacza z `lsof`, a bez niego w `PATH` (Ubuntu 24.04 domyślnie go nie ma) z `ss -Hltnp`
|
|
260
|
+
* (iproute2, `users:(("node",pid=…,fd=…))`). Bez obu — powód z podpowiedzią, czyli „nie wiem”.
|
|
261
|
+
*/
|
|
262
|
+
function linuxListeningPids(port, io) {
|
|
263
|
+
const lsof = spawnLsof(port, io);
|
|
264
|
+
if (!isMissing(lsof.error))
|
|
265
|
+
return lsofListeners(lsof);
|
|
266
|
+
const result = spawnSync('ss', ['-Hltnp', `sport = :${String(port)}`], {
|
|
267
|
+
env: io.env, encoding: 'utf8', timeout: 10_000,
|
|
268
|
+
});
|
|
269
|
+
if (isMissing(result.error)) {
|
|
270
|
+
return { failure: 'neither lsof nor ss in PATH — install lsof or iproute2 (ss) and run doctor again' };
|
|
271
|
+
}
|
|
272
|
+
if (result.error !== undefined)
|
|
273
|
+
return { failure: `ss: ${result.error.message}` };
|
|
274
|
+
if (result.status !== 0) {
|
|
275
|
+
return { failure: `ss: exit status ${String(result.status)} ${result.stderr.trim().split('\n')[0] ?? ''}`.trim() };
|
|
276
|
+
}
|
|
277
|
+
const lines = result.stdout.split('\n').filter((line) => line.trim() !== '');
|
|
278
|
+
// Każde gniazdo osobno: jedno bez PID (słuchacz innego użytkownika) obok drugiego z PID-em nie może dać „ok”
|
|
279
|
+
// dla procesu, który nie musi być tym, co odpowiada na /health.
|
|
280
|
+
if (lines.some((line) => !/\bpid=[0-9]+/.test(line))) {
|
|
281
|
+
return { failure: `ss sees a socket on port ${String(port)}, but not its process (another user's listener?)` };
|
|
282
|
+
}
|
|
283
|
+
return { pids: [...new Set(lines.flatMap((line) => [...line.matchAll(/\bpid=([0-9]+)/g)].map((m) => m[1] ?? '')))] };
|
|
284
|
+
}
|
|
285
|
+
function lsofListeners(result) {
|
|
286
|
+
if (result.error !== undefined)
|
|
287
|
+
return { failure: `lsof: ${result.error.message}` };
|
|
288
|
+
const pids = [...new Set(result.stdout.split('\n').map((l) => l.trim()).filter((l) => /^[0-9]+$/.test(l)))];
|
|
289
|
+
if (pids.length === 0 && result.status !== 0 && result.status !== 1) {
|
|
290
|
+
return { failure: `lsof: exit status ${String(result.status)} ${result.stderr.trim()}`.trim() };
|
|
291
|
+
}
|
|
292
|
+
return { pids };
|
|
293
|
+
}
|
|
294
|
+
function psLine(args, io) {
|
|
295
|
+
const result = spawnSync('ps', args, { env: io.env, encoding: 'utf8', timeout: 10_000 });
|
|
296
|
+
if (result.error !== undefined)
|
|
297
|
+
return { failure: result.error.message };
|
|
298
|
+
const text = result.stdout.replace(/\n+$/, '');
|
|
299
|
+
if (result.status !== 0 || text === '') {
|
|
300
|
+
return { failure: (result.stderr.trim().split('\n')[0] ?? '') || `exit status ${String(result.status)}` };
|
|
301
|
+
}
|
|
302
|
+
return { text };
|
|
303
|
+
}
|
|
304
|
+
const PS_SOURCE = {
|
|
305
|
+
read: 'ps', exact: false,
|
|
306
|
+
repair: 'fix config.json (or the secrets file, service.wrapper); the ai.rarog.server service picks up'
|
|
307
|
+
+ ' changes on rarog restart',
|
|
308
|
+
};
|
|
309
|
+
const PROC_SOURCE = {
|
|
310
|
+
read: '/proc', exact: true,
|
|
311
|
+
repair: `fix config.json (or the secrets file, service.wrapper); the ${UNIT_NAME} unit picks up changes`
|
|
312
|
+
+ ' on rarog restart',
|
|
313
|
+
};
|
|
314
|
+
/** Sufit odczytu `/proc/<pid>/environ` (jądro i tak tnie środowisko procesu do kilku MiB). */
|
|
315
|
+
const ENVIRON_MAX_BYTES = 1024 * 1024;
|
|
316
|
+
function onlyListener(title, port, listening) {
|
|
317
|
+
if ('failure' in listening)
|
|
318
|
+
return { line: { verdict: 'unknown', text: `${title}: ${listening.failure}` } };
|
|
319
|
+
if (listening.pids.length === 0) {
|
|
320
|
+
return { line: { verdict: 'unknown', text: `${title}: nothing listens on port ${String(port)}` } };
|
|
321
|
+
}
|
|
322
|
+
if (listening.pids.length > 1) {
|
|
323
|
+
return {
|
|
324
|
+
line: {
|
|
325
|
+
verdict: 'unknown',
|
|
326
|
+
text: `${title}: several processes listen on port ${String(port)} (${listening.pids.join(', ')})`,
|
|
327
|
+
},
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
return { pid: listening.pids[0] ?? '' };
|
|
331
|
+
}
|
|
332
|
+
/** macOS: środowisko procesu z `ps -E` (po odcięciu polecenia z `ps -o command=`). */
|
|
333
|
+
function psRead(io, title, pid) {
|
|
334
|
+
const command = psLine(['-ww', '-o', 'command=', '-p', pid], io);
|
|
335
|
+
const withEnv = psLine(['-Eww', '-o', 'command=', '-p', pid], io);
|
|
336
|
+
for (const read of [command, withEnv]) {
|
|
337
|
+
if ('failure' in read) {
|
|
338
|
+
return {
|
|
339
|
+
line: {
|
|
340
|
+
verdict: 'unknown',
|
|
341
|
+
text: `${title}: ps could not read process ${pid} (${read.failure}) — inside an agent session sandbox,`
|
|
342
|
+
+ ' run doctor in a regular terminal',
|
|
343
|
+
},
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
const cmd = 'text' in command ? command.text : '';
|
|
348
|
+
const full = 'text' in withEnv ? withEnv.text : '';
|
|
349
|
+
if (!full.startsWith(`${cmd} `)) {
|
|
350
|
+
return { line: { verdict: 'unknown', text: `${title}: ps -E did not show the environment of process ${pid}` } };
|
|
351
|
+
}
|
|
352
|
+
return { pid, live: parsePsEnvironment(full.slice(cmd.length + 1)) };
|
|
353
|
+
}
|
|
354
|
+
/** Linux: środowisko procesu dokładnie z `<procRoot>/<pid>/environ` (katalog procfs z `CliIo`, domyślnie `/proc`). */
|
|
355
|
+
function procRead(io, title, pid) {
|
|
356
|
+
const file = path.join(io.procRoot ?? '/proc', pid, 'environ');
|
|
357
|
+
try {
|
|
358
|
+
const read = readRegularFileSync(file, { maxBytes: ENVIRON_MAX_BYTES, followSymlink: false });
|
|
359
|
+
if (read === null || read.truncated) {
|
|
360
|
+
return { line: { verdict: 'unknown', text: `${title}: ${file} is not a regular file up to 1 MiB` } };
|
|
361
|
+
}
|
|
362
|
+
return { pid, live: parseProcEnvironment(read.bytes) };
|
|
363
|
+
}
|
|
364
|
+
catch (failure) {
|
|
365
|
+
return {
|
|
366
|
+
line: {
|
|
367
|
+
verdict: 'unknown',
|
|
368
|
+
text: `${title}: cannot read ${file} (${errnoCode(failure)}) — another user's process, or it has exited`,
|
|
369
|
+
},
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
function compareLine(title, read, expected, wrapper, source) {
|
|
374
|
+
const { pid, live } = read;
|
|
375
|
+
const { diffs, unsure } = compareServerEnv(expected, live, { wrapper, ...(source.exact ? { exact: true } : {}) });
|
|
376
|
+
if (diffs.length > 0) {
|
|
377
|
+
return {
|
|
378
|
+
verdict: 'bad',
|
|
379
|
+
text: `${title}: process ${pid} differs in ${String(diffs.length)} ${diffs.length === 1 ? 'place' : 'places'}`,
|
|
380
|
+
details: [...diffs, ...unsure],
|
|
381
|
+
repair: source.repair,
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
if (unsure.length > 0) {
|
|
385
|
+
return {
|
|
386
|
+
verdict: 'unknown',
|
|
387
|
+
text: `${title}: ${source.read} read of process ${pid} is ambiguous`,
|
|
388
|
+
details: unsure,
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
const secrets = [...live.values.entries()].filter(([name, value]) => kindOf(name) === 'secret' && value !== '')
|
|
392
|
+
.map(([name]) => name).sort();
|
|
393
|
+
return {
|
|
394
|
+
verdict: 'ok',
|
|
395
|
+
text: `${title}: process ${pid}, ${String(live.values.size)} variables match; secrets present:`
|
|
396
|
+
+ ` ${secrets.length > 0 ? secrets.join(', ') : 'none'}`,
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* `managerFailure`: na Linuksie środowisko menedżera użytkownika (`busctl`) nieczytelne — oczekiwanego nie ma z czego
|
|
401
|
+
* policzyć („nie wiem”, surowe wyjście `busctl` nie trafia na ekran).
|
|
402
|
+
*/
|
|
403
|
+
function envLine(io, built, configIssue, port, expectedPath, managerFailure) {
|
|
404
|
+
const title = 'live server environment = config';
|
|
405
|
+
const platform = platformOf(io);
|
|
406
|
+
if (platform !== 'darwin' && platform !== 'linux') {
|
|
407
|
+
return {
|
|
408
|
+
verdict: 'unknown',
|
|
409
|
+
text: `${title}: doctor knows macOS (ps -E) and Linux (/proc/<pid>/environ), and this platform is ${platform}`,
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
if (configIssue !== null) {
|
|
413
|
+
return { verdict: 'bad', text: `${title}: ${configIssue}`, repair: 'fix ~/.config/rarog/config.json' };
|
|
414
|
+
}
|
|
415
|
+
if (built === null || built.config === null) {
|
|
416
|
+
return {
|
|
417
|
+
verdict: 'bad',
|
|
418
|
+
text: `${title}: no config.json — nothing to compare against`,
|
|
419
|
+
repair: 'create ~/.config/rarog/config.json (docs/server-config.md, "Config file and rarog serve")',
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
if (managerFailure !== null) {
|
|
423
|
+
return {
|
|
424
|
+
verdict: 'unknown',
|
|
425
|
+
text: `${title}: user manager environment unreadable (${managerFailure}) — without it the expected`
|
|
426
|
+
+ ' environment cannot be computed; run doctor in a regular user session',
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
if (port === null)
|
|
430
|
+
return { verdict: 'unknown', text: `${title}: port from the config unreadable` };
|
|
431
|
+
const linux = platform === 'linux';
|
|
432
|
+
const listener = onlyListener(title, port, linux ? linuxListeningPids(port, io) : listeningPids(port, io));
|
|
433
|
+
if ('line' in listener)
|
|
434
|
+
return listener.line;
|
|
435
|
+
const read = linux ? procRead(io, title, listener.pid) : psRead(io, title, listener.pid);
|
|
436
|
+
if ('line' in read)
|
|
437
|
+
return read.line;
|
|
438
|
+
return compareLine(title, read, { ...built.env, PATH: expectedPath }, built.config.wrapper !== null, linux ? PROC_SOURCE : PS_SOURCE);
|
|
439
|
+
}
|
|
440
|
+
async function readHealth(port) {
|
|
441
|
+
try {
|
|
442
|
+
const response = await fetch(`http://127.0.0.1:${String(port)}/health`, {
|
|
443
|
+
signal: AbortSignal.timeout(HEALTH_TIMEOUT_MS),
|
|
444
|
+
});
|
|
445
|
+
if (!response.ok)
|
|
446
|
+
return { failure: `HTTP ${String(response.status)}`, denied: false };
|
|
447
|
+
const body = await response.json();
|
|
448
|
+
return isRecord(body) ? { body } : { failure: 'response is not a JSON object', denied: false };
|
|
449
|
+
}
|
|
450
|
+
catch (failure) {
|
|
451
|
+
const cause = isRecord(failure) ? failure['cause'] : undefined;
|
|
452
|
+
const code = errnoCode(cause ?? failure);
|
|
453
|
+
return { failure: code, denied: code === 'EPERM' || code === 'EACCES' };
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
function healthLine(port, health, termExpected, installed = RAROG_VERSION) {
|
|
457
|
+
if (port === null || health === null)
|
|
458
|
+
return { verdict: 'unknown', text: '/health: port unreadable' };
|
|
459
|
+
const where = `127.0.0.1:${String(port)}`;
|
|
460
|
+
if ('failure' in health) {
|
|
461
|
+
return health.denied
|
|
462
|
+
? { verdict: 'unknown', text: `/health ${where}: connection blocked (${health.failure}, sandbox?)` }
|
|
463
|
+
: { verdict: 'bad', text: `/health ${where}: not responding (${health.failure})`, repair: 'rarog restart' };
|
|
464
|
+
}
|
|
465
|
+
const { body } = health;
|
|
466
|
+
const problems = [];
|
|
467
|
+
if (body['herdr'] !== true) {
|
|
468
|
+
problems.push('herdr: false — the server cannot talk to herdr (see the socket line below)');
|
|
469
|
+
}
|
|
470
|
+
if (body['term'] !== true && termExpected)
|
|
471
|
+
problems.push('term: false, but the config has RAROG_TERM=1');
|
|
472
|
+
if (body['authStore'] === 'broken') {
|
|
473
|
+
problems.push('authStore: broken — key store unreadable, devices have to pair again (rarog pair)');
|
|
474
|
+
}
|
|
475
|
+
// Wersja z `/health` to wersja kodu, który działa (czytana przy starcie serwera), a tu — zainstalowana teraz.
|
|
476
|
+
const version = body['version'];
|
|
477
|
+
const stale = typeof version === 'string' && version !== installed;
|
|
478
|
+
if (stale)
|
|
479
|
+
problems.push(`version ${version}, installed ${installed} — the server runs code from before the change`);
|
|
480
|
+
const summary = `herdr: ${String(body['herdr'])}, term: ${String(body['term'])}, hook: ${String(body['hook'])},`
|
|
481
|
+
+ ` authStore: ${String(body['authStore'])}, version ${String(body['version'])}`;
|
|
482
|
+
if (problems.length > 0) {
|
|
483
|
+
return {
|
|
484
|
+
verdict: 'bad', text: `/health ${where}: ${summary}`, details: problems,
|
|
485
|
+
repair: stale && problems.length === 1 ? 'rarog restart'
|
|
486
|
+
: 'cause in server.log in the data directory; after the fix, rarog restart',
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
return { verdict: 'ok', text: `/health ${where}: ${summary}` };
|
|
490
|
+
}
|
|
491
|
+
/** Linia usługi bez węzła (jednostka nie nasza albo nie rozstrzygnięta). */
|
|
492
|
+
const unitOnly = (line) => ({ line, node: null });
|
|
493
|
+
/**
|
|
494
|
+
* Linux: jednostka `rarog.service` z `systemctl --user show` — nasza (`FragmentPath`), bez drop-inów
|
|
495
|
+
* i bez środowiska w samej jednostce, wczytana po ostatniej zmianie pliku; węzeł z `ExecStart` naszego pliku;
|
|
496
|
+
* `ActiveState=active` i `UnitFileState=enabled`; na koniec linger (`no` albo nieczytelny = „nie wiem” z komendą).
|
|
497
|
+
*/
|
|
498
|
+
function unitServiceLine(io, home) {
|
|
499
|
+
const shown = showUnit(io, [...UNIT_STATE_PROPS, 'ActiveState', 'UnitFileState'], UNIT_ENV_PROPS);
|
|
500
|
+
if ('failure' in shown) {
|
|
501
|
+
return unitOnly({
|
|
502
|
+
verdict: 'unknown',
|
|
503
|
+
text: `service: systemctl --user show ${UNIT_NAME} is inconclusive (${shown.failure}) — without the user`
|
|
504
|
+
+ ' manager bus (logind session, XDG_RUNTIME_DIR) the state is unknown; run doctor in a regular user session',
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
const file = unitFilePath(home);
|
|
508
|
+
const status = classifyUnit(shown.values, home);
|
|
509
|
+
switch (status.kind) {
|
|
510
|
+
case 'ours':
|
|
511
|
+
break;
|
|
512
|
+
case 'absent':
|
|
513
|
+
return unitOnly({
|
|
514
|
+
verdict: 'bad', text: `service: no systemd --user unit ${UNIT_NAME}`, repair: 'rarog service install',
|
|
515
|
+
});
|
|
516
|
+
case 'masked':
|
|
517
|
+
return unitOnly({
|
|
518
|
+
verdict: 'bad', text: `service: ${UNIT_NAME} has LoadState=masked`,
|
|
519
|
+
repair: `systemctl --user unmask ${UNIT_NAME}, then rarog service install`,
|
|
520
|
+
});
|
|
521
|
+
case 'bad-setting':
|
|
522
|
+
return unitOnly({
|
|
523
|
+
verdict: 'bad', text: `service: ${UNIT_NAME} has LoadState=bad-setting (systemd rejected the unit file)`,
|
|
524
|
+
repair: `cause in systemctl --user status ${UNIT_NAME}; then rarog service install`,
|
|
525
|
+
});
|
|
526
|
+
case 'foreign':
|
|
527
|
+
return unitOnly({
|
|
528
|
+
verdict: 'bad', text: `service: ${UNIT_NAME} loaded from ${status.detail}, not from ${file}`,
|
|
529
|
+
repair: `not the unit from rarog service install: remove it, systemctl --user daemon-reload, then rarog`
|
|
530
|
+
+ ' service install',
|
|
531
|
+
});
|
|
532
|
+
case 'drop-in':
|
|
533
|
+
return unitOnly({
|
|
534
|
+
verdict: 'bad',
|
|
535
|
+
text: `service: ${UNIT_NAME} has drop-ins (${status.detail}) — they can change the server start or`
|
|
536
|
+
+ ' environment',
|
|
537
|
+
repair: 'remove the drop-ins and run systemctl --user daemon-reload; server variables go in config.json',
|
|
538
|
+
});
|
|
539
|
+
case 'stale':
|
|
540
|
+
return unitOnly({
|
|
541
|
+
verdict: 'bad', text: `service: ${file} changed without daemon-reload (NeedDaemonReload=yes)`,
|
|
542
|
+
repair: 'systemctl --user daemon-reload, then rarog restart',
|
|
543
|
+
});
|
|
544
|
+
case 'environment':
|
|
545
|
+
return unitOnly({
|
|
546
|
+
verdict: 'bad', text: `service: ${UNIT_NAME} sets environment in the unit itself (${status.detail})`,
|
|
547
|
+
repair: 'rarog service install (the template has no such entries); server variables go in config.json',
|
|
548
|
+
});
|
|
549
|
+
default:
|
|
550
|
+
return unitOnly({
|
|
551
|
+
verdict: 'unknown',
|
|
552
|
+
text: `service: ${UNIT_NAME} has ${status.detail} — check systemctl --user status ${UNIT_NAME}`,
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
const found = unitNode(io);
|
|
556
|
+
if ('issue' in found) {
|
|
557
|
+
return unitOnly({ verdict: 'bad', text: `service: ${found.issue}`, repair: 'rarog service install' });
|
|
558
|
+
}
|
|
559
|
+
const active = shown.values.get('ActiveState') ?? '';
|
|
560
|
+
if (active !== 'active') {
|
|
561
|
+
return {
|
|
562
|
+
line: {
|
|
563
|
+
verdict: 'bad', text: `service: ${UNIT_NAME} is not running (ActiveState=${active || '?'}), node ${found.node}`,
|
|
564
|
+
repair: `rarog restart; cause in server.log in the data directory and in systemctl --user status ${UNIT_NAME}`,
|
|
565
|
+
},
|
|
566
|
+
node: found.node,
|
|
567
|
+
};
|
|
568
|
+
}
|
|
569
|
+
const enabled = shown.values.get('UnitFileState') ?? '';
|
|
570
|
+
if (enabled !== 'enabled') {
|
|
571
|
+
return {
|
|
572
|
+
line: {
|
|
573
|
+
verdict: 'bad',
|
|
574
|
+
text: `service: ${UNIT_NAME} runs, but will not start on its own (UnitFileState=${enabled || '?'}),`
|
|
575
|
+
+ ` node ${found.node}`,
|
|
576
|
+
repair: `systemctl --user enable ${UNIT_NAME}`,
|
|
577
|
+
},
|
|
578
|
+
node: found.node,
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
const running = `service: ${UNIT_NAME} active and enabled, node ${found.node}`;
|
|
582
|
+
const user = userInfo().username;
|
|
583
|
+
const linger = lingerState(io, user);
|
|
584
|
+
if ('failure' in linger || linger.value !== 'yes') {
|
|
585
|
+
const state = 'failure' in linger ? `linger: unknown (${linger.failure})`
|
|
586
|
+
: `linger off (Linger=${linger.value || '?'})`;
|
|
587
|
+
return {
|
|
588
|
+
line: withInstallation({
|
|
589
|
+
verdict: 'unknown',
|
|
590
|
+
text: `${running}; ${state} — without a login session (server, reboot) the service will not start;`
|
|
591
|
+
+ ` enable it with ${enableLingerCommand(user)}`,
|
|
592
|
+
}, UNIT_NAME, unitArgv(io)),
|
|
593
|
+
node: found.node,
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
return {
|
|
597
|
+
line: withInstallation({ verdict: 'ok', text: `${running}; linger: yes` }, UNIT_NAME, unitArgv(io)),
|
|
598
|
+
node: found.node,
|
|
599
|
+
};
|
|
600
|
+
}
|
|
601
|
+
/**
|
|
602
|
+
* Cel usługi wobec tej instalacji (`restart.ts`, {@link serviceInstallationMismatch}; ta sama reguła co
|
|
603
|
+
* w `rarog restart`) na linii usługi, która poza tym przechodzi: rozjazd blokujący restart = czerwone z komendą
|
|
604
|
+
* `service install` tej instalacji, a z klonu przy usłudze na paczce npm z radą {@link clonePackageAdvice} (tam
|
|
605
|
+
* `service install` przełączyłby usługę na klon); inny węzeł klonu = dopisek pod linią.
|
|
606
|
+
*/
|
|
607
|
+
function withInstallation(line, label, argv) {
|
|
608
|
+
if ('issue' in argv || (line.verdict !== 'ok' && line.verdict !== 'unknown'))
|
|
609
|
+
return line;
|
|
610
|
+
const mismatch = serviceInstallationMismatch(argv.argv);
|
|
611
|
+
if (mismatch === null)
|
|
612
|
+
return line;
|
|
613
|
+
if (mismatch.blocking) {
|
|
614
|
+
const repair = mismatch.servicePackage === null ? mismatch.reinstall : clonePackageAdvice(mismatch.servicePackage);
|
|
615
|
+
return { verdict: 'bad', text: `service: ${label} ${mismatch.what}`, repair };
|
|
616
|
+
}
|
|
617
|
+
return {
|
|
618
|
+
...line, details: [...(line.details ?? []), `the service ${mismatch.what}; ${mismatch.reinstall} switches it`],
|
|
619
|
+
};
|
|
620
|
+
}
|
|
621
|
+
function serviceLine(io, home, dataDir) {
|
|
622
|
+
const platform = platformOf(io);
|
|
623
|
+
if (platform === 'linux')
|
|
624
|
+
return unitServiceLine(io, home);
|
|
625
|
+
if (platform !== 'darwin') {
|
|
626
|
+
return unitOnly({
|
|
627
|
+
verdict: 'unknown',
|
|
628
|
+
text: `service: doctor knows launchd (macOS) and systemd --user (Linux), and this platform is ${platform}`,
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
const service = loadState(SERVICE_LABEL, io);
|
|
632
|
+
const servicePlist = existsSync(servicePlistPath(home));
|
|
633
|
+
if (typeof service === 'object') {
|
|
634
|
+
return {
|
|
635
|
+
line: { verdict: 'unknown', text: `service: launchctl print ${SERVICE_LABEL} is inconclusive (${service.unknown})` },
|
|
636
|
+
node: null,
|
|
637
|
+
};
|
|
638
|
+
}
|
|
639
|
+
if (service === 'absent' && !servicePlist) {
|
|
640
|
+
return { line: { verdict: 'bad', text: 'service: no launchd service', repair: 'rarog service install' }, node: null };
|
|
641
|
+
}
|
|
642
|
+
const found = serviceNode(io);
|
|
643
|
+
if ('issue' in found) {
|
|
644
|
+
return { line: { verdict: 'bad', text: `service: ${found.issue}`, repair: 'rarog service install' }, node: null };
|
|
645
|
+
}
|
|
646
|
+
if (service !== 'loaded') {
|
|
647
|
+
return {
|
|
648
|
+
line: { verdict: 'bad', text: `service: ${SERVICE_LABEL} has a plist, but is not loaded`,
|
|
649
|
+
repair: 'rarog service install' },
|
|
650
|
+
node: found.node,
|
|
651
|
+
};
|
|
652
|
+
}
|
|
653
|
+
const log = dataDir === null ? undefined : serviceLogPaths(io, home)
|
|
654
|
+
.find((file) => path.dirname(path.resolve(file)) !== path.resolve(dataDir));
|
|
655
|
+
if (log !== undefined && dataDir !== null) {
|
|
656
|
+
// Plist pisze log poza katalogiem danych (np. przez dowiązanie po przeniesieniu katalogu): bez dowiązania launchd
|
|
657
|
+
// nie otworzy pliku logu. Ponowna instalacja wpisuje log z bieżącej reguły katalogu.
|
|
658
|
+
return {
|
|
659
|
+
line: {
|
|
660
|
+
verdict: 'bad',
|
|
661
|
+
text: `service: ${SERVICE_LABEL} loaded, but the service log ${log} lies outside the data directory ${dataDir}`,
|
|
662
|
+
repair: 'rarog service install',
|
|
663
|
+
},
|
|
664
|
+
node: found.node,
|
|
665
|
+
};
|
|
666
|
+
}
|
|
667
|
+
return {
|
|
668
|
+
line: withInstallation({ verdict: 'ok', text: `service: ${SERVICE_LABEL} loaded, node ${found.node}` }, SERVICE_LABEL, servicePlistArgv(io)),
|
|
669
|
+
node: found.node,
|
|
670
|
+
};
|
|
671
|
+
}
|
|
672
|
+
/**
|
|
673
|
+
* `StandardOutPath` i `StandardErrorPath` plistu usługi (szablon daje oba równe, ręczna edycja nie musi; review
|
|
674
|
+
* Codexa); pusta lista, gdy plist nieczytelny (plist i węzeł sprawdza już reszta linii usługi).
|
|
675
|
+
*/
|
|
676
|
+
function serviceLogPaths(io, home) {
|
|
677
|
+
const converted = spawnSync('plutil', ['-convert', 'json', '-o', '-', servicePlistPath(home)], {
|
|
678
|
+
env: io.env, encoding: 'utf8', timeout: 10_000,
|
|
679
|
+
});
|
|
680
|
+
if (converted.error !== undefined || converted.status !== 0)
|
|
681
|
+
return [];
|
|
682
|
+
try {
|
|
683
|
+
const plist = JSON.parse(converted.stdout);
|
|
684
|
+
return [plist['StandardOutPath'], plist['StandardErrorPath']]
|
|
685
|
+
.filter((value) => typeof value === 'string' && value !== '');
|
|
686
|
+
}
|
|
687
|
+
catch {
|
|
688
|
+
return [];
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
/** Katalog danych (hook, log usługi) w tym samym rozstrzygnięciu co {@link dataDirLine}; `null` przy konflikcie. */
|
|
692
|
+
function resolvedDataDir(io, home, flag) {
|
|
693
|
+
const resolved = resolveDataDir({ env: launchdEnv(io.env), home, flag });
|
|
694
|
+
return resolved.ok ? resolved.dir : null;
|
|
695
|
+
}
|
|
696
|
+
function dataDirLine(io, home, flag) {
|
|
697
|
+
const resolved = resolveDataDir({ env: launchdEnv(io.env), home, flag });
|
|
698
|
+
if (!resolved.ok) {
|
|
699
|
+
return {
|
|
700
|
+
verdict: 'bad', text: 'data directory: CONFLICT — the server will not start, the hook will not write anything',
|
|
701
|
+
details: dataDirConflictMessage(resolved).split('\n'),
|
|
702
|
+
};
|
|
703
|
+
}
|
|
704
|
+
const where = `data directory: ${resolved.dir} (${resolved.source})`;
|
|
705
|
+
const file = path.join(resolved.dir, DEVICES_FILENAME);
|
|
706
|
+
let text;
|
|
707
|
+
try {
|
|
708
|
+
const read = readRegularFileSync(file, { maxBytes: 4 * 1024 * 1024, followSymlink: false });
|
|
709
|
+
if (read === null || read.truncated) {
|
|
710
|
+
return { verdict: 'bad', text: `${where}; ${DEVICES_FILENAME} is not a regular file` };
|
|
711
|
+
}
|
|
712
|
+
text = read.bytes.toString('utf8');
|
|
713
|
+
}
|
|
714
|
+
catch (failure) {
|
|
715
|
+
const code = errnoCode(failure);
|
|
716
|
+
return code === 'ENOENT'
|
|
717
|
+
? { verdict: 'unknown', text: `${where}; no ${DEVICES_FILENAME} — no server has run with this directory` }
|
|
718
|
+
: { verdict: 'unknown', text: `${where}; ${DEVICES_FILENAME} unreadable (${code})` };
|
|
719
|
+
}
|
|
720
|
+
let serverId;
|
|
721
|
+
try {
|
|
722
|
+
serverId = JSON.parse(text)['serverId'];
|
|
723
|
+
}
|
|
724
|
+
catch {
|
|
725
|
+
serverId = undefined;
|
|
726
|
+
}
|
|
727
|
+
if (typeof serverId !== 'string' || serverId === '') {
|
|
728
|
+
return { verdict: 'bad', text: `${where}; ${DEVICES_FILENAME} without serverId`, repair: 'see authStore in /health' };
|
|
729
|
+
}
|
|
730
|
+
return { verdict: 'ok', text: `${where}; serverId ${serverId.slice(0, 8)}…` };
|
|
731
|
+
}
|
|
732
|
+
/**
|
|
733
|
+
* Linia hooka: rejestracja i kopia jak w `/health`; w szczegółach znaczniki per plik wejściowy, gdy katalog
|
|
734
|
+
* danych jest znany (`dataDir` = `null` przy konflikcie katalogów — wtedy pokazuje go linia katalogu danych).
|
|
735
|
+
*/
|
|
736
|
+
function hookLine(home, health, dataDir) {
|
|
737
|
+
const user = inspectSettingsFile(userSettingsPath(home), expectedHookEntries(hookCommand(home)));
|
|
738
|
+
const report = hookCopyReport(home);
|
|
739
|
+
const status = withCopyStatus(combineStatus([user]), report);
|
|
740
|
+
const origin = hookCopyOriginLine(report);
|
|
741
|
+
const details = { details: dataDir === null ? [origin] : [origin, ...seenByFileLines(dataDir, Date.now())] };
|
|
742
|
+
const fromHealth = health !== null && 'body' in health && typeof health.body['hook'] === 'string'
|
|
743
|
+
? health.body['hook'] : null;
|
|
744
|
+
const healthNote = fromHealth !== null && fromHealth !== status ? ` (/health: ${fromHealth})` : '';
|
|
745
|
+
if (status === 'ok' && healthNote !== '') {
|
|
746
|
+
// Serwer liczy to samo względem SWOJEGO checkoutu i trzyma wynik sondy przez chwilę: zgoda lokalna nie wystarczy.
|
|
747
|
+
return {
|
|
748
|
+
verdict: 'unknown',
|
|
749
|
+
text: `hook: entry and copy match this repo, but /health says ${String(fromHealth)} — the server runs from`
|
|
750
|
+
+ ' another checkout or holds an older probe result; run doctor again in a moment',
|
|
751
|
+
...details,
|
|
752
|
+
};
|
|
753
|
+
}
|
|
754
|
+
if (status === 'ok')
|
|
755
|
+
return { verdict: 'ok', text: 'hook: ok — entry and copy match the repo', ...details };
|
|
756
|
+
const stale = report.files.every((one) => one.state === 'match') && report.leftovers.length > 0
|
|
757
|
+
? `the copy in ~/.claude/hooks/rarog has a leftover file from an older installation (${report.leftovers.join(', ')})`
|
|
758
|
+
: 'the copy in ~/.claude/hooks/rarog differs from the repo or is missing';
|
|
759
|
+
const reason = status === 'stale' ? stale
|
|
760
|
+
: status === HOOK_STATUS_MISSING ? 'no entry in ~/.claude/settings.json' : (user.checkout ? HOOK_CHECKOUT_REASON
|
|
761
|
+
: 'the entry exists, but differs from the one hooks:print prints');
|
|
762
|
+
const repair = status === 'stale' ? HOOK_REPAIR_COPY : HOOK_REPAIR_ENTRY;
|
|
763
|
+
return {
|
|
764
|
+
verdict: 'bad',
|
|
765
|
+
text: `hook: ${status}${healthNote} — ${reason}`,
|
|
766
|
+
// Zdanie z `hooks.ts` zaczyna się od etykiety naprawy („Fix: ” itp.), a linia `doctor` ma własną (`fix:`).
|
|
767
|
+
repair: `${repair.replace(/^\p{L}+: /u, '')} Details: rarog hooks doctor.`,
|
|
768
|
+
...details,
|
|
769
|
+
};
|
|
770
|
+
}
|
|
771
|
+
/**
|
|
772
|
+
* Pochodzenie zainstalowanej kopii hooka (krok 6 rollbacku kanału zgód: `hooks:install` z commita, do którego się
|
|
773
|
+
* wraca): commit klonu albo wersja paczki z manifestu instalacji, wyłącznie gdy każdy plik kopii ma skrót zapisany
|
|
774
|
+
* w manifeście. Brak katalogu kopii, brak manifestu albo plik zmieniony po instalacji = powód zamiast pochodzenia.
|
|
775
|
+
*/
|
|
776
|
+
export function hookCopyOriginLine(report) {
|
|
777
|
+
if (report.dirKind !== 'dir')
|
|
778
|
+
return 'installed copy: origin unknown (no copy directory)';
|
|
779
|
+
const manifest = report.manifest;
|
|
780
|
+
if (manifest === null)
|
|
781
|
+
return `installed copy: origin unknown (${HOOK_MANIFEST_FILENAME} missing or unreadable)`;
|
|
782
|
+
const changed = report.files.filter((one) => one.copySha === null || one.copySha !== one.manifestSha);
|
|
783
|
+
if (changed.length > 0) {
|
|
784
|
+
return `installed copy: origin unknown (changed after installation or missing: ${changed.map((one) => one.name).join(', ')})`;
|
|
785
|
+
}
|
|
786
|
+
return `installed copy from ${hookOriginText(manifest)}, installed ${new Date(manifest.at).toISOString()}`;
|
|
787
|
+
}
|
|
788
|
+
/** Naprawa trybu `shadow` zamiast `main` według powodu z `/health`. */
|
|
789
|
+
const CONSENT_SHADOW_REPAIR = {
|
|
790
|
+
'missing': 'see the hook line above; after the fix run rarog restart (the mode is computed once, at start)',
|
|
791
|
+
'mismatch': 'see the hook line above; after the fix run rarog restart (the mode is computed once, at start)',
|
|
792
|
+
'stale': 'see the hook line above; after the fix run rarog restart (the mode is computed once, at start)',
|
|
793
|
+
'consent-socket': 'the registration socket <dataDir>/run/consent.sock did not start: look for consent: and'
|
|
794
|
+
+ ' admin: lines in the server log, then run rarog restart',
|
|
795
|
+
'admin-socket': 'the admin socket <dataDir>/run/admin.sock did not start: look for admin: lines in the server'
|
|
796
|
+
+ ' log, then run rarog restart',
|
|
797
|
+
'min-client-build': 'set RAROG_MIN_CLIENT_BUILD in env in ~/.config/rarog/config.json to the first app build'
|
|
798
|
+
+ ' that knows consent channel cards, then run rarog restart',
|
|
799
|
+
};
|
|
800
|
+
/**
|
|
801
|
+
* Linia kanału zgód z pola `consent` w `/health` (`herdr/dialogs/layer1/mode.ts`): kanał otwarty (`main`, `all`)
|
|
802
|
+
* równy skonfigurowanemu = zielona, tryb równy skonfigurowanemu (`off`, `shadow`) = „info”, konfiguracja `main` albo
|
|
803
|
+
* `all` z `shadow` = czerwona z naprawą według powodu, wyłącznik = „uwaga” z wpisem do `config.json`,
|
|
804
|
+
* rozstrzygnięcie w toku = „nie wiem”. Serwer bez pola
|
|
805
|
+
* (starsza wersja) i brak `/health` = „info”: linia `/health` ocenia to sama.
|
|
806
|
+
* `threshold` (from {@link thresholdOf}) adds the minimum app build and its source to the text; `undefined` = no
|
|
807
|
+
* clause. The verdict does not depend on it.
|
|
808
|
+
*/
|
|
809
|
+
export function consentLineOf(health, threshold) {
|
|
810
|
+
if (health === null || 'failure' in health)
|
|
811
|
+
return { verdict: 'info', text: 'consent channel: no /health answer' };
|
|
812
|
+
const raw = health.body['consent'];
|
|
813
|
+
if (!isRecord(raw) || typeof raw['configured'] !== 'string' || typeof raw['effective'] !== 'string'
|
|
814
|
+
|| typeof raw['reason'] !== 'string') {
|
|
815
|
+
return { verdict: 'info', text: 'consent channel: the server does not report it (/health without consent)' };
|
|
816
|
+
}
|
|
817
|
+
const configured = raw['configured'];
|
|
818
|
+
const effective = raw['effective'];
|
|
819
|
+
const reason = raw['reason'];
|
|
820
|
+
const where = `consent channel: ${effective} (configured ${configured}, reason ${reason})${thresholdText(threshold)}`;
|
|
821
|
+
if (reason === 'killswitch') {
|
|
822
|
+
return {
|
|
823
|
+
verdict: 'warn', text: `${where} — off until the server restarts (rarog dialogs off)`,
|
|
824
|
+
repair: 'to keep it off after a restart, set RAROG_CONSENT_CHANNEL to "off" in env in'
|
|
825
|
+
+ ' ~/.config/rarog/config.json, then run rarog restart',
|
|
826
|
+
};
|
|
827
|
+
}
|
|
828
|
+
if (reason === 'starting') {
|
|
829
|
+
return { verdict: 'unknown', text: `${where} — the server is starting its sockets; run doctor again in a moment` };
|
|
830
|
+
}
|
|
831
|
+
if (consentChannelOpen(effective) && effective === configured)
|
|
832
|
+
return { verdict: 'ok', text: where };
|
|
833
|
+
if (consentChannelOpen(configured)) {
|
|
834
|
+
return {
|
|
835
|
+
verdict: 'bad', text: `${where} — the channel does not run, the server falls back to shadow`,
|
|
836
|
+
repair: CONSENT_SHADOW_REPAIR[reason] ?? 'check the server log, then run rarog restart',
|
|
837
|
+
};
|
|
838
|
+
}
|
|
839
|
+
return { verdict: 'info', text: where };
|
|
840
|
+
}
|
|
841
|
+
/** Clause of the consent channel line: the minimum app build `rarog serve` takes from `config.json`. */
|
|
842
|
+
function thresholdText(threshold) {
|
|
843
|
+
if (threshold === undefined)
|
|
844
|
+
return '';
|
|
845
|
+
if (threshold === null)
|
|
846
|
+
return `; minimum app build: none (${MIN_CLIENT_BUILD_ENV} not set)`;
|
|
847
|
+
return `; minimum app build ${String(threshold.value)} (${threshold.source === 'default' ? 'package default' : `${MIN_CLIENT_BUILD_ENV} in config.json`})`;
|
|
848
|
+
}
|
|
849
|
+
/**
|
|
850
|
+
* Minimum app build from the server environment with the same rule as the server (`config/clients.ts`): `null` = no
|
|
851
|
+
* threshold, `undefined` = unknown (no environment, or a value the server refuses at start; the env line says so).
|
|
852
|
+
*/
|
|
853
|
+
export function thresholdOf(env) {
|
|
854
|
+
if (env === null)
|
|
855
|
+
return undefined;
|
|
856
|
+
const demo = env['RAROG_DEMO'] === '1' || env['RAROG_DEMO'] === 'true';
|
|
857
|
+
try {
|
|
858
|
+
return minClientBuildOf(env[MIN_CLIENT_BUILD_ENV], { demo }) ?? null;
|
|
859
|
+
}
|
|
860
|
+
catch {
|
|
861
|
+
return undefined;
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
/** Wzorzec ścieżki z ustawień sandboksa: `~/` od domu, `*` w obrębie członu, `**` przez człony. */
|
|
865
|
+
function socketPattern(entry, home) {
|
|
866
|
+
const full = entry.startsWith('~/') ? path.join(home, entry.slice(2)) : entry;
|
|
867
|
+
const body = full.replace(/\/+$/, '').split('**').map((part) => part.split('*').map(escapeRe).join('[^/]*'))
|
|
868
|
+
.join('.*');
|
|
869
|
+
// Wpis bez gwiazdki obejmuje samo gniazdo albo katalog nad nim.
|
|
870
|
+
return new RegExp(`^${body}(?:/.*)?$`);
|
|
871
|
+
}
|
|
872
|
+
/** Wpisy `sandbox.network`, które dają agentowi w sandboksie gniazda pod `<dataDir>/run/`. */
|
|
873
|
+
function sandboxSocketFindings(settings, home, dataDir) {
|
|
874
|
+
const sandbox = isRecord(settings['sandbox']) ? settings['sandbox'] : null;
|
|
875
|
+
const network = sandbox !== null && isRecord(sandbox['network']) ? sandbox['network'] : null;
|
|
876
|
+
if (network === null)
|
|
877
|
+
return [];
|
|
878
|
+
const found = [];
|
|
879
|
+
if (network['allowAllUnixSockets'] === true) {
|
|
880
|
+
found.push('sandbox.network.allowAllUnixSockets: true — a sandboxed agent reaches every Unix socket, also'
|
|
881
|
+
+ ' <dataDir>/run/admin.sock (the owner\'s power: pairing, rarog dialogs)');
|
|
882
|
+
}
|
|
883
|
+
const entries = Array.isArray(network['allowUnixSockets']) ? network['allowUnixSockets'] : [];
|
|
884
|
+
if (dataDir === null)
|
|
885
|
+
return found;
|
|
886
|
+
const sockets = [adminSocketPath(dataDir), path.join(path.dirname(adminSocketPath(dataDir)), CONSENT_SOCKET_FILENAME)];
|
|
887
|
+
for (const entry of entries) {
|
|
888
|
+
if (typeof entry !== 'string' || entry.trim() === '')
|
|
889
|
+
continue;
|
|
890
|
+
const pattern = socketPattern(entry.trim(), home);
|
|
891
|
+
const hit = sockets.filter((socket) => pattern.test(socket));
|
|
892
|
+
if (hit.length > 0) {
|
|
893
|
+
found.push(`sandbox.network.allowUnixSockets: ${quoted(entry)} covers ${hit.join(' and ')} — a sandboxed`
|
|
894
|
+
+ ' agent with it has the owner\'s power (admin socket) or can block channel cards (registration socket)');
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
return found;
|
|
898
|
+
}
|
|
899
|
+
/** Komendy hooków `PermissionRequest` spoza Raroga: taki hook może odpowiedzieć na ten sam dialog. */
|
|
900
|
+
function foreignPermissionHooks(settings) {
|
|
901
|
+
const hooks = isRecord(settings['hooks']) ? settings['hooks'] : null;
|
|
902
|
+
const groups = hooks === null ? null : hooks[HOOK_PERMISSION_EVENT];
|
|
903
|
+
if (!Array.isArray(groups))
|
|
904
|
+
return [];
|
|
905
|
+
const ours = new Set(rarogHookEntries(settings).filter((one) => one.event === HOOK_PERMISSION_EVENT)
|
|
906
|
+
.map((one) => one.command));
|
|
907
|
+
const found = [];
|
|
908
|
+
for (const group of groups) {
|
|
909
|
+
const list = isRecord(group) && Array.isArray(group['hooks']) ? group['hooks'] : [];
|
|
910
|
+
for (const hook of list) {
|
|
911
|
+
const command = isRecord(hook) && typeof hook['command'] === 'string' ? hook['command'] : null;
|
|
912
|
+
if (command === null || ours.has(command))
|
|
913
|
+
continue;
|
|
914
|
+
const shown = command.length > 100 ? `${command.slice(0, 100)}…` : command;
|
|
915
|
+
found.push(`another ${HOOK_PERMISSION_EVENT} hook: ${quoted(shown)} — it can answer the same dialog`);
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
return found;
|
|
919
|
+
}
|
|
920
|
+
/**
|
|
921
|
+
* Linia ustawień Claude Code wobec kanału zgód (`~/.claude/settings.json`, tylko odczyt): sandbox z dostępem do
|
|
922
|
+
* gniazd pod `<dataDir>/run/` i drugi hook `PermissionRequest` = „uwaga”; doctor nie widzi ustawień
|
|
923
|
+
* projektów, więc to ostrzeżenie, nie zabezpieczenie. Czysto albo brak pliku = „info”.
|
|
924
|
+
*/
|
|
925
|
+
export function channelSettingsLine(home, dataDir) {
|
|
926
|
+
const settings = userSettingsPath(home);
|
|
927
|
+
let parsed = null;
|
|
928
|
+
try {
|
|
929
|
+
const read = readRegularFileSync(settings, { maxBytes: 4 * 1024 * 1024, followSymlink: true });
|
|
930
|
+
parsed = read === null ? null : JSON.parse(read.bytes.toString('utf8'));
|
|
931
|
+
}
|
|
932
|
+
catch (failure) {
|
|
933
|
+
if (errnoCode(failure) !== 'ENOENT') {
|
|
934
|
+
return { verdict: 'unknown', text: `consent channel settings: ${settings} unreadable (${errnoCode(failure)})` };
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
if (!isRecord(parsed)) {
|
|
938
|
+
return { verdict: 'info', text: `consent channel settings: no ${settings}` };
|
|
939
|
+
}
|
|
940
|
+
const sandbox = sandboxSocketFindings(parsed, home, dataDir);
|
|
941
|
+
const foreign = foreignPermissionHooks(parsed);
|
|
942
|
+
if (sandbox.length === 0 && foreign.length === 0) {
|
|
943
|
+
const runDir = dataDir === null ? '<dataDir>/run' : path.dirname(adminSocketPath(dataDir));
|
|
944
|
+
return {
|
|
945
|
+
verdict: 'info',
|
|
946
|
+
text: `consent channel settings: no sandbox access to ${runDir}/ and no other ${HOOK_PERMISSION_EVENT}`
|
|
947
|
+
+ ` hook in ${settings}`,
|
|
948
|
+
};
|
|
949
|
+
}
|
|
950
|
+
const repairs = [
|
|
951
|
+
...(sandbox.length > 0 ? ['remove that sandbox entry from ~/.claude/settings.json (doctor warns, it does not'
|
|
952
|
+
+ ' protect: project settings stay unseen)'] : []),
|
|
953
|
+
...(foreign.length > 0 ? [`remove the other ${HOOK_PERMISSION_EVENT} hook, or expect its answers as unmatched in`
|
|
954
|
+
+ ' the channel audit'] : []),
|
|
955
|
+
];
|
|
956
|
+
return {
|
|
957
|
+
verdict: 'warn',
|
|
958
|
+
text: `consent channel settings: ${[...sandbox.length > 0 ? ['sandbox reaches <dataDir>/run/'] : [],
|
|
959
|
+
...foreign.length > 0 ? [`${String(foreign.length)} other ${HOOK_PERMISSION_EVENT} hook(s)`] : []].join(', ')}`
|
|
960
|
+
+ ` in ${settings}`,
|
|
961
|
+
details: [...sandbox, ...foreign],
|
|
962
|
+
repair: repairs.join('; '),
|
|
963
|
+
};
|
|
964
|
+
}
|
|
965
|
+
function statusLineLine(home, now) {
|
|
966
|
+
const settings = userSettingsPath(home);
|
|
967
|
+
let command;
|
|
968
|
+
try {
|
|
969
|
+
const read = readRegularFileSync(settings, { maxBytes: 4 * 1024 * 1024, followSymlink: true });
|
|
970
|
+
const parsed = read === null ? null : JSON.parse(read.bytes.toString('utf8'));
|
|
971
|
+
command = isRecord(parsed) && isRecord(parsed['statusLine']) ? parsed['statusLine']['command'] : undefined;
|
|
972
|
+
}
|
|
973
|
+
catch (failure) {
|
|
974
|
+
const code = errnoCode(failure);
|
|
975
|
+
if (code !== 'ENOENT' && !(failure instanceof SyntaxError)) {
|
|
976
|
+
return { verdict: 'unknown', text: `statusLine: ${settings} unreadable (${code})` };
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
const repair = 'run rarog setup in your own terminal: it sets statusLine in ~/.claude/settings.json to the Rarog'
|
|
980
|
+
+ ' script, which dumps the payload to ~/.claude/statusline/<session>.json, after one question, d shows the'
|
|
981
|
+
+ ' diff (block to paste instead: rarog hooks statusline)';
|
|
982
|
+
if (typeof command !== 'string' || command.trim() === '') {
|
|
983
|
+
return {
|
|
984
|
+
verdict: 'bad', text: 'statusLine: missing in ~/.claude/settings.json — the app will not show usage', repair,
|
|
985
|
+
};
|
|
986
|
+
}
|
|
987
|
+
// Komenda wskazuje kopię skryptu Raroga: kopia różna od repo albo jej brak to `stale`, jak przy hooku.
|
|
988
|
+
// Własna komenda użytkownika tego sprawdzenia nie dostaje — kopia skryptu jej nie dotyczy.
|
|
989
|
+
if (command.includes(STATUSLINE_INSTALLED_SCRIPT_REL) && !statuslineCopyReport(home).ok) {
|
|
990
|
+
return {
|
|
991
|
+
verdict: 'bad',
|
|
992
|
+
text: 'statusLine: stale — the command points to the script copy in ~/.claude/hooks/rarog, and the copy'
|
|
993
|
+
+ ' differs from the repo or is missing',
|
|
994
|
+
repair: 'review rarog hooks doctor, then run rarog hooks install in your own terminal (outside the Claude'
|
|
995
|
+
+ ' Code sandbox)',
|
|
996
|
+
};
|
|
997
|
+
}
|
|
998
|
+
// Ta sama reguła świeżości co pisarz ustawień (`rarog setup`, krok 7): `newestStatuslineDump` w `hook-config.ts`.
|
|
999
|
+
const dir = statuslineDumpDir(home);
|
|
1000
|
+
const dump = newestStatuslineDump(home);
|
|
1001
|
+
if ('code' in dump)
|
|
1002
|
+
return { verdict: 'unknown', text: `statusLine: ${dir} unreadable (${dump.code})` };
|
|
1003
|
+
const { newest } = dump;
|
|
1004
|
+
if (newest === null) {
|
|
1005
|
+
return { verdict: 'unknown', text: `statusLine: command "${command}", but ${dir} has no dump` };
|
|
1006
|
+
}
|
|
1007
|
+
const age = Math.max(0, Math.round((now - newest) / 1000));
|
|
1008
|
+
return now - newest <= STATUSLINE_FRESH_MS
|
|
1009
|
+
? { verdict: 'ok', text: `statusLine: command "${command}", last dump ${String(age)} s ago` }
|
|
1010
|
+
: { verdict: 'unknown', text: `statusLine: command "${command}", last dump ${String(age)} s ago (no session`
|
|
1011
|
+
+ ' worked in the last hour?)' };
|
|
1012
|
+
}
|
|
1013
|
+
function herdrSocketLine(expected, home, start) {
|
|
1014
|
+
const configured = expected?.[HERDR_SOCKET_ENV] ?? '';
|
|
1015
|
+
const socket = configured !== '' ? configured : defaultHerdrSocket(home);
|
|
1016
|
+
try {
|
|
1017
|
+
const stats = lstatSync(socket);
|
|
1018
|
+
return stats.isSocket()
|
|
1019
|
+
? { verdict: 'ok', text: `herdr socket: ${socket}` }
|
|
1020
|
+
: { verdict: 'bad', text: `herdr socket: ${socket} is not a socket`, repair: 'check RAROG_HERDR_SOCKET' };
|
|
1021
|
+
}
|
|
1022
|
+
catch (failure) {
|
|
1023
|
+
const code = errnoCode(failure);
|
|
1024
|
+
return code === 'ENOENT'
|
|
1025
|
+
? { verdict: 'bad', text: `herdr socket: ${socket} missing — herdr is not running`, repair: start }
|
|
1026
|
+
: { verdict: 'unknown', text: `herdr socket: ${socket} unreadable (${code})` };
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
/**
|
|
1030
|
+
* Pierwszy `rarog` w `PATH`. W paczce npm wejście `…/bin/rarog.mjs` innej instalacji (dowiązanie klonu
|
|
1031
|
+
* `~/.local/bin/rarog` przed katalogiem poleceń menedżera) = „uwaga”: `rarog` z powłoki uruchamiałby tamten kod.
|
|
1032
|
+
* Polecenie pnpm to skrypt sh, nie dowiązanie, więc jego wejścia stąd nie widać i nie ocenia się go.
|
|
1033
|
+
*/
|
|
1034
|
+
export function rarogInPathLine(io, home, mode = INSTALL_MODE, bin = RAROG_BIN) {
|
|
1035
|
+
const dirs = (io.env['PATH'] ?? '').split(':').filter((dir) => dir !== '');
|
|
1036
|
+
for (const dir of dirs) {
|
|
1037
|
+
const candidate = path.join(dir, 'rarog');
|
|
1038
|
+
try {
|
|
1039
|
+
accessSync(candidate, constants.X_OK);
|
|
1040
|
+
}
|
|
1041
|
+
catch {
|
|
1042
|
+
continue;
|
|
1043
|
+
}
|
|
1044
|
+
let real = candidate;
|
|
1045
|
+
try {
|
|
1046
|
+
real = realpathSync(candidate);
|
|
1047
|
+
}
|
|
1048
|
+
catch {
|
|
1049
|
+
// Zostaje ścieżka w PATH.
|
|
1050
|
+
}
|
|
1051
|
+
const text = `rarog in PATH: ${candidate}${real !== candidate ? ` → ${real}` : ''}`;
|
|
1052
|
+
if (mode === 'package' && real.endsWith('/bin/rarog.mjs') && !sameRealpath(real, bin)) {
|
|
1053
|
+
return {
|
|
1054
|
+
verdict: 'warn', text: `${text}, but this installation is ${bin} — it shadows the package`,
|
|
1055
|
+
repair: `remove the other installation's symlink (rm ${candidate}) or reorder PATH`,
|
|
1056
|
+
};
|
|
1057
|
+
}
|
|
1058
|
+
return { verdict: 'ok', text };
|
|
1059
|
+
}
|
|
1060
|
+
if (mode === 'package')
|
|
1061
|
+
return { verdict: 'bad', text: 'rarog in PATH: missing', repair: packageBinRepair(bin) };
|
|
1062
|
+
const link = rarogLinkPath(home);
|
|
1063
|
+
if (existsSync(link)) {
|
|
1064
|
+
return {
|
|
1065
|
+
verdict: 'bad', text: `rarog in PATH: symlink ${link} exists, but ${path.dirname(link)} is not in PATH`,
|
|
1066
|
+
repair: `add ${path.dirname(link)} to PATH in your shell profile`,
|
|
1067
|
+
};
|
|
1068
|
+
}
|
|
1069
|
+
return {
|
|
1070
|
+
verdict: 'bad', text: 'rarog in PATH: missing',
|
|
1071
|
+
repair: `rarog service install creates the symlink ${link} → ${bin}; until then ${REPAIR.cli}`,
|
|
1072
|
+
};
|
|
1073
|
+
}
|
|
1074
|
+
/**
|
|
1075
|
+
* Naprawa braku `rarog` w `PATH` paczki: polecenie kładzie menedżer w swoim katalogu poleceń, nie `service install`
|
|
1076
|
+
* w `~/.local/bin`. npm: `<prefiks>/bin` ({@link npmBinDir}); pnpm: katalog z `pnpm bin -g`; menedżer nieznany = obie
|
|
1077
|
+
* rady.
|
|
1078
|
+
*/
|
|
1079
|
+
function packageBinRepair(bin) {
|
|
1080
|
+
const root = path.dirname(path.dirname(bin));
|
|
1081
|
+
const manager = packageManagerOf(root);
|
|
1082
|
+
const npmBin = manager === 'npm' ? npmBinDir(root) : null;
|
|
1083
|
+
if (npmBin !== null) {
|
|
1084
|
+
return `add ${npmBin} (the npm bin directory: npm prefix -g, then /bin) to PATH in your shell profile`;
|
|
1085
|
+
}
|
|
1086
|
+
if (manager === 'pnpm')
|
|
1087
|
+
return 'add the pnpm bin directory (pnpm bin -g) to PATH in your shell profile';
|
|
1088
|
+
return 'add the package manager bin directory to PATH (npm: npm prefix -g, then /bin; pnpm: pnpm bin -g)';
|
|
1089
|
+
}
|
|
1090
|
+
function sameRealpath(a, b) {
|
|
1091
|
+
try {
|
|
1092
|
+
return realpathSync(a) === realpathSync(b);
|
|
1093
|
+
}
|
|
1094
|
+
catch {
|
|
1095
|
+
return a === b;
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
/** Prawo zapisu katalogu dla tego procesu. */
|
|
1099
|
+
function writableDir(dir) {
|
|
1100
|
+
try {
|
|
1101
|
+
accessSync(dir, constants.W_OK);
|
|
1102
|
+
return true;
|
|
1103
|
+
}
|
|
1104
|
+
catch {
|
|
1105
|
+
return false;
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
/**
|
|
1109
|
+
* Tryb i katalog tej instalacji z wersją, w paczce z menedżerem (`install/repair.ts`): „info”. Katalog pod domem to
|
|
1110
|
+
* dopisek (sesja agenta z zapisem w domu może zmienić kod, który usługa uruchamia poza sandboksem). W paczce katalog
|
|
1111
|
+
* nadrzędny bez prawa zapisu = „uwaga”: aktualizacja menedżerem padnie na EACCES.
|
|
1112
|
+
*/
|
|
1113
|
+
export function installationLine(input) {
|
|
1114
|
+
const { mode, root, home } = input;
|
|
1115
|
+
const manager = mode === 'package' ? packageManagerOf(root) : null;
|
|
1116
|
+
const kind = mode === 'clone' ? 'repo clone' : `npm package${manager === null ? '' : ` (${manager})`}`;
|
|
1117
|
+
const text = `installation: ${kind} ${root}, version ${input.version}`;
|
|
1118
|
+
const details = [];
|
|
1119
|
+
if (root === home || root.startsWith(`${home}${path.sep}`)) {
|
|
1120
|
+
details.push(`installation directory under ${home}: a Claude Code session with write access to the home`
|
|
1121
|
+
+ ' directory can change the code the service runs outside the sandbox'
|
|
1122
|
+
+ (mode === 'package' ? '; Node outside the home directory (e.g. Homebrew) narrows this' : ''));
|
|
1123
|
+
}
|
|
1124
|
+
const parent = path.dirname(root);
|
|
1125
|
+
if (mode === 'package' && !input.writable(parent)) {
|
|
1126
|
+
return {
|
|
1127
|
+
verdict: 'warn', text, ...(details.length > 0 ? { details } : {}),
|
|
1128
|
+
repair: `${parent} is not writable — ${packageCommands(manager, root).update} will fail with EACCES; use a Node`
|
|
1129
|
+
+ ' version manager (e.g. nvm), not sudo',
|
|
1130
|
+
};
|
|
1131
|
+
}
|
|
1132
|
+
return { verdict: 'info', text, ...(details.length > 0 ? { details } : {}) };
|
|
1133
|
+
}
|
|
1134
|
+
/**
|
|
1135
|
+
* Katalog danych z tej powłoki wobec katalogu usługi (`install/data-dir.ts`, bez katalogu logu usługi — ten
|
|
1136
|
+
* sprawdza linia usługi): rozjazd = czerwone, bo hook w sesjach Claude z tej powłoki liczyłby inny katalog niż
|
|
1137
|
+
* serwer. Wystąpienia próbnego (`--data-dir`) nie dotyczy.
|
|
1138
|
+
*/
|
|
1139
|
+
function withShellDataDir(line, io, home, flag) {
|
|
1140
|
+
if (flag !== undefined || line.verdict === 'bad')
|
|
1141
|
+
return line;
|
|
1142
|
+
const resolved = installDataDir({ home, shellEnv: io.env, serviceEnv: launchdEnv(io.env),
|
|
1143
|
+
reinstall: rarogCli('service install') });
|
|
1144
|
+
if (resolved.ok)
|
|
1145
|
+
return line;
|
|
1146
|
+
return {
|
|
1147
|
+
verdict: 'bad', text: `${line.text}; this shell computes a different directory`, details: [resolved.message],
|
|
1148
|
+
repair: 'run Claude sessions and rarog without the data directory variables of this shell',
|
|
1149
|
+
};
|
|
1150
|
+
}
|
|
1151
|
+
// ---------------------------------------------------------------------------
|
|
1152
|
+
// Nasłuch iroh
|
|
1153
|
+
// ---------------------------------------------------------------------------
|
|
1154
|
+
const ADMIN_TIMEOUT_MS = 3_000;
|
|
1155
|
+
/** Sufit odpowiedzi gniazda administracyjnego: stan nasłuchu to kilkaset bajtów. */
|
|
1156
|
+
const ADMIN_MAX_BYTES = 256 * 1024;
|
|
1157
|
+
/** Skrót EndpointId w linii, jak etykieta `iroh:<id>` w logach serwera. */
|
|
1158
|
+
const SHORT_ENDPOINT_ID = 12;
|
|
1159
|
+
/**
|
|
1160
|
+
* How long to wait for the first contact with the relay before the line turns into a warning. Until then the
|
|
1161
|
+
* library retries the connection itself, so no contact is not an error yet.
|
|
1162
|
+
*/
|
|
1163
|
+
const RELAY_CONTACT_WAIT_S = 120;
|
|
1164
|
+
/** `GET` przez gniazdo administracyjne serwera (`<dataDir>/run/admin.sock`); ciało JSON albo `null`. */
|
|
1165
|
+
function readAdmin(socketPath, route) {
|
|
1166
|
+
return new Promise((resolve) => {
|
|
1167
|
+
let settled = false;
|
|
1168
|
+
const settle = (value) => {
|
|
1169
|
+
if (settled)
|
|
1170
|
+
return;
|
|
1171
|
+
settled = true;
|
|
1172
|
+
resolve(value);
|
|
1173
|
+
};
|
|
1174
|
+
const fail = (failure) => {
|
|
1175
|
+
const code = errnoCode(failure);
|
|
1176
|
+
settle({ failure: code, denied: code === 'EACCES' || code === 'EPERM' });
|
|
1177
|
+
};
|
|
1178
|
+
const req = http.request({ socketPath, path: route, method: 'GET', timeout: ADMIN_TIMEOUT_MS }, (res) => {
|
|
1179
|
+
const chunks = [];
|
|
1180
|
+
let size = 0;
|
|
1181
|
+
res.on('data', (chunk) => {
|
|
1182
|
+
size += chunk.length;
|
|
1183
|
+
if (size <= ADMIN_MAX_BYTES) {
|
|
1184
|
+
chunks.push(chunk);
|
|
1185
|
+
return;
|
|
1186
|
+
}
|
|
1187
|
+
fail(Object.assign(new Error('response too large'), { code: 'E2BIG' }));
|
|
1188
|
+
req.destroy();
|
|
1189
|
+
});
|
|
1190
|
+
res.on('end', () => {
|
|
1191
|
+
let parsed = null;
|
|
1192
|
+
try {
|
|
1193
|
+
parsed = JSON.parse(Buffer.concat(chunks).toString('utf8'));
|
|
1194
|
+
}
|
|
1195
|
+
catch {
|
|
1196
|
+
parsed = null;
|
|
1197
|
+
}
|
|
1198
|
+
settle({ status: res.statusCode ?? 0, body: isRecord(parsed) ? parsed : null });
|
|
1199
|
+
});
|
|
1200
|
+
res.on('error', fail);
|
|
1201
|
+
// Połączenie zerwane po nagłówkach nie daje ani `end`, ani `error` żądania (Node 22: samo
|
|
1202
|
+
// `aborted` i `close`), a obietnica bez rozstrzygnięcia kończy `doctor` kodem 13 bez raportu.
|
|
1203
|
+
res.on('close', () => {
|
|
1204
|
+
if (!res.complete)
|
|
1205
|
+
fail(Object.assign(new Error('response cut off'), { code: 'ECONNRESET' }));
|
|
1206
|
+
});
|
|
1207
|
+
});
|
|
1208
|
+
req.on('timeout', () => { req.destroy(Object.assign(new Error('timeout'), { code: 'ETIMEDOUT' })); });
|
|
1209
|
+
req.on('error', fail);
|
|
1210
|
+
req.end();
|
|
1211
|
+
});
|
|
1212
|
+
}
|
|
1213
|
+
/** Paczka i moduł platformy z manifestów (bez ładowania kodu natywnego) albo powód, czemu nie wiadomo. */
|
|
1214
|
+
function moduleInfo() {
|
|
1215
|
+
try {
|
|
1216
|
+
return irohModuleInfo();
|
|
1217
|
+
}
|
|
1218
|
+
catch (failure) {
|
|
1219
|
+
return { failure: failure instanceof Error ? failure.message : String(failure) };
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
/**
|
|
1223
|
+
* The native module's description for the line and whether it looks ready (the manifests of the package and of the
|
|
1224
|
+
* platform package are on disk). The same description picks the transport in `rarog setup`.
|
|
1225
|
+
*/
|
|
1226
|
+
export function describeModule(info) {
|
|
1227
|
+
if ('failure' in info)
|
|
1228
|
+
return { text: `package manifest ${IROH_PACKAGE} unreadable (${info.failure})`, ready: false };
|
|
1229
|
+
if (info.version === null)
|
|
1230
|
+
return { text: `package ${IROH_PACKAGE} missing`, ready: false };
|
|
1231
|
+
const main = `package ${IROH_PACKAGE} ${info.version}`;
|
|
1232
|
+
if (info.platformPackage === null)
|
|
1233
|
+
return { text: `${main}, but ${irohPlatform()} has no native module`, ready: false };
|
|
1234
|
+
if (info.platformVersion === null)
|
|
1235
|
+
return { text: `${main}, but ${info.platformPackage} is missing`, ready: false };
|
|
1236
|
+
return { text: `${main}, module ${info.platformPackage} ${info.platformVersion}`, ready: true };
|
|
1237
|
+
}
|
|
1238
|
+
const count = (value) => (typeof value === 'number' && Number.isFinite(value) ? value : 0);
|
|
1239
|
+
const strings = (value) => (Array.isArray(value) ? value.filter((item) => typeof item === 'string') : []);
|
|
1240
|
+
/**
|
|
1241
|
+
* The listener runs (`enabled: true` from the server): green with a relay, yellow without a relay address. The sign
|
|
1242
|
+
* that the relay admitted the server is the first contact (`relayContact.firstContactAt`, the library's `online()`
|
|
1243
|
+
* resolved): without it the line waits {@link RELAY_CONTACT_WAIT_S} s as `info`, then it is a warning. A server
|
|
1244
|
+
* without the field (older code) and a server after the contact get the line from the home relay address.
|
|
1245
|
+
*/
|
|
1246
|
+
function listeningLine(status, configured, now) {
|
|
1247
|
+
const id = typeof status['endpointId'] === 'string' ? status['endpointId'] : '?';
|
|
1248
|
+
const home = isRecord(status['homeRelay']) ? status['homeRelay'] : {};
|
|
1249
|
+
const relays = strings(home['relays']);
|
|
1250
|
+
const since = typeof home['since'] === 'string' ? Date.parse(home['since']) : Number.NaN;
|
|
1251
|
+
const age = Number.isNaN(since) ? null : Math.max(0, Math.round((now - since) / 1000));
|
|
1252
|
+
const conns = isRecord(status['connections']) ? status['connections'] : {};
|
|
1253
|
+
const connText = `connections: ${String(count(conns['authenticated']))} with a device,`
|
|
1254
|
+
+ ` ${String(count(conns['unauthenticated']))} without`;
|
|
1255
|
+
const sockets = strings(status['boundSockets']);
|
|
1256
|
+
const details = [];
|
|
1257
|
+
if (!configured)
|
|
1258
|
+
details.push(`the config has no ${IROH_ENV}=1 — after a restart the server will not listen on iroh`);
|
|
1259
|
+
const pending = count(status['pendingCloseOps']);
|
|
1260
|
+
if (pending > 0) {
|
|
1261
|
+
details.push(`stream close operations in progress: ${String(pending)} (growing between doctor runs =`
|
|
1262
|
+
+ ' the library is stuck)');
|
|
1263
|
+
}
|
|
1264
|
+
const head = `iroh: listener running, EndpointId ${id.slice(0, SHORT_ENDPOINT_ID)}…`;
|
|
1265
|
+
const contact = isRecord(status['relayContact']) ? status['relayContact'] : null;
|
|
1266
|
+
const startedAt = typeof contact?.['startedAt'] === 'string' ? Date.parse(contact['startedAt']) : Number.NaN;
|
|
1267
|
+
if (contact !== null && contact['firstContactAt'] === null && !Number.isNaN(startedAt)) {
|
|
1268
|
+
const waited = Math.max(0, Math.round((now - startedAt) / 1000));
|
|
1269
|
+
const relayName = typeof status['relay'] === 'string' ? status['relay'] : '?';
|
|
1270
|
+
if (waited < RELAY_CONTACT_WAIT_S) {
|
|
1271
|
+
return {
|
|
1272
|
+
verdict: 'info',
|
|
1273
|
+
text: `${head}, waiting for the first contact with relay ${relayName} (${String(waited)} s since start);`
|
|
1274
|
+
+ ` ${connText}`,
|
|
1275
|
+
...(details.length > 0 ? { details } : {}),
|
|
1276
|
+
};
|
|
1277
|
+
}
|
|
1278
|
+
return {
|
|
1279
|
+
verdict: 'warn',
|
|
1280
|
+
text: `${head}, but relay ${relayName} has not accepted the connection for ${String(waited)} s; ${connText}`,
|
|
1281
|
+
details: ['until the first contact with the relay only devices with a direct UDP path connect', ...details],
|
|
1282
|
+
repair: `check the address in ${IROH_RELAY_ENV} (DNS, HTTPS, firewall); a relay that admits only registered`
|
|
1283
|
+
+ ' servers lets this server in after a device pairs with it (rarog pair)',
|
|
1284
|
+
};
|
|
1285
|
+
}
|
|
1286
|
+
if (relays.length > 0) {
|
|
1287
|
+
return {
|
|
1288
|
+
verdict: 'ok',
|
|
1289
|
+
text: `${head}, relay ${relays.join(' ')} (${age === null ? 'no events since start' : `last event`
|
|
1290
|
+
+ ` ${String(age)} s ago`}), ${connText}${sockets.length > 0 ? `, UDP ${sockets.join(' ')}` : ''}`,
|
|
1291
|
+
...(details.length > 0 ? { details } : {}),
|
|
1292
|
+
};
|
|
1293
|
+
}
|
|
1294
|
+
const relay = typeof status['relay'] === 'string' ? ` ${status['relay']}` : '';
|
|
1295
|
+
return {
|
|
1296
|
+
verdict: 'warn',
|
|
1297
|
+
text: `${head}, but no relay address ${age === null ? 'since server start' : `for ${String(age)} s`}; ${connText}`,
|
|
1298
|
+
details: [
|
|
1299
|
+
`the iroh library reports only the relay address, not the connection state: a missing address is the only`
|
|
1300
|
+
+ ` sign that relay${relay} is unreachable (right after start, contact takes a few seconds)`,
|
|
1301
|
+
...details,
|
|
1302
|
+
],
|
|
1303
|
+
repair: `check ${IROH_RELAY_ENV} and the route to the relay (DNS, HTTPS, firewall); without a relay only`
|
|
1304
|
+
+ ' devices with a direct UDP path connect; run rarog doctor again in a moment',
|
|
1305
|
+
};
|
|
1306
|
+
}
|
|
1307
|
+
/**
|
|
1308
|
+
* Linia „iroh” (`docs/server-config.md`, „iroh listener”): stan z `GET /api/admin/iroh` żywego serwera (bez klucza; doctor nie czyta
|
|
1309
|
+
* `RAROG_IROH_KEY` ani pliku klucza) i flaga z konfiguracji. Wyłączone = „info” z paczką z manifestu; włączone
|
|
1310
|
+
* i słucha = zielone albo żółte (bez adresu relaya); włączone bez nasłuchu albo modułu = czerwone. Gniazdo
|
|
1311
|
+
* niedostępne (sandbox) przy włączonym = „nie wiem”.
|
|
1312
|
+
*/
|
|
1313
|
+
export function irohLineOf(input) {
|
|
1314
|
+
const { flag, socket, read, now } = input;
|
|
1315
|
+
if (flag !== '' && flag !== '0' && flag !== '1') {
|
|
1316
|
+
return {
|
|
1317
|
+
verdict: 'bad', text: `iroh: ${IROH_ENV}=${flag} — the server accepts 1 or 0 and will not start`,
|
|
1318
|
+
repair: 'fix ~/.config/rarog/config.json',
|
|
1319
|
+
};
|
|
1320
|
+
}
|
|
1321
|
+
const configured = flag === '1';
|
|
1322
|
+
if (read !== null && 'status' in read && read.status === 200 && read.body?.['enabled'] === true) {
|
|
1323
|
+
return listeningLine(read.body, configured, now);
|
|
1324
|
+
}
|
|
1325
|
+
if (!configured) {
|
|
1326
|
+
return { verdict: 'info', text: `iroh: off (${IROH_ENV} is not 1); ${describeModule(input.module()).text}` };
|
|
1327
|
+
}
|
|
1328
|
+
if (socket === null || read === null) {
|
|
1329
|
+
return {
|
|
1330
|
+
verdict: 'unknown',
|
|
1331
|
+
text: `iroh: ${IROH_ENV}=1, but the data directory is in conflict — admin socket location unknown`,
|
|
1332
|
+
};
|
|
1333
|
+
}
|
|
1334
|
+
if ('failure' in read && read.denied) {
|
|
1335
|
+
return {
|
|
1336
|
+
verdict: 'unknown',
|
|
1337
|
+
text: `iroh: ${IROH_ENV}=1, admin socket ${socket} not accessible (${read.failure}) — inside an agent`
|
|
1338
|
+
+ ' session sandbox, run doctor in a regular terminal',
|
|
1339
|
+
};
|
|
1340
|
+
}
|
|
1341
|
+
const reason = 'failure' in read
|
|
1342
|
+
? `the server does not respond on the admin socket ${socket} (${read.failure})`
|
|
1343
|
+
: read.status === 404 ? 'the server does not know GET /api/admin/iroh (code older than the iroh listener)'
|
|
1344
|
+
: read.status === 200 && read.body?.['enabled'] === false
|
|
1345
|
+
? 'the server runs without the iroh listener (started before the config change?)'
|
|
1346
|
+
: `GET /api/admin/iroh: HTTP ${String(read.status)} without listener state`;
|
|
1347
|
+
const module = describeModule(input.module());
|
|
1348
|
+
if (!module.ready) {
|
|
1349
|
+
return {
|
|
1350
|
+
verdict: 'bad', text: `iroh: ${IROH_ENV}=1, but the native module is missing: ${module.text}`, details: [reason],
|
|
1351
|
+
repair: `${REPAIR.dependencies}${INSTALL_MODE === 'clone' ? ' in the repo' : ''}, then rarog serve --check`
|
|
1352
|
+
+ ` (loads the module) and rarog restart; an Intel Mac has no module: ${IROH_ENV}=0`,
|
|
1353
|
+
};
|
|
1354
|
+
}
|
|
1355
|
+
return {
|
|
1356
|
+
verdict: 'bad', text: `iroh: ${IROH_ENV}=1, but no listener — ${reason}`,
|
|
1357
|
+
repair: 'rarog serve --check (loads the native module), then rarog restart; the start failure cause is in'
|
|
1358
|
+
+ ' server.log in the data directory',
|
|
1359
|
+
};
|
|
1360
|
+
}
|
|
1361
|
+
const sizeText = (bytes) => `${(bytes / 1_000_000).toFixed(1)} MB`;
|
|
1362
|
+
/**
|
|
1363
|
+
* Linia „SDK”: SDK Claude listy sesji (`install/sdk.ts`). Klon repo: z workspace. Paczka: wersja wymagana, katalog,
|
|
1364
|
+
* obecność, wynik sondy, pozostałe wersje z rozmiarem (bez porady kasowania: stary katalog może czytać działający
|
|
1365
|
+
* proces albo poprzednia wersja Raroga po powrocie) i stan z `/health`. Brak albo błąd = czerwona z `rarog setup`;
|
|
1366
|
+
* pobrany SDK przy serwerze, który mówi coś innego niż `ok` = czerwona z `rarog restart`.
|
|
1367
|
+
*/
|
|
1368
|
+
export function sdkLineOf(input) {
|
|
1369
|
+
const { mode, pinned, dataDir, versions, probe, health } = input;
|
|
1370
|
+
const fromHealth = health === null ? '' : ` (/health: ${health})`;
|
|
1371
|
+
if (mode === 'clone') {
|
|
1372
|
+
// `missing` w klonie mówi tylko serwer demo (SDK nie ładuje), więc czerwone jest wyłącznie `error`.
|
|
1373
|
+
if (health === 'error') {
|
|
1374
|
+
return {
|
|
1375
|
+
verdict: 'bad', text: `SDK: from the workspace, but the server says /health sdk: ${health}`,
|
|
1376
|
+
repair: `${REPAIR.dependencies}, then rarog restart; cause in the "sdk:" line of server.log in the data`
|
|
1377
|
+
+ ' directory',
|
|
1378
|
+
};
|
|
1379
|
+
}
|
|
1380
|
+
return { verdict: 'ok', text: `SDK: from the workspace (${SDK_PACKAGE} ${pinned})${fromHealth}` };
|
|
1381
|
+
}
|
|
1382
|
+
if (dataDir === null) {
|
|
1383
|
+
return { verdict: 'unknown', text: `SDK ${pinned}: data directory in conflict — location unknown` };
|
|
1384
|
+
}
|
|
1385
|
+
const dir = sdkVersionDir(dataDir, pinned);
|
|
1386
|
+
const others = versions.filter((entry) => entry.version !== pinned);
|
|
1387
|
+
const details = others.length === 0 ? [] : [`other versions in ${path.dirname(dir)}: ${others
|
|
1388
|
+
.map((entry) => `${entry.version} (${sizeText(entry.bytes)})`).join(', ')}`];
|
|
1389
|
+
const setup = rarogCli('setup', mode);
|
|
1390
|
+
const present = versions.find((entry) => entry.version === pinned);
|
|
1391
|
+
if (present === undefined) {
|
|
1392
|
+
const installed = others[0]?.version;
|
|
1393
|
+
return {
|
|
1394
|
+
verdict: 'bad',
|
|
1395
|
+
text: installed === undefined
|
|
1396
|
+
? `SDK ${pinned}: missing in ${dir} — the Recent sessions list in the app is empty${fromHealth}`
|
|
1397
|
+
: `SDK ${pinned} missing, ${installed} installed — after a restart the server runs the old SDK${fromHealth}`,
|
|
1398
|
+
details, repair: setup,
|
|
1399
|
+
};
|
|
1400
|
+
}
|
|
1401
|
+
if (probe !== null && !probe.ok) {
|
|
1402
|
+
return {
|
|
1403
|
+
verdict: 'bad', text: `SDK ${pinned} (${dir}): probe failed — ${probe.reason}${fromHealth}`, details,
|
|
1404
|
+
repair: `${setup} (shows the directory state; does not change an existing one)`,
|
|
1405
|
+
};
|
|
1406
|
+
}
|
|
1407
|
+
if (health !== null && health !== 'ok') {
|
|
1408
|
+
return {
|
|
1409
|
+
verdict: 'bad', text: `SDK ${pinned} downloaded (${dir}), but the server says /health sdk: ${health} — it`
|
|
1410
|
+
+ ' started before the download or with another data directory', details, repair: rarogCli('restart', mode),
|
|
1411
|
+
};
|
|
1412
|
+
}
|
|
1413
|
+
return { verdict: 'ok', text: `SDK ${pinned}: ${dir} (${sizeText(present.bytes)})${fromHealth}`, details };
|
|
1414
|
+
}
|
|
1415
|
+
/** Linia „SDK” z odczytem katalogu i sondą w osobnym procesie na środowisku usługi. */
|
|
1416
|
+
export async function sdkLine(dataDir, health, env, mode = INSTALL_MODE) {
|
|
1417
|
+
let pinned;
|
|
1418
|
+
try {
|
|
1419
|
+
pinned = readSdkPin().version;
|
|
1420
|
+
}
|
|
1421
|
+
catch (failure) {
|
|
1422
|
+
return { verdict: 'bad', text: `SDK: pin unreadable (${failure instanceof Error ? failure.message : '?'})` };
|
|
1423
|
+
}
|
|
1424
|
+
const versions = mode === 'package' && dataDir !== null
|
|
1425
|
+
? sdkVersions(dataDir).map((version) => ({ version, bytes: treeBytes(sdkVersionDir(dataDir, version)) }))
|
|
1426
|
+
: [];
|
|
1427
|
+
const probe = dataDir !== null && versions.some((entry) => entry.version === pinned)
|
|
1428
|
+
? await probeCheckedSdkDir(dataDir, pinned, (dir, version) => probeSdkDir(dir, version, env))
|
|
1429
|
+
: null;
|
|
1430
|
+
const field = health !== null && 'body' in health ? health.body['sdk'] : undefined;
|
|
1431
|
+
return sdkLineOf({ mode, pinned, dataDir, versions, probe, health: typeof field === 'string' ? field : null });
|
|
1432
|
+
}
|
|
1433
|
+
/** Linia „iroh” z odczytem: gniazdo administracyjne pytane zawsze, gdy katalog danych jest znany. */
|
|
1434
|
+
async function irohLine(built, dataDir, now) {
|
|
1435
|
+
const socket = dataDir === null ? null : adminSocketPath(dataDir);
|
|
1436
|
+
const read = socket === null ? null : await readAdmin(socket, '/api/admin/iroh');
|
|
1437
|
+
return irohLineOf({ flag: (built?.env[IROH_ENV] ?? '').trim(), socket, read, module: moduleInfo, now });
|
|
1438
|
+
}
|
|
1439
|
+
// ---------------------------------------------------------------------------
|
|
1440
|
+
// Komenda
|
|
1441
|
+
// ---------------------------------------------------------------------------
|
|
1442
|
+
function portOf(flags, built) {
|
|
1443
|
+
const raw = flags.port ?? built?.env['RAROG_PORT'] ?? '';
|
|
1444
|
+
if (raw === '')
|
|
1445
|
+
return DEFAULT_PORT;
|
|
1446
|
+
return /^[0-9]{1,5}$/.test(raw) && Number(raw) >= 1 && Number(raw) <= 65535 ? Number(raw) : null;
|
|
1447
|
+
}
|
|
1448
|
+
function print(io, lines) {
|
|
1449
|
+
for (const line of lines) {
|
|
1450
|
+
out(io, `${MARK[line.verdict]} ${line.text}`);
|
|
1451
|
+
for (const detail of line.details ?? [])
|
|
1452
|
+
out(io, ` ${detail}`);
|
|
1453
|
+
if (line.repair !== undefined && (line.verdict === 'bad' || line.verdict === 'warn')) {
|
|
1454
|
+
out(io, ` fix: ${line.repair}`);
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
/** Środowisko bez zmiennych katalogu danych (`PROCESS_NAMES`). */
|
|
1459
|
+
function withoutProcessNames(env) {
|
|
1460
|
+
const result = { ...env };
|
|
1461
|
+
for (const name of PROCESS_NAMES)
|
|
1462
|
+
Reflect.deleteProperty(result, name);
|
|
1463
|
+
return result;
|
|
1464
|
+
}
|
|
1465
|
+
/** `rarog doctor` — `argv` zaczyna się od `doctor`. */
|
|
1466
|
+
export async function doctorCommand(argv, io) {
|
|
1467
|
+
if (argv.includes('--help') || argv.includes('-h')) {
|
|
1468
|
+
out(io, usageFor(io, `Usage:\n${DOCTOR_USAGE}`));
|
|
1469
|
+
return EXIT_OK;
|
|
1470
|
+
}
|
|
1471
|
+
const flags = parseDoctorFlags(argv, io.cwd);
|
|
1472
|
+
const home = homeOf(io.env);
|
|
1473
|
+
const platform = platformOf(io);
|
|
1474
|
+
// Linux: serwer dostaje środowisko menedżera użytkownika (rarog serve pod systemd --user), więc z niego liczymy
|
|
1475
|
+
// oczekiwane — ale bez zmiennych katalogu danych, jak na macOS: hook liczy katalog bez nich, więc niepusta w serwerze
|
|
1476
|
+
// ma wyjść różnicą, a nie zgodą z menedżerem. Bez magistrali port i gniazdo herdr bierzemy jak na macOS, a linia
|
|
1477
|
+
// środowiska mówi „nie wiem”.
|
|
1478
|
+
const manager = platform === 'linux' ? managerEnvironment(io) : null;
|
|
1479
|
+
const base = manager !== null && 'env' in manager ? withoutProcessNames(manager.env) : launchdEnv(io.env);
|
|
1480
|
+
let built = null;
|
|
1481
|
+
let configIssue = null;
|
|
1482
|
+
try {
|
|
1483
|
+
built = buildServeEnv(base, {
|
|
1484
|
+
env: {}, mode: 'check',
|
|
1485
|
+
...(flags.port !== undefined ? { port: flags.port } : {}),
|
|
1486
|
+
...(flags.dataDir !== undefined ? { dataDir: flags.dataDir } : {}),
|
|
1487
|
+
});
|
|
1488
|
+
}
|
|
1489
|
+
catch (failure) {
|
|
1490
|
+
if (!(failure instanceof Refusal))
|
|
1491
|
+
throw failure;
|
|
1492
|
+
configIssue = failure.message;
|
|
1493
|
+
}
|
|
1494
|
+
const port = portOf(flags, built);
|
|
1495
|
+
const health = port === null ? null : await readHealth(port);
|
|
1496
|
+
const dataDir = resolvedDataDir(io, home, flags.dataDir);
|
|
1497
|
+
// Usługa pracuje na katalogu z reguły, nie na `--data-dir` wystąpienia próbnego.
|
|
1498
|
+
const service = serviceLine(io, home, resolvedDataDir(io, home, undefined));
|
|
1499
|
+
// `PATH` usługi liczy `rarog serve` z katalogu SWOJEGO węzła — tego z plistu (z `ExecStart`), gdy usługa jest.
|
|
1500
|
+
const expectedPath = servePath(service.node ?? process.execPath, platform);
|
|
1501
|
+
const managerFailure = manager !== null && 'failure' in manager ? manager.failure : null;
|
|
1502
|
+
const lines = [
|
|
1503
|
+
installationLine({ mode: INSTALL_MODE, root: INSTALL_ROOT, home, version: RAROG_VERSION, writable: writableDir }),
|
|
1504
|
+
healthLine(port, health, built?.env['RAROG_TERM'] === '1'),
|
|
1505
|
+
service.line,
|
|
1506
|
+
withShellDataDir(dataDirLine(io, home, flags.dataDir), io, home, flags.dataDir),
|
|
1507
|
+
await sdkLine(dataDir, health, base),
|
|
1508
|
+
envLine(io, built, configIssue, port, expectedPath, managerFailure),
|
|
1509
|
+
await irohLine(built, dataDir, Date.now()),
|
|
1510
|
+
hookLine(home, health, dataDir),
|
|
1511
|
+
consentLineOf(health, thresholdOf(built?.env ?? null)),
|
|
1512
|
+
channelSettingsLine(home, dataDir),
|
|
1513
|
+
writeBlockLine(io, home, platform, manager, flags.dataDir),
|
|
1514
|
+
statusLineLine(home, Date.now()),
|
|
1515
|
+
// A loaded herdr agent starts herdr with `launchctl kickstart` (`setup-herdr-agent.ts`).
|
|
1516
|
+
herdrSocketLine(built?.env ?? null, home, herdrAgentStart(io, home, platform) ?? 'start herdr'),
|
|
1517
|
+
...await herdrAgentDoctorLine(io, home, platform, built?.env ?? null).then((one) => (one === null ? [] : [one])),
|
|
1518
|
+
rarogInPathLine(io, home),
|
|
1519
|
+
await prStatusLine(built?.env ?? null),
|
|
1520
|
+
];
|
|
1521
|
+
out(io, `rarog doctor — port ${port === null ? '?' : String(port)}`
|
|
1522
|
+
+ `${flags.dataDir !== undefined ? `, data directory ${flags.dataDir}` : ''}:`);
|
|
1523
|
+
print(io, lines);
|
|
1524
|
+
const tally = (verdict) => lines.filter((line) => line.verdict === verdict).length;
|
|
1525
|
+
out(io, `result: ok ${String(tally('ok'))}, ERROR ${String(tally('bad'))},`
|
|
1526
|
+
+ ` unknown ${String(tally('unknown'))}, warn ${String(tally('warn'))}`);
|
|
1527
|
+
return tally('ok') + tally('info') === lines.length ? EXIT_OK : EXIT_REFUSED;
|
|
1528
|
+
}
|